zero-query 1.2.6 → 1.2.8
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/cli/commands/dev/index.js +25 -0
- package/cli/commands/dev/server.js +12 -12
- package/cli/scaffold/webrtc/app/components/video-room.js +51 -25
- package/cli/scaffold/webrtc/global.css +43 -5
- package/dist/zquery.dist.zip +0 -0
- package/dist/zquery.js +3 -3
- package/dist/zquery.min.js +2 -2
- package/package.json +3 -3
- package/tests/dev-server.test.js +7 -7
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
const fs = require('fs');
|
|
13
13
|
const path = require('path');
|
|
14
|
+
const { spawn } = require('child_process');
|
|
14
15
|
|
|
15
16
|
const { args, flag, option } = require('../../args');
|
|
16
17
|
const { createServer } = require('./server');
|
|
@@ -54,6 +55,30 @@ async function devServer() {
|
|
|
54
55
|
const bundleMode = flag('bundle', 'b');
|
|
55
56
|
const root = resolveRoot(htmlEntry);
|
|
56
57
|
|
|
58
|
+
// If the target project ships its own server (ssr / webrtc scaffolds),
|
|
59
|
+
// delegate to it instead of starting the static dev server. The bundled
|
|
60
|
+
// signaling/SSR server already serves the front-end on its own port,
|
|
61
|
+
// and the basic dev server has no WebSocket/signaling support, so
|
|
62
|
+
// running it here would silently break things like the webrtc demo.
|
|
63
|
+
// Skip the redirect when the user explicitly asked for --bundle, which
|
|
64
|
+
// is only meaningful for the static dev server.
|
|
65
|
+
const serverEntry = path.join(root, 'server', 'index.js');
|
|
66
|
+
if (!bundleMode && fs.existsSync(serverEntry)) {
|
|
67
|
+
const rel = path.relative(process.cwd(), root) || '.';
|
|
68
|
+
console.log(`\n Detected project server at ${path.join(rel, 'server', 'index.js')}`);
|
|
69
|
+
console.log(` Launching it instead of the static dev server.`);
|
|
70
|
+
console.log(` (Pass --bundle / -b to force the static dev server.)\n`);
|
|
71
|
+
const child = spawn('node', ['server/index.js'], {
|
|
72
|
+
cwd: root,
|
|
73
|
+
stdio: 'inherit',
|
|
74
|
+
shell: process.platform === 'win32',
|
|
75
|
+
});
|
|
76
|
+
process.on('SIGINT', () => { child.kill(); process.exit(); });
|
|
77
|
+
process.on('SIGTERM', () => { child.kill(); process.exit(); });
|
|
78
|
+
child.on('exit', (code) => process.exit(code || 0));
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
57
82
|
// In bundle mode, build the app first then serve from dist/server/
|
|
58
83
|
let serveRoot = root;
|
|
59
84
|
if (bundleMode) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* cli/commands/dev/server.js - HTTP server & SSE broadcasting
|
|
3
3
|
*
|
|
4
|
-
* Creates the zero-
|
|
4
|
+
* Creates the @zero-server/sdk app, serves static files, injects the
|
|
5
5
|
* error-overlay snippet into HTML responses, and manages the
|
|
6
6
|
* SSE connection pool for live-reload events.
|
|
7
7
|
*
|
|
8
|
-
* Uses zero-
|
|
8
|
+
* Uses @zero-server/sdk middleware:
|
|
9
9
|
* - helmet() → security headers (relaxed CSP for dev inline scripts)
|
|
10
10
|
* - compress() → brotli/gzip/deflate response compression
|
|
11
11
|
* - cors() → allow cross-origin requests in development
|
|
@@ -29,7 +29,7 @@ class SSEPool {
|
|
|
29
29
|
this._clients = new Set();
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
/** @param {import('zero-
|
|
32
|
+
/** @param {import('@zero-server/sdk').SSEStream} sse */
|
|
33
33
|
add(sse) {
|
|
34
34
|
this._clients.add(sse);
|
|
35
35
|
sse.on('close', () => this._clients.delete(sse));
|
|
@@ -57,7 +57,7 @@ class SSEPool {
|
|
|
57
57
|
// ---------------------------------------------------------------------------
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
|
-
* Prompt the user to auto-install zero-
|
|
60
|
+
* Prompt the user to auto-install @zero-server/sdk when it isn't found.
|
|
61
61
|
* Resolves `true` if the user accepts, `false` otherwise.
|
|
62
62
|
*/
|
|
63
63
|
function promptInstall() {
|
|
@@ -67,7 +67,7 @@ function promptInstall() {
|
|
|
67
67
|
});
|
|
68
68
|
return new Promise((resolve) => {
|
|
69
69
|
rl.question(
|
|
70
|
-
'\n The local dev server requires zero-
|
|
70
|
+
'\n The local dev server requires @zero-server/sdk, which is not installed.\n' +
|
|
71
71
|
' This package is only used during development and is not needed\n' +
|
|
72
72
|
' for building, bundling, or production.\n' +
|
|
73
73
|
' Install it now? (y/n): ',
|
|
@@ -88,19 +88,19 @@ function promptInstall() {
|
|
|
88
88
|
* @returns {Promise<{ app, pool: SSEPool, listen: Function }>}
|
|
89
89
|
*/
|
|
90
90
|
async function createServer({ root, htmlEntry, port, noIntercept }) {
|
|
91
|
-
let
|
|
91
|
+
let sdk;
|
|
92
92
|
try {
|
|
93
|
-
|
|
93
|
+
sdk = require('@zero-server/sdk');
|
|
94
94
|
} catch {
|
|
95
95
|
const ok = await promptInstall();
|
|
96
96
|
if (!ok) {
|
|
97
|
-
console.error('\n ✖ Cannot start dev server without zero-
|
|
97
|
+
console.error('\n ✖ Cannot start dev server without @zero-server/sdk.\n');
|
|
98
98
|
process.exit(1);
|
|
99
99
|
}
|
|
100
100
|
const { execSync } = require('child_process');
|
|
101
|
-
console.log('\n Installing zero-
|
|
102
|
-
execSync('npm install zero-
|
|
103
|
-
|
|
101
|
+
console.log('\n Installing @zero-server/sdk...\n');
|
|
102
|
+
execSync('npm install @zero-server/sdk --save-dev', { stdio: 'inherit' });
|
|
103
|
+
sdk = require('@zero-server/sdk');
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
const {
|
|
@@ -110,7 +110,7 @@ async function createServer({ root, htmlEntry, port, noIntercept }) {
|
|
|
110
110
|
compress,
|
|
111
111
|
cors,
|
|
112
112
|
debug,
|
|
113
|
-
} =
|
|
113
|
+
} = sdk;
|
|
114
114
|
|
|
115
115
|
debug.level('silent');
|
|
116
116
|
|
|
@@ -529,6 +529,32 @@ $.component('video-room', {
|
|
|
529
529
|
} catch (_) { return ''; }
|
|
530
530
|
},
|
|
531
531
|
|
|
532
|
+
// Lucide-style line icons, 24x24, strokes follow `currentColor` so they
|
|
533
|
+
// pick up button text colour automatically. Used everywhere instead of
|
|
534
|
+
// emoji so glyphs look consistent across OSes and inside dark UI chrome.
|
|
535
|
+
_icon(name, size) {
|
|
536
|
+
const s = size || 18;
|
|
537
|
+
const head = '<svg xmlns="http://www.w3.org/2000/svg" width="' + s + '" height="' + s +
|
|
538
|
+
'" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"' +
|
|
539
|
+
' stroke-linecap="round" stroke-linejoin="round" class="icon icon-' + name + '" aria-hidden="true">';
|
|
540
|
+
const paths = {
|
|
541
|
+
'mic': '<path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"/><path d="M19 10v2a7 7 0 0 1-14 0v-2"/><line x1="12" y1="19" x2="12" y2="23"/><line x1="8" y1="23" x2="16" y2="23"/>',
|
|
542
|
+
'mic-off': '<line x1="1" y1="1" x2="23" y2="23"/><path d="M9 9v3a3 3 0 0 0 5.12 2.12M15 9.34V4a3 3 0 0 0-5.94-.6"/><path d="M17 16.95A7 7 0 0 1 5 12v-2m14 0v2a7 7 0 0 1-.11 1.23"/><line x1="12" y1="19" x2="12" y2="23"/><line x1="8" y1="23" x2="16" y2="23"/>',
|
|
543
|
+
'video': '<polygon points="23 7 16 12 23 17 23 7"/><rect x="1" y="5" width="15" height="14" rx="2" ry="2"/>',
|
|
544
|
+
'video-off': '<path d="M16 16v1a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h2m5.66 0H14a2 2 0 0 1 2 2v3.34l1 1L23 7v10"/><line x1="1" y1="1" x2="23" y2="23"/>',
|
|
545
|
+
'monitor': '<rect x="2" y="3" width="20" height="14" rx="2" ry="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/>',
|
|
546
|
+
'volume': '<polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"/><path d="M15.54 8.46a5 5 0 0 1 0 7.07"/><path d="M19.07 4.93a10 10 0 0 1 0 14.14"/>',
|
|
547
|
+
'pin': '<path d="M12 17v5"/><path d="M9 10.76V6h-.5a1.5 1.5 0 0 1 0-3h7a1.5 1.5 0 0 1 0 3H15v4.76a2 2 0 0 0 .55 1.38l2.45 2.6V17H6v-2.26l2.45-2.6A2 2 0 0 0 9 10.76z"/>',
|
|
548
|
+
'phone-off': '<path d="M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-3.33-2.67m-2.67-3.34a19.79 19.79 0 0 1-3.07-8.63A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91"/><line x1="23" y1="1" x2="1" y2="23"/>',
|
|
549
|
+
'stop': '<rect x="6" y="6" width="12" height="12" rx="1"/>',
|
|
550
|
+
'send': '<line x1="22" y1="2" x2="11" y2="13"/><polygon points="22 2 15 22 11 13 2 9 22 2"/>',
|
|
551
|
+
'message': '<path d="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"/>',
|
|
552
|
+
'wave': '<path d="M18 11V6a2 2 0 0 0-4 0v6"/><path d="M14 10V4a2 2 0 0 0-4 0v8"/><path d="M10 10.5V6a2 2 0 0 0-4 0v8"/><path d="M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"/>',
|
|
553
|
+
'alert': '<path d="M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/>',
|
|
554
|
+
};
|
|
555
|
+
return head + (paths[name] || '') + '</svg>';
|
|
556
|
+
},
|
|
557
|
+
|
|
532
558
|
// ---- Tile assembly --------------------------------------------------
|
|
533
559
|
|
|
534
560
|
_collectTiles() {
|
|
@@ -585,7 +611,7 @@ $.component('video-room', {
|
|
|
585
611
|
if (!hasMic) hint.push('no microphone detected');
|
|
586
612
|
if (!hasCam) hint.push('no camera detected');
|
|
587
613
|
if (!hasShare) hint.push('screen sharing unavailable in this browser');
|
|
588
|
-
const hintLine = hint.length ? `<div class="device-hint"
|
|
614
|
+
const hintLine = hint.length ? `<div class="device-hint">${this._icon('alert', 14)}<span>${$.escapeHtml(hint.join(' · '))}</span></div>` : '';
|
|
589
615
|
|
|
590
616
|
return `
|
|
591
617
|
<div class="lobby">
|
|
@@ -699,9 +725,9 @@ $.component('video-room', {
|
|
|
699
725
|
<span class="dot ${micOn && !micMuted ? 'on' : 'off'}"></span>
|
|
700
726
|
<span class="who">${$.escapeHtml(displayName)} <small>(you)</small></span>
|
|
701
727
|
<span class="roster-icons">
|
|
702
|
-
${micOn ? (micMuted ? '
|
|
703
|
-
${camOn ? (camMuted ? '
|
|
704
|
-
${sharing ? '
|
|
728
|
+
${micOn ? this._icon(micMuted ? 'mic-off' : 'mic', 14) : ''}
|
|
729
|
+
${camOn ? this._icon(camMuted ? 'video-off' : 'video', 14) : ''}
|
|
730
|
+
${sharing ? this._icon('monitor', 14) : ''}
|
|
705
731
|
</span>
|
|
706
732
|
</div>
|
|
707
733
|
${peers.map((p) => `
|
|
@@ -709,14 +735,14 @@ $.component('video-room', {
|
|
|
709
735
|
<span class="dot ${p.micOn && !p.micMuted ? 'on' : 'off'}"></span>
|
|
710
736
|
<span class="who">${$.escapeHtml(p.name || p.id)}</span>
|
|
711
737
|
<span class="roster-icons">
|
|
712
|
-
${p.micOn ? (p.micMuted ? '
|
|
713
|
-
${p.camOn ? (p.camMuted ? '
|
|
714
|
-
${p.sharing ? '
|
|
738
|
+
${p.micOn ? this._icon(p.micMuted ? 'mic-off' : 'mic', 14) : ''}
|
|
739
|
+
${p.camOn ? this._icon(p.camMuted ? 'video-off' : 'video', 14) : ''}
|
|
740
|
+
${p.sharing ? this._icon('monitor', 14) : ''}
|
|
715
741
|
</span>
|
|
716
742
|
</div>
|
|
717
743
|
`).join('')}
|
|
718
744
|
</div>
|
|
719
|
-
<button class="leave" @click="leave">Leave room</button>
|
|
745
|
+
<button class="leave" @click="leave">${this._icon('phone-off', 16)}<span>Leave room</span></button>
|
|
720
746
|
</aside>
|
|
721
747
|
|
|
722
748
|
<section class="stage">
|
|
@@ -728,25 +754,25 @@ $.component('video-room', {
|
|
|
728
754
|
<div class="controls">
|
|
729
755
|
<div class="ctl-group">
|
|
730
756
|
${micOn
|
|
731
|
-
? `<button class="${micMuted ? 'off' : ''}" @click="toggleMute" title="${micMuted ? 'Unmute mic' : 'Mute mic'}">${micMuted ? '
|
|
732
|
-
<button class="off ghost" @click="stopMic" title="Stop microphone"
|
|
733
|
-
: `<button class="primary" @click="startMic"
|
|
757
|
+
? `<button class="${micMuted ? 'off' : ''}" @click="toggleMute" title="${micMuted ? 'Unmute mic' : 'Mute mic'}">${this._icon(micMuted ? 'mic-off' : 'mic')}<span>${micMuted ? 'Unmute' : 'Mute'}</span></button>
|
|
758
|
+
<button class="off ghost" @click="stopMic" title="Stop microphone">${this._icon('stop')}<span>Mic</span></button>`
|
|
759
|
+
: `<button class="primary" @click="startMic">${this._icon('mic')}<span>Start mic</span></button>`}
|
|
734
760
|
</div>
|
|
735
761
|
|
|
736
762
|
<div class="ctl-group">
|
|
737
763
|
${camOn
|
|
738
|
-
? `<button class="${camMuted ? 'off' : ''}" @click="toggleCamMute" title="${camMuted ? 'Resume camera' : 'Pause camera'}">${camMuted ? '
|
|
739
|
-
<button class="off ghost" @click="stopCam" title="Stop camera"
|
|
740
|
-
: `<button class="primary" @click="startCam"
|
|
764
|
+
? `<button class="${camMuted ? 'off' : ''}" @click="toggleCamMute" title="${camMuted ? 'Resume camera' : 'Pause camera'}">${this._icon(camMuted ? 'video-off' : 'video')}<span>${camMuted ? 'Resume' : 'Pause'}</span></button>
|
|
765
|
+
<button class="off ghost" @click="stopCam" title="Stop camera">${this._icon('stop')}<span>Cam</span></button>`
|
|
766
|
+
: `<button class="primary" @click="startCam">${this._icon('video')}<span>Start camera</span></button>`}
|
|
741
767
|
</div>
|
|
742
768
|
|
|
743
769
|
<div class="ctl-group">
|
|
744
770
|
${sharing
|
|
745
|
-
? `<button class="active" @click="stopShare" title="Stop screen share"
|
|
746
|
-
: `<button @click="startShare" ${hasShare ? '' : 'disabled'} title="${hasShare ? 'Share a screen, window or tab (audio capture optional)' : 'Screen share unsupported here'}"
|
|
771
|
+
? `<button class="active" @click="stopShare" title="Stop screen share">${this._icon('stop')}<span>Stop sharing${shareAudio ? ' (with audio)' : ''}</span></button>`
|
|
772
|
+
: `<button @click="startShare" ${hasShare ? '' : 'disabled'} title="${hasShare ? 'Share a screen, window or tab (audio capture optional)' : 'Screen share unsupported here'}">${this._icon('monitor')}<span>Share screen</span></button>`}
|
|
747
773
|
</div>
|
|
748
774
|
|
|
749
|
-
${pinned ? `<button class="ghost" @click="unpin" title="Unpin focused tile"
|
|
775
|
+
${pinned ? `<button class="ghost" @click="unpin" title="Unpin focused tile">${this._icon('pin')}<span>Unpin</span></button>` : ''}
|
|
750
776
|
|
|
751
777
|
<div class="status-inline ${error ? 'error' : ''}">
|
|
752
778
|
${error ? $.escapeHtml(error) : $.escapeHtml(status)}
|
|
@@ -755,13 +781,13 @@ $.component('video-room', {
|
|
|
755
781
|
</section>
|
|
756
782
|
|
|
757
783
|
<aside class="chat">
|
|
758
|
-
<div class="chat-header">Chat · ${messages.length}</div>
|
|
784
|
+
<div class="chat-header">${this._icon('message', 14)}<span>Chat · ${messages.length}</span></div>
|
|
759
785
|
<div class="chat-log" id="chat-log">
|
|
760
|
-
${chatLines ||
|
|
786
|
+
${chatLines || `<div class="empty">${this._icon('wave', 22)}<span>No messages yet. Say hi.</span></div>`}
|
|
761
787
|
</div>
|
|
762
788
|
<form class="chat-form" @submit="sendChat">
|
|
763
789
|
<input type="text" value="${$.escapeHtml(draft)}" @input="setDraft" placeholder="Message #${$.escapeHtml(roomName)}" maxlength="500" />
|
|
764
|
-
<button type="submit" class="primary">Send</button>
|
|
790
|
+
<button type="submit" class="primary">${this._icon('send')}<span>Send</span></button>
|
|
765
791
|
</form>
|
|
766
792
|
</aside>
|
|
767
793
|
</div>
|
|
@@ -793,20 +819,20 @@ $.component('video-room', {
|
|
|
793
819
|
: '';
|
|
794
820
|
|
|
795
821
|
const micChip = (!isScreen && t.micOn !== undefined)
|
|
796
|
-
? `<span class="chip ${t.micMuted ? 'chip-off' : 'chip-on'}">${t.micMuted ? '
|
|
822
|
+
? `<span class="chip ${t.micMuted ? 'chip-off' : 'chip-on'}">${this._icon(t.micMuted ? 'mic-off' : 'mic', 12)}</span>`
|
|
797
823
|
: '';
|
|
798
824
|
|
|
799
825
|
const audioChip = (isScreen && t.badges && t.badges.length)
|
|
800
|
-
? `<span class="chip chip-on"
|
|
826
|
+
? `<span class="chip chip-on">${this._icon('volume', 12)}</span>`
|
|
801
827
|
: '';
|
|
802
828
|
|
|
803
829
|
const label = `<div class="label">
|
|
804
|
-
<span class="label-name">${$.escapeHtml(t.name)}
|
|
830
|
+
<span class="label-name">${$.escapeHtml(t.name)}</span>
|
|
805
831
|
${micChip}${audioChip}
|
|
806
|
-
${isScreen ?
|
|
832
|
+
${isScreen ? `<span class="chip chip-screen">${this._icon('monitor', 12)}</span>` : ''}
|
|
807
833
|
</div>`;
|
|
808
834
|
|
|
809
|
-
const pinBtn = `<button class="pin-btn" @click="pinTile('${t.id}', '${t.kind}')" title="Pin to focus"
|
|
835
|
+
const pinBtn = `<button class="pin-btn" @click="pinTile('${t.id}', '${t.kind}')" title="Pin to focus">${this._icon('pin', 14)}</button>`;
|
|
810
836
|
|
|
811
837
|
return `
|
|
812
838
|
<div class="${cls}">
|
|
@@ -88,7 +88,12 @@ button {
|
|
|
88
88
|
cursor: pointer;
|
|
89
89
|
font-family: inherit;
|
|
90
90
|
transition: background .15s, border-color .15s, transform .05s;
|
|
91
|
+
display: inline-flex;
|
|
92
|
+
align-items: center;
|
|
93
|
+
gap: 0.4rem;
|
|
94
|
+
line-height: 1;
|
|
91
95
|
}
|
|
96
|
+
button .icon { flex: 0 0 auto; display: block; }
|
|
92
97
|
button:hover { background: #232939; border-color: var(--border-hi); }
|
|
93
98
|
button:active { transform: translateY(1px); }
|
|
94
99
|
button:disabled { opacity: 0.55; cursor: not-allowed; }
|
|
@@ -110,7 +115,11 @@ button.ghost { background: transparent; }
|
|
|
110
115
|
border-radius: 0.375rem;
|
|
111
116
|
font-size: 0.85rem;
|
|
112
117
|
margin-top: 0.75rem;
|
|
118
|
+
display: flex;
|
|
119
|
+
align-items: center;
|
|
120
|
+
gap: 0.5rem;
|
|
113
121
|
}
|
|
122
|
+
.device-hint .icon { flex: 0 0 auto; }
|
|
114
123
|
|
|
115
124
|
/* ---- Room layout (in-call) -------------------------------------------- */
|
|
116
125
|
|
|
@@ -150,7 +159,14 @@ button.ghost { background: transparent; }
|
|
|
150
159
|
flex: 0 0 auto;
|
|
151
160
|
}
|
|
152
161
|
.roster-row .dot.off { background: var(--text-muted); }
|
|
153
|
-
.roster-row .roster-icons {
|
|
162
|
+
.roster-row .roster-icons {
|
|
163
|
+
display: inline-flex;
|
|
164
|
+
align-items: center;
|
|
165
|
+
gap: 0.25rem;
|
|
166
|
+
color: var(--text-muted);
|
|
167
|
+
white-space: nowrap;
|
|
168
|
+
}
|
|
169
|
+
.roster-row.me .roster-icons { color: var(--accent); }
|
|
154
170
|
|
|
155
171
|
.sidebar .leave { margin-top: 0.5rem; }
|
|
156
172
|
|
|
@@ -256,12 +272,16 @@ button.ghost { background: transparent; }
|
|
|
256
272
|
}
|
|
257
273
|
.tile .label-name { font-weight: 600; }
|
|
258
274
|
.tile .chip {
|
|
275
|
+
display: inline-flex;
|
|
276
|
+
align-items: center;
|
|
277
|
+
gap: 0.2rem;
|
|
259
278
|
font-size: 0.78rem;
|
|
260
279
|
line-height: 1;
|
|
261
|
-
padding: 0.
|
|
280
|
+
padding: 0.2rem 0.35rem;
|
|
262
281
|
border-radius: 999px;
|
|
263
282
|
background: rgba(255,255,255,0.08);
|
|
264
283
|
}
|
|
284
|
+
.tile .chip .icon { display: block; }
|
|
265
285
|
.tile .chip-on { background: rgba(22,163,74,0.25); }
|
|
266
286
|
.tile .chip-off { background: rgba(225,69,92,0.25); }
|
|
267
287
|
.tile .chip-screen { background: rgba(91,141,239,0.25); }
|
|
@@ -282,11 +302,17 @@ button.ghost { background: transparent; }
|
|
|
282
302
|
border-radius: 6px;
|
|
283
303
|
background: rgba(0, 0, 0, 0.5);
|
|
284
304
|
border: 1px solid rgba(255,255,255,0.15);
|
|
305
|
+
color: #fff;
|
|
306
|
+
display: inline-flex;
|
|
307
|
+
align-items: center;
|
|
308
|
+
justify-content: center;
|
|
309
|
+
gap: 0;
|
|
285
310
|
opacity: 0;
|
|
286
311
|
transition: opacity .15s;
|
|
287
|
-
font-size: 0.85rem;
|
|
288
312
|
}
|
|
289
|
-
.tile
|
|
313
|
+
.tile.self .pin-btn,
|
|
314
|
+
.tile.tile-main .pin-btn { opacity: 1; background: rgba(0, 0, 0, 0.4); }
|
|
315
|
+
.tile:hover .pin-btn { opacity: 1; }
|
|
290
316
|
|
|
291
317
|
.tile.thumb .label { font-size: 0.72rem; padding: 0.1rem 0.4rem; }
|
|
292
318
|
.tile.thumb .chip { display: none; }
|
|
@@ -326,6 +352,9 @@ button.ghost { background: transparent; }
|
|
|
326
352
|
padding: 0.75rem 1rem;
|
|
327
353
|
border-bottom: 1px solid var(--border);
|
|
328
354
|
font-weight: 600;
|
|
355
|
+
display: flex;
|
|
356
|
+
align-items: center;
|
|
357
|
+
gap: 0.5rem;
|
|
329
358
|
}
|
|
330
359
|
.chat-log {
|
|
331
360
|
flex: 1 1 auto;
|
|
@@ -335,7 +364,16 @@ button.ghost { background: transparent; }
|
|
|
335
364
|
flex-direction: column;
|
|
336
365
|
gap: 0.5rem;
|
|
337
366
|
}
|
|
338
|
-
.chat-log .empty {
|
|
367
|
+
.chat-log .empty {
|
|
368
|
+
display: flex;
|
|
369
|
+
flex-direction: column;
|
|
370
|
+
align-items: center;
|
|
371
|
+
gap: 0.4rem;
|
|
372
|
+
color: var(--text-muted);
|
|
373
|
+
font-size: 0.9rem;
|
|
374
|
+
text-align: center;
|
|
375
|
+
margin: auto 0;
|
|
376
|
+
}
|
|
339
377
|
.msg {
|
|
340
378
|
background: rgba(255,255,255,0.02);
|
|
341
379
|
padding: 0.35rem 0.5rem;
|
package/dist/zquery.dist.zip
CHANGED
|
Binary file
|
package/dist/zquery.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* zQuery (zeroQuery) v1.2.
|
|
2
|
+
* zQuery (zeroQuery) v1.2.8
|
|
3
3
|
* Lightweight Frontend Library
|
|
4
4
|
* https://github.com/tonywied17/zero-query
|
|
5
5
|
* (c) 2026 Anthony Wiedman - MIT License
|
|
@@ -10449,9 +10449,9 @@ $.TurnError = TurnError;
|
|
|
10449
10449
|
$.E2eeError = E2eeError;
|
|
10450
10450
|
|
|
10451
10451
|
// --- Meta ------------------------------------------------------------------
|
|
10452
|
-
$.version = '1.2.
|
|
10452
|
+
$.version = '1.2.8';
|
|
10453
10453
|
$.libSize = '~130 KB';
|
|
10454
|
-
$.unitTests = {"passed":2348,"failed":0,"total":2534,"suites":620,"duration":
|
|
10454
|
+
$.unitTests = {"passed":2348,"failed":0,"total":2534,"suites":620,"duration":8039,"ok":true};
|
|
10455
10455
|
$.meta = {}; // populated at build time by CLI bundler
|
|
10456
10456
|
|
|
10457
10457
|
// --- Environment detection -------------------------------------------------
|
package/dist/zquery.min.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* zQuery (zeroQuery) v1.2.
|
|
2
|
+
* zQuery (zeroQuery) v1.2.8
|
|
3
3
|
* Lightweight Frontend Library
|
|
4
4
|
* https://github.com/tonywied17/zero-query
|
|
5
5
|
* (c) 2026 Anthony Wiedman - MIT License
|
|
@@ -10,4 +10,4 @@
|
|
|
10
10
|
`||r==="\r"){t++;continue}if(r>="0"&&r<="9"||r==="."&&t+1<n&&s[t+1]>="0"&&s[t+1]<="9"){let a="";if(r==="0"&&t+1<n&&(s[t+1]==="x"||s[t+1]==="X"))for(a="0x",t+=2;t<n&&/[0-9a-fA-F]/.test(s[t]);)a+=s[t++];else{for(;t<n&&(s[t]>="0"&&s[t]<="9"||s[t]===".");)a+=s[t++];if(t<n&&(s[t]==="e"||s[t]==="E"))for(a+=s[t++],t<n&&(s[t]==="+"||s[t]==="-")&&(a+=s[t++]);t<n&&s[t]>="0"&&s[t]<="9";)a+=s[t++]}e.push({t:y.NUM,v:Number(a)});continue}if(r==="'"||r==='"'){const a=r;let c="";for(t++;t<n&&s[t]!==a;){if(s[t]==="\\"&&t+1<n){const l=s[++t];l==="n"?c+=`
|
|
11
11
|
`:l==="t"?c+=" ":l==="r"?c+="\r":l==="\\"?c+="\\":l===a?c+=a:c+=l}else c+=s[t];t++}t++,e.push({t:y.STR,v:c});continue}if(r==="`"){const a=[];let c="";for(t++;t<n&&s[t]!=="`";)if(s[t]==="$"&&t+1<n&&s[t+1]==="{"){a.push(c),c="",t+=2;let l=1,u="";for(;t<n&&l>0;){if(s[t]==="{")l++;else if(s[t]==="}"&&(l--,l===0))break;u+=s[t++]}t++,a.push({expr:u})}else s[t]==="\\"&&t+1<n?c+=s[++t]:c+=s[t],t++;t++,a.push(c),e.push({t:y.TMPL,v:a});continue}if(r>="a"&&r<="z"||r>="A"&&r<="Z"||r==="_"||r==="$"){let a="";for(;t<n&&/[\w$]/.test(s[t]);)a+=s[t++];e.push({t:y.IDENT,v:a});continue}const i=s.slice(t,t+3);if(i==="==="||i==="!=="||i==="?."){i==="?."?(e.push({t:y.OP,v:"?."}),t+=2):(e.push({t:y.OP,v:i}),t+=3);continue}const o=s.slice(t,t+2);if(o==="=="||o==="!="||o==="<="||o===">="||o==="&&"||o==="||"||o==="??"||o==="?."||o==="=>"){e.push({t:y.OP,v:o}),t+=2;continue}if("+-*/%".includes(r)){e.push({t:y.OP,v:r}),t++;continue}if("<>=!".includes(r)){e.push({t:y.OP,v:r}),t++;continue}if(r==="."&&t+2<n&&s[t+1]==="."&&s[t+2]==="."){e.push({t:y.OP,v:"..."}),t+=3;continue}if("()[]{},.?:".includes(r)){e.push({t:y.PUNC,v:r}),t++;continue}t++}return e.push({t:y.EOF,v:null}),e}class Sn{constructor(e,t){this.tokens=e,this.pos=0,this.scope=t}peek(){return this.tokens[this.pos]}next(){return this.tokens[this.pos++]}expect(e,t){const n=this.next();if(n.t!==e||t!==void 0&&n.v!==t)throw new Error(`Expected ${t||e} but got ${n.v}`);return n}match(e,t){const n=this.peek();return n.t===e&&(t===void 0||n.v===t)?this.next():null}parse(){return this.depth=0,this.parseExpression(0)}parseExpression(e){if(++this.depth>96)throw this.depth--,new Error("Expression nesting depth exceeded (max 96)");try{return this._parseExpressionImpl(e)}finally{this.depth--}}_parseExpressionImpl(e){var n;let t=this.parseUnary();for(;;){const r=this.peek();if(r.t===y.PUNC&&r.v==="?"&&((n=this.tokens[this.pos+1])==null?void 0:n.v)!=="."){if(1<=e)break;this.next();const i=this.parseExpression(0);this.expect(y.PUNC,":");const o=this.parseExpression(0);t={type:"ternary",cond:t,truthy:i,falsy:o};continue}if(r.t===y.OP&&r.v in he){const i=he[r.v];if(i<=e)break;this.next();const o=this.parseExpression(i);t={type:"binary",op:r.v,left:t,right:o};continue}if(r.t===y.IDENT&&(r.v==="instanceof"||r.v==="in")&&he[r.v]>e){const i=he[r.v];this.next();const o=this.parseExpression(i);t={type:"binary",op:r.v,left:t,right:o};continue}break}return t}parseUnary(){const e=this.peek();if(e.t===y.IDENT&&e.v==="typeof")return this.next(),{type:"typeof",arg:this.parseUnary()};if(e.t===y.IDENT&&e.v==="void")return this.next(),this.parseUnary(),{type:"literal",value:void 0};if(e.t===y.OP&&e.v==="!")return this.next(),{type:"not",arg:this.parseUnary()};if(e.t===y.OP&&(e.v==="-"||e.v==="+")){this.next();const t=this.parseUnary();return{type:"unary",op:e.v,arg:t}}return this.parsePostfix()}parsePostfix(){let e=this.parsePrimary();for(;;){const t=this.peek();if(t.t===y.PUNC&&t.v==="."){this.next();const n=this.next();e={type:"member",obj:e,prop:n.v,computed:!1},this.peek().t===y.PUNC&&this.peek().v==="("&&(e=this._parseCall(e));continue}if(t.t===y.OP&&t.v==="?."){this.next();const n=this.peek();if(n.t===y.PUNC&&n.v==="["){this.next();const r=this.parseExpression(0);this.expect(y.PUNC,"]"),e={type:"optional_member",obj:e,prop:r,computed:!0}}else if(n.t===y.PUNC&&n.v==="(")e={type:"optional_call",callee:e,args:this._parseArgs()};else{const r=this.next();e={type:"optional_member",obj:e,prop:r.v,computed:!1},this.peek().t===y.PUNC&&this.peek().v==="("&&(e=this._parseCall(e))}continue}if(t.t===y.PUNC&&t.v==="["){this.next();const n=this.parseExpression(0);this.expect(y.PUNC,"]"),e={type:"member",obj:e,prop:n,computed:!0},this.peek().t===y.PUNC&&this.peek().v==="("&&(e=this._parseCall(e));continue}if(t.t===y.PUNC&&t.v==="("){e=this._parseCall(e);continue}break}return e}_parseCall(e){const t=this._parseArgs();return{type:"call",callee:e,args:t}}_parseArgs(){this.expect(y.PUNC,"(");const e=[];for(;!(this.peek().t===y.PUNC&&this.peek().v===")")&&this.peek().t!==y.EOF;)this.peek().t===y.OP&&this.peek().v==="..."?(this.next(),e.push({type:"spread",arg:this.parseExpression(0)})):e.push(this.parseExpression(0)),this.peek().t===y.PUNC&&this.peek().v===","&&this.next();return this.expect(y.PUNC,")"),e}parsePrimary(){const e=this.peek();if(e.t===y.NUM)return this.next(),{type:"literal",value:e.v};if(e.t===y.STR)return this.next(),{type:"literal",value:e.v};if(e.t===y.TMPL)return this.next(),{type:"template",parts:e.v};if(e.t===y.PUNC&&e.v==="("){const t=this.pos;this.next();const n=[];let r=!0;if(!(this.peek().t===y.PUNC&&this.peek().v===")"))for(;r;){const o=this.peek();if(o.t===y.IDENT&&!En.has(o.v))if(n.push(this.next().v),this.peek().t===y.PUNC&&this.peek().v===",")this.next();else break;else r=!1}if(r&&this.peek().t===y.PUNC&&this.peek().v===")"&&(this.next(),this.peek().t===y.OP&&this.peek().v==="=>")){this.next();const o=this.parseExpression(0);return{type:"arrow",params:n,body:o}}this.pos=t,this.next();const i=this.parseExpression(0);return this.expect(y.PUNC,")"),i}if(e.t===y.PUNC&&e.v==="["){this.next();const t=[];for(;!(this.peek().t===y.PUNC&&this.peek().v==="]")&&this.peek().t!==y.EOF;)this.peek().t===y.OP&&this.peek().v==="..."?(this.next(),t.push({type:"spread",arg:this.parseExpression(0)})):t.push(this.parseExpression(0)),this.peek().t===y.PUNC&&this.peek().v===","&&this.next();return this.expect(y.PUNC,"]"),{type:"array",elements:t}}if(e.t===y.PUNC&&e.v==="{"){this.next();const t=[];for(;!(this.peek().t===y.PUNC&&this.peek().v==="}")&&this.peek().t!==y.EOF;){if(this.peek().t===y.OP&&this.peek().v==="..."){this.next(),t.push({spread:!0,value:this.parseExpression(0)}),this.peek().t===y.PUNC&&this.peek().v===","&&this.next();continue}const n=this.next();let r;if(n.t===y.IDENT||n.t===y.STR)r=n.v;else if(n.t===y.NUM)r=String(n.v);else throw new Error("Invalid object key: "+n.v);this.peek().t===y.PUNC&&(this.peek().v===","||this.peek().v==="}")?t.push({key:r,value:{type:"ident",name:r}}):(this.expect(y.PUNC,":"),t.push({key:r,value:this.parseExpression(0)})),this.peek().t===y.PUNC&&this.peek().v===","&&this.next()}return this.expect(y.PUNC,"}"),{type:"object",properties:t}}if(e.t===y.IDENT){if(this.next(),e.v==="true")return{type:"literal",value:!0};if(e.v==="false")return{type:"literal",value:!1};if(e.v==="null")return{type:"literal",value:null};if(e.v==="undefined")return{type:"literal",value:void 0};if(e.v==="new"){let t=this.parsePrimary();for(;this.peek().t===y.PUNC&&this.peek().v===".";){this.next();const r=this.next();t={type:"member",obj:t,prop:r.v,computed:!1}}let n=[];return this.peek().t===y.PUNC&&this.peek().v==="("&&(n=this._parseArgs()),{type:"new",callee:t,args:n}}if(this.peek().t===y.OP&&this.peek().v==="=>"){this.next();const t=this.parseExpression(0);return{type:"arrow",params:[e.v],body:t}}return{type:"ident",name:e.v}}return this.next(),{type:"literal",value:void 0}}}const vn=new Set(["length","charAt","charCodeAt","includes","indexOf","lastIndexOf","slice","substring","trim","trimStart","trimEnd","toLowerCase","toUpperCase","split","replace","replaceAll","match","search","startsWith","endsWith","padStart","padEnd","repeat","at","toString","valueOf"]),Cn=new Set(["toFixed","toPrecision","toString","valueOf"]);function de(s,e){return typeof e=="string"&&new Set(["constructor","__proto__","prototype","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__","call","apply","bind"]).has(e)?!1:s!=null&&(typeof s=="object"||typeof s=="function")?!0:typeof s=="string"?vn.has(e):typeof s=="number"?Cn.has(e):!1}function b(s,e){var t;if(s)switch(s.type){case"literal":return s.value;case"ident":{const n=s.name;for(const r of e)if(r&&typeof r=="object"&&n in r)return r[n];return n==="Math"?Math:n==="JSON"?JSON:n==="Date"?Date:n==="Array"?Array:n==="Object"?Object:n==="String"?String:n==="Number"?Number:n==="Boolean"?Boolean:n==="parseInt"?parseInt:n==="parseFloat"?parseFloat:n==="isNaN"?isNaN:n==="isFinite"?isFinite:n==="Infinity"?1/0:n==="NaN"?NaN:n==="encodeURIComponent"?encodeURIComponent:n==="decodeURIComponent"?decodeURIComponent:n==="console"?console:n==="Map"?Map:n==="Set"?Set:n==="URL"?URL:n==="URLSearchParams"?URLSearchParams:void 0}case"template":{let n="";for(const r of s.parts)typeof r=="string"?n+=r:r&&r.expr&&(n+=String((t=V(r.expr,e))!=null?t:""));return n}case"member":{const n=b(s.obj,e);if(n==null)return;const r=s.computed?b(s.prop,e):s.prop;return de(n,r)?n[r]:void 0}case"optional_member":{const n=b(s.obj,e);if(n==null)return;const r=s.computed?b(s.prop,e):s.prop;return de(n,r)?n[r]:void 0}case"call":return An(s,e,!1);case"optional_call":{const n=s.callee,r=Me(s.args,e);if(n.type==="member"||n.type==="optional_member"){const o=b(n.obj,e);if(o==null)return;const a=n.computed?b(n.prop,e):n.prop;if(!de(o,a))return;const c=o[a];return typeof c!="function"?void 0:c.apply(o,r)}const i=b(n,e);return i==null||typeof i!="function"?void 0:i(...r)}case"new":{const n=b(s.callee,e);if(typeof n!="function")return;if(n===Date||n===Array||n===Map||n===Set||n===URL||n===URLSearchParams){const r=Me(s.args,e);return new n(...r)}return}case"binary":return Tn(s,e);case"unary":{const n=b(s.arg,e);return s.op==="-"?-n:+n}case"not":return!b(s.arg,e);case"typeof":try{return typeof b(s.arg,e)}catch{return"undefined"}case"ternary":{const n=b(s.cond,e);return b(n?s.truthy:s.falsy,e)}case"array":{const n=[];for(const r of s.elements)if(r.type==="spread"){const i=b(r.arg,e);if(i!=null&&typeof i[Symbol.iterator]=="function")for(const o of i)n.push(o)}else n.push(b(r,e));return n}case"object":{const n={};for(const r of s.properties)if(r.spread){const i=b(r.value,e);i!=null&&typeof i=="object"&&Object.assign(n,i)}else n[r.key]=b(r.value,e);return n}case"arrow":{const n=s.params,r=s.body,i=e;return function(...o){const a={};return n.forEach((c,l)=>{a[c]=o[l]}),b(r,[a,...i])}}default:return}}function Me(s,e){const t=[];for(const n of s)if(n.type==="spread"){const r=b(n.arg,e);if(r!=null&&typeof r[Symbol.iterator]=="function")for(const i of r)t.push(i)}else t.push(b(n,e));return t}function An(s,e){const t=s.callee,n=Me(s.args,e);if(t.type==="member"||t.type==="optional_member"){const i=b(t.obj,e);if(i==null)return;const o=t.computed?b(t.prop,e):t.prop;if(!de(i,o))return;const a=i[o];return typeof a!="function"?void 0:a.apply(i,n)}const r=b(t,e);if(typeof r=="function")return r(...n)}function Tn(s,e){if(s.op==="&&"){const r=b(s.left,e);return r&&b(s.right,e)}if(s.op==="||"){const r=b(s.left,e);return r||b(s.right,e)}if(s.op==="??"){const r=b(s.left,e);return r!=null?r:b(s.right,e)}const t=b(s.left,e),n=b(s.right,e);switch(s.op){case"+":return t+n;case"-":return t-n;case"*":return t*n;case"/":return t/n;case"%":return t%n;case"==":return t==n;case"!=":return t!=n;case"===":return t===n;case"!==":return t!==n;case"<":return t<n;case">":return t>n;case"<=":return t<=n;case">=":return t>=n;case"instanceof":return t instanceof n;case"in":return t in n;default:return}}const Z=new Map,Rn=512,Ct=8192;function V(s,e){try{if(typeof s!="string")return;if(s.length>Ct)throw new Error(`Expression exceeds max length (${Ct} bytes)`);const t=s.trim();if(!t)return;if(/^[a-zA-Z_$][\w$]*$/.test(t)){for(const r of e)if(r&&typeof r=="object"&&t in r)return r[t]}let n=Z.get(t);if(n)Z.delete(t),Z.set(t,n);else{const r=bn(t);if(n=new Sn(r,e).parse(),Z.size>=Rn){const o=Z.keys().next().value;Z.delete(o)}Z.set(t,n)}return b(n,e)}catch(t){typeof console!="undefined"&&console.debug&&console.debug(`[zQuery EXPR_EVAL] Failed to evaluate: "${s}"`,t.message);return}}const re=new Map,z=new Map,pe=new Map;let At=0;if(typeof document!="undefined"&&!document.querySelector("[data-zq-cloak]")){const s=document.createElement("style");s.textContent="[z-cloak]{display:none!important}*,*::before,*::after{-webkit-tap-highlight-color:transparent}",s.setAttribute("data-zq-cloak",""),document.head.appendChild(s)}const _e=new WeakMap,me=new WeakMap;function ie(s){if(pe.has(s))return pe.get(s);if(typeof window!="undefined"&&window.__zqInline){for(const[n,r]of Object.entries(window.__zqInline))if(s===n||s.endsWith("/"+n)||s.endsWith("\\"+n)){const i=Promise.resolve(r);return pe.set(s,i),i}}let e=s;if(typeof s=="string"&&!s.startsWith("/")&&!s.includes(":")&&!s.startsWith("//"))try{const n=document.querySelector("base"),r=n?n.href:window.location.origin+"/";e=new URL(s,r).href}catch{}const t=fetch(e).then(n=>{if(!n.ok)throw new Error(`zQuery: Failed to load resource "${s}" (${n.status})`);return n.text()});return pe.set(s,t),t}function J(s,e){if(!e||!s||typeof s!="string"||s.startsWith("/")||s.includes("://")||s.startsWith("//"))return s;try{if(e.includes("://"))return new URL(s,e).href;const t=document.querySelector("base"),n=t?t.href:window.location.origin+"/",r=new URL(e.endsWith("/")?e:e+"/",n).href;return new URL(s,r).href}catch{return s}}let Ie;try{typeof document!="undefined"&&document.currentScript&&document.currentScript.src&&(Ie=document.currentScript.src.replace(/[?#].*$/,""))}catch{}function Tt(){try{const e=(new Error().stack||"").match(/(?:https?|file):\/\/[^\s\)]+/g)||[];for(const t of e){const n=t.replace(/:\d+:\d+$/,"").replace(/:\d+$/,"");if(!/zquery(\.min)?\.js$/i.test(n)&&!(Ie&&n.replace(/[?#].*$/,"")===Ie))return n.replace(/\/[^/]*$/,"/")}}catch{}}function ye(s,e){return e.split(".").reduce((t,n)=>t==null?void 0:t[n],s)}function kn(s,e,t){const n=e.split("."),r=n.pop(),i=n.reduce((o,a)=>o&&typeof o=="object"?o[a]:void 0,s);i&&typeof i=="object"&&(i[r]=t)}class De{constructor(e,t,n={}){this._uid=++At,this._el=e,this._def=t,this._mounted=!1,this._destroyed=!1,this._updateQueued=!1,this._listeners=[],this._watchCleanups=[],this._timerEls=new Set,this.refs={},this._slotContent={};const r=[];if([...e.childNodes].forEach(o=>{if(o.nodeType===1&&o.hasAttribute("slot")){const a=o.getAttribute("slot")||"default";this._slotContent[a]||(this._slotContent[a]=""),this._slotContent[a]+=o.outerHTML}else(o.nodeType===1||o.nodeType===3&&o.textContent.trim())&&r.push(o.nodeType===1?o.outerHTML:o.textContent)}),r.length&&(this._slotContent.default=r.join("")),t.props&&typeof t.props=="object"&&!Array.isArray(t.props)){this.props=this._resolveReactiveProps(t.props,n);const o=Object.keys(t.props),a=[];for(const c of o)a.push(c.toLowerCase()),a.push(":"+c.toLowerCase());this._propObserver=new MutationObserver(c=>{if(this._destroyed)return;let l=!1;for(const u of c)if(u.type==="attributes"){const d=u.attributeName;(d.startsWith(":")?d.slice(1):d)in t.props&&(l=!0)}l&&(this.props=this._resolveReactiveProps(t.props,{}),this._scheduleUpdate())}),this._propObserver.observe(e,{attributes:!0,attributeFilter:a})}else this.props=Object.freeze({...n});if(this._storeCleanups=[],this.stores={},t.stores&&typeof t.stores=="object")for(const[o,a]of Object.entries(t.stores)){if(!a||!a._zqConnector)continue;const{store:c,keys:l}=a,u={};for(const p of l)u[p]=c.state[p];this.stores[o]=u;const d=c.subscribe(l,(p,f)=>{this.stores[o][p]=f,this._destroyed||this._scheduleUpdate()});this._storeCleanups.push(d)}const i=typeof t.state=="function"?t.state():{...t.state||{}};if(this.state=Pe(i,(o,a,c)=>{this._destroyed||(this._runWatchers(o,a,c),this._scheduleUpdate())}),this.computed={},t.computed)for(const[o,a]of Object.entries(t.computed))Object.defineProperty(this.computed,o,{get:()=>a.call(this,this.state.__raw||this.state),enumerable:!0});for(const[o,a]of Object.entries(t))typeof a=="function"&&!xn.has(o)&&(this[o]=a.bind(this));if(t.init)try{t.init.call(this)}catch(o){A(v.COMP_LIFECYCLE,`Component "${t._name}" init() threw`,{component:t._name},o)}if(t.watch){this._prevWatchValues={};for(const o of Object.keys(t.watch))this._prevWatchValues[o]=ye(this.state.__raw||this.state,o)}}_runWatchers(e,t,n){var i;const r=this._def.watch;if(r){for(const[o,a]of Object.entries(r))if(e===o||o.startsWith(e+".")||e.startsWith(o+".")){const c=ye(this.state.__raw||this.state,o),l=(i=this._prevWatchValues)==null?void 0:i[o];if(c!==l){const u=typeof a=="function"?a:a.handler;typeof u=="function"&&u.call(this,c,l),this._prevWatchValues&&(this._prevWatchValues[o]=c)}}}}_scheduleUpdate(){this._updateQueued||(this._updateQueued=!0,queueMicrotask(()=>{try{this._destroyed||this._render()}finally{this._updateQueued=!1}}))}_resolveReactiveProps(e,t){const n={};for(const[r,i]of Object.entries(e)){const o=typeof i=="object"&&i!==null?i:{type:i},a=o.type,c=o.default;if(r in t){n[r]=t[r];continue}let l=this._el.getAttribute(":"+r),u=l!==null;u||(l=this._el.getAttribute(r),u=l!==null),u&&l!==null?n[r]=this._coercePropValue(l,a):c!==void 0?n[r]=typeof c=="function"?c():c:n[r]=void 0}return Object.freeze(n)}_coercePropValue(e,t){if(t===Number)return Number(e);if(t===Boolean)return e!=="false"&&e!=="0"&&e!=="";if(t===Object||t===Array)try{return JSON.parse(e)}catch{return e}return e}async _loadExternals(){const e=this._def,t=e._base;if(e.templateUrl&&!e._templateLoaded){const n=e.templateUrl;if(typeof n=="string")e._externalTemplate=await ie(J(n,t));else if(Array.isArray(n)){const r=n.map(o=>J(o,t)),i=await Promise.all(r.map(o=>ie(o)));e._externalTemplates={},i.forEach((o,a)=>{e._externalTemplates[a]=o})}else if(typeof n=="object"){const r=Object.entries(n),i=await Promise.all(r.map(([,o])=>ie(J(o,t))));e._externalTemplates={},r.forEach(([o],a)=>{e._externalTemplates[o]=i[a]})}e._templateLoaded=!0}if(e.styleUrl&&!e._styleLoaded){const n=e.styleUrl;if(typeof n=="string"){const r=J(n,t);e._externalStyles=await ie(r),e._resolvedStyleUrls=[r]}else if(Array.isArray(n)){const r=n.map(o=>J(o,t)),i=await Promise.all(r.map(o=>ie(o)));e._externalStyles=i.join(`
|
|
12
12
|
`),e._resolvedStyleUrls=r}e._styleLoaded=!0}}_render(){var o,a;if(this._def.templateUrl&&!this._def._templateLoaded||this._def.styleUrl&&!this._def._styleLoaded){this._loadExternals().then(()=>{this._destroyed||this._render()});return}this._def._externalTemplates&&(this.templates=this._def._externalTemplates);let e;this._def.render?(e=this._def.render.call(this),e=this._expandZFor(e)):this._def._externalTemplate?(e=this._expandZFor(this._def._externalTemplate),e=e.replace(/\{\{(.+?)\}\}/g,(c,l)=>{try{const u=V(l.trim(),[this.state.__raw||this.state,{props:this.props,computed:this.computed,$:typeof window!="undefined"?window.$:void 0}]);return u!=null?ge(String(u)):""}catch{return""}})):e="",e=this._expandContentDirectives(e),e.includes("<slot")&&(e=e.replace(/<slot(?:\s+name="([^"]*)")?\s*(?:\/>|>([\s\S]*?)<\/slot>)/g,(c,l,u)=>{const d=l||"default";return this._slotContent[d]||u||""}));const t=[this._def.styles||"",this._def._externalStyles||""].filter(Boolean).join(`
|
|
13
|
-
`);if(!this._mounted&&t){const c=this._def;let l=c._scopeAttr;if(l||(l=c._name?`z-s-${c._name}`:`z-s${this._uid}`,c._scopeAttr=l),this._el.setAttribute(l,""),this._scopeAttr=l,c._styleEl&&c._styleEl.isConnected)c._styleRefCount=(c._styleRefCount||0)+1;else{let u=0,d=0;const p=t.replace(/([^{}]+)\{|\}/g,(_,w)=>{if(_==="}")return u>0&&d<=u&&(u=0),d--,_;d++;const m=w.trim();return m.startsWith("@")?(/^@(keyframes|font-face)\b/.test(m)&&(u=d),_):u>0&&d>u?_:w.split(",").map(S=>`[${l}] ${S.trim()}`).join(", ")+" {"}),f=document.createElement("style");f.textContent=p,f.setAttribute("data-zq-component",c._name||""),f.setAttribute("data-zq-scope",l),c._resolvedStyleUrls&&(f.setAttribute("data-zq-style-urls",c._resolvedStyleUrls.join(" ")),c.styles&&f.setAttribute("data-zq-inline",c.styles)),document.head.appendChild(f),c._styleEl=f,c._styleRefCount=1}}let n=null;const r=document.activeElement;if(r&&this._el.contains(r)){const c=(o=r.getAttribute)==null?void 0:o.call(r,"z-model"),l=(a=r.getAttribute)==null?void 0:a.call(r,"z-ref");let u=null;if(c)u=`[z-model="${c}"]`;else if(l)u=`[z-ref="${l}"]`;else{const d=r.tagName.toLowerCase();if(d==="input"||d==="textarea"||d==="select"){let p=d;r.type&&(p+=`[type="${r.type}"]`),r.name&&(p+=`[name="${r.name}"]`),r.placeholder&&(p+=`[placeholder="${CSS.escape(r.placeholder)}"]`),u=p}}u&&(n={selector:u,start:r.selectionStart,end:r.selectionEnd,dir:r.selectionDirection})}const i=typeof window!="undefined"&&(window.__zqMorphHook||window.__zqRenderHook)?performance.now():0;if(this._mounted?Ue(this._el,e):(this._el.innerHTML=e,i&&window.__zqRenderHook&&window.__zqRenderHook(this._el,performance.now()-i,"mount",this._def._name)),this._processDirectives(),this._bindEvents(),this._bindRefs(),this._bindModels(),n){const c=this._el.querySelector(n.selector);if(c){c!==document.activeElement&&c.focus();try{n.start!==null&&n.start!==void 0&&c.setSelectionRange(n.start,n.end,n.dir)}catch{}}}if(kt(this._el),this._mounted){if(this._def.updated)try{this._def.updated.call(this)}catch(c){A(v.COMP_LIFECYCLE,`Component "${this._def._name}" updated() threw`,{component:this._def._name},c)}}else if(this._mounted=!0,this._def.mounted)try{this._def.mounted.call(this)}catch(c){A(v.COMP_LIFECYCLE,`Component "${this._def._name}" mounted() threw`,{component:this._def._name},c)}}_bindEvents(){const e=new Map;if(this._el.querySelectorAll("*").forEach(n=>{if(n.closest("[z-pre]"))return;const r=n.attributes;for(let i=0;i<r.length;i++){const o=r[i];let a;if(o.name.charCodeAt(0)===64)a=o.name.slice(1);else if(o.name.startsWith("z-on:"))a=o.name.slice(5);else continue;const c=a.split("."),l=c[0],u=c.slice(1),d=o.value;n.dataset.zqEid||(n.dataset.zqEid=String(++At));const p=`[data-zq-eid="${n.dataset.zqEid}"]`;e.has(l)||e.set(l,[]),e.get(l).push({selector:p,methodExpr:d,modifiers:u,el:n})}}),this._eventBindings=e,this._delegatedEvents){for(const n of e.keys())this._delegatedEvents.has(n)||this._attachDelegatedEvent(n,e.get(n));for(const n of this._delegatedEvents.keys())if(!e.has(n)){const{handler:r,opts:i}=this._delegatedEvents.get(n);this._el.removeEventListener(n,r,i),this._delegatedEvents.delete(n),this._listeners=this._listeners.filter(o=>o.event!==n)}return}this._delegatedEvents=new Map;for(const[n,r]of e)this._attachDelegatedEvent(n,r);this._outsideListeners=this._outsideListeners||[];for(const[n,r]of e)for(const i of r){if(!i.modifiers.includes("outside"))continue;const o=a=>{if(i.el.contains(a.target))return;const c=i.methodExpr.match(/^(\w+)(?:\(([^)]*)\))?$/);if(!c)return;const l=this[c[1]];typeof l=="function"&&l.call(this,a)};document.addEventListener(n,o,!0),this._outsideListeners.push({event:n,handler:o})}}_attachDelegatedEvent(e,t){const n=t.some(a=>a.modifiers.includes("capture")),r=t.some(a=>a.modifiers.includes("passive")),i=n||r?{capture:n,passive:r}:!1,o=a=>{var d;const c=((d=this._eventBindings)==null?void 0:d.get(e))||[],l=[];for(const p of c){const f=a.target.closest(p.selector);f&&l.push({...p,matched:f})}l.sort((p,f)=>p.matched===f.matched?0:p.matched.contains(f.matched)?1:-1);let u=null;for(const{methodExpr:p,modifiers:f,el:_,matched:w}of l){if(u){let O=!1;for(const T of u)if(w.contains(T)&&w!==T){O=!0;break}if(O)continue}if(f.includes("self")&&a.target!==_||f.includes("outside")&&_.contains(a.target))continue;const m={enter:"Enter",escape:"Escape",tab:"Tab",space:" ",delete:"Delete|Backspace",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight"},S=new Set(["prevent","stop","self","once","outside","capture","passive","debounce","throttle","ctrl","shift","alt","meta"]);let L=!1;for(let O=0;O<f.length;O++){const T=f[O];if(m[T]){const X=m[T].split("|");if(!a.key||!X.includes(a.key)){L=!0;break}}else{if(S.has(T))continue;if(/^\d+$/.test(T)&&O>0&&(f[O-1]==="debounce"||f[O-1]==="throttle"))continue;if(!a.key||a.key.toLowerCase()!==T.toLowerCase()){L=!0;break}}}if(L||f.includes("ctrl")&&!a.ctrlKey||f.includes("shift")&&!a.shiftKey||f.includes("alt")&&!a.altKey||f.includes("meta")&&!a.metaKey)continue;f.includes("prevent")&&a.preventDefault(),f.includes("stop")&&(a.stopPropagation(),u||(u=[]),u.push(w));const W=O=>{const T=p.match(/^(\w+)(?:\(([^)]*)\))?$/);if(!T)return;const X=T[1],Fe=this[X];if(typeof Fe=="function")if(T[2]!==void 0){const bs=T[2].split(",").map(x=>{if(x=x.trim(),x!=="")return x==="$event"?O:x==="true"?!0:x==="false"?!1:x==="null"?null:/^-?\d+(\.\d+)?$/.test(x)?Number(x):x.startsWith("'")&&x.endsWith("'")||x.startsWith('"')&&x.endsWith('"')?x.slice(1,-1):x.startsWith("state.")?ye(this.state,x.slice(6)):x}).filter(x=>x!==void 0);Fe(...bs)}else Fe(O)},Q=f.indexOf("debounce");if(Q!==-1){const O=parseInt(f[Q+1],10)||250,T=_e.get(_)||{};clearTimeout(T[e]),T[e]=setTimeout(()=>W(a),O),_e.set(_,T),this._timerEls.add(_);continue}const je=f.indexOf("throttle");if(je!==-1){const O=parseInt(f[je+1],10)||250,T=me.get(_)||{};if(T[e])continue;W(a),T[e]=setTimeout(()=>{T[e]=null},O),me.set(_,T),this._timerEls.add(_);continue}if(f.includes("once")){if(_.dataset.zqOnce===e)continue;_.dataset.zqOnce=e}W(a)}};this._el.addEventListener(e,o,i),this._listeners.push({event:e,handler:o}),this._delegatedEvents.set(e,{handler:o,opts:i})}_bindRefs(){this.refs={},this._el.querySelectorAll("[z-ref]").forEach(e=>{this.refs[e.getAttribute("z-ref")]=e})}_bindModels(){this._el.querySelectorAll("[z-model]").forEach(e=>{const t=e.getAttribute("z-model"),n=e.tagName.toLowerCase(),r=(e.type||"").toLowerCase(),i=e.hasAttribute("contenteditable"),o=e.hasAttribute("z-lazy"),a=e.hasAttribute("z-trim"),c=e.hasAttribute("z-number"),l=e.hasAttribute("z-uppercase"),u=e.hasAttribute("z-lowercase"),d=e.hasAttribute("z-debounce"),p=d?parseInt(e.getAttribute("z-debounce"),10)||250:0,f=ye(this.state,t);if(n==="input"&&r==="checkbox")e.checked=!!f;else if(n==="input"&&r==="radio")e.checked=e.value===String(f);else if(n==="select"&&e.multiple){const m=Array.isArray(f)?f.map(String):[];[...e.options].forEach(S=>{S.selected=m.includes(S.value)})}else i?e.textContent!==String(f!=null?f:"")&&(e.textContent=f!=null?f:""):e.value=f!=null?f:"";const _=o||n==="select"||r==="checkbox"||r==="radio"?"change":"input";if(e._zqModelUnbind){try{e._zqModelUnbind()}catch{}e._zqModelUnbind=null}const w=()=>{let m;r==="checkbox"?m=e.checked:n==="select"&&e.multiple?m=[...e.selectedOptions].map(S=>S.value):i?m=e.textContent:m=e.value,a&&typeof m=="string"&&(m=m.trim()),l&&typeof m=="string"&&(m=m.toUpperCase()),u&&typeof m=="string"&&(m=m.toLowerCase()),(c||r==="number"||r==="range")&&(m=Number(m)),kn(this.state,t,m)};if(d){let m=null;const S=()=>{clearTimeout(m),m=setTimeout(w,p)};e.addEventListener(_,S),e._zqModelUnbind=()=>{e.removeEventListener(_,S),clearTimeout(m)}}else e.addEventListener(_,w),e._zqModelUnbind=()=>e.removeEventListener(_,w)})}_evalExpr(e){return V(e,[this.state.__raw||this.state,{props:this.props,refs:this.refs,computed:this.computed,$:typeof window!="undefined"?window.$:void 0}])}_expandZFor(e){if(!e.includes("z-for"))return e;const t=document.createElement("div");t.innerHTML=e;const n=r=>{let i=[...r.querySelectorAll("[z-for]")].filter(o=>!o.querySelector("[z-for]"));if(i.length){for(const o of i){if(!o.parentNode)continue;const c=o.getAttribute("z-for").match(/^\s*(?:\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)|(\w+))\s+in\s+(.+)\s*$/);if(!c){o.removeAttribute("z-for");continue}const l=c[1]||c[3],u=c[2]||"$index",d=c[4].trim();let p=this._evalExpr(d);if(p==null){o.remove();continue}if(typeof p=="number"&&(p=Array.from({length:p},(L,W)=>W+1)),!Array.isArray(p)&&typeof p=="object"&&typeof p[Symbol.iterator]!="function"&&(p=Object.entries(p).map(([L,W])=>({key:L,value:W}))),!Array.isArray(p)&&typeof p[Symbol.iterator]=="function"&&(p=[...p]),!Array.isArray(p)){o.remove();continue}const f=o.parentNode,_=o.cloneNode(!0);_.removeAttribute("z-for");const w=_.outerHTML,m=document.createDocumentFragment(),S=(L,W,Q)=>L.replace(/\{\{(.+?)\}\}/g,(je,O)=>{try{const T={};T[l]=W,T[u]=Q;const X=V(O.trim(),[T,this.state.__raw||this.state,{props:this.props,computed:this.computed,$:typeof window!="undefined"?window.$:void 0}]);return X!=null?ge(String(X)):""}catch{return""}});for(let L=0;L<p.length;L++){const W=S(w,p[L],L),Q=document.createElement("div");for(Q.innerHTML=W;Q.firstChild;)m.appendChild(Q.firstChild)}f.replaceChild(m,o)}r.querySelector("[z-for]")&&n(r)}};return n(t),t.innerHTML}_expandContentDirectives(e){if(!e.includes("z-html")&&!e.includes("z-text"))return e;const t=document.createElement("div");return t.innerHTML=e,t.querySelectorAll("[z-html]").forEach(n=>{if(n.closest("[z-pre]"))return;const r=this._evalExpr(n.getAttribute("z-html"));n.innerHTML=r!=null?String(r):"",n.removeAttribute("z-html")}),t.querySelectorAll("[z-text]").forEach(n=>{if(n.closest("[z-pre]"))return;const r=this._evalExpr(n.getAttribute("z-text"));n.textContent=r!=null?String(r):"",n.removeAttribute("z-text")}),t.innerHTML}_processDirectives(){const e=[...this._el.querySelectorAll("[z-if]")];for(const i of e){if(!i.parentNode||i.closest("[z-pre]"))continue;const o=!!this._evalExpr(i.getAttribute("z-if")),a=[{el:i,show:o}];let c=i.nextElementSibling;for(;c;)if(c.hasAttribute("z-else-if"))a.push({el:c,show:!!this._evalExpr(c.getAttribute("z-else-if"))}),c=c.nextElementSibling;else if(c.hasAttribute("z-else")){a.push({el:c,show:!0});break}else break;let l=!1;for(const u of a)if(!l&&u.show){l=!0,u.el.removeAttribute("z-if"),u.el.removeAttribute("z-else-if"),u.el.removeAttribute("z-else");const d=u.el.getAttribute("z-transition");d&&(u.el.removeAttribute("z-transition"),this._transitionEnter(u.el,d))}else{const d=u.el.getAttribute("z-transition");d?this._transitionLeave(u.el,d,()=>u.el.remove()):u.el.remove()}}this._el.querySelectorAll("[z-show]").forEach(i=>{if(i.closest("[z-pre]"))return;const o=!!this._evalExpr(i.getAttribute("z-show")),a=i.getAttribute("z-transition"),c=i.style.display==="none"||i.hasAttribute("data-zq-hidden");a?(i.removeAttribute("z-show"),o&&c?(i.style.display="",i.removeAttribute("data-zq-hidden"),this._transitionEnter(i,a)):!o&&!c?(i.setAttribute("data-zq-hidden",""),this._transitionLeave(i,a,()=>{i.style.display="none"})):(i.style.display=o?"":"none",o?i.removeAttribute("data-zq-hidden"):i.setAttribute("data-zq-hidden",""))):(i.style.display=o?"":"none",i.removeAttribute("z-show"))});const t=document.createTreeWalker(this._el,NodeFilter.SHOW_ELEMENT,{acceptNode(i){return i.hasAttribute("z-pre")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),n=typeof MediaStream!="undefined";let r;for(;r=t.nextNode();){const i=r.attributes;for(let o=i.length-1;o>=0;o--){const a=i[o];let c;if(a.name.startsWith("z-bind:"))c=a.name.slice(7);else if(a.name.charCodeAt(0)===58&&a.name.charCodeAt(1)!==58)c=a.name.slice(1);else continue;const l=this._evalExpr(a.value);r.removeAttribute(a.name),l===!1||l===null||l===void 0?r.toggleAttribute(c,!1):l===!0?r.toggleAttribute(c,!0):r.setAttribute(c,String(l))}if(r.hasAttribute("z-class")){const o=this._evalExpr(r.getAttribute("z-class"));if(typeof o=="string")o.split(/\s+/).filter(Boolean).forEach(a=>r.classList.add(a));else if(Array.isArray(o))o.filter(Boolean).forEach(a=>r.classList.add(String(a)));else if(o&&typeof o=="object")for(const[a,c]of Object.entries(o))r.classList.toggle(a,!!c);r.removeAttribute("z-class")}if(r.hasAttribute("z-style")){const o=this._evalExpr(r.getAttribute("z-style"));if(typeof o=="string")r.style.cssText+=";"+o;else if(o&&typeof o=="object")for(const[a,c]of Object.entries(o))r.style[a]=c;r.removeAttribute("z-style")}if(r.hasAttribute("z-stream")){const o=this._evalExpr(r.getAttribute("z-stream"));o==null?r.srcObject=null:n&&o instanceof MediaStream||o&&typeof o.getTracks=="function"?r.srcObject=o:r.srcObject=null,r.removeAttribute("z-stream")}r.hasAttribute("z-cloak")&&r.removeAttribute("z-cloak")}}_transitionEnter(e,t){const n=this._def.transition;if(n&&n.enter){e.classList.add(n.enter);const r=n.duration||0,i=()=>e.classList.remove(n.enter);r>0?setTimeout(i,r):(e.addEventListener("transitionend",i,{once:!0}),e.addEventListener("animationend",i,{once:!0}));return}e.classList.add(`${t}-enter-from`,`${t}-enter-active`),e.offsetHeight,requestAnimationFrame(()=>{e.classList.remove(`${t}-enter-from`),e.classList.add(`${t}-enter-to`);const r=()=>{e.classList.remove(`${t}-enter-active`,`${t}-enter-to`)};e.addEventListener("transitionend",r,{once:!0}),e.addEventListener("animationend",r,{once:!0})})}_transitionLeave(e,t,n){const r=this._def.transition;if(r&&r.leave){e.classList.add(r.leave);const i=r.duration||0,o=()=>{e.classList.remove(r.leave),n()};i>0?setTimeout(o,i):(e.addEventListener("transitionend",o,{once:!0}),e.addEventListener("animationend",o,{once:!0}));return}e.classList.add(`${t}-leave-from`,`${t}-leave-active`),e.offsetHeight,requestAnimationFrame(()=>{e.classList.remove(`${t}-leave-from`),e.classList.add(`${t}-leave-to`);const i=()=>{e.classList.remove(`${t}-leave-active`,`${t}-leave-to`),n()};e.addEventListener("transitionend",i,{once:!0}),e.addEventListener("animationend",i,{once:!0})})}setState(e){e&&Object.keys(e).length>0?Object.assign(this.state,e):this._scheduleUpdate()}emit(e,t){this._el.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,cancelable:!0}))}destroy(){if(!this._destroyed){if(this._destroyed=!0,this._def.destroyed)try{this._def.destroyed.call(this)}catch(e){A(v.COMP_LIFECYCLE,`Component "${this._def._name}" destroyed() threw`,{component:this._def._name},e)}if(this._propObserver&&(this._propObserver.disconnect(),this._propObserver=null),this._storeCleanups&&(this._storeCleanups.forEach(e=>e()),this._storeCleanups=[]),this._listeners.forEach(({event:e,handler:t})=>this._el.removeEventListener(e,t)),this._listeners=[],this._outsideListeners&&(this._outsideListeners.forEach(({event:e,handler:t})=>document.removeEventListener(e,t,!0)),this._outsideListeners=[]),this._delegatedEvents=null,this._eventBindings=null,this._timerEls&&(this._timerEls.forEach(e=>{const t=_e.get(e);if(t){for(const r in t)clearTimeout(t[r]);_e.delete(e)}const n=me.get(e);if(n){for(const r in n)clearTimeout(n[r]);me.delete(e)}}),this._timerEls.clear()),this._scopeAttr){const e=this._def;e&&e._styleEl&&e._scopeAttr===this._scopeAttr&&(e._styleRefCount=(e._styleRefCount||1)-1,e._styleRefCount<=0&&(e._styleEl.remove(),e._styleEl=null,e._styleRefCount=0))}z.delete(this._el),this._el.innerHTML=""}}}const xn=new Set(["state","render","styles","init","mounted","updated","destroyed","props","templateUrl","styleUrl","templates","base","computed","watch","stores","transition","activated","deactivated"]);function Ln(s,e){if(!s||typeof s!="string")throw new I(v.COMP_INVALID_NAME,"Component name must be a non-empty string");if(!s.includes("-"))throw new I(v.COMP_INVALID_NAME,`Component name "${s}" must contain a hyphen (Web Component convention)`);e._name=s,e.base!==void 0?e._base=e.base:e._base=Tt(),re.set(s,e)}function Rt(s,e,t={}){const n=typeof s=="string"?document.querySelector(s):s;if(!n)throw new I(v.COMP_MOUNT_TARGET,`Mount target "${s}" not found`,{target:s});const r=re.get(e);if(!r)throw new I(v.COMP_NOT_FOUND,`Component "${e}" not registered`,{component:e});z.has(n)&&z.get(n).destroy();const i=new De(n,r,t);return z.set(n,i),i._render(),i}function kt(s=document.body){for(const[e,t]of re)s.querySelectorAll(e).forEach(r=>{if(z.has(r))return;const i={};let o=null,a=r.parentElement;for(;a;){if(z.has(a)){o=z.get(a);break}a=a.parentElement}[...r.attributes].forEach(l=>{if(!(l.name.startsWith("@")||l.name.startsWith("z-"))){if(l.name.startsWith(":")){const u=l.name.slice(1);if(o)i[u]=V(l.value,[o.state.__raw||o.state,{props:o.props,refs:o.refs,computed:o.computed,$:typeof window!="undefined"?window.$:void 0}]);else try{i[u]=JSON.parse(l.value)}catch{i[u]=l.value}return}try{i[l.name]=JSON.parse(l.value)}catch{i[l.name]=l.value}}});const c=new De(r,t,i);z.set(r,c),c._render()})}function On(s){const e=typeof s=="string"?document.querySelector(s):s;return z.get(e)||null}function Nn(s){const e=typeof s=="string"?document.querySelector(s):s,t=z.get(e);t&&t.destroy()}function Pn(){return Object.fromEntries(re)}async function xt(s){const e=re.get(s);e&&(e.templateUrl&&!e._templateLoaded||e.styleUrl&&!e._styleLoaded)&&await De.prototype._loadExternals.call({_def:e})}const oe=new Map;function Bn(s,e={}){const t=Tt(),n=Array.isArray(s)?s:[s],r=[],i=[];let o=null;e.critical!==!1&&(o=document.createElement("style"),o.setAttribute("data-zq-critical",""),o.textContent=`html{visibility:hidden!important;background:${e.bg||"#0d1117"}}`,document.head.insertBefore(o,document.head.firstChild));for(let c of n){if(typeof c=="string"&&!c.startsWith("/")&&!c.includes(":")&&!c.startsWith("//")&&(c=J(c,t)),oe.has(c)){r.push(oe.get(c));continue}const l=document.createElement("link");l.rel="stylesheet",l.href=c,l.setAttribute("data-zq-style","");const u=new Promise(d=>{l.onload=d,l.onerror=d});i.push(u),document.head.appendChild(l),oe.set(c,l),r.push(l)}return{ready:Promise.all(i).then(()=>{o&&o.remove()}),remove(){for(const c of r){c.remove();for(const[l,u]of oe)if(u===c){oe.delete(l);break}}}}}const j="__zq";function Lt(s,e){if(s===e)return!0;if(!s||!e)return!1;const t=Object.keys(s),n=Object.keys(e);if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++){const i=t[r];if(s[i]!==e[i])return!1}return!0}class Un{constructor(e={}){this._el=null;const t=typeof location!="undefined"&&location.protocol==="file:";this._mode=t?"hash":e.mode||"history",this._keepAliveCache=new Map,this._keepAliveMax=typeof e.keepAliveMax=="number"&&e.keepAliveMax>0?e.keepAliveMax:null;let n=e.base;if(n==null&&(n=typeof window!="undefined"&&window.__ZQ_BASE||"",!n&&typeof document!="undefined")){const r=document.querySelector("base");if(r){try{n=new URL(r.href).pathname}catch{n=r.getAttribute("href")||""}n==="/"&&(n="")}}if(this._base=String(n).replace(/\/+$/,""),this._base&&!this._base.startsWith("/")&&(this._base="/"+this._base),this._routes=[],this._fallback=e.fallback||null,this._current=null,this._guards={before:[],after:[]},this._listeners=new Set,this._instance=null,this._resolving=!1,this._substateListeners=[],this._inSubstate=!1,e.el)this._el=typeof e.el=="string"?document.querySelector(e.el):e.el;else if(typeof document!="undefined"){const r=document.querySelector("z-outlet");if(r){if(this._el=r,!e.fallback&&r.getAttribute("fallback")&&(this._fallback=r.getAttribute("fallback")),!e.mode&&r.getAttribute("mode")){const i=r.getAttribute("mode");(i==="hash"||i==="history")&&(this._mode=t?"hash":i)}if(e.base==null&&r.getAttribute("base")){let i=r.getAttribute("base");i=String(i).replace(/\/+$/,""),i&&!i.startsWith("/")&&(i="/"+i),this._base=i}}}e.routes&&e.routes.forEach(r=>this.add(r)),this._mode==="hash"?(this._onNavEvent=()=>this._resolve(),window.addEventListener("hashchange",this._onNavEvent),this._onPopState=r=>{const i=r.state;if(i&&i[j]==="substate"){if(this._fireSubstate(i.key,i.data,"pop"))return;this._resolve().then(()=>{this._fireSubstate(i.key,i.data,"pop")});return}else this._inSubstate&&(this._inSubstate=!1,this._fireSubstate(null,null,"reset"))},window.addEventListener("popstate",this._onPopState)):(this._onNavEvent=r=>{const i=r.state;if(i&&i[j]==="substate"){if(this._fireSubstate(i.key,i.data,"pop"))return;this._resolve().then(()=>{this._fireSubstate(i.key,i.data,"pop")});return}else this._inSubstate&&(this._inSubstate=!1,this._fireSubstate(null,null,"reset"));this._resolve()},window.addEventListener("popstate",this._onNavEvent)),this._onLinkClick=r=>{if(r.metaKey||r.ctrlKey||r.shiftKey||r.altKey)return;const i=r.target.closest("[z-link]");if(!i||i.getAttribute("target")==="_blank")return;r.preventDefault();let o=i.getAttribute("z-link");if(o&&/^[a-z][a-z0-9+.-]*:/i.test(o))return;const a=i.getAttribute("z-link-params");if(a)try{const c=JSON.parse(a);typeof c!="object"||c===null||Array.isArray(c)?A(v.ROUTER_RESOLVE,"z-link-params must be a JSON object",{href:o,paramsAttr:a}):o=this._interpolateParams(o,c)}catch(c){A(v.ROUTER_RESOLVE,"Malformed JSON in z-link-params",{href:o,paramsAttr:a},c)}if(this.navigate(o),i.hasAttribute("z-to-top")){const c=i.getAttribute("z-to-top")||"instant";window.scrollTo({top:0,behavior:c})}},document.addEventListener("click",this._onLinkClick),this._el&&queueMicrotask(()=>this._resolve())}add(e){const{regex:t,keys:n}=we(e.path);if(this._routes.push({...e,_regex:t,_keys:n}),e.fallback){const r=we(e.fallback);this._routes.push({...e,path:e.fallback,_regex:r.regex,_keys:r.keys})}return this}remove(e){return this._routes=this._routes.filter(t=>t.path!==e),this}_interpolateParams(e,t){return!t||typeof t!="object"?e:e.replace(/:([\w]+)/g,(n,r)=>{const i=t[r];return i!=null?encodeURIComponent(String(i)):":"+r})}_currentURL(){if(this._mode==="hash")return window.location.hash.slice(1)||"/";const e=window.location.pathname||"/",t=window.location.hash||"";return e+t}navigate(e,t={}){t.params&&(e=this._interpolateParams(e,t.params));const[n,r]=(e||"").split("#");let i=this._normalizePath(n);const o=r?"#"+r:"";if(this._mode==="hash"){r&&(window.__zqScrollTarget=r);const a="#"+i;if(window.location.hash===a&&!t.force)return this;window.location.hash=a}else{const a=this._base+i+o,c=(window.location.pathname||"/")+(window.location.hash||"");if(a===c&&!t.force){if(r){const d=document.getElementById(r);d&&d.scrollIntoView({behavior:"smooth",block:"start"})}return this}const l=this._base+i,u=window.location.pathname||"/";if(l===u&&o&&!t.force){if(window.history.replaceState({...t.state,[j]:"route"},"",a),r){const d=document.getElementById(r);d&&d.scrollIntoView({behavior:"smooth",block:"start"})}return this}window.history.pushState({...t.state,[j]:"route"},"",a),this._resolve()}return this}replace(e,t={}){t.params&&(e=this._interpolateParams(e,t.params));const[n,r]=(e||"").split("#");let i=this._normalizePath(n);const o=r?"#"+r:"";return this._mode==="hash"?(r&&(window.__zqScrollTarget=r),window.location.replace("#"+i)):(window.history.replaceState({...t.state,[j]:"route"},"",this._base+i+o),this._resolve()),this}_normalizePath(e){let t=e&&e.startsWith("/")?e:e?`/${e}`:"/";if(this._base){if(t===this._base)return"/";t.startsWith(this._base+"/")&&(t=t.slice(this._base.length)||"/")}return t}resolve(e){const t=e&&e.startsWith("/")?e:e?`/${e}`:"/";return this._base+t}back(){return window.history.back(),this}forward(){return window.history.forward(),this}go(e){return window.history.go(e),this}beforeEach(e){return this._guards.before.push(e),this}afterEach(e){return this._guards.after.push(e),this}onChange(e){return this._listeners.add(e),()=>this._listeners.delete(e)}pushSubstate(e,t){return this._inSubstate=!0,this._mode==="hash"?window.history.pushState({[j]:"substate",key:e,data:t},"",window.location.href):window.history.pushState({[j]:"substate",key:e,data:t},"",window.location.href),this}onSubstate(e){return this._substateListeners.push(e),()=>{this._substateListeners=this._substateListeners.filter(t=>t!==e)}}_fireSubstate(e,t,n){for(const r of this._substateListeners)try{if(r(e,t,n)===!0)return!0}catch(i){A(v.ROUTER_GUARD,"onSubstate listener threw",{key:e,data:t},i)}return!1}get current(){return this._current}get base(){return this._base}get path(){if(this._mode==="hash"){const t=window.location.hash.slice(1)||"/";if(t&&!t.startsWith("/")){window.__zqScrollTarget=t;const n=this._current&&this._current.path||"/";return window.location.replace("#"+n),n}return t}let e=window.location.pathname||"/";if(e.length>1&&e.endsWith("/")&&(e=e.slice(0,-1)),this._base){if(e===this._base)return"/";if(e.startsWith(this._base+"/"))return e.slice(this._base.length)||"/"}return e}get query(){const e=this._mode==="hash"?window.location.hash.split("?")[1]||"":window.location.search.slice(1);return Object.fromEntries(new URLSearchParams(e))}async _resolve(){if(!this._resolving){this._resolving=!0,this._redirectCount=0;try{await this.__resolve()}finally{this._resolving=!1}}}async __resolve(){const e=window.history.state;if(e&&e[j]==="substate"&&this._fireSubstate(e.key,e.data,"resolve"))return;const t=this.path,[n,r]=t.split("?"),i=n||"/",o=Object.fromEntries(new URLSearchParams(r||""));let a=null,c={};for(const d of this._routes){const p=i.match(d._regex);if(p){a=d,d._keys.forEach((f,_)=>{c[f]=p[_+1]});break}}if(!a&&this._fallback&&(a={component:this._fallback,path:"*",_keys:[],_regex:/.*/}),!a)return;const l={route:a,params:c,query:o,path:i},u=this._current;if(u&&this._instance&&a.component===u.route.component){const d=Lt(c,u.params),p=Lt(o,u.query);if(d&&p)return}for(const d of this._guards.before)try{const p=await d(l,u);if(p===!1)return;if(typeof p=="string"){if(++this._redirectCount>10){A(v.ROUTER_GUARD,"Too many guard redirects (possible loop)",{to:l},null);return}const[f,_]=p.split("#"),w=this._normalizePath(f||"/"),m=_?"#"+_:"";return this._mode==="hash"?(_&&(window.__zqScrollTarget=_),window.location.replace("#"+w)):window.history.replaceState({[j]:"route"},"",this._base+w+m),this.__resolve()}}catch(p){A(v.ROUTER_GUARD,"Before-guard threw",{to:l,from:u},p);return}if(a.load)try{await a.load()}catch(d){A(v.ROUTER_LOAD,`Failed to load module for route "${a.path}"`,{path:a.path},d);return}if(this._current=l,this._el&&a.component){typeof a.component=="string"&&await xt(a.component);const d=!!a.keepAlive,p=typeof a.component=="string"?a.component:null;if(this._instance&&this._currentKeepAlive&&this._currentComponentName){const w=this._keepAliveCache.get(this._currentComponentName);if(w&&(w.container.style.display="none",w.instance._def.deactivated))try{w.instance._def.deactivated.call(w.instance)}catch(m){A(v.COMP_LIFECYCLE,`Component "${this._currentComponentName}" deactivated() threw`,{component:this._currentComponentName},m)}this._instance=null}else this._instance&&(this._instance.destroy(),this._instance=null);const f=typeof window!="undefined"&&window.__zqRenderHook?performance.now():0,_={...c,$route:l,$query:o,$params:c};if(d&&p&&this._keepAliveCache.has(p)){const w=this._keepAliveCache.get(p);if(this._keepAliveCache.delete(p),this._keepAliveCache.set(p,w),[...this._el.children].forEach(m=>{m.style.display="none"}),w.container.style.display="",this._instance=w.instance,this._currentKeepAlive=!0,this._currentComponentName=p,w.instance._def.activated)try{w.instance._def.activated.call(w.instance)}catch(m){A(v.COMP_LIFECYCLE,`Component "${p}" activated() threw`,{component:p},m)}f&&window.__zqRenderHook(this._el,performance.now()-f,"route",p)}else if(p){[...this._el.children].forEach(m=>{m.dataset.zqKeepAlive&&(m.style.display="none")}),[...this._el.children].forEach(m=>{m.dataset.zqKeepAlive||m.remove()});const w=document.createElement(p);d&&(w.dataset.zqKeepAlive=p),this._el.appendChild(w);try{this._instance=Rt(w,p,_)}catch(m){A(v.COMP_NOT_FOUND,`Failed to mount component for route "${a.path}"`,{component:a.component,path:a.path},m);return}if(d&&(this._keepAliveCache.set(p,{container:w,instance:this._instance}),this._evictKeepAliveLRU(),this._instance._def.activated))try{this._instance._def.activated.call(this._instance)}catch(m){A(v.COMP_LIFECYCLE,`Component "${p}" activated() threw`,{component:p},m)}this._currentKeepAlive=d,this._currentComponentName=p,f&&window.__zqRenderHook(this._el,performance.now()-f,"route",p)}else if(typeof a.component=="function"){[...this._el.children].forEach(m=>{m.dataset.zqKeepAlive?m.style.display="none":m.remove()});const w=document.createElement("div");for(w.innerHTML=a.component(l);w.firstChild;)this._el.appendChild(w.firstChild);this._currentKeepAlive=!1,this._currentComponentName=null,f&&window.__zqRenderHook(this._el,performance.now()-f,"route",l)}}this._updateActiveRoutes(i);for(const d of this._guards.after)await d(l,u);this._listeners.forEach(d=>d(l,u))}_updateActiveRoutes(e){if(typeof document=="undefined")return;const t=document.querySelectorAll("[z-active-route]");for(let n=0;n<t.length;n++){const r=t[n],i=r.getAttribute("z-active-route"),o=r.getAttribute("z-active-class")||"active",c=r.hasAttribute("z-active-exact")?e===i:i==="/"?e==="/":e.startsWith(i);r.classList.toggle(o,c)}}_evictKeepAliveLRU(){if(this._keepAliveMax!=null)for(;this._keepAliveCache.size>this._keepAliveMax;){let e=null;for(const n of this._keepAliveCache.keys())if(n!==this._currentComponentName){e=n;break}if(e==null)break;const t=this._keepAliveCache.get(e);this._keepAliveCache.delete(e);try{t.instance.destroy()}catch{}t.container&&t.container.parentNode&&t.container.remove()}}destroy(){this._onNavEvent&&(window.removeEventListener(this._mode==="hash"?"hashchange":"popstate",this._onNavEvent),this._onNavEvent=null),this._onPopState&&(window.removeEventListener("popstate",this._onPopState),this._onPopState=null),this._onLinkClick&&(document.removeEventListener("click",this._onLinkClick),this._onLinkClick=null);for(const[,e]of this._keepAliveCache)e.instance.destroy();this._keepAliveCache.clear(),this._instance&&this._instance.destroy(),this._listeners.clear(),this._substateListeners=[],this._inSubstate=!1,this._routes=[],this._guards={before:[],after:[]}}}function we(s){const e=[],t=s.replace(/:(\w+)/g,(n,r)=>(e.push(r),"([^/]+)")).replace(/\*/g,"(.*)");return{regex:new RegExp(`^${t}$`),keys:e}}function Mn(s,e,t="not-found"){for(const n of s){const{regex:r,keys:i}=we(n.path),o=e.match(r);if(o){const a={};return i.forEach((c,l)=>{a[c]=o[l+1]}),{component:n.component,params:a}}if(n.fallback){const a=we(n.fallback),c=e.match(a.regex);if(c){const l={};return a.keys.forEach((u,d)=>{l[u]=c[d+1]}),{component:n.component,params:l}}}}return{component:t,params:{}}}let We=null;function In(s){return We=new Un(s),We}function Dn(){return We}class Wn{constructor(e={}){this._subscribers=new Map,this._wildcards=new Set,this._actions=e.actions||{},this._getters=e.getters||{},this._middleware=[],this._history=[],this._maxHistory=e.maxHistory||1e3,this._debug=e.debug||!1,this._batching=!1,this._batchQueue=[],this._undoStack=[],this._redoStack=[],this._maxUndo=e.maxUndo||50;const t=typeof e.state=="function"?e.state():{...e.state||{}};this._initialState=K(t),this.state=Pe(t,(n,r,i)=>{if(this._batching){this._batchQueue.push({key:n,value:r,old:i});return}this._notifySubscribers(n,r,i)}),this.getters={};for(const[n,r]of Object.entries(this._getters))Object.defineProperty(this.getters,n,{get:()=>r(this.state.__raw||this.state),enumerable:!0})}_notifySubscribers(e,t,n){const r=this._subscribers.get(e);r&&r.forEach(i=>{try{i(e,t,n)}catch(o){A(v.STORE_SUBSCRIBE,`Subscriber for "${e}" threw`,{key:e},o)}}),this._wildcards.forEach(i=>{try{i(e,t,n)}catch(o){A(v.STORE_SUBSCRIBE,"Wildcard subscriber threw",{key:e},o)}})}batch(e){this._batching=!0,this._batchQueue=[];let t;try{t=e(this.state)}finally{this._batching=!1;const n=new Map;for(const r of this._batchQueue)n.set(r.key,r);this._batchQueue=[];for(const{key:r,value:i,old:o}of n.values())this._notifySubscribers(r,i,o)}return t}checkpoint(){const e=K(this.state.__raw||this.state);this._undoStack.push(e),this._undoStack.length>this._maxUndo&&this._undoStack.splice(0,this._undoStack.length-this._maxUndo),this._redoStack=[]}undo(){if(this._undoStack.length===0)return!1;const e=K(this.state.__raw||this.state);this._redoStack.push(e);const t=this._undoStack.pop();return this.replaceState(t),!0}redo(){if(this._redoStack.length===0)return!1;const e=K(this.state.__raw||this.state);this._undoStack.push(e);const t=this._redoStack.pop();return this.replaceState(t),!0}get canUndo(){return this._undoStack.length>0}get canRedo(){return this._redoStack.length>0}dispatch(e,...t){const n=this._actions[e];if(!n){A(v.STORE_ACTION,`Unknown action "${e}"`,{action:e,args:t});return}for(const r of this._middleware)try{if(r(e,t,this.state)===!1)return}catch(i){A(v.STORE_MIDDLEWARE,`Middleware threw during "${e}"`,{action:e},i);return}this._debug&&console.log(`%c[Store] ${e}`,"color: #4CAF50; font-weight: bold;",...t);try{const r=n(this.state,...t);return this._history.push({action:e,args:t,timestamp:Date.now()}),this._history.length>this._maxHistory&&this._history.splice(0,this._history.length-this._maxHistory),r}catch(r){A(v.STORE_ACTION,`Action "${e}" threw`,{action:e,args:t},r)}}subscribe(e,t){if(typeof e=="function")return this._wildcards.add(e),()=>this._wildcards.delete(e);if(Array.isArray(e)){const n=e,r=(i,o,a)=>{n.includes(i)&&t(i,o,a)};return this._wildcards.add(r),()=>this._wildcards.delete(r)}return this._subscribers.has(e)||this._subscribers.set(e,new Set),this._subscribers.get(e).add(t),()=>{var n;return(n=this._subscribers.get(e))==null?void 0:n.delete(t)}}snapshot(e){const t=this.state.__raw||this.state;return e&&e.clone===!1?t:K(t)}replaceState(e){const t=this.state.__raw||this.state;for(const n of Object.keys(t))delete this.state[n];Object.assign(this.state,e)}use(e){return this._middleware.push(e),this}get history(){return[...this._history]}reset(e){this.replaceState(e||K(this._initialState)),this._history=[],this._undoStack=[],this._redoStack=[]}}let Ot=new Map;function zn(s,e){typeof s=="object"&&(e=s,s="default");const t=new Wn(e);return Ot.set(s,t),t}function qn(s="default"){return Ot.get(s)||null}function jn(s,e){return{_zqConnector:!0,store:s,keys:e}}const F={baseURL:"",headers:{"Content-Type":"application/json"},timeout:3e4},q={request:[],response:[]};async function Y(s,e,t,n={}){var p;if(!e||typeof e!="string")throw new Error(`HTTP request requires a URL string, got ${typeof e}`);let r=e.startsWith("http")?e:F.baseURL+e,i={...F.headers,...n.headers},o;const a={method:s.toUpperCase(),headers:i,...n};if(t!==void 0&&s!=="GET"&&s!=="HEAD"&&(t instanceof FormData?(o=t,delete a.headers["Content-Type"]):typeof t=="object"?o=JSON.stringify(t):o=t,a.body=o),t&&(s==="GET"||s==="HEAD")&&typeof t=="object"){const f=new URLSearchParams(t).toString();r+=(r.includes("?")?"&":"?")+f}const c=new AbortController,l=(p=n.timeout)!=null?p:F.timeout;let u;n.signal?typeof AbortSignal.any=="function"?a.signal=AbortSignal.any([n.signal,c.signal]):(a.signal=c.signal,n.signal.aborted?c.abort(n.signal.reason):n.signal.addEventListener("abort",()=>c.abort(n.signal.reason),{once:!0})):a.signal=c.signal;let d=!1;l>0&&(u=setTimeout(()=>{d=!0,c.abort()},l));for(const f of q.request){const _=await f(a,r);if(_===!1)throw new Error("Request blocked by interceptor");_!=null&&_.url&&(r=_.url),_!=null&&_.options&&Object.assign(a,_.options)}try{const f=await fetch(r,a);u&&clearTimeout(u);const _=f.headers.get("Content-Type")||"";let w;try{if(_.includes("application/json"))w=await f.json();else if(_.includes("text/"))w=await f.text();else if(_.includes("application/octet-stream")||_.includes("image/"))w=await f.blob();else{const S=await f.text();try{w=JSON.parse(S)}catch{w=S}}}catch(S){w=null,console.warn(`[zQuery HTTP] Failed to parse response body from ${s} ${r}:`,S.message)}const m={ok:f.ok,status:f.status,statusText:f.statusText,headers:Object.fromEntries(f.headers.entries()),data:w,response:f};for(const S of q.response)await S(m);if(!f.ok){const S=new Error(`HTTP ${f.status}: ${f.statusText}`);throw S.response=m,S}return m}catch(f){throw u&&clearTimeout(u),f.name==="AbortError"?d?new Error(`Request timeout after ${l}ms: ${s} ${r}`):new Error(`Request aborted: ${s} ${r}`):f}}const H={get:(s,e,t)=>Y("GET",s,e,t),post:(s,e,t)=>Y("POST",s,e,t),put:(s,e,t)=>Y("PUT",s,e,t),patch:(s,e,t)=>Y("PATCH",s,e,t),delete:(s,e,t)=>Y("DELETE",s,e,t),head:(s,e)=>Y("HEAD",s,void 0,e),configure(s){s.baseURL!==void 0&&(F.baseURL=s.baseURL),s.headers&&Object.assign(F.headers,s.headers),s.timeout!==void 0&&(F.timeout=s.timeout)},getConfig(){return{baseURL:F.baseURL,headers:{...F.headers},timeout:F.timeout}},onRequest(s){return q.request.push(s),()=>{const e=q.request.indexOf(s);e!==-1&&q.request.splice(e,1)}},onResponse(s){return q.response.push(s),()=>{const e=q.response.indexOf(s);e!==-1&&q.response.splice(e,1)}},clearInterceptors(s){(!s||s==="request")&&(q.request.length=0),(!s||s==="response")&&(q.response.length=0)},all(s){return Promise.all(s)},createAbort(){return new AbortController},raw:(s,e)=>fetch(s,e)};function Fn(s,e=250,t={}){let n;const r=t.signal,i=(...o)=>{r&&r.aborted||(clearTimeout(n),n=setTimeout(()=>s(...o),e))};return i.cancel=()=>clearTimeout(n),r&&(r.aborted?i.cancel():r.addEventListener("abort",i.cancel,{once:!0})),i}function Qn(s,e=250,t={}){let n=0,r;const i=t.signal,o=(...a)=>{if(i&&i.aborted)return;const c=Date.now(),l=e-(c-n);clearTimeout(r),l<=0?(n=c,s(...a)):r=setTimeout(()=>{n=Date.now(),s(...a)},l)};return o.cancel=()=>clearTimeout(r),i&&(i.aborted?o.cancel():i.addEventListener("abort",o.cancel,{once:!0})),o}function $n(...s){return e=>s.reduce((t,n)=>n(t),e)}function Zn(s){let e=!1,t;return(...n)=>(e||(e=!0,t=s(...n)),t)}function Hn(s){return new Promise(e=>setTimeout(e,s))}function ge(s){const e={"&":"&","<":"<",">":">",'"':""","'":"'"};return String(s).replace(/[&<>"']/g,t=>e[t])}function Kn(s){return String(s).replace(/<[^>]*>/g,"")}function Gn(s,...e){return s.reduce((t,n,r)=>{const i=e[r-1],o=i instanceof ze?i.toString():ge(i!=null?i:"");return t+o+n})}class ze{constructor(e){this._html=e}toString(){return this._html}}function Vn(s){return new ze(s)}function Jn(){return crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,s=>{const e=new Uint8Array(1);crypto.getRandomValues(e);const t=e[0]&15;return(s==="x"?t:t&3|8).toString(16)})}function Yn(s){return s.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function Xn(s){return s.replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").replace(/([a-z\d])([A-Z])/g,"$1-$2").toLowerCase()}function K(s){if(typeof structuredClone=="function")return structuredClone(s);const e=new Map;function t(n){if(n===null||typeof n!="object")return n;if(e.has(n))return e.get(n);if(n instanceof Date)return new Date(n.getTime());if(n instanceof RegExp)return new RegExp(n.source,n.flags);if(n instanceof Map){const i=new Map;return e.set(n,i),n.forEach((o,a)=>i.set(t(a),t(o))),i}if(n instanceof Set){const i=new Set;return e.set(n,i),n.forEach(o=>i.add(t(o))),i}if(ArrayBuffer.isView(n))return new n.constructor(n.buffer.slice(0));if(n instanceof ArrayBuffer)return n.slice(0);if(Array.isArray(n)){const i=[];e.set(n,i);for(let o=0;o<n.length;o++)i[o]=t(n[o]);return i}const r=Object.create(Object.getPrototypeOf(n));e.set(n,r);for(const i of Object.keys(n))r[i]=t(n[i]);return r}return t(s)}const qe=new Set(["__proto__","constructor","prototype"]);function es(s,...e){const t=new WeakSet;function n(r,i){if(t.has(i))return r;t.add(i);for(const o of Object.keys(i))qe.has(o)||(i[o]&&typeof i[o]=="object"&&!Array.isArray(i[o])?((!r[o]||typeof r[o]!="object")&&(r[o]={}),n(r[o],i[o])):r[o]=i[o]);return r}for(const r of e)n(s,r);return s}function Nt(s,e,t){if(s===e)return!0;if(typeof s!=typeof e||typeof s!="object"||s===null||e===null||Array.isArray(s)!==Array.isArray(e))return!1;if(t||(t=new Set),t.has(s))return!0;t.add(s);const n=Object.keys(s),r=Object.keys(e);return n.length!==r.length?!1:n.every(i=>Nt(s[i],e[i],t))}function ts(s){return new URLSearchParams(s).toString()}function ns(s){return Object.fromEntries(new URLSearchParams(s))}const ss={get(s,e=null){try{const t=localStorage.getItem(s);return t!==null?JSON.parse(t):e}catch{return e}},set(s,e){localStorage.setItem(s,JSON.stringify(e))},remove(s){localStorage.removeItem(s)},clear(){localStorage.clear()}},rs={get(s,e=null){try{const t=sessionStorage.getItem(s);return t!==null?JSON.parse(t):e}catch{return e}},set(s,e){sessionStorage.setItem(s,JSON.stringify(e))},remove(s){sessionStorage.removeItem(s)},clear(){sessionStorage.clear()}};class Pt{constructor(){this._handlers=new Map}on(e,t){return this._handlers.has(e)||this._handlers.set(e,new Set),this._handlers.get(e).add(t),()=>this.off(e,t)}off(e,t){var n;(n=this._handlers.get(e))==null||n.delete(t)}emit(e,...t){var n;(n=this._handlers.get(e))==null||n.forEach(r=>r(...t))}once(e,t){const n=(...r)=>{t(...r),this.off(e,n)};return this.on(e,n)}clear(){this._handlers.clear()}}const is=new Pt;function os(s,e,t){let n,r,i;if(e===void 0?(n=0,r=s,i=1):(n=s,r=e,i=t!==void 0?t:1),i===0)return[];const o=[];if(i>0)for(let a=n;a<r;a+=i)o.push(a);else for(let a=n;a>r;a+=i)o.push(a);return o}function as(s,e){if(!e)return[...new Set(s)];const t=new Set;return s.filter(n=>{const r=e(n);return t.has(r)?!1:(t.add(r),!0)})}function cs(s,e){const t=[];for(let n=0;n<s.length;n+=e)t.push(s.slice(n,n+e));return t}function ls(s,e){var n;if(typeof Object.groupBy=="function")return Object.groupBy(s,e);const t={};for(const r of s){const i=e(r);((n=t[i])!=null?n:t[i]=[]).push(r)}return t}function us(s,e){const t={};for(const n of e)n in s&&(t[n]=s[n]);return t}function fs(s,e){const t=new Set(e),n={};for(const r of Object.keys(s))t.has(r)||(n[r]=s[r]);return n}function hs(s,e,t){const n=e.split(".");let r=s;for(const i of n){if(r==null||typeof r!="object")return t;r=r[i]}return r===void 0?t:r}function ds(s,e,t){const n=e.split(".");let r=s;for(let o=0;o<n.length-1;o++){const a=n[o];if(qe.has(a))return s;(r[a]==null||typeof r[a]!="object")&&(r[a]={}),r=r[a]}const i=n[n.length-1];return qe.has(i)||(r[i]=t),s}function ps(s){return s==null?!0:typeof s=="string"||Array.isArray(s)?s.length===0:s instanceof Map||s instanceof Set?s.size===0:typeof s=="object"?Object.keys(s).length===0:!1}function _s(s){return s?s[0].toUpperCase()+s.slice(1).toLowerCase():""}function ms(s,e,t="…"){if(s.length<=e)return s;const n=Math.max(0,e-t.length);return s.slice(0,n)+t}function ys(s,e,t){return s<e?e:s>t?t:s}function ws(s,e){let t,n=0;typeof e=="function"?t=e:e&&typeof e=="object"&&(n=e.maxSize||0);const r=new Map,i=(...o)=>{const a=t?t(...o):o[0];if(r.has(a)){const l=r.get(a);return r.delete(a),r.set(a,l),l}const c=s(...o);return r.set(a,c),n>0&&r.size>n&&r.delete(r.keys().next().value),c};return i.clear=()=>r.clear(),i}function gs(s,e={}){const{attempts:t=3,delay:n=1e3,backoff:r=1}=e;return new Promise((i,o)=>{let a=0,c=n;const l=()=>{a++,s(a).then(i,u=>{if(a>=t)return o(u);const d=c;c*=r,setTimeout(l,d)})};l()})}function Es(s,e,t){let n;return Promise.race([s,new Promise((i,o)=>{n=setTimeout(()=>o(new Error(t||`Timed out after ${e}ms`)),e)})]).finally(()=>clearTimeout(n))}function h(s,e){if(typeof s=="function"){C.ready(s);return}return C(s,e)}h.id=C.id,h.class=C.class,h.classes=C.classes,h.tag=C.tag,Object.defineProperty(h,"name",{value:C.name,writable:!0,configurable:!0}),h.children=C.children,h.qs=C.qs,h.qsa=C.qsa,h.all=function(s,e){return gn(s,e)},h.create=C.create,h.ready=C.ready,h.on=C.on,h.off=C.off,h.fn=C.fn,h.reactive=Pe,h.Signal=R,h.signal=$,h.computed=fn,h.effect=wt,h.batch=hn,h.untracked=dn,h.component=Ln,h.mount=Rt,h.mountAll=kt,h.getInstance=On,h.destroy=Nn,h.components=Pn,h.prefetch=xt,h.style=Bn,h.morph=Ue,h.morphElement=Et,h.safeEval=V,h.router=In,h.getRouter=Dn,h.matchRoute=Mn,h.store=zn,h.getStore=qn,h.connectStore=jn,h.http=H,h.get=H.get,h.post=H.post,h.put=H.put,h.patch=H.patch,h.delete=H.delete,h.head=H.head,h.debounce=Fn,h.throttle=Qn,h.pipe=$n,h.once=Zn,h.sleep=Hn,h.escapeHtml=ge,h.stripHtml=Kn,h.html=Gn,h.trust=Vn,h.TrustedHTML=ze,h.uuid=Jn,h.camelCase=Yn,h.kebabCase=Xn,h.deepClone=K,h.deepMerge=es,h.isEqual=Nt,h.param=ts,h.parseQuery=ns,h.storage=ss,h.session=rs,h.EventBus=Pt,h.bus=is,h.range=os,h.unique=as,h.chunk=cs,h.groupBy=ls,h.pick=us,h.omit=fs,h.getPath=hs,h.setPath=ds,h.isEmpty=ps,h.capitalize=_s,h.truncate=ms,h.clamp=ys,h.memoize=ws,h.retry=gs,h.timeout=Es,h.onError=Bt,h.ZQueryError=I,h.ErrorCode=v,h.guardCallback=Ut,h.guardAsync=It,h.validate=Mt,h.formatError=Qe,h.webrtc=un,h.SignalingClient=Re,h.Peer=ke,h.Room=G,h.useRoom=Ye,h.usePeer=Xe,h.useTracks=et,h.useDataChannel=tt,h.useConnectionQuality=nt,h.fetchTurnCredentials=xe,h.mergeIceServers=rt,h.createTurnRefresher=it,h.deriveSFrameKey=ct,h.generateSFrameKey=lt,h.SFrameContext=ne,h.encryptFrame=Le,h.decryptFrame=Oe,h.attachE2ee=ut,h.loadSfuAdapter=mt,h.SfuError=k,h.decodeJoinToken=ht,h.isJoinTokenExpired=dt,h.samplePeerStats=Ne,h.createStatsSampler=pt,h.classifyStats=_t,h.parseSdp=Ee,h.validateSdp=Ze,h.parseCandidate=Se,h.stringifyCandidate=He,h.filterCandidates=Ke,h.isPrivateIp=ve,h.isLoopbackIp=Ce,h.isLinkLocalIp=Ae,h.isMdnsHostname=Te,h.WebRtcError=E,h.SignalingError=P,h.IceError=U,h.SdpError=B,h.TurnError=M,h.E2eeError=N,h.version="1.2.6",h.libSize="~130 KB",h.unitTests={"passed":2348,"failed":0,"total":2534,"suites":620,"duration":9008,"ok":true},h.meta={},h.isElectron=typeof navigator!="undefined"&&/Electron/i.test(navigator.userAgent)||typeof process!="undefined"&&process.versions!=null&&!!process.versions.electron,h.platform=h.isElectron?"electron":typeof window!="undefined"?"browser":"node",h.noConflict=()=>(typeof window!="undefined"&&window.$===h&&delete window.$,h),typeof window!="undefined"&&(window.$=h,window.zQuery=h)})(typeof window!="undefined"?window:globalThis);
|
|
13
|
+
`);if(!this._mounted&&t){const c=this._def;let l=c._scopeAttr;if(l||(l=c._name?`z-s-${c._name}`:`z-s${this._uid}`,c._scopeAttr=l),this._el.setAttribute(l,""),this._scopeAttr=l,c._styleEl&&c._styleEl.isConnected)c._styleRefCount=(c._styleRefCount||0)+1;else{let u=0,d=0;const p=t.replace(/([^{}]+)\{|\}/g,(_,w)=>{if(_==="}")return u>0&&d<=u&&(u=0),d--,_;d++;const m=w.trim();return m.startsWith("@")?(/^@(keyframes|font-face)\b/.test(m)&&(u=d),_):u>0&&d>u?_:w.split(",").map(S=>`[${l}] ${S.trim()}`).join(", ")+" {"}),f=document.createElement("style");f.textContent=p,f.setAttribute("data-zq-component",c._name||""),f.setAttribute("data-zq-scope",l),c._resolvedStyleUrls&&(f.setAttribute("data-zq-style-urls",c._resolvedStyleUrls.join(" ")),c.styles&&f.setAttribute("data-zq-inline",c.styles)),document.head.appendChild(f),c._styleEl=f,c._styleRefCount=1}}let n=null;const r=document.activeElement;if(r&&this._el.contains(r)){const c=(o=r.getAttribute)==null?void 0:o.call(r,"z-model"),l=(a=r.getAttribute)==null?void 0:a.call(r,"z-ref");let u=null;if(c)u=`[z-model="${c}"]`;else if(l)u=`[z-ref="${l}"]`;else{const d=r.tagName.toLowerCase();if(d==="input"||d==="textarea"||d==="select"){let p=d;r.type&&(p+=`[type="${r.type}"]`),r.name&&(p+=`[name="${r.name}"]`),r.placeholder&&(p+=`[placeholder="${CSS.escape(r.placeholder)}"]`),u=p}}u&&(n={selector:u,start:r.selectionStart,end:r.selectionEnd,dir:r.selectionDirection})}const i=typeof window!="undefined"&&(window.__zqMorphHook||window.__zqRenderHook)?performance.now():0;if(this._mounted?Ue(this._el,e):(this._el.innerHTML=e,i&&window.__zqRenderHook&&window.__zqRenderHook(this._el,performance.now()-i,"mount",this._def._name)),this._processDirectives(),this._bindEvents(),this._bindRefs(),this._bindModels(),n){const c=this._el.querySelector(n.selector);if(c){c!==document.activeElement&&c.focus();try{n.start!==null&&n.start!==void 0&&c.setSelectionRange(n.start,n.end,n.dir)}catch{}}}if(kt(this._el),this._mounted){if(this._def.updated)try{this._def.updated.call(this)}catch(c){A(v.COMP_LIFECYCLE,`Component "${this._def._name}" updated() threw`,{component:this._def._name},c)}}else if(this._mounted=!0,this._def.mounted)try{this._def.mounted.call(this)}catch(c){A(v.COMP_LIFECYCLE,`Component "${this._def._name}" mounted() threw`,{component:this._def._name},c)}}_bindEvents(){const e=new Map;if(this._el.querySelectorAll("*").forEach(n=>{if(n.closest("[z-pre]"))return;const r=n.attributes;for(let i=0;i<r.length;i++){const o=r[i];let a;if(o.name.charCodeAt(0)===64)a=o.name.slice(1);else if(o.name.startsWith("z-on:"))a=o.name.slice(5);else continue;const c=a.split("."),l=c[0],u=c.slice(1),d=o.value;n.dataset.zqEid||(n.dataset.zqEid=String(++At));const p=`[data-zq-eid="${n.dataset.zqEid}"]`;e.has(l)||e.set(l,[]),e.get(l).push({selector:p,methodExpr:d,modifiers:u,el:n})}}),this._eventBindings=e,this._delegatedEvents){for(const n of e.keys())this._delegatedEvents.has(n)||this._attachDelegatedEvent(n,e.get(n));for(const n of this._delegatedEvents.keys())if(!e.has(n)){const{handler:r,opts:i}=this._delegatedEvents.get(n);this._el.removeEventListener(n,r,i),this._delegatedEvents.delete(n),this._listeners=this._listeners.filter(o=>o.event!==n)}return}this._delegatedEvents=new Map;for(const[n,r]of e)this._attachDelegatedEvent(n,r);this._outsideListeners=this._outsideListeners||[];for(const[n,r]of e)for(const i of r){if(!i.modifiers.includes("outside"))continue;const o=a=>{if(i.el.contains(a.target))return;const c=i.methodExpr.match(/^(\w+)(?:\(([^)]*)\))?$/);if(!c)return;const l=this[c[1]];typeof l=="function"&&l.call(this,a)};document.addEventListener(n,o,!0),this._outsideListeners.push({event:n,handler:o})}}_attachDelegatedEvent(e,t){const n=t.some(a=>a.modifiers.includes("capture")),r=t.some(a=>a.modifiers.includes("passive")),i=n||r?{capture:n,passive:r}:!1,o=a=>{var d;const c=((d=this._eventBindings)==null?void 0:d.get(e))||[],l=[];for(const p of c){const f=a.target.closest(p.selector);f&&l.push({...p,matched:f})}l.sort((p,f)=>p.matched===f.matched?0:p.matched.contains(f.matched)?1:-1);let u=null;for(const{methodExpr:p,modifiers:f,el:_,matched:w}of l){if(u){let O=!1;for(const T of u)if(w.contains(T)&&w!==T){O=!0;break}if(O)continue}if(f.includes("self")&&a.target!==_||f.includes("outside")&&_.contains(a.target))continue;const m={enter:"Enter",escape:"Escape",tab:"Tab",space:" ",delete:"Delete|Backspace",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight"},S=new Set(["prevent","stop","self","once","outside","capture","passive","debounce","throttle","ctrl","shift","alt","meta"]);let L=!1;for(let O=0;O<f.length;O++){const T=f[O];if(m[T]){const X=m[T].split("|");if(!a.key||!X.includes(a.key)){L=!0;break}}else{if(S.has(T))continue;if(/^\d+$/.test(T)&&O>0&&(f[O-1]==="debounce"||f[O-1]==="throttle"))continue;if(!a.key||a.key.toLowerCase()!==T.toLowerCase()){L=!0;break}}}if(L||f.includes("ctrl")&&!a.ctrlKey||f.includes("shift")&&!a.shiftKey||f.includes("alt")&&!a.altKey||f.includes("meta")&&!a.metaKey)continue;f.includes("prevent")&&a.preventDefault(),f.includes("stop")&&(a.stopPropagation(),u||(u=[]),u.push(w));const W=O=>{const T=p.match(/^(\w+)(?:\(([^)]*)\))?$/);if(!T)return;const X=T[1],Fe=this[X];if(typeof Fe=="function")if(T[2]!==void 0){const bs=T[2].split(",").map(x=>{if(x=x.trim(),x!=="")return x==="$event"?O:x==="true"?!0:x==="false"?!1:x==="null"?null:/^-?\d+(\.\d+)?$/.test(x)?Number(x):x.startsWith("'")&&x.endsWith("'")||x.startsWith('"')&&x.endsWith('"')?x.slice(1,-1):x.startsWith("state.")?ye(this.state,x.slice(6)):x}).filter(x=>x!==void 0);Fe(...bs)}else Fe(O)},Q=f.indexOf("debounce");if(Q!==-1){const O=parseInt(f[Q+1],10)||250,T=_e.get(_)||{};clearTimeout(T[e]),T[e]=setTimeout(()=>W(a),O),_e.set(_,T),this._timerEls.add(_);continue}const je=f.indexOf("throttle");if(je!==-1){const O=parseInt(f[je+1],10)||250,T=me.get(_)||{};if(T[e])continue;W(a),T[e]=setTimeout(()=>{T[e]=null},O),me.set(_,T),this._timerEls.add(_);continue}if(f.includes("once")){if(_.dataset.zqOnce===e)continue;_.dataset.zqOnce=e}W(a)}};this._el.addEventListener(e,o,i),this._listeners.push({event:e,handler:o}),this._delegatedEvents.set(e,{handler:o,opts:i})}_bindRefs(){this.refs={},this._el.querySelectorAll("[z-ref]").forEach(e=>{this.refs[e.getAttribute("z-ref")]=e})}_bindModels(){this._el.querySelectorAll("[z-model]").forEach(e=>{const t=e.getAttribute("z-model"),n=e.tagName.toLowerCase(),r=(e.type||"").toLowerCase(),i=e.hasAttribute("contenteditable"),o=e.hasAttribute("z-lazy"),a=e.hasAttribute("z-trim"),c=e.hasAttribute("z-number"),l=e.hasAttribute("z-uppercase"),u=e.hasAttribute("z-lowercase"),d=e.hasAttribute("z-debounce"),p=d?parseInt(e.getAttribute("z-debounce"),10)||250:0,f=ye(this.state,t);if(n==="input"&&r==="checkbox")e.checked=!!f;else if(n==="input"&&r==="radio")e.checked=e.value===String(f);else if(n==="select"&&e.multiple){const m=Array.isArray(f)?f.map(String):[];[...e.options].forEach(S=>{S.selected=m.includes(S.value)})}else i?e.textContent!==String(f!=null?f:"")&&(e.textContent=f!=null?f:""):e.value=f!=null?f:"";const _=o||n==="select"||r==="checkbox"||r==="radio"?"change":"input";if(e._zqModelUnbind){try{e._zqModelUnbind()}catch{}e._zqModelUnbind=null}const w=()=>{let m;r==="checkbox"?m=e.checked:n==="select"&&e.multiple?m=[...e.selectedOptions].map(S=>S.value):i?m=e.textContent:m=e.value,a&&typeof m=="string"&&(m=m.trim()),l&&typeof m=="string"&&(m=m.toUpperCase()),u&&typeof m=="string"&&(m=m.toLowerCase()),(c||r==="number"||r==="range")&&(m=Number(m)),kn(this.state,t,m)};if(d){let m=null;const S=()=>{clearTimeout(m),m=setTimeout(w,p)};e.addEventListener(_,S),e._zqModelUnbind=()=>{e.removeEventListener(_,S),clearTimeout(m)}}else e.addEventListener(_,w),e._zqModelUnbind=()=>e.removeEventListener(_,w)})}_evalExpr(e){return V(e,[this.state.__raw||this.state,{props:this.props,refs:this.refs,computed:this.computed,$:typeof window!="undefined"?window.$:void 0}])}_expandZFor(e){if(!e.includes("z-for"))return e;const t=document.createElement("div");t.innerHTML=e;const n=r=>{let i=[...r.querySelectorAll("[z-for]")].filter(o=>!o.querySelector("[z-for]"));if(i.length){for(const o of i){if(!o.parentNode)continue;const c=o.getAttribute("z-for").match(/^\s*(?:\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)|(\w+))\s+in\s+(.+)\s*$/);if(!c){o.removeAttribute("z-for");continue}const l=c[1]||c[3],u=c[2]||"$index",d=c[4].trim();let p=this._evalExpr(d);if(p==null){o.remove();continue}if(typeof p=="number"&&(p=Array.from({length:p},(L,W)=>W+1)),!Array.isArray(p)&&typeof p=="object"&&typeof p[Symbol.iterator]!="function"&&(p=Object.entries(p).map(([L,W])=>({key:L,value:W}))),!Array.isArray(p)&&typeof p[Symbol.iterator]=="function"&&(p=[...p]),!Array.isArray(p)){o.remove();continue}const f=o.parentNode,_=o.cloneNode(!0);_.removeAttribute("z-for");const w=_.outerHTML,m=document.createDocumentFragment(),S=(L,W,Q)=>L.replace(/\{\{(.+?)\}\}/g,(je,O)=>{try{const T={};T[l]=W,T[u]=Q;const X=V(O.trim(),[T,this.state.__raw||this.state,{props:this.props,computed:this.computed,$:typeof window!="undefined"?window.$:void 0}]);return X!=null?ge(String(X)):""}catch{return""}});for(let L=0;L<p.length;L++){const W=S(w,p[L],L),Q=document.createElement("div");for(Q.innerHTML=W;Q.firstChild;)m.appendChild(Q.firstChild)}f.replaceChild(m,o)}r.querySelector("[z-for]")&&n(r)}};return n(t),t.innerHTML}_expandContentDirectives(e){if(!e.includes("z-html")&&!e.includes("z-text"))return e;const t=document.createElement("div");return t.innerHTML=e,t.querySelectorAll("[z-html]").forEach(n=>{if(n.closest("[z-pre]"))return;const r=this._evalExpr(n.getAttribute("z-html"));n.innerHTML=r!=null?String(r):"",n.removeAttribute("z-html")}),t.querySelectorAll("[z-text]").forEach(n=>{if(n.closest("[z-pre]"))return;const r=this._evalExpr(n.getAttribute("z-text"));n.textContent=r!=null?String(r):"",n.removeAttribute("z-text")}),t.innerHTML}_processDirectives(){const e=[...this._el.querySelectorAll("[z-if]")];for(const i of e){if(!i.parentNode||i.closest("[z-pre]"))continue;const o=!!this._evalExpr(i.getAttribute("z-if")),a=[{el:i,show:o}];let c=i.nextElementSibling;for(;c;)if(c.hasAttribute("z-else-if"))a.push({el:c,show:!!this._evalExpr(c.getAttribute("z-else-if"))}),c=c.nextElementSibling;else if(c.hasAttribute("z-else")){a.push({el:c,show:!0});break}else break;let l=!1;for(const u of a)if(!l&&u.show){l=!0,u.el.removeAttribute("z-if"),u.el.removeAttribute("z-else-if"),u.el.removeAttribute("z-else");const d=u.el.getAttribute("z-transition");d&&(u.el.removeAttribute("z-transition"),this._transitionEnter(u.el,d))}else{const d=u.el.getAttribute("z-transition");d?this._transitionLeave(u.el,d,()=>u.el.remove()):u.el.remove()}}this._el.querySelectorAll("[z-show]").forEach(i=>{if(i.closest("[z-pre]"))return;const o=!!this._evalExpr(i.getAttribute("z-show")),a=i.getAttribute("z-transition"),c=i.style.display==="none"||i.hasAttribute("data-zq-hidden");a?(i.removeAttribute("z-show"),o&&c?(i.style.display="",i.removeAttribute("data-zq-hidden"),this._transitionEnter(i,a)):!o&&!c?(i.setAttribute("data-zq-hidden",""),this._transitionLeave(i,a,()=>{i.style.display="none"})):(i.style.display=o?"":"none",o?i.removeAttribute("data-zq-hidden"):i.setAttribute("data-zq-hidden",""))):(i.style.display=o?"":"none",i.removeAttribute("z-show"))});const t=document.createTreeWalker(this._el,NodeFilter.SHOW_ELEMENT,{acceptNode(i){return i.hasAttribute("z-pre")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),n=typeof MediaStream!="undefined";let r;for(;r=t.nextNode();){const i=r.attributes;for(let o=i.length-1;o>=0;o--){const a=i[o];let c;if(a.name.startsWith("z-bind:"))c=a.name.slice(7);else if(a.name.charCodeAt(0)===58&&a.name.charCodeAt(1)!==58)c=a.name.slice(1);else continue;const l=this._evalExpr(a.value);r.removeAttribute(a.name),l===!1||l===null||l===void 0?r.toggleAttribute(c,!1):l===!0?r.toggleAttribute(c,!0):r.setAttribute(c,String(l))}if(r.hasAttribute("z-class")){const o=this._evalExpr(r.getAttribute("z-class"));if(typeof o=="string")o.split(/\s+/).filter(Boolean).forEach(a=>r.classList.add(a));else if(Array.isArray(o))o.filter(Boolean).forEach(a=>r.classList.add(String(a)));else if(o&&typeof o=="object")for(const[a,c]of Object.entries(o))r.classList.toggle(a,!!c);r.removeAttribute("z-class")}if(r.hasAttribute("z-style")){const o=this._evalExpr(r.getAttribute("z-style"));if(typeof o=="string")r.style.cssText+=";"+o;else if(o&&typeof o=="object")for(const[a,c]of Object.entries(o))r.style[a]=c;r.removeAttribute("z-style")}if(r.hasAttribute("z-stream")){const o=this._evalExpr(r.getAttribute("z-stream"));o==null?r.srcObject=null:n&&o instanceof MediaStream||o&&typeof o.getTracks=="function"?r.srcObject=o:r.srcObject=null,r.removeAttribute("z-stream")}r.hasAttribute("z-cloak")&&r.removeAttribute("z-cloak")}}_transitionEnter(e,t){const n=this._def.transition;if(n&&n.enter){e.classList.add(n.enter);const r=n.duration||0,i=()=>e.classList.remove(n.enter);r>0?setTimeout(i,r):(e.addEventListener("transitionend",i,{once:!0}),e.addEventListener("animationend",i,{once:!0}));return}e.classList.add(`${t}-enter-from`,`${t}-enter-active`),e.offsetHeight,requestAnimationFrame(()=>{e.classList.remove(`${t}-enter-from`),e.classList.add(`${t}-enter-to`);const r=()=>{e.classList.remove(`${t}-enter-active`,`${t}-enter-to`)};e.addEventListener("transitionend",r,{once:!0}),e.addEventListener("animationend",r,{once:!0})})}_transitionLeave(e,t,n){const r=this._def.transition;if(r&&r.leave){e.classList.add(r.leave);const i=r.duration||0,o=()=>{e.classList.remove(r.leave),n()};i>0?setTimeout(o,i):(e.addEventListener("transitionend",o,{once:!0}),e.addEventListener("animationend",o,{once:!0}));return}e.classList.add(`${t}-leave-from`,`${t}-leave-active`),e.offsetHeight,requestAnimationFrame(()=>{e.classList.remove(`${t}-leave-from`),e.classList.add(`${t}-leave-to`);const i=()=>{e.classList.remove(`${t}-leave-active`,`${t}-leave-to`),n()};e.addEventListener("transitionend",i,{once:!0}),e.addEventListener("animationend",i,{once:!0})})}setState(e){e&&Object.keys(e).length>0?Object.assign(this.state,e):this._scheduleUpdate()}emit(e,t){this._el.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,cancelable:!0}))}destroy(){if(!this._destroyed){if(this._destroyed=!0,this._def.destroyed)try{this._def.destroyed.call(this)}catch(e){A(v.COMP_LIFECYCLE,`Component "${this._def._name}" destroyed() threw`,{component:this._def._name},e)}if(this._propObserver&&(this._propObserver.disconnect(),this._propObserver=null),this._storeCleanups&&(this._storeCleanups.forEach(e=>e()),this._storeCleanups=[]),this._listeners.forEach(({event:e,handler:t})=>this._el.removeEventListener(e,t)),this._listeners=[],this._outsideListeners&&(this._outsideListeners.forEach(({event:e,handler:t})=>document.removeEventListener(e,t,!0)),this._outsideListeners=[]),this._delegatedEvents=null,this._eventBindings=null,this._timerEls&&(this._timerEls.forEach(e=>{const t=_e.get(e);if(t){for(const r in t)clearTimeout(t[r]);_e.delete(e)}const n=me.get(e);if(n){for(const r in n)clearTimeout(n[r]);me.delete(e)}}),this._timerEls.clear()),this._scopeAttr){const e=this._def;e&&e._styleEl&&e._scopeAttr===this._scopeAttr&&(e._styleRefCount=(e._styleRefCount||1)-1,e._styleRefCount<=0&&(e._styleEl.remove(),e._styleEl=null,e._styleRefCount=0))}z.delete(this._el),this._el.innerHTML=""}}}const xn=new Set(["state","render","styles","init","mounted","updated","destroyed","props","templateUrl","styleUrl","templates","base","computed","watch","stores","transition","activated","deactivated"]);function Ln(s,e){if(!s||typeof s!="string")throw new I(v.COMP_INVALID_NAME,"Component name must be a non-empty string");if(!s.includes("-"))throw new I(v.COMP_INVALID_NAME,`Component name "${s}" must contain a hyphen (Web Component convention)`);e._name=s,e.base!==void 0?e._base=e.base:e._base=Tt(),re.set(s,e)}function Rt(s,e,t={}){const n=typeof s=="string"?document.querySelector(s):s;if(!n)throw new I(v.COMP_MOUNT_TARGET,`Mount target "${s}" not found`,{target:s});const r=re.get(e);if(!r)throw new I(v.COMP_NOT_FOUND,`Component "${e}" not registered`,{component:e});z.has(n)&&z.get(n).destroy();const i=new De(n,r,t);return z.set(n,i),i._render(),i}function kt(s=document.body){for(const[e,t]of re)s.querySelectorAll(e).forEach(r=>{if(z.has(r))return;const i={};let o=null,a=r.parentElement;for(;a;){if(z.has(a)){o=z.get(a);break}a=a.parentElement}[...r.attributes].forEach(l=>{if(!(l.name.startsWith("@")||l.name.startsWith("z-"))){if(l.name.startsWith(":")){const u=l.name.slice(1);if(o)i[u]=V(l.value,[o.state.__raw||o.state,{props:o.props,refs:o.refs,computed:o.computed,$:typeof window!="undefined"?window.$:void 0}]);else try{i[u]=JSON.parse(l.value)}catch{i[u]=l.value}return}try{i[l.name]=JSON.parse(l.value)}catch{i[l.name]=l.value}}});const c=new De(r,t,i);z.set(r,c),c._render()})}function On(s){const e=typeof s=="string"?document.querySelector(s):s;return z.get(e)||null}function Nn(s){const e=typeof s=="string"?document.querySelector(s):s,t=z.get(e);t&&t.destroy()}function Pn(){return Object.fromEntries(re)}async function xt(s){const e=re.get(s);e&&(e.templateUrl&&!e._templateLoaded||e.styleUrl&&!e._styleLoaded)&&await De.prototype._loadExternals.call({_def:e})}const oe=new Map;function Bn(s,e={}){const t=Tt(),n=Array.isArray(s)?s:[s],r=[],i=[];let o=null;e.critical!==!1&&(o=document.createElement("style"),o.setAttribute("data-zq-critical",""),o.textContent=`html{visibility:hidden!important;background:${e.bg||"#0d1117"}}`,document.head.insertBefore(o,document.head.firstChild));for(let c of n){if(typeof c=="string"&&!c.startsWith("/")&&!c.includes(":")&&!c.startsWith("//")&&(c=J(c,t)),oe.has(c)){r.push(oe.get(c));continue}const l=document.createElement("link");l.rel="stylesheet",l.href=c,l.setAttribute("data-zq-style","");const u=new Promise(d=>{l.onload=d,l.onerror=d});i.push(u),document.head.appendChild(l),oe.set(c,l),r.push(l)}return{ready:Promise.all(i).then(()=>{o&&o.remove()}),remove(){for(const c of r){c.remove();for(const[l,u]of oe)if(u===c){oe.delete(l);break}}}}}const j="__zq";function Lt(s,e){if(s===e)return!0;if(!s||!e)return!1;const t=Object.keys(s),n=Object.keys(e);if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++){const i=t[r];if(s[i]!==e[i])return!1}return!0}class Un{constructor(e={}){this._el=null;const t=typeof location!="undefined"&&location.protocol==="file:";this._mode=t?"hash":e.mode||"history",this._keepAliveCache=new Map,this._keepAliveMax=typeof e.keepAliveMax=="number"&&e.keepAliveMax>0?e.keepAliveMax:null;let n=e.base;if(n==null&&(n=typeof window!="undefined"&&window.__ZQ_BASE||"",!n&&typeof document!="undefined")){const r=document.querySelector("base");if(r){try{n=new URL(r.href).pathname}catch{n=r.getAttribute("href")||""}n==="/"&&(n="")}}if(this._base=String(n).replace(/\/+$/,""),this._base&&!this._base.startsWith("/")&&(this._base="/"+this._base),this._routes=[],this._fallback=e.fallback||null,this._current=null,this._guards={before:[],after:[]},this._listeners=new Set,this._instance=null,this._resolving=!1,this._substateListeners=[],this._inSubstate=!1,e.el)this._el=typeof e.el=="string"?document.querySelector(e.el):e.el;else if(typeof document!="undefined"){const r=document.querySelector("z-outlet");if(r){if(this._el=r,!e.fallback&&r.getAttribute("fallback")&&(this._fallback=r.getAttribute("fallback")),!e.mode&&r.getAttribute("mode")){const i=r.getAttribute("mode");(i==="hash"||i==="history")&&(this._mode=t?"hash":i)}if(e.base==null&&r.getAttribute("base")){let i=r.getAttribute("base");i=String(i).replace(/\/+$/,""),i&&!i.startsWith("/")&&(i="/"+i),this._base=i}}}e.routes&&e.routes.forEach(r=>this.add(r)),this._mode==="hash"?(this._onNavEvent=()=>this._resolve(),window.addEventListener("hashchange",this._onNavEvent),this._onPopState=r=>{const i=r.state;if(i&&i[j]==="substate"){if(this._fireSubstate(i.key,i.data,"pop"))return;this._resolve().then(()=>{this._fireSubstate(i.key,i.data,"pop")});return}else this._inSubstate&&(this._inSubstate=!1,this._fireSubstate(null,null,"reset"))},window.addEventListener("popstate",this._onPopState)):(this._onNavEvent=r=>{const i=r.state;if(i&&i[j]==="substate"){if(this._fireSubstate(i.key,i.data,"pop"))return;this._resolve().then(()=>{this._fireSubstate(i.key,i.data,"pop")});return}else this._inSubstate&&(this._inSubstate=!1,this._fireSubstate(null,null,"reset"));this._resolve()},window.addEventListener("popstate",this._onNavEvent)),this._onLinkClick=r=>{if(r.metaKey||r.ctrlKey||r.shiftKey||r.altKey)return;const i=r.target.closest("[z-link]");if(!i||i.getAttribute("target")==="_blank")return;r.preventDefault();let o=i.getAttribute("z-link");if(o&&/^[a-z][a-z0-9+.-]*:/i.test(o))return;const a=i.getAttribute("z-link-params");if(a)try{const c=JSON.parse(a);typeof c!="object"||c===null||Array.isArray(c)?A(v.ROUTER_RESOLVE,"z-link-params must be a JSON object",{href:o,paramsAttr:a}):o=this._interpolateParams(o,c)}catch(c){A(v.ROUTER_RESOLVE,"Malformed JSON in z-link-params",{href:o,paramsAttr:a},c)}if(this.navigate(o),i.hasAttribute("z-to-top")){const c=i.getAttribute("z-to-top")||"instant";window.scrollTo({top:0,behavior:c})}},document.addEventListener("click",this._onLinkClick),this._el&&queueMicrotask(()=>this._resolve())}add(e){const{regex:t,keys:n}=we(e.path);if(this._routes.push({...e,_regex:t,_keys:n}),e.fallback){const r=we(e.fallback);this._routes.push({...e,path:e.fallback,_regex:r.regex,_keys:r.keys})}return this}remove(e){return this._routes=this._routes.filter(t=>t.path!==e),this}_interpolateParams(e,t){return!t||typeof t!="object"?e:e.replace(/:([\w]+)/g,(n,r)=>{const i=t[r];return i!=null?encodeURIComponent(String(i)):":"+r})}_currentURL(){if(this._mode==="hash")return window.location.hash.slice(1)||"/";const e=window.location.pathname||"/",t=window.location.hash||"";return e+t}navigate(e,t={}){t.params&&(e=this._interpolateParams(e,t.params));const[n,r]=(e||"").split("#");let i=this._normalizePath(n);const o=r?"#"+r:"";if(this._mode==="hash"){r&&(window.__zqScrollTarget=r);const a="#"+i;if(window.location.hash===a&&!t.force)return this;window.location.hash=a}else{const a=this._base+i+o,c=(window.location.pathname||"/")+(window.location.hash||"");if(a===c&&!t.force){if(r){const d=document.getElementById(r);d&&d.scrollIntoView({behavior:"smooth",block:"start"})}return this}const l=this._base+i,u=window.location.pathname||"/";if(l===u&&o&&!t.force){if(window.history.replaceState({...t.state,[j]:"route"},"",a),r){const d=document.getElementById(r);d&&d.scrollIntoView({behavior:"smooth",block:"start"})}return this}window.history.pushState({...t.state,[j]:"route"},"",a),this._resolve()}return this}replace(e,t={}){t.params&&(e=this._interpolateParams(e,t.params));const[n,r]=(e||"").split("#");let i=this._normalizePath(n);const o=r?"#"+r:"";return this._mode==="hash"?(r&&(window.__zqScrollTarget=r),window.location.replace("#"+i)):(window.history.replaceState({...t.state,[j]:"route"},"",this._base+i+o),this._resolve()),this}_normalizePath(e){let t=e&&e.startsWith("/")?e:e?`/${e}`:"/";if(this._base){if(t===this._base)return"/";t.startsWith(this._base+"/")&&(t=t.slice(this._base.length)||"/")}return t}resolve(e){const t=e&&e.startsWith("/")?e:e?`/${e}`:"/";return this._base+t}back(){return window.history.back(),this}forward(){return window.history.forward(),this}go(e){return window.history.go(e),this}beforeEach(e){return this._guards.before.push(e),this}afterEach(e){return this._guards.after.push(e),this}onChange(e){return this._listeners.add(e),()=>this._listeners.delete(e)}pushSubstate(e,t){return this._inSubstate=!0,this._mode==="hash"?window.history.pushState({[j]:"substate",key:e,data:t},"",window.location.href):window.history.pushState({[j]:"substate",key:e,data:t},"",window.location.href),this}onSubstate(e){return this._substateListeners.push(e),()=>{this._substateListeners=this._substateListeners.filter(t=>t!==e)}}_fireSubstate(e,t,n){for(const r of this._substateListeners)try{if(r(e,t,n)===!0)return!0}catch(i){A(v.ROUTER_GUARD,"onSubstate listener threw",{key:e,data:t},i)}return!1}get current(){return this._current}get base(){return this._base}get path(){if(this._mode==="hash"){const t=window.location.hash.slice(1)||"/";if(t&&!t.startsWith("/")){window.__zqScrollTarget=t;const n=this._current&&this._current.path||"/";return window.location.replace("#"+n),n}return t}let e=window.location.pathname||"/";if(e.length>1&&e.endsWith("/")&&(e=e.slice(0,-1)),this._base){if(e===this._base)return"/";if(e.startsWith(this._base+"/"))return e.slice(this._base.length)||"/"}return e}get query(){const e=this._mode==="hash"?window.location.hash.split("?")[1]||"":window.location.search.slice(1);return Object.fromEntries(new URLSearchParams(e))}async _resolve(){if(!this._resolving){this._resolving=!0,this._redirectCount=0;try{await this.__resolve()}finally{this._resolving=!1}}}async __resolve(){const e=window.history.state;if(e&&e[j]==="substate"&&this._fireSubstate(e.key,e.data,"resolve"))return;const t=this.path,[n,r]=t.split("?"),i=n||"/",o=Object.fromEntries(new URLSearchParams(r||""));let a=null,c={};for(const d of this._routes){const p=i.match(d._regex);if(p){a=d,d._keys.forEach((f,_)=>{c[f]=p[_+1]});break}}if(!a&&this._fallback&&(a={component:this._fallback,path:"*",_keys:[],_regex:/.*/}),!a)return;const l={route:a,params:c,query:o,path:i},u=this._current;if(u&&this._instance&&a.component===u.route.component){const d=Lt(c,u.params),p=Lt(o,u.query);if(d&&p)return}for(const d of this._guards.before)try{const p=await d(l,u);if(p===!1)return;if(typeof p=="string"){if(++this._redirectCount>10){A(v.ROUTER_GUARD,"Too many guard redirects (possible loop)",{to:l},null);return}const[f,_]=p.split("#"),w=this._normalizePath(f||"/"),m=_?"#"+_:"";return this._mode==="hash"?(_&&(window.__zqScrollTarget=_),window.location.replace("#"+w)):window.history.replaceState({[j]:"route"},"",this._base+w+m),this.__resolve()}}catch(p){A(v.ROUTER_GUARD,"Before-guard threw",{to:l,from:u},p);return}if(a.load)try{await a.load()}catch(d){A(v.ROUTER_LOAD,`Failed to load module for route "${a.path}"`,{path:a.path},d);return}if(this._current=l,this._el&&a.component){typeof a.component=="string"&&await xt(a.component);const d=!!a.keepAlive,p=typeof a.component=="string"?a.component:null;if(this._instance&&this._currentKeepAlive&&this._currentComponentName){const w=this._keepAliveCache.get(this._currentComponentName);if(w&&(w.container.style.display="none",w.instance._def.deactivated))try{w.instance._def.deactivated.call(w.instance)}catch(m){A(v.COMP_LIFECYCLE,`Component "${this._currentComponentName}" deactivated() threw`,{component:this._currentComponentName},m)}this._instance=null}else this._instance&&(this._instance.destroy(),this._instance=null);const f=typeof window!="undefined"&&window.__zqRenderHook?performance.now():0,_={...c,$route:l,$query:o,$params:c};if(d&&p&&this._keepAliveCache.has(p)){const w=this._keepAliveCache.get(p);if(this._keepAliveCache.delete(p),this._keepAliveCache.set(p,w),[...this._el.children].forEach(m=>{m.style.display="none"}),w.container.style.display="",this._instance=w.instance,this._currentKeepAlive=!0,this._currentComponentName=p,w.instance._def.activated)try{w.instance._def.activated.call(w.instance)}catch(m){A(v.COMP_LIFECYCLE,`Component "${p}" activated() threw`,{component:p},m)}f&&window.__zqRenderHook(this._el,performance.now()-f,"route",p)}else if(p){[...this._el.children].forEach(m=>{m.dataset.zqKeepAlive&&(m.style.display="none")}),[...this._el.children].forEach(m=>{m.dataset.zqKeepAlive||m.remove()});const w=document.createElement(p);d&&(w.dataset.zqKeepAlive=p),this._el.appendChild(w);try{this._instance=Rt(w,p,_)}catch(m){A(v.COMP_NOT_FOUND,`Failed to mount component for route "${a.path}"`,{component:a.component,path:a.path},m);return}if(d&&(this._keepAliveCache.set(p,{container:w,instance:this._instance}),this._evictKeepAliveLRU(),this._instance._def.activated))try{this._instance._def.activated.call(this._instance)}catch(m){A(v.COMP_LIFECYCLE,`Component "${p}" activated() threw`,{component:p},m)}this._currentKeepAlive=d,this._currentComponentName=p,f&&window.__zqRenderHook(this._el,performance.now()-f,"route",p)}else if(typeof a.component=="function"){[...this._el.children].forEach(m=>{m.dataset.zqKeepAlive?m.style.display="none":m.remove()});const w=document.createElement("div");for(w.innerHTML=a.component(l);w.firstChild;)this._el.appendChild(w.firstChild);this._currentKeepAlive=!1,this._currentComponentName=null,f&&window.__zqRenderHook(this._el,performance.now()-f,"route",l)}}this._updateActiveRoutes(i);for(const d of this._guards.after)await d(l,u);this._listeners.forEach(d=>d(l,u))}_updateActiveRoutes(e){if(typeof document=="undefined")return;const t=document.querySelectorAll("[z-active-route]");for(let n=0;n<t.length;n++){const r=t[n],i=r.getAttribute("z-active-route"),o=r.getAttribute("z-active-class")||"active",c=r.hasAttribute("z-active-exact")?e===i:i==="/"?e==="/":e.startsWith(i);r.classList.toggle(o,c)}}_evictKeepAliveLRU(){if(this._keepAliveMax!=null)for(;this._keepAliveCache.size>this._keepAliveMax;){let e=null;for(const n of this._keepAliveCache.keys())if(n!==this._currentComponentName){e=n;break}if(e==null)break;const t=this._keepAliveCache.get(e);this._keepAliveCache.delete(e);try{t.instance.destroy()}catch{}t.container&&t.container.parentNode&&t.container.remove()}}destroy(){this._onNavEvent&&(window.removeEventListener(this._mode==="hash"?"hashchange":"popstate",this._onNavEvent),this._onNavEvent=null),this._onPopState&&(window.removeEventListener("popstate",this._onPopState),this._onPopState=null),this._onLinkClick&&(document.removeEventListener("click",this._onLinkClick),this._onLinkClick=null);for(const[,e]of this._keepAliveCache)e.instance.destroy();this._keepAliveCache.clear(),this._instance&&this._instance.destroy(),this._listeners.clear(),this._substateListeners=[],this._inSubstate=!1,this._routes=[],this._guards={before:[],after:[]}}}function we(s){const e=[],t=s.replace(/:(\w+)/g,(n,r)=>(e.push(r),"([^/]+)")).replace(/\*/g,"(.*)");return{regex:new RegExp(`^${t}$`),keys:e}}function Mn(s,e,t="not-found"){for(const n of s){const{regex:r,keys:i}=we(n.path),o=e.match(r);if(o){const a={};return i.forEach((c,l)=>{a[c]=o[l+1]}),{component:n.component,params:a}}if(n.fallback){const a=we(n.fallback),c=e.match(a.regex);if(c){const l={};return a.keys.forEach((u,d)=>{l[u]=c[d+1]}),{component:n.component,params:l}}}}return{component:t,params:{}}}let We=null;function In(s){return We=new Un(s),We}function Dn(){return We}class Wn{constructor(e={}){this._subscribers=new Map,this._wildcards=new Set,this._actions=e.actions||{},this._getters=e.getters||{},this._middleware=[],this._history=[],this._maxHistory=e.maxHistory||1e3,this._debug=e.debug||!1,this._batching=!1,this._batchQueue=[],this._undoStack=[],this._redoStack=[],this._maxUndo=e.maxUndo||50;const t=typeof e.state=="function"?e.state():{...e.state||{}};this._initialState=K(t),this.state=Pe(t,(n,r,i)=>{if(this._batching){this._batchQueue.push({key:n,value:r,old:i});return}this._notifySubscribers(n,r,i)}),this.getters={};for(const[n,r]of Object.entries(this._getters))Object.defineProperty(this.getters,n,{get:()=>r(this.state.__raw||this.state),enumerable:!0})}_notifySubscribers(e,t,n){const r=this._subscribers.get(e);r&&r.forEach(i=>{try{i(e,t,n)}catch(o){A(v.STORE_SUBSCRIBE,`Subscriber for "${e}" threw`,{key:e},o)}}),this._wildcards.forEach(i=>{try{i(e,t,n)}catch(o){A(v.STORE_SUBSCRIBE,"Wildcard subscriber threw",{key:e},o)}})}batch(e){this._batching=!0,this._batchQueue=[];let t;try{t=e(this.state)}finally{this._batching=!1;const n=new Map;for(const r of this._batchQueue)n.set(r.key,r);this._batchQueue=[];for(const{key:r,value:i,old:o}of n.values())this._notifySubscribers(r,i,o)}return t}checkpoint(){const e=K(this.state.__raw||this.state);this._undoStack.push(e),this._undoStack.length>this._maxUndo&&this._undoStack.splice(0,this._undoStack.length-this._maxUndo),this._redoStack=[]}undo(){if(this._undoStack.length===0)return!1;const e=K(this.state.__raw||this.state);this._redoStack.push(e);const t=this._undoStack.pop();return this.replaceState(t),!0}redo(){if(this._redoStack.length===0)return!1;const e=K(this.state.__raw||this.state);this._undoStack.push(e);const t=this._redoStack.pop();return this.replaceState(t),!0}get canUndo(){return this._undoStack.length>0}get canRedo(){return this._redoStack.length>0}dispatch(e,...t){const n=this._actions[e];if(!n){A(v.STORE_ACTION,`Unknown action "${e}"`,{action:e,args:t});return}for(const r of this._middleware)try{if(r(e,t,this.state)===!1)return}catch(i){A(v.STORE_MIDDLEWARE,`Middleware threw during "${e}"`,{action:e},i);return}this._debug&&console.log(`%c[Store] ${e}`,"color: #4CAF50; font-weight: bold;",...t);try{const r=n(this.state,...t);return this._history.push({action:e,args:t,timestamp:Date.now()}),this._history.length>this._maxHistory&&this._history.splice(0,this._history.length-this._maxHistory),r}catch(r){A(v.STORE_ACTION,`Action "${e}" threw`,{action:e,args:t},r)}}subscribe(e,t){if(typeof e=="function")return this._wildcards.add(e),()=>this._wildcards.delete(e);if(Array.isArray(e)){const n=e,r=(i,o,a)=>{n.includes(i)&&t(i,o,a)};return this._wildcards.add(r),()=>this._wildcards.delete(r)}return this._subscribers.has(e)||this._subscribers.set(e,new Set),this._subscribers.get(e).add(t),()=>{var n;return(n=this._subscribers.get(e))==null?void 0:n.delete(t)}}snapshot(e){const t=this.state.__raw||this.state;return e&&e.clone===!1?t:K(t)}replaceState(e){const t=this.state.__raw||this.state;for(const n of Object.keys(t))delete this.state[n];Object.assign(this.state,e)}use(e){return this._middleware.push(e),this}get history(){return[...this._history]}reset(e){this.replaceState(e||K(this._initialState)),this._history=[],this._undoStack=[],this._redoStack=[]}}let Ot=new Map;function zn(s,e){typeof s=="object"&&(e=s,s="default");const t=new Wn(e);return Ot.set(s,t),t}function qn(s="default"){return Ot.get(s)||null}function jn(s,e){return{_zqConnector:!0,store:s,keys:e}}const F={baseURL:"",headers:{"Content-Type":"application/json"},timeout:3e4},q={request:[],response:[]};async function Y(s,e,t,n={}){var p;if(!e||typeof e!="string")throw new Error(`HTTP request requires a URL string, got ${typeof e}`);let r=e.startsWith("http")?e:F.baseURL+e,i={...F.headers,...n.headers},o;const a={method:s.toUpperCase(),headers:i,...n};if(t!==void 0&&s!=="GET"&&s!=="HEAD"&&(t instanceof FormData?(o=t,delete a.headers["Content-Type"]):typeof t=="object"?o=JSON.stringify(t):o=t,a.body=o),t&&(s==="GET"||s==="HEAD")&&typeof t=="object"){const f=new URLSearchParams(t).toString();r+=(r.includes("?")?"&":"?")+f}const c=new AbortController,l=(p=n.timeout)!=null?p:F.timeout;let u;n.signal?typeof AbortSignal.any=="function"?a.signal=AbortSignal.any([n.signal,c.signal]):(a.signal=c.signal,n.signal.aborted?c.abort(n.signal.reason):n.signal.addEventListener("abort",()=>c.abort(n.signal.reason),{once:!0})):a.signal=c.signal;let d=!1;l>0&&(u=setTimeout(()=>{d=!0,c.abort()},l));for(const f of q.request){const _=await f(a,r);if(_===!1)throw new Error("Request blocked by interceptor");_!=null&&_.url&&(r=_.url),_!=null&&_.options&&Object.assign(a,_.options)}try{const f=await fetch(r,a);u&&clearTimeout(u);const _=f.headers.get("Content-Type")||"";let w;try{if(_.includes("application/json"))w=await f.json();else if(_.includes("text/"))w=await f.text();else if(_.includes("application/octet-stream")||_.includes("image/"))w=await f.blob();else{const S=await f.text();try{w=JSON.parse(S)}catch{w=S}}}catch(S){w=null,console.warn(`[zQuery HTTP] Failed to parse response body from ${s} ${r}:`,S.message)}const m={ok:f.ok,status:f.status,statusText:f.statusText,headers:Object.fromEntries(f.headers.entries()),data:w,response:f};for(const S of q.response)await S(m);if(!f.ok){const S=new Error(`HTTP ${f.status}: ${f.statusText}`);throw S.response=m,S}return m}catch(f){throw u&&clearTimeout(u),f.name==="AbortError"?d?new Error(`Request timeout after ${l}ms: ${s} ${r}`):new Error(`Request aborted: ${s} ${r}`):f}}const H={get:(s,e,t)=>Y("GET",s,e,t),post:(s,e,t)=>Y("POST",s,e,t),put:(s,e,t)=>Y("PUT",s,e,t),patch:(s,e,t)=>Y("PATCH",s,e,t),delete:(s,e,t)=>Y("DELETE",s,e,t),head:(s,e)=>Y("HEAD",s,void 0,e),configure(s){s.baseURL!==void 0&&(F.baseURL=s.baseURL),s.headers&&Object.assign(F.headers,s.headers),s.timeout!==void 0&&(F.timeout=s.timeout)},getConfig(){return{baseURL:F.baseURL,headers:{...F.headers},timeout:F.timeout}},onRequest(s){return q.request.push(s),()=>{const e=q.request.indexOf(s);e!==-1&&q.request.splice(e,1)}},onResponse(s){return q.response.push(s),()=>{const e=q.response.indexOf(s);e!==-1&&q.response.splice(e,1)}},clearInterceptors(s){(!s||s==="request")&&(q.request.length=0),(!s||s==="response")&&(q.response.length=0)},all(s){return Promise.all(s)},createAbort(){return new AbortController},raw:(s,e)=>fetch(s,e)};function Fn(s,e=250,t={}){let n;const r=t.signal,i=(...o)=>{r&&r.aborted||(clearTimeout(n),n=setTimeout(()=>s(...o),e))};return i.cancel=()=>clearTimeout(n),r&&(r.aborted?i.cancel():r.addEventListener("abort",i.cancel,{once:!0})),i}function Qn(s,e=250,t={}){let n=0,r;const i=t.signal,o=(...a)=>{if(i&&i.aborted)return;const c=Date.now(),l=e-(c-n);clearTimeout(r),l<=0?(n=c,s(...a)):r=setTimeout(()=>{n=Date.now(),s(...a)},l)};return o.cancel=()=>clearTimeout(r),i&&(i.aborted?o.cancel():i.addEventListener("abort",o.cancel,{once:!0})),o}function $n(...s){return e=>s.reduce((t,n)=>n(t),e)}function Zn(s){let e=!1,t;return(...n)=>(e||(e=!0,t=s(...n)),t)}function Hn(s){return new Promise(e=>setTimeout(e,s))}function ge(s){const e={"&":"&","<":"<",">":">",'"':""","'":"'"};return String(s).replace(/[&<>"']/g,t=>e[t])}function Kn(s){return String(s).replace(/<[^>]*>/g,"")}function Gn(s,...e){return s.reduce((t,n,r)=>{const i=e[r-1],o=i instanceof ze?i.toString():ge(i!=null?i:"");return t+o+n})}class ze{constructor(e){this._html=e}toString(){return this._html}}function Vn(s){return new ze(s)}function Jn(){return crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,s=>{const e=new Uint8Array(1);crypto.getRandomValues(e);const t=e[0]&15;return(s==="x"?t:t&3|8).toString(16)})}function Yn(s){return s.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function Xn(s){return s.replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").replace(/([a-z\d])([A-Z])/g,"$1-$2").toLowerCase()}function K(s){if(typeof structuredClone=="function")return structuredClone(s);const e=new Map;function t(n){if(n===null||typeof n!="object")return n;if(e.has(n))return e.get(n);if(n instanceof Date)return new Date(n.getTime());if(n instanceof RegExp)return new RegExp(n.source,n.flags);if(n instanceof Map){const i=new Map;return e.set(n,i),n.forEach((o,a)=>i.set(t(a),t(o))),i}if(n instanceof Set){const i=new Set;return e.set(n,i),n.forEach(o=>i.add(t(o))),i}if(ArrayBuffer.isView(n))return new n.constructor(n.buffer.slice(0));if(n instanceof ArrayBuffer)return n.slice(0);if(Array.isArray(n)){const i=[];e.set(n,i);for(let o=0;o<n.length;o++)i[o]=t(n[o]);return i}const r=Object.create(Object.getPrototypeOf(n));e.set(n,r);for(const i of Object.keys(n))r[i]=t(n[i]);return r}return t(s)}const qe=new Set(["__proto__","constructor","prototype"]);function es(s,...e){const t=new WeakSet;function n(r,i){if(t.has(i))return r;t.add(i);for(const o of Object.keys(i))qe.has(o)||(i[o]&&typeof i[o]=="object"&&!Array.isArray(i[o])?((!r[o]||typeof r[o]!="object")&&(r[o]={}),n(r[o],i[o])):r[o]=i[o]);return r}for(const r of e)n(s,r);return s}function Nt(s,e,t){if(s===e)return!0;if(typeof s!=typeof e||typeof s!="object"||s===null||e===null||Array.isArray(s)!==Array.isArray(e))return!1;if(t||(t=new Set),t.has(s))return!0;t.add(s);const n=Object.keys(s),r=Object.keys(e);return n.length!==r.length?!1:n.every(i=>Nt(s[i],e[i],t))}function ts(s){return new URLSearchParams(s).toString()}function ns(s){return Object.fromEntries(new URLSearchParams(s))}const ss={get(s,e=null){try{const t=localStorage.getItem(s);return t!==null?JSON.parse(t):e}catch{return e}},set(s,e){localStorage.setItem(s,JSON.stringify(e))},remove(s){localStorage.removeItem(s)},clear(){localStorage.clear()}},rs={get(s,e=null){try{const t=sessionStorage.getItem(s);return t!==null?JSON.parse(t):e}catch{return e}},set(s,e){sessionStorage.setItem(s,JSON.stringify(e))},remove(s){sessionStorage.removeItem(s)},clear(){sessionStorage.clear()}};class Pt{constructor(){this._handlers=new Map}on(e,t){return this._handlers.has(e)||this._handlers.set(e,new Set),this._handlers.get(e).add(t),()=>this.off(e,t)}off(e,t){var n;(n=this._handlers.get(e))==null||n.delete(t)}emit(e,...t){var n;(n=this._handlers.get(e))==null||n.forEach(r=>r(...t))}once(e,t){const n=(...r)=>{t(...r),this.off(e,n)};return this.on(e,n)}clear(){this._handlers.clear()}}const is=new Pt;function os(s,e,t){let n,r,i;if(e===void 0?(n=0,r=s,i=1):(n=s,r=e,i=t!==void 0?t:1),i===0)return[];const o=[];if(i>0)for(let a=n;a<r;a+=i)o.push(a);else for(let a=n;a>r;a+=i)o.push(a);return o}function as(s,e){if(!e)return[...new Set(s)];const t=new Set;return s.filter(n=>{const r=e(n);return t.has(r)?!1:(t.add(r),!0)})}function cs(s,e){const t=[];for(let n=0;n<s.length;n+=e)t.push(s.slice(n,n+e));return t}function ls(s,e){var n;if(typeof Object.groupBy=="function")return Object.groupBy(s,e);const t={};for(const r of s){const i=e(r);((n=t[i])!=null?n:t[i]=[]).push(r)}return t}function us(s,e){const t={};for(const n of e)n in s&&(t[n]=s[n]);return t}function fs(s,e){const t=new Set(e),n={};for(const r of Object.keys(s))t.has(r)||(n[r]=s[r]);return n}function hs(s,e,t){const n=e.split(".");let r=s;for(const i of n){if(r==null||typeof r!="object")return t;r=r[i]}return r===void 0?t:r}function ds(s,e,t){const n=e.split(".");let r=s;for(let o=0;o<n.length-1;o++){const a=n[o];if(qe.has(a))return s;(r[a]==null||typeof r[a]!="object")&&(r[a]={}),r=r[a]}const i=n[n.length-1];return qe.has(i)||(r[i]=t),s}function ps(s){return s==null?!0:typeof s=="string"||Array.isArray(s)?s.length===0:s instanceof Map||s instanceof Set?s.size===0:typeof s=="object"?Object.keys(s).length===0:!1}function _s(s){return s?s[0].toUpperCase()+s.slice(1).toLowerCase():""}function ms(s,e,t="…"){if(s.length<=e)return s;const n=Math.max(0,e-t.length);return s.slice(0,n)+t}function ys(s,e,t){return s<e?e:s>t?t:s}function ws(s,e){let t,n=0;typeof e=="function"?t=e:e&&typeof e=="object"&&(n=e.maxSize||0);const r=new Map,i=(...o)=>{const a=t?t(...o):o[0];if(r.has(a)){const l=r.get(a);return r.delete(a),r.set(a,l),l}const c=s(...o);return r.set(a,c),n>0&&r.size>n&&r.delete(r.keys().next().value),c};return i.clear=()=>r.clear(),i}function gs(s,e={}){const{attempts:t=3,delay:n=1e3,backoff:r=1}=e;return new Promise((i,o)=>{let a=0,c=n;const l=()=>{a++,s(a).then(i,u=>{if(a>=t)return o(u);const d=c;c*=r,setTimeout(l,d)})};l()})}function Es(s,e,t){let n;return Promise.race([s,new Promise((i,o)=>{n=setTimeout(()=>o(new Error(t||`Timed out after ${e}ms`)),e)})]).finally(()=>clearTimeout(n))}function h(s,e){if(typeof s=="function"){C.ready(s);return}return C(s,e)}h.id=C.id,h.class=C.class,h.classes=C.classes,h.tag=C.tag,Object.defineProperty(h,"name",{value:C.name,writable:!0,configurable:!0}),h.children=C.children,h.qs=C.qs,h.qsa=C.qsa,h.all=function(s,e){return gn(s,e)},h.create=C.create,h.ready=C.ready,h.on=C.on,h.off=C.off,h.fn=C.fn,h.reactive=Pe,h.Signal=R,h.signal=$,h.computed=fn,h.effect=wt,h.batch=hn,h.untracked=dn,h.component=Ln,h.mount=Rt,h.mountAll=kt,h.getInstance=On,h.destroy=Nn,h.components=Pn,h.prefetch=xt,h.style=Bn,h.morph=Ue,h.morphElement=Et,h.safeEval=V,h.router=In,h.getRouter=Dn,h.matchRoute=Mn,h.store=zn,h.getStore=qn,h.connectStore=jn,h.http=H,h.get=H.get,h.post=H.post,h.put=H.put,h.patch=H.patch,h.delete=H.delete,h.head=H.head,h.debounce=Fn,h.throttle=Qn,h.pipe=$n,h.once=Zn,h.sleep=Hn,h.escapeHtml=ge,h.stripHtml=Kn,h.html=Gn,h.trust=Vn,h.TrustedHTML=ze,h.uuid=Jn,h.camelCase=Yn,h.kebabCase=Xn,h.deepClone=K,h.deepMerge=es,h.isEqual=Nt,h.param=ts,h.parseQuery=ns,h.storage=ss,h.session=rs,h.EventBus=Pt,h.bus=is,h.range=os,h.unique=as,h.chunk=cs,h.groupBy=ls,h.pick=us,h.omit=fs,h.getPath=hs,h.setPath=ds,h.isEmpty=ps,h.capitalize=_s,h.truncate=ms,h.clamp=ys,h.memoize=ws,h.retry=gs,h.timeout=Es,h.onError=Bt,h.ZQueryError=I,h.ErrorCode=v,h.guardCallback=Ut,h.guardAsync=It,h.validate=Mt,h.formatError=Qe,h.webrtc=un,h.SignalingClient=Re,h.Peer=ke,h.Room=G,h.useRoom=Ye,h.usePeer=Xe,h.useTracks=et,h.useDataChannel=tt,h.useConnectionQuality=nt,h.fetchTurnCredentials=xe,h.mergeIceServers=rt,h.createTurnRefresher=it,h.deriveSFrameKey=ct,h.generateSFrameKey=lt,h.SFrameContext=ne,h.encryptFrame=Le,h.decryptFrame=Oe,h.attachE2ee=ut,h.loadSfuAdapter=mt,h.SfuError=k,h.decodeJoinToken=ht,h.isJoinTokenExpired=dt,h.samplePeerStats=Ne,h.createStatsSampler=pt,h.classifyStats=_t,h.parseSdp=Ee,h.validateSdp=Ze,h.parseCandidate=Se,h.stringifyCandidate=He,h.filterCandidates=Ke,h.isPrivateIp=ve,h.isLoopbackIp=Ce,h.isLinkLocalIp=Ae,h.isMdnsHostname=Te,h.WebRtcError=E,h.SignalingError=P,h.IceError=U,h.SdpError=B,h.TurnError=M,h.E2eeError=N,h.version="1.2.8",h.libSize="~130 KB",h.unitTests={"passed":2348,"failed":0,"total":2534,"suites":620,"duration":8039,"ok":true},h.meta={},h.isElectron=typeof navigator!="undefined"&&/Electron/i.test(navigator.userAgent)||typeof process!="undefined"&&process.versions!=null&&!!process.versions.electron,h.platform=h.isElectron?"electron":typeof window!="undefined"?"browser":"node",h.noConflict=()=>(typeof window!="undefined"&&window.$===h&&delete window.$,h),typeof window!="undefined"&&(window.$=h,window.zQuery=h)})(typeof window!="undefined"?window:globalThis);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zero-query",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.8",
|
|
4
4
|
"description": "Lightweight modern frontend library - jQuery-like selectors, reactive components, SPA router, and state management with zero dependencies.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -67,11 +67,11 @@
|
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@eslint/js": "^9.39.4",
|
|
70
|
+
"@zero-server/sdk": "^0.9.8",
|
|
70
71
|
"esbuild": "^0.27.7",
|
|
71
72
|
"eslint": "^9.39.4",
|
|
72
73
|
"globals": "^17.6.0",
|
|
73
74
|
"jsdom": "^28.1.0",
|
|
74
|
-
"vitest": "^4.0.18"
|
|
75
|
-
"zero-http": "^0.3.5"
|
|
75
|
+
"vitest": "^4.0.18"
|
|
76
76
|
}
|
|
77
77
|
}
|
package/tests/dev-server.test.js
CHANGED
|
@@ -120,7 +120,7 @@ describe('SSEPool', () => {
|
|
|
120
120
|
|
|
121
121
|
|
|
122
122
|
// ---------------------------------------------------------------------------
|
|
123
|
-
// createServer tests (requires zero-
|
|
123
|
+
// createServer tests (requires @zero-server/sdk — integration)
|
|
124
124
|
// ---------------------------------------------------------------------------
|
|
125
125
|
|
|
126
126
|
describe('createServer', () => {
|
|
@@ -145,9 +145,9 @@ describe('createServer', () => {
|
|
|
145
145
|
}
|
|
146
146
|
});
|
|
147
147
|
|
|
148
|
-
// Check if zero-
|
|
148
|
+
// Check if @zero-server/sdk is available before running integration tests
|
|
149
149
|
let zeroHttpAvailable = false;
|
|
150
|
-
try { require('zero-
|
|
150
|
+
try { require('@zero-server/sdk'); zeroHttpAvailable = true; } catch {}
|
|
151
151
|
|
|
152
152
|
it('createServer is exported as a function', () => {
|
|
153
153
|
expect(createServerFn).toBeTypeOf('function');
|
|
@@ -180,7 +180,7 @@ describe('createServer', () => {
|
|
|
180
180
|
|
|
181
181
|
it.skipIf(!zeroHttpAvailable)('app has registered routes for SSE and devtools', async () => {
|
|
182
182
|
const { app } = await createServerFn({ root: tmpRoot, htmlEntry: 'index.html', port: 0, noIntercept: true });
|
|
183
|
-
// The app should be a valid zero-
|
|
183
|
+
// The app should be a valid @zero-server/sdk app with the ability to handle routes
|
|
184
184
|
expect(app).toBeDefined();
|
|
185
185
|
expect(app.listen).toBeTypeOf('function');
|
|
186
186
|
});
|
|
@@ -196,7 +196,7 @@ describe('Dev server HTTP integration', () => {
|
|
|
196
196
|
let tmpRoot, server, port;
|
|
197
197
|
|
|
198
198
|
let zeroHttpAvailable = false;
|
|
199
|
-
try { require('zero-
|
|
199
|
+
try { require('@zero-server/sdk'); zeroHttpAvailable = true; } catch {}
|
|
200
200
|
|
|
201
201
|
beforeEach(async () => {
|
|
202
202
|
vi.resetModules();
|
|
@@ -355,7 +355,7 @@ describe('Dev server HTTP integration', () => {
|
|
|
355
355
|
expect(res.status).toBe(200);
|
|
356
356
|
// The response should be compressed — check encoding header
|
|
357
357
|
const enc = res.headers.get('content-encoding');
|
|
358
|
-
// Accept either br, gzip, or deflate depending on what zero-
|
|
358
|
+
// Accept either br, gzip, or deflate depending on what @zero-server/sdk negotiates
|
|
359
359
|
expect(['br', 'gzip', 'deflate']).toContain(enc);
|
|
360
360
|
});
|
|
361
361
|
|
|
@@ -365,7 +365,7 @@ describe('Dev server HTTP integration', () => {
|
|
|
365
365
|
headers: { 'Accept-Encoding': 'gzip, deflate, br' },
|
|
366
366
|
});
|
|
367
367
|
expect(res.status).toBe(200);
|
|
368
|
-
// Compression is applied — exact encoding depends on zero-
|
|
368
|
+
// Compression is applied — exact encoding depends on @zero-server/sdk negotiation
|
|
369
369
|
const text = await res.text();
|
|
370
370
|
expect(text).toContain('margin: 0');
|
|
371
371
|
});
|