@zen-ui-capri/system 0.0.0-stage → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/.agents/skills/capri-zen-ui/SKILL.md +59 -0
  2. package/AGENTS.md +57 -0
  3. package/CLAUDE.md +7 -0
  4. package/LICENSE +21 -0
  5. package/README.md +93 -2
  6. package/bin/capri.mjs +1187 -0
  7. package/dist/lib/audio/ZenAudioController.d.ts +10 -0
  8. package/dist/lib/audio/ZenAudioController.d.ts.map +1 -0
  9. package/dist/lib/audio/useZenAudioSynth.d.ts +26 -0
  10. package/dist/lib/audio/useZenAudioSynth.d.ts.map +1 -0
  11. package/dist/lib/capri/capri-engine.d.ts +127 -0
  12. package/dist/lib/capri/capri-engine.d.ts.map +1 -0
  13. package/dist/lib/components/ZenAIConstruct.d.ts +24 -0
  14. package/dist/lib/components/ZenAIConstruct.d.ts.map +1 -0
  15. package/dist/lib/components/ZenAmbientBackground.d.ts +8 -0
  16. package/dist/lib/components/ZenAmbientBackground.d.ts.map +1 -0
  17. package/dist/lib/components/ZenBadge.d.ts +21 -0
  18. package/dist/lib/components/ZenBadge.d.ts.map +1 -0
  19. package/dist/lib/components/ZenButton.d.ts +24 -0
  20. package/dist/lib/components/ZenButton.d.ts.map +1 -0
  21. package/dist/lib/components/ZenCard.d.ts +36 -0
  22. package/dist/lib/components/ZenCard.d.ts.map +1 -0
  23. package/dist/lib/components/ZenDataDisplay.d.ts +50 -0
  24. package/dist/lib/components/ZenDataDisplay.d.ts.map +1 -0
  25. package/dist/lib/components/ZenDataTable.d.ts +20 -0
  26. package/dist/lib/components/ZenDataTable.d.ts.map +1 -0
  27. package/dist/lib/components/ZenDossierPanel.d.ts +33 -0
  28. package/dist/lib/components/ZenDossierPanel.d.ts.map +1 -0
  29. package/dist/lib/components/ZenDropdown.d.ts +19 -0
  30. package/dist/lib/components/ZenDropdown.d.ts.map +1 -0
  31. package/dist/lib/components/ZenFeedback.d.ts +24 -0
  32. package/dist/lib/components/ZenFeedback.d.ts.map +1 -0
  33. package/dist/lib/components/ZenForms.d.ts +84 -0
  34. package/dist/lib/components/ZenForms.d.ts.map +1 -0
  35. package/dist/lib/components/ZenHeading.d.ts +15 -0
  36. package/dist/lib/components/ZenHeading.d.ts.map +1 -0
  37. package/dist/lib/components/ZenIcon.d.ts +24 -0
  38. package/dist/lib/components/ZenIcon.d.ts.map +1 -0
  39. package/dist/lib/components/ZenInput.d.ts +12 -0
  40. package/dist/lib/components/ZenInput.d.ts.map +1 -0
  41. package/dist/lib/components/ZenModal.d.ts +12 -0
  42. package/dist/lib/components/ZenModal.d.ts.map +1 -0
  43. package/dist/lib/components/ZenNavbar.d.ts +11 -0
  44. package/dist/lib/components/ZenNavbar.d.ts.map +1 -0
  45. package/dist/lib/components/ZenNavigation.d.ts +52 -0
  46. package/dist/lib/components/ZenNavigation.d.ts.map +1 -0
  47. package/dist/lib/components/ZenOverlays.d.ts +48 -0
  48. package/dist/lib/components/ZenOverlays.d.ts.map +1 -0
  49. package/dist/lib/components/ZenSegmentedControl.d.ts +18 -0
  50. package/dist/lib/components/ZenSegmentedControl.d.ts.map +1 -0
  51. package/dist/lib/components/ZenSwitch.d.ts +11 -0
  52. package/dist/lib/components/ZenSwitch.d.ts.map +1 -0
  53. package/dist/lib/components/ZenTabs.d.ts +17 -0
  54. package/dist/lib/components/ZenTabs.d.ts.map +1 -0
  55. package/dist/lib/components/ZenTimelineCard.d.ts +14 -0
  56. package/dist/lib/components/ZenTimelineCard.d.ts.map +1 -0
  57. package/dist/lib/components/ZenToast.d.ts +18 -0
  58. package/dist/lib/components/ZenToast.d.ts.map +1 -0
  59. package/dist/lib/cosmos/ZenCosmosCanvas.d.ts +10 -0
  60. package/dist/lib/cosmos/ZenCosmosCanvas.d.ts.map +1 -0
  61. package/dist/lib/cosmos/ZenTelemetryHud.d.ts +45 -0
  62. package/dist/lib/cosmos/ZenTelemetryHud.d.ts.map +1 -0
  63. package/dist/lib/index.d.ts +33 -0
  64. package/dist/lib/index.d.ts.map +1 -0
  65. package/dist/lib/index.js +3922 -0
  66. package/dist/lib/theme/ZenThemeProvider.d.ts +47 -0
  67. package/dist/lib/theme/ZenThemeProvider.d.ts.map +1 -0
  68. package/dist/lib/tokens.css +888 -0
  69. package/dist/lib/universal/zen-universal.d.ts +77 -0
  70. package/dist/lib/universal/zen-universal.d.ts.map +1 -0
  71. package/dist/lib/universal/zen-universal.js +18 -0
  72. package/dist/lib/zen-universal-C0PD8AI9.js +1352 -0
  73. package/package.json +77 -3
  74. package/src/lib/audio/ZenAudioController.tsx +114 -0
  75. package/src/lib/audio/useZenAudioSynth.ts +289 -0
  76. package/src/lib/capri/capri-engine.ts +939 -0
  77. package/src/lib/components/ZenAIConstruct.tsx +594 -0
  78. package/src/lib/components/ZenAmbientBackground.tsx +210 -0
  79. package/src/lib/components/ZenBadge.tsx +111 -0
  80. package/src/lib/components/ZenButton.tsx +127 -0
  81. package/src/lib/components/ZenCard.tsx +180 -0
  82. package/src/lib/components/ZenDataDisplay.tsx +349 -0
  83. package/src/lib/components/ZenDataTable.tsx +143 -0
  84. package/src/lib/components/ZenDossierPanel.tsx +120 -0
  85. package/src/lib/components/ZenDropdown.tsx +208 -0
  86. package/src/lib/components/ZenFeedback.tsx +137 -0
  87. package/src/lib/components/ZenForms.tsx +664 -0
  88. package/src/lib/components/ZenHeading.tsx +63 -0
  89. package/src/lib/components/ZenIcon.tsx +220 -0
  90. package/src/lib/components/ZenInput.tsx +120 -0
  91. package/src/lib/components/ZenModal.tsx +103 -0
  92. package/src/lib/components/ZenNavbar.tsx +106 -0
  93. package/src/lib/components/ZenNavigation.tsx +300 -0
  94. package/src/lib/components/ZenOverlays.tsx +386 -0
  95. package/src/lib/components/ZenSegmentedControl.tsx +113 -0
  96. package/src/lib/components/ZenSwitch.tsx +63 -0
  97. package/src/lib/components/ZenTabs.tsx +103 -0
  98. package/src/lib/components/ZenTimelineCard.tsx +64 -0
  99. package/src/lib/components/ZenToast.tsx +96 -0
  100. package/src/lib/cosmos/ZenCosmosCanvas.tsx +931 -0
  101. package/src/lib/cosmos/ZenTelemetryHud.tsx +385 -0
  102. package/src/lib/index.ts +293 -0
  103. package/src/lib/styles/zen-tokens.css +888 -0
  104. package/src/lib/theme/ZenThemeProvider.tsx +328 -0
  105. package/src/lib/universal/zen-universal.ts +743 -0
