zero-query 1.2.2 → 1.2.4
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/README.md +5 -6
- package/cli/commands/create.js +67 -74
- package/cli/scaffold/default/package.json +14 -0
- package/cli/scaffold/minimal/package.json +14 -0
- package/cli/scaffold/ssr/package.json +4 -0
- package/cli/scaffold/webrtc/package.json +1 -1
- package/dist/API.md +1 -1
- package/dist/zquery.dist.zip +0 -0
- package/dist/zquery.js +3 -3
- package/dist/zquery.min.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -44,20 +44,19 @@
|
|
|
44
44
|
The fastest way to develop with zQuery is via the built-in **CLI dev server** with **live-reload**. It serves your ES modules as-is and automatically resolves the library - no manual downloads required.
|
|
45
45
|
|
|
46
46
|
```bash
|
|
47
|
-
|
|
48
|
-
npm install zero-query # or: npm install zero-query -g
|
|
47
|
+
npx zero-query create my-app
|
|
49
48
|
```
|
|
50
49
|
|
|
51
|
-
|
|
50
|
+
That's it. One command scaffolds the project, installs dependencies, starts the dev server, and opens your browser to <http://localhost:3100>. To restart later:
|
|
52
51
|
|
|
53
52
|
```bash
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
cd my-app
|
|
54
|
+
npm run dev # or: npm start
|
|
56
55
|
```
|
|
57
56
|
|
|
58
57
|
> **Tip:** Stay in the project root (where `node_modules` lives) instead of `cd`-ing into `my-app`. This keeps `index.d.ts` accessible to your IDE for full type/intellisense support.
|
|
59
58
|
|
|
60
|
-
The `create` command generates a ready-to-run project with a sidebar layout, router, multiple components (including folder components with external templates and styles), and responsive styles. Use `--minimal` (or `-m`)
|
|
59
|
+
The `create` command generates a ready-to-run project with a sidebar layout, router, multiple components (including folder components with external templates and styles), and responsive styles. Use `--minimal` (or `-m`) for a lightweight 3-page starter. Use `--ssr` (or `-s`) for a Node.js server-side rendering project (auto-launches on port 3000). Use `--webrtc-demo` (or `-w`) for a one-page video room backed by [zero-server](https://github.com/tonywied17/zero-server) (also port 3000). Every variant auto-installs, auto-starts, and opens the browser. The dev server watches for file changes, hot-swaps CSS in-place, full-reloads on other changes, and handles SPA fallback routing.
|
|
61
60
|
|
|
62
61
|
#### Error Overlay
|
|
63
62
|
|
package/cli/commands/create.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// cli/commands/create.js - scaffold a new zQuery project
|
|
2
2
|
//
|
|
3
|
-
// Templates live in cli/scaffold/<variant>/ (default
|
|
3
|
+
// Templates live in cli/scaffold/<variant>/ (default, minimal, ssr, webrtc).
|
|
4
4
|
// Reads template files, replaces {{NAME}} with the project name,
|
|
5
5
|
// and writes them into the target directory.
|
|
6
6
|
|
|
@@ -25,6 +25,28 @@ function walkDir(dir, prefix = '') {
|
|
|
25
25
|
return entries;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
/**
|
|
29
|
+
* Open the given URL in the user's default browser. Best-effort, silent on
|
|
30
|
+
* failure (the server still prints the URL).
|
|
31
|
+
*/
|
|
32
|
+
function openBrowser(url) {
|
|
33
|
+
const cmd = process.platform === 'win32' ? 'start ""'
|
|
34
|
+
: process.platform === 'darwin' ? 'open' : 'xdg-open';
|
|
35
|
+
try { execSync(`${cmd} ${url}`, { stdio: 'ignore' }); } catch { /* ignore */ }
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Spawn a long-running child process, wire SIGINT/SIGTERM to terminate it,
|
|
40
|
+
* and exit when it does. Used by every scaffold variant to launch the dev /
|
|
41
|
+
* SSR / signaling server right after install.
|
|
42
|
+
*/
|
|
43
|
+
function runAndExit(cmd, cmdArgs, cwd) {
|
|
44
|
+
const child = spawn(cmd, cmdArgs, { cwd, stdio: 'inherit', shell: process.platform === 'win32' });
|
|
45
|
+
process.on('SIGINT', () => { child.kill(); process.exit(); });
|
|
46
|
+
process.on('SIGTERM', () => { child.kill(); process.exit(); });
|
|
47
|
+
child.on('exit', (code) => process.exit(code || 0));
|
|
48
|
+
}
|
|
49
|
+
|
|
28
50
|
function createProject(args) {
|
|
29
51
|
// First positional arg after "create" is the target dir (skip flags)
|
|
30
52
|
const dirArg = args.slice(1).find(a => !a.startsWith('-'));
|
|
@@ -38,7 +60,7 @@ function createProject(args) {
|
|
|
38
60
|
: 'default';
|
|
39
61
|
|
|
40
62
|
// Guard: refuse to overwrite existing files
|
|
41
|
-
const checkFiles = ['index.html', 'global.css', 'app', 'assets'];
|
|
63
|
+
const checkFiles = ['index.html', 'global.css', 'app', 'assets', 'package.json'];
|
|
42
64
|
if (variant === 'ssr' || variant === 'webrtc') checkFiles.push('server');
|
|
43
65
|
const conflicts = checkFiles.filter(f =>
|
|
44
66
|
fs.existsSync(path.join(target, f))
|
|
@@ -76,103 +98,74 @@ function createProject(args) {
|
|
|
76
98
|
console.log(` ✓ ${rel}`);
|
|
77
99
|
}
|
|
78
100
|
|
|
79
|
-
const devCmd = `npx zquery dev${target !== process.cwd() ? ` ${dirArg}` : ''}`;
|
|
80
|
-
|
|
81
101
|
// Copy zquery.min.js from the package's pre-built dist into the project root
|
|
82
102
|
// so file:// previews and the dev/SSR servers all serve the same minified
|
|
83
103
|
// bundle that ships with the installed zero-query package. The dev server
|
|
84
104
|
// also intercepts requests for "zquery.min.js" and will fall back to the
|
|
85
105
|
// package copy if the file is missing, so this is a convenience for direct
|
|
86
106
|
// file access (Open in Browser, etc.).
|
|
107
|
+
const zqRoot = path.resolve(__dirname, '..', '..');
|
|
87
108
|
{
|
|
88
|
-
const
|
|
89
|
-
const zqMin = path.join(zqRoot, 'dist', 'zquery.min.js');
|
|
109
|
+
const zqMin = path.join(zqRoot, 'dist', 'zquery.min.js');
|
|
90
110
|
if (fs.existsSync(zqMin)) {
|
|
91
111
|
fs.copyFileSync(zqMin, path.join(target, 'zquery.min.js'));
|
|
92
112
|
console.log(` ✓ zquery.min.js`);
|
|
93
113
|
}
|
|
94
114
|
}
|
|
95
115
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
// (works both in local dev and when installed from npm)
|
|
100
|
-
const zqRoot = path.resolve(__dirname, '..', '..');
|
|
101
|
-
try {
|
|
102
|
-
execSync(`npm install "${zqRoot}"`, { cwd: target, stdio: 'inherit' });
|
|
103
|
-
} catch {
|
|
104
|
-
console.error(`\n ✗ npm install failed. Run it manually:\n\n cd ${dirArg || '.'}\n npm install\n node server/index.js\n`);
|
|
105
|
-
process.exit(1);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// Copy zquery.min.js into the project root so the SSR server can serve it
|
|
109
|
-
const zqMin = path.join(target, 'node_modules', 'zero-query', 'dist', 'zquery.min.js');
|
|
110
|
-
if (fs.existsSync(zqMin)) {
|
|
111
|
-
fs.copyFileSync(zqMin, path.join(target, 'zquery.min.js'));
|
|
112
|
-
console.log(` ✓ zquery.min.js`);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
console.log(`\n Starting SSR server...\n`);
|
|
116
|
-
const child = spawn('node', ['server/index.js'], { cwd: target, stdio: 'inherit' });
|
|
117
|
-
|
|
118
|
-
setTimeout(() => {
|
|
119
|
-
const open = process.platform === 'win32' ? 'start'
|
|
120
|
-
: process.platform === 'darwin' ? 'open' : 'xdg-open';
|
|
121
|
-
try { execSync(`${open} http://localhost:3000`, { stdio: 'ignore' }); } catch {}
|
|
122
|
-
}, 500);
|
|
123
|
-
|
|
124
|
-
process.on('SIGINT', () => { child.kill(); process.exit(); });
|
|
125
|
-
process.on('SIGTERM', () => { child.kill(); process.exit(); });
|
|
126
|
-
child.on('exit', (code) => process.exit(code || 0));
|
|
127
|
-
return; // keep process alive for the server
|
|
128
|
-
} else if (variant === 'webrtc') {
|
|
129
|
-
console.log(`\n Installing dependencies...\n`);
|
|
116
|
+
// ---- Install dependencies (all variants ship a package.json) ----
|
|
117
|
+
console.log(`\n Installing dependencies...\n`);
|
|
118
|
+
try {
|
|
130
119
|
// Install zero-query from the same package that provides this CLI so
|
|
131
|
-
// local-dev and published-npm both work.
|
|
132
|
-
//
|
|
133
|
-
//
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
console.error(`\n ✗ npm install failed. Run it manually:\n\n cd ${dirArg || '.'}\n npm install\n node server/index.js\n`);
|
|
141
|
-
process.exit(1);
|
|
142
|
-
}
|
|
120
|
+
// local-dev and published-npm both work. Any extra devDependencies in
|
|
121
|
+
// the scaffold's package.json (e.g. @zero-server/* for webrtc) come in
|
|
122
|
+
// on the follow-up plain `npm install`.
|
|
123
|
+
execSync(`npm install "${zqRoot}"`, { cwd: target, stdio: 'inherit' });
|
|
124
|
+
execSync(`npm install`, { cwd: target, stdio: 'inherit' });
|
|
125
|
+
} catch {
|
|
126
|
+
console.error(`\n ✗ npm install failed. Run it manually:\n\n cd ${dirArg || '.'}\n npm install\n npm start\n`);
|
|
127
|
+
process.exit(1);
|
|
128
|
+
}
|
|
143
129
|
|
|
144
|
-
|
|
145
|
-
|
|
130
|
+
// Refresh zquery.min.js from the freshly installed package (preferred
|
|
131
|
+
// over the pre-copied one above so post-install rebuilds win).
|
|
132
|
+
{
|
|
146
133
|
const zqMin = path.join(target, 'node_modules', 'zero-query', 'dist', 'zquery.min.js');
|
|
147
134
|
if (fs.existsSync(zqMin)) {
|
|
148
135
|
fs.copyFileSync(zqMin, path.join(target, 'zquery.min.js'));
|
|
149
|
-
console.log(` ✓ zquery.min.js`);
|
|
150
136
|
}
|
|
137
|
+
}
|
|
151
138
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
node server/index.js
|
|
157
|
-
|
|
158
|
-
Then in another terminal serve the static client:
|
|
159
|
-
|
|
160
|
-
${devCmd}
|
|
161
|
-
|
|
162
|
-
Notes:
|
|
163
|
-
- Camera, microphone, and screen-share are OFF by default. Users opt-in
|
|
164
|
-
from inside the room.
|
|
165
|
-
- Set WEBRTC_JWT_SECRET to enforce signed join tokens.
|
|
166
|
-
- Set TURN_SECRET + TURN_URLS to issue time-limited TURN credentials.
|
|
167
|
-
`);
|
|
139
|
+
// ---- Launch the right server for the variant ----
|
|
140
|
+
if (variant === 'ssr') {
|
|
141
|
+
console.log(`\n Starting SSR server on http://localhost:3000 ...\n`);
|
|
142
|
+
setTimeout(() => openBrowser('http://localhost:3000'), 500);
|
|
143
|
+
runAndExit('node', ['server/index.js'], target);
|
|
168
144
|
return;
|
|
169
|
-
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (variant === 'webrtc') {
|
|
170
148
|
console.log(`
|
|
171
|
-
|
|
149
|
+
Camera, microphone, and screen-share are OFF by default - users opt in
|
|
150
|
+
from inside the room. Optional env vars:
|
|
151
|
+
- WEBRTC_JWT_SECRET enforce signed join tokens
|
|
152
|
+
- TURN_SECRET + TURN_URLS issue time-limited TURN credentials
|
|
172
153
|
|
|
173
|
-
|
|
154
|
+
Starting WebRTC signaling + static server on http://localhost:3000 ...
|
|
174
155
|
`);
|
|
156
|
+
setTimeout(() => openBrowser('http://localhost:3000'), 500);
|
|
157
|
+
runAndExit('node', ['server/index.js'], target);
|
|
158
|
+
return;
|
|
175
159
|
}
|
|
160
|
+
|
|
161
|
+
// default / minimal: invoke the local zquery CLI's dev command. We point
|
|
162
|
+
// it at this same package's CLI entry so it works regardless of whether
|
|
163
|
+
// node_modules/.bin/zquery resolved a shim correctly (Windows .cmd quirks
|
|
164
|
+
// and all).
|
|
165
|
+
console.log(`\n Starting dev server on http://localhost:3100 ...\n`);
|
|
166
|
+
setTimeout(() => openBrowser('http://localhost:3100'), 800);
|
|
167
|
+
const cliEntry = path.resolve(__dirname, '..', 'index.js');
|
|
168
|
+
runAndExit('node', [cliEntry, 'dev', target], target);
|
|
176
169
|
}
|
|
177
170
|
|
|
178
171
|
module.exports = createProject;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{NAME}}",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"start": "npx zquery dev",
|
|
7
|
+
"dev": "npx zquery dev",
|
|
8
|
+
"build": "npx zquery build",
|
|
9
|
+
"bundle": "npx zquery bundle"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"zero-query": "latest"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{NAME}}",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"start": "npx zquery dev",
|
|
7
|
+
"dev": "npx zquery dev",
|
|
8
|
+
"build": "npx zquery build",
|
|
9
|
+
"bundle": "npx zquery bundle"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"zero-query": "latest"
|
|
13
|
+
}
|
|
14
|
+
}
|
package/dist/API.md
CHANGED
|
@@ -6555,7 +6555,7 @@ The WebRTC surface is layered — pick the level you need:
|
|
|
6555
6555
|
| **Hardening** | `SFrameContext`, `attachE2ee`, TURN refresher | You need E2EE and rotating TURN credentials. |
|
|
6556
6556
|
|
|
6557
6557
|
|
|
6558
|
-
> **Tip:** Want a working starting point? Run `npx zero-query create my-app --webrtc-demo` (alias `-w`) to scaffold a one-page video room with
|
|
6558
|
+
> **Tip:** Want a working starting point? Run `npx zero-query create my-app --webrtc-demo` (alias `-w`) to scaffold a one-page video room with mic / camera / screen-share toggles, a reactive roster, and a chat data channel. The scaffold installs [zero-server](https://github.com/tonywied17/zero-server), launches the signaling + static server on `http://localhost:3000`, and opens your browser - one command, no extra setup. Camera and microphone stay off until the user opts in.
|
|
6559
6559
|
|
|
6560
6560
|
|
|
6561
6561
|
### Surface Status
|
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.4
|
|
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.4';
|
|
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":8149,"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.4
|
|
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.2",h.libSize="~130 KB",h.unitTests={"passed":2348,"failed":0,"total":2534,"suites":620,"duration":8532,"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.4",h.libSize="~130 KB",h.unitTests={"passed":2348,"failed":0,"total":2534,"suites":620,"duration":8149,"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.4",
|
|
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",
|