@yoyaflow/yoya-ui 0.3.3 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/yoya.ssr.js DELETED
@@ -1,3444 +0,0 @@
1
- //#region src/core/access.js
2
- var e = null, t = null;
3
- function n(e) {
4
- if (!e) return null;
5
- if (typeof e == "object" && e.code) return {
6
- code: e.code,
7
- level: e.level === "write" ? "write" : "read"
8
- };
9
- let t = String(e).trim();
10
- return t ? t.startsWith("w.") ? {
11
- code: t.slice(2),
12
- level: "write"
13
- } : t.startsWith("r.") ? {
14
- code: t.slice(2),
15
- level: "read"
16
- } : {
17
- code: t,
18
- level: "write"
19
- } : null;
20
- }
21
- function r(e) {
22
- let t = n(e);
23
- return t ? t.code : String(e ?? "");
24
- }
25
- function i({ permissions: e = [], roles: t = [], superAdmins: n = ["super_admin"] } = {}) {
26
- let i = {
27
- permissions: [...e || []],
28
- roles: [...t || []],
29
- superAdmins: [...n || []]
30
- }, a = new Set(i.permissions), o = /* @__PURE__ */ new Set(), s = () => i.superAdmins.some((e) => i.roles.includes(e));
31
- function c(e, t) {
32
- return s() ? !0 : t === "write" ? a.has(`w.${e}`) || a.has(e) : a.has(`r.${e}`) || a.has(`w.${e}`) || a.has(e);
33
- }
34
- function l(e, t) {
35
- return c(r(e), t);
36
- }
37
- let u = {
38
- roles() {
39
- return i.roles.slice();
40
- },
41
- permissions() {
42
- return i.permissions.slice();
43
- },
44
- isSuper: s,
45
- has(e) {
46
- let t = r(e);
47
- return s() || a.has(`r.${t}`) || a.has(`w.${t}`) || a.has(t);
48
- },
49
- canRead(e) {
50
- return l(e, "read");
51
- },
52
- canWrite(e) {
53
- return l(e, "write");
54
- },
55
- setPermissions(e) {
56
- return i.permissions = [...e || []], a.clear(), (e || []).forEach((e) => a.add(e)), o.forEach((e) => e()), u;
57
- },
58
- subscribe(e) {
59
- return o.add(e), () => o.delete(e);
60
- }
61
- };
62
- return u;
63
- }
64
- function a(t, n) {
65
- let r = e;
66
- e = t || r;
67
- try {
68
- return n();
69
- } finally {
70
- e = r;
71
- }
72
- }
73
- function o(e) {
74
- return t = e || null, t;
75
- }
76
- function s() {
77
- return e || t;
78
- }
79
- //#endregion
80
- //#region src/core/node.js
81
- var c = Symbol.for("yoya.devtools.bridge");
82
- function l() {
83
- return typeof globalThis > "u" ? null : globalThis[c] || null;
84
- }
85
- function u() {
86
- let e = l();
87
- return e ? e.enabled() : !1;
88
- }
89
- function d(e) {
90
- let t = l();
91
- t && t.emit(e);
92
- }
93
- function f(e) {
94
- let t = l();
95
- t && t.unregister(e);
96
- }
97
- function p(e) {
98
- let t = l();
99
- t && t.captureScope(e);
100
- }
101
- function m(e) {
102
- let t = l();
103
- return t ? t.ensureId(e) : void 0;
104
- }
105
- function h(e, t, n) {
106
- let r = l();
107
- r && r.notify(e, t, n);
108
- }
109
- function g(e) {
110
- let t = l();
111
- t && t.commit(e);
112
- }
113
- var _ = /* @__PURE__ */ new Set([
114
- "checked",
115
- "disabled",
116
- "readonly",
117
- "selected"
118
- ]), v = /* @__PURE__ */ new Set([
119
- "input",
120
- "select",
121
- "textarea",
122
- "button",
123
- "fieldset",
124
- "option",
125
- "optgroup",
126
- "keygen"
127
- ]), y = /* @__PURE__ */ new Set(["input", "textarea"]), b = [];
128
- function x() {
129
- return b.length > 0 ? b[b.length - 1] : null;
130
- }
131
- function S(e, t) {
132
- b.push(e);
133
- try {
134
- return t();
135
- } finally {
136
- b.pop();
137
- }
138
- }
139
- var C = null;
140
- function w(e, t) {
141
- let n = C;
142
- C = e;
143
- try {
144
- return t();
145
- } finally {
146
- C = n;
147
- }
148
- }
149
- function T(e, t, n, r) {
150
- if (!C) throw TypeError(`vStateNode binding scope required for function value (${e}${t ? ` "${t}"` : ""})`);
151
- let i = C;
152
- i.bindings.push({
153
- commit: r,
154
- committed: !1,
155
- evaluate: () => n(i.getState()),
156
- key: t,
157
- kind: e,
158
- last: void 0
159
- });
160
- }
161
- var E = /* @__PURE__ */ new Set([
162
- "area",
163
- "base",
164
- "br",
165
- "col",
166
- "embed",
167
- "hr",
168
- "img",
169
- "input",
170
- "link",
171
- "meta",
172
- "param",
173
- "source",
174
- "track",
175
- "wbr"
176
- ]);
177
- function D(e) {
178
- return typeof e == "string" ? document.querySelector(e) : e;
179
- }
180
- function ee(e) {
181
- return String(e).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
182
- }
183
- function te(e) {
184
- return _.has(e);
185
- }
186
- function O(e, t, n) {
187
- if (n == null || n === !1) {
188
- if (e.removeAttribute(t), t in e) try {
189
- e[t] = !1;
190
- } catch {}
191
- return;
192
- }
193
- if (n === !0 || te(t)) {
194
- if (e.setAttribute(t, t), t in e) try {
195
- e[t] = !0;
196
- } catch {}
197
- return;
198
- }
199
- if (e.setAttribute(t, String(n)), t in e) try {
200
- e[t] = n;
201
- } catch {}
202
- }
203
- function ne(e) {
204
- return Object.entries(e).filter(([, e]) => e != null && e !== "").map(([e, t]) => `${re(e)}:${ee(t)}`).join("; ");
205
- }
206
- function re(e) {
207
- return String(e).replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);
208
- }
209
- function ie(e, t) {
210
- return e === t ? !0 : !e || !t || typeof e != "object" || typeof t != "object" ? !1 : !!e.capture == !!t.capture && !!e.once == !!t.once && !!e.passive == !!t.passive;
211
- }
212
- var k = class e {
213
- constructor(e = null) {
214
- this._children = [], this._childKeys = /* @__PURE__ */ new Map(), this._events = /* @__PURE__ */ new Map(), this._domAdapters = /* @__PURE__ */ new Map(), this._cleanup = [], this._states = {}, this._stateTypes = {}, this._stateHandlers = /* @__PURE__ */ new Map(), this._pendingRemovals = /* @__PURE__ */ new Set(), this._childrenDirty = !1, this._deleted = !1, this._access = null, this._accessContext = s(), u() && p(this), e !== null && this.setup(e);
215
- }
216
- setup(t) {
217
- return typeof t == "function" ? t(this) : t instanceof e ? this.child(t) : typeof t == "string" || typeof t == "number" ? this.text(t) : t && typeof t == "object" && this._setupObject(t), this;
218
- }
219
- access(e) {
220
- let t = n(e);
221
- return this._access = t ? {
222
- code: t.code,
223
- level: "write"
224
- } : null, this;
225
- }
226
- _permissionState() {
227
- let e = this._access ?? x();
228
- if (!e) return "active";
229
- let t = this._accessContext || s();
230
- return t ? t.canRead(e.code) ? e.level === "write" && !t.canWrite(e.code) ? "readonly" : "active" : "hidden" : "active";
231
- }
232
- _applyAccessState(e) {}
233
- _setupObject(e) {
234
- e.children && this.child(e.children);
235
- }
236
- children() {
237
- return [...this._children];
238
- }
239
- clearChildren() {
240
- let e = this._el && u() && !this._devtoolsRendering ? this._children.map((e) => m(e)) : [];
241
- return this._dropChildKeys(this._children), this._children.forEach((e) => {
242
- this._pendingRemovals.add(e);
243
- }), this._children = [], this._childrenDirty = !0, e.length > 0 && !this._devtoolsRendering && h(this, "child", { removed: e }), this;
244
- }
245
- addChild(e, t) {
246
- let n = String(e);
247
- if (this._childKeys.has(n)) throw TypeError(`duplicate key "${n}"`);
248
- let r = ae(t);
249
- if (this._childKeys.set(n, r), typeof r.attr == "function" && r.attr("data-row-key", n), this._pendingRemovals.delete(r), this._children.push(r), this._childrenDirty = !0, this._el) {
250
- let e = S(this._access ?? x(), () => r.renderDom());
251
- e && e.parentNode !== this._el && this._el.appendChild(e), u() && !this._devtoolsRendering && h(this, "child", { added: [m(r)] });
252
- }
253
- return this;
254
- }
255
- getChild(e) {
256
- return this._childKeys.get(String(e)) || null;
257
- }
258
- removeChild(e) {
259
- let t = String(e), n = this._childKeys.get(t);
260
- if (!n) return this;
261
- this._childKeys.delete(t);
262
- let r = this._children.indexOf(n);
263
- r !== -1 && this._children.splice(r, 1), this._childrenDirty = !0;
264
- let i = this._el && u() && !this._devtoolsRendering ? m(n) : null;
265
- return n.destroy(), i !== null && h(this, "child", { removed: [i] }), this;
266
- }
267
- _dropChildKeys(e) {
268
- let t = new Set(e);
269
- this._childKeys.forEach((e, n) => {
270
- t.has(e) && this._childKeys.delete(n);
271
- });
272
- }
273
- child(...e) {
274
- return e.flat(Infinity).forEach((e) => {
275
- if (e == null) return;
276
- let t = ae(e);
277
- this._pendingRemovals.delete(t), this._children.push(t), this._childrenDirty = !0;
278
- }), this;
279
- }
280
- text(e) {
281
- return this.child(new A(e));
282
- }
283
- on(e, t, n) {
284
- if (typeof t != "function") throw TypeError("ViewNode event handler must be a function");
285
- let r = this._events.get(e);
286
- return this._events.set(e, {
287
- handler: t,
288
- options: n
289
- }), this._el && this._bindDomAdapter(e, r?.options, n), this;
290
- }
291
- off(e) {
292
- this._events.delete(e);
293
- let t = this._domAdapters.get(e);
294
- return t && (t.cleanup(), this._removeCleanup(t.cleanup), this._domAdapters.delete(e)), this;
295
- }
296
- _bindDomAdapter(e, t, n) {
297
- let r = this._domAdapters.get(e);
298
- if (r) {
299
- if (ie(t, n)) return;
300
- r.cleanup(), this._removeCleanup(r.cleanup), this._domAdapters.delete(e);
301
- }
302
- let i = (t) => {
303
- let n = this._events.get(e);
304
- !n || typeof n.handler != "function" || (n.handler.call(this, t), n.options?.once && this.off(e));
305
- }, a = () => {
306
- this._el && this._el.removeEventListener(e, i, n);
307
- };
308
- this._el.addEventListener(e, i, n), this._domAdapters.set(e, { cleanup: a }), this._cleanup.push(a);
309
- }
310
- _removeCleanup(e) {
311
- let t = this._cleanup.indexOf(e);
312
- t !== -1 && this._cleanup.splice(t, 1);
313
- }
314
- registerStateAttrs(...e) {
315
- return e.forEach((e) => {
316
- if (typeof e == "string") {
317
- this._stateTypes[e] = "boolean";
318
- return;
319
- }
320
- e && typeof e == "object" && Object.entries(e).forEach(([e, t]) => {
321
- this._stateTypes[e] = t || "boolean";
322
- });
323
- }), this;
324
- }
325
- registerStateHandler(e, t) {
326
- return this._stateHandlers.has(e) || this._stateHandlers.set(e, []), this._stateHandlers.get(e).push(t), this;
327
- }
328
- setState(e, t = !0) {
329
- let n = this._states[e];
330
- return this._states[e] = t, (this._stateHandlers.get(e) || []).forEach((e) => e(t, this, n)), this;
331
- }
332
- getState(e) {
333
- return this._states[e];
334
- }
335
- getBooleanState(e) {
336
- return !!this.getState(e);
337
- }
338
- getStringState(e) {
339
- let t = this.getState(e);
340
- return t == null ? "" : String(t);
341
- }
342
- getNumberState(e) {
343
- return Number(this.getState(e) || 0);
344
- }
345
- renderDom() {
346
- return null;
347
- }
348
- commit() {
349
- return this.renderDom();
350
- }
351
- _commitChildren() {
352
- this._pendingRemovals.forEach((e) => e.destroy()), this._pendingRemovals.clear(), this._childrenDirty = !1;
353
- }
354
- bindTo(e) {
355
- let t = D(e), n = this.renderDom();
356
- return t && n && t.appendChild(n), this;
357
- }
358
- destroy() {
359
- return u() && (d({
360
- type: "destroy",
361
- node: this
362
- }), f(this)), this._deleted = !0, this._cleanup.forEach((e) => e()), this._cleanup = [], this._children.forEach((e) => e.destroy()), this._pendingRemovals.forEach((e) => e.destroy()), this._pendingRemovals.clear(), this._children = [], this._childKeys.clear(), this._el?.parentNode && this._el.parentNode.removeChild(this._el), this;
363
- }
364
- toHTML() {
365
- return "";
366
- }
367
- hydrateSnapshot() {
368
- return this;
369
- }
370
- }, A = class extends k {
371
- constructor(e = "") {
372
- if (super(null), this._content = "", this._textNode = null, typeof e == "function") {
373
- T("text", null, e, (e) => this.textContent(e));
374
- return;
375
- }
376
- this._content = String(e);
377
- }
378
- textContent(e) {
379
- if (e === void 0) return this._content;
380
- if (typeof e == "function") return T("text", null, e, (e) => this.textContent(e)), this;
381
- let t = this._content;
382
- return this._content = String(e), this._textNode && (this._textNode.textContent = this._content), this._textNode && u() && !Object.is(t, this._content) && h(this, "text", {
383
- from: t,
384
- to: this._content
385
- }), this;
386
- }
387
- renderDom() {
388
- return this._deleted || this._permissionState() === "hidden" ? null : (this._textNode || (this._textNode = document.createTextNode(this._content), this._el = this._textNode), this._textNode);
389
- }
390
- toHTML() {
391
- return this._deleted || this._permissionState() === "hidden" ? "" : ee(this._content);
392
- }
393
- }, j = class extends k {
394
- constructor(e) {
395
- super(null), this._component = e, this._resolved = null, this._resolvedList = null, this._roots = null, this._fragmentDom = null;
396
- }
397
- _resolve() {
398
- if (this._resolvedList) return this._resolved;
399
- let e = a(this._accessContext || s(), () => typeof this._component == "function" ? this._component() : this._component.render()), t = Array.isArray(e) ? e.slice() : [e];
400
- return t.forEach((e) => {
401
- if (!(e instanceof k)) throw TypeError("Component render must return a ViewNode or an array of ViewNodes");
402
- }), this._resolvedList = t, this._resolved = t[0] || null, this._roots = Array.isArray(e) ? t : null, this._component && typeof this._component == "object" && typeof this._component._attachHost == "function" && this._component._attachHost(this), this._resolved;
403
- }
404
- _resolveList() {
405
- return this._resolve(), this._resolvedList || [];
406
- }
407
- _replaceResolved(e) {
408
- let t = this._resolvedList || [], n = Array.isArray(e) ? e.slice() : [e];
409
- if (n.forEach((e) => {
410
- if (!(e instanceof k)) throw TypeError("Component render must return a ViewNode or an array of ViewNodes");
411
- }), t.length === n.length && t.every((e, t) => e === n[t])) return;
412
- let r = [];
413
- if (this._fragmentDom && this._fragmentDom.length > 0) r.push(...this._fragmentDom);
414
- else if (t.length > 0) {
415
- let e = t[0]._el;
416
- e && e.parentNode && r.push(e);
417
- }
418
- if (this._resolvedList = n, this._resolved = n[0] || null, this._roots = Array.isArray(e) ? n : null, this._fragmentDom = null, r.length === 0) {
419
- t.forEach((e) => e.destroy());
420
- return;
421
- }
422
- let i = x(), a = r[0].parentNode, o = [];
423
- n.forEach((e) => {
424
- let t = S(this._access ?? i, () => e.renderDom());
425
- t && o.push(t);
426
- }), o.length > 0 && a && o.forEach((e) => a.insertBefore(e, r[0])), r.forEach((e) => {
427
- e.parentNode === a && a.removeChild(e);
428
- }), this._roots ? this._fragmentDom = o : this._el = o[0] || null, t.forEach((e) => e.destroy());
429
- }
430
- children() {
431
- return this._resolvedList ? this._roots ? this._resolvedList.flatMap((e) => e.children()) : this._resolvedList[0] ? this._resolvedList[0].children() : [] : [];
432
- }
433
- textContent() {
434
- return this._resolveList().map((e) => typeof e.textContent == "function" ? e.textContent() : "").join("");
435
- }
436
- renderDom() {
437
- if (this._deleted || this._permissionState() === "hidden") return null;
438
- let e = x(), t = this._resolveList();
439
- if (this._roots) {
440
- if (this._fragmentDom) return null;
441
- let n = [];
442
- t.forEach((t) => {
443
- let r = S(this._access ?? e, () => t.renderDom());
444
- r && n.push(r);
445
- }), this._fragmentDom = n;
446
- let r = document.createDocumentFragment();
447
- return n.forEach((e) => r.appendChild(e)), r;
448
- }
449
- let n = t[0];
450
- return S(this._access ?? e, () => {
451
- let e = n.renderDom();
452
- return this._el = e, e;
453
- });
454
- }
455
- toHTML() {
456
- if (this._deleted || this._permissionState() === "hidden") return "";
457
- let e = x(), t = this._resolveList();
458
- return S(this._access ?? e, () => t.map((e) => e.toHTML()).join(""));
459
- }
460
- destroy() {
461
- return this._component && typeof this._component == "object" && typeof this._component.destroy == "function" && this._component.destroy(), (this._resolvedList || []).forEach((e) => e.destroy()), this._fragmentDom = null, super.destroy();
462
- }
463
- };
464
- function M(e = "") {
465
- return new A(e);
466
- }
467
- function ae(e) {
468
- if (e instanceof k) return e;
469
- if (typeof e == "function" || e && typeof e == "object" && typeof e.render == "function") return new j(e);
470
- if (typeof e == "string" || typeof e == "number") return new A(e);
471
- throw TypeError("ViewNode child must be a ViewNode, component, string, or number");
472
- }
473
- function oe(e = null, t = null, n = null) {
474
- return typeof t == "function" && n == null ? {
475
- first: e,
476
- options: null,
477
- callback: t
478
- } : {
479
- first: e,
480
- options: t,
481
- callback: n
482
- };
483
- }
484
- function N(e, t) {
485
- return !t || typeof t != "object" || Array.isArray(t) ? e : (t.attrs && typeof e.attr == "function" && e.attr(t.attrs), t.style && typeof e.styles == "function" && e.styles(t.style), e);
486
- }
487
- var P = class extends k {
488
- constructor(e, t = null) {
489
- super(null), this._tagName = e, this._attrs = {}, this._styles = {}, this._classes = /* @__PURE__ */ new Set(), this._el = null, t !== null && this.setup(t);
490
- }
491
- _setupObject(e) {
492
- Object.entries(e).forEach(([e, t]) => {
493
- if (e === "class" || e === "className") {
494
- this.className(t);
495
- return;
496
- }
497
- if (e === "attrs") {
498
- this.attr(t);
499
- return;
500
- }
501
- if (e === "style") {
502
- this.styles(t);
503
- return;
504
- }
505
- if (e === "children") {
506
- this.child(t);
507
- return;
508
- }
509
- if (e.startsWith("on") && typeof t == "function") {
510
- this.on(e.slice(2).toLowerCase(), t);
511
- return;
512
- }
513
- if (typeof this[e] == "function") {
514
- this[e](t);
515
- return;
516
- }
517
- typeof t != "function" && this.attr(e, t);
518
- });
519
- }
520
- tagName() {
521
- return this._tagName;
522
- }
523
- textContent() {
524
- return this._children.map((e) => typeof e.textContent == "function" ? e.textContent() : "").join("");
525
- }
526
- attr(e, t) {
527
- if (t === void 0 && typeof e == "string") return this._attrs[e];
528
- if (e && typeof e == "object") return Object.entries(e).forEach(([e, t]) => this.attr(e, t)), this;
529
- if (typeof t == "function") return T("attr", e, t, (t) => this.attr(e, t)), this;
530
- let n = this._attrs[e];
531
- return t == null || t === !1 ? delete this._attrs[e] : this._attrs[e] = t, this._el && O(this._el, e, t), this._el && u() && !this._devtoolsRendering && !Object.is(n, t) && h(this, "attr", {
532
- name: e,
533
- previous: n,
534
- next: t
535
- }), this;
536
- }
537
- id(e) {
538
- return e === void 0 ? this.attr("id") : this.attr("id", e);
539
- }
540
- name(e) {
541
- return e === void 0 ? this.attr("name") : this.attr("name", e);
542
- }
543
- className(...e) {
544
- return e.length === 0 ? [...this._classes].join(" ") : (e.flat(Infinity).forEach((e) => {
545
- e && String(e).split(/\s+/).filter(Boolean).forEach((e) => this._classes.add(e));
546
- }), this._syncClassName(), this);
547
- }
548
- class(...e) {
549
- return this.className(...e);
550
- }
551
- replaceClassName(e, t, n = !1) {
552
- return !e || !t || e === t ? this : this._classes.has(e) ? (this._classes.delete(e), this.className(t)) : n ? this.className(t) : this;
553
- }
554
- style(e, t) {
555
- if (t === void 0 && typeof e == "string") return this._styles[e];
556
- if (e && typeof e == "object") return this.styles(e);
557
- if (typeof t == "function") return T("style", e, t, (t) => this.style(e, t)), this;
558
- let n = this._styles[e];
559
- return t == null || t === "" ? delete this._styles[e] : this._styles[e] = t, this._el && (this._el.style[e] = t || ""), this._el && u() && !this._devtoolsRendering && !Object.is(n, t) && h(this, "style", {
560
- name: e,
561
- previous: n,
562
- next: t
563
- }), this;
564
- }
565
- styles(e) {
566
- return Object.entries(e || {}).forEach(([e, t]) => this.style(e, t)), this;
567
- }
568
- child(...e) {
569
- let t = this._el && u() && !this._devtoolsRendering ? [] : null;
570
- return e.flat(Infinity).forEach((e) => {
571
- if (e == null) return;
572
- let n = ae(e);
573
- if (this._pendingRemovals.delete(n), this._children.push(n), this._childrenDirty = !0, this._el) {
574
- let e = S(this._access ?? x(), () => n.renderDom());
575
- e && e.parentNode !== this._el && this._el.appendChild(e), t && t.push(m(n));
576
- }
577
- }), t && t.length > 0 && h(this, "child", { added: t }), this;
578
- }
579
- _applyAccessState(e) {
580
- if (e === "readonly") {
581
- this._accessAttrsApplied = !0;
582
- let e = this._tagName;
583
- v.has(e) && this.attr("disabled", !0), y.has(e) && this.attr("readonly", !0), this.attr("aria-disabled", "true");
584
- return;
585
- }
586
- this._accessAttrsApplied && (this._accessAttrsApplied = !1, this.attr("disabled", null), this.attr("readonly", null), this.attr("aria-disabled", null));
587
- }
588
- renderDom() {
589
- if (this._deleted) return null;
590
- let e = this._permissionState();
591
- if (e === "hidden") return null;
592
- let t = this._access ?? x();
593
- u() && (this._devtoolsRendering = !0);
594
- try {
595
- return this._el || (this._el = document.createElement(this._tagName), S(t, () => this._applySnapshotToElement())), this._applyAccessState(e), this._commitChildren(), this._children.forEach((e) => {
596
- S(t, () => {
597
- let t = e.renderDom();
598
- t && t.parentNode !== this._el ? this._el.appendChild(t) : !t && e._el && e._el.parentNode === this._el && this._el.removeChild(e._el);
599
- });
600
- }), u() && g(this), this._el;
601
- } finally {
602
- this._devtoolsRendering = !1;
603
- }
604
- }
605
- toHTML() {
606
- if (this._deleted) return "";
607
- let e = this._permissionState();
608
- return e === "hidden" ? "" : (this._applyAccessState(e), S(this._access ?? x(), () => {
609
- let e = this._serializeAttributes(), t = e ? `<${this._tagName} ${e}>` : `<${this._tagName}>`;
610
- return E.has(this._tagName) ? t : `${t}${this._children.map((e) => e.toHTML()).join("")}</${this._tagName}>`;
611
- }));
612
- }
613
- _applyBindingsToElement() {
614
- Object.entries(this._attrs).forEach(([e, t]) => O(this._el, e, t)), this._syncClassName(), Object.entries(this._styles).forEach(([e, t]) => {
615
- this._el.style[e] = t;
616
- }), this._events.forEach((e, t) => {
617
- this._bindDomAdapter(t, void 0, e.options);
618
- });
619
- }
620
- _applySnapshotToElement() {
621
- this._applyBindingsToElement(), this._children.forEach((e) => {
622
- let t = e.renderDom();
623
- t && this._el.appendChild(t);
624
- });
625
- }
626
- _syncClassName() {
627
- let e = this._attrs.class, t = [...this._classes].join(" ");
628
- t ? this._attrs.class = t : delete this._attrs.class, this._el && (t ? this._el.className = t : this._el.removeAttribute("class"), u() && !this._devtoolsRendering && !Object.is(e, t) && h(this, "attr", {
629
- name: "class",
630
- previous: e,
631
- next: t || void 0
632
- }));
633
- }
634
- _serializeAttributes() {
635
- let e = { ...this._attrs }, t = this._serializeStyles();
636
- return t && (e.style = e.style ? `${e.style}; ${t}` : t), Object.entries(e).filter(([, e]) => e != null && e !== !1).map(([e, t]) => t === !0 || te(e) ? `${e}="${e}"` : `${e}="${ee(t)}"`).join(" ");
637
- }
638
- _serializeStyles() {
639
- return ne(this._styles);
640
- }
641
- };
642
- function se(e, t = P) {
643
- return function(n = null, r = null, i = null) {
644
- let a = oe(n, r, i), o = new t(e, a.first);
645
- return N(o, a.options), typeof a.callback == "function" && a.callback(o), o;
646
- };
647
- }
648
- function F(e, t, n = {}) {
649
- let { override: r = !1 } = n;
650
- Object.entries(t).forEach(([t, n]) => {
651
- !r && e.prototype[t] || (e.prototype[t] = function(...e) {
652
- return this.child(n(...e));
653
- });
654
- });
655
- }
656
- //#endregion
657
- //#region src/html/index.js
658
- var I = class extends P {}, ce = [
659
- "a",
660
- "abbr",
661
- "address",
662
- "area",
663
- "article",
664
- "aside",
665
- "audio",
666
- "b",
667
- "base",
668
- "bdi",
669
- "bdo",
670
- "blockquote",
671
- "body",
672
- "br",
673
- "button",
674
- "canvas",
675
- "caption",
676
- "cite",
677
- "code",
678
- "col",
679
- "colgroup",
680
- "data",
681
- "datalist",
682
- "dd",
683
- "del",
684
- "details",
685
- "dfn",
686
- "dialog",
687
- "div",
688
- "dl",
689
- "dt",
690
- "em",
691
- "embed",
692
- "fieldset",
693
- "figcaption",
694
- "figure",
695
- "footer",
696
- "form",
697
- "h1",
698
- "h2",
699
- "h3",
700
- "h4",
701
- "h5",
702
- "h6",
703
- "head",
704
- "header",
705
- "hgroup",
706
- "hr",
707
- "html",
708
- "i",
709
- "iframe",
710
- "img",
711
- "input",
712
- "ins",
713
- "kbd",
714
- "label",
715
- "legend",
716
- "li",
717
- "link",
718
- "main",
719
- "map",
720
- "mark",
721
- "menu",
722
- "meta",
723
- "meter",
724
- "nav",
725
- "noscript",
726
- "object",
727
- "ol",
728
- "optgroup",
729
- "option",
730
- "output",
731
- "p",
732
- "picture",
733
- "pre",
734
- "progress",
735
- "q",
736
- "rp",
737
- "rt",
738
- "ruby",
739
- "s",
740
- "samp",
741
- "script",
742
- "search",
743
- "section",
744
- "select",
745
- "selectedcontent",
746
- "slot",
747
- "small",
748
- "source",
749
- "span",
750
- "strong",
751
- {
752
- name: "style",
753
- tagName: "style",
754
- aliases: ["styleTag"]
755
- },
756
- "sub",
757
- "summary",
758
- "sup",
759
- "table",
760
- "tbody",
761
- "td",
762
- "template",
763
- "textarea",
764
- "tfoot",
765
- "th",
766
- "thead",
767
- "time",
768
- "title",
769
- "tr",
770
- "track",
771
- "u",
772
- "ul",
773
- {
774
- name: "varTag",
775
- tagName: "var"
776
- },
777
- "video",
778
- "wbr"
779
- ];
780
- function le() {
781
- return ce.reduce((e, t) => {
782
- let { aliases: n = [], name: r, tagName: i } = vn(t), a = se(i, I);
783
- return e[r] = a, n.forEach((t) => {
784
- e[t] = a;
785
- }), e;
786
- }, {});
787
- }
788
- var ue = le();
789
- F(I, ue);
790
- var { a: de, abbr: fe, address: pe, area: me, article: he, aside: ge, audio: _e, b: ve, base: ye, bdi: be, bdo: xe, blockquote: Se, body: Ce, br: we, button: Te, canvas: Ee, caption: De, cite: Oe, code: ke, col: Ae, colgroup: je, data: Me, datalist: Ne, dd: Pe, del: Fe, details: Ie, dfn: Le, dialog: Re, div: ze, dl: Be, dt: Ve, em: He, embed: Ue, fieldset: We, figcaption: Ge, figure: Ke, footer: qe, form: Je, h1: Ye, h2: Xe, h3: Ze, h4: Qe, h5: $e, h6: et, head: tt, header: nt, hgroup: rt, hr: it, html: at, i: ot, iframe: st, img: ct, input: lt, ins: ut, kbd: dt, label: ft, legend: pt, li: mt, link: ht, main: gt, map: _t, mark: vt, menu: yt, meta: bt, meter: xt, nav: St, noscript: Ct, object: wt, ol: Tt, optgroup: Et, option: Dt, output: Ot, p: kt, picture: At, pre: jt, progress: Mt, q: Nt, rp: Pt, rt: Ft, ruby: It, s: Lt, samp: Rt, script: zt, search: Bt, section: Vt, select: Ht, selectedcontent: Ut, slot: Wt, small: Gt, source: Kt, span: qt, strong: Jt, style: Yt, styleTag: Xt, sub: Zt, summary: Qt, sup: $t, table: en, tbody: tn, td: nn, template: rn, textarea: an, tfoot: on, th: sn, thead: cn, time: ln, title: un, tr: dn, track: fn, u: pn, ul: mn, varTag: hn, video: gn, wbr: _n } = ue;
791
- function vn(e) {
792
- return typeof e == "string" ? {
793
- name: e,
794
- tagName: e
795
- } : e;
796
- }
797
- //#endregion
798
- //#region src/core/document-events.js
799
- function L(e, t, n = void 0) {
800
- return typeof document > "u" ? () => {} : (document.addEventListener(e, t, n), () => {
801
- document.removeEventListener(e, t, n);
802
- });
803
- }
804
- function yn(e, t, n = void 0) {
805
- typeof document > "u" || document.removeEventListener(e, t, n);
806
- }
807
- function R(e, t, n = void 0) {
808
- return typeof window > "u" ? () => {} : (window.addEventListener(e, t, n), () => {
809
- window.removeEventListener(e, t, n);
810
- });
811
- }
812
- function bn(e, t = null) {
813
- if (typeof document > "u") return null;
814
- if (t) {
815
- let e = document.querySelector(`[${t}]`);
816
- if (e) return e;
817
- }
818
- let n = document.createElement("style");
819
- return t && n.setAttribute(t, ""), n.textContent = e, document.head?.appendChild(n), n;
820
- }
821
- //#endregion
822
- //#region src/svg/index.js
823
- var xn = "http://www.w3.org/2000/svg", Sn = /* @__PURE__ */ new Set([
824
- "desc",
825
- "metadata",
826
- "text",
827
- "textPath",
828
- "title",
829
- "tspan"
830
- ]), Cn = class e extends P {
831
- setup(e) {
832
- return typeof e == "string" || typeof e == "number" ? this.child(e) : super.setup(e);
833
- }
834
- text(...e) {
835
- if (Sn.has(this._tagName)) {
836
- let [t, n] = e;
837
- return e.length > 0 && this.child(t), n != null && this.setup(n), this;
838
- }
839
- return this._svgChild("text", ...e);
840
- }
841
- style(...e) {
842
- let [t, n] = e;
843
- return this._tagName === "style" && e.length <= 1 ? (e.length === 1 && this.child(t), this) : e.length <= 1 && wn(t) ? this._svgChild("style", t) : super.style(t, n);
844
- }
845
- renderDom() {
846
- return this._deleted ? null : (this._el || (this._el = document.createElementNS(xn, this._tagName), this._applySnapshotToElement()), this._el);
847
- }
848
- _syncClassName() {
849
- let e = [...this._classes].join(" ");
850
- e ? this._attrs.class = e : delete this._attrs.class, this._el && (e ? this._el.setAttribute("class", e) : this._el.removeAttribute("class"));
851
- }
852
- _svgChild(t, ...n) {
853
- let r = new e(t);
854
- return n.forEach((e) => {
855
- e != null && r.setup(e);
856
- }), this.child(r);
857
- }
858
- };
859
- function wn(e) {
860
- return e == null || typeof e == "function" || typeof e == "string" || typeof e == "number" || Array.isArray(e);
861
- }
862
- var Tn = /* @__PURE__ */ "animate.animateMotion.animateTransform.circle.clipPath.defs.desc.ellipse.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feDropShadow.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.filter.foreignObject.g.image.line.linearGradient.marker.mask.metadata.mpath.path.pattern.polygon.polyline.radialGradient.rect.set.stop.a.script.style.switch.text.title.symbol.textPath.tspan.use.view".split(".");
863
- function En(e) {
864
- return function(...t) {
865
- let n = new Cn(e);
866
- return e === "svg" && n.style("display", "block"), t.forEach((e) => {
867
- e != null && n.setup(e);
868
- }), n;
869
- };
870
- }
871
- function Dn() {
872
- return Tn.reduce((e, t) => {
873
- let { aliases: n = [], name: r, tagName: i } = An(t), a = En(i);
874
- return e[r] = a, n.forEach((t) => {
875
- e[t] = a;
876
- }), e;
877
- }, {});
878
- }
879
- var On = En("svg"), kn = Dn();
880
- F(I, { svg: On }), F(Cn, {
881
- svg: On,
882
- ...kn
883
- });
884
- function An(e) {
885
- return typeof e == "string" ? {
886
- name: e,
887
- tagName: e
888
- } : e;
889
- }
890
- //#endregion
891
- //#region src/svg/icons.js
892
- function jn() {
893
- return On((e) => {
894
- e.className("yoya-icon").attr({
895
- "aria-hidden": "true",
896
- fill: "none",
897
- stroke: "currentColor",
898
- "stroke-linecap": "round",
899
- "stroke-linejoin": "round",
900
- "stroke-width": "2",
901
- viewBox: "0 0 24 24"
902
- }).styles({
903
- height: "24px",
904
- width: "24px"
905
- }), e.path({ d: "M4 6h16" }), e.path({ d: "M4 12h16" }), e.path({ d: "M4 18h16" });
906
- });
907
- }
908
- //#endregion
909
- //#region src/components/shared.js
910
- var Mn = "yoya-component";
911
- function z(e, t) {
912
- return `var(--yoya-${e}, ${t})`;
913
- }
914
- function B(e, t, n = "1px") {
915
- return `${n} solid ${z(e, t)}`;
916
- }
917
- function V(e = null, t = null, n = null) {
918
- return oe(e, t, n);
919
- }
920
- function Nn(e, t) {
921
- return typeof e.attr == "function" || typeof e.styles == "function" ? N(e, t) : (typeof e.render == "function" && N(e.render(), t), e);
922
- }
923
- function H(e, t = null, n = null) {
924
- return Nn(e, t), typeof n == "function" && n(e), e;
925
- }
926
- function Pn(e, t = null, n = null, r = null) {
927
- let { first: i, options: a, callback: o } = V(t, n, r);
928
- return H(i instanceof e ? i : new e(i), a, o);
929
- }
930
- function Fn(e, t) {
931
- return t == null ? e : typeof t == "function" ? (t(e), e) : t instanceof k || Array.isArray(t) || typeof t == "string" || typeof t == "number" ? (e.child(t), e) : (Ln(t) && e.setup(t), e);
932
- }
933
- function In(e) {
934
- return e == null ? [] : Array.isArray(e) ? e : [e];
935
- }
936
- function U(e, t) {
937
- return e.children().forEach((e) => e.destroy()), e._children = [], e._el && e._el.replaceChildren(), t.length > 0 && e.child(t), e;
938
- }
939
- function Ln(e) {
940
- if (Object.prototype.toString.call(e) !== "[object Object]") return !1;
941
- let t = Object.getPrototypeOf(e);
942
- return t === Object.prototype || t === null;
943
- }
944
- //#endregion
945
- //#region src/layout/split-panel.js
946
- var Rn = class extends I {
947
- constructor(e = null, t = null, n = null) {
948
- super("div", null), this.className(Mn, "yoya-vsplit-panel"), this.styles({
949
- boxSizing: "border-box",
950
- display: "flex",
951
- minHeight: "0",
952
- minWidth: "0",
953
- overflow: "hidden",
954
- width: "100%"
955
- }), this._direction = "horizontal", this._firstSize = "50%", this._minSize = 40, this._drag = null, this._dragMove = null, this._dragUp = null, this._first = new I("div").className("yoya-vsplit-panel-first").attr("data-vsplit-first", "true").styles({
956
- boxSizing: "border-box",
957
- minHeight: "0",
958
- minWidth: "0",
959
- overflow: "auto"
960
- }), this._second = new I("div").className("yoya-vsplit-panel-second").attr("data-vsplit-second", "true").styles({
961
- boxSizing: "border-box",
962
- flex: "1 1 auto",
963
- minHeight: "0",
964
- minWidth: "0",
965
- overflow: "auto"
966
- }), this._divider = new I("div").className("yoya-vsplit-panel-divider").attr({
967
- "aria-orientation": "horizontal",
968
- "data-vsplit-divider": "true",
969
- role: "separator",
970
- tabindex: "0",
971
- title: "拖拽调整面板大小,双击恢复 50%"
972
- }).styles({
973
- background: "transparent",
974
- boxSizing: "border-box",
975
- flex: "0 0 auto"
976
- }).on("mousedown", (e) => this._startDrag(e)).on("dblclick", () => this.reset()).on("keydown", (e) => this._handleKeydown(e)).on("mouseenter", () => this._hoverDivider(!0)).on("mouseleave", () => this._hoverDivider(!1)), this.child(this._first, this._divider, this._second), this._sync(), this._setupSplitPanel(e), H(this, t, n);
977
- }
978
- direction(e) {
979
- return e === void 0 ? this._direction : (this._direction = e === "vertical" ? "vertical" : "horizontal", this._sync(), this);
980
- }
981
- size(e) {
982
- return e === void 0 ? this._firstSize : (this._firstSize = Bn(e), this._sync(), this);
983
- }
984
- minSize(e) {
985
- if (e === void 0) return this._minSize;
986
- let t = Number(e);
987
- return this._minSize = Number.isFinite(t) ? Math.max(0, t) : this._minSize, this;
988
- }
989
- reset() {
990
- return this.size("50%");
991
- }
992
- first(e) {
993
- return U(this._first, []), typeof e == "function" ? e(this._first) : U(this._first, In(e)), this;
994
- }
995
- second(e) {
996
- return U(this._second, []), typeof e == "function" ? e(this._second) : U(this._second, In(e)), this;
997
- }
998
- destroy() {
999
- return this._endDrag(), super.destroy();
1000
- }
1001
- _sync() {
1002
- let e = this._direction === "horizontal";
1003
- return this.style("flexDirection", e ? "row" : "column"), this._first.styles({
1004
- flex: "0 0 auto",
1005
- height: e ? "100%" : this._firstSize,
1006
- width: e ? this._firstSize : "100%"
1007
- }), this._divider.styles(e ? {
1008
- cursor: "col-resize",
1009
- height: "100%",
1010
- width: "6px"
1011
- } : {
1012
- cursor: "row-resize",
1013
- height: "6px",
1014
- width: "100%"
1015
- }), this._divider.attr("aria-orientation", e ? "horizontal" : "vertical"), this;
1016
- }
1017
- _hoverDivider(e) {
1018
- this._divider.style("background", e ? z("color-primary-subtle", "#eff6ff") : "var(--yoya-color-border-faint, #efefef)");
1019
- }
1020
- _startDrag(e) {
1021
- if (e.button !== 0 || !this._el) return;
1022
- e.preventDefault();
1023
- let t = this._direction === "horizontal", n = this._first._el.getBoundingClientRect(), r = t ? e.clientX : e.clientY, i = t ? n.width : n.height, a = t ? this._el.offsetWidth : this._el.offsetHeight;
1024
- this._drag = {
1025
- containerSize: a,
1026
- start: r,
1027
- startSize: i
1028
- }, this._dragMove = (e) => this._onDrag(e), this._dragUp = () => this._endDrag(), this._dragUnbindMove = L("mousemove", this._dragMove), this._dragUnbindUp = L("mouseup", this._dragUp);
1029
- }
1030
- _onDrag(e) {
1031
- if (!this._drag) return;
1032
- let t = (this._direction === "horizontal" ? e.clientX : e.clientY) - this._drag.start, n = Vn(this._drag.startSize + t, this._minSize, this._drag.containerSize - this._minSize);
1033
- this._firstSize = `${Math.round(n)}px`, this._sync();
1034
- }
1035
- _handleKeydown(e) {
1036
- let t = e.key === "ArrowLeft" || e.key === "ArrowUp" ? -16 : e.key === "ArrowRight" || e.key === "ArrowDown" ? 16 : 0;
1037
- if (!t || !this._el) return;
1038
- e.preventDefault();
1039
- let n = this._direction === "horizontal" ? this._el.offsetWidth : this._el.offsetHeight, r = Vn((Number.parseFloat(this._firstSize) || 0) + t, this._minSize, n - this._minSize);
1040
- this._firstSize = `${Math.round(r)}px`, this._sync();
1041
- }
1042
- _endDrag() {
1043
- this._dragMove && (this._dragUnbindMove?.(), this._dragMove = null, this._dragUnbindMove = null), this._dragUp && (this._dragUnbindUp?.(), this._dragUp = null, this._dragUnbindUp = null), this._drag = null;
1044
- }
1045
- _setupSplitPanel(e) {
1046
- if (e != null) {
1047
- if (typeof e == "function") {
1048
- e(this);
1049
- return;
1050
- }
1051
- if (Ln(e)) {
1052
- let { direction: t, first: n, minSize: r, second: i, size: a, ...o } = e;
1053
- Object.keys(o).length > 0 && this.setup(o), t !== void 0 && this.direction(t), a !== void 0 && this.size(a), r !== void 0 && this.minSize(r), n !== void 0 && this.first(n), i !== void 0 && this.second(i);
1054
- return;
1055
- }
1056
- this.first(e);
1057
- }
1058
- }
1059
- };
1060
- function zn(e = null, t = null, n = null) {
1061
- return Pn(Rn, e, t, n);
1062
- }
1063
- F(I, { vSplitPanel: zn });
1064
- function Bn(e) {
1065
- return typeof e == "number" ? `${e}px` : e;
1066
- }
1067
- function Vn(e, t, n) {
1068
- return Number.isNaN(e) ? t : Math.min(Math.max(e, t), Math.max(n, t));
1069
- }
1070
- //#endregion
1071
- //#region src/layout/masonry.js
1072
- var Hn = class extends I {
1073
- constructor(e = null) {
1074
- super("div", null), this._columns = 3, this._gap = 16, this._minColumnWidth = null, this.className(Mn, "yoya-vmasonry"), this.attr({ "data-columns": "3" }), this.styles({
1075
- boxSizing: "border-box",
1076
- columnCount: "3",
1077
- columnGap: "16px",
1078
- width: "100%"
1079
- }), this._setupMasonry(e), this._syncLayout();
1080
- }
1081
- columns(e) {
1082
- if (e === void 0) return this._columns;
1083
- let t = Math.floor(Number(e));
1084
- return this._columns = Number.isFinite(t) && t >= 1 ? t : 3, this.attr("data-columns", String(this._columns)), this._syncLayout(), this;
1085
- }
1086
- gap(e) {
1087
- if (e === void 0) return this._gap;
1088
- let t = Number(e);
1089
- return this._gap = Number.isFinite(t) && t >= 0 ? t : 16, this._syncLayout(), this;
1090
- }
1091
- minColumnWidth(e) {
1092
- if (e === void 0) return this._minColumnWidth;
1093
- let t = Number(e);
1094
- return this._minColumnWidth = Number.isFinite(t) && t > 0 ? t : null, this._syncLayout(), this;
1095
- }
1096
- _syncLayout() {
1097
- this._minColumnWidth ? (this.style("columnCount", "auto"), this.style("columnWidth", `${this._minColumnWidth}px`), this.attr("data-column-mode", "responsive")) : (this.style("columnCount", String(this._columns)), this.style("columnWidth", "auto"), this.attr("data-column-mode", null)), this.style("columnGap", `${this._gap}px`), this.style("--yoya-masonry-gap", `${this._gap}px`);
1098
- }
1099
- _setupMasonry(e) {
1100
- if (e != null) {
1101
- if (typeof e == "function") {
1102
- e(this);
1103
- return;
1104
- }
1105
- if (Ln(e)) {
1106
- let { columns: t, gap: n, minColumnWidth: r, ...i } = e;
1107
- Object.keys(i).length > 0 && this.setup(i), t !== void 0 && this.columns(t), n !== void 0 && this.gap(n), r !== void 0 && this.minColumnWidth(r);
1108
- }
1109
- }
1110
- }
1111
- };
1112
- function Un(e = null, t = null, n = null) {
1113
- return Pn(Hn, e, t, n);
1114
- }
1115
- //#endregion
1116
- //#region src/layout/theme-shell.js
1117
- var Wn = class extends I {
1118
- constructor(e = null) {
1119
- super("div", null), this.className("yoya-component", "yoya-vtheme-shell"), this.styles({
1120
- background: z("color-surface", "#ffffff"),
1121
- border: `1px solid ${z("color-border", "#d8dee8")}`,
1122
- borderRadius: z("radius-md", "6px"),
1123
- boxSizing: "border-box",
1124
- color: z("color-text", "#172033"),
1125
- minWidth: "0"
1126
- }), Fn(this, e);
1127
- }
1128
- _requireSingleShellChild() {
1129
- let e = this.children();
1130
- if (e.length !== 1) throw TypeError("vThemeShell virtual mode requires exactly one child");
1131
- return e[0];
1132
- }
1133
- _virtualTarget() {
1134
- let e = this._requireSingleShellChild();
1135
- return typeof e._resolve == "function" ? e._resolve() : e;
1136
- }
1137
- _syncShellStyles(e) {
1138
- !e || typeof e.styles != "function" || e.styles({
1139
- background: this._styles.background,
1140
- border: this._styles.border,
1141
- borderColor: this._styles.borderColor,
1142
- borderRadius: this._styles.borderRadius,
1143
- boxSizing: this._styles.boxSizing,
1144
- color: this._styles.color,
1145
- minWidth: this._styles.minWidth,
1146
- overflow: this._styles.overflow
1147
- });
1148
- }
1149
- virtual(e = !0) {
1150
- return this._virtualMode = !!e, this;
1151
- }
1152
- renderDom() {
1153
- if (this._deleted) return null;
1154
- if (this._virtualMode) {
1155
- let e = this._requireSingleShellChild(), t = this._virtualTarget();
1156
- return this._syncShellStyles(t), e.renderDom();
1157
- }
1158
- return super.renderDom();
1159
- }
1160
- toHTML() {
1161
- return this._deleted ? "" : this._virtualMode ? this._requireSingleShellChild().toHTML() : super.toHTML();
1162
- }
1163
- background(e) {
1164
- return e === void 0 ? this._styles.background : e === null ? this : (this._styles.background = String(e), this._el && (this._el.style.background = String(e)), this);
1165
- }
1166
- backgroundOpacity(e) {
1167
- let t = this.background() || z("color-surface", "#ffffff"), n = Math.max(0, Math.min(1, Number(e) || 0));
1168
- return this.background(`color-mix(in srgb, ${t} ${Math.round(n * 100)}%, transparent)`);
1169
- }
1170
- radius(e) {
1171
- return e === void 0 ? this._styles.borderRadius : this.styles({ borderRadius: e === null ? void 0 : String(e) });
1172
- }
1173
- border(e) {
1174
- return e === void 0 ? this._styles.border : this.styles({ border: e === null ? void 0 : String(e) });
1175
- }
1176
- borderColor(e) {
1177
- return e === void 0 ? this._styles.borderColor : this.styles({ borderColor: e === null ? void 0 : String(e) });
1178
- }
1179
- scrollable(e = !0) {
1180
- return this.styles({ overflow: e ? "auto" : "visible" });
1181
- }
1182
- };
1183
- function Gn(e = null, t = null, n = null) {
1184
- return Pn(Wn, e, t, n);
1185
- }
1186
- F(P, { vThemeShell: Gn });
1187
- //#endregion
1188
- //#region src/layout/index.js
1189
- var Kn = /* @__PURE__ */ new Set(/* @__PURE__ */ "align.areas.asideWidth.autoFlow.breakpoint.columns.direction.drawer.gutter.offset.pull.push.span.xs.sm.md.lg.xl.gap.justify.maxWidth.minColumnWidth.mobileDirection.mobileGap.orientation.padding.paddingInline.rows.safeArea.size.breakpoints.viewport.wrap".split(".")), qn = /* @__PURE__ */ new Set(["height", "width"]);
1190
- function Jn(e = null, t = null, n = null) {
1191
- return W("flex", { display: "flex" }, e, vr, t, n);
1192
- }
1193
- function Yn(e = null, t = null, n = null) {
1194
- return W("stack", {
1195
- display: "flex",
1196
- flexDirection: "column"
1197
- }, e, vr, t, n);
1198
- }
1199
- function Xn(e = null, t = null, n = null) {
1200
- return W("vstack", {
1201
- display: "flex",
1202
- flexDirection: "column"
1203
- }, e, vr, t, n);
1204
- }
1205
- function Zn(e = null, t = null, n = null) {
1206
- return W("hstack", {
1207
- display: "flex",
1208
- flexDirection: "row"
1209
- }, e, vr, t, n);
1210
- }
1211
- function Qn(e = null, t = null, n = null) {
1212
- return W("center", {
1213
- display: "flex",
1214
- alignItems: "center",
1215
- justifyContent: "center"
1216
- }, e, vr, t, n);
1217
- }
1218
- function $n(e = null, t = null, n = null) {
1219
- let r = V(e, t, n), i = new I("div");
1220
- i.className("yoya-layout", "yoya-vrow"), i.styles({
1221
- boxSizing: "border-box",
1222
- display: "flex",
1223
- flexWrap: "wrap",
1224
- width: "100%"
1225
- }), i._gutter = null, i.gutter = (e) => e === void 0 ? i._gutter : (i._gutter = q(e), Tr(i), i), i.justify = (e) => e === void 0 ? i.style("justifyContent") : (i.style("justifyContent", e), i), i.align = (e) => e === void 0 ? i.style("alignItems") : (i.style("alignItems", e), i), i.wrap = (e) => e === void 0 ? i.style("flexWrap") : (i.style("flexWrap", e === !1 ? "nowrap" : Jr(e ?? !0)), i);
1226
- let a = i.child.bind(i);
1227
- return i.child = (...e) => (a(...e), Tr(i), i), G(i, r.first, Er), Tr(i), H(i, r.options, r.callback);
1228
- }
1229
- function er(e = null, t = null, n = null) {
1230
- let r = V(e, t, n), i = new I("div");
1231
- return i.className("yoya-layout", "yoya-vcol"), i.styles({
1232
- boxSizing: "border-box",
1233
- minWidth: "0"
1234
- }), i._baseCol = kr({}), i._responsiveCols = [], i._gutter = null, i.refresh = i._refreshCol = () => {
1235
- let e = typeof window > "u" ? null : window.innerWidth, t = (e === null ? null : i._responsiveCols.filter((t) => e >= t.minWidth).at(-1))?.props ?? i._baseCol;
1236
- return i.style("boxSizing", "border-box"), i.style("flex", "0 0 auto"), i.style("left", t.push ? `${Mr(t.push)}%` : null), i.style("marginLeft", t.offset ? `${Mr(t.offset)}%` : null), i.style("paddingLeft", i._gutter ? Nr(i._gutter) : null), i.style("paddingRight", i._gutter ? Nr(i._gutter) : null), i.style("position", t.push || t.pull ? "relative" : null), i.style("right", t.pull ? `${Mr(t.pull)}%` : null), i.style("width", `${Mr(t.span)}%`), i;
1237
- }, i.span = (e) => e === void 0 ? i._baseCol.span : (i._baseCol.span = K(e), i._refreshCol(), i), i.offset = (e) => e === void 0 ? i._baseCol.offset : (i._baseCol.offset = K(e), i._refreshCol(), i), i.push = (e) => e === void 0 ? i._baseCol.push : (i._baseCol.push = K(e), i._refreshCol(), i), i.pull = (e) => e === void 0 ? i._baseCol.pull : (i._baseCol.pull = K(e), i._refreshCol(), i), i.gutter = (e) => e === void 0 ? i._gutter : (i._gutter = q(e), i._refreshCol(), i), G(i, r.first, Dr), i._refreshCol(), i._responsiveCols.length && (i._colResize = () => i._refreshCol(), i._colResizeUnbind = R("resize", i._colResize), Pr(i)), H(i, r.options, r.callback);
1238
- }
1239
- function tr(e = null, t = null, n = null) {
1240
- return W("grid", { display: "grid" }, e, yr, t, n);
1241
- }
1242
- function nr(e = null, t = null, n = null) {
1243
- let r = V(e, t, n), i = W("responsive-grid", { display: "grid" }, r.first, br, r.options, r.callback), a = Xr(r.first) ? r.first : {};
1244
- return i._responsiveGridBreakpoints = qr(a.breakpoints), i._responsiveGridMinColumnWidth = Kr(a.minColumnWidth), i._responsiveGridRefresh = () => {
1245
- let e = typeof window > "u" ? null : window.innerWidth, t = e === null ? null : i._responsiveGridBreakpoints.filter((t) => e >= t.minWidth).at(-1);
1246
- return i.style("gridTemplateColumns", t ? `repeat(${t.columns}, minmax(0, 1fr))` : `repeat(auto-fit, minmax(${i._responsiveGridMinColumnWidth}, 1fr))`), i;
1247
- }, i.refresh = i._responsiveGridRefresh, i.minColumnWidth = (e) => e === void 0 ? i._responsiveGridMinColumnWidth : (i._responsiveGridMinColumnWidth = Kr(e), i._responsiveGridRefresh(), i), i.breakpoints = (e) => e === void 0 ? i._responsiveGridBreakpoints : (i._responsiveGridBreakpoints = qr(e), i._responsiveGridBreakpoints.length && !i._responsiveGridResize && !i._responsiveGridResizeUnbind && (i._responsiveGridResize = () => i._responsiveGridRefresh(), i._responsiveGridResizeUnbind = R("resize", i._responsiveGridResize), ar(i)), i._responsiveGridRefresh(), i), i._responsiveGridRefresh(), i._responsiveGridBreakpoints.length && (i._responsiveGridResize = () => i._responsiveGridRefresh(), i._responsiveGridResizeUnbind = R("resize", i._responsiveGridResize), ar(i)), i;
1248
- }
1249
- function rr(e = null, t = null, n = null) {
1250
- let r = V(e, t, n), i = new I("div"), a = new I("div").className("yoya-vbody-content"), o = i.child.bind(i);
1251
- return i.className("yoya-layout", "yoya-vbody"), i.attr("data-page-body", "true"), i.styles({
1252
- background: z("color-bg", "#f9f9f9"),
1253
- boxSizing: "border-box",
1254
- color: z("color-text", "#0d0d0d"),
1255
- fontFamily: z("font-family", "ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif"),
1256
- fontSize: z("font-size", "14px"),
1257
- lineHeight: z("line-height", "1.5"),
1258
- minHeight: "100%",
1259
- padding: "clamp(16px, 3vw, 32px)",
1260
- width: "100%"
1261
- }), a.styles({
1262
- display: "grid",
1263
- gap: "24px",
1264
- marginLeft: "auto",
1265
- marginRight: "auto",
1266
- maxWidth: "1120px",
1267
- width: "100%"
1268
- }), o(a), i.background = (e) => e === void 0 ? i.style("background") : (i.style("background", e), i), i.maxWidth = (e) => e === void 0 ? a.style("maxWidth") : (a.style("maxWidth", q(e)), i), i.padding = (e) => e === void 0 ? i.style("padding") : (i.style("padding", q(e)), i), i.gap = (e) => e === void 0 ? a.style("gap") : (a.style("gap", q(e)), i), i.minHeight = (e) => e === void 0 ? i.style("minHeight") : (i.style("minHeight", q(e)), i), i.content = (e) => e === void 0 ? a : (typeof e == "function" ? e(a) : a.child(e), i), i.child = (...e) => (a.child(...e), i), xr(i, r.first), H(i, r.options, r.callback);
1269
- }
1270
- function ir(e = null, t = null) {
1271
- let n = rr(e);
1272
- return typeof document < "u" && n.bindTo(t || document.body), n;
1273
- }
1274
- function ar(e) {
1275
- if (e._responsiveGridDestroyWrapped) return;
1276
- e._responsiveGridDestroyWrapped = !0;
1277
- let t = e.destroy.bind(e);
1278
- e.destroy = () => (e._responsiveGridResizeUnbind?.(), t());
1279
- }
1280
- function or(e = null, t = null, n = null) {
1281
- return W("container", {
1282
- width: "100%",
1283
- maxWidth: "1120px",
1284
- marginLeft: "auto",
1285
- marginRight: "auto",
1286
- paddingLeft: "16px",
1287
- paddingRight: "16px"
1288
- }, e, Sr, t, n);
1289
- }
1290
- function sr(e = null, t = null, n = null) {
1291
- let r = V(e, t, n), i = new I("div");
1292
- i.className("yoya-layout", "yoya-vcontainer"), i.styles({
1293
- boxSizing: "border-box",
1294
- display: "flex",
1295
- minWidth: "0",
1296
- width: "100%"
1297
- }), i._direction = null, i._viewport = !1, i._fill = !1, i._scrollable = !1, i.viewport = (e = !0) => e === void 0 ? i._viewport : (i._viewport = !!e, i.styles({
1298
- height: i._viewport ? "100dvh" : null,
1299
- minHeight: i._viewport ? "100vh" : null,
1300
- overflow: i._viewport ? "hidden" : null
1301
- }), i), i.fill = (e = !0) => e === void 0 ? i._fill : (i._fill = !!e, i.styles({
1302
- flex: i._fill ? "1 1 auto" : null,
1303
- height: i._fill ? "auto" : null,
1304
- minHeight: i._fill ? "0" : null,
1305
- minWidth: i._fill ? "0" : null,
1306
- overflow: i._fill ? "hidden" : null
1307
- }), i), i.scrollable = (e = !0) => e === void 0 ? i._scrollable : (i._scrollable = !!e, i.styles({
1308
- height: i._scrollable ? "100%" : null,
1309
- minHeight: i._scrollable ? "0" : null,
1310
- overflow: i._scrollable ? "auto" : null,
1311
- overscrollBehavior: i._scrollable ? "contain" : null
1312
- }), i), i._autoDirection = () => i.children().some((e) => zr(e)) ? "column" : "row", i._syncContainerDirection = () => (i.style("flexDirection", i._direction || i._autoDirection()), i), i.direction = (e) => e === void 0 ? i._direction || i._autoDirection() : (i._direction = e, i._syncContainerDirection(), i);
1313
- let a = i.child.bind(i);
1314
- return i.child = (...e) => (a(...e), i._syncContainerDirection(), i), G(i, r.first, Br), i._syncContainerDirection(), H(i, r.options, r.callback);
1315
- }
1316
- function cr(e = null, t = null, n = null) {
1317
- let r = V(e, t, n), i = new I("div");
1318
- i.className("yoya-layout", "yoya-mobile-layout", "yoya-vmobile-layout"), i.attr("data-mobile-layout", "false"), i.styles({
1319
- boxSizing: "border-box",
1320
- display: "flex",
1321
- minWidth: "0",
1322
- width: "100%"
1323
- }), i._breakpoint = 768, i._desktopDirection = "row", i._mobileDirection = "column", i._desktopGap = 0, i._mobileGap = 12, i._asideWidth = 280, i._safeArea = !1, i._safeAreaApplied = !1, i._viewport = !1, i._mobile = !1, i._drawerEnabled = !0, i._asideOpen = !1, i._asideBackdrop = new I("div").className("yoya-vmobile-layout-backdrop").attr("aria-hidden", "true").style("display", "none").on("click", () => i.closeAside()), i._asideToggle = new I("button").className("yoya-vmobile-layout-toggle").attr({
1324
- type: "button",
1325
- "aria-label": "打开导航",
1326
- "aria-expanded": "false"
1327
- }).style("display", "none").child(jn().styles({
1328
- height: "18px",
1329
- width: "18px"
1330
- })).on("click", () => i.toggleAside()), i._refreshMobileLayout = () => {
1331
- let e = typeof window > "u" ? null : window.innerWidth, t = e !== null && e <= i._breakpoint;
1332
- return i._mobile = t, t || (i._asideOpen = !1), i.attr("data-mobile-layout", t ? "true" : "false"), i.attr("data-aside-open", t && i._asideOpen ? "true" : null), i.styles({
1333
- flexDirection: t ? i._mobileDirection : i._desktopDirection,
1334
- gap: t ? i._mobileGap : i._desktopGap,
1335
- height: i._viewport ? "100dvh" : null,
1336
- minHeight: i._viewport ? "100vh" : null,
1337
- overflow: i._viewport ? "hidden" : null
1338
- }), i._safeArea ? (i._safeAreaApplied = !0, i.style("paddingLeft", t ? "max(env(safe-area-inset-left), 0px)" : null), i.style("paddingRight", t ? "max(env(safe-area-inset-right), 0px)" : null), i.style("paddingTop", t ? "max(env(safe-area-inset-top), 0px)" : null), i.style("paddingBottom", t ? "max(env(safe-area-inset-bottom), 0px)" : null)) : i._safeAreaApplied && (i._safeAreaApplied = !1, i.style("paddingLeft", null), i.style("paddingRight", null), i.style("paddingTop", null), i.style("paddingBottom", null)), i.children().forEach((e) => Ir(i, e)), Lr(i), i;
1339
- }, i.refresh = i._refreshMobileLayout, i.breakpoint = (e) => e === void 0 ? i._breakpoint : (i._breakpoint = Number(e), (!Number.isFinite(i._breakpoint) || i._breakpoint <= 0) && (i._breakpoint = 768), i._refreshMobileLayout(), i), i.direction = (e, t) => e === void 0 ? i._desktopDirection : (i._desktopDirection = e || "row", t !== void 0 && (i._mobileDirection = t || "column"), i._refreshMobileLayout(), i), i.mobileDirection = (e) => e === void 0 ? i._mobileDirection : (i._mobileDirection = e || "column", i._refreshMobileLayout(), i), i.gap = (e, t) => e === void 0 ? i._desktopGap : (i._desktopGap = q(e), t !== void 0 && (i._mobileGap = q(t)), i._refreshMobileLayout(), i), i.mobileGap = (e) => e === void 0 ? i._mobileGap : (i._mobileGap = q(e), i._refreshMobileLayout(), i), i.asideWidth = (e) => e === void 0 ? i._asideWidth : (i._asideWidth = q(e), i._refreshMobileLayout(), i), i.viewport = (e = !0) => e === void 0 ? i._viewport : (i._viewport = !!e, i._refreshMobileLayout(), i), i.safeArea = (e = !0) => e === void 0 ? i._safeArea : (i._safeArea = !!e, i._refreshMobileLayout(), i), i.drawer = (e = !0) => e === void 0 ? i._drawerEnabled : (i._drawerEnabled = !!e, i._drawerEnabled || (i._asideOpen = !1), i._refreshMobileLayout(), i), i.asideOpen = (e) => e === void 0 ? i._asideOpen : (i._asideOpen = !!e, i._refreshMobileLayout(), i), i.openAside = () => i.asideOpen(!0), i.closeAside = () => i.asideOpen(!1), i.toggleAside = () => i.asideOpen(!i._asideOpen), i.mobile = () => i._mobile;
1340
- let a = i.child.bind(i);
1341
- return i.child = (...e) => (a(...e), i._refreshMobileLayout(), i), G(i, r.first, Vr), i.child(i._asideBackdrop, i._asideToggle), i._mobileLayoutResize = () => i._refreshMobileLayout(), i._mobileLayoutResizeUnbind = R("resize", i._mobileLayoutResize), Fr(i), i._refreshMobileLayout(), H(i, r.options, r.callback);
1342
- }
1343
- var lr = cr;
1344
- function ur(e = null, t = null, n = null) {
1345
- return W("vheader", {
1346
- boxSizing: "border-box",
1347
- flex: "0 0 auto",
1348
- height: "60px",
1349
- width: "100%"
1350
- }, e, Hr, t, n, "header", qn, gr);
1351
- }
1352
- function dr(e = null, t = null, n = null) {
1353
- return W("vaside", {
1354
- boxSizing: "border-box",
1355
- flex: "0 0 auto",
1356
- minWidth: "0",
1357
- width: "300px"
1358
- }, e, Ur, t, n, "aside", qn, _r);
1359
- }
1360
- function fr(e = null, t = null, n = null) {
1361
- return W("vmain", {
1362
- boxSizing: "border-box",
1363
- flex: "1 1 auto",
1364
- minHeight: "0",
1365
- minWidth: "0",
1366
- overflow: "auto"
1367
- }, e, Wr, t, n, "main", qn, _r);
1368
- }
1369
- function pr(e = null, t = null, n = null) {
1370
- return W("vfooter", {
1371
- boxSizing: "border-box",
1372
- flex: "0 0 auto",
1373
- height: "60px",
1374
- width: "100%"
1375
- }, e, Hr, t, n, "footer", qn, gr);
1376
- }
1377
- function mr(e = null, t = null, n = null) {
1378
- let r = W("spacer", {
1379
- flexGrow: 1,
1380
- minWidth: 0,
1381
- minHeight: 0
1382
- }, e, Cr, t, n);
1383
- return r.attr("aria-hidden", "true"), r;
1384
- }
1385
- function hr(e = null, t = null, n = null) {
1386
- let r = W("divider", {}, e, wr, t, n);
1387
- return r.attr("role", "separator"), r.attr("aria-orientation") || r.attr("aria-orientation", "horizontal"), r;
1388
- }
1389
- F(I, {
1390
- vAside: dr,
1391
- vCol: er,
1392
- vContainer: sr,
1393
- vFooter: pr,
1394
- vHeader: ur,
1395
- vMain: fr,
1396
- vMasonry: Un,
1397
- vRow: $n,
1398
- vSplitPanel: zn,
1399
- center: Qn,
1400
- container: or,
1401
- divider: hr,
1402
- flex: Jn,
1403
- grid: tr,
1404
- mobileLayout: cr,
1405
- responsiveGrid: nr,
1406
- vMobileLayout: lr,
1407
- vBody: rr,
1408
- hstack: Zn,
1409
- spacer: mr,
1410
- stack: Yn,
1411
- vstack: Xn
1412
- });
1413
- function W(e, t, n, r, i, a, o = "div", s = null, c = null) {
1414
- let l = V(n, i, a), u = new I(o);
1415
- return u.className("yoya-layout", `yoya-${e}`), u.styles(t), c && c(u), G(u, l.first, r, s), H(u, l.options, l.callback);
1416
- }
1417
- function gr(e) {
1418
- e.sticky = (t = !0) => {
1419
- if (t === void 0) return e.style("position") === "sticky";
1420
- let n = !!t;
1421
- return e.styles({
1422
- position: n ? "sticky" : null,
1423
- top: n ? "0" : null,
1424
- zIndex: n ? "20" : null
1425
- }), e;
1426
- };
1427
- }
1428
- function _r(e) {
1429
- e.scrollable = (t = !0) => {
1430
- if (t === void 0) return e.style("overflow") === "auto";
1431
- let n = !!t;
1432
- return e.styles({
1433
- height: n ? "100%" : null,
1434
- minHeight: n ? "0" : null,
1435
- overflow: n ? "auto" : null,
1436
- overscrollBehavior: n ? "contain" : null
1437
- }), e;
1438
- };
1439
- }
1440
- function G(e, t, n, r = null) {
1441
- if (t == null) return n(e, {}), e;
1442
- if (!Xr(t)) return n(e, {}), e.setup(t);
1443
- n(e, t);
1444
- let i = Yr(t, r);
1445
- return Object.keys(i).length > 0 && e.setup(i), e;
1446
- }
1447
- function vr(e, t) {
1448
- e.styles(J({
1449
- alignItems: t.align,
1450
- flexDirection: t.direction,
1451
- flexWrap: Jr(t.wrap),
1452
- gap: t.gap,
1453
- justifyContent: t.justify
1454
- }));
1455
- }
1456
- function yr(e, t) {
1457
- e.styles(J({
1458
- gap: t.gap,
1459
- gridAutoFlow: t.autoFlow,
1460
- gridTemplateAreas: t.areas,
1461
- gridTemplateColumns: Gr(t.columns),
1462
- gridTemplateRows: Gr(t.rows)
1463
- }));
1464
- }
1465
- function br(e, t) {
1466
- e.style("gap", t.gap), e.style("gridTemplateColumns", `repeat(auto-fit, minmax(${Kr(t.minColumnWidth)}, 1fr))`);
1467
- }
1468
- function xr(e, t) {
1469
- if (t == null) return e;
1470
- if (typeof t == "function") return t(e), e;
1471
- if (!Xr(t)) return e.child(t), e;
1472
- let { background: n, children: r, content: i, gap: a, maxWidth: o, minHeight: s, padding: c, ...l } = t;
1473
- Object.keys(l).length && e.setup(l), n !== void 0 && e.background(n), o !== void 0 && e.maxWidth(o), c !== void 0 && e.padding(c), a !== void 0 && e.gap(a), s !== void 0 && e.minHeight(s);
1474
- let u = i ?? r;
1475
- return u !== void 0 && e.content(u), e;
1476
- }
1477
- function Sr(e, t) {
1478
- let n = t.paddingInline ?? t.padding;
1479
- e.styles(J({
1480
- maxWidth: t.maxWidth,
1481
- paddingLeft: n,
1482
- paddingRight: n
1483
- }));
1484
- }
1485
- function Cr(e, t) {
1486
- e.styles(J({
1487
- flexBasis: t.size,
1488
- height: t.orientation === "vertical" ? t.size : void 0,
1489
- width: t.orientation === "horizontal" ? t.size : void 0
1490
- }));
1491
- }
1492
- function wr(e, t) {
1493
- let n = t.orientation === "vertical" ? "vertical" : "horizontal";
1494
- if (e.attr("aria-orientation", n), n === "vertical") {
1495
- e.styles({
1496
- alignSelf: "stretch",
1497
- background: "currentColor",
1498
- opacity: .2,
1499
- width: "1px"
1500
- });
1501
- return;
1502
- }
1503
- e.styles({
1504
- background: "currentColor",
1505
- height: "1px",
1506
- opacity: .2,
1507
- width: "100%"
1508
- });
1509
- }
1510
- function Tr(e) {
1511
- e.children().forEach((t) => {
1512
- let n = t?._resolved ?? t?._resolve?.() ?? t;
1513
- n && typeof n.gutter == "function" && n.gutter(e._gutter);
1514
- });
1515
- }
1516
- function Er(e, t) {
1517
- t.gutter !== void 0 && e.gutter(t.gutter), e.styles(J({
1518
- alignItems: t.align,
1519
- flexWrap: t.wrap === void 0 || t.wrap === null ? "wrap" : t.wrap === !1 ? "nowrap" : Jr(t.wrap),
1520
- justifyContent: t.justify
1521
- }));
1522
- }
1523
- function Dr(e, t) {
1524
- e._baseCol = kr(t), e._responsiveCols = Ar(t), t.gutter !== void 0 && e.gutter(t.gutter);
1525
- }
1526
- var Or = [
1527
- ["xs", 0],
1528
- ["sm", 768],
1529
- ["md", 992],
1530
- ["lg", 1200],
1531
- ["xl", 1920]
1532
- ];
1533
- function kr(e = {}) {
1534
- return {
1535
- span: K(e.span ?? 24),
1536
- offset: K(e.offset ?? 0),
1537
- push: K(e.push ?? 0),
1538
- pull: K(e.pull ?? 0)
1539
- };
1540
- }
1541
- function Ar(e = {}) {
1542
- return Or.filter(([t]) => e[t] !== void 0).map(([t, n]) => ({
1543
- minWidth: n,
1544
- props: jr(e[t])
1545
- }));
1546
- }
1547
- function jr(e) {
1548
- return typeof e == "number" ? kr({ span: e }) : Xr(e) ? kr(e) : kr({});
1549
- }
1550
- function K(e) {
1551
- let t = Number(e);
1552
- return Number.isFinite(t) ? Math.min(24, Math.max(0, Math.round(t))) : 0;
1553
- }
1554
- function Mr(e) {
1555
- return e / 24 * 100;
1556
- }
1557
- function Nr(e) {
1558
- if (typeof e == "number") return `${e / 2}px`;
1559
- let t = String(e).match(/^(-?(?:\d+\.?\d*|\.\d+))([a-z%]+)$/i);
1560
- return t ? `${Number(t[1]) / 2}${t[2]}` : `calc(${e} * 0.5)`;
1561
- }
1562
- function Pr(e) {
1563
- if (e._colDestroyWrapped) return;
1564
- e._colDestroyWrapped = !0;
1565
- let t = e.destroy.bind(e);
1566
- e.destroy = () => (e._colResizeUnbind?.(), t());
1567
- }
1568
- function Fr(e) {
1569
- if (e._mobileLayoutDestroyWrapped) return;
1570
- e._mobileLayoutDestroyWrapped = !0;
1571
- let t = e.destroy.bind(e);
1572
- e.destroy = () => (e._mobileLayoutResizeUnbind?.(), t());
1573
- }
1574
- function Ir(e, t) {
1575
- let n = t?._resolved ?? t?._resolve?.() ?? t;
1576
- if (!n || typeof n.styles != "function") return;
1577
- let r = n._classes;
1578
- if (r?.has("yoya-vaside") && e._mobile && e._drawerEnabled) {
1579
- n.styles({
1580
- bottom: "0",
1581
- boxShadow: e._asideOpen ? "0 12px 36px rgba(15, 23, 42, 0.28)" : "none",
1582
- display: "flex",
1583
- flexDirection: "column",
1584
- height: "100dvh",
1585
- left: "0",
1586
- maxWidth: "84vw",
1587
- minHeight: "100vh",
1588
- minWidth: "0",
1589
- pointerEvents: e._asideOpen ? "auto" : "none",
1590
- position: "fixed",
1591
- top: "0",
1592
- transform: e._asideOpen ? "translateX(0)" : "translateX(-100%)",
1593
- transition: "transform 180ms ease, box-shadow 180ms ease, visibility 180ms ease",
1594
- visibility: e._asideOpen ? "visible" : "hidden",
1595
- width: "320px",
1596
- zIndex: "40"
1597
- }), n.attr("aria-hidden", e._asideOpen ? null : "true"), n._mobileDrawerAriaHiddenApplied = !0, n._mobileDrawerStylesApplied = !0, n._mobileDrawerClickBound || (n._mobileDrawerClickBound = !0, n.on("click", (t) => {
1598
- t.target?.closest?.(".yoya-vmenu-item") && !t.target.closest?.(".yoya-vsubmenu-trigger") && e.closeAside();
1599
- }));
1600
- return;
1601
- }
1602
- if (r?.has("yoya-vaside")) {
1603
- n._mobileDrawerStylesApplied && (n._mobileDrawerStylesApplied = !1, n.styles({
1604
- bottom: null,
1605
- boxShadow: null,
1606
- display: null,
1607
- height: null,
1608
- left: null,
1609
- minHeight: null,
1610
- minWidth: null,
1611
- pointerEvents: null,
1612
- position: null,
1613
- top: null,
1614
- transform: null,
1615
- transition: null,
1616
- visibility: null,
1617
- zIndex: null
1618
- })), n._mobileDrawerAriaHiddenApplied && (n._mobileDrawerAriaHiddenApplied = !1, n.attr("aria-hidden", null));
1619
- let t = e._mobile ? "100%" : q(e._asideWidth);
1620
- n.styles({
1621
- flex: "0 0 auto",
1622
- maxWidth: t,
1623
- width: t
1624
- });
1625
- return;
1626
- }
1627
- r?.has("yoya-vmain") && (n.styles({
1628
- flex: "1 1 auto",
1629
- minHeight: "0",
1630
- minWidth: "0"
1631
- }), e._mobile && e._drawerEnabled ? (n.styles({
1632
- maxWidth: "100%",
1633
- width: "100%"
1634
- }), n._mobileDrawerMainStylesApplied = !0) : n._mobileDrawerMainStylesApplied && (n._mobileDrawerMainStylesApplied = !1, n.styles({
1635
- maxWidth: null,
1636
- width: null
1637
- })));
1638
- }
1639
- function Lr(e) {
1640
- let t = e._mobile && e._drawerEnabled && Rr(e), n = t && e._asideOpen, r = e._asideBackdrop, i = e._asideToggle;
1641
- i && i.attr("aria-expanded", n ? "true" : "false").attr("aria-label", n ? "关闭导航" : "打开导航").styles({
1642
- alignItems: "center",
1643
- background: "var(--yoya-color-surface, #ffffff)",
1644
- border: "0",
1645
- borderRadius: "10px",
1646
- boxShadow: t ? "0 2px 10px rgba(15, 23, 42, 0.18)" : "none",
1647
- color: "#172033",
1648
- cursor: "pointer",
1649
- display: t ? "inline-flex" : "none",
1650
- height: "38px",
1651
- justifyContent: "center",
1652
- left: "12px",
1653
- padding: "0",
1654
- position: "fixed",
1655
- top: "max(env(safe-area-inset-top), 10px)",
1656
- width: "38px",
1657
- zIndex: "45"
1658
- }), r && r.styles({
1659
- background: n ? "rgba(15, 23, 42, 0.42)" : null,
1660
- display: n ? "block" : "none",
1661
- inset: "0",
1662
- position: "fixed",
1663
- zIndex: n ? "35" : null
1664
- });
1665
- }
1666
- function Rr(e) {
1667
- return e.children().some((e) => !!(e?._resolved ?? e?._resolve?.() ?? e)?._classes?.has("yoya-vaside"));
1668
- }
1669
- function zr(e) {
1670
- let t = (e?._resolved ?? e?._resolve?.() ?? e)?._classes;
1671
- return !!(t?.has("yoya-vheader") || t?.has("yoya-vfooter"));
1672
- }
1673
- function Br(e, t) {
1674
- t.direction !== void 0 && e.direction(t.direction), e.styles(J({ gap: t.gap }));
1675
- }
1676
- function Vr(e, t) {
1677
- e.styles(J({
1678
- alignItems: t.align,
1679
- flexWrap: Jr(t.wrap),
1680
- justifyContent: t.justify
1681
- })), t.direction === void 0 ? t.mobileDirection !== void 0 && e.mobileDirection(t.mobileDirection) : e.direction(t.direction, t.mobileDirection), t.gap === void 0 ? t.mobileGap !== void 0 && e.mobileGap(t.mobileGap) : e.gap(t.gap, t.mobileGap), t.breakpoint !== void 0 && e.breakpoint(t.breakpoint), t.asideWidth !== void 0 && e.asideWidth(t.asideWidth), t.drawer !== void 0 && e.drawer(t.drawer), t.viewport !== void 0 && e.viewport(t.viewport), t.safeArea !== void 0 && e.safeArea(t.safeArea);
1682
- }
1683
- function Hr(e, t) {
1684
- e.style("height", q(t.height ?? t.size ?? 60)), e.style("width", "100%");
1685
- }
1686
- function Ur(e, t) {
1687
- e.style("width", q(t.width ?? t.size ?? 300));
1688
- }
1689
- function Wr(e, t = {}) {
1690
- t.height !== void 0 && e.style("height", q(t.height));
1691
- }
1692
- function Gr(e) {
1693
- if (e != null && e !== !1) return typeof e == "number" ? `repeat(${e}, minmax(0, 1fr))` : String(e);
1694
- }
1695
- function Kr(e) {
1696
- return typeof e == "number" ? `${e}px` : e || "240px";
1697
- }
1698
- function q(e) {
1699
- return typeof e == "number" ? `${e}px` : e;
1700
- }
1701
- function qr(e) {
1702
- return e ? (Array.isArray(e) ? e : Object.entries(e).map(([e, t]) => ({
1703
- minWidth: e,
1704
- columns: t
1705
- }))).map((e) => ({
1706
- columns: Number(e.columns),
1707
- minWidth: Number.parseInt(e.minWidth, 10)
1708
- })).filter(({ columns: e, minWidth: t }) => Number.isFinite(t) && e > 0).sort((e, t) => e.minWidth - t.minWidth) : [];
1709
- }
1710
- function Jr(e) {
1711
- if (e === !0) return "wrap";
1712
- if (e !== !1 && e != null) return String(e);
1713
- }
1714
- function Yr(e, t = null) {
1715
- let n = t || Kn;
1716
- return Object.fromEntries(Object.entries(e).filter(([e]) => !n.has(e)));
1717
- }
1718
- function J(e) {
1719
- return Object.fromEntries(Object.entries(e).filter(([, e]) => e != null && e !== !1));
1720
- }
1721
- function Xr(e) {
1722
- return Object.prototype.toString.call(e) === "[object Object]";
1723
- }
1724
- //#endregion
1725
- //#region src/core/client-only.js
1726
- var Zr = class extends k {
1727
- constructor(e) {
1728
- super(null), this._loader = e, this._resolved = null;
1729
- }
1730
- _resolve() {
1731
- return this._resolved ||= $r(this._loader), this._resolved;
1732
- }
1733
- toHTML() {
1734
- return this._deleted ? "" : "<div class=\"yoya-client-only\" data-client-only=\"true\"></div>";
1735
- }
1736
- renderDom() {
1737
- if (this._deleted) return null;
1738
- let e = this._resolve().renderDom();
1739
- return this._el && this._el !== e && this._el.parentNode && this._el.parentNode.replaceChild(e, this._el), this._el = e, e;
1740
- }
1741
- children() {
1742
- return this._resolved ? this._resolved.children() : [];
1743
- }
1744
- textContent() {
1745
- return this._resolved && typeof this._resolved.textContent == "function" ? this._resolved.textContent() : "";
1746
- }
1747
- destroy() {
1748
- return this._resolved && this._resolved.destroy(), super.destroy();
1749
- }
1750
- };
1751
- function Qr(e) {
1752
- return new Zr(e);
1753
- }
1754
- function $r(e) {
1755
- if (e instanceof k) return e;
1756
- if (typeof e == "function") return $r(e());
1757
- if (e && typeof e.render == "function") return $r(e.render());
1758
- throw TypeError("vClientOnly loader must return a ViewNode or a component object");
1759
- }
1760
- //#endregion
1761
- //#region src/core/i18n.js
1762
- var ei = "yoya-ui:i18n", Y = /* @__PURE__ */ new Map(), ti = class {
1763
- constructor(e = {}) {
1764
- let t = e.language || "zh-CN";
1765
- this._key = e.key || null, this._storage = ji(e.storage), this._storageKey = e.storageKey || null, this._sharedStorageKey = this._key ? ei : null, this._fallbackLanguage = e.fallbackLanguage || t, this._language = this._readStoredLanguage(t), this._messages = {}, this._listeners = /* @__PURE__ */ new Set(), this.registerMessages(e.messages || {}), this._key && li(this);
1766
- }
1767
- key() {
1768
- return this._key;
1769
- }
1770
- getLanguage() {
1771
- return this._language;
1772
- }
1773
- setLanguage(e) {
1774
- return !e || e === this._language ? this : (this._language = e, this._persistLanguage(), this._notify(), this);
1775
- }
1776
- getFallbackLanguage() {
1777
- return this._fallbackLanguage;
1778
- }
1779
- setFallbackLanguage(e) {
1780
- return e ? (this._fallbackLanguage = e, this._notify(), this) : this;
1781
- }
1782
- clearPersistedLanguage() {
1783
- if (!this._storageKey) {
1784
- if (!this._sharedStorageKey) return this;
1785
- let e = mi(this._storage, this._sharedStorageKey);
1786
- return delete e[this._key], hi(this._storage, this._sharedStorageKey, e), this;
1787
- }
1788
- try {
1789
- this._storage.removeItem(this._storageKey);
1790
- } catch {}
1791
- return this;
1792
- }
1793
- registerLocale(e, t) {
1794
- if (!e || typeof t != "function") return Promise.reject(/* @__PURE__ */ TypeError("registerLocale requires a language name and a loader"));
1795
- let n;
1796
- try {
1797
- n = t();
1798
- } catch (e) {
1799
- return Promise.reject(e);
1800
- }
1801
- return Promise.resolve(n).then((t) => (this.register(e, t || {}), this));
1802
- }
1803
- register(e, t = {}) {
1804
- return e ? (Ai(t).forEach((t) => {
1805
- this._messages[e] = Di(this._messages[e] || {}, t);
1806
- }), this._notify(), this) : this;
1807
- }
1808
- registerMessages(e = {}) {
1809
- return ki(e).forEach((e) => {
1810
- if (e.language) {
1811
- this.register(e.language, e.messages || {});
1812
- return;
1813
- }
1814
- Object.entries(e).forEach(([e, t]) => {
1815
- this.register(e, t);
1816
- });
1817
- }), this;
1818
- }
1819
- t(e, t = {}, n = void 0) {
1820
- let r = gi(this._messages[this._language], e) ?? gi(this._messages[this._fallbackLanguage], e) ?? n ?? e;
1821
- return _i(typeof r == "function" ? r(t, this) : r, t, this);
1822
- }
1823
- text(e, t = {}, n = void 0) {
1824
- return new ni(this, e, t, n);
1825
- }
1826
- subscribe(e) {
1827
- return this._listeners.add(e), () => {
1828
- this._listeners.delete(e);
1829
- };
1830
- }
1831
- _readStoredLanguage(e) {
1832
- if (this._storageKey) try {
1833
- return this._storage.getItem(this._storageKey) || e;
1834
- } catch {
1835
- return e;
1836
- }
1837
- return this._sharedStorageKey && mi(this._storage, this._sharedStorageKey)[this._key] || e;
1838
- }
1839
- _persistLanguage() {
1840
- if (this._storageKey) {
1841
- try {
1842
- this._storage.setItem(this._storageKey, this._language);
1843
- } catch {}
1844
- return;
1845
- }
1846
- if (this._sharedStorageKey) {
1847
- let e = mi(this._storage, this._sharedStorageKey);
1848
- e[this._key] = this._language, hi(this._storage, this._sharedStorageKey, e);
1849
- }
1850
- }
1851
- _notify() {
1852
- this._listeners.forEach((e) => e(this));
1853
- }
1854
- }, ni = class extends A {
1855
- constructor(e, t, n = {}, r = void 0) {
1856
- super(e.t(t, n, r)), this._i18n = e, this._key = t, this._params = n || {}, this._defaultValue = r, this._unsubscribe = e.subscribe(() => this.refresh());
1857
- }
1858
- key(e) {
1859
- return e === void 0 ? this._key : (this._key = e, this.refresh());
1860
- }
1861
- params(e) {
1862
- return e === void 0 ? { ...this._params } : (this._params = e || {}, this.refresh());
1863
- }
1864
- defaultValue(e) {
1865
- return e === void 0 ? this._defaultValue : (this._defaultValue = e, this.refresh());
1866
- }
1867
- refresh() {
1868
- return this.textContent(this._i18n.t(this._key, this._params, this._defaultValue)), this;
1869
- }
1870
- destroy() {
1871
- return this._unsubscribe &&= (this._unsubscribe(), null), super.destroy();
1872
- }
1873
- };
1874
- function ri(e = {}) {
1875
- return new ti(e);
1876
- }
1877
- var ii = ri();
1878
- function ai(e, t = {}) {
1879
- return ii.text(e, t);
1880
- }
1881
- var X = ii;
1882
- function oi(e = ii) {
1883
- return X = e, String.prototype._yoyaUiStringShortcutInstalled ? e : (Object.defineProperty(String.prototype, "_yoyaUiStringShortcutInstalled", {
1884
- configurable: !0,
1885
- enumerable: !1,
1886
- value: !0
1887
- }), Object.defineProperty(String.prototype, "s", {
1888
- configurable: !0,
1889
- enumerable: !1,
1890
- value: function(e, t, n) {
1891
- let r = String(this), i = {}, a = X;
1892
- return ci(t) ? a = t : typeof t == "string" ? a = di(t) || X : (i = t || {}, ci(n) ? a = n : typeof n == "string" && (a = di(n) || X)), a.text(e || r, i, r);
1893
- }
1894
- }), e);
1895
- }
1896
- function si(e, t) {
1897
- let n = X;
1898
- X = e || n;
1899
- try {
1900
- return t();
1901
- } finally {
1902
- X = n;
1903
- }
1904
- }
1905
- function ci(e) {
1906
- return !!(e && typeof e.text == "function");
1907
- }
1908
- function li(e) {
1909
- let t = e?.key?.();
1910
- return t ? (Y.set(t, e), () => {
1911
- Y.get(t) === e && Y.delete(t);
1912
- }) : () => {};
1913
- }
1914
- function ui(e) {
1915
- let t = typeof e == "string" ? e : e?.key?.();
1916
- return t && Y.delete(t), t;
1917
- }
1918
- function di(e) {
1919
- return e && Y.get(e) || null;
1920
- }
1921
- function fi() {
1922
- return new Map(Y);
1923
- }
1924
- function pi(e) {
1925
- return mi(e || ji(), ei);
1926
- }
1927
- function mi(e, t) {
1928
- if (!e) return {};
1929
- try {
1930
- let n = e.getItem(t);
1931
- if (!n) return {};
1932
- let r = JSON.parse(n);
1933
- return r && typeof r == "object" ? r : {};
1934
- } catch {
1935
- return {};
1936
- }
1937
- }
1938
- function hi(e, t, n) {
1939
- if (e) try {
1940
- e.setItem(t, JSON.stringify(n));
1941
- } catch {}
1942
- }
1943
- oi(ii);
1944
- function gi(e, t) {
1945
- if (!(!e || !t)) return Object.prototype.hasOwnProperty.call(e, t) ? e[t] : String(t).split(".").reduce((e, t) => {
1946
- if (e && typeof e == "object" && Object.prototype.hasOwnProperty.call(e, t)) return e[t];
1947
- }, e);
1948
- }
1949
- function _i(e, t, n) {
1950
- let r = String(e), i = [], a = 0;
1951
- for (; a < r.length;) {
1952
- let e = r.charAt(a);
1953
- if (e === "{") {
1954
- let e = vi(r, a), o = r.slice(a + 1, e).trim();
1955
- i.push(yi(o, t, n, r.slice(a, e + 1))), a = e + 1;
1956
- } else i.push(e), a += 1;
1957
- }
1958
- return i.join("");
1959
- }
1960
- function vi(e, t) {
1961
- let n = 0;
1962
- for (let r = t; r < e.length; r += 1) {
1963
- let t = e.charAt(r);
1964
- if (t === "{") n += 1;
1965
- else if (t === "}" && (--n, n === 0)) return r;
1966
- }
1967
- return e.length - 1;
1968
- }
1969
- function yi(e, t, n, r) {
1970
- let i = bi(e);
1971
- if (i.length === 1) return xi(t, i[0], r);
1972
- let [a, o, ...s] = i, c = xi(t, a, void 0);
1973
- if (c == null) return r;
1974
- let l = n?.getLanguage?.() || "zh-CN";
1975
- if (/^number$/i.test(o || "")) return wi(c, l);
1976
- if (/^date$/i.test(o || "")) return Ei(c, l, s[0]);
1977
- if (/^plural$/i.test(o || "")) {
1978
- let e = Ci(c, l), a = Si(i.slice(2).join(","));
1979
- return _i(a[`=${c}`] ?? a[e] ?? a.other ?? r, t, n);
1980
- }
1981
- return r;
1982
- }
1983
- function bi(e) {
1984
- let t = [], n = 0, r = "";
1985
- for (let i of String(e)) i === "{" ? n += 1 : i === "}" && --n, i === "," && n === 0 ? (t.push(r.trim()), r = "") : r += i;
1986
- return r && t.push(r.trim()), t;
1987
- }
1988
- function xi(e, t, n) {
1989
- let r = e?.[t];
1990
- return r === void 0 ? n : r;
1991
- }
1992
- function Si(e) {
1993
- let t = {}, n = /([^\s{}]+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g, r;
1994
- for (; r = n.exec(e);) t[r[1].trim()] = r[2].trim();
1995
- return t;
1996
- }
1997
- function Ci(e, t) {
1998
- let n = Number(e);
1999
- if (typeof Intl > "u" || typeof Intl.PluralRules != "function") return n === 1 ? "one" : "other";
2000
- try {
2001
- return new Intl.PluralRules(t).select(n);
2002
- } catch {
2003
- return n === 1 ? "one" : "other";
2004
- }
2005
- }
2006
- function wi(e, t) {
2007
- if (typeof Intl > "u" || typeof Intl.NumberFormat != "function") return String(e);
2008
- try {
2009
- return new Intl.NumberFormat(t).format(e);
2010
- } catch {
2011
- return String(e);
2012
- }
2013
- }
2014
- var Ti = /* @__PURE__ */ new Set([
2015
- "full",
2016
- "long",
2017
- "medium",
2018
- "short"
2019
- ]);
2020
- function Ei(e, t, n = "medium") {
2021
- if (typeof Intl > "u" || typeof Intl.DateTimeFormat != "function") return String(e);
2022
- try {
2023
- return new Intl.DateTimeFormat(t, { dateStyle: Ti.has(n) ? n : "medium" }).format(new Date(e));
2024
- } catch {
2025
- return String(e);
2026
- }
2027
- }
2028
- function Di(e, t) {
2029
- let n = { ...e };
2030
- return Object.entries(t || {}).forEach(([e, t]) => {
2031
- Oi(t) && Oi(n[e]) ? n[e] = Di(n[e], t) : n[e] = t;
2032
- }), n;
2033
- }
2034
- function Oi(e) {
2035
- return Object.prototype.toString.call(e) === "[object Object]";
2036
- }
2037
- function ki(e) {
2038
- return Array.isArray(e) ? e.flatMap((e) => ki(e)) : [e || {}];
2039
- }
2040
- function Ai(e) {
2041
- return Array.isArray(e) ? e.flatMap((e) => Ai(e)) : [e || {}];
2042
- }
2043
- function ji(e) {
2044
- if (e) return e;
2045
- try {
2046
- if (typeof globalThis < "u" && globalThis.localStorage) return globalThis.localStorage;
2047
- } catch {}
2048
- return Ni();
2049
- }
2050
- var Mi = /* @__PURE__ */ new Map();
2051
- function Ni() {
2052
- return {
2053
- getItem(e) {
2054
- return Mi.has(e) ? Mi.get(e) : null;
2055
- },
2056
- setItem(e, t) {
2057
- Mi.set(e, String(t));
2058
- },
2059
- removeItem(e) {
2060
- Mi.delete(e);
2061
- }
2062
- };
2063
- }
2064
- //#endregion
2065
- //#region src/core/context.js
2066
- var Pi = [], Z = null;
2067
- function Fi(e, t) {
2068
- if (!e || typeof e != "object") return t();
2069
- Pi.push(e);
2070
- try {
2071
- return t();
2072
- } finally {
2073
- Pi.pop();
2074
- }
2075
- }
2076
- function Ii(e) {
2077
- return Z = e && typeof e == "object" ? e : null, Z;
2078
- }
2079
- function Li() {
2080
- return Z = null, null;
2081
- }
2082
- function Ri(e, t = void 0) {
2083
- for (let t = Pi.length - 1; t >= 0; --t) {
2084
- let n = Pi[t];
2085
- if (n && Object.prototype.hasOwnProperty.call(n, e)) return n[e];
2086
- }
2087
- return Z && Object.prototype.hasOwnProperty.call(Z, e) ? Z[e] : t;
2088
- }
2089
- function zi() {
2090
- let e = { ...Z || {} };
2091
- return Pi.forEach((t) => Object.assign(e, t)), e;
2092
- }
2093
- //#endregion
2094
- //#region src/core/devtools.js
2095
- var Bi = !1, Vi = /* @__PURE__ */ new WeakMap(), Hi = /* @__PURE__ */ new Map(), Ui = 1;
2096
- function Wi() {
2097
- return Bi;
2098
- }
2099
- function Gi(e) {}
2100
- function Ki(e) {
2101
- let t = Vi.get(e);
2102
- return t === void 0 && (t = Ui, Ui += 1, Vi.set(e, t)), Hi.set(t, e), t;
2103
- }
2104
- function qi(e) {
2105
- let t = Vi.get(e);
2106
- t !== void 0 && Hi.delete(t);
2107
- }
2108
- function Ji(e) {
2109
- let t = zi();
2110
- e._devtoolsContext = Object.keys(t).length > 0 ? t : null;
2111
- }
2112
- function Yi(e) {
2113
- return Ki(e);
2114
- }
2115
- function Xi(e, t, n) {}
2116
- function Zi(e) {}
2117
- var Qi = Symbol.for("yoya.devtools.bridge");
2118
- function $i() {
2119
- typeof globalThis > "u" || (globalThis[Qi] = {
2120
- captureScope: Ji,
2121
- commit: Zi,
2122
- emit: Gi,
2123
- enabled: () => Bi,
2124
- ensureId: Yi,
2125
- notify: Xi,
2126
- unregister: qi
2127
- });
2128
- }
2129
- $i();
2130
- //#endregion
2131
- //#region src/core/state-node.js
2132
- var ea = /* @__PURE__ */ new Set([
2133
- "state",
2134
- "render",
2135
- "update"
2136
- ]), ta = /* @__PURE__ */ new Set([
2137
- "_attachHost",
2138
- "destroy",
2139
- "getState",
2140
- "setState",
2141
- "subscribe"
2142
- ]);
2143
- function na(e = {}) {
2144
- if (typeof e.render != "function") throw TypeError("vStateNode requires a render function");
2145
- let t = typeof e.state == "function" ? e.state() : { ...e.state || {} }, n = /* @__PURE__ */ new Set(), r = !1, i = null, a = null, o = [], s = {
2146
- _attachHost(e) {
2147
- return a = e, s;
2148
- },
2149
- destroy() {
2150
- if (r) return s;
2151
- if (r = !0, o = [], n.clear(), a = null, i) {
2152
- let e = i;
2153
- i = null, e.forEach((e) => e.destroy());
2154
- }
2155
- return s;
2156
- },
2157
- getState() {
2158
- return s.state();
2159
- },
2160
- render() {
2161
- return r || i || c(), l();
2162
- },
2163
- setState(e) {
2164
- if (r || e == null) return s;
2165
- let a = typeof e == "function" ? e({ ...t }) : e;
2166
- if (!a || typeof a != "object") return s;
2167
- let o = /* @__PURE__ */ new Set(), c = Wi() ? {} : null;
2168
- return Object.entries(a).forEach(([e, n]) => {
2169
- t[e] !== n && (c && (c[e] = {
2170
- from: t[e],
2171
- to: n
2172
- }), t[e] = n, o.add(e));
2173
- }), o.size > 0 && (i && d(o), n.forEach((e) => e(t, s)), Wi() && c && { ...t }), s;
2174
- },
2175
- state() {
2176
- return { ...t };
2177
- },
2178
- subscribe(e) {
2179
- if (typeof e != "function") throw TypeError("vStateNode subscriber must be a function");
2180
- return n.add(e), () => n.delete(e);
2181
- }
2182
- };
2183
- for (let t of Object.keys(e)) if (!(ea.has(t) || typeof e[t] != "function")) {
2184
- if (ta.has(t)) throw TypeError(`vStateNode config key "${t}" conflicts with the built-in API`);
2185
- s[t] = e[t];
2186
- }
2187
- return s;
2188
- function c() {
2189
- let n = i || [];
2190
- o = [];
2191
- let r = w({
2192
- bindings: o,
2193
- getState: () => t
2194
- }, () => e.render.call(s, t, s)), c = Array.isArray(r) ? r.slice() : [r];
2195
- if (c.forEach((e) => {
2196
- if (!(e instanceof k)) throw TypeError("vStateNode render must return a ViewNode or an array of ViewNodes");
2197
- }), i = c, u(), a) {
2198
- a._replaceResolved(l());
2199
- return;
2200
- }
2201
- if (n.length > 0) {
2202
- let e = n.length === 1 ? n[0] : null;
2203
- if (e && e._el && e._el.parentNode && c.length === 1) {
2204
- let t = c[0].renderDom();
2205
- t && e._el.parentNode.replaceChild(t, e._el);
2206
- }
2207
- n.forEach((e) => e.destroy());
2208
- }
2209
- }
2210
- function l() {
2211
- return i ? i.length === 1 ? i[0] : i : null;
2212
- }
2213
- function u() {
2214
- o.forEach((e) => {
2215
- let t = e.evaluate();
2216
- (!e.committed || !Object.is(t, e.last)) && (e.committed = !0, e.last = t, e.commit(t));
2217
- });
2218
- }
2219
- function d(n) {
2220
- return typeof e.update == "function" ? e.update.call(s, t, s, n) === !0 ? (c(), "rebuild") : o.length > 0 ? (u(), "bindings") : "update" : o.length > 0 ? (u(), "bindings") : (c(), "rebuild");
2221
- }
2222
- }
2223
- F(P, { vStateNode: na });
2224
- //#endregion
2225
- //#region src/core/a11y.js
2226
- var ra = [
2227
- "a[href]",
2228
- "button:not([disabled])",
2229
- "input:not([disabled])",
2230
- "select:not([disabled])",
2231
- "textarea:not([disabled])",
2232
- "[tabindex]:not([tabindex=\"-1\"])"
2233
- ].join(", "), ia = "data-yoya-live";
2234
- function aa(e) {
2235
- return !e || typeof e.querySelectorAll != "function" ? [] : Array.from(e.querySelectorAll(ra)).filter((e) => e.getAttribute && e.getAttribute("tabindex") !== "-1");
2236
- }
2237
- function oa(e, t = {}) {
2238
- let { onEscape: n = null, restoreFocus: r = !0 } = t;
2239
- if (typeof document > "u" || !e) return {
2240
- activate() {},
2241
- destroy() {}
2242
- };
2243
- let i = !1, a = null, o = null, s = (t) => {
2244
- if (!i) return;
2245
- if (t.key === "Escape") {
2246
- n && n(t);
2247
- return;
2248
- }
2249
- if (t.key !== "Tab") return;
2250
- let r = aa(e);
2251
- if (r.length === 0) {
2252
- t.preventDefault();
2253
- return;
2254
- }
2255
- let a = document.activeElement, o = r.indexOf(a), s;
2256
- s = t.shiftKey ? o <= 0 ? r.length - 1 : o - 1 : o === -1 || o === r.length - 1 ? 0 : o + 1, t.preventDefault(), r[s].focus();
2257
- };
2258
- return {
2259
- activate: () => {
2260
- if (i) return;
2261
- i = !0, a = document.activeElement, o = L("keydown", s);
2262
- let t = aa(e)[0];
2263
- t && t.focus();
2264
- },
2265
- destroy: () => {
2266
- i && (i = !1, o &&= (o(), null), r && a && typeof a.isConnected == "boolean" && a.isConnected && typeof a.focus == "function" && a.focus());
2267
- }
2268
- };
2269
- }
2270
- function sa(e, t = {}) {
2271
- if (typeof document > "u") return null;
2272
- let { politeness: n = "polite", dedupeKey: r = "yoya-announce" } = t, i = document.querySelector(`[${ia}="${r}"]`);
2273
- return i || (i = document.createElement("div"), i.setAttribute(ia, r), i.setAttribute("aria-live", n), i.setAttribute("aria-atomic", "true"), i.className = "yoya-a11y-live", i.style.cssText = "position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0;padding:0;margin:-1px;", document.body.appendChild(i)), i.textContent = "", queueMicrotask(() => {
2274
- i.textContent = String(e);
2275
- }), i;
2276
- }
2277
- function ca({ key: e, items: t, currentIndex: n = -1, shiftKey: r = !1 }) {
2278
- let i = t?.length || 0;
2279
- if (i === 0) return -1;
2280
- let a = i - 1, o = n >= 0 && n < i ? n : -1;
2281
- return e === "Home" ? 0 : e === "End" ? a : e === "ArrowDown" ? r ? -1 : o === a ? 0 : o + 1 : e === "ArrowUp" ? r || o <= 0 ? a : o - 1 : o;
2282
- }
2283
- //#endregion
2284
- //#region src/core/theme.js
2285
- var la = [
2286
- "light",
2287
- "dark",
2288
- "system"
2289
- ], ua = "yoya-theme-mode", da = "yoya-theme-name";
2290
- function fa() {
2291
- return typeof document > "u" ? null : document.documentElement;
2292
- }
2293
- function pa() {
2294
- try {
2295
- return typeof localStorage < "u" && localStorage !== null;
2296
- } catch {
2297
- return !1;
2298
- }
2299
- }
2300
- function ma(e = "light", t = {}) {
2301
- let n = la.includes(e) ? e : "light", r = fa();
2302
- if (r && (r.dataset.yoyaMode = n), t.persist && pa()) try {
2303
- localStorage.setItem(ua, n);
2304
- } catch {}
2305
- return n;
2306
- }
2307
- function ha() {
2308
- let e = fa(), t = e && e.dataset.yoyaMode;
2309
- return la.includes(t) ? t : "light";
2310
- }
2311
- function ga() {
2312
- let e = ha();
2313
- return e === "system" ? typeof window > "u" || typeof window.matchMedia != "function" ? "light" : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : e;
2314
- }
2315
- function _a(e = "", t = {}) {
2316
- let n = fa();
2317
- if (!e) {
2318
- if (n && delete n.dataset.yoyaTheme, t.persist && pa()) try {
2319
- localStorage.removeItem(da);
2320
- } catch {}
2321
- return "";
2322
- }
2323
- if (n && (n.dataset.yoyaTheme = e), t.persist && pa()) try {
2324
- localStorage.setItem(da, e);
2325
- } catch {}
2326
- return e;
2327
- }
2328
- function va() {
2329
- let e = fa();
2330
- return e && e.dataset.yoyaTheme || "";
2331
- }
2332
- function ya(e = {}) {
2333
- let t = e.mode, n = e.theme;
2334
- if (t === void 0 && pa()) {
2335
- let e = localStorage.getItem(ua);
2336
- la.includes(e) && (t = e);
2337
- }
2338
- return n === void 0 && pa() && (n = localStorage.getItem(da) || ""), t !== void 0 && ma(t, { persist: e.persist }), n !== void 0 && _a(n, { persist: e.persist }), {
2339
- mode: ha(),
2340
- theme: va()
2341
- };
2342
- }
2343
- //#endregion
2344
- //#region src/core/request.js
2345
- var ba = null;
2346
- function xa({ submit: e } = {}) {
2347
- return ba = typeof e == "function" ? e : null, ba;
2348
- }
2349
- var Sa = class {
2350
- method() {
2351
- return "GET";
2352
- }
2353
- headers() {
2354
- return {};
2355
- }
2356
- cookies() {
2357
- return null;
2358
- }
2359
- body() {
2360
- return null;
2361
- }
2362
- params() {
2363
- return {};
2364
- }
2365
- address() {
2366
- return "";
2367
- }
2368
- submit() {
2369
- if (typeof ba != "function") throw Error("RequestBase: 未注册请求传输,请先 configureRequest({ submit })");
2370
- return ba(this);
2371
- }
2372
- }, Ca = class e {
2373
- constructor({ ok: e = !0, code: t = "0", msg: n = null, showType: r = 0, data: i = null, kind: a = "detail", pageNum: o = null, pageSize: s = null, total: c = null } = {}) {
2374
- this.ok = e, this.code = t, this.msg = n, this.showType = r, this.data = i, this.kind = a, this.pageNum = o, this.pageSize = s, this.total = c;
2375
- }
2376
- get isSuccess() {
2377
- return !!this.ok;
2378
- }
2379
- get pages() {
2380
- return this.pageSize > 0 ? Math.ceil((this.total ?? 0) / this.pageSize) : 0;
2381
- }
2382
- static from(t, n = {}) {
2383
- if (!t || t.ok === !1) {
2384
- let e = Error(t?.msg || "请求失败");
2385
- throw e.code = t?.code, e.showType = t?.showType, e;
2386
- }
2387
- let r = t.data, i = Array.isArray(r) && t.pageNum != null, a = Array.isArray(r);
2388
- return new e({
2389
- ok: t.ok,
2390
- code: t.code,
2391
- msg: t.msg,
2392
- showType: t.showType,
2393
- kind: i ? "page" : a ? "list" : "detail",
2394
- data: i || a ? (r ?? []).map((e) => n.toItem ? n.toItem(e) : e) : n.toDetail ? n.toDetail(r) : r,
2395
- pageNum: t.pageNum,
2396
- pageSize: t.pageSize,
2397
- total: t.total
2398
- });
2399
- }
2400
- }, wa = 8, Ta = null;
2401
- function Ea() {
2402
- Ta ||= bn(".yoya-vrouter-views-titlebar,\n.yoya-vrouter-views-popup {\n -ms-overflow-style: none;\n scrollbar-width: none;\n}\n.yoya-vrouter-views-titlebar::-webkit-scrollbar,\n.yoya-vrouter-views-popup::-webkit-scrollbar {\n display: none;\n height: 0;\n width: 0;\n}\n.yoya-vrouter-views-popup-item:hover {\n background: var(--yoya-color-surface-hover, #eef3f9);\n}\n.yoya-vrouter-views-popup-item[aria-current='true'] {\n background: var(--yoya-color-primary-subtle, #e8f0fe);\n color: var(--yoya-color-primary, #1f6feb);\n}\n.yoya-vrouter-views-popup-close {\n color: var(--yoya-color-text-secondary, #57606a);\n opacity: 0.65;\n}\n.yoya-vrouter-views-popup-item:hover .yoya-vrouter-views-popup-close,\n.yoya-vrouter-views-popup-close:hover {\n color: var(--yoya-color-text-danger, #b91c1c);\n opacity: 1;\n}\n.yoya-vrouter-views-context-item:hover {\n background: var(--yoya-color-surface-hover, #f6f8fa);\n}\n.yoya-vrouter-views-context-separator {\n background: var(--yoya-color-border, #d0d7de);\n height: 1px;\n margin: 4px 6px;\n}", "data-yoya-vrouter-views-popup-style");
2403
- }
2404
- function Da(e) {
2405
- let t = [e._defaultPath || "/", e._routes.map((e) => e.pattern).join("|")].join("::"), n = 0;
2406
- for (let e = 0; e < t.length; e += 1) n = n * 31 + t.charCodeAt(e) | 0;
2407
- return `yoya-ui:router-views:${(n >>> 0).toString(36)}`;
2408
- }
2409
- function Oa(e) {
2410
- if (typeof localStorage > "u") return null;
2411
- try {
2412
- let t = JSON.parse(localStorage.getItem(e) || "null");
2413
- return Array.isArray(t?.paths) ? t : null;
2414
- } catch {
2415
- return null;
2416
- }
2417
- }
2418
- var ka = class extends P {
2419
- constructor(e = null) {
2420
- super("div"), this._routes = [], this._defaultPath = null, this._notFoundView = null, this._beforeEach = null, this._currentPath = "/", this._currentParams = {}, this._currentQuery = {}, this._currentRoute = null, this._currentView = null, this._loadingView = null, this._errorView = null, this._navigationGeneration = 0, this._outlet = this, this._subscribers = /* @__PURE__ */ new Set(), this._ignoreNextHashPath = null, this._mode = "hash", this._started = !1, this._onHashChange = () => this._handleHashChange(), this._onPopState = () => this._handlePopState(), this.attr("data-yoya-router", ""), e !== null && this.setup(e);
2421
- }
2422
- setup(e) {
2423
- return typeof e == "function" ? (e(this), this) : super.setup(e);
2424
- }
2425
- default(e) {
2426
- return this._defaultPath = $(e), this;
2427
- }
2428
- mode(e) {
2429
- if (e === void 0) return this._mode;
2430
- let t = e === "history" ? "history" : "hash";
2431
- if (t === this._mode) return this;
2432
- let n = this._started;
2433
- return n && this.stop(), this._mode = t, n && this.start(), this;
2434
- }
2435
- route(e, t) {
2436
- let n = La(e, t);
2437
- return this._routes.push(n), this;
2438
- }
2439
- notFound(e) {
2440
- return this._notFoundView = e, this;
2441
- }
2442
- loading(e) {
2443
- return this._loadingView = e, this;
2444
- }
2445
- error(e) {
2446
- return this._errorView = e, this;
2447
- }
2448
- beforeEach(e) {
2449
- return this._beforeEach = e, this;
2450
- }
2451
- start() {
2452
- this._started ||= (this._stopListening = this._mode === "history" ? R("popstate", this._onPopState) : R("hashchange", this._onHashChange), !0);
2453
- let e = eo(this._mode);
2454
- return (this._mode === "history" ? e === "/" || e === "/index.html" : !window.location.hash) && this._defaultPath ? this.navigate(this._defaultPath, { replace: !0 }) : this.refresh();
2455
- }
2456
- stop() {
2457
- return this._started &&= (this._stopListening?.(), this._stopListening = null, !1), this;
2458
- }
2459
- navigate(e, t = {}) {
2460
- let n = $(e), r = this._resolve(n);
2461
- return this._canEnter(r.context) ? (no(n, t, this._mode) && !t.replace && this._mode === "hash" && (this._ignoreNextHashPath = n), this._renderResolved(r), this) : this;
2462
- }
2463
- refresh() {
2464
- let e = eo(this._mode), t = this._resolve(e);
2465
- return this._canEnter(t.context) && this._renderResolved(t), this;
2466
- }
2467
- renderPath(e) {
2468
- let t = this._resolve(e);
2469
- return this._canEnter(t.context) && this._renderResolved(t), this;
2470
- }
2471
- currentPath() {
2472
- return this._currentPath;
2473
- }
2474
- currentParams() {
2475
- return { ...this._currentParams };
2476
- }
2477
- currentQuery() {
2478
- return { ...this._currentQuery };
2479
- }
2480
- currentRoute() {
2481
- return this._currentRoute;
2482
- }
2483
- currentView() {
2484
- return this._currentView;
2485
- }
2486
- outlet(e) {
2487
- if (e === void 0) return this._outlet;
2488
- if (!(e instanceof P)) throw TypeError("Router outlet must be an ElementNode");
2489
- return this._outlet = e, this;
2490
- }
2491
- subscribe(e) {
2492
- if (typeof e != "function") throw TypeError("Router subscriber must be a function");
2493
- return this._subscribers.add(e), () => this._subscribers.delete(e);
2494
- }
2495
- go(e) {
2496
- return window.history.go(e), this;
2497
- }
2498
- back() {
2499
- return this.go(-1);
2500
- }
2501
- forward() {
2502
- return this.go(1);
2503
- }
2504
- destroy() {
2505
- return this.stop(), this._navigationGeneration += 1, this._destroyCurrentView(), this._subscribers.clear(), super.destroy();
2506
- }
2507
- _resolve(e) {
2508
- let t = this._routes.map((t) => ({
2509
- route: t,
2510
- match: Za(t.pattern, e)
2511
- })).find(({ match: e }) => e);
2512
- if (t) return {
2513
- context: Qa(this, e, t.route, t.match),
2514
- route: t.route,
2515
- view: t.route.view
2516
- };
2517
- let n = io(e);
2518
- return {
2519
- context: Qa(this, e, null, {
2520
- params: {},
2521
- pathname: n.pathname,
2522
- query: n.query
2523
- }),
2524
- route: null,
2525
- view: this._notFoundView
2526
- };
2527
- }
2528
- _handleHashChange() {
2529
- let e = $a();
2530
- return this._ignoreNextHashPath === e ? (this._ignoreNextHashPath = null, this) : (this._ignoreNextHashPath = null, e === this._currentPath ? this : this.refresh());
2531
- }
2532
- _handlePopState() {
2533
- return this._ignoreNextHashPath = null, this.refresh();
2534
- }
2535
- _canEnter(e) {
2536
- let t = {
2537
- params: this.currentParams(),
2538
- path: this._currentPath,
2539
- query: this.currentQuery(),
2540
- route: this._currentRoute
2541
- };
2542
- return !(this._beforeEach && this._beforeEach(e, t, this) === !1 || e.route?.beforeEnter && e.route.beforeEnter(e, t, this) === !1);
2543
- }
2544
- _renderResolved(e) {
2545
- let { context: t, route: n, view: r } = e, i = typeof r == "function" ? r(t) : r;
2546
- if (this._navigationGeneration += 1, !Ya(i)) {
2547
- this._commitView(e, Q(i, t));
2548
- return;
2549
- }
2550
- let a = this._navigationGeneration;
2551
- this._commitView(e, this._buildLoadingView(n, t)), Promise.resolve(i).then((r) => {
2552
- if (a !== this._navigationGeneration || this._deleted) return r;
2553
- let i;
2554
- try {
2555
- i = Q(r, t);
2556
- } catch (i) {
2557
- return this._commitView(e, this._buildErrorView(n, t, i)), r;
2558
- }
2559
- return this._commitView(e, i), r;
2560
- }, (r) => (a !== this._navigationGeneration || this._deleted || this._commitView(e, this._buildErrorView(n, t, r)), r));
2561
- }
2562
- _commitView(e, t) {
2563
- let { context: n, route: r } = e, i = this._outlet;
2564
- this._destroyCurrentView(), i._children = [], i._el && i._el.replaceChildren(), i.child(t), this._currentPath = n.path, this._currentParams = n.params, this._currentQuery = n.query, this._currentRoute = r, this._currentView = t, this._subscribers.forEach((e) => e(n, this));
2565
- }
2566
- _buildLoadingView(e, t) {
2567
- return Xa(e?.loading ?? this._loadingView ?? qa, [t]);
2568
- }
2569
- _buildErrorView(e, t, n) {
2570
- return Xa(e?.error ?? this._errorView ?? Ja, [n, t]);
2571
- }
2572
- _destroyCurrentView() {
2573
- this._currentView?.destroy && this._currentView.destroy(), this._currentView = null;
2574
- }
2575
- };
2576
- function Aa(e = null, t = null, n = null) {
2577
- let r = oe(e, t, n), i = new ka(r.first);
2578
- return N(i, r.options), typeof r.callback == "function" && r.callback(i), i;
2579
- }
2580
- var ja = Aa;
2581
- function Ma(e, t) {
2582
- return {
2583
- config: t,
2584
- pattern: e
2585
- };
2586
- }
2587
- function Na(e = null, t = null, n = null) {
2588
- let r = oe(e, t, n), i = new ka();
2589
- return i.vRoute = (e, t) => (i.route(e, t), i), Ba(i, r.first), N(i, r.options), typeof r.callback == "function" && r.callback(i), i;
2590
- }
2591
- function Pa(e, t = null, n = null) {
2592
- Ra(e);
2593
- let r = new P("a"), i = {
2594
- exact: !0,
2595
- label: null,
2596
- params: {},
2597
- query: {},
2598
- replace: !1,
2599
- to: "/"
2600
- }, a = new P("span").className("yoya-vlink-label");
2601
- r.className("yoya-vlink"), r.attr("data-router-link", "true"), r.child(a), r.to = (e) => Ha(r, i, "to", e), r.params = (e) => Ha(r, i, "params", e || {}), r.query = (e) => Ha(r, i, "query", e || {}), r.replace = (e) => Ha(r, i, "replace", !!e), r.exact = (e) => Ha(r, i, "exact", !!e), r.label = (e) => e === void 0 ? i.label : (i.label = e, U(a, In(e)), r), Va(r, i, t), Ua(r, i, e), r.on("click", (t) => {
2602
- Ka(t, r) && (t.preventDefault(), e.navigate(Wa(i.to, i.params, i.query), { replace: i.replace }));
2603
- });
2604
- let o = e.subscribe(() => Ua(r, i, e)), s = r.destroy.bind(r);
2605
- return r.destroy = () => (o(), s()), typeof n == "function" && n(r), r;
2606
- }
2607
- function Fa(e, t = null, n = null) {
2608
- Ra(e);
2609
- let r = new P("div");
2610
- r.className("yoya-vrouter-view"), r.attr("data-router-view", "true"), typeof t == "function" ? t(r) : t && r.setup(t), e.outlet(r);
2611
- let i = r.destroy.bind(r);
2612
- return r.destroy = () => (e.outlet() === r && e.outlet(e), i()), typeof n == "function" && n(r), r;
2613
- }
2614
- function Ia(e, t = null, n = null) {
2615
- Ra(e);
2616
- let r = new P("div"), i = new P("header").className("yoya-vrouter-views-titlebar").attr({
2617
- role: "tablist",
2618
- "aria-label": "已打开页面"
2619
- }), a = new P("div").className("yoya-vrouter-views-content"), o = M("⋯"), s = new P("button").className("yoya-vrouter-views-expand").attr({
2620
- type: "button",
2621
- "aria-expanded": "false",
2622
- "aria-label": "展开全部标签"
2623
- }).styles({
2624
- alignItems: "center",
2625
- background: "transparent",
2626
- border: "0",
2627
- color: z("color-text-secondary", "#57606a"),
2628
- cursor: "pointer",
2629
- display: "none",
2630
- flexShrink: "0",
2631
- font: "inherit",
2632
- gap: "6px",
2633
- height: "24px",
2634
- justifyContent: "center",
2635
- lineHeight: "1",
2636
- marginBottom: "0",
2637
- marginLeft: "auto",
2638
- minWidth: "24px",
2639
- padding: "0",
2640
- position: "sticky",
2641
- right: "8px",
2642
- zIndex: "2"
2643
- }).child(o), c = new P("div").className("yoya-vrouter-views-popup").attr({
2644
- role: "menu",
2645
- "aria-label": "已打开页面"
2646
- }).styles({
2647
- background: z("color-surface", "#ffffff"),
2648
- border: B("color-border", "#d0d7de"),
2649
- borderRadius: "8px",
2650
- boxShadow: "0 12px 28px rgba(15, 23, 42, 0.18)",
2651
- display: "none",
2652
- maxHeight: "280px",
2653
- maxWidth: "260px",
2654
- minWidth: "180px",
2655
- msOverflowStyle: "none",
2656
- overflowY: "auto",
2657
- padding: "6px",
2658
- position: "fixed",
2659
- scrollbarWidth: "none",
2660
- zIndex: "100"
2661
- }), l = {
2662
- lockTitle: !1,
2663
- overflow: !1,
2664
- persist: !0,
2665
- popupOpen: !1,
2666
- storageKey: Da(e),
2667
- suppressPersist: !1,
2668
- tabs: /* @__PURE__ */ new Map(),
2669
- title: "工作区",
2670
- titleResolver: null,
2671
- titlePosition: "top"
2672
- };
2673
- r.className("yoya-vrouter-views"), r.styles({
2674
- border: B("color-border", "#d0d7de"),
2675
- boxSizing: "border-box",
2676
- overflow: "hidden"
2677
- }), i.styles({
2678
- background: z("color-surface-hover", "#f6f8fa"),
2679
- borderBottom: B("color-border", "#d0d7de"),
2680
- boxSizing: "border-box",
2681
- color: z("color-text-secondary", "#57606a"),
2682
- display: "flex",
2683
- flexWrap: "nowrap",
2684
- fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace",
2685
- fontSize: "13px",
2686
- gap: "0px",
2687
- msOverflowStyle: "none",
2688
- overflowX: "auto",
2689
- overflowY: "hidden",
2690
- padding: "0px 0px",
2691
- scrollbarWidth: "none",
2692
- width: "100%"
2693
- }), a.className("yoya-vrouter-views-content"), a.styles({
2694
- minHeight: "120px",
2695
- padding: "16px"
2696
- }), r.child(i, a, c);
2697
- let u = () => {
2698
- let e = l.titlePosition !== "top";
2699
- if (l.lockTitle) {
2700
- r.styles({
2701
- display: "flex",
2702
- flexDirection: e ? "row" : "column",
2703
- height: "100%",
2704
- minHeight: "0",
2705
- overflow: "hidden"
2706
- }), i.style("flex", "0 0 auto"), a.styles({
2707
- flex: "1 1 auto",
2708
- minHeight: "0",
2709
- minWidth: "0",
2710
- overflow: "auto"
2711
- });
2712
- return;
2713
- }
2714
- r.styles({
2715
- flexDirection: null,
2716
- height: null,
2717
- minHeight: null,
2718
- overflow: "hidden"
2719
- }), i.style("flex", null), a.styles({
2720
- flex: e ? "1 1 auto" : null,
2721
- minHeight: "120px",
2722
- minWidth: e ? "0" : null,
2723
- overflow: null
2724
- });
2725
- }, d = (e) => {
2726
- let t = e !== "top";
2727
- r.styles({
2728
- alignItems: t ? "stretch" : null,
2729
- display: t ? "flex" : null
2730
- }), i.styles({
2731
- background: z("color-surface-hover", "#f6f8fa"),
2732
- borderBottom: t ? null : B("color-border", "#d0d7de"),
2733
- borderLeft: e === "right" ? "1px solid" : null,
2734
- borderLeftColor: e === "right" ? z("color-border", "#d0d7de") : null,
2735
- borderLeftStyle: e === "right" ? "solid" : null,
2736
- borderLeftWidth: e === "right" ? "1px" : null,
2737
- borderRight: e === "left" ? "1px solid" : null,
2738
- borderRightColor: e === "left" ? z("color-border", "#d0d7de") : null,
2739
- borderRightStyle: e === "left" ? "solid" : null,
2740
- borderRightWidth: e === "left" ? "1px" : null,
2741
- boxSizing: "border-box",
2742
- color: z("color-text-secondary", "#57606a"),
2743
- display: "flex",
2744
- flexDirection: t ? "column" : "row",
2745
- flexShrink: t ? "0" : null,
2746
- flexWrap: "nowrap",
2747
- fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace",
2748
- fontSize: "13px",
2749
- gap: "0px",
2750
- msOverflowStyle: "none",
2751
- overflowX: t ? "hidden" : "auto",
2752
- overflowY: t ? "auto" : "hidden",
2753
- padding: t ? "10px 8px" : "0px 0px",
2754
- scrollbarWidth: "none",
2755
- width: t ? null : "100%"
2756
- }), a.styles({
2757
- flex: t ? "1 1 auto" : null,
2758
- minWidth: t ? "0" : null
2759
- });
2760
- let n = e === "right" ? [
2761
- a,
2762
- i,
2763
- c
2764
- ] : [
2765
- i,
2766
- a,
2767
- c
2768
- ];
2769
- r.clearChildren().child(n), r._el && n.forEach((e) => {
2770
- let t = e.renderDom();
2771
- t && r._el.appendChild(t);
2772
- }), u();
2773
- }, f = (e = {}) => {
2774
- let t = l.title, n = e.route?.title;
2775
- if (n !== void 0 && (t = typeof n == "function" ? n(e) : n), l.titleResolver) {
2776
- let n = l.titleResolver(e);
2777
- n != null && (t = typeof n == "function" ? n(e) : n);
2778
- }
2779
- return t ?? "";
2780
- }, p = (e, t) => {
2781
- let n = e.tab, r = l.titlePosition, i = r !== "top";
2782
- e.label.attr("aria-selected", String(t)), n.styles({
2783
- background: t ? z("color-surface", "#ffffff") : z("color-surface-active", "#eaeef2"),
2784
- border: B("color-border", "#d0d7de"),
2785
- borderBottomColor: r === "top" && t ? z("color-surface", "#ffffff") : z("color-border", "#d0d7de"),
2786
- borderLeftColor: "transparent",
2787
- borderRightColor: r === "left" && t ? z("color-surface", "#ffffff") : z("color-border", "#d0d7de"),
2788
- color: t ? z("color-text", "#24292f") : z("color-text-secondary", "#57606a"),
2789
- fontWeight: t ? "600" : "400",
2790
- marginBottom: r === "top" ? "-9px" : "0",
2791
- marginLeft: r === "right" ? "-9px" : "0",
2792
- marginRight: r === "left" ? "-9px" : "0",
2793
- padding: i ? "8px 10px" : "7px 14px 8px"
2794
- });
2795
- }, m = (e) => {
2796
- l.overflow = !!e, r.attr("data-title-overflow", l.overflow ? "true" : null), s.style("display", l.overflow ? "inline-flex" : "none");
2797
- }, h = () => {
2798
- if (l.titlePosition !== "top" || l.tabs.size <= wa) {
2799
- m(!1);
2800
- return;
2801
- }
2802
- m(!0);
2803
- }, g = () => {
2804
- let e = Array.from(l.tabs.entries()), t = e.slice(0, wa).map(([, e]) => e.tab).filter((e) => e !== s);
2805
- if (!(e.length > wa && l.titlePosition === "top")) {
2806
- l.popupOpen && y(), i._children = t, i._childrenDirty = !0, i._el ? i._el.replaceChildren(...t.map((e) => e.renderDom()).filter(Boolean)) : s._el?.remove(), m(!1);
2807
- return;
2808
- }
2809
- if (i._children = [...t, s], i._childrenDirty = !0, i._el) {
2810
- let e = t.map((e) => e.renderDom()).filter(Boolean);
2811
- i._el.replaceChildren(...e, s.renderDom());
2812
- }
2813
- h();
2814
- }, _ = () => {
2815
- if (!(!l.persist || l.suppressPersist || typeof localStorage > "u")) try {
2816
- localStorage.setItem(l.storageKey, JSON.stringify({
2817
- activePath: e.currentPath(),
2818
- paths: Array.from(l.tabs.keys())
2819
- }));
2820
- } catch {}
2821
- }, v = null, y = () => {
2822
- l.popupOpen = !1, r.attr("data-title-popup", null), s.attr("aria-expanded", "false"), c.style("display", "none"), v &&= (v(), null);
2823
- }, b = () => {
2824
- c.clearChildren(), c._el && c._el.replaceChildren(), Array.from(l.tabs.entries()).slice(wa).forEach(([t, n]) => {
2825
- let r = n.text.textContent(), i = new P("div").className("yoya-vrouter-views-popup-item").attr({
2826
- role: "menuitem",
2827
- tabIndex: "0",
2828
- "data-router-view-path": t
2829
- }).styles({
2830
- alignItems: "center",
2831
- borderRadius: "6px",
2832
- color: z("color-text", "#24292f"),
2833
- cursor: "pointer",
2834
- display: "flex",
2835
- fontSize: "13px",
2836
- gap: "8px",
2837
- padding: "7px 8px",
2838
- width: "100%"
2839
- }), a = new P("span").className("yoya-vrouter-views-popup-title").styles({
2840
- flex: "1",
2841
- minWidth: "0",
2842
- overflow: "hidden",
2843
- textOverflow: "ellipsis",
2844
- whiteSpace: "nowrap"
2845
- }).text(r), o = new P("button").className("yoya-vrouter-views-popup-close").attr({
2846
- type: "button",
2847
- "aria-label": `关闭 ${r}`
2848
- }).styles({
2849
- background: "transparent",
2850
- border: "0",
2851
- color: "inherit",
2852
- cursor: "pointer",
2853
- flexShrink: "0",
2854
- font: "inherit",
2855
- lineHeight: "1",
2856
- padding: "2px 4px"
2857
- }).text("×");
2858
- t === e.currentPath() && (i.attr("aria-current", "true"), i.styles({
2859
- background: z("color-primary-subtle", "#e8f0fe"),
2860
- color: z("color-primary", "#1f6feb")
2861
- }));
2862
- let s = () => {
2863
- y(), e.navigate(t);
2864
- };
2865
- i.on("click", s), i.on("keydown", (e) => {
2866
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), s());
2867
- }), o.on("click", (e) => {
2868
- e.stopPropagation(), C(t, e), l.popupOpen && b();
2869
- }), i.child(a, o), c.child(i);
2870
- });
2871
- }, x = () => {
2872
- if (l.tabs.size === 0) return;
2873
- Ea(), b(), l.popupOpen = !0, r.attr("data-title-popup", "true"), s.attr("aria-expanded", "true"), c.styles({ display: "block" }), f();
2874
- let e = (e) => {
2875
- !c._el?.contains(e.target) && !s._el?.contains(e.target) && y();
2876
- }, t = (e) => {
2877
- e.key === "Escape" && y();
2878
- }, n = () => f(), i = () => f(), a = L("click", e), o = L("keydown", t), u = R("scroll", n, !0), d = R("resize", i);
2879
- v = () => {
2880
- a(), o(), u(), d();
2881
- };
2882
- function f() {
2883
- let e = s._el?.getBoundingClientRect(), t = c._el?.getBoundingClientRect();
2884
- if (!e || !t) return;
2885
- let n = window.innerWidth || document.documentElement?.clientWidth || 0, r = window.innerHeight || document.documentElement?.clientHeight || 0, i = e.right - t.width;
2886
- i = Math.max(8, Math.min(i, n - t.width - 8));
2887
- let a = e.bottom + 4;
2888
- a + t.height + 8 > r && (a = Math.max(8, e.top - t.height - 4)), c.styles({
2889
- left: `${i}px`,
2890
- top: `${a}px`
2891
- });
2892
- }
2893
- };
2894
- s.on("click", () => {
2895
- l.popupOpen ? y() : x();
2896
- });
2897
- let S = r.renderDom.bind(r);
2898
- r.renderDom = () => {
2899
- Ea();
2900
- let e = S();
2901
- return h(), e;
2902
- }, r.updateOverflow = h, r.titlePosition = (t) => {
2903
- if (t === void 0) return l.titlePosition;
2904
- let n = za(t);
2905
- return l.titlePosition = n, n !== "top" && l.popupOpen && y(), r.attr("data-title-position", l.titlePosition), i.attr("aria-orientation", l.titlePosition === "top" ? "horizontal" : "vertical"), d(l.titlePosition), g(), l.tabs.forEach((t, n) => {
2906
- p(t, n === e.currentPath());
2907
- }), h(), r;
2908
- }, r.titlePosition(l.titlePosition), r.lockTitle = (e = !0) => e === void 0 ? l.lockTitle : (l.lockTitle = !!e, r.attr("data-title-locked", l.lockTitle ? "true" : null), d(l.titlePosition), h(), r), r.titleLocked = r.lockTitle;
2909
- let C = (t, n = null) => {
2910
- n && n.stopPropagation();
2911
- let r = Array.from(l.tabs.entries()).findIndex(([e]) => e === t), o = l.tabs.get(t);
2912
- if (!o) return;
2913
- let s = o.label.attr("aria-selected") === "true";
2914
- if (l.tabs.delete(t), i._children = i.children().filter((e) => e !== o.tab), i._childrenDirty = !0, o.tab.destroy(), g(), _(), !s) return;
2915
- let c = Array.from(l.tabs.keys());
2916
- if (c.length > 0) {
2917
- let t = c[Math.min(r, c.length - 1)];
2918
- e.navigate(t, { replace: !0 });
2919
- return;
2920
- }
2921
- a.clearChildren().commit(), e._navigationGeneration += 1, e._currentView = null;
2922
- }, w = new P("div").className("yoya-vrouter-views-context").attr({
2923
- role: "menu",
2924
- "aria-label": "标签页操作"
2925
- }).styles({
2926
- background: z("color-surface", "#ffffff"),
2927
- border: B("color-border", "#d0d7de"),
2928
- borderRadius: "8px",
2929
- boxShadow: "0 12px 28px rgba(15, 23, 42, 0.18)",
2930
- display: "none",
2931
- minWidth: "180px",
2932
- padding: "6px",
2933
- position: "fixed",
2934
- zIndex: "100"
2935
- }), T = null, E = () => {
2936
- w.styles({ display: "none" }), w.clearChildren(), w._el?.remove(), T &&= (T(), null);
2937
- }, D = (t, n = null) => {
2938
- let r = new Set(t), o = Array.from(l.tabs.entries()), s = o.findIndex(([e]) => r.has(e));
2939
- if (o.forEach(([e, t]) => {
2940
- r.has(e) && (l.tabs.delete(e), i._children = i.children().filter((e) => e !== t.tab), i._childrenDirty = !0, t.tab.destroy());
2941
- }), g(), _(), l.popupOpen && b(), !r.has(e.currentPath())) return;
2942
- let c = Array.from(l.tabs.keys());
2943
- if (c.length === 0) {
2944
- a.clearChildren().commit(), e._navigationGeneration += 1, e._currentView = null;
2945
- return;
2946
- }
2947
- let u = n && l.tabs.has(n) ? n : c[Math.min(Math.max(s, 0), c.length - 1)];
2948
- e.navigate(u, { replace: !0 });
2949
- }, ee = (t) => {
2950
- if (typeof navigator > "u" || !navigator.clipboard) return;
2951
- let n = typeof window > "u" ? "" : window.location.origin, r = typeof window > "u" ? "" : window.location.pathname, i = e.mode() === "history" ? `${n}${r}${t}` : `${n}${r}#${t}`;
2952
- navigator.clipboard.writeText(i).catch(() => {});
2953
- }, te = (t, n) => {
2954
- l.popupOpen && y(), E();
2955
- let r = Array.from(l.tabs.entries()), i = r.findIndex(([e]) => e === t), a = () => D(r.filter(([e]) => e !== t).map(([e]) => e), t), o = () => D(r.slice(0, i).map(([e]) => e), t), s = () => D(r.slice(i + 1).map(([e]) => e), t), c = () => D(r.map(([e]) => e)), u = (e, t, n = !1, r = !1) => {
2956
- let i = new P("div").className("yoya-vrouter-views-context-item").attr({
2957
- role: "menuitem",
2958
- tabIndex: "0"
2959
- }).text(e).styles({
2960
- alignItems: "center",
2961
- borderRadius: "6px",
2962
- color: n ? z("color-text-danger", "#b91c1c") : z("color-text", "#24292f"),
2963
- cursor: r ? "default" : "pointer",
2964
- display: "flex",
2965
- fontSize: "13px",
2966
- gap: "8px",
2967
- padding: "7px 10px",
2968
- width: "100%"
2969
- });
2970
- return r ? (i.attr("aria-disabled", "true"), i.styles({ opacity: "0.4" })) : i.on("click", () => {
2971
- E(), t();
2972
- }), w.child(i), i;
2973
- }, d = () => w.child(new P("div").className("yoya-vrouter-views-context-separator"));
2974
- u("刷新", () => e.navigate(t, { replace: !0 })), u("复制链接", () => ee(t)), d(), u("关闭", () => C(t), !0), u("关闭其他", a, !1, r.length <= 1), u("关闭左侧", o, !1, i <= 0), u("关闭右侧", s, !1, i === r.length - 1), d(), u("关闭全部", c, !0, r.length === 0), w.bindTo(document.body), w.styles({ display: "block" });
2975
- let f = w._el.getBoundingClientRect(), p = typeof window > "u" ? 0 : window.innerWidth || 0, m = typeof window > "u" ? 0 : window.innerHeight || 0, h = Math.max(8, Math.min(n.clientX || 0, p - f.width - 8)), g = Math.max(8, Math.min(n.clientY || 0, m - f.height - 8));
2976
- w.styles({
2977
- left: `${h}px`,
2978
- top: `${g}px`
2979
- });
2980
- let _ = (e) => {
2981
- w._el?.contains(e.target) || E();
2982
- }, v = (e) => {
2983
- e.key === "Escape" && E();
2984
- }, b = () => E(), x = L("mousedown", _), S = L("keydown", v), te = R("scroll", b, !0), O = R("resize", b);
2985
- T = () => {
2986
- x(), S(), te(), O();
2987
- };
2988
- }, O = (t = {}) => {
2989
- let n = t.path || e.currentPath(), r = new Set(l.titlePosition === "top" ? Array.from(l.tabs.keys()).slice(0, wa) : Array.from(l.tabs.keys())), a = l.tabs.get(n);
2990
- if (a) {
2991
- let e = f(t);
2992
- a.text.textContent(e), a.closeButton.attr("aria-label", `关闭 ${e}`);
2993
- } else {
2994
- let r = new P("div").className("yoya-vrouter-views-title"), o = M(f(t)), s = new P("button").className("yoya-vrouter-views-label").child(o), c = new P("button").className("yoya-vrouter-views-close");
2995
- r.attr({ "data-router-view-path": n }), r.styles({
2996
- alignItems: "center",
2997
- cursor: "pointer",
2998
- display: "inline-flex",
2999
- font: "inherit",
3000
- gap: "8px",
3001
- whiteSpace: "nowrap"
3002
- }), s.attr({
3003
- role: "tab",
3004
- type: "button"
3005
- }), s.styles({
3006
- background: "transparent",
3007
- border: "0",
3008
- color: "inherit",
3009
- cursor: "pointer",
3010
- font: "inherit",
3011
- padding: "0"
3012
- }), s.on("click", () => e.navigate(n)), c.attr({
3013
- type: "button",
3014
- "aria-label": `关闭 ${f(t)}`
3015
- }), c.styles({
3016
- background: "transparent",
3017
- border: "0",
3018
- color: "inherit",
3019
- cursor: "pointer",
3020
- font: "inherit",
3021
- lineHeight: "1",
3022
- padding: "0"
3023
- }), c.text("×"), c.on("click", (e) => C(n, e)), r.on("contextmenu", (e) => {
3024
- e.preventDefault(), e.stopPropagation(), te(n, e);
3025
- }), r.child(s, c), i.child(r), a = {
3026
- closeButton: c,
3027
- label: s,
3028
- tab: r,
3029
- text: o
3030
- }, l.tabs.set(n, a), p(a, !1);
3031
- }
3032
- r.has(n) || (l.tabs.delete(n), l.tabs = new Map([[n, a], ...l.tabs])), l.tabs.forEach((e, t) => p(e, t === n)), g(), l.popupOpen && b(), _();
3033
- }, ne = () => {
3034
- if (!l.persist) return;
3035
- let t = Oa(l.storageKey);
3036
- if (t) {
3037
- l.suppressPersist = !0;
3038
- try {
3039
- t.paths.slice().reverse().forEach((t) => {
3040
- let n = e._resolve(t);
3041
- O({
3042
- ...n.context,
3043
- path: t
3044
- });
3045
- });
3046
- } finally {
3047
- l.suppressPersist = !1, _();
3048
- }
3049
- }
3050
- };
3051
- if (typeof t == "function") t(r);
3052
- else if (t && typeof t == "object") {
3053
- let { persist: e, storageKey: n, title: i, titlePosition: a, titleResolver: o, ...s } = t;
3054
- i !== void 0 && (l.title = i), e !== void 0 && (l.persist = !!e), n !== void 0 && (l.storageKey = n), a !== void 0 && r.titlePosition(a), typeof o == "function" && (l.titleResolver = o), Object.keys(s).length > 0 && r.setup(s);
3055
- }
3056
- e.outlet(a), ne(), (e.currentRoute() || e.currentPath() !== "/") && O({
3057
- params: e.currentParams(),
3058
- path: e.currentPath(),
3059
- query: e.currentQuery(),
3060
- route: e.currentRoute(),
3061
- router: e
3062
- });
3063
- let re = e.subscribe((e) => O(e)), ie = R("resize", () => h()), k = r.destroy.bind(r);
3064
- return r.destroy = () => (l.popupOpen && y(), E(), ie(), re(), e.outlet() === a && e.outlet(e), k()), typeof n == "function" && n(r), r;
3065
- }
3066
- F(P, {
3067
- vLink: Pa,
3068
- vRouter: Na,
3069
- vRouterView: Fa,
3070
- vRouterViews: Ia
3071
- });
3072
- function La(e, t) {
3073
- let n = {
3074
- beforeEnter: null,
3075
- error: null,
3076
- loading: null,
3077
- pattern: ro(e),
3078
- title: null,
3079
- view: null
3080
- };
3081
- return typeof t == "function" || t instanceof k || oo(t) ? (n.view = t, n) : (t && typeof t == "object" && (n.beforeEnter = t.beforeEnter || null, n.error = t.error ?? null, n.loading = t.loading ?? null, n.title = t.title ?? null, n.view = t.view || t.component || null), n);
3082
- }
3083
- function Ra(e) {
3084
- if (!(e instanceof ka)) throw TypeError("vLink and vRouterView require a Router instance");
3085
- }
3086
- function za(e) {
3087
- return e === "left" || e === "right" ? e : "top";
3088
- }
3089
- function Ba(e, t) {
3090
- if (typeof t == "function") return t(e), e;
3091
- if (!t || typeof t != "object") return e;
3092
- let { beforeEach: n, default: r, error: i, loading: a, notFound: o, routes: s = [], ...c } = t;
3093
- return Object.keys(c).length && e.setup(c), r !== void 0 && e.default(r), n && e.beforeEach(n), a !== void 0 && e.loading(a), i !== void 0 && e.error(i), s.forEach((t) => {
3094
- t?.pattern !== void 0 && e.vRoute(t.pattern, t.config);
3095
- }), o !== void 0 && e.notFound(o), e;
3096
- }
3097
- function Va(e, t, n) {
3098
- if (typeof n == "function") {
3099
- n(e);
3100
- return;
3101
- }
3102
- if (typeof n == "string") {
3103
- e.to(n), e.label(n);
3104
- return;
3105
- }
3106
- if (!n) return;
3107
- let { exact: r, label: i, params: a, query: o, replace: s, to: c, ...l } = n;
3108
- Object.keys(l).length && e.setup(l), c !== void 0 && (t.to = c), a !== void 0 && (t.params = a || {}), o !== void 0 && (t.query = o || {}), s !== void 0 && (t.replace = !!s), r !== void 0 && (t.exact = !!r), t.label = i ?? t.to, e.label(t.label);
3109
- }
3110
- function Ha(e, t, n, r) {
3111
- if (r === void 0) return t[n];
3112
- t[n] = r, n === "to" && t.label === null && U(e.children()[0], In(r));
3113
- let i = e._routerInstance;
3114
- return i && Ua(e, t, i), e;
3115
- }
3116
- function Ua(e, t, n) {
3117
- e._routerInstance = n;
3118
- let r = Wa(t.to, t.params, t.query), i = Ga(n.currentPath(), r, t.exact), a = new Set(String(e.attr("class") || "").split(/\s+/).filter(Boolean));
3119
- return a.add("yoya-vlink"), i ? a.add("is-active") : a.delete("is-active"), e.attr({
3120
- "aria-current": i ? "page" : null,
3121
- class: [...a].join(" "),
3122
- href: n.mode() === "history" ? r : `#${r}`
3123
- }), e;
3124
- }
3125
- function Wa(e, t, n) {
3126
- let [r, i = ""] = $(e).split("?"), a = r.replace(/:([A-Za-z0-9_]+)/g, (e, n) => t[n] === void 0 ? e : encodeURIComponent(t[n])), o = new URLSearchParams(i);
3127
- Object.entries(n || {}).forEach(([e, t]) => {
3128
- o.delete(e), Array.isArray(t) ? t.forEach((t) => o.append(e, t)) : t != null && o.set(e, t);
3129
- });
3130
- let s = o.toString();
3131
- return s ? `${a}?${s}` : a;
3132
- }
3133
- function Ga(e, t, n) {
3134
- let r = $(e), i = $(t);
3135
- if (n) return r === i;
3136
- let a = io(r).pathname, o = io(i).pathname;
3137
- return a === o || a.startsWith(`${o}/`);
3138
- }
3139
- function Ka(e, t) {
3140
- return !e.defaultPrevented && e.button === 0 && !e.metaKey && !e.ctrlKey && !e.shiftKey && !e.altKey && (!t.attr("target") || t.attr("target") === "_self");
3141
- }
3142
- function Q(e, t) {
3143
- if (e instanceof k) return e;
3144
- if (e == null) return M("");
3145
- if (oo(e)) return M(e);
3146
- if (typeof e == "object" && e && e.default !== void 0 && typeof e.render != "function") return Q(e.default, t);
3147
- if (typeof e == "function") return Q(e(t), t);
3148
- if (typeof e == "object" && typeof e.render == "function") return Q(e.render(), t);
3149
- throw TypeError("Router route view must be a ViewNode, string, number, null, undefined, a render() component object, a factory returning one, or a module with a default export");
3150
- }
3151
- var qa = () => "加载中…", Ja = (e) => `加载失败:${e?.message ?? String(e)}`;
3152
- function Ya(e) {
3153
- return e !== null && (typeof e == "object" || typeof e == "function") && typeof e.then == "function";
3154
- }
3155
- function Xa(e, t) {
3156
- return Q(typeof e == "function" ? e(...t) : e, t[t.length - 1]);
3157
- }
3158
- function Za(e, t) {
3159
- let n = io(e), r = io(t), i = ao(n.pathname), a = ao(r.pathname);
3160
- if (i.length !== a.length) return null;
3161
- let o = {};
3162
- for (let e = 0; e < i.length; e += 1) {
3163
- let t = i[e], n = a[e];
3164
- if (t.startsWith(":")) {
3165
- o[t.slice(1)] = decodeURIComponent(n);
3166
- continue;
3167
- }
3168
- if (t !== n) return null;
3169
- }
3170
- return {
3171
- params: o,
3172
- pathname: r.pathname,
3173
- query: r.query
3174
- };
3175
- }
3176
- function Qa(e, t, n, r) {
3177
- return {
3178
- params: { ...r.params },
3179
- path: t,
3180
- pathname: r.pathname,
3181
- query: { ...r.query },
3182
- route: n,
3183
- router: e
3184
- };
3185
- }
3186
- function $a() {
3187
- return typeof window > "u" ? "/" : $(window.location.hash.replace(/^#/, "") || "/");
3188
- }
3189
- function eo(e = "hash") {
3190
- return typeof window > "u" ? "/" : e === "history" ? $(`${window.location.pathname}${window.location.search}`) : $a();
3191
- }
3192
- function to(e, t = {}) {
3193
- if (typeof window > "u") return !1;
3194
- let n = `#${e}`;
3195
- return t.replace ? (window.history.replaceState(null, "", n), !0) : window.location.hash !== n && (window.location.hash = n, !0);
3196
- }
3197
- function no(e, t = {}, n = "hash") {
3198
- if (typeof window > "u") return !1;
3199
- if (n !== "history") return to(e, t);
3200
- let r = $(e), i = eo("history");
3201
- return !t.replace && i === r ? !1 : (t.replace ? window.history.replaceState(null, "", r) : window.history.pushState(null, "", r), !0);
3202
- }
3203
- function ro(e) {
3204
- return $(e).split("?")[0] || "/";
3205
- }
3206
- function $(e) {
3207
- let [t, n = ""] = String(e || "/").replace(/^#/, "").split("?"), r = t.startsWith("/") ? t : `/${t}`, i = r.length > 1 ? r.replace(/\/+$/, "") : r;
3208
- return n ? `${i}?${n}` : i;
3209
- }
3210
- function io(e) {
3211
- let [t, n = ""] = $(e).split("?");
3212
- return {
3213
- pathname: t,
3214
- query: Object.fromEntries(new URLSearchParams(n))
3215
- };
3216
- }
3217
- function ao(e) {
3218
- return e.split("/").filter(Boolean);
3219
- }
3220
- function oo(e) {
3221
- return typeof e == "string" || typeof e == "number";
3222
- }
3223
- //#endregion
3224
- //#region src/core/id.js
3225
- var so = null;
3226
- function co() {
3227
- let e = 0;
3228
- return { next() {
3229
- return e += 1, e;
3230
- } };
3231
- }
3232
- function lo(e, t) {
3233
- let n = so;
3234
- so = e;
3235
- try {
3236
- return t();
3237
- } finally {
3238
- so = n;
3239
- }
3240
- }
3241
- //#endregion
3242
- //#region src/core/ssr.js
3243
- function uo(e = {}, t = {}) {
3244
- let { cookie: n = "", url: r = "", acceptLanguage: i = "" } = e || {}, { cookieKey: a = "yoya-lang", queryKey: o = "locale", defaultLanguage: s = "zh-CN" } = t;
3245
- return fo(n, a) || po(r, o) || mo(i) || s;
3246
- }
3247
- function fo(e, t) {
3248
- if (!e || !t) return null;
3249
- for (let n of String(e).split(";")) {
3250
- let e = n.indexOf("=");
3251
- if (e === -1 || n.slice(0, e).trim() !== t) continue;
3252
- let r = n.slice(e + 1).trim();
3253
- if (!r) return null;
3254
- try {
3255
- return decodeURIComponent(r);
3256
- } catch {
3257
- return r;
3258
- }
3259
- }
3260
- return null;
3261
- }
3262
- function po(e, t) {
3263
- if (!e || !t) return null;
3264
- let n = String(e).indexOf("?");
3265
- return n === -1 ? null : new URLSearchParams(String(e).slice(n + 1)).get(t) || null;
3266
- }
3267
- function mo(e) {
3268
- if (!e) return null;
3269
- let t = String(e).split(",")[0];
3270
- return t && t.split(";")[0].trim() || null;
3271
- }
3272
- function ho(e, t) {
3273
- return e ? a(typeof e == "function" ? e() : e, t) : t();
3274
- }
3275
- function go(e, t, n, r, i) {
3276
- return ho(e, () => _o(t, r, () => vo(n, r, i)));
3277
- }
3278
- function _o(e, t, n) {
3279
- return e ? Fi(typeof e == "function" ? e(t) : e, n) : n();
3280
- }
3281
- function vo(e, t, n) {
3282
- return e ? si(typeof e == "function" ? e(t) : e, n) : n();
3283
- }
3284
- function yo(e, t = null) {
3285
- if (e instanceof k) return e;
3286
- if (typeof e == "function") return yo(e(t), t);
3287
- if (e && typeof e.render == "function") return yo(e.render(), t);
3288
- throw TypeError("renderToString/mount requires a ViewNode, a component object with render(), or a factory function");
3289
- }
3290
- function bo(e) {
3291
- let t = 1;
3292
- return typeof e.children == "function" && e.children().forEach((e) => {
3293
- (e instanceof j ? e._resolveList() : [e]).forEach((e) => {
3294
- t += bo(e);
3295
- });
3296
- }), t;
3297
- }
3298
- function xo(e, t = {}) {
3299
- let { access: n = null, context: r = null, maxNodes: i = Infinity, state: a = null, i18n: o = null } = t || {}, s = Eo(a);
3300
- return lo(co(), () => go(n, r, o, a, () => {
3301
- let t = typeof e == "function", n = yo(e, a), r;
3302
- try {
3303
- r = bo(n) > i ? {
3304
- exceeded: !0,
3305
- html: "",
3306
- state: s
3307
- } : {
3308
- exceeded: !1,
3309
- html: n.toHTML(),
3310
- state: s
3311
- };
3312
- } finally {
3313
- t && n.destroy();
3314
- }
3315
- return r;
3316
- }));
3317
- }
3318
- var So = class extends I {
3319
- constructor() {
3320
- super("html", null), this._headCallback = null, this._bodyCallback = null;
3321
- }
3322
- head(e) {
3323
- return this._headCallback = typeof e == "function" ? e : null, this;
3324
- }
3325
- body(e) {
3326
- return this._bodyCallback = typeof e == "function" ? e : null, this;
3327
- }
3328
- vBody(...e) {
3329
- return this.body((t) => t.vBody(...e));
3330
- }
3331
- };
3332
- function Co(e) {
3333
- return String(e ?? "").replace(/&/g, "&amp;").replace(/"/g, "&quot;");
3334
- }
3335
- function wo(e, t = {}, n = {}) {
3336
- let { client: r = "/client.js", containerId: i = "app", access: a = null, context: o = null, i18n: s = null, maxNodes: c = Infinity, messages: l, stateId: u = "__YOYA_DATA__" } = n || {}, d = t || {};
3337
- if (!e || typeof e.page != "function") throw TypeError("renderPage requires { page: (page, state) => {} }");
3338
- let f = s || (l ? () => ri({
3339
- language: d.lang || "zh-CN",
3340
- messages: l
3341
- }) : null), p = Eo(d);
3342
- return lo(co(), () => go(a, o, f, d, () => {
3343
- let t = new So();
3344
- e.page(t, d);
3345
- let n = new I("head");
3346
- t._headCallback && t._headCallback(n, d);
3347
- let a = new I("body");
3348
- t._bodyCallback && t._bodyCallback(a, d);
3349
- let o = bo(a) > c, s = n.toHTML(), l = `<div id="${Co(i)}">`, f = o ? `${l}</div>` : `${l}${a.toHTML()}</div>`, m = `<script type="application/json" id="${Co(u)}">${p}<\/script>`, h = `<script type="module" src="${Co(r)}"><\/script>`;
3350
- return n.destroy(), a.destroy(), `<!doctype html>
3351
- <html lang="${Co(d.lang || "zh-CN")}">
3352
- ${s}
3353
- <body>
3354
- ${f}
3355
- ${m}
3356
- ${h}
3357
- </body>
3358
- </html>`;
3359
- }));
3360
- }
3361
- function To(e, t = {}) {
3362
- if (typeof document > "u") return null;
3363
- let { messages: n, i18n: r = null, stateId: i = "__YOYA_DATA__", target: a = "#app" } = t || {}, o = document.getElementById(i), s = Do(o ? o.textContent : ""), c = r || (n ? () => ri({
3364
- language: s?.lang || "zh-CN",
3365
- messages: n
3366
- }) : null), l = D(a);
3367
- return l && l.firstElementChild ? ko(e, a, s, {
3368
- access: t.access,
3369
- context: t.context,
3370
- i18n: c
3371
- }) : Oo(e, a, s, {
3372
- access: t.access,
3373
- context: t.context,
3374
- i18n: c
3375
- });
3376
- }
3377
- function Eo(e) {
3378
- return e == null ? null : JSON.stringify(e).replace(/</g, "\\u003c");
3379
- }
3380
- function Do(e) {
3381
- return e == null || e === "" ? null : JSON.parse(e);
3382
- }
3383
- function Oo(e, t, n = null, r = {}) {
3384
- return lo(co(), () => go(r.access, r.context, r.i18n, n, () => {
3385
- let r = yo(e, n), i = D(t);
3386
- return i && (i.replaceChildren(), i.appendChild(r.renderDom())), r;
3387
- }));
3388
- }
3389
- function ko(e, t, n = null, r = {}) {
3390
- return lo(co(), () => go(r.access, r.context, r.i18n, n, () => {
3391
- let r = yo(e, n), i = D(t);
3392
- if (i) {
3393
- let e = i.firstElementChild;
3394
- e ? (Ao(r, e), Mo(r), jo(r), r.renderDom()) : i.appendChild(r.renderDom());
3395
- }
3396
- return r;
3397
- }));
3398
- }
3399
- function Ao(e, t) {
3400
- if (e instanceof j) {
3401
- let n = e._resolveList();
3402
- if (n.length === 1) {
3403
- Ao(n[0], t);
3404
- return;
3405
- }
3406
- let r = t ? Array.from(t.childNodes) : [];
3407
- n.forEach((e, t) => Ao(e, r[t]));
3408
- return;
3409
- }
3410
- if (e instanceof A) {
3411
- t && t.nodeType === 3 ? (e._textNode = t, e._el = t, t.textContent !== e._content && (t.textContent = e._content)) : No(t, e.renderDom());
3412
- return;
3413
- }
3414
- if (t && t.nodeType === 1 && t.tagName.toLowerCase() === e._tagName) {
3415
- e._el = t, e._hydrated = !0;
3416
- let n = Array.from(t.childNodes), r = 0;
3417
- e.children().forEach((e) => {
3418
- (e instanceof j ? e._resolveList() : [e]).forEach((e) => {
3419
- Ao(e, n[r]), r += 1;
3420
- });
3421
- });
3422
- return;
3423
- }
3424
- No(t, e.renderDom());
3425
- }
3426
- function jo(e) {
3427
- if (e instanceof j) {
3428
- e._resolveList().forEach((e) => jo(e));
3429
- return;
3430
- }
3431
- e instanceof A || (e._el && e._hydrated && e._applyBindingsToElement(), e.children().forEach(jo));
3432
- }
3433
- function Mo(e) {
3434
- if (e instanceof j) {
3435
- e._resolveList().forEach((e) => Mo(e));
3436
- return;
3437
- }
3438
- e instanceof A || (e.children().forEach(Mo), typeof e.hydrateSnapshot == "function" && e.hydrateSnapshot());
3439
- }
3440
- function No(e, t) {
3441
- e && e.parentNode && e.parentNode.replaceChild(t, e);
3442
- }
3443
- //#endregion
3444
- export { Zr as ClientOnlyNode, j as ComponentNode, P as ElementNode, I as HtmlElementNode, ti as I18n, ni as I18nTextNode, So as PageDocumentNode, Sa as RequestBase, Ca as Result, ka as Router, A as TextNode, A as VTextNode, A as ViewTextNode, Hn as VMasonry, Rn as VSplitPanel, Wn as VThemeShell, k as ViewNode, de as a, fe as abbr, pe as address, sa as announce, N as applyElementOptions, me as area, he as article, ge as aside, _e as audio, ve as b, ye as base, be as bdi, xe as bdo, L as bindDocumentEvent, R as bindWindowEvent, Se as blockquote, Ce as body, we as br, Te as button, Ee as canvas, De as caption, Qn as center, Oe as cite, Li as clearInstalledContext, ke as code, Ae as col, je as colgroup, xa as configureRequest, or as container, i as createAccess, se as createElementFactory, oa as createFocusTrap, le as createHtmlFactories, ri as createI18n, Aa as createRouter, ir as createVBodyPage, s as currentAccess, Ri as currentContext, Me as data, Ne as datalist, Pe as dd, Fe as del, Ie as details, Le as dfn, Re as dialog, ze as div, hr as divider, Be as dl, Ve as dt, He as em, Ue as embed, ee as escapeHtml, We as fieldset, Ge as figcaption, Ke as figure, Jn as flex, qe as footer, Je as form, aa as getFocusableElements, di as getI18n, pi as getPersistedI18nLocales, ha as getYoyaMode, va as getYoyaTheme, tr as grid, Ye as h1, Xe as h2, Ze as h3, Qe as h4, $e as h5, et as h6, tt as head, nt as header, rt as hgroup, it as hr, Zn as hstack, at as html, ko as hydrate, To as hydrateOrMount, ot as i, ii as i18n, ai as i18nText, st as iframe, ct as img, ya as initYoyaTheme, bn as injectDocumentStyle, lt as input, ut as ins, o as installAccess, Ii as installContext, oi as installI18nStringShortcut, dt as kbd, ft as label, pt as legend, mt as li, ht as link, fi as listI18n, gt as main, _t as map, vt as mark, yt as menu, bt as meta, xt as meter, cr as mobileLayout, Oo as mount, ca as moveByKey, St as nav, ae as normalizeChild, oe as normalizeSetupArguments, Ct as noscript, wt as object, Tt as ol, Et as optgroup, Dt as option, Ot as output, kt as p, n as parseAccessSpec, Do as parseState, At as picture, jt as pre, Mt as progress, Nt as q, F as registerChildFactories, li as registerI18n, wo as renderPage, xo as renderToString, uo as resolveLocale, D as resolveTarget, ga as resolveYoyaMode, nr as responsiveGrid, ja as router, Pt as rp, Ft as rt, It as ruby, Lt as s, Rt as samp, zt as script, Bt as search, Vt as section, Ht as select, Ut as selectedcontent, Eo as serializeState, ma as setYoyaMode, _a as setYoyaTheme, Wt as slot, Gt as small, zi as snapshotContext, Kt as source, mr as spacer, qt as span, Yn as stack, r as stripAccessCode, Jt as strong, Yt as style, Xt as styleTag, Zt as sub, Qt as summary, $t as sup, en as table, tn as tbody, nn as td, rn as template, M as text, M as vText, an as textarea, on as tfoot, sn as th, cn as thead, ln as time, un as title, dn as tr, fn as track, pn as u, mn as ul, yn as unbindDocumentEvent, ui as unregisterI18n, dr as vAside, rr as vBody, Qr as vClientOnly, er as vCol, sr as vContainer, pr as vFooter, ur as vHeader, Pa as vLink, fr as vMain, Un as vMasonry, lr as vMobileLayout, Ma as vRoute, Na as vRouter, Fa as vRouterView, Ia as vRouterViews, $n as vRow, zn as vSplitPanel, na as vStateNode, Gn as vThemeShell, hn as varTag, gn as video, Xn as vstack, _n as wbr, a as withAccess, Fi as withContext, si as withI18nStringShortcut };