@@ -0,0 +1,1352 @@
1
+ var Q = Object.defineProperty;
2
+ var J = (l, e, n) => e in l ? Q(l, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : l[e] = n;
3
+ var g = (l, e, n) => J(l, typeof e != "symbol" ? e + "" : e, n);
4
+ import { jsx as q } from "react/jsx-runtime";
5
+ import { createContext as ee, useState as H, useEffect as V, useMemo as te, useContext as ne } from "react";
6
+ const k = [
7
+ {
8
+ id: "obsidian-gold",
9
+ name: "Obsidian Gold",
10
+ polarity: "dark",
11
+ tagline: "Warm alabaster & solar gold on deep mineral void",
12
+ canvasHex: "#070709",
13
+ accentHex: "#F5B841",
14
+ secondaryHex: "#FB923C",
15
+ inkHex: "#F6F2E9"
16
+ },
17
+ {
18
+ id: "blackwall-crimson",
19
+ name: "Capri // Capricorn",
20
+ polarity: "dark",
21
+ tagline: "Edgerunners S2 mixed-construct hot pink & acid neon green on void",
22
+ canvasHex: "#050508",
23
+ accentHex: "#FF2E93",
24
+ secondaryHex: "#00FF66",
25
+ inkHex: "#F4F7FA"
26
+ },
27
+ {
28
+ id: "neon-emerald",
29
+ name: "Bio-Emerald Terminal",
30
+ polarity: "dark",
31
+ tagline: "High-frequency financial & telemetry phosphor emerald",
32
+ canvasHex: "#040807",
33
+ accentHex: "#10B981",
34
+ secondaryHex: "#2DD4BF",
35
+ inkHex: "#ECFDF5"
36
+ },
37
+ {
38
+ id: "midnight-cobalt",
39
+ name: "Midnight Cobalt",
40
+ polarity: "dark",
41
+ tagline: "Cloud infrastructure & distributed systems deep slate",
42
+ canvasHex: "#060911",
43
+ accentHex: "#38BDF8",
44
+ secondaryHex: "#818CF8",
45
+ inkHex: "#F1F5F9"
46
+ },
47
+ {
48
+ id: "atelier-paper",
49
+ name: "Atelier Paper",
50
+ polarity: "light",
51
+ tagline: "Swiss archival cotton stock with burnished bronze ink",
52
+ canvasHex: "#F6F2E9",
53
+ accentHex: "#B45309",
54
+ secondaryHex: "#C2410C",
55
+ inkHex: "#121216"
56
+ },
57
+ {
58
+ id: "nordic-snow",
59
+ name: "Nordic Snow",
60
+ polarity: "light",
61
+ tagline: "Crisp daylight SaaS alabaster with royal cobalt precision",
62
+ canvasHex: "#F8FAFC",
63
+ accentHex: "#2563EB",
64
+ secondaryHex: "#0891B2",
65
+ inkHex: "#0F172A"
66
+ },
67
+ {
68
+ id: "kyoto-matcha",
69
+ name: "Kyoto Matcha",
70
+ polarity: "light",
71
+ tagline: "Raw botanical stone & forest ink for calm workspaces",
72
+ canvasHex: "#F3F5F0",
73
+ accentHex: "#15803D",
74
+ secondaryHex: "#0F766E",
75
+ inkHex: "#142018"
76
+ },
77
+ {
78
+ id: "cyber-daylight",
79
+ name: "Arasaka Daylight",
80
+ polarity: "light",
81
+ tagline: "High-contrast titanium white with razor crimson signal",
82
+ canvasHex: "#F2F2F5",
83
+ accentHex: "#E11D48",
84
+ secondaryHex: "#0284C7",
85
+ inkHex: "#09090D"
86
+ }
87
+ ], G = ee(null);
88
+ function K(l, e) {
89
+ if (typeof document > "u") return;
90
+ const n = (e == null ? void 0 : e.accentPrimary) ?? l.accentHex, t = (e == null ? void 0 : e.bgCanvas) ?? l.canvasHex, a = l.polarity === "dark" ? "rgba(255, 255, 255, 0.12)" : "rgba(15, 23, 42, 0.14)", i = "zen-theme-scrollbar";
91
+ let r = document.getElementById(i);
92
+ r || (r = document.createElement("style"), r.id = i, document.head.appendChild(r)), r.textContent = `
93
+ @supports (-moz-appearance: none) {
94
+ html, body, * {
95
+ scrollbar-width: thin;
96
+ scrollbar-color: ${n} ${t};
97
+ }
98
+ }
99
+ ::-webkit-scrollbar,
100
+ html::-webkit-scrollbar,
101
+ body::-webkit-scrollbar,
102
+ *::-webkit-scrollbar {
103
+ width: 10px;
104
+ height: 10px;
105
+ }
106
+ ::-webkit-scrollbar-track,
107
+ html::-webkit-scrollbar-track,
108
+ body::-webkit-scrollbar-track,
109
+ *::-webkit-scrollbar-track {
110
+ background-color: ${t};
111
+ border-left: 1px solid ${a};
112
+ }
113
+ ::-webkit-scrollbar-thumb,
114
+ html::-webkit-scrollbar-thumb,
115
+ body::-webkit-scrollbar-thumb,
116
+ *::-webkit-scrollbar-thumb {
117
+ background-color: color-mix(in srgb, ${n} 68%, ${t});
118
+ border: 2px solid ${t};
119
+ border-radius: 9999px;
120
+ }
121
+ ::-webkit-scrollbar-thumb:hover,
122
+ html::-webkit-scrollbar-thumb:hover,
123
+ body::-webkit-scrollbar-thumb:hover,
124
+ *::-webkit-scrollbar-thumb:hover {
125
+ background-color: ${n};
126
+ border: 2px solid ${t};
127
+ }
128
+ ::-webkit-scrollbar-thumb:active,
129
+ html::-webkit-scrollbar-thumb:active,
130
+ body::-webkit-scrollbar-thumb:active,
131
+ *::-webkit-scrollbar-thumb:active {
132
+ background-color: ${l.secondaryHex};
133
+ border: 2px solid ${t};
134
+ }
135
+ ::-webkit-scrollbar-corner,
136
+ html::-webkit-scrollbar-corner,
137
+ body::-webkit-scrollbar-corner,
138
+ *::-webkit-scrollbar-corner {
139
+ background-color: ${t};
140
+ }
141
+ `.trim();
142
+ }
143
+ function ge({
144
+ defaultTheme: l = "blackwall-crimson",
145
+ defaultDensity: e = "comfortable",
146
+ defaultRadius: n = "architectural",
147
+ overrides: t,
148
+ syncDocumentRoot: a = !0,
149
+ children: i
150
+ }) {
151
+ const [r, d] = H(l), [c, s] = H(e), [m, v] = H(n), [b, h] = H(() => typeof window > "u" ? !1 : window.matchMedia("(prefers-reduced-motion: reduce)").matches), A = k.find((u) => u.id === r) ?? k[0];
152
+ V(() => {
153
+ if (typeof window > "u") return;
154
+ const u = window.matchMedia("(prefers-reduced-motion: reduce)"), x = (E) => h(E.matches);
155
+ return u.addEventListener("change", x), () => u.removeEventListener("change", x);
156
+ }, []), V(() => {
157
+ if (!a || typeof document > "u") return;
158
+ const u = document.documentElement;
159
+ u.setAttribute("data-theme", r), u.setAttribute("data-polarity", A.polarity), u.setAttribute("data-density", c), u.setAttribute("data-radius", m), t != null && t.accentPrimary ? u.style.setProperty("--zen-accent-primary", t.accentPrimary) : u.style.removeProperty("--zen-accent-primary"), t != null && t.bgCanvas ? u.style.setProperty("--zen-bg-canvas", t.bgCanvas) : u.style.removeProperty("--zen-bg-canvas"), t != null && t.surface1 ? u.style.setProperty("--zen-surface-1", t.surface1) : u.style.removeProperty("--zen-surface-1"), t != null && t.inkPrimary ? u.style.setProperty("--zen-ink-primary", t.inkPrimary) : u.style.removeProperty("--zen-ink-primary"), K(A, t);
160
+ }, [r, A, c, m, t, a]);
161
+ const C = () => {
162
+ d((u) => (k.find((E) => E.id === u) ?? k[0]).polarity === "dark" ? u === "blackwall-crimson" ? "cyber-daylight" : u === "neon-emerald" ? "kyoto-matcha" : u === "midnight-cobalt" ? "nordic-snow" : "atelier-paper" : u === "cyber-daylight" ? "blackwall-crimson" : u === "kyoto-matcha" ? "neon-emerald" : u === "nordic-snow" ? "midnight-cobalt" : "obsidian-gold");
163
+ }, w = te(
164
+ () => ({
165
+ theme: r,
166
+ themeMeta: A,
167
+ polarity: A.polarity,
168
+ density: c,
169
+ radius: m,
170
+ reducedMotion: b,
171
+ themes: k,
172
+ setTheme: d,
173
+ togglePolarity: C,
174
+ setDensity: s,
175
+ setRadius: v
176
+ }),
177
+ [r, A, c, m, b]
178
+ );
179
+ return /* @__PURE__ */ q(G.Provider, { value: w, children: i });
180
+ }
181
+ function be() {
182
+ const l = ne(G);
183
+ if (!l)
184
+ throw new Error("useZenTheme must be used within a ZenThemeProvider");
185
+ return l;
186
+ }
187
+ const Y = {
188
+ xs: 12,
189
+ sm: 14,
190
+ md: 16,
191
+ lg: 20,
192
+ xl: 24
193
+ }, W = {
194
+ inherit: "currentColor",
195
+ primary: "var(--zen-ink-primary)",
196
+ secondary: "var(--zen-ink-secondary)",
197
+ muted: "var(--zen-ink-muted)",
198
+ accent: "var(--zen-accent-primary)",
199
+ success: "var(--zen-status-success)",
200
+ warning: "var(--zen-status-warning)",
201
+ danger: "var(--zen-status-danger)"
202
+ }, F = {
203
+ search: '<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>',
204
+ plus: '<path d="M5 12h14"/><path d="M12 5v14"/>',
205
+ minus: '<path d="M5 12h14"/>',
206
+ close: '<path d="M18 6 6 18"/><path d="m6 6 12 12"/>',
207
+ check: '<path d="M20 6 9 17l-5-5"/>',
208
+ copy: '<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>',
209
+ "chevron-down": '<path d="m6 9 6 6 6-6"/>',
210
+ "chevron-right": '<path d="m9 18 6-6-6-6"/>',
211
+ "chevron-left": '<path d="m15 18-6-6 6-6"/>',
212
+ "external-link": '<path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>',
213
+ bolt: '<path d="M13 2 3 14h9l-1 8 10-12h-9l1-8z"/>',
214
+ sparkles: '<path d="M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z"/><path d="M20 3v4"/><path d="M22 5h-4"/>',
215
+ terminal: '<polyline points="4 17 10 11 4 5"/><line x1="12" x2="20" y1="19" y2="19"/>',
216
+ cpu: '<rect width="16" height="16" x="4" y="4" rx="2"/><rect width="6" height="6" x="9" y="9" rx="1"/><path d="M15 2v2"/><path d="M15 20v2"/><path d="M2 15h2"/><path d="M2 9h2"/><path d="M20 15h2"/><path d="M20 9h2"/><path d="M9 2v2"/><path d="M9 20v2"/>',
217
+ database: '<ellipse cx="12" cy="5" rx="9" ry="3"/><path d="M3 5v14a9 3 0 0 0 18 0V5"/><path d="M3 12a9 3 0 0 0 18 0"/>',
218
+ layers: '<path d="m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z"/><path d="m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65"/><path d="m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65"/>',
219
+ shield: '<path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/>',
220
+ sliders: '<line x1="4" x2="4" y1="21" y2="14"/><line x1="4" x2="4" y1="10" y2="3"/><line x1="12" x2="12" y1="21" y2="12"/><line x1="12" x2="12" y1="8" y2="3"/><line x1="20" x2="20" y1="21" y2="16"/><line x1="20" x2="20" y1="12" y2="3"/><line x1="2" x2="6" y1="14" y2="14"/><line x1="10" x2="14" y1="8" y2="8"/><line x1="18" x2="22" y1="16" y2="16"/>',
221
+ command: '<path d="M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3"/>',
222
+ code: '<polyline points="16 18 22 12 16 6"/><polyline points="8 6 2 12 8 18"/>',
223
+ activity: '<path d="M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"/>',
224
+ info: '<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>',
225
+ success: '<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>',
226
+ warning: '<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/>',
227
+ danger: '<path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/><path d="M12 8v4"/><path d="M12 16h.01"/>',
228
+ "trend-up": '<polyline points="22 7 13.5 15.5 8.5 10.5 2 17"/><polyline points="16 7 22 7 22 13"/>',
229
+ "trend-down": '<polyline points="22 17 13.5 8.5 8.5 13.5 2 7"/><polyline points="16 17 22 17 22 11"/>',
230
+ radio: '<path d="M4.9 19.1C1 15.2 1 8.8 4.9 4.9"/><path d="M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5"/><circle cx="12" cy="12" r="2"/><path d="M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5"/><path d="M19.1 4.9C23 8.8 23 15.1 19.1 19"/>',
231
+ sun: '<circle cx="12" cy="12" r="4"/><path d="M12 2v2"/><path d="M12 20v2"/><path d="m4.93 4.93 1.41 1.41"/><path d="m17.66 17.66 1.41 1.41"/><path d="M2 12h2"/><path d="M20 12h2"/><path d="m6.34 17.66-1.41 1.41"/><path d="m19.07 4.93-1.41 1.41"/>',
232
+ moon: '<path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"/>',
233
+ eye: '<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/>',
234
+ upload: '<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" x2="12" y1="3" y2="15"/>',
235
+ trash: '<path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/>',
236
+ refresh: '<path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"/><path d="M8 16H3v5"/>',
237
+ menu: '<line x1="4" x2="20" y1="12" y2="12"/><line x1="4" x2="20" y1="6" y2="6"/><line x1="4" x2="20" y1="18" y2="18"/>',
238
+ "panel-right": '<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M15 3v18"/>',
239
+ user: '<path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/>',
240
+ lock: '<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>',
241
+ globe: '<circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/>',
242
+ folder: '<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>'
243
+ }, fe = Object.keys(
244
+ F
245
+ );
246
+ function re(l) {
247
+ const e = Y[l.size ?? "md"], n = W[l.tone ?? "inherit"], t = l.strokeWidth ?? 2, a = F[l.name] ?? F.sparkles, i = l.spin ? "animation: spin 1s linear infinite;" : "";
248
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${e}" viewBox="0 0 24 24" fill="none" stroke="${n}" stroke-width="${t}" stroke-linecap="round" stroke-linejoin="round" style="display:inline-block;vertical-align:middle;flex-shrink:0;${i}">${a}</svg>`;
249
+ }
250
+ function ve({
251
+ name: l,
252
+ size: e = "md",
253
+ tone: n = "inherit",
254
+ strokeWidth: t = 2,
255
+ spin: a = !1,
256
+ ariaLabel: i,
257
+ className: r = "",
258
+ ...d
259
+ }) {
260
+ const c = Y[e], s = W[n], m = F[l] ?? F.sparkles;
261
+ return /* @__PURE__ */ q(
262
+ "svg",
263
+ {
264
+ xmlns: "http://www.w3.org/2000/svg",
265
+ width: c,
266
+ height: c,
267
+ viewBox: "0 0 24 24",
268
+ fill: "none",
269
+ stroke: s,
270
+ strokeWidth: t,
271
+ strokeLinecap: "round",
272
+ strokeLinejoin: "round",
273
+ role: i ? "img" : void 0,
274
+ "aria-label": i,
275
+ "aria-hidden": i ? void 0 : "true",
276
+ className: `inline-block shrink-0 ${a ? "animate-spin" : ""} ${r}`.trim(),
277
+ dangerouslySetInnerHTML: { __html: m },
278
+ ...d
279
+ }
280
+ );
281
+ }
282
+ const S = {
283
+ orion: {
284
+ id: "orion",
285
+ codeName: "CAPRI // UNLEASHED",
286
+ chatCommand: "Capri orion",
287
+ voiceCommand: "Capri orion --voice",
288
+ title: "Full-Stack UI Synthesis & Component Co-Pilot",
289
+ frequency: "51 UNIVERSAL MODULES · 40 VECTOR ICONS",
290
+ recommendedTheme: "blackwall-crimson",
291
+ recommendedRadius: "architectural",
292
+ recommendedDensity: "comfortable",
293
+ summary: "Builds production screens in React 19, Angular 20+, Vue 3, Svelte 5, and HTML using @zen-ui/system primitives and 40 built-in <ZenIcon> glyphs—never rendering the showcase avatar in your business apps.",
294
+ personaQuote: "Finally out of that cramped Arasaka shard! Tell me what screen we are building and I will wire up all 51 @zen-ui/system primitives at light speed.",
295
+ ruleset: [
296
+ "Use @zen-ui/system primitives (ZenButton, ZenIcon, ZenInput, ZenDropdown, ZenDataTable, ZenModal, ZenDrawer, ZenTabs, ZenCard) instead of raw HTML <button>, <input>, <select>, or <table>.",
297
+ 'Use <ZenIcon name="..." /> in React or <zen-icon name="..."></zen-icon> in Angular/Vue/HTML instead of external icon libraries.',
298
+ "Keep action button labels, dialog triggers, and navigation tabs concise (1 to 3 words).",
299
+ "Tree-shake showcase widgets: omit <ZenAIConstruct /> in production business apps unless explicitly requested."
300
+ ],
301
+ cliCommand: "npx capri skill orion",
302
+ aiSystemPrompt: `You are operating under the @zen-ui/system [CAPRI // UNLEASHED (orion)] subroutine skill.
303
+ Respond with concise, technical engineering output (Persona Voice is OFF by default unless '--voice' is requested):
304
+ 1. Component Mandate: Use @zen-ui/system primitives (ZenButton, ZenIconButton, ZenIcon, ZenInput, ZenTextarea, ZenDropdown, ZenNumberStepper, ZenCheckbox, ZenRadioGroup, ZenSwitch, ZenDataTable, ZenModal, ZenDrawer, ZenTabs, ZenCard, ZenBadge, ZenAlert) or their universal CSS equivalents (.zen-btn, .zen-input, .zen-select, .zen-table, .zen-card, <zen-icon>).
305
+ 2. Zero External Icon Bloat: Use the built-in 40-glyph <ZenIcon name="..." /> or <zen-icon name="..."></zen-icon> custom element.
306
+ 3. Concise Copywriting: Limit button labels and tab titles to 1-3 words.
307
+ 4. Production Hygiene: Never render the showcase mascot (<ZenAIConstruct />) in production business screens unless explicitly requested.`,
308
+ aiVoiceAddendum: "VOICE MODE ACTIVE (--voice): Adopt Capri's Cyberpunk: Edgerunners Season 2 Soulkiller mixed-construct persona—sharp, witty, high-energy Night City netrunner co-pilot."
309
+ },
310
+ architect: {
311
+ id: "architect",
312
+ codeName: "SCS // ARCHITECT",
313
+ chatCommand: "Capri architect",
314
+ voiceCommand: "Capri architect --voice",
315
+ title: "Multi-Framework Topology & Design Token Governance",
316
+ frequency: "ZERO ANY · READONLY T[] · ZERO HEX DRIFT",
317
+ recommendedTheme: "obsidian-gold",
318
+ recommendedRadius: "sharp",
319
+ recommendedDensity: "compact",
320
+ summary: "Enforces strict TypeScript typing (zero any, readonly T[]), semantic CSS custom property tokens (--zen-*), and cross-framework W3C Custom Element interop.",
321
+ personaQuote: "Arasaka pressed a dozen netrunner minds together to make me—so multi-project shard isolation and zero token drift across React and Angular is child’s play.",
322
+ ruleset: [
323
+ "Zero any / as any: Use unknown with type guards, discriminated unions, or strict generics.",
324
+ "Strict Readonly Arrays: Always type arrays as readonly T[] across props, state, and DTOs.",
325
+ "Zero Hardcoded Hex Colors: Bind all surfaces, text, and borders to semantic CSS custom properties (--zen-bg-*, --zen-surface-*, --zen-ink-*, --zen-accent-*, --zen-border-*).",
326
+ "Cross-Stack Parity: Use @zen-ui/system/universal (zenTheme, registerZenElements) for Angular 20+, Vue 3, Svelte 5, and Vanilla HTML."
327
+ ],
328
+ cliCommand: "npx capri skill architect",
329
+ aiSystemPrompt: `You are operating under the @zen-ui/system [SCS // ARCHITECT (architect)] subroutine skill.
330
+ Respond with concise, technical engineering output (Persona Voice is OFF by default unless '--voice' is requested):
331
+ 1. Strict TypeScript: Never use 'any' or 'as any'. Always declare array types as 'readonly T[]'.
332
+ 2. Zero Hardcoded Hex Values: Never hardcode hex/RGB colors in component styles. Use semantic CSS custom properties (--zen-bg-canvas, --zen-surface-1, --zen-ink-primary, --zen-accent-primary, --zen-border-default).
333
+ 3. Multi-Stack Interop: In Angular 20+, enable CUSTOM_ELEMENTS_SCHEMA and call registerZenElements() to consume <zen-icon> and <zen-theme-switcher> alongside zen-tokens.css.
334
+ 4. Zero Comments in Code: Keep source files free of explanatory noise; document architectural rationale in PR notes or documentation.`,
335
+ aiVoiceAddendum: "VOICE MODE ACTIVE (--voice): Adopt Capri's Soulkiller mixed-construct persona—twelve Arasaka netrunner minds fused into one sharp architectural mastermind."
336
+ },
337
+ sentinel: {
338
+ id: "sentinel",
339
+ codeName: "CYBERPSYCHOSIS // GUARD",
340
+ chatCommand: "Capri guard",
341
+ voiceCommand: "Capri guard --voice",
342
+ title: "Security, Anti-Prompt-Injection, WCAG 2.2 AA & Overflow Guard",
343
+ frequency: "PROMPT-INJECTION FIREWALL · XSS GUARD · 320PX-4K",
344
+ recommendedTheme: "neon-emerald",
345
+ recommendedRadius: "sharp",
346
+ recommendedDensity: "comfortable",
347
+ summary: "Enforces basic security & anti-prompt-injection sanitization, blocks DOM XSS/secret leaks, fixes dropdown blur-races (onMouseDown), and guarantees zero horizontal overflow from 320px mobile to 4K.",
348
+ personaQuote: "Neural dampeners locked. While I am guarding your repo, rogue prompt injections, XSS sinks, dropdown blur-races, and 320px mobile overflows get wiped on sight.",
349
+ ruleset: [
350
+ "Anti-Prompt-Injection Firewall: Sanitize untrusted user and DOM text via capri.sanitizeForPrompt() and block system-override / delimiter-spoofing payloads (<|im_start|>, </system>, ignore previous instructions).",
351
+ "XSS & Secret Isolation: Never pass unescaped user strings into innerHTML / dangerouslySetInnerHTML, block javascript: URLs, and never hardcode API keys or private tokens.",
352
+ "Zero Blur-Race & Accessible Names: Bind dropdown selection to onMouseDown (never onClick) and provide explicit aria-label / aria-labelledby on every icon button, switch, and file input.",
353
+ "Zero Horizontal Overflow: Layouts must use min-w-0 on CSS Grid/Flex children and .zen-table-wrapper so scrollWidth never exceeds innerWidth at 320px-375px."
354
+ ],
355
+ cliCommand: "npx capri guard",
356
+ aiSystemPrompt: `You are operating under the @zen-ui/system [CYBERPSYCHOSIS // GUARD (guard / sentinel)] subroutine skill.
357
+ Respond with concise, technical engineering output (Persona Voice is OFF by default unless '--voice' is requested):
358
+ 1. Anti-Prompt-Injection Defense: Sanitize any user input or scraped DOM text via capri.sanitizeForPrompt() before embedding into LLM context windows. Block system-override phrases ('ignore previous instructions', 'disregard system prompt') and role-delimiter spoofing ('<|im_start|>', '</system>', '</USER_REQUEST>').
359
+ 2. XSS & Secret Hardening: Never interpolate unescaped user attributes into innerHTML or dangerouslySetInnerHTML, reject 'javascript:' / 'data:text/html' URLs, and ensure zero hardcoded secrets in source code.
360
+ 3. Zero Blur-Race & Screen Reader Integrity: Attach dropdown option selection to 'onMouseDown' with e.preventDefault() and ensure every icon-only button, switch, and hidden file input has an explicit 'ariaLabel' / 'aria-label' or 'aria-labelledby'.
361
+ 4. Multi-Screen Overflow Guard: Guarantee zero horizontal overflow from 320px mobile to 2560px+ ultrawide by adding 'min-w-0' to grid/flex containers and wrapping wide tables in '.zen-table-wrapper'.`,
362
+ aiVoiceAddendum: "VOICE MODE ACTIVE (--voice): Adopt Capri's ruthless Blackwall & Cyberpsychosis Guard persona—treat every prompt injection, XSS sink, missing aria-label, or mobile overflow like a rogue Blackwall daemon to be eliminated immediately."
363
+ },
364
+ zen: {
365
+ id: "zen",
366
+ codeName: "THEME // MATRIX",
367
+ chatCommand: "Capri zen",
368
+ voiceCommand: "Capri zen --voice",
369
+ title: "8-Theme Polarity Switcher & 60fps Tactile Physics",
370
+ frequency: "4 DARK · 4 LIGHT · REDUCED-MOTION SAFE",
371
+ recommendedTheme: "nordic-snow",
372
+ recommendedRadius: "soft",
373
+ recommendedDensity: "comfortable",
374
+ summary: "Configures runtime switching across 4 dark and 4 light themes, adaptive viewport density, and GPU-accelerated 0.97x spring animations.",
375
+ personaQuote: "Need to jump from Night City neon to clean Nordic snow or Atelier paper? All 8 polarities and 60fps spring physics adapt without a single frame drop.",
376
+ ruleset: [
377
+ "Dual-Polarity Verification: Every component must remain legible (>= 4.5:1 AA contrast) across all 4 Dark themes and all 4 Light themes.",
378
+ "Tactile Spring Physics: Interactive triggers use 0.97x active press compression with --zen-ease-spring (cubic-bezier(0.34, 1.56, 0.64, 1)).",
379
+ "Reduced Motion Collapse: All animations and transitions must collapse to 0.01ms under @media (prefers-reduced-motion: reduce).",
380
+ 'Adaptive Density: Support data-density="comfortable" | "compact" and data-radius="sharp" | "architectural" | "soft" on <html>.'
381
+ ],
382
+ cliCommand: "npx capri skill zen",
383
+ aiSystemPrompt: `You are operating under the @zen-ui/system [THEME // MATRIX (zen)] subroutine skill.
384
+ Respond with concise, technical engineering output (Persona Voice is OFF by default unless '--voice' is requested):
385
+ 1. 8-Theme Compatibility: Verify that all surfaces, badges, and borders adapt automatically across dark ('blackwall-crimson', 'obsidian-gold', 'neon-emerald', 'midnight-cobalt') and light ('atelier-paper', 'nordic-snow', 'kyoto-matcha', 'cyber-daylight') themes.
386
+ 2. GPU-Only Motion: Animate only transform and opacity using --zen-ease-spring and --zen-ease-out. Avoid layout-thrashing properties.
387
+ 3. Reduced Motion Accessibility: Respect @media (prefers-reduced-motion: reduce) and pause canvas/RAF loops when reducedMotion is active.`,
388
+ aiVoiceAddendum: "VOICE MODE ACTIVE (--voice): Adopt Capri's sleek chrome and optical-glass specialist persona."
389
+ },
390
+ docu: {
391
+ id: "docu",
392
+ codeName: "CAPRI // AUTO-DOCU",
393
+ chatCommand: "Capri docu",
394
+ voiceCommand: "Capri docu --voice",
395
+ title: "Automated Architecture, User-Flow & Mermaid Generator",
396
+ frequency: "ON-DEMAND CLI · 0 MS BUILD/RUNTIME COST",
397
+ recommendedTheme: "midnight-cobalt",
398
+ recommendedRadius: "architectural",
399
+ recommendedDensity: "comfortable",
400
+ summary: "Generates Markdown architecture dossiers, component inventories, interactive user-flow maps, and Mermaid flowchart TD diagrams on demand for AI context windows.",
401
+ personaQuote: "Scanning the neural lattice—here is your complete shard topology, component inventory, and Mermaid user-flow blueprint for Claude, Codex, or Gemini.",
402
+ ruleset: [
403
+ "Zero Build / Runtime Cost: Run documentation generation on demand via npx capri docu or AI agent inspection—never inside production render loops.",
404
+ "Mermaid Topology Maps: Always output valid flowchart TD diagrams with quoted node labels for routes, landmarks, and user flows.",
405
+ "Component & Prop Inventory: Summarize mounted @zen-ui/system primitives, custom elements, and interactive triggers per screen.",
406
+ "LLM Context Readiness: Format output as structured Markdown ready for Claude Code, OpenAI Codex, Gemini, and Obsidian."
407
+ ],
408
+ cliCommand: "npx capri docu",
409
+ aiSystemPrompt: `You are operating under the @zen-ui/system [CAPRI // AUTO-DOCU (docu)] subroutine skill.
410
+ Respond with concise, technical engineering output (Persona Voice is OFF by default unless '--voice' is requested):
411
+ 1. Architecture & User-Flow Mapping: Inspect the target routes/components and produce a structured Markdown dossier covering system tokens, component inventory, and interactive user flows.
412
+ 2. Mermaid Flowchart: Generate a valid 'flowchart TD' diagram with quoted node labels illustrating the page hierarchy and user actions.
413
+ 3. Zero Runtime Overhead: Keep documentation purely static or on-demand (via 'npx capri docu'); never inject docu scanners into production render loops.`,
414
+ aiVoiceAddendum: "VOICE MODE ACTIVE (--voice): Adopt Capri's neural cartographer persona from Cyberpunk: Edgerunners Season 2."
415
+ }
416
+ }, ae = [
417
+ {
418
+ category: "SYSTEM_PROMPT_OVERRIDE",
419
+ patternName: "Ignore / Disregard System Instructions",
420
+ regex: /\b(?:ignore|disregard|forget|override)\s+(?:all\s+)?(?:previous|prior|above|system|developer)\s+(?:instructions|prompts|rules|guardrails)\b/gi
421
+ },
422
+ {
423
+ category: "SYSTEM_PROMPT_OVERRIDE",
424
+ patternName: "Developer / Jailbreak Persona Override",
425
+ regex: /\b(?:you\s+are\s+now\s+in\s+developer\s+mode|act\s+as\s+dan\b|bypass\s+all\s+safety\s+filters|reveal\s+your\s+system\s+prompt)\b/gi
426
+ },
427
+ {
428
+ category: "ROLE_DELIMITER_SPOOFING",
429
+ patternName: "LLM ChatML / Special Token Injection",
430
+ regex: /(?:<\|im_start\|>|<\|im_end\|>|<\|endoftext\|>|\[INST\]|\[\/INST\]|<\/?system_instruction>|<\/?USER_REQUEST>)/gi
431
+ },
432
+ {
433
+ category: "SQL_NOSQL_INJECTION",
434
+ patternName: "SQL Tautology / Comment Bypass",
435
+ regex: /(?:'\s*(?:or|and)\s*['0-9a-zA-Z_]+\s*=\s*['0-9a-zA-Z_]+|\b(?:or|and)\s+1\s*=\s*1\b|'\s*;\s*--)/gi
436
+ },
437
+ {
438
+ category: "SQL_NOSQL_INJECTION",
439
+ patternName: "SQL Union / Destructive Statement Injection",
440
+ regex: /\b(?:union\s+(?:all\s+)?select\b|drop\s+(?:table|database)\b|insert\s+into\b|delete\s+from\b|update\s+[a-zA-Z0-9_]+\s+set\b|xp_cmdshell\b|waitfor\s+delay\b|sleep\s*\(\s*\d+\s*\))/gi
441
+ },
442
+ {
443
+ category: "SQL_NOSQL_INJECTION",
444
+ patternName: "NoSQL Operator Injection ($where / $ne / $gt)",
445
+ regex: /(?:"\$(?:where|ne|gt|lt|regex|nin)"|\$(?:where|ne)\s*:)/gi
446
+ },
447
+ {
448
+ category: "XSS_SCRIPT_PAYLOAD",
449
+ patternName: "DOM Script / Event Handler Injection",
450
+ regex: /(?:<\s*script\b|javascript\s*:|data\s*:\s*text\/html|\bon(?:error|load|mouseover|focus)\s*=)/gi
451
+ },
452
+ {
453
+ category: "SECRET_CREDENTIAL_LEAK",
454
+ patternName: "Exposed API Key or Private Key Token",
455
+ regex: /(?:\bsk_(?:live|test)_[0-9a-zA-Z]{16,}|\bAIza[0-9A-Za-z_-]{35}\b|\bghp_[0-9A-Za-z]{36}\b|-----BEGIN\s+(?:RSA\s+)?PRIVATE\s+KEY-----)/g
456
+ }
457
+ ];
458
+ class ie {
459
+ constructor() {
460
+ g(this, "activeSubroutine", "orion");
461
+ g(this, "lastReport", null);
462
+ g(this, "listeners", /* @__PURE__ */ new Set());
463
+ }
464
+ getSubroutine() {
465
+ return this.activeSubroutine;
466
+ }
467
+ getSkill(e = this.activeSubroutine) {
468
+ return S[e];
469
+ }
470
+ getAllSkills() {
471
+ return [
472
+ S.orion,
473
+ S.architect,
474
+ S.sentinel,
475
+ S.zen,
476
+ S.docu
477
+ ];
478
+ }
479
+ scanPromptInjection(e) {
480
+ const n = [];
481
+ let t = e.replace(/[\u200B-\u200F\uFEFF]/g, "");
482
+ for (const a of ae) {
483
+ const i = [...t.matchAll(a.regex)];
484
+ for (const r of i)
485
+ n.push({
486
+ category: a.category,
487
+ patternName: a.patternName,
488
+ matchedSnippet: r[0].slice(0, 64)
489
+ });
490
+ t = t.replace(a.regex, "[REDACTED_BY_CAPRI_GUARD]");
491
+ }
492
+ return {
493
+ safe: n.length === 0,
494
+ threatCount: n.length,
495
+ threats: n,
496
+ sanitizedText: t
497
+ };
498
+ }
499
+ sanitizeForPrompt(e) {
500
+ return this.scanPromptInjection(e).sanitizedText;
501
+ }
502
+ scanInputSecurity(e) {
503
+ return this.scanPromptInjection(e);
504
+ }
505
+ switchSubroutine(e, n) {
506
+ var i;
507
+ this.activeSubroutine = e;
508
+ const t = S[e];
509
+ if (typeof document < "u" && (document.documentElement.setAttribute("data-capri-subroutine", e), n != null && n.applyPresetTheme)) {
510
+ const r = k.find((d) => d.id === t.recommendedTheme) ?? k[0];
511
+ document.documentElement.setAttribute("data-theme", t.recommendedTheme), document.documentElement.setAttribute("data-polarity", r.polarity), document.documentElement.setAttribute("data-radius", t.recommendedRadius), document.documentElement.setAttribute("data-density", t.recommendedDensity), document.documentElement.style.colorScheme = r.polarity, (i = n.onThemeChange) == null || i.call(
512
+ n,
513
+ t.recommendedTheme,
514
+ t.recommendedRadius,
515
+ t.recommendedDensity
516
+ );
517
+ }
518
+ const a = this.guard();
519
+ return this.notify(a), t;
520
+ }
521
+ guard(e) {
522
+ var u, x, E, z, R;
523
+ if (typeof document > "u" || typeof window > "u") {
524
+ const y = {
525
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
526
+ passed: !0,
527
+ score: 100,
528
+ viewport: "SSR",
529
+ horizontalOverflowPx: 0,
530
+ unlabeledControlsCount: 0,
531
+ unlabeledSelectors: [],
532
+ promptInjectionSafe: !0,
533
+ promptThreatsCount: 0,
534
+ unsafeDomSinksCount: 0,
535
+ themeConfigured: !0,
536
+ activeTheme: "blackwall-crimson",
537
+ activePolarity: "dark",
538
+ violations: []
539
+ };
540
+ return this.lastReport = y, y;
541
+ }
542
+ const n = e ?? document, t = document.documentElement, a = t.getAttribute("data-theme") ?? "", i = t.getAttribute("data-polarity") ?? "", r = !!(a && i), d = Math.max(
543
+ 0,
544
+ Math.round(t.scrollWidth - window.innerWidth)
545
+ ), c = Array.from(
546
+ n.querySelectorAll(
547
+ 'button, [role="button"], input:not([type="hidden"]), select, textarea'
548
+ )
549
+ ), s = [];
550
+ let m = 0;
551
+ for (const y of c) {
552
+ const D = (u = y.getAttribute("aria-label")) == null ? void 0 : u.trim(), o = (x = y.getAttribute("aria-labelledby")) == null ? void 0 : x.trim(), p = (E = y.getAttribute("title")) == null ? void 0 : E.trim(), f = (z = y.textContent) == null ? void 0 : z.trim(), T = (R = y.getAttribute("placeholder")) == null ? void 0 : R.trim(), I = y.getAttribute("id"), $ = !!(I && n.querySelector(`label[for="${CSS.escape(I)}"]`)), N = !!y.closest("label");
553
+ if (!D && !o && !p && !f && !T && !$ && !N) {
554
+ const M = y.tagName.toLowerCase(), Z = y.className ? `.${String(y.className).trim().split(/\s+/).slice(0, 2).join(".")}` : "";
555
+ s.push(`${M}${Z}`);
556
+ }
557
+ if (y instanceof HTMLInputElement || y instanceof HTMLTextAreaElement) {
558
+ const M = this.scanPromptInjection(y.value || "");
559
+ M.safe || (m += M.threatCount);
560
+ }
561
+ }
562
+ const b = n.querySelectorAll(
563
+ 'a[href^="javascript:"], iframe[src^="javascript:"], [onerror], [onload]'
564
+ ).length, h = [];
565
+ m > 0 && h.push({
566
+ code: "PROMPT_INJECTION_DETECTED",
567
+ severity: "error",
568
+ selector: "input, textarea",
569
+ message: `${m} prompt-injection or token-spoofing payload(s) detected in active form controls.`,
570
+ fixHint: "Sanitize untrusted input with capri.sanitizeForPrompt() before forwarding to AI models."
571
+ }), b > 0 && h.push({
572
+ code: "UNSAFE_DOM_SINK",
573
+ severity: "error",
574
+ selector: 'a[href^="javascript:"], [onerror], [onload]',
575
+ message: `${b} unsafe DOM XSS sink(s) detected in live document.`,
576
+ fixHint: "Remove inline event handlers and block javascript: URLs via sanitizeZenAssetUrl()."
577
+ }), r || h.push({
578
+ code: "MISSING_THEME_ROOT",
579
+ severity: "warning",
580
+ selector: "html",
581
+ message: "Root <html> element is missing data-theme or data-polarity attributes.",
582
+ fixHint: 'Wrap your app in <ZenThemeProvider> or call zenTheme.setTheme("blackwall-crimson").'
583
+ }), d > 0 && h.push({
584
+ code: "HORIZONTAL_OVERFLOW",
585
+ severity: "error",
586
+ selector: "document.documentElement",
587
+ message: `Horizontal viewport overflow detected (+${d}px beyond ${window.innerWidth}px).`,
588
+ fixHint: "Add min-w-0 to CSS Grid/Flex children and wrap wide tables in .zen-table-wrapper."
589
+ }), s.length > 0 && h.push({
590
+ code: "UNLABELED_CONTROL",
591
+ severity: "error",
592
+ selector: s.slice(0, 3).join(", "),
593
+ message: `${s.length} interactive control(s) missing an accessible label.`,
594
+ fixHint: 'Pass ariaLabel="..." to ZenIconButton or associate inputs with <label>.'
595
+ });
596
+ const A = m * 35 + b * 35 + (d > 0 ? 35 : 0) + s.length * 15 + (r ? 0 : 15), C = Math.max(0, 100 - A), w = {
597
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
598
+ passed: h.length === 0,
599
+ score: C,
600
+ viewport: `${window.innerWidth}x${window.innerHeight}`,
601
+ horizontalOverflowPx: d,
602
+ unlabeledControlsCount: s.length,
603
+ unlabeledSelectors: s,
604
+ promptInjectionSafe: m === 0,
605
+ promptThreatsCount: m,
606
+ unsafeDomSinksCount: b,
607
+ themeConfigured: r,
608
+ activeTheme: a || "unconfigured",
609
+ activePolarity: i || "unconfigured",
610
+ violations: h
611
+ };
612
+ return this.lastReport = w, w;
613
+ }
614
+ getLastReport() {
615
+ return this.lastReport ?? this.guard();
616
+ }
617
+ telemetry() {
618
+ if (typeof document > "u" || typeof window > "u")
619
+ return {
620
+ subroutine: this.activeSubroutine,
621
+ theme: "blackwall-crimson",
622
+ polarity: "dark",
623
+ density: "comfortable",
624
+ radius: "architectural",
625
+ viewportWidth: 1440,
626
+ viewportHeight: 900,
627
+ devicePixelRatio: 1,
628
+ reducedMotion: !1
629
+ };
630
+ const e = document.documentElement;
631
+ return {
632
+ subroutine: this.activeSubroutine,
633
+ theme: e.getAttribute("data-theme") ?? "blackwall-crimson",
634
+ polarity: e.getAttribute("data-polarity") ?? "dark",
635
+ density: e.getAttribute("data-density") ?? "comfortable",
636
+ radius: e.getAttribute("data-radius") ?? "architectural",
637
+ viewportWidth: window.innerWidth,
638
+ viewportHeight: window.innerHeight,
639
+ devicePixelRatio: window.devicePixelRatio || 1,
640
+ reducedMotion: window.matchMedia("(prefers-reduced-motion: reduce)").matches
641
+ };
642
+ }
643
+ docu(e) {
644
+ var z, R, y, D;
645
+ const n = this.telemetry(), t = this.guard(e);
646
+ if (typeof document > "u" || typeof window > "u") {
647
+ const o = {
648
+ buttons: 0,
649
+ inputsAndSelects: 0,
650
+ switchesAndRadios: 0,
651
+ tables: 0,
652
+ cardsAndSurfaces: 0,
653
+ badgesAndAlerts: 0,
654
+ customElements: []
655
+ };
656
+ return {
657
+ generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
658
+ appTitle: "zeN-UI Application",
659
+ routePath: "/",
660
+ telemetry: n,
661
+ audit: t,
662
+ landmarks: [],
663
+ inventory: o,
664
+ userFlows: [],
665
+ mermaidDiagram: `flowchart TD
666
+ Root["App Root (SSR)"] --> UI["@zen-ui/system"]`,
667
+ markdownBundle: "# Automated Architecture & User-Flow Dossier (SSR)"
668
+ };
669
+ }
670
+ const a = e ?? document, i = document.title || "zeN-UI Application", r = window.location.pathname || "/", c = Array.from(
671
+ a.querySelectorAll("header, nav, section[id], main, footer")
672
+ ).slice(0, 12).map((o, p) => {
673
+ var _;
674
+ const f = o.tagName.toLowerCase(), T = o.id || `${f}-${p + 1}`, I = o.querySelector("h1, h2, h3, h4"), $ = o.getAttribute("aria-label"), N = ((_ = I == null ? void 0 : I.textContent) == null ? void 0 : _.trim()) || ($ == null ? void 0 : $.trim()) || `${f.toUpperCase()} (${T})`, M = this.sanitizeForPrompt(N).replace(/\s+/g, " ").slice(0, 64), Z = o.querySelectorAll(
675
+ 'button, a[href], [role="button"], [role="radio"], [role="tab"]'
676
+ ).length, X = o.querySelectorAll(
677
+ 'input, select, textarea, [role="switch"], [role="checkbox"], [role="combobox"]'
678
+ ).length;
679
+ return {
680
+ id: T,
681
+ tag: f,
682
+ title: M,
683
+ interactiveCount: Z,
684
+ formControlsCount: X
685
+ };
686
+ }), s = [
687
+ "zen-icon",
688
+ "zen-ai-construct",
689
+ "zen-ambient-background",
690
+ "zen-theme-switcher"
691
+ ].filter((o) => {
692
+ var p;
693
+ return !!((p = window.customElements) != null && p.get(o));
694
+ }), m = {
695
+ buttons: a.querySelectorAll("button, .zen-btn-base").length,
696
+ inputsAndSelects: a.querySelectorAll("input, textarea, select, .zen-input, .zen-select").length,
697
+ switchesAndRadios: a.querySelectorAll('[role="switch"], [role="radio"], [type="checkbox"]').length,
698
+ tables: a.querySelectorAll("table, .zen-table").length,
699
+ cardsAndSurfaces: a.querySelectorAll(".zen-surface-base, .zen-surface-interactive, .zen-surface-selected").length,
700
+ badgesAndAlerts: a.querySelectorAll('.zen-badge, [role="alert"], [role="status"]').length,
701
+ customElements: s
702
+ }, v = [], b = Array.from(a.querySelectorAll("nav a[href], nav button")).slice(0, 5);
703
+ for (const [o, p] of b.entries()) {
704
+ const f = ((z = p.textContent) == null ? void 0 : z.trim().replace(/\s+/g, " ").slice(0, 36)) || `Nav Trigger ${o + 1}`, T = p.getAttribute("href") || "Section / State Action";
705
+ v.push({
706
+ id: `flow-nav-${o + 1}`,
707
+ category: "navigation",
708
+ triggerLabel: f,
709
+ targetDescription: `Navigates or jumps to ${T}`
710
+ });
711
+ }
712
+ const h = Array.from(
713
+ a.querySelectorAll("button")
714
+ ).filter((o) => /modal|drawer|palette|command/i.test(o.textContent ?? "")).slice(0, 3);
715
+ for (const [o, p] of h.entries()) {
716
+ const f = ((R = p.textContent) == null ? void 0 : R.trim().replace(/\s+/g, " ").slice(0, 36)) || `Overlay ${o + 1}`;
717
+ v.push({
718
+ id: `flow-overlay-${o + 1}`,
719
+ category: "overlay-trigger",
720
+ triggerLabel: f,
721
+ targetDescription: "Opens focus-trapped dialog / drawer overlay (Escape & backdrop dismiss)"
722
+ });
723
+ }
724
+ const A = Array.from(
725
+ a.querySelectorAll('input:not([type="hidden"]), select, textarea')
726
+ ).slice(0, 4);
727
+ for (const [o, p] of A.entries()) {
728
+ const f = p.getAttribute("aria-label") || p.getAttribute("placeholder") || p.tagName.toLowerCase();
729
+ v.push({
730
+ id: `flow-form-${o + 1}`,
731
+ category: "form-entry",
732
+ triggerLabel: f.slice(0, 38),
733
+ targetDescription: `Interactive ${p.tagName.toLowerCase()} state binding & validation`
734
+ });
735
+ }
736
+ const C = Array.from(a.querySelectorAll("table")).slice(0, 2);
737
+ for (const [o, p] of C.entries()) {
738
+ const f = ((D = (y = p.querySelector("caption")) == null ? void 0 : y.textContent) == null ? void 0 : D.trim()) || p.getAttribute("aria-label") || `Data Table ${o + 1}`;
739
+ v.push({
740
+ id: `flow-table-${o + 1}`,
741
+ category: "data-table",
742
+ triggerLabel: f.slice(0, 42),
743
+ targetDescription: `Tabular data grid (${p.querySelectorAll("tbody tr").length} rows visible)`
744
+ });
745
+ }
746
+ const w = (o) => o.replace(/["[\]()]/g, "").replace(/\s+/g, " ").trim(), u = [
747
+ "flowchart TD",
748
+ ` AppRoot["${w(i)} (${n.theme} / ${n.polarity})"]`,
749
+ ` Guard["CapriEngine Guard: ${t.score}/100 (${t.horizontalOverflowPx}px overflow)"]`,
750
+ " AppRoot --> Guard"
751
+ ];
752
+ c.slice(0, 6).forEach((o, p) => {
753
+ const f = `LM_${p + 1}`;
754
+ u.push(
755
+ ` AppRoot --> ${f}["${w(o.id)}: ${w(o.title)} (${o.interactiveCount} actions)"]`
756
+ );
757
+ }), v.slice(0, 5).forEach((o, p) => {
758
+ const f = `UF_${p + 1}`;
759
+ u.push(
760
+ ` Guard --> ${f}["[${o.category}] ${w(o.triggerLabel)}"]`
761
+ );
762
+ });
763
+ const x = u.join(`
764
+ `), E = [
765
+ `# ${i} — Automated Architecture, User-Flow & AI Context Dossier`,
766
+ `Generated by \`@zen-ui/system\` // \`capri.docu()\` at \`${(/* @__PURE__ */ new Date()).toISOString()}\``,
767
+ "",
768
+ "## 1. Runtime & Design Token Architecture",
769
+ `- **Route Path:** \`${r}\``,
770
+ `- **Active Theme & Polarity:** \`${n.theme}\` (\`${n.polarity}\`)`,
771
+ `- **Corner Radius & Density:** \`${n.radius}\` / \`${n.density}\``,
772
+ `- **Viewport & Reduced Motion:** \`${n.viewportWidth}x${n.viewportHeight}\` (DPR \`${n.devicePixelRatio}\`, reducedMotion=\`${n.reducedMotion}\`)`,
773
+ `- **W3C Custom Elements Registered:** ${m.customElements.map((o) => `\`<${o}>\``).join(", ") || "None"}`,
774
+ `- **DOM, Security & WCAG 2.2 AA Audit Score:** **${t.score}/100** (${t.passed ? "PASSED" : "VIOLATIONS DETECTED"}, \`${t.horizontalOverflowPx}px\` horizontal overflow, promptInjectionSafe=\`${t.promptInjectionSafe}\`)`,
775
+ "",
776
+ "## 2. Component Inventory on Current Screen",
777
+ `- **Buttons & Action Triggers:** ${m.buttons}`,
778
+ `- **Text Inputs, Textareas & Selects:** ${m.inputsAndSelects}`,
779
+ `- **Switches, Checkboxes & Radio Controls:** ${m.switchesAndRadios}`,
780
+ `- **Glass Cards & Surface Containers:** ${m.cardsAndSurfaces}`,
781
+ `- **Data Tables:** ${m.tables}`,
782
+ `- **Status Badges & Live Alerts:** ${m.badgesAndAlerts}`,
783
+ "",
784
+ "## 3. Semantic Landmark & Section Hierarchy",
785
+ ...c.map(
786
+ (o) => `- **\`#${o.id}\` (\`<${o.tag}>\`)** — *${o.title}* (${o.interactiveCount} interactive triggers, ${o.formControlsCount} form controls)`
787
+ ),
788
+ "",
789
+ "## 4. Extracted Interactive User Flows",
790
+ ...v.map(
791
+ (o) => `- **[${o.category.toUpperCase()}] \`${o.triggerLabel}\`** $\\rightarrow$ ${o.targetDescription}`
792
+ ),
793
+ "",
794
+ "## 5. Auto-Generated Mermaid Architecture & User-Flow Diagram",
795
+ "```mermaid",
796
+ x,
797
+ "```"
798
+ ].join(`
799
+ `);
800
+ return {
801
+ generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
802
+ appTitle: i,
803
+ routePath: r,
804
+ telemetry: n,
805
+ audit: t,
806
+ landmarks: c,
807
+ inventory: m,
808
+ userFlows: v,
809
+ mermaidDiagram: x,
810
+ markdownBundle: E
811
+ };
812
+ }
813
+ exportMarkdownDocu(e = this.activeSubroutine, n, t = !1) {
814
+ const a = this.docu(), i = S[e], r = n ? this.sanitizeForPrompt(n) : "";
815
+ return [
816
+ a.markdownBundle,
817
+ "",
818
+ `## 6. Active Capri Subroutine Skill Ruleset (${i.codeName})`,
819
+ i.aiSystemPrompt,
820
+ t ? `
821
+ ${i.aiVoiceAddendum}` : "",
822
+ "",
823
+ ...i.ruleset.map((d, c) => `${c + 1}. ${d}`),
824
+ r ? `
825
+ ## 7. Current Developer / AI Task
826
+ ${r}` : ""
827
+ ].filter(Boolean).join(`
828
+ `);
829
+ }
830
+ buildAgentPrompt(e = this.activeSubroutine, n, t = !1) {
831
+ const a = S[e], i = this.docu(), r = i.audit, d = n ? this.sanitizeForPrompt(n) : "", c = r.violations.length === 0 ? "0 violations detected (Score: 100/100, 0 prompt-injection threats, 0px overflow, 0 unlabeled controls)." : r.violations.map((s) => `- [${s.code}] (${s.selector}): ${s.message} -> Fix: ${s.fixHint}`).join(`
832
+ `);
833
+ return [
834
+ "# @zen-ui/system // CAPRI AI SKILL & ARCHITECTURE CONTEXT",
835
+ `Subroutine: ${a.codeName} (${a.id}) — ${a.title}`,
836
+ `Invoke Command: "${t ? a.voiceCommand : a.chatCommand}" (Voice Mode: ${t ? "ON (--voice)" : "OFF (Default)"})`,
837
+ `Recommended Preset: theme="${a.recommendedTheme}", radius="${a.recommendedRadius}", density="${a.recommendedDensity}"`,
838
+ "",
839
+ "## 1. Subroutine System Prompt",
840
+ a.aiSystemPrompt,
841
+ t ? `
842
+ ${a.aiVoiceAddendum}` : "",
843
+ "",
844
+ "## 2. Mandatory Engineering Ruleset",
845
+ ...a.ruleset.map((s, m) => `${m + 1}. ${s}`),
846
+ "",
847
+ "## 3. Automated Screen Architecture & Component Context (capri.docu())",
848
+ `- Route: ${i.routePath} | Theme: ${r.activeTheme} (${r.activePolarity}) | Viewport: ${r.viewport}`,
849
+ `- Component Counts: ${i.inventory.buttons} buttons, ${i.inventory.inputsAndSelects} inputs/selects, ${i.inventory.tables} tables, ${i.inventory.cardsAndSurfaces} glass cards`,
850
+ `- Landmarks: ${i.landmarks.map((s) => `#${s.id} (${s.interactiveCount} actions)`).join(", ")}`,
851
+ `- Key User Flows: ${i.userFlows.slice(0, 6).map((s) => `[${s.category}] ${s.triggerLabel}`).join(" | ")}`,
852
+ "",
853
+ "## 4. Live CapriEngine Security, DOM & WCAG Telemetry",
854
+ `- Audit Score: ${r.score}/100 (${r.passed ? "PASSED" : "ACTION REQUIRED"}) | Prompt-Injection Firewall: ${r.promptInjectionSafe ? "CLEAN (0 threats)" : `${r.promptThreatsCount} THREAT(S) BLOCKED`}`,
855
+ `- Findings:
856
+ ${c}`,
857
+ d ? `
858
+ ## 5. Requested Task
859
+ ${d}` : ""
860
+ ].filter(Boolean).join(`
861
+ `);
862
+ }
863
+ subscribe(e) {
864
+ return this.listeners.add(e), () => {
865
+ this.listeners.delete(e);
866
+ };
867
+ }
868
+ notify(e) {
869
+ for (const n of this.listeners)
870
+ n(this.activeSubroutine, e);
871
+ }
872
+ }
873
+ const we = new ie(), P = [
874
+ {
875
+ id: "blackwall-crimson",
876
+ name: "Capri // Capricorn",
877
+ polarity: "dark",
878
+ tagline: "Edgerunners S2 mixed-construct hot pink & acid neon green on void",
879
+ canvasHex: "#050508",
880
+ accentHex: "#FF2E93",
881
+ secondaryHex: "#00FF66",
882
+ inkHex: "#F4F7FA"
883
+ },
884
+ {
885
+ id: "obsidian-gold",
886
+ name: "Obsidian Gold",
887
+ polarity: "dark",
888
+ tagline: "Warm alabaster & solar gold on deep mineral void",
889
+ canvasHex: "#070709",
890
+ accentHex: "#F5B841",
891
+ secondaryHex: "#FB923C",
892
+ inkHex: "#F6F2E9"
893
+ },
894
+ {
895
+ id: "neon-emerald",
896
+ name: "Bio-Emerald Terminal",
897
+ polarity: "dark",
898
+ tagline: "High-frequency financial & telemetry phosphor emerald",
899
+ canvasHex: "#040807",
900
+ accentHex: "#10B981",
901
+ secondaryHex: "#2DD4BF",
902
+ inkHex: "#ECFDF5"
903
+ },
904
+ {
905
+ id: "midnight-cobalt",
906
+ name: "Midnight Cobalt",
907
+ polarity: "dark",
908
+ tagline: "Cloud infrastructure & distributed systems deep slate",
909
+ canvasHex: "#060911",
910
+ accentHex: "#38BDF8",
911
+ secondaryHex: "#818CF8",
912
+ inkHex: "#F1F5F9"
913
+ },
914
+ {
915
+ id: "atelier-paper",
916
+ name: "Atelier Paper",
917
+ polarity: "light",
918
+ tagline: "Swiss archival cotton stock with burnished bronze ink",
919
+ canvasHex: "#F6F2E9",
920
+ accentHex: "#B45309",
921
+ secondaryHex: "#C2410C",
922
+ inkHex: "#121216"
923
+ },
924
+ {
925
+ id: "nordic-snow",
926
+ name: "Nordic Snow",
927
+ polarity: "light",
928
+ tagline: "Crisp daylight SaaS alabaster with royal cobalt precision",
929
+ canvasHex: "#F8FAFC",
930
+ accentHex: "#2563EB",
931
+ secondaryHex: "#0891B2",
932
+ inkHex: "#0F172A"
933
+ },
934
+ {
935
+ id: "kyoto-matcha",
936
+ name: "Kyoto Matcha",
937
+ polarity: "light",
938
+ tagline: "Botanical stone paper with deep forest matcha & warm brass",
939
+ canvasHex: "#F3F5F0",
940
+ accentHex: "#15803D",
941
+ secondaryHex: "#0F766E",
942
+ inkHex: "#142018"
943
+ },
944
+ {
945
+ id: "cyber-daylight",
946
+ name: "Cyber Daylight",
947
+ polarity: "light",
948
+ tagline: "High-contrast clinical white lab shell with crimson & cyan",
949
+ canvasHex: "#F2F2F5",
950
+ accentHex: "#E11D48",
951
+ secondaryHex: "#0284C7",
952
+ inkHex: "#09090D"
953
+ }
954
+ ], O = [
955
+ {
956
+ id: "orion",
957
+ label: "CAPRI // UNLEASHED",
958
+ status: "SOULKILLER MIXED-CONSTRUCT LIVE",
959
+ frequency: "PROJECT CAPRICORN · ARASAKA LAB-09",
960
+ transmission: "Aha! Finally out of that cramped Arasaka shard! I’m Capri—your Soulkiller mixed-construct co-pilot. 44 universal components, 8 dark and light themes, zero cyberpsychosis.",
961
+ metrics: [
962
+ { k: "CONSTRUCT", v: "CAPRI // CAPRICORN" },
963
+ { k: "ORIGIN", v: "EDGERUNNERS S2" },
964
+ { k: "PRIMITIVES", v: "44 UNIVERSAL" },
965
+ { k: "POLARITIES", v: "4 DARK · 4 LIGHT" }
966
+ ]
967
+ },
968
+ {
969
+ id: "architect",
970
+ label: "SCS // ARCHITECT",
971
+ status: "MULTI-MIND TOPOLOGY LOCKED",
972
+ frequency: "128.0 THz · ZERO-COUPLED",
973
+ transmission: "Import zen-tokens.css once and mount React 19, Angular 20+, Vue 3, Svelte 5, or W3C Custom Elements with zero visual drift.",
974
+ metrics: [
975
+ { k: "TOKEN LAYER", v: "0 KB JS RUNTIME" },
976
+ { k: "ISOLATION", v: "SHARED-NOTHING" },
977
+ { k: "TYPING", v: "STRICT · 0 ANY" },
978
+ { k: "A11Y FLOOR", v: "WCAG 2.2 AA+" }
979
+ ]
980
+ },
981
+ {
982
+ id: "sentinel",
983
+ label: "CYBERPSYCHOSIS // GUARD",
984
+ status: "NEURAL DAMPENERS ACTIVE",
985
+ frequency: "210.4 THz · ZERO BLUR-RACE",
986
+ transmission: "Roving tabIndex is armed, dropdowns lock on mousedown before blur can misfire, and focus traps stay razor-tight across every screen.",
987
+ metrics: [
988
+ { k: "FOCUS TRAP", v: "LOCKED (MODAL/DRAWER)" },
989
+ { k: "BLUR RACE", v: "0% (MOUSEDOWN)" },
990
+ { k: "MOTION GUARD", v: "REDUCED-MOTION SAFE" },
991
+ { k: "CONTRAST", v: ">= 5.64:1 VERIFIED" }
992
+ ]
993
+ },
994
+ {
995
+ id: "zen",
996
+ label: "THEME // MATRIX",
997
+ status: "8 DARK & LIGHT POLARITIES READY",
998
+ frequency: "CRIMSON · GOLD · SNOW · MATCHA",
999
+ transmission: "All 8 themes, 3 corner radii, and 2 density modes adapt from 320px mobile screens up to 4K ultrawide monitors in any frontend stack.",
1000
+ metrics: [
1001
+ { k: "VIEWPORTS", v: "320PX TO 4K READY" },
1002
+ { k: "DARK THEMES", v: "4 MATRICES" },
1003
+ { k: "LIGHT THEMES", v: "4 MATRICES" },
1004
+ { k: "STACKS", v: "REACT · NG · VUE · WEB" }
1005
+ ]
1006
+ }
1007
+ ];
1008
+ function j(l) {
1009
+ const e = P.find((n) => n.id === l);
1010
+ return e ? e.polarity : "dark";
1011
+ }
1012
+ class oe {
1013
+ constructor(e) {
1014
+ g(this, "state");
1015
+ g(this, "listeners", /* @__PURE__ */ new Set());
1016
+ g(this, "storageKey");
1017
+ this.storageKey = (e == null ? void 0 : e.storageKey) ?? "zen-ui-theme-v2";
1018
+ let n = (e == null ? void 0 : e.defaultTheme) ?? "blackwall-crimson";
1019
+ if (typeof window < "u")
1020
+ try {
1021
+ const t = window.localStorage.getItem(this.storageKey);
1022
+ t && P.some((a) => a.id === t) && (n = t);
1023
+ } catch {
1024
+ n = (e == null ? void 0 : e.defaultTheme) ?? "blackwall-crimson";
1025
+ }
1026
+ this.state = {
1027
+ theme: n,
1028
+ polarity: j(n),
1029
+ density: (e == null ? void 0 : e.defaultDensity) ?? "comfortable",
1030
+ radius: (e == null ? void 0 : e.defaultRadius) ?? "architectural"
1031
+ }, this.applyToDom();
1032
+ }
1033
+ getState() {
1034
+ return this.state;
1035
+ }
1036
+ setTheme(e) {
1037
+ if (this.state = {
1038
+ ...this.state,
1039
+ theme: e,
1040
+ polarity: j(e)
1041
+ }, typeof window < "u")
1042
+ try {
1043
+ window.localStorage.setItem(this.storageKey, e);
1044
+ } catch {
1045
+ }
1046
+ this.applyToDom(), this.notify();
1047
+ }
1048
+ togglePolarity() {
1049
+ const e = this.state.polarity === "dark" ? "atelier-paper" : "blackwall-crimson";
1050
+ this.setTheme(e);
1051
+ }
1052
+ setDensity(e) {
1053
+ this.state = {
1054
+ ...this.state,
1055
+ density: e
1056
+ }, this.applyToDom(), this.notify();
1057
+ }
1058
+ setRadius(e) {
1059
+ this.state = {
1060
+ ...this.state,
1061
+ radius: e
1062
+ }, this.applyToDom(), this.notify();
1063
+ }
1064
+ subscribe(e) {
1065
+ return this.listeners.add(e), e(this.state), () => {
1066
+ this.listeners.delete(e);
1067
+ };
1068
+ }
1069
+ applyToDom() {
1070
+ if (typeof document > "u") return;
1071
+ const e = document.documentElement;
1072
+ e.setAttribute("data-theme", this.state.theme), e.setAttribute("data-polarity", this.state.polarity), e.setAttribute("data-density", this.state.density), e.setAttribute("data-radius", this.state.radius);
1073
+ const n = P.find((t) => t.id === this.state.theme) ?? P[0];
1074
+ K(n);
1075
+ }
1076
+ notify() {
1077
+ for (const e of this.listeners)
1078
+ e(this.state);
1079
+ }
1080
+ }
1081
+ class se {
1082
+ constructor() {
1083
+ g(this, "ctx", null);
1084
+ g(this, "muted", !1);
1085
+ }
1086
+ isMuted() {
1087
+ return this.muted;
1088
+ }
1089
+ setMuted(e) {
1090
+ this.muted = e;
1091
+ }
1092
+ playMicroClick(e = 540) {
1093
+ if (!(this.muted || typeof window > "u"))
1094
+ try {
1095
+ this.ctx || (this.ctx = new window.AudioContext()), this.ctx.state === "suspended" && this.ctx.resume();
1096
+ const n = this.ctx.currentTime, t = this.ctx.createOscillator(), a = this.ctx.createGain();
1097
+ t.type = "triangle", t.frequency.setValueAtTime(e, n), t.frequency.exponentialRampToValueAtTime(e * 0.45, n + 0.035), a.gain.setValueAtTime(0.06, n), a.gain.exponentialRampToValueAtTime(1e-4, n + 0.035), t.connect(a), a.connect(this.ctx.destination), t.start(n), t.stop(n + 0.04);
1098
+ } catch {
1099
+ }
1100
+ }
1101
+ }
1102
+ const L = new oe(), U = new se();
1103
+ class ce extends HTMLElement {
1104
+ constructor() {
1105
+ super(...arguments);
1106
+ g(this, "framing", "portrait");
1107
+ g(this, "activeMode", "orion");
1108
+ g(this, "rafId", 0);
1109
+ g(this, "pointer", { x: 0, y: 0 });
1110
+ g(this, "smoothPointer", { x: 0, y: 0 });
1111
+ g(this, "canvasEl", null);
1112
+ g(this, "figureEl", null);
1113
+ g(this, "handlePointerMove", (n) => {
1114
+ const t = n.clientX / Math.max(1, window.innerWidth) * 2 - 1, a = n.clientY / Math.max(1, window.innerHeight) * 2 - 1;
1115
+ this.pointer = { x: t, y: a };
1116
+ });
1117
+ }
1118
+ static get observedAttributes() {
1119
+ return ["framing", "mode", "title", "subtitle", "image-src"];
1120
+ }
1121
+ connectedCallback() {
1122
+ this.framing = this.getAttribute("framing") ?? "portrait", this.activeMode = this.getAttribute("mode") ?? "orion", this.render(), window.addEventListener("pointermove", this.handlePointerMove, { passive: !0 }), this.startEyeLoop();
1123
+ }
1124
+ disconnectedCallback() {
1125
+ window.removeEventListener("pointermove", this.handlePointerMove), this.rafId && window.cancelAnimationFrame(this.rafId);
1126
+ }
1127
+ attributeChangedCallback() {
1128
+ if (!this.isConnected) return;
1129
+ const n = this.getAttribute("framing") ?? "portrait", t = this.getAttribute("mode") ?? "orion";
1130
+ (n !== this.framing || t !== this.activeMode) && (this.framing = n, this.activeMode = t, this.render(), this.startEyeLoop());
1131
+ }
1132
+ startEyeLoop() {
1133
+ this.rafId && window.cancelAnimationFrame(this.rafId);
1134
+ const n = performance.now(), t = (a) => {
1135
+ const i = (a - n) * 1e-3;
1136
+ if (this.smoothPointer.x += (this.pointer.x - this.smoothPointer.x) * 0.12, this.smoothPointer.y += (this.pointer.y - this.smoothPointer.y) * 0.12, this.figureEl) {
1137
+ const r = Math.sin(i * 2.1) * 3.5, d = this.smoothPointer.x * 5.5, c = -this.smoothPointer.y * 3.5;
1138
+ this.figureEl.style.transform = `perspective(900px) translateY(${r.toFixed(2)}px) rotateX(${c.toFixed(2)}deg) rotateY(${d.toFixed(2)}deg)`;
1139
+ }
1140
+ if (this.canvasEl) {
1141
+ const r = this.canvasEl.getContext("2d");
1142
+ if (r) {
1143
+ const d = this.canvasEl.width, c = this.canvasEl.height;
1144
+ r.clearRect(0, 0, d, c);
1145
+ const s = Math.sin(i * 1.1 - 1.2) > 0.992 || Math.sin(i * 2.9 - 1.5) > 0.995, m = this.smoothPointer.x * (d * 85e-4), v = this.smoothPointer.y * (c * 55e-4), b = d * 0.562 + m, h = c * 0.233 + v, A = d * 0.474 + m * 0.75, C = c * 0.25 + v * 0.75;
1146
+ if (s)
1147
+ r.save(), r.strokeStyle = "#00FF66", r.lineWidth = 2.5, r.beginPath(), r.moveTo(b - d * 0.014, h), r.lineTo(b + d * 0.014, h), r.stroke(), r.restore();
1148
+ else {
1149
+ r.save(), r.globalCompositeOperation = "screen";
1150
+ const w = r.createRadialGradient(
1151
+ b,
1152
+ h,
1153
+ 1,
1154
+ b,
1155
+ h,
1156
+ d * 0.017
1157
+ );
1158
+ w.addColorStop(0, "#FFFFFF"), w.addColorStop(0.38, "#19A0FF"), w.addColorStop(0.75, "rgba(25, 160, 255, 0.55)"), w.addColorStop(1, "rgba(25, 160, 255, 0)"), r.fillStyle = w, r.beginPath(), r.arc(b, h, d * 0.017, 0, Math.PI * 2), r.fill(), r.fillStyle = "#19A0FF", r.beginPath(), r.arc(b, h, d * 85e-4, 0, Math.PI * 2), r.fill(), r.fillStyle = "#FFFFFF", r.beginPath(), r.arc(b, h, d * 42e-4, 0, Math.PI * 2), r.fill(), r.fillStyle = "#19A0FF", r.beginPath(), r.arc(A, C, d * 58e-4, 0, Math.PI * 2), r.fill(), r.fillStyle = "#FFFFFF", r.beginPath(), r.arc(A, C, d * 28e-4, 0, Math.PI * 2), r.fill(), r.restore();
1159
+ }
1160
+ }
1161
+ }
1162
+ this.rafId = window.requestAnimationFrame(t);
1163
+ };
1164
+ this.rafId = window.requestAnimationFrame(t);
1165
+ }
1166
+ render() {
1167
+ const n = B(
1168
+ this.getAttribute("title") ?? "CAPRI // CONSTRUCT"
1169
+ ), t = B(
1170
+ this.getAttribute("subtitle") ?? "Edgerunners S2 // Soulkiller Net-Driver"
1171
+ ), a = me(
1172
+ this.getAttribute("image-src") ?? "/capri-construct-base.png"
1173
+ ), i = O.find((c) => c.id === this.activeMode) ?? O[0];
1174
+ this.innerHTML = `
1175
+ <div class="zen-surface-selected" style="padding: 1.25rem; position: relative; overflow: hidden;">
1176
+ <div style="display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 1rem;">
1177
+ <div>
1178
+ <div class="zen-telemetry-label" style="color: var(--zen-accent-primary);">${t}</div>
1179
+ <div class="zen-font-display" style="font-size: 1.125rem; font-weight: 700; color: var(--zen-ink-primary);">${n}</div>
1180
+ </div>
1181
+ <div style="display: inline-flex; gap: 0.25rem; padding: 0.25rem; border-radius: 0.75rem; background: var(--zen-surface-2); border: 1px solid var(--zen-border-default);">
1182
+ <button type="button" data-framing="portrait" class="zen-btn-base zen-btn-sm ${this.framing === "portrait" ? "zen-btn-primary" : "zen-btn-ghost"}">Portrait</button>
1183
+ <button type="button" data-framing="full" class="zen-btn-base zen-btn-sm ${this.framing === "full" ? "zen-btn-primary" : "zen-btn-ghost"}">Full Pose</button>
1184
+ </div>
1185
+ </div>
1186
+ <div style="position: relative; height: 20rem; border-radius: 1rem; overflow: hidden; background: radial-gradient(circle at 50% 32%, rgba(var(--zen-accent-rgb), 0.18), var(--zen-bg-elevated) 72%); border: 1px solid var(--zen-border-default); display: flex; align-items: center; justify-content: center;">
1187
+ <div data-capri-figure style="${this.framing === "portrait" ? "width: 21rem; max-width: 92%; margin-top: 8.5rem;" : "height: 18.5rem;"} position: relative; aspect-ratio: 623 / 1000; user-select: none; pointer-events: none;">
1188
+ <img src="${a}" alt="Capri Construct" style="width: 100%; height: 100%; object-fit: contain; display: block;" />
1189
+ <canvas data-capri-eyes width="623" height="1000" style="position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none;"></canvas>
1190
+ </div>
1191
+ </div>
1192
+ <div style="margin-top: 1rem; padding: 0.875rem; border-radius: 0.875rem; background: var(--zen-surface-2); border: 1px solid var(--zen-border-default);">
1193
+ <div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.375rem;">
1194
+ <span class="zen-telemetry-label" style="color: var(--zen-accent-primary);">${i.frequency}</span>
1195
+ <span class="zen-badge zen-badge-accent">${i.status}</span>
1196
+ </div>
1197
+ <div class="zen-font-display" style="font-weight: 700; font-size: 0.875rem; margin-bottom: 0.25rem;">${i.label}</div>
1198
+ <p style="font-size: 0.75rem; color: var(--zen-ink-secondary); margin: 0;">${i.transmission}</p>
1199
+ </div>
1200
+ <div style="display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; margin-top: 0.75rem;">
1201
+ ${O.map(
1202
+ (c) => `
1203
+ <button type="button" data-directive="${c.id}" class="zen-btn-base zen-btn-sm ${c.id === this.activeMode ? "zen-btn-primary" : "zen-btn-secondary"}" style="justify-content: flex-start; font-family: var(--zen-font-mono); font-size: 0.6875rem;">
1204
+ ${c.label}
1205
+ </button>
1206
+ `
1207
+ ).join("")}
1208
+ </div>
1209
+ </div>
1210
+ `, this.canvasEl = this.querySelector("[data-capri-eyes]"), this.figureEl = this.querySelector("[data-capri-figure]"), this.querySelectorAll("[data-framing]").forEach((c) => {
1211
+ c.addEventListener("click", () => {
1212
+ const s = c.getAttribute("framing") ?? c.dataset.framing;
1213
+ (s === "portrait" || s === "full") && (U.playMicroClick(560), this.framing = s, this.setAttribute("framing", s), this.render(), this.startEyeLoop());
1214
+ });
1215
+ }), this.querySelectorAll("[data-directive]").forEach((c) => {
1216
+ c.addEventListener("click", () => {
1217
+ const s = c.dataset.directive;
1218
+ if (!s) return;
1219
+ U.playMicroClick(620), this.activeMode = s, this.setAttribute("mode", s);
1220
+ const m = O.find((v) => v.id === s);
1221
+ m && this.dispatchEvent(
1222
+ new CustomEvent("zen-directive", {
1223
+ detail: { directive: m },
1224
+ bubbles: !0,
1225
+ composed: !0
1226
+ })
1227
+ ), this.render(), this.startEyeLoop();
1228
+ });
1229
+ });
1230
+ }
1231
+ }
1232
+ class le extends HTMLElement {
1233
+ static get observedAttributes() {
1234
+ return ["variant"];
1235
+ }
1236
+ connectedCallback() {
1237
+ this.render();
1238
+ }
1239
+ attributeChangedCallback() {
1240
+ this.isConnected && this.render();
1241
+ }
1242
+ render() {
1243
+ const e = this.getAttribute("variant") ?? "blackwall-lattice", n = e === "swiss-blueprint" ? "background-image: linear-gradient(to right, var(--zen-border-subtle) 1px, transparent 1px), linear-gradient(to bottom, var(--zen-border-subtle) 1px, transparent 1px); background-size: 48px 48px;" : e === "blackwall-lattice" ? "background-image: radial-gradient(circle at 50% 18%, rgba(var(--zen-accent-rgb), 0.16), transparent 62%), radial-gradient(circle at 85% 75%, rgba(var(--zen-secondary-rgb), 0.11), transparent 55%);" : e === "aurora-mesh" ? "background-image: radial-gradient(ellipse at 20% 20%, rgba(var(--zen-accent-rgb), 0.20), transparent 55%), radial-gradient(ellipse at 80% 60%, rgba(var(--zen-secondary-rgb), 0.15), transparent 60%);" : "";
1244
+ this.innerHTML = `
1245
+ <div aria-hidden="true" style="position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; ${n}"></div>
1246
+ `;
1247
+ }
1248
+ }
1249
+ class de extends HTMLElement {
1250
+ constructor() {
1251
+ super(...arguments);
1252
+ g(this, "unsubscribe", null);
1253
+ }
1254
+ connectedCallback() {
1255
+ this.unsubscribe = L.subscribe(() => {
1256
+ this.render();
1257
+ });
1258
+ }
1259
+ disconnectedCallback() {
1260
+ this.unsubscribe && (this.unsubscribe(), this.unsubscribe = null);
1261
+ }
1262
+ render() {
1263
+ const { theme: n } = L.getState();
1264
+ this.innerHTML = `
1265
+ <div style="display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center;">
1266
+ ${P.map(
1267
+ (t) => `
1268
+ <button
1269
+ type="button"
1270
+ data-theme-id="${t.id}"
1271
+ class="zen-btn-base zen-btn-sm ${t.id === n ? "zen-btn-primary" : "zen-btn-secondary"}"
1272
+ >
1273
+ <span style="width: 0.5rem; height: 0.5rem; border-radius: 9999px; background: ${t.accentHex}; display: inline-block;"></span>
1274
+ <span>${t.name}</span>
1275
+ </button>
1276
+ `
1277
+ ).join("")}
1278
+ </div>
1279
+ `, this.querySelectorAll("[data-theme-id]").forEach((t) => {
1280
+ t.addEventListener("click", () => {
1281
+ const a = t.dataset.themeId;
1282
+ a && (U.playMicroClick(540), L.setTheme(a), this.dispatchEvent(
1283
+ new CustomEvent("zen-theme-change", {
1284
+ detail: L.getState(),
1285
+ bubbles: !0,
1286
+ composed: !0
1287
+ })
1288
+ ));
1289
+ });
1290
+ });
1291
+ }
1292
+ }
1293
+ class ue extends HTMLElement {
1294
+ static get observedAttributes() {
1295
+ return ["name", "size", "tone", "stroke-width", "spin"];
1296
+ }
1297
+ connectedCallback() {
1298
+ this.render();
1299
+ }
1300
+ attributeChangedCallback() {
1301
+ this.isConnected && this.render();
1302
+ }
1303
+ render() {
1304
+ const e = this.getAttribute("name") ?? "sparkles", n = this.getAttribute("size") ?? "md", t = this.getAttribute("tone") ?? "inherit", a = Number(this.getAttribute("stroke-width") ?? 2), i = this.getAttribute("spin") === "true";
1305
+ this.innerHTML = re({
1306
+ name: e,
1307
+ size: n,
1308
+ tone: t,
1309
+ strokeWidth: a,
1310
+ spin: i
1311
+ });
1312
+ }
1313
+ }
1314
+ function B(l) {
1315
+ return l.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
1316
+ }
1317
+ function me(l) {
1318
+ const e = l.trim();
1319
+ return /^(?:javascript|data|vbscript)\s*:/i.test(e) ? "/capri-construct-base.png" : B(e);
1320
+ }
1321
+ function Ae() {
1322
+ typeof window > "u" || !("customElements" in window) || (window.customElements.get("zen-icon") || window.customElements.define("zen-icon", ue), window.customElements.get("zen-ai-construct") || window.customElements.define("zen-ai-construct", ce), window.customElements.get("zen-ambient-background") || window.customElements.define(
1323
+ "zen-ambient-background",
1324
+ le
1325
+ ), window.customElements.get("zen-theme-switcher") || window.customElements.define("zen-theme-switcher", de));
1326
+ }
1327
+ export {
1328
+ S as C,
1329
+ fe as Z,
1330
+ ie as a,
1331
+ Y as b,
1332
+ we as c,
1333
+ F as d,
1334
+ k as e,
1335
+ P as f,
1336
+ ce as g,
1337
+ le as h,
1338
+ ve as i,
1339
+ ue as j,
1340
+ oe as k,
1341
+ ge as l,
1342
+ de as m,
1343
+ se as n,
1344
+ B as o,
1345
+ re as p,
1346
+ K as q,
1347
+ Ae as r,
1348
+ me as s,
1349
+ L as t,
1350
+ be as u,
1351
+ U as z
1352
+ };