tekivex-ui 2.5.2 → 2.5.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/dist/TkxForm-DSMDo2Ol.js +388 -0
- package/dist/TkxForm-DwV_n-eE.cjs +12 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.js +324 -301
- package/dist/headless.cjs +1 -1
- package/dist/headless.js +396 -195
- package/dist/i18n.cjs +1 -0
- package/dist/i18n.js +757 -0
- package/dist/index.cjs +27 -22
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4994 -5089
- package/dist/quantum.cjs +91 -0
- package/dist/quantum.js +2312 -0
- package/dist/realtime.cjs +25 -0
- package/dist/realtime.js +944 -0
- package/dist/security-C369oOWH.cjs +1 -0
- package/dist/security-CzAmaMqa.js +97 -0
- package/dist/src/charts/TkxDonutChart.d.ts.map +1 -1
- package/dist/src/charts/TkxPieChart.d.ts.map +1 -1
- package/dist/src/components/TkxDataGrid.d.ts +9 -1
- package/dist/src/components/TkxDataGrid.d.ts.map +1 -1
- package/dist/src/components/TkxDropdown.d.ts +41 -0
- package/dist/src/components/TkxDropdown.d.ts.map +1 -0
- package/dist/src/components/TkxLiveFeed.d.ts +891 -0
- package/dist/src/components/TkxLiveFeed.d.ts.map +1 -0
- package/dist/src/components/TkxLiveLog.d.ts +892 -0
- package/dist/src/components/TkxLiveLog.d.ts.map +1 -0
- package/dist/src/components/TkxLiveMetrics.d.ts +24 -0
- package/dist/src/components/TkxLiveMetrics.d.ts.map +1 -0
- package/dist/src/components/TkxPlayground.d.ts +15 -0
- package/dist/src/components/TkxPlayground.d.ts.map +1 -0
- package/dist/src/components/TkxQuantumForm.d.ts +20 -0
- package/dist/src/components/TkxQuantumForm.d.ts.map +1 -0
- package/dist/src/components/TkxRealTimeChart.d.ts +27 -0
- package/dist/src/components/TkxRealTimeChart.d.ts.map +1 -0
- package/dist/src/components/TkxTable.d.ts +11 -1
- package/dist/src/components/TkxTable.d.ts.map +1 -1
- package/dist/src/components/TkxThemeBuilder.d.ts +9 -0
- package/dist/src/components/TkxThemeBuilder.d.ts.map +1 -0
- package/dist/src/components/index.d.ts +1 -0
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/engine/index.d.ts +2 -0
- package/dist/src/engine/index.d.ts.map +1 -1
- package/dist/src/engine/quantum-ai.d.ts +201 -0
- package/dist/src/engine/quantum-ai.d.ts.map +1 -0
- package/dist/src/engine/tkx.d.ts.map +1 -1
- package/dist/src/headless/index.d.ts +6 -0
- package/dist/src/headless/index.d.ts.map +1 -1
- package/dist/src/headless/useInfiniteQuery.d.ts +35 -0
- package/dist/src/headless/useInfiniteQuery.d.ts.map +1 -0
- package/dist/src/headless/useSSE.d.ts +36 -0
- package/dist/src/headless/useSSE.d.ts.map +1 -0
- package/dist/src/headless/useWebSocket.d.ts +33 -0
- package/dist/src/headless/useWebSocket.d.ts.map +1 -0
- package/dist/src/quantum/index.d.ts +9 -0
- package/dist/src/quantum/index.d.ts.map +1 -0
- package/dist/src/realtime/index.d.ts +9 -0
- package/dist/src/realtime/index.d.ts.map +1 -0
- package/dist/{TkxForm-BWK4LqY3.js → tkx-BJ10JtMv.js} +372 -721
- package/dist/tkx-BeNyC0w7.cjs +4 -0
- package/package.json +16 -1
- package/src/charts/TkxDonutChart.tsx +15 -2
- package/src/charts/TkxPieChart.tsx +17 -2
- package/src/components/TkxDataGrid.tsx +72 -0
- package/src/components/TkxDropdown.tsx +802 -0
- package/src/components/TkxLiveFeed.tsx +329 -0
- package/src/components/TkxLiveLog.tsx +470 -0
- package/src/components/TkxLiveMetrics.tsx +291 -0
- package/src/components/TkxPlayground.tsx +736 -0
- package/src/components/TkxQuantumForm.tsx +592 -0
- package/src/components/TkxRealTimeChart.tsx +381 -0
- package/src/components/TkxTable.tsx +351 -77
- package/src/components/TkxThemeBuilder.tsx +685 -0
- package/src/components/index.ts +4 -0
- package/src/engine/index.ts +2 -0
- package/src/engine/quantum-ai.ts +1045 -0
- package/src/engine/tkx.ts +95 -4
- package/src/headless/index.ts +6 -0
- package/src/headless/useInfiniteQuery.ts +153 -0
- package/src/headless/useSSE.ts +165 -0
- package/src/headless/useWebSocket.ts +229 -0
- package/src/quantum/index.ts +39 -0
- package/src/realtime/index.ts +21 -0
- package/dist/TkxForm-ljQjX7KD.cjs +0 -15
package/dist/quantum.js
ADDED
|
@@ -0,0 +1,2312 @@
|
|
|
1
|
+
import { jsxs as c, jsx as a, Fragment as pe } from "react/jsx-runtime";
|
|
2
|
+
import Z, { useState as A, useEffect as V, useCallback as R, useRef as X } from "react";
|
|
3
|
+
import { u as K } from "./index-eT_U4qB2.js";
|
|
4
|
+
import { t as le } from "./tkx-BJ10JtMv.js";
|
|
5
|
+
import { s as J } from "./security-CzAmaMqa.js";
|
|
6
|
+
class W {
|
|
7
|
+
constructor(e, n) {
|
|
8
|
+
this.re = e, this.im = n;
|
|
9
|
+
}
|
|
10
|
+
add(e) {
|
|
11
|
+
return new W(this.re + e.re, this.im + e.im);
|
|
12
|
+
}
|
|
13
|
+
sub(e) {
|
|
14
|
+
return new W(this.re - e.re, this.im - e.im);
|
|
15
|
+
}
|
|
16
|
+
mul(e) {
|
|
17
|
+
return new W(
|
|
18
|
+
this.re * e.re - this.im * e.im,
|
|
19
|
+
this.re * e.im + this.im * e.re
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
scale(e) {
|
|
23
|
+
return new W(this.re * e, this.im * e);
|
|
24
|
+
}
|
|
25
|
+
conjugate() {
|
|
26
|
+
return new W(this.re, -this.im);
|
|
27
|
+
}
|
|
28
|
+
/** |z|² */
|
|
29
|
+
magnitudeSquared() {
|
|
30
|
+
return this.re * this.re + this.im * this.im;
|
|
31
|
+
}
|
|
32
|
+
/** |z| */
|
|
33
|
+
magnitude() {
|
|
34
|
+
return Math.sqrt(this.magnitudeSquared());
|
|
35
|
+
}
|
|
36
|
+
static fromPolar(e, n) {
|
|
37
|
+
return new W(e * Math.cos(n), e * Math.sin(n));
|
|
38
|
+
}
|
|
39
|
+
static zero() {
|
|
40
|
+
return new W(0, 0);
|
|
41
|
+
}
|
|
42
|
+
static one() {
|
|
43
|
+
return new W(1, 0);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
class _ {
|
|
47
|
+
// amplitude of |1⟩
|
|
48
|
+
constructor(e = W.one(), n = W.zero()) {
|
|
49
|
+
this.alpha = e, this.beta = n, this.normalize();
|
|
50
|
+
}
|
|
51
|
+
/** Ensure |α|² + |β|² = 1 */
|
|
52
|
+
normalize() {
|
|
53
|
+
const e = Math.sqrt(
|
|
54
|
+
this.alpha.magnitudeSquared() + this.beta.magnitudeSquared()
|
|
55
|
+
);
|
|
56
|
+
e > 0 && (this.alpha = this.alpha.scale(1 / e), this.beta = this.beta.scale(1 / e));
|
|
57
|
+
}
|
|
58
|
+
/** Hadamard gate: H|0⟩ = (|0⟩+|1⟩)/√2, H|1⟩ = (|0⟩−|1⟩)/√2 */
|
|
59
|
+
hadamard() {
|
|
60
|
+
const e = 1 / Math.SQRT2, n = this.alpha.add(this.beta).scale(e), i = this.alpha.sub(this.beta).scale(e);
|
|
61
|
+
return new _(n, i);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Ry(θ) rotation gate:
|
|
65
|
+
* [[cos(θ/2), -sin(θ/2)],
|
|
66
|
+
* [sin(θ/2), cos(θ/2)]]
|
|
67
|
+
*/
|
|
68
|
+
ry(e) {
|
|
69
|
+
const n = Math.cos(e / 2), i = Math.sin(e / 2), t = this.alpha.scale(n).sub(this.beta.scale(i)), l = this.alpha.scale(i).add(this.beta.scale(n));
|
|
70
|
+
return new _(t, l);
|
|
71
|
+
}
|
|
72
|
+
/** Phase gate: |0⟩ → |0⟩, |1⟩ → e^(iφ)|1⟩ */
|
|
73
|
+
phase(e) {
|
|
74
|
+
const n = W.fromPolar(1, e);
|
|
75
|
+
return new _(this.alpha, this.beta.mul(n));
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Measure the qubit. Returns 0 with probability |α|², 1 with probability |β|².
|
|
79
|
+
* Collapses the state after measurement.
|
|
80
|
+
*/
|
|
81
|
+
measure() {
|
|
82
|
+
const e = this.beta.magnitudeSquared();
|
|
83
|
+
return Math.random() < e ? 1 : 0;
|
|
84
|
+
}
|
|
85
|
+
/** Returns |β|² — probability of measuring 1 */
|
|
86
|
+
expectation() {
|
|
87
|
+
return this.beta.magnitudeSquared();
|
|
88
|
+
}
|
|
89
|
+
getAlpha() {
|
|
90
|
+
return this.alpha;
|
|
91
|
+
}
|
|
92
|
+
getBeta() {
|
|
93
|
+
return this.beta;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
class ue {
|
|
97
|
+
constructor(e) {
|
|
98
|
+
this.qubits = Array.from({ length: e }, () => new _());
|
|
99
|
+
}
|
|
100
|
+
get size() {
|
|
101
|
+
return this.qubits.length;
|
|
102
|
+
}
|
|
103
|
+
getQubit(e) {
|
|
104
|
+
return this.qubits[e];
|
|
105
|
+
}
|
|
106
|
+
/** Apply Hadamard to all qubits — creates uniform superposition */
|
|
107
|
+
superpose() {
|
|
108
|
+
this.qubits = this.qubits.map((e) => e.hadamard());
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* CNOT gate: if control qubit has high |1⟩ probability, flip target qubit.
|
|
112
|
+
* Approximate classical simulation: probabilistic flip based on control expectation.
|
|
113
|
+
*/
|
|
114
|
+
cnot(e, n) {
|
|
115
|
+
const i = this.qubits[e], t = this.qubits[n], l = i.expectation();
|
|
116
|
+
this.qubits[n] = t.ry(Math.PI * l);
|
|
117
|
+
}
|
|
118
|
+
/** Apply Ry rotation to a specific qubit */
|
|
119
|
+
rotate(e, n) {
|
|
120
|
+
this.qubits[e] = this.qubits[e].ry(n);
|
|
121
|
+
}
|
|
122
|
+
/** Measure all qubits; returns array of 0/1 */
|
|
123
|
+
measure() {
|
|
124
|
+
return this.qubits.map((e) => e.measure());
|
|
125
|
+
}
|
|
126
|
+
/** Returns probability of measuring 1 for each qubit */
|
|
127
|
+
probs() {
|
|
128
|
+
return this.qubits.map((e) => e.expectation());
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
class de {
|
|
132
|
+
constructor(e = 1, n = 0.995, i = 0.3, t = 1e-6) {
|
|
133
|
+
this.temperature = e, this.coolingRate = n, this.tunnelingStrength = i, this.minTemp = t;
|
|
134
|
+
}
|
|
135
|
+
anneal(e, n, i, t = 1e3) {
|
|
136
|
+
let l = e, s = n(l), d = l, o = s, p = this.temperature, f = 0, m = 0;
|
|
137
|
+
for (let g = 0; g < t && p > this.minTemp; g++) {
|
|
138
|
+
const b = i(l), h = n(b), v = h - s;
|
|
139
|
+
let C = !1;
|
|
140
|
+
if (v <= 0)
|
|
141
|
+
C = !0;
|
|
142
|
+
else {
|
|
143
|
+
const k = Math.exp(-v / p), P = Math.sqrt(2 * Math.abs(v)), F = Math.abs(v), w = Math.exp(-2 * P * Math.sqrt(F) * this.tunnelingStrength);
|
|
144
|
+
Math.random() < k + w && (C = !0, Math.random() < w / (k + w + 1e-10) && m++);
|
|
145
|
+
}
|
|
146
|
+
C && (l = b, s = h, f++, s < o && (d = l, o = s)), p *= this.coolingRate;
|
|
147
|
+
}
|
|
148
|
+
return {
|
|
149
|
+
state: d,
|
|
150
|
+
energy: o,
|
|
151
|
+
iterations: t,
|
|
152
|
+
accepted: f,
|
|
153
|
+
tunnels: m
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
class he {
|
|
158
|
+
constructor(e, n) {
|
|
159
|
+
const i = Math.sqrt(2 / (e + n));
|
|
160
|
+
this.weights = Array.from(
|
|
161
|
+
{ length: e },
|
|
162
|
+
() => Array.from({ length: n }, () => (Math.random() * 2 - 1) * i)
|
|
163
|
+
), this.visibleBias = Array.from({ length: e }, () => 0), this.hiddenBias = Array.from({ length: n }, () => 0);
|
|
164
|
+
}
|
|
165
|
+
/** Sigmoid with tiny quantum noise */
|
|
166
|
+
sigmoid(e) {
|
|
167
|
+
const n = (Math.random() - 0.5) * 0.1;
|
|
168
|
+
return 1 / (1 + Math.exp(-(e + n)));
|
|
169
|
+
}
|
|
170
|
+
/** Sample a binary value from a probability */
|
|
171
|
+
sample(e) {
|
|
172
|
+
return Math.random() < e ? 1 : 0;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Energy: E(v,h) = -vBias·v - hBias·h - v^T W h
|
|
176
|
+
*/
|
|
177
|
+
energy(e, n) {
|
|
178
|
+
const i = this.visibleBias.reduce((s, d, o) => s + d * e[o], 0), t = this.hiddenBias.reduce((s, d, o) => s + d * n[o], 0);
|
|
179
|
+
let l = 0;
|
|
180
|
+
for (let s = 0; s < e.length; s++)
|
|
181
|
+
for (let d = 0; d < n.length; d++)
|
|
182
|
+
l += e[s] * this.weights[s][d] * n[d];
|
|
183
|
+
return -(i + t + l);
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Compute P(h_j=1 | v) = sigmoid(hBias[j] + sum_i weights[i][j] * v[i])
|
|
187
|
+
*/
|
|
188
|
+
hiddenProbs(e) {
|
|
189
|
+
return this.hiddenBias.map((n, i) => {
|
|
190
|
+
const t = n + e.reduce((l, s, d) => l + this.weights[d][i] * s, 0);
|
|
191
|
+
return this.sigmoid(t);
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Compute P(v_i=1 | h) = sigmoid(vBias[i] + sum_j weights[i][j] * h[j])
|
|
196
|
+
*/
|
|
197
|
+
visibleProbs(e) {
|
|
198
|
+
return this.visibleBias.map((n, i) => {
|
|
199
|
+
const t = n + e.reduce((l, s, d) => l + this.weights[i][d] * s, 0);
|
|
200
|
+
return this.sigmoid(t);
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Gibbs sampling: run k steps of
|
|
205
|
+
* h ← sample(hiddenProbs(v))
|
|
206
|
+
* v ← sample(visibleProbs(h))
|
|
207
|
+
*/
|
|
208
|
+
gibbs(e, n = 1) {
|
|
209
|
+
let i = [...e], t = [];
|
|
210
|
+
for (let l = 0; l < n; l++)
|
|
211
|
+
t = this.hiddenProbs(i).map((s) => this.sample(s)), i = this.visibleProbs(t).map((s) => this.sample(s));
|
|
212
|
+
return { visible: i, hidden: t };
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Contrastive Divergence-1 training step.
|
|
216
|
+
*/
|
|
217
|
+
trainCD1(e, n = 0.01) {
|
|
218
|
+
const i = this.visibleBias.length, t = this.hiddenBias.length, l = Array.from({ length: i }, () => Array(t).fill(0)), s = Array(i).fill(0), d = Array(t).fill(0);
|
|
219
|
+
for (const p of e) {
|
|
220
|
+
const f = this.hiddenProbs(p), m = f.map((h) => this.sample(h)), g = this.visibleProbs(m).map((h) => this.sample(h)), b = this.hiddenProbs(g);
|
|
221
|
+
for (let h = 0; h < i; h++) {
|
|
222
|
+
for (let v = 0; v < t; v++)
|
|
223
|
+
l[h][v] += p[h] * f[v] - g[h] * b[v];
|
|
224
|
+
s[h] += p[h] - g[h];
|
|
225
|
+
}
|
|
226
|
+
for (let h = 0; h < t; h++)
|
|
227
|
+
d[h] += f[h] - b[h];
|
|
228
|
+
}
|
|
229
|
+
const o = e.length;
|
|
230
|
+
for (let p = 0; p < i; p++) {
|
|
231
|
+
for (let f = 0; f < t; f++)
|
|
232
|
+
this.weights[p][f] += n * l[p][f] / o;
|
|
233
|
+
this.visibleBias[p] += n * s[p] / o;
|
|
234
|
+
}
|
|
235
|
+
for (let p = 0; p < t; p++)
|
|
236
|
+
this.hiddenBias[p] += n * d[p] / o;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Infer hidden activations from partial visible input.
|
|
240
|
+
*/
|
|
241
|
+
infer(e) {
|
|
242
|
+
const n = this.hiddenProbs(e), i = n.map((l) => this.sample(l)), t = this.visibleProbs(i);
|
|
243
|
+
return {
|
|
244
|
+
hidden: n,
|
|
245
|
+
visible: t,
|
|
246
|
+
energy: this.energy(e, i),
|
|
247
|
+
iterations: 1
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
class ee {
|
|
252
|
+
/**
|
|
253
|
+
* Amplify probabilities of "marked" items using Grover-inspired algorithm.
|
|
254
|
+
*/
|
|
255
|
+
amplify(e, n, i = 0.5) {
|
|
256
|
+
const t = e.length;
|
|
257
|
+
if (t === 0) return [];
|
|
258
|
+
const l = e.map(n), s = l.filter((m) => m > i).length, d = Math.max(1, s);
|
|
259
|
+
let o = Array(t).fill(1 / Math.sqrt(t));
|
|
260
|
+
const p = Math.max(1, Math.floor(Math.PI / 4 * Math.sqrt(t / d)));
|
|
261
|
+
for (let m = 0; m < p; m++) {
|
|
262
|
+
for (let b = 0; b < t; b++)
|
|
263
|
+
l[b] > i && (o[b] = -o[b]);
|
|
264
|
+
const g = o.reduce((b, h) => b + h, 0) / t;
|
|
265
|
+
o = o.map((b) => 2 * g - b);
|
|
266
|
+
}
|
|
267
|
+
return e.map((m, g) => ({
|
|
268
|
+
index: g,
|
|
269
|
+
amplitude: o[g],
|
|
270
|
+
probability: o[g] * o[g],
|
|
271
|
+
classicalSimilarity: l[g],
|
|
272
|
+
combined: o[g] * o[g] * 0.6 + l[g] * 0.4
|
|
273
|
+
})).sort((m, g) => g.combined - m.combined);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
const te = [
|
|
277
|
+
{
|
|
278
|
+
keywords: ["email", "e-mail", "mail"],
|
|
279
|
+
type: "email",
|
|
280
|
+
validations: [
|
|
281
|
+
{ rule: "required", message: "Email is required" },
|
|
282
|
+
{ rule: "pattern", value: "^[^@]+@[^@]+\\.[^@]+$", message: "Enter a valid email address" },
|
|
283
|
+
{ rule: "maxLength", value: 254, message: "Email too long" }
|
|
284
|
+
],
|
|
285
|
+
placeholder: "you@example.com",
|
|
286
|
+
label: "Email Address",
|
|
287
|
+
confidence: 0.98
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
keywords: ["password", "passwd", "pwd", "pass"],
|
|
291
|
+
type: "password",
|
|
292
|
+
validations: [
|
|
293
|
+
{ rule: "required", message: "Password is required" },
|
|
294
|
+
{ rule: "minLength", value: 8, message: "Password must be at least 8 characters" },
|
|
295
|
+
{ rule: "pattern", value: "(?=.*[A-Z])(?=.*[0-9])", message: "Include uppercase and a number" }
|
|
296
|
+
],
|
|
297
|
+
placeholder: "••••••••",
|
|
298
|
+
label: "Password",
|
|
299
|
+
confidence: 0.97
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
keywords: ["confirm_password", "confirmpassword", "confirm_pass", "repassword", "password2", "repeat_password"],
|
|
303
|
+
type: "password",
|
|
304
|
+
validations: [
|
|
305
|
+
{ rule: "required", message: "Please confirm your password" },
|
|
306
|
+
{ rule: "match", value: "password", message: "Passwords do not match" }
|
|
307
|
+
],
|
|
308
|
+
placeholder: "••••••••",
|
|
309
|
+
label: "Confirm Password",
|
|
310
|
+
confidence: 0.95
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
keywords: ["phone", "mobile", "cell", "tel", "telephone", "contact_number"],
|
|
314
|
+
type: "tel",
|
|
315
|
+
validations: [
|
|
316
|
+
{ rule: "pattern", value: "^[+]?[(]?[0-9]{3}[)]?[-\\s.]?[0-9]{3}[-\\s.]?[0-9]{4,6}$", message: "Enter a valid phone number" }
|
|
317
|
+
],
|
|
318
|
+
placeholder: "+1 (555) 000-0000",
|
|
319
|
+
label: "Phone Number",
|
|
320
|
+
confidence: 0.93
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
keywords: ["age"],
|
|
324
|
+
type: "number",
|
|
325
|
+
validations: [
|
|
326
|
+
{ rule: "min", value: 0, message: "Age cannot be negative" },
|
|
327
|
+
{ rule: "max", value: 150, message: "Enter a valid age" },
|
|
328
|
+
{ rule: "integer", message: "Age must be a whole number" }
|
|
329
|
+
],
|
|
330
|
+
placeholder: "25",
|
|
331
|
+
label: "Age",
|
|
332
|
+
confidence: 0.9
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
keywords: ["price", "amount", "cost", "fee", "payment", "salary", "wage", "total"],
|
|
336
|
+
type: "number",
|
|
337
|
+
validations: [
|
|
338
|
+
{ rule: "min", value: 0, message: "Amount cannot be negative" },
|
|
339
|
+
{ rule: "pattern", value: "^\\d+(\\.\\d{1,2})?$", message: "Enter a valid amount (e.g. 9.99)" }
|
|
340
|
+
],
|
|
341
|
+
placeholder: "0.00",
|
|
342
|
+
label: "Amount",
|
|
343
|
+
confidence: 0.88
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
keywords: ["url", "website", "site", "link", "homepage", "web"],
|
|
347
|
+
type: "url",
|
|
348
|
+
validations: [
|
|
349
|
+
{ rule: "pattern", value: "https?://.+", message: "Enter a valid URL starting with http:// or https://" }
|
|
350
|
+
],
|
|
351
|
+
placeholder: "https://example.com",
|
|
352
|
+
label: "Website URL",
|
|
353
|
+
confidence: 0.92
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
keywords: ["zip", "zipcode", "postal", "postcode", "pin_code"],
|
|
357
|
+
type: "text",
|
|
358
|
+
validations: [
|
|
359
|
+
{ rule: "pattern", value: "^[0-9]{5}(-[0-9]{4})?$", message: "Enter a valid ZIP code (e.g. 12345)" }
|
|
360
|
+
],
|
|
361
|
+
placeholder: "12345",
|
|
362
|
+
label: "ZIP / Postal Code",
|
|
363
|
+
confidence: 0.91
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
keywords: ["date", "dob", "birthday", "birth_date", "birthdate", "born"],
|
|
367
|
+
type: "date",
|
|
368
|
+
validations: [
|
|
369
|
+
{ rule: "required", message: "Date is required" }
|
|
370
|
+
],
|
|
371
|
+
placeholder: "YYYY-MM-DD",
|
|
372
|
+
label: "Date of Birth",
|
|
373
|
+
confidence: 0.89
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
keywords: ["first_name", "firstname", "fname", "given_name"],
|
|
377
|
+
type: "text",
|
|
378
|
+
validations: [
|
|
379
|
+
{ rule: "minLength", value: 2, message: "First name too short" },
|
|
380
|
+
{ rule: "maxLength", value: 50, message: "First name too long" }
|
|
381
|
+
],
|
|
382
|
+
placeholder: "Jane",
|
|
383
|
+
label: "First Name",
|
|
384
|
+
confidence: 0.9
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
keywords: ["last_name", "lastname", "lname", "surname", "family_name"],
|
|
388
|
+
type: "text",
|
|
389
|
+
validations: [
|
|
390
|
+
{ rule: "minLength", value: 2, message: "Last name too short" },
|
|
391
|
+
{ rule: "maxLength", value: 50, message: "Last name too long" }
|
|
392
|
+
],
|
|
393
|
+
placeholder: "Doe",
|
|
394
|
+
label: "Last Name",
|
|
395
|
+
confidence: 0.9
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
keywords: ["name", "full_name", "fullname", "display_name"],
|
|
399
|
+
type: "text",
|
|
400
|
+
validations: [
|
|
401
|
+
{ rule: "minLength", value: 2, message: "Name too short" },
|
|
402
|
+
{ rule: "maxLength", value: 100, message: "Name too long" }
|
|
403
|
+
],
|
|
404
|
+
placeholder: "Jane Doe",
|
|
405
|
+
label: "Full Name",
|
|
406
|
+
confidence: 0.85
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
keywords: ["username", "user_name", "handle", "login", "loginname"],
|
|
410
|
+
type: "text",
|
|
411
|
+
validations: [
|
|
412
|
+
{ rule: "minLength", value: 3, message: "Username must be at least 3 characters" },
|
|
413
|
+
{ rule: "maxLength", value: 32, message: "Username too long" },
|
|
414
|
+
{ rule: "pattern", value: "^[a-zA-Z0-9_.-]+$", message: "Only letters, numbers, _, - and . allowed" }
|
|
415
|
+
],
|
|
416
|
+
placeholder: "cooluser42",
|
|
417
|
+
label: "Username",
|
|
418
|
+
confidence: 0.94
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
keywords: ["bio", "biography", "about", "description", "summary", "details"],
|
|
422
|
+
type: "textarea",
|
|
423
|
+
validations: [
|
|
424
|
+
{ rule: "maxLength", value: 500, message: "Bio must be under 500 characters" }
|
|
425
|
+
],
|
|
426
|
+
placeholder: "Tell us about yourself...",
|
|
427
|
+
label: "Bio",
|
|
428
|
+
confidence: 0.87
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
keywords: ["message", "comment", "feedback", "note", "notes", "remarks", "body"],
|
|
432
|
+
type: "textarea",
|
|
433
|
+
validations: [
|
|
434
|
+
{ rule: "minLength", value: 10, message: "Message too short" },
|
|
435
|
+
{ rule: "maxLength", value: 2e3, message: "Message too long" }
|
|
436
|
+
],
|
|
437
|
+
placeholder: "Write your message here...",
|
|
438
|
+
label: "Message",
|
|
439
|
+
confidence: 0.86
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
keywords: ["search", "query", "q", "keyword", "find"],
|
|
443
|
+
type: "search",
|
|
444
|
+
validations: [],
|
|
445
|
+
placeholder: "Search...",
|
|
446
|
+
label: "Search",
|
|
447
|
+
confidence: 0.9
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
keywords: ["otp", "one_time_password", "verification_code", "pin", "code"],
|
|
451
|
+
type: "text",
|
|
452
|
+
validations: [
|
|
453
|
+
{ rule: "minLength", value: 4, message: "Code too short" },
|
|
454
|
+
{ rule: "maxLength", value: 8, message: "Code too long" },
|
|
455
|
+
{ rule: "pattern", value: "^[0-9]+$", message: "Code must be numeric" }
|
|
456
|
+
],
|
|
457
|
+
placeholder: "123456",
|
|
458
|
+
label: "Verification Code",
|
|
459
|
+
confidence: 0.92
|
|
460
|
+
},
|
|
461
|
+
{
|
|
462
|
+
keywords: ["color", "colour", "hex_color", "brand_color"],
|
|
463
|
+
type: "color",
|
|
464
|
+
validations: [],
|
|
465
|
+
placeholder: "#3b82f6",
|
|
466
|
+
label: "Color",
|
|
467
|
+
confidence: 0.95
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
keywords: ["address", "street", "street_address", "addr"],
|
|
471
|
+
type: "text",
|
|
472
|
+
validations: [
|
|
473
|
+
{ rule: "maxLength", value: 200, message: "Address too long" }
|
|
474
|
+
],
|
|
475
|
+
placeholder: "123 Main Street",
|
|
476
|
+
label: "Street Address",
|
|
477
|
+
confidence: 0.87
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
keywords: ["city", "town", "municipality"],
|
|
481
|
+
type: "text",
|
|
482
|
+
validations: [
|
|
483
|
+
{ rule: "maxLength", value: 100, message: "City name too long" }
|
|
484
|
+
],
|
|
485
|
+
placeholder: "San Francisco",
|
|
486
|
+
label: "City",
|
|
487
|
+
confidence: 0.89
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
keywords: ["country", "nation", "country_code"],
|
|
491
|
+
type: "text",
|
|
492
|
+
validations: [],
|
|
493
|
+
placeholder: "United States",
|
|
494
|
+
label: "Country",
|
|
495
|
+
confidence: 0.88
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
keywords: ["company", "organization", "org", "employer", "company_name"],
|
|
499
|
+
type: "text",
|
|
500
|
+
validations: [
|
|
501
|
+
{ rule: "maxLength", value: 200, message: "Company name too long" }
|
|
502
|
+
],
|
|
503
|
+
placeholder: "Acme Inc.",
|
|
504
|
+
label: "Company",
|
|
505
|
+
confidence: 0.87
|
|
506
|
+
}
|
|
507
|
+
];
|
|
508
|
+
function ce(r) {
|
|
509
|
+
const e = r.toLowerCase().replace(/[\s-]/g, "_"), i = new ee().amplify(
|
|
510
|
+
te,
|
|
511
|
+
(t) => {
|
|
512
|
+
let l = 0;
|
|
513
|
+
for (const s of t.keywords)
|
|
514
|
+
e === s ? l = Math.max(l, 1) : e.includes(s) || s.includes(e) ? l = Math.max(l, 0.8) : s.split("_").some((d) => e.includes(d)) && (l = Math.max(l, 0.5));
|
|
515
|
+
return l;
|
|
516
|
+
},
|
|
517
|
+
0.3
|
|
518
|
+
);
|
|
519
|
+
if (i.length > 0 && i[0].combined > 0.1) {
|
|
520
|
+
const t = te[i[0].index];
|
|
521
|
+
return {
|
|
522
|
+
type: t.type,
|
|
523
|
+
validations: t.validations,
|
|
524
|
+
placeholder: t.placeholder,
|
|
525
|
+
confidence: Math.min(t.confidence * i[0].combined * 2, 0.99),
|
|
526
|
+
label: t.label
|
|
527
|
+
};
|
|
528
|
+
}
|
|
529
|
+
return {
|
|
530
|
+
type: "text",
|
|
531
|
+
validations: [{ rule: "maxLength", value: 255, message: "Input too long" }],
|
|
532
|
+
placeholder: r.replace(/_/g, " "),
|
|
533
|
+
confidence: 0.3,
|
|
534
|
+
label: r.replace(/_/g, " ").replace(/\b\w/g, (t) => t.toUpperCase())
|
|
535
|
+
};
|
|
536
|
+
}
|
|
537
|
+
function G(r, e, n) {
|
|
538
|
+
const i = e / 100, t = n / 100, l = i * Math.min(t, 1 - t), s = (d) => {
|
|
539
|
+
const o = (d + r / 30) % 12, p = t - l * Math.max(Math.min(o - 3, 9 - o, 1), -1);
|
|
540
|
+
return Math.round(255 * p).toString(16).padStart(2, "0");
|
|
541
|
+
};
|
|
542
|
+
return `#${s(0)}${s(8)}${s(4)}`;
|
|
543
|
+
}
|
|
544
|
+
function me(r) {
|
|
545
|
+
const e = r.replace("#", ""), n = e.length === 3 ? e.split("").map((i) => i + i).join("") : e;
|
|
546
|
+
return [
|
|
547
|
+
parseInt(n.slice(0, 2), 16),
|
|
548
|
+
parseInt(n.slice(2, 4), 16),
|
|
549
|
+
parseInt(n.slice(4, 6), 16)
|
|
550
|
+
];
|
|
551
|
+
}
|
|
552
|
+
function re(r) {
|
|
553
|
+
const [e, n, i] = me(r).map((t) => {
|
|
554
|
+
const l = t / 255;
|
|
555
|
+
return l <= 0.03928 ? l / 12.92 : ((l + 0.055) / 1.055) ** 2.4;
|
|
556
|
+
});
|
|
557
|
+
return 0.2126 * e + 0.7152 * n + 0.0722 * i;
|
|
558
|
+
}
|
|
559
|
+
function U(r, e) {
|
|
560
|
+
const n = re(r), i = re(e), t = Math.max(n, i), l = Math.min(n, i);
|
|
561
|
+
return (t + 0.05) / (l + 0.05);
|
|
562
|
+
}
|
|
563
|
+
function ge(r, e) {
|
|
564
|
+
const n = (t) => G(t.h, t.s, t.l), i = e ? r.text.l - 20 : r.text.l + 15;
|
|
565
|
+
return {
|
|
566
|
+
primary: n(r.primary),
|
|
567
|
+
secondary: n(r.secondary),
|
|
568
|
+
background: n(r.bg),
|
|
569
|
+
surface: n(r.surface),
|
|
570
|
+
text: n(r.text),
|
|
571
|
+
textMuted: G(
|
|
572
|
+
r.text.h,
|
|
573
|
+
Math.max(0, r.text.s - 10),
|
|
574
|
+
Math.max(20, Math.min(85, i))
|
|
575
|
+
),
|
|
576
|
+
border: n(r.border),
|
|
577
|
+
error: e ? "#f87171" : "#dc2626",
|
|
578
|
+
warning: e ? "#fbbf24" : "#d97706",
|
|
579
|
+
success: e ? "#34d399" : "#059669",
|
|
580
|
+
accent: n(r.accent)
|
|
581
|
+
};
|
|
582
|
+
}
|
|
583
|
+
function fe(r, e) {
|
|
584
|
+
let n = 0;
|
|
585
|
+
const i = (k) => G(k.h, k.s, k.l), t = i(r.text), l = i(r.bg), s = i(r.surface), d = i(r.primary), o = U(t, l), p = U(t, s), f = U(d, l);
|
|
586
|
+
o < 4.5 && (n += (4.5 - o) * 10), p < 4.5 && (n += (4.5 - p) * 8), f < 3 && (n += (3 - f) * 5);
|
|
587
|
+
const g = Math.abs((r.secondary.h - r.primary.h + 360) % 360 - 137.508);
|
|
588
|
+
n += g * 0.05;
|
|
589
|
+
const b = Math.abs((r.accent.h - r.primary.h + 360) % 360 - 120);
|
|
590
|
+
n += b * 0.03;
|
|
591
|
+
const h = (r.primary.s + r.secondary.s) / 2;
|
|
592
|
+
h < 20 && (n += (20 - h) * 0.5), h > 90 && (n += (h - 90) * 0.5);
|
|
593
|
+
const v = r.bg.l;
|
|
594
|
+
e ? (v > 25 && (n += (v - 25) * 2), v < 3 && (n += (3 - v) * 2), r.text.l < 70 && (n += (70 - r.text.l) * 1.5)) : (v < 90 && (n += (90 - v) * 2), v > 100 && (n += (v - 100) * 2), r.text.l > 30 && (n += (r.text.l - 30) * 1.5));
|
|
595
|
+
const C = Math.abs(r.surface.l - r.bg.l);
|
|
596
|
+
return C < 2 && (n += (2 - C) * 2), C > 12 && (n += (C - 12) * 1), n;
|
|
597
|
+
}
|
|
598
|
+
function ne(r, e, n) {
|
|
599
|
+
return Math.max(e, Math.min(n, r));
|
|
600
|
+
}
|
|
601
|
+
function ye(r, e, n = 800) {
|
|
602
|
+
const i = e ? {
|
|
603
|
+
primary: { h: r, s: 70, l: 55 },
|
|
604
|
+
secondary: { h: (r + 137.5) % 360, s: 65, l: 50 },
|
|
605
|
+
bg: { h: r, s: 10, l: 8 },
|
|
606
|
+
surface: { h: r, s: 10, l: 13 },
|
|
607
|
+
text: { h: r, s: 15, l: 90 },
|
|
608
|
+
border: { h: r, s: 15, l: 22 },
|
|
609
|
+
accent: { h: (r + 120) % 360, s: 75, l: 60 }
|
|
610
|
+
} : {
|
|
611
|
+
primary: { h: r, s: 65, l: 40 },
|
|
612
|
+
secondary: { h: (r + 137.5) % 360, s: 55, l: 38 },
|
|
613
|
+
bg: { h: r, s: 15, l: 97 },
|
|
614
|
+
surface: { h: r, s: 12, l: 100 },
|
|
615
|
+
text: { h: r, s: 15, l: 12 },
|
|
616
|
+
border: { h: r, s: 12, l: 85 },
|
|
617
|
+
accent: { h: (r + 120) % 360, s: 70, l: 42 }
|
|
618
|
+
}, l = new de(1.5, 0.994, 0.35, 1e-5).anneal(
|
|
619
|
+
i,
|
|
620
|
+
(s) => fe(s, e),
|
|
621
|
+
(s) => {
|
|
622
|
+
const d = ["primary", "secondary", "bg", "surface", "text", "border", "accent"], o = d[Math.floor(Math.random() * d.length)], p = ["h", "s", "l"], f = p[Math.floor(Math.random() * p.length)], m = (Math.random() - 0.5) * (f === "h" ? 30 : 15), g = {
|
|
623
|
+
...s,
|
|
624
|
+
[o]: { ...s[o] }
|
|
625
|
+
};
|
|
626
|
+
return f === "h" ? g[o] = { ...g[o], h: (s[o].h + m + 360) % 360 } : f === "s" ? g[o] = { ...g[o], s: ne(s[o].s + m, 0, 100) } : g[o] = { ...g[o], l: ne(s[o].l + m, 0, 100) }, g;
|
|
627
|
+
},
|
|
628
|
+
n
|
|
629
|
+
);
|
|
630
|
+
return ge(l.state, e);
|
|
631
|
+
}
|
|
632
|
+
const Y = {
|
|
633
|
+
/** Create a single qubit in |0⟩ state */
|
|
634
|
+
qubit() {
|
|
635
|
+
return new _();
|
|
636
|
+
},
|
|
637
|
+
/** Create a quantum register of n qubits */
|
|
638
|
+
register(r) {
|
|
639
|
+
return new ue(r);
|
|
640
|
+
},
|
|
641
|
+
/** Create a quantum annealer */
|
|
642
|
+
annealer(r, e, n) {
|
|
643
|
+
return new de(r, e, n);
|
|
644
|
+
},
|
|
645
|
+
/** Create a Quantum Boltzmann Machine */
|
|
646
|
+
qbm(r, e) {
|
|
647
|
+
return new he(r, e);
|
|
648
|
+
},
|
|
649
|
+
/** Create an amplitude amplifier */
|
|
650
|
+
amplifier() {
|
|
651
|
+
return new ee();
|
|
652
|
+
},
|
|
653
|
+
/** Infer field intelligence from a field name */
|
|
654
|
+
inferField: ce,
|
|
655
|
+
/** Optimize theme colors using quantum annealing */
|
|
656
|
+
optimizeTheme: ye,
|
|
657
|
+
/** Compute WCAG contrast ratio between two hex colors */
|
|
658
|
+
contrast: U,
|
|
659
|
+
/** Convert HSL to hex */
|
|
660
|
+
hslToHex: G
|
|
661
|
+
};
|
|
662
|
+
function xe(r, e, n, i) {
|
|
663
|
+
const t = n.trim();
|
|
664
|
+
switch (r) {
|
|
665
|
+
case "required":
|
|
666
|
+
return t !== "";
|
|
667
|
+
case "email":
|
|
668
|
+
case "pattern":
|
|
669
|
+
if (typeof e == "string")
|
|
670
|
+
try {
|
|
671
|
+
return t === "" || new RegExp(e).test(t);
|
|
672
|
+
} catch {
|
|
673
|
+
return !0;
|
|
674
|
+
}
|
|
675
|
+
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t);
|
|
676
|
+
case "phone":
|
|
677
|
+
return t === "" || /^\+?[\d\s\-()]{7,15}$/.test(t);
|
|
678
|
+
case "url":
|
|
679
|
+
return t === "" || /^https?:\/\/.+/.test(t);
|
|
680
|
+
case "minLength":
|
|
681
|
+
case "min": {
|
|
682
|
+
const l = Number(e ?? 0);
|
|
683
|
+
return t === "" || (isNaN(Number(t)) ? t.length >= l : Number(t) >= l);
|
|
684
|
+
}
|
|
685
|
+
case "maxLength":
|
|
686
|
+
case "max": {
|
|
687
|
+
const l = Number(e ?? 1 / 0);
|
|
688
|
+
return t === "" || (isNaN(Number(t)) ? t.length <= l : Number(t) <= l);
|
|
689
|
+
}
|
|
690
|
+
case "integer":
|
|
691
|
+
return t === "" || /^\d+$/.test(t);
|
|
692
|
+
case "alphanumeric":
|
|
693
|
+
return t === "" || /^[a-zA-Z0-9]+$/.test(t);
|
|
694
|
+
case "match":
|
|
695
|
+
return t === (i[typeof e == "string" ? e : "password"] ?? "");
|
|
696
|
+
default:
|
|
697
|
+
return !0;
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
function be({ phase: r, collapsed: e, primaryColor: n, borderColor: i }) {
|
|
701
|
+
const d = e ? 0 : r, o = e ? 0 : r * 1.618, p = 12 + 10 * Math.sin(d) * Math.cos(o), f = 12 - 10 * Math.cos(d);
|
|
702
|
+
return /* @__PURE__ */ c(
|
|
703
|
+
"svg",
|
|
704
|
+
{
|
|
705
|
+
width: "24",
|
|
706
|
+
height: "24",
|
|
707
|
+
viewBox: "0 0 24 24",
|
|
708
|
+
"aria-hidden": "true",
|
|
709
|
+
style: { flexShrink: 0, opacity: e ? 0.4 : 1, transition: "opacity 0.6s" },
|
|
710
|
+
children: [
|
|
711
|
+
/* @__PURE__ */ a("circle", { cx: 12, cy: 12, r: 10, fill: "none", stroke: i, strokeWidth: "0.8" }),
|
|
712
|
+
/* @__PURE__ */ a("ellipse", { cx: 12, cy: 12, rx: 10, ry: 10 * 0.3, fill: "none", stroke: i, strokeWidth: "0.5", strokeDasharray: "2 2" }),
|
|
713
|
+
/* @__PURE__ */ a("line", { x1: 12, y1: 2, x2: 12, y2: 22, stroke: i, strokeWidth: "0.5" }),
|
|
714
|
+
/* @__PURE__ */ a(
|
|
715
|
+
"line",
|
|
716
|
+
{
|
|
717
|
+
x1: 12,
|
|
718
|
+
y1: 12,
|
|
719
|
+
x2: p,
|
|
720
|
+
y2: f,
|
|
721
|
+
stroke: n,
|
|
722
|
+
strokeWidth: "1.5",
|
|
723
|
+
style: { transition: e ? "all 0.6s ease-out" : "none" }
|
|
724
|
+
}
|
|
725
|
+
),
|
|
726
|
+
/* @__PURE__ */ a(
|
|
727
|
+
"circle",
|
|
728
|
+
{
|
|
729
|
+
cx: p,
|
|
730
|
+
cy: f,
|
|
731
|
+
r: "2",
|
|
732
|
+
fill: n,
|
|
733
|
+
style: { transition: e ? "all 0.6s ease-out" : "none" }
|
|
734
|
+
}
|
|
735
|
+
)
|
|
736
|
+
]
|
|
737
|
+
}
|
|
738
|
+
);
|
|
739
|
+
}
|
|
740
|
+
function ve({
|
|
741
|
+
confidence: r,
|
|
742
|
+
theme: e
|
|
743
|
+
}) {
|
|
744
|
+
const n = Math.round(r * 100), i = n >= 80 ? e.success : n >= 60 ? e.warning : e.danger;
|
|
745
|
+
return /* @__PURE__ */ c(
|
|
746
|
+
"span",
|
|
747
|
+
{
|
|
748
|
+
style: {
|
|
749
|
+
display: "inline-flex",
|
|
750
|
+
alignItems: "center",
|
|
751
|
+
gap: "2px",
|
|
752
|
+
fontSize: "10px",
|
|
753
|
+
fontWeight: 600,
|
|
754
|
+
padding: "1px 5px",
|
|
755
|
+
borderRadius: "999px",
|
|
756
|
+
backgroundColor: `${i}22`,
|
|
757
|
+
color: i,
|
|
758
|
+
border: `1px solid ${i}44`,
|
|
759
|
+
marginLeft: "6px",
|
|
760
|
+
verticalAlign: "middle",
|
|
761
|
+
letterSpacing: "0.03em"
|
|
762
|
+
},
|
|
763
|
+
children: [
|
|
764
|
+
"⚛ ",
|
|
765
|
+
n,
|
|
766
|
+
"%"
|
|
767
|
+
]
|
|
768
|
+
}
|
|
769
|
+
);
|
|
770
|
+
}
|
|
771
|
+
function ke({
|
|
772
|
+
config: r,
|
|
773
|
+
intel: e,
|
|
774
|
+
qubitPhase: n,
|
|
775
|
+
value: i,
|
|
776
|
+
error: t,
|
|
777
|
+
touched: l,
|
|
778
|
+
showConfidence: s,
|
|
779
|
+
showQuantumState: d,
|
|
780
|
+
collapsed: o,
|
|
781
|
+
onChange: p,
|
|
782
|
+
onBlur: f,
|
|
783
|
+
theme: m,
|
|
784
|
+
mounted: g,
|
|
785
|
+
index: b
|
|
786
|
+
}) {
|
|
787
|
+
const h = r.type ?? e.type, v = r.label ?? e.label, C = r.placeholder ?? e.placeholder, k = r.required !== void 0 ? r.required : e.validations.some((L) => L.rule === "required"), P = J(v), F = h === "textarea", w = l && t !== "", $ = `qf-${r.name}`, q = {
|
|
788
|
+
width: "100%",
|
|
789
|
+
padding: "9px 12px",
|
|
790
|
+
border: `1.5px solid ${w ? m.danger : m.border}`,
|
|
791
|
+
borderRadius: "8px",
|
|
792
|
+
backgroundColor: m.surface,
|
|
793
|
+
color: m.text,
|
|
794
|
+
fontSize: "14px",
|
|
795
|
+
fontFamily: "inherit",
|
|
796
|
+
outline: "none",
|
|
797
|
+
boxSizing: "border-box",
|
|
798
|
+
transition: "border-color 0.15s, box-shadow 0.15s",
|
|
799
|
+
resize: F ? "vertical" : void 0,
|
|
800
|
+
minHeight: F ? "80px" : void 0
|
|
801
|
+
};
|
|
802
|
+
return /* @__PURE__ */ c(
|
|
803
|
+
"div",
|
|
804
|
+
{
|
|
805
|
+
style: {
|
|
806
|
+
display: "flex",
|
|
807
|
+
flexDirection: "column",
|
|
808
|
+
gap: "4px",
|
|
809
|
+
opacity: g ? 1 : 0,
|
|
810
|
+
transform: g ? "scaleY(1)" : "scaleY(0.92)",
|
|
811
|
+
transition: `opacity 0.35s ease ${b * 60}ms, transform 0.35s ease ${b * 60}ms`,
|
|
812
|
+
transformOrigin: "top"
|
|
813
|
+
},
|
|
814
|
+
children: [
|
|
815
|
+
/* @__PURE__ */ c("div", { style: { display: "flex", alignItems: "center", gap: "4px" }, children: [
|
|
816
|
+
d && /* @__PURE__ */ a(
|
|
817
|
+
be,
|
|
818
|
+
{
|
|
819
|
+
phase: n,
|
|
820
|
+
collapsed: o,
|
|
821
|
+
primaryColor: m.primary,
|
|
822
|
+
borderColor: m.border
|
|
823
|
+
}
|
|
824
|
+
),
|
|
825
|
+
/* @__PURE__ */ c(
|
|
826
|
+
"label",
|
|
827
|
+
{
|
|
828
|
+
htmlFor: $,
|
|
829
|
+
style: { fontSize: "13px", fontWeight: 500, color: m.text, cursor: "pointer" },
|
|
830
|
+
children: [
|
|
831
|
+
P,
|
|
832
|
+
k && /* @__PURE__ */ a("span", { "aria-hidden": "true", style: { color: m.danger, marginLeft: "3px" }, children: "*" })
|
|
833
|
+
]
|
|
834
|
+
}
|
|
835
|
+
),
|
|
836
|
+
s && /* @__PURE__ */ a(ve, { confidence: e.confidence, theme: m })
|
|
837
|
+
] }),
|
|
838
|
+
F ? /* @__PURE__ */ a(
|
|
839
|
+
"textarea",
|
|
840
|
+
{
|
|
841
|
+
id: $,
|
|
842
|
+
value: i,
|
|
843
|
+
onChange: (L) => p(L.target.value),
|
|
844
|
+
onBlur: f,
|
|
845
|
+
placeholder: C,
|
|
846
|
+
"aria-invalid": w,
|
|
847
|
+
"aria-required": k,
|
|
848
|
+
style: q
|
|
849
|
+
}
|
|
850
|
+
) : /* @__PURE__ */ a(
|
|
851
|
+
"input",
|
|
852
|
+
{
|
|
853
|
+
id: $,
|
|
854
|
+
type: h,
|
|
855
|
+
value: i,
|
|
856
|
+
onChange: (L) => p(L.target.value),
|
|
857
|
+
onBlur: f,
|
|
858
|
+
placeholder: C,
|
|
859
|
+
"aria-invalid": w,
|
|
860
|
+
"aria-required": k,
|
|
861
|
+
style: q
|
|
862
|
+
}
|
|
863
|
+
),
|
|
864
|
+
w && /* @__PURE__ */ c(
|
|
865
|
+
"span",
|
|
866
|
+
{
|
|
867
|
+
role: "alert",
|
|
868
|
+
style: {
|
|
869
|
+
fontSize: "12px",
|
|
870
|
+
color: m.danger,
|
|
871
|
+
display: "flex",
|
|
872
|
+
alignItems: "center",
|
|
873
|
+
gap: "4px"
|
|
874
|
+
},
|
|
875
|
+
children: [
|
|
876
|
+
/* @__PURE__ */ a("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ a("path", { d: "M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z" }) }),
|
|
877
|
+
J(t)
|
|
878
|
+
]
|
|
879
|
+
}
|
|
880
|
+
)
|
|
881
|
+
]
|
|
882
|
+
}
|
|
883
|
+
);
|
|
884
|
+
}
|
|
885
|
+
function we(r) {
|
|
886
|
+
let e = 2166136261;
|
|
887
|
+
for (let n = 0; n < r.length; n++)
|
|
888
|
+
e ^= r.charCodeAt(n), e = Math.imul(e, 16777619) >>> 0;
|
|
889
|
+
return (e & 65535) / 65535 * Math.PI * 2;
|
|
890
|
+
}
|
|
891
|
+
function Se({
|
|
892
|
+
fields: r,
|
|
893
|
+
onSubmit: e,
|
|
894
|
+
submitLabel: n = "Submit",
|
|
895
|
+
layout: i = "vertical",
|
|
896
|
+
showConfidence: t = !0,
|
|
897
|
+
showQuantumState: l = !1
|
|
898
|
+
}) {
|
|
899
|
+
const s = K(), d = r.map((y) => ce(y.name)), [o, p] = A(
|
|
900
|
+
() => Object.fromEntries(r.map((y) => [y.name, ""]))
|
|
901
|
+
), [f, m] = A({}), [g, b] = A({}), [h, v] = A(!1), [C, k] = A(!1), [P, F] = A(!1);
|
|
902
|
+
V(() => {
|
|
903
|
+
const y = requestAnimationFrame(() => k(!0));
|
|
904
|
+
return () => cancelAnimationFrame(y);
|
|
905
|
+
}, []);
|
|
906
|
+
const w = R(
|
|
907
|
+
(y, u) => {
|
|
908
|
+
const x = r.find((z) => z.name === y), M = d[r.findIndex((z) => z.name === y)];
|
|
909
|
+
if (!x || !M) return "";
|
|
910
|
+
const S = u[y] ?? "";
|
|
911
|
+
for (const { rule: z, value: N, message: O } of M.validations)
|
|
912
|
+
if (!(z === "required" && x.required === !1) && !xe(z, N, S, u))
|
|
913
|
+
return O;
|
|
914
|
+
return "";
|
|
915
|
+
},
|
|
916
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
917
|
+
[r]
|
|
918
|
+
), $ = R(
|
|
919
|
+
(y) => {
|
|
920
|
+
const u = {};
|
|
921
|
+
for (const x of r) {
|
|
922
|
+
const M = w(x.name, y);
|
|
923
|
+
M && (u[x.name] = M);
|
|
924
|
+
}
|
|
925
|
+
return u;
|
|
926
|
+
},
|
|
927
|
+
[r, w]
|
|
928
|
+
), q = R(
|
|
929
|
+
(y, u) => {
|
|
930
|
+
p((x) => {
|
|
931
|
+
var S;
|
|
932
|
+
const M = { ...x, [y]: u };
|
|
933
|
+
if (g[y] && (m((z) => ({ ...z, [y]: w(y, M) })), y === "password")) {
|
|
934
|
+
const z = (S = r.find(
|
|
935
|
+
(N) => ["confirmpassword", "confirm_password", "passwordconfirm"].includes(
|
|
936
|
+
N.name.toLowerCase().replace(/[\s_-]/g, "")
|
|
937
|
+
)
|
|
938
|
+
)) == null ? void 0 : S.name;
|
|
939
|
+
z && g[z] && m((N) => ({ ...N, [z]: w(z, M) }));
|
|
940
|
+
}
|
|
941
|
+
return M;
|
|
942
|
+
}), F(!0);
|
|
943
|
+
},
|
|
944
|
+
[r, g, w]
|
|
945
|
+
), L = R(
|
|
946
|
+
(y) => {
|
|
947
|
+
b((u) => ({ ...u, [y]: !0 })), m((u) => ({ ...u, [y]: w(y, o) }));
|
|
948
|
+
},
|
|
949
|
+
[o, w]
|
|
950
|
+
), D = R(
|
|
951
|
+
async (y) => {
|
|
952
|
+
y.preventDefault();
|
|
953
|
+
const u = Object.fromEntries(r.map((M) => [M.name, !0]));
|
|
954
|
+
b(u);
|
|
955
|
+
const x = $(o);
|
|
956
|
+
if (m(x), !(Object.keys(x).length > 0)) {
|
|
957
|
+
v(!0);
|
|
958
|
+
try {
|
|
959
|
+
await e(o);
|
|
960
|
+
} finally {
|
|
961
|
+
v(!1);
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
},
|
|
965
|
+
[r, o, $, e]
|
|
966
|
+
), E = d.length > 0 ? Math.round(
|
|
967
|
+
d.reduce((y, u) => y + u.confidence, 0) / d.length * 100
|
|
968
|
+
) : 0, I = E >= 80 ? s.success : E >= 60 ? s.warning : s.danger, j = i === "horizontal";
|
|
969
|
+
return /* @__PURE__ */ c(
|
|
970
|
+
"form",
|
|
971
|
+
{
|
|
972
|
+
onSubmit: D,
|
|
973
|
+
noValidate: !0,
|
|
974
|
+
className: le("w-full"),
|
|
975
|
+
style: {
|
|
976
|
+
backgroundColor: s.surface,
|
|
977
|
+
border: `1px solid ${s.border}`,
|
|
978
|
+
borderRadius: "12px",
|
|
979
|
+
padding: "24px",
|
|
980
|
+
position: "relative",
|
|
981
|
+
boxSizing: "border-box"
|
|
982
|
+
},
|
|
983
|
+
children: [
|
|
984
|
+
/* @__PURE__ */ a(
|
|
985
|
+
"span",
|
|
986
|
+
{
|
|
987
|
+
"aria-label": "Powered by Quantum AI",
|
|
988
|
+
style: {
|
|
989
|
+
position: "absolute",
|
|
990
|
+
top: "16px",
|
|
991
|
+
right: "16px",
|
|
992
|
+
fontSize: "10px",
|
|
993
|
+
fontWeight: 700,
|
|
994
|
+
padding: "3px 8px",
|
|
995
|
+
borderRadius: "999px",
|
|
996
|
+
backgroundColor: `${s.primary}20`,
|
|
997
|
+
color: s.primary,
|
|
998
|
+
border: `1px solid ${s.primary}44`,
|
|
999
|
+
letterSpacing: "0.04em",
|
|
1000
|
+
userSelect: "none"
|
|
1001
|
+
},
|
|
1002
|
+
children: "⚛ Quantum AI"
|
|
1003
|
+
}
|
|
1004
|
+
),
|
|
1005
|
+
t && /* @__PURE__ */ c("div", { style: { marginBottom: "20px", paddingRight: "100px" }, children: [
|
|
1006
|
+
/* @__PURE__ */ c(
|
|
1007
|
+
"div",
|
|
1008
|
+
{
|
|
1009
|
+
style: {
|
|
1010
|
+
display: "flex",
|
|
1011
|
+
alignItems: "center",
|
|
1012
|
+
justifyContent: "space-between",
|
|
1013
|
+
marginBottom: "4px"
|
|
1014
|
+
},
|
|
1015
|
+
children: [
|
|
1016
|
+
/* @__PURE__ */ a("span", { style: { fontSize: "11px", color: s.textMuted, fontWeight: 500 }, children: "Form Intelligence Confidence" }),
|
|
1017
|
+
/* @__PURE__ */ c("span", { style: { fontSize: "11px", fontWeight: 700, color: I }, children: [
|
|
1018
|
+
E,
|
|
1019
|
+
"%"
|
|
1020
|
+
] })
|
|
1021
|
+
]
|
|
1022
|
+
}
|
|
1023
|
+
),
|
|
1024
|
+
/* @__PURE__ */ a(
|
|
1025
|
+
"div",
|
|
1026
|
+
{
|
|
1027
|
+
style: {
|
|
1028
|
+
height: "4px",
|
|
1029
|
+
borderRadius: "4px",
|
|
1030
|
+
backgroundColor: s.border,
|
|
1031
|
+
overflow: "hidden"
|
|
1032
|
+
},
|
|
1033
|
+
children: /* @__PURE__ */ a(
|
|
1034
|
+
"div",
|
|
1035
|
+
{
|
|
1036
|
+
style: {
|
|
1037
|
+
height: "100%",
|
|
1038
|
+
width: `${E}%`,
|
|
1039
|
+
backgroundColor: I,
|
|
1040
|
+
borderRadius: "4px",
|
|
1041
|
+
transition: "width 0.8s ease"
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
)
|
|
1045
|
+
}
|
|
1046
|
+
)
|
|
1047
|
+
] }),
|
|
1048
|
+
/* @__PURE__ */ a(
|
|
1049
|
+
"div",
|
|
1050
|
+
{
|
|
1051
|
+
style: {
|
|
1052
|
+
display: "grid",
|
|
1053
|
+
gridTemplateColumns: j ? "repeat(auto-fill, minmax(260px, 1fr))" : "1fr",
|
|
1054
|
+
gap: "16px",
|
|
1055
|
+
marginBottom: "20px"
|
|
1056
|
+
},
|
|
1057
|
+
children: r.map((y, u) => /* @__PURE__ */ a(
|
|
1058
|
+
ke,
|
|
1059
|
+
{
|
|
1060
|
+
config: y,
|
|
1061
|
+
intel: d[u],
|
|
1062
|
+
qubitPhase: we(y.name),
|
|
1063
|
+
value: o[y.name] ?? "",
|
|
1064
|
+
error: f[y.name] ?? "",
|
|
1065
|
+
touched: g[y.name] ?? !1,
|
|
1066
|
+
showConfidence: t,
|
|
1067
|
+
showQuantumState: l,
|
|
1068
|
+
collapsed: P,
|
|
1069
|
+
onChange: (x) => q(y.name, x),
|
|
1070
|
+
onBlur: () => L(y.name),
|
|
1071
|
+
theme: s,
|
|
1072
|
+
mounted: C,
|
|
1073
|
+
index: u
|
|
1074
|
+
},
|
|
1075
|
+
y.name
|
|
1076
|
+
))
|
|
1077
|
+
}
|
|
1078
|
+
),
|
|
1079
|
+
/* @__PURE__ */ a(
|
|
1080
|
+
"button",
|
|
1081
|
+
{
|
|
1082
|
+
type: "submit",
|
|
1083
|
+
disabled: h,
|
|
1084
|
+
style: {
|
|
1085
|
+
width: "100%",
|
|
1086
|
+
padding: "10px 20px",
|
|
1087
|
+
borderRadius: "8px",
|
|
1088
|
+
border: "none",
|
|
1089
|
+
backgroundColor: h ? `${s.primary}88` : s.primary,
|
|
1090
|
+
color: s.bg,
|
|
1091
|
+
fontSize: "14px",
|
|
1092
|
+
fontWeight: 700,
|
|
1093
|
+
fontFamily: "inherit",
|
|
1094
|
+
cursor: h ? "not-allowed" : "pointer",
|
|
1095
|
+
transition: "background-color 0.15s, opacity 0.15s",
|
|
1096
|
+
display: "flex",
|
|
1097
|
+
alignItems: "center",
|
|
1098
|
+
justifyContent: "center",
|
|
1099
|
+
gap: "8px"
|
|
1100
|
+
},
|
|
1101
|
+
children: h ? /* @__PURE__ */ c(pe, { children: [
|
|
1102
|
+
/* @__PURE__ */ c(
|
|
1103
|
+
"svg",
|
|
1104
|
+
{
|
|
1105
|
+
width: "14",
|
|
1106
|
+
height: "14",
|
|
1107
|
+
viewBox: "0 0 24 24",
|
|
1108
|
+
fill: "none",
|
|
1109
|
+
stroke: "currentColor",
|
|
1110
|
+
strokeWidth: "2.5",
|
|
1111
|
+
style: { animation: "qf-spin 0.8s linear infinite" },
|
|
1112
|
+
"aria-hidden": "true",
|
|
1113
|
+
children: [
|
|
1114
|
+
/* @__PURE__ */ a("circle", { cx: "12", cy: "12", r: "10", strokeOpacity: "0.25" }),
|
|
1115
|
+
/* @__PURE__ */ a("path", { d: "M12 2a10 10 0 0 1 10 10" })
|
|
1116
|
+
]
|
|
1117
|
+
}
|
|
1118
|
+
),
|
|
1119
|
+
"Processing…"
|
|
1120
|
+
] }) : J(n)
|
|
1121
|
+
}
|
|
1122
|
+
),
|
|
1123
|
+
/* @__PURE__ */ a("style", { children: "@keyframes qf-spin { to { transform: rotate(360deg); } }" })
|
|
1124
|
+
]
|
|
1125
|
+
}
|
|
1126
|
+
);
|
|
1127
|
+
}
|
|
1128
|
+
Se.displayName = "TkxQuantumForm";
|
|
1129
|
+
function oe(r) {
|
|
1130
|
+
return r ? {
|
|
1131
|
+
primary: "#00f5d4",
|
|
1132
|
+
secondary: "#7b2ff7",
|
|
1133
|
+
background: "#0a0a0f",
|
|
1134
|
+
surface: "#12121a",
|
|
1135
|
+
text: "#e8e8f4",
|
|
1136
|
+
textMuted: "#8888aa",
|
|
1137
|
+
border: "#2a2a3e",
|
|
1138
|
+
error: "#f87171",
|
|
1139
|
+
warning: "#fbbf24",
|
|
1140
|
+
success: "#34d399",
|
|
1141
|
+
accent: "#ff6b6b"
|
|
1142
|
+
} : {
|
|
1143
|
+
primary: "#0d7c5f",
|
|
1144
|
+
secondary: "#6930c3",
|
|
1145
|
+
background: "#f8f6f1",
|
|
1146
|
+
surface: "#ffffff",
|
|
1147
|
+
text: "#1a1815",
|
|
1148
|
+
textMuted: "#6b6560",
|
|
1149
|
+
border: "#ddd8cc",
|
|
1150
|
+
error: "#dc2626",
|
|
1151
|
+
warning: "#d97706",
|
|
1152
|
+
success: "#059669",
|
|
1153
|
+
accent: "#e05a00"
|
|
1154
|
+
};
|
|
1155
|
+
}
|
|
1156
|
+
function Ce({ points: r, primary: e }) {
|
|
1157
|
+
if (r.length < 2)
|
|
1158
|
+
return /* @__PURE__ */ a("div", { style: { height: 48, display: "flex", alignItems: "center", justifyContent: "center", color: "#888", fontSize: 12 }, children: "Waiting for data..." });
|
|
1159
|
+
const n = 280, i = 48, t = Math.max(...r.map((p) => p.energy)), l = Math.min(...r.map((p) => p.energy)), s = t - l || 1, d = r[r.length - 1].iteration || 1, o = r.map((p) => {
|
|
1160
|
+
const f = p.iteration / d * n, m = i - (p.energy - l) / s * (i - 4) - 2;
|
|
1161
|
+
return `${f.toFixed(1)},${m.toFixed(1)}`;
|
|
1162
|
+
}).join(" ");
|
|
1163
|
+
return /* @__PURE__ */ c("svg", { width: n, height: i, style: { display: "block" }, children: [
|
|
1164
|
+
/* @__PURE__ */ a(
|
|
1165
|
+
"polyline",
|
|
1166
|
+
{
|
|
1167
|
+
points: o,
|
|
1168
|
+
fill: "none",
|
|
1169
|
+
stroke: e,
|
|
1170
|
+
strokeWidth: 1.5,
|
|
1171
|
+
strokeLinecap: "round",
|
|
1172
|
+
strokeLinejoin: "round",
|
|
1173
|
+
opacity: 0.9
|
|
1174
|
+
}
|
|
1175
|
+
),
|
|
1176
|
+
/* @__PURE__ */ c("text", { x: 2, y: 10, fontSize: 9, fill: "#888", children: [
|
|
1177
|
+
"E=",
|
|
1178
|
+
t.toFixed(1)
|
|
1179
|
+
] }),
|
|
1180
|
+
/* @__PURE__ */ c("text", { x: 2, y: i - 2, fontSize: 9, fill: "#888", children: [
|
|
1181
|
+
"E=",
|
|
1182
|
+
l.toFixed(1)
|
|
1183
|
+
] })
|
|
1184
|
+
] });
|
|
1185
|
+
}
|
|
1186
|
+
function Me({ label: r, value: e, onChange: n, text: i, border: t }) {
|
|
1187
|
+
return /* @__PURE__ */ c("div", { style: { display: "flex", alignItems: "center", gap: 8, marginBottom: 6 }, children: [
|
|
1188
|
+
/* @__PURE__ */ a(
|
|
1189
|
+
"input",
|
|
1190
|
+
{
|
|
1191
|
+
type: "color",
|
|
1192
|
+
value: e,
|
|
1193
|
+
onChange: (l) => n(l.target.value),
|
|
1194
|
+
style: {
|
|
1195
|
+
width: 32,
|
|
1196
|
+
height: 32,
|
|
1197
|
+
border: `1px solid ${t}`,
|
|
1198
|
+
borderRadius: 6,
|
|
1199
|
+
padding: 2,
|
|
1200
|
+
cursor: "pointer",
|
|
1201
|
+
background: "transparent"
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
),
|
|
1205
|
+
/* @__PURE__ */ a(
|
|
1206
|
+
"div",
|
|
1207
|
+
{
|
|
1208
|
+
style: {
|
|
1209
|
+
width: 60,
|
|
1210
|
+
height: 28,
|
|
1211
|
+
borderRadius: 6,
|
|
1212
|
+
background: e,
|
|
1213
|
+
border: `1px solid ${t}`
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
),
|
|
1217
|
+
/* @__PURE__ */ a("span", { style: { flex: 1, fontSize: 13, color: i, fontFamily: "monospace" }, children: r }),
|
|
1218
|
+
/* @__PURE__ */ a("code", { style: { fontSize: 12, color: i, opacity: 0.7, fontFamily: "monospace" }, children: e })
|
|
1219
|
+
] });
|
|
1220
|
+
}
|
|
1221
|
+
function ze({ label: r, ratio: e }) {
|
|
1222
|
+
const n = e >= 4.5, i = e >= 4.5, t = e >= 7;
|
|
1223
|
+
return /* @__PURE__ */ c("div", { style: { display: "flex", alignItems: "center", gap: 6, marginBottom: 4 }, children: [
|
|
1224
|
+
/* @__PURE__ */ a("span", { style: { fontSize: 11, opacity: 0.8, minWidth: 140 }, children: r }),
|
|
1225
|
+
/* @__PURE__ */ c("span", { style: { fontSize: 12, fontWeight: 600 }, children: [
|
|
1226
|
+
e.toFixed(2),
|
|
1227
|
+
":1"
|
|
1228
|
+
] }),
|
|
1229
|
+
/* @__PURE__ */ a("span", { style: { fontSize: 11, color: i ? "#22c55e" : "#ef4444" }, children: i ? "✓ AA" : "✗ AA" }),
|
|
1230
|
+
/* @__PURE__ */ a("span", { style: { fontSize: 11, color: t ? "#22c55e" : "#888" }, children: t ? "✓ AAA" : "— AAA" }),
|
|
1231
|
+
/* @__PURE__ */ a("span", { style: { fontSize: 13 }, children: n ? "✅" : "❌" })
|
|
1232
|
+
] });
|
|
1233
|
+
}
|
|
1234
|
+
function Ne({
|
|
1235
|
+
onThemeChange: r,
|
|
1236
|
+
initialHue: e = 210,
|
|
1237
|
+
initialMode: n = "dark"
|
|
1238
|
+
}) {
|
|
1239
|
+
const i = K(), [t, l] = A(n), [s, d] = A(e), [o, p] = A(() => oe(n === "dark")), [f, m] = A(!1), [g, b] = A([]), [h, v] = A(!1), C = X(null), k = t === "dark", P = R(
|
|
1240
|
+
(u, x) => {
|
|
1241
|
+
p((M) => {
|
|
1242
|
+
const S = { ...M, [u]: x };
|
|
1243
|
+
return r == null || r(S), S;
|
|
1244
|
+
});
|
|
1245
|
+
},
|
|
1246
|
+
[r]
|
|
1247
|
+
), F = R(() => {
|
|
1248
|
+
if (f) return;
|
|
1249
|
+
m(!0), b([]);
|
|
1250
|
+
let u = 0;
|
|
1251
|
+
const x = 600, M = 60, S = [], z = () => {
|
|
1252
|
+
u += M, Y.optimizeTheme(s, k, u);
|
|
1253
|
+
const N = u / x, O = 50 * (1 - N) + 2, Q = (Math.random() - 0.5) * 8 * (1 - N * 0.8);
|
|
1254
|
+
if (S.push({ iteration: u, energy: Math.max(0, O + Q) }), b([...S]), u < x)
|
|
1255
|
+
C.current = window.setTimeout(z, 40);
|
|
1256
|
+
else {
|
|
1257
|
+
const T = Y.optimizeTheme(s, k, 1e3);
|
|
1258
|
+
p(T), r == null || r(T), m(!1);
|
|
1259
|
+
}
|
|
1260
|
+
};
|
|
1261
|
+
C.current = window.setTimeout(z, 16);
|
|
1262
|
+
}, [s, k, f, r]), w = R(() => {
|
|
1263
|
+
const u = t === "dark" ? "light" : "dark";
|
|
1264
|
+
l(u);
|
|
1265
|
+
const x = oe(u === "dark");
|
|
1266
|
+
p(x), r == null || r(x);
|
|
1267
|
+
}, [t, r]), $ = R(() => {
|
|
1268
|
+
const u = `export const myTheme = {
|
|
1269
|
+
${Object.entries(o).map(([x, M]) => ` ${x}: '${M}',`).join(`
|
|
1270
|
+
`)}
|
|
1271
|
+
};`;
|
|
1272
|
+
typeof navigator < "u" && navigator.clipboard && navigator.clipboard.writeText(u).then(() => {
|
|
1273
|
+
v(!0), setTimeout(() => v(!1), 2e3);
|
|
1274
|
+
});
|
|
1275
|
+
}, [o]), q = [
|
|
1276
|
+
{ label: "Text on Background", fg: o.text, bg: o.background },
|
|
1277
|
+
{ label: "Text on Surface", fg: o.text, bg: o.surface },
|
|
1278
|
+
{ label: "Primary on Background", fg: o.primary, bg: o.background },
|
|
1279
|
+
{ label: "TextMuted on Background", fg: o.textMuted, bg: o.background }
|
|
1280
|
+
], L = "linear-gradient(to right," + [
|
|
1281
|
+
"hsl(0,80%,55%)",
|
|
1282
|
+
"hsl(30,80%,55%)",
|
|
1283
|
+
"hsl(60,80%,55%)",
|
|
1284
|
+
"hsl(90,80%,55%)",
|
|
1285
|
+
"hsl(120,80%,55%)",
|
|
1286
|
+
"hsl(150,80%,55%)",
|
|
1287
|
+
"hsl(180,80%,55%)",
|
|
1288
|
+
"hsl(210,80%,55%)",
|
|
1289
|
+
"hsl(240,80%,55%)",
|
|
1290
|
+
"hsl(270,80%,55%)",
|
|
1291
|
+
"hsl(300,80%,55%)",
|
|
1292
|
+
"hsl(330,80%,55%)",
|
|
1293
|
+
"hsl(360,80%,55%)"
|
|
1294
|
+
].join(",") + ")", D = {
|
|
1295
|
+
fontFamily: "system-ui, -apple-system, sans-serif",
|
|
1296
|
+
background: o.background,
|
|
1297
|
+
color: o.text,
|
|
1298
|
+
border: `1px solid ${o.border}`,
|
|
1299
|
+
borderRadius: 12,
|
|
1300
|
+
padding: 20,
|
|
1301
|
+
maxWidth: 900,
|
|
1302
|
+
display: "grid",
|
|
1303
|
+
gridTemplateColumns: "1fr 1fr",
|
|
1304
|
+
gap: 20
|
|
1305
|
+
}, E = {
|
|
1306
|
+
background: o.surface,
|
|
1307
|
+
border: `1px solid ${o.border}`,
|
|
1308
|
+
borderRadius: 8,
|
|
1309
|
+
padding: 16
|
|
1310
|
+
}, I = {
|
|
1311
|
+
fontSize: 13,
|
|
1312
|
+
fontWeight: 700,
|
|
1313
|
+
textTransform: "uppercase",
|
|
1314
|
+
letterSpacing: "0.08em",
|
|
1315
|
+
color: o.primary,
|
|
1316
|
+
marginBottom: 12,
|
|
1317
|
+
marginTop: 0
|
|
1318
|
+
}, j = {
|
|
1319
|
+
padding: "8px 16px",
|
|
1320
|
+
borderRadius: 8,
|
|
1321
|
+
border: "none",
|
|
1322
|
+
cursor: "pointer",
|
|
1323
|
+
fontWeight: 600,
|
|
1324
|
+
fontSize: 13,
|
|
1325
|
+
transition: "opacity 0.15s"
|
|
1326
|
+
}, y = le;
|
|
1327
|
+
return /* @__PURE__ */ c("div", { style: D, children: [
|
|
1328
|
+
/* @__PURE__ */ c("div", { style: { display: "flex", flexDirection: "column", gap: 16 }, children: [
|
|
1329
|
+
/* @__PURE__ */ c("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gridColumn: "1/-1" }, children: [
|
|
1330
|
+
/* @__PURE__ */ c("div", { children: [
|
|
1331
|
+
/* @__PURE__ */ a("h2", { style: { margin: 0, fontSize: 18, fontWeight: 700 }, children: "Theme Builder" }),
|
|
1332
|
+
/* @__PURE__ */ a("p", { style: { margin: "2px 0 0", fontSize: 12, color: o.textMuted }, children: "Quantum-powered color optimization" })
|
|
1333
|
+
] }),
|
|
1334
|
+
/* @__PURE__ */ a(
|
|
1335
|
+
"button",
|
|
1336
|
+
{
|
|
1337
|
+
onClick: w,
|
|
1338
|
+
style: {
|
|
1339
|
+
...j,
|
|
1340
|
+
background: o.surface,
|
|
1341
|
+
color: o.text,
|
|
1342
|
+
border: `1px solid ${o.border}`
|
|
1343
|
+
},
|
|
1344
|
+
children: k ? "☀ Light" : "🌙 Dark"
|
|
1345
|
+
}
|
|
1346
|
+
)
|
|
1347
|
+
] }),
|
|
1348
|
+
/* @__PURE__ */ c("div", { style: E, children: [
|
|
1349
|
+
/* @__PURE__ */ a("p", { style: I, children: "Base Hue" }),
|
|
1350
|
+
/* @__PURE__ */ c("div", { style: { display: "flex", alignItems: "center", gap: 10 }, children: [
|
|
1351
|
+
/* @__PURE__ */ a(
|
|
1352
|
+
"div",
|
|
1353
|
+
{
|
|
1354
|
+
style: {
|
|
1355
|
+
width: 24,
|
|
1356
|
+
height: 24,
|
|
1357
|
+
borderRadius: "50%",
|
|
1358
|
+
background: `hsl(${s},70%,55%)`,
|
|
1359
|
+
border: `2px solid ${o.border}`,
|
|
1360
|
+
flexShrink: 0
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1363
|
+
),
|
|
1364
|
+
/* @__PURE__ */ a(
|
|
1365
|
+
"input",
|
|
1366
|
+
{
|
|
1367
|
+
type: "range",
|
|
1368
|
+
min: 0,
|
|
1369
|
+
max: 360,
|
|
1370
|
+
value: s,
|
|
1371
|
+
onChange: (u) => d(Number(u.target.value)),
|
|
1372
|
+
style: {
|
|
1373
|
+
flex: 1,
|
|
1374
|
+
height: 16,
|
|
1375
|
+
borderRadius: 8,
|
|
1376
|
+
background: L,
|
|
1377
|
+
outline: "none",
|
|
1378
|
+
border: "none",
|
|
1379
|
+
cursor: "pointer",
|
|
1380
|
+
appearance: "none",
|
|
1381
|
+
WebkitAppearance: "none"
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
),
|
|
1385
|
+
/* @__PURE__ */ c("span", { style: { fontSize: 13, fontFamily: "monospace", minWidth: 32 }, children: [
|
|
1386
|
+
s,
|
|
1387
|
+
"°"
|
|
1388
|
+
] })
|
|
1389
|
+
] })
|
|
1390
|
+
] }),
|
|
1391
|
+
/* @__PURE__ */ c("div", { style: E, children: [
|
|
1392
|
+
/* @__PURE__ */ c("div", { style: { display: "flex", alignItems: "center", gap: 8, marginBottom: 10 }, children: [
|
|
1393
|
+
/* @__PURE__ */ a(
|
|
1394
|
+
"button",
|
|
1395
|
+
{
|
|
1396
|
+
onClick: F,
|
|
1397
|
+
disabled: f,
|
|
1398
|
+
style: {
|
|
1399
|
+
...j,
|
|
1400
|
+
background: f ? o.border : o.primary,
|
|
1401
|
+
color: k ? "#000" : "#fff",
|
|
1402
|
+
opacity: f ? 0.7 : 1,
|
|
1403
|
+
flex: 1
|
|
1404
|
+
},
|
|
1405
|
+
children: f ? "⟳ Optimizing..." : "⚛ Generate with Quantum Annealing"
|
|
1406
|
+
}
|
|
1407
|
+
),
|
|
1408
|
+
/* @__PURE__ */ a(
|
|
1409
|
+
"div",
|
|
1410
|
+
{
|
|
1411
|
+
style: {
|
|
1412
|
+
padding: "3px 8px",
|
|
1413
|
+
background: o.primary + "22",
|
|
1414
|
+
border: `1px solid ${o.primary}44`,
|
|
1415
|
+
borderRadius: 20,
|
|
1416
|
+
fontSize: 10,
|
|
1417
|
+
color: o.primary,
|
|
1418
|
+
fontWeight: 700,
|
|
1419
|
+
whiteSpace: "nowrap"
|
|
1420
|
+
},
|
|
1421
|
+
children: "⚛ Quantum Annealing"
|
|
1422
|
+
}
|
|
1423
|
+
)
|
|
1424
|
+
] }),
|
|
1425
|
+
(f || g.length > 0) && /* @__PURE__ */ c("div", { children: [
|
|
1426
|
+
/* @__PURE__ */ a("p", { style: { fontSize: 11, color: o.textMuted, margin: "0 0 4px" }, children: "Energy landscape (lower = better palette)" }),
|
|
1427
|
+
/* @__PURE__ */ a(Ce, { points: g, primary: o.primary })
|
|
1428
|
+
] })
|
|
1429
|
+
] }),
|
|
1430
|
+
/* @__PURE__ */ c("div", { style: E, children: [
|
|
1431
|
+
/* @__PURE__ */ a("p", { style: I, children: "Color Tokens" }),
|
|
1432
|
+
Object.keys(o).map((u) => /* @__PURE__ */ a(
|
|
1433
|
+
Me,
|
|
1434
|
+
{
|
|
1435
|
+
label: u,
|
|
1436
|
+
value: o[u],
|
|
1437
|
+
onChange: (x) => P(u, x),
|
|
1438
|
+
text: o.text,
|
|
1439
|
+
border: o.border
|
|
1440
|
+
},
|
|
1441
|
+
u
|
|
1442
|
+
))
|
|
1443
|
+
] }),
|
|
1444
|
+
/* @__PURE__ */ a(
|
|
1445
|
+
"button",
|
|
1446
|
+
{
|
|
1447
|
+
onClick: $,
|
|
1448
|
+
style: {
|
|
1449
|
+
...j,
|
|
1450
|
+
background: o.accent,
|
|
1451
|
+
color: "#fff",
|
|
1452
|
+
width: "100%"
|
|
1453
|
+
},
|
|
1454
|
+
children: h ? "✓ Copied to Clipboard!" : "⬇ Export Theme"
|
|
1455
|
+
}
|
|
1456
|
+
)
|
|
1457
|
+
] }),
|
|
1458
|
+
/* @__PURE__ */ c("div", { style: { display: "flex", flexDirection: "column", gap: 16 }, children: [
|
|
1459
|
+
/* @__PURE__ */ c("div", { style: E, children: [
|
|
1460
|
+
/* @__PURE__ */ a("p", { style: I, children: "Live Preview" }),
|
|
1461
|
+
/* @__PURE__ */ c("div", { style: { marginBottom: 12 }, children: [
|
|
1462
|
+
/* @__PURE__ */ a("p", { style: { fontSize: 11, color: o.textMuted, margin: "0 0 6px" }, children: "Buttons" }),
|
|
1463
|
+
/* @__PURE__ */ c("div", { style: { display: "flex", gap: 8, flexWrap: "wrap" }, children: [
|
|
1464
|
+
/* @__PURE__ */ a(
|
|
1465
|
+
"button",
|
|
1466
|
+
{
|
|
1467
|
+
style: {
|
|
1468
|
+
padding: "8px 16px",
|
|
1469
|
+
borderRadius: 8,
|
|
1470
|
+
border: "none",
|
|
1471
|
+
background: o.primary,
|
|
1472
|
+
color: k ? "#000" : "#fff",
|
|
1473
|
+
fontWeight: 600,
|
|
1474
|
+
fontSize: 13,
|
|
1475
|
+
cursor: "pointer"
|
|
1476
|
+
},
|
|
1477
|
+
children: "Primary"
|
|
1478
|
+
}
|
|
1479
|
+
),
|
|
1480
|
+
/* @__PURE__ */ a(
|
|
1481
|
+
"button",
|
|
1482
|
+
{
|
|
1483
|
+
style: {
|
|
1484
|
+
padding: "8px 16px",
|
|
1485
|
+
borderRadius: 8,
|
|
1486
|
+
border: "none",
|
|
1487
|
+
background: o.secondary,
|
|
1488
|
+
color: "#fff",
|
|
1489
|
+
fontWeight: 600,
|
|
1490
|
+
fontSize: 13,
|
|
1491
|
+
cursor: "pointer"
|
|
1492
|
+
},
|
|
1493
|
+
children: "Secondary"
|
|
1494
|
+
}
|
|
1495
|
+
),
|
|
1496
|
+
/* @__PURE__ */ a(
|
|
1497
|
+
"button",
|
|
1498
|
+
{
|
|
1499
|
+
style: {
|
|
1500
|
+
padding: "8px 16px",
|
|
1501
|
+
borderRadius: 8,
|
|
1502
|
+
border: `1px solid ${o.border}`,
|
|
1503
|
+
background: "transparent",
|
|
1504
|
+
color: o.text,
|
|
1505
|
+
fontWeight: 600,
|
|
1506
|
+
fontSize: 13,
|
|
1507
|
+
cursor: "pointer"
|
|
1508
|
+
},
|
|
1509
|
+
children: "Outline"
|
|
1510
|
+
}
|
|
1511
|
+
)
|
|
1512
|
+
] })
|
|
1513
|
+
] }),
|
|
1514
|
+
/* @__PURE__ */ c("div", { style: { marginBottom: 12 }, children: [
|
|
1515
|
+
/* @__PURE__ */ a("p", { style: { fontSize: 11, color: o.textMuted, margin: "0 0 6px" }, children: "Card" }),
|
|
1516
|
+
/* @__PURE__ */ c(
|
|
1517
|
+
"div",
|
|
1518
|
+
{
|
|
1519
|
+
style: {
|
|
1520
|
+
background: o.surface,
|
|
1521
|
+
border: `1px solid ${o.border}`,
|
|
1522
|
+
borderRadius: 8,
|
|
1523
|
+
padding: 12
|
|
1524
|
+
},
|
|
1525
|
+
children: [
|
|
1526
|
+
/* @__PURE__ */ a("div", { style: { fontSize: 14, fontWeight: 700, marginBottom: 4 }, children: "Card Title" }),
|
|
1527
|
+
/* @__PURE__ */ a("div", { style: { fontSize: 12, color: o.textMuted, lineHeight: 1.4 }, children: "Sample card with surface background and muted text content." }),
|
|
1528
|
+
/* @__PURE__ */ c("div", { style: { marginTop: 8, display: "flex", gap: 6 }, children: [
|
|
1529
|
+
/* @__PURE__ */ a(
|
|
1530
|
+
"span",
|
|
1531
|
+
{
|
|
1532
|
+
style: {
|
|
1533
|
+
padding: "2px 8px",
|
|
1534
|
+
borderRadius: 20,
|
|
1535
|
+
background: o.primary + "33",
|
|
1536
|
+
color: o.primary,
|
|
1537
|
+
fontSize: 11,
|
|
1538
|
+
fontWeight: 600
|
|
1539
|
+
},
|
|
1540
|
+
children: "Tag"
|
|
1541
|
+
}
|
|
1542
|
+
),
|
|
1543
|
+
/* @__PURE__ */ a(
|
|
1544
|
+
"span",
|
|
1545
|
+
{
|
|
1546
|
+
style: {
|
|
1547
|
+
padding: "2px 8px",
|
|
1548
|
+
borderRadius: 20,
|
|
1549
|
+
background: o.accent + "33",
|
|
1550
|
+
color: o.accent,
|
|
1551
|
+
fontSize: 11,
|
|
1552
|
+
fontWeight: 600
|
|
1553
|
+
},
|
|
1554
|
+
children: "Accent"
|
|
1555
|
+
}
|
|
1556
|
+
)
|
|
1557
|
+
] })
|
|
1558
|
+
]
|
|
1559
|
+
}
|
|
1560
|
+
)
|
|
1561
|
+
] }),
|
|
1562
|
+
/* @__PURE__ */ c("div", { style: { marginBottom: 12 }, children: [
|
|
1563
|
+
/* @__PURE__ */ a("p", { style: { fontSize: 11, color: o.textMuted, margin: "0 0 6px" }, children: "Input" }),
|
|
1564
|
+
/* @__PURE__ */ a(
|
|
1565
|
+
"input",
|
|
1566
|
+
{
|
|
1567
|
+
type: "text",
|
|
1568
|
+
placeholder: "Type something...",
|
|
1569
|
+
readOnly: !0,
|
|
1570
|
+
style: {
|
|
1571
|
+
width: "100%",
|
|
1572
|
+
padding: "8px 12px",
|
|
1573
|
+
borderRadius: 8,
|
|
1574
|
+
border: `1px solid ${o.border}`,
|
|
1575
|
+
background: o.background,
|
|
1576
|
+
color: o.text,
|
|
1577
|
+
fontSize: 13,
|
|
1578
|
+
outline: "none",
|
|
1579
|
+
boxSizing: "border-box"
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
)
|
|
1583
|
+
] }),
|
|
1584
|
+
/* @__PURE__ */ c("div", { style: { marginBottom: 12 }, children: [
|
|
1585
|
+
/* @__PURE__ */ a("p", { style: { fontSize: 11, color: o.textMuted, margin: "0 0 6px" }, children: "Progress" }),
|
|
1586
|
+
/* @__PURE__ */ a(
|
|
1587
|
+
"div",
|
|
1588
|
+
{
|
|
1589
|
+
style: {
|
|
1590
|
+
height: 8,
|
|
1591
|
+
borderRadius: 4,
|
|
1592
|
+
background: o.border,
|
|
1593
|
+
overflow: "hidden"
|
|
1594
|
+
},
|
|
1595
|
+
children: /* @__PURE__ */ a(
|
|
1596
|
+
"div",
|
|
1597
|
+
{
|
|
1598
|
+
style: {
|
|
1599
|
+
height: "100%",
|
|
1600
|
+
width: "68%",
|
|
1601
|
+
background: `linear-gradient(to right, ${o.primary}, ${o.accent})`,
|
|
1602
|
+
borderRadius: 4,
|
|
1603
|
+
transition: "width 0.4s ease"
|
|
1604
|
+
}
|
|
1605
|
+
}
|
|
1606
|
+
)
|
|
1607
|
+
}
|
|
1608
|
+
)
|
|
1609
|
+
] }),
|
|
1610
|
+
/* @__PURE__ */ c("div", { children: [
|
|
1611
|
+
/* @__PURE__ */ a("p", { style: { fontSize: 11, color: o.textMuted, margin: "0 0 6px" }, children: "Status Badges" }),
|
|
1612
|
+
/* @__PURE__ */ a("div", { style: { display: "flex", gap: 6, flexWrap: "wrap" }, children: [
|
|
1613
|
+
{ label: "Error", color: o.error },
|
|
1614
|
+
{ label: "Warning", color: o.warning },
|
|
1615
|
+
{ label: "Success", color: o.success }
|
|
1616
|
+
].map(({ label: u, color: x }) => /* @__PURE__ */ a(
|
|
1617
|
+
"span",
|
|
1618
|
+
{
|
|
1619
|
+
style: {
|
|
1620
|
+
padding: "3px 10px",
|
|
1621
|
+
borderRadius: 4,
|
|
1622
|
+
background: x + "22",
|
|
1623
|
+
color: x,
|
|
1624
|
+
border: `1px solid ${x}44`,
|
|
1625
|
+
fontSize: 11,
|
|
1626
|
+
fontWeight: 700
|
|
1627
|
+
},
|
|
1628
|
+
children: u
|
|
1629
|
+
},
|
|
1630
|
+
u
|
|
1631
|
+
)) })
|
|
1632
|
+
] })
|
|
1633
|
+
] }),
|
|
1634
|
+
/* @__PURE__ */ c("div", { style: E, children: [
|
|
1635
|
+
/* @__PURE__ */ a("p", { style: I, children: "WCAG Contrast Check" }),
|
|
1636
|
+
q.map((u) => /* @__PURE__ */ a(
|
|
1637
|
+
ze,
|
|
1638
|
+
{
|
|
1639
|
+
label: u.label,
|
|
1640
|
+
ratio: Y.contrast(u.fg, u.bg)
|
|
1641
|
+
},
|
|
1642
|
+
u.label
|
|
1643
|
+
)),
|
|
1644
|
+
/* @__PURE__ */ a("p", { style: { fontSize: 10, color: o.textMuted, marginTop: 8, marginBottom: 0 }, children: "AA requires 4.5:1 (normal text). AAA requires 7:1." })
|
|
1645
|
+
] }),
|
|
1646
|
+
/* @__PURE__ */ c("div", { style: E, children: [
|
|
1647
|
+
/* @__PURE__ */ a("p", { style: I, children: "Color Palette" }),
|
|
1648
|
+
/* @__PURE__ */ a("div", { style: { display: "flex", gap: 4, flexWrap: "wrap" }, children: Object.entries(o).map(([u, x]) => /* @__PURE__ */ a(
|
|
1649
|
+
"div",
|
|
1650
|
+
{
|
|
1651
|
+
title: `${u}: ${x}`,
|
|
1652
|
+
style: {
|
|
1653
|
+
width: 36,
|
|
1654
|
+
height: 36,
|
|
1655
|
+
borderRadius: 6,
|
|
1656
|
+
background: x,
|
|
1657
|
+
border: `2px solid ${o.border}`,
|
|
1658
|
+
cursor: "default",
|
|
1659
|
+
flexShrink: 0
|
|
1660
|
+
}
|
|
1661
|
+
},
|
|
1662
|
+
u
|
|
1663
|
+
)) })
|
|
1664
|
+
] })
|
|
1665
|
+
] }),
|
|
1666
|
+
typeof y == "function" && null,
|
|
1667
|
+
typeof i.bg == "string" && null
|
|
1668
|
+
] });
|
|
1669
|
+
}
|
|
1670
|
+
const ie = [
|
|
1671
|
+
{
|
|
1672
|
+
label: "Hello World",
|
|
1673
|
+
code: `<div style={{ padding: 24, fontFamily: 'sans-serif', color: '#e8e8f4' }}>
|
|
1674
|
+
<h2 style={{ margin: 0 }}>👋 Hello, TkxPlayground!</h2>
|
|
1675
|
+
<p style={{ marginTop: 8, opacity: 0.7 }}>Edit the code on the left to see live updates.</p>
|
|
1676
|
+
</div>`
|
|
1677
|
+
},
|
|
1678
|
+
{
|
|
1679
|
+
label: "Button Styles",
|
|
1680
|
+
code: `<div style={{ display: 'flex', gap: 12, flexWrap: 'wrap', padding: 24 }}>
|
|
1681
|
+
{['primary', 'success', 'danger', 'warning', 'info'].map(color => (
|
|
1682
|
+
<button
|
|
1683
|
+
key={color}
|
|
1684
|
+
style={{
|
|
1685
|
+
padding: '8px 18px',
|
|
1686
|
+
borderRadius: 8,
|
|
1687
|
+
border: 'none',
|
|
1688
|
+
background: color === 'primary' ? '#00f5d4' : color === 'success' ? '#06d6a0' : color === 'danger' ? '#f72585' : color === 'warning' ? '#ffbe0b' : '#3a86ff',
|
|
1689
|
+
color: '#0a0a0f',
|
|
1690
|
+
fontWeight: 700,
|
|
1691
|
+
cursor: 'pointer',
|
|
1692
|
+
textTransform: 'capitalize',
|
|
1693
|
+
}}
|
|
1694
|
+
>
|
|
1695
|
+
{color}
|
|
1696
|
+
</button>
|
|
1697
|
+
))}
|
|
1698
|
+
</div>`
|
|
1699
|
+
},
|
|
1700
|
+
{
|
|
1701
|
+
label: "Card Grid",
|
|
1702
|
+
code: `<div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 16, padding: 24 }}>
|
|
1703
|
+
{['Alpha', 'Beta', 'Gamma', 'Delta', 'Epsilon', 'Zeta'].map(name => (
|
|
1704
|
+
<div key={name} style={{
|
|
1705
|
+
background: '#1a1a2e',
|
|
1706
|
+
borderRadius: 10,
|
|
1707
|
+
border: '1px solid #2a2a3e',
|
|
1708
|
+
padding: '16px',
|
|
1709
|
+
}}>
|
|
1710
|
+
<div style={{ fontWeight: 700, color: '#00f5d4', marginBottom: 4 }}>{name}</div>
|
|
1711
|
+
<div style={{ fontSize: 12, color: '#8888aa' }}>Quantum module {name.toLowerCase()}</div>
|
|
1712
|
+
</div>
|
|
1713
|
+
))}
|
|
1714
|
+
</div>`
|
|
1715
|
+
},
|
|
1716
|
+
{
|
|
1717
|
+
label: "Animated Counter",
|
|
1718
|
+
code: `(() => {
|
|
1719
|
+
const [count, setCount] = React.useState(0);
|
|
1720
|
+
return (
|
|
1721
|
+
<div style={{ padding: 32, textAlign: 'center', fontFamily: 'sans-serif' }}>
|
|
1722
|
+
<div style={{ fontSize: 64, fontWeight: 900, color: '#00f5d4', marginBottom: 16 }}>
|
|
1723
|
+
{count}
|
|
1724
|
+
</div>
|
|
1725
|
+
<div style={{ display: 'flex', gap: 12, justifyContent: 'center' }}>
|
|
1726
|
+
<button onClick={() => setCount(c => c - 1)} style={{ padding: '8px 20px', borderRadius: 8, border: '1px solid #2a2a3e', background: '#1a1a2e', color: '#e8e8f4', fontSize: 20, cursor: 'pointer' }}>−</button>
|
|
1727
|
+
<button onClick={() => setCount(0)} style={{ padding: '8px 20px', borderRadius: 8, border: '1px solid #2a2a3e', background: '#1a1a2e', color: '#8888aa', cursor: 'pointer' }}>Reset</button>
|
|
1728
|
+
<button onClick={() => setCount(c => c + 1)} style={{ padding: '8px 20px', borderRadius: 8, border: '1px solid #2a2a3e', background: '#1a1a2e', color: '#e8e8f4', fontSize: 20, cursor: 'pointer' }}>+</button>
|
|
1729
|
+
</div>
|
|
1730
|
+
</div>
|
|
1731
|
+
);
|
|
1732
|
+
})()`
|
|
1733
|
+
},
|
|
1734
|
+
{
|
|
1735
|
+
label: "Data Table",
|
|
1736
|
+
code: `(() => {
|
|
1737
|
+
const rows = [
|
|
1738
|
+
{ id: 1, name: 'Hydrogen', symbol: 'H', mass: 1.008 },
|
|
1739
|
+
{ id: 2, name: 'Helium', symbol: 'He', mass: 4.003 },
|
|
1740
|
+
{ id: 3, name: 'Lithium', symbol: 'Li', mass: 6.941 },
|
|
1741
|
+
{ id: 4, name: 'Carbon', symbol: 'C', mass: 12.011 },
|
|
1742
|
+
{ id: 5, name: 'Nitrogen', symbol: 'N', mass: 14.007 },
|
|
1743
|
+
];
|
|
1744
|
+
const cell = { padding: '8px 14px', borderBottom: '1px solid #2a2a3e', color: '#e8e8f4', fontSize: 13 };
|
|
1745
|
+
const hcell = { ...cell, color: '#8888aa', fontWeight: 600, fontSize: 11, textTransform: 'uppercase', letterSpacing: '0.06em' };
|
|
1746
|
+
return (
|
|
1747
|
+
<div style={{ padding: 16 }}>
|
|
1748
|
+
<table style={{ width: '100%', borderCollapse: 'collapse', fontFamily: 'sans-serif' }}>
|
|
1749
|
+
<thead>
|
|
1750
|
+
<tr>{['ID','Element','Symbol','Atomic Mass'].map(h => <th key={h} style={hcell}>{h}</th>)}</tr>
|
|
1751
|
+
</thead>
|
|
1752
|
+
<tbody>
|
|
1753
|
+
{rows.map(r => (
|
|
1754
|
+
<tr key={r.id} style={{ transition: 'background 0.15s' }}>
|
|
1755
|
+
<td style={cell}>{r.id}</td>
|
|
1756
|
+
<td style={cell}>{r.name}</td>
|
|
1757
|
+
<td style={{ ...cell, color: '#00f5d4', fontWeight: 700 }}>{r.symbol}</td>
|
|
1758
|
+
<td style={cell}>{r.mass}</td>
|
|
1759
|
+
</tr>
|
|
1760
|
+
))}
|
|
1761
|
+
</tbody>
|
|
1762
|
+
</table>
|
|
1763
|
+
</div>
|
|
1764
|
+
);
|
|
1765
|
+
})()`
|
|
1766
|
+
}
|
|
1767
|
+
];
|
|
1768
|
+
class Te extends Z.Component {
|
|
1769
|
+
constructor(e) {
|
|
1770
|
+
super(e), this.state = { hasError: !1 };
|
|
1771
|
+
}
|
|
1772
|
+
static getDerivedStateFromError() {
|
|
1773
|
+
return { hasError: !0 };
|
|
1774
|
+
}
|
|
1775
|
+
componentDidCatch(e) {
|
|
1776
|
+
this.props.onError(e.message);
|
|
1777
|
+
}
|
|
1778
|
+
componentDidUpdate(e) {
|
|
1779
|
+
e.children !== this.props.children && this.state.hasError && this.setState({ hasError: !1 });
|
|
1780
|
+
}
|
|
1781
|
+
render() {
|
|
1782
|
+
return this.state.hasError ? null : this.props.children;
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
function Ae() {
|
|
1786
|
+
return typeof window > "u" ? null : window.Babel ?? null;
|
|
1787
|
+
}
|
|
1788
|
+
function Be(r, e) {
|
|
1789
|
+
const n = performance.now();
|
|
1790
|
+
try {
|
|
1791
|
+
const i = r.trim();
|
|
1792
|
+
let s = `
|
|
1793
|
+
function PlaygroundRoot() {
|
|
1794
|
+
${i.startsWith("<") || i.startsWith("(") ? `return (${i});` : i}
|
|
1795
|
+
}
|
|
1796
|
+
return PlaygroundRoot;
|
|
1797
|
+
`;
|
|
1798
|
+
const d = Ae();
|
|
1799
|
+
d && (s = d.transform(s, {
|
|
1800
|
+
presets: ["react"],
|
|
1801
|
+
filename: "playground.jsx"
|
|
1802
|
+
}).code ?? s);
|
|
1803
|
+
const p = new Function(
|
|
1804
|
+
"React",
|
|
1805
|
+
"imports",
|
|
1806
|
+
`
|
|
1807
|
+
"use strict";
|
|
1808
|
+
const { ${Object.keys(e).join(", ")} } = imports;
|
|
1809
|
+
${s}
|
|
1810
|
+
`
|
|
1811
|
+
)(Z, e), f = Z.createElement(p), m = parseFloat((performance.now() - n).toFixed(2));
|
|
1812
|
+
return { element: f, error: null, renderMs: m };
|
|
1813
|
+
} catch (i) {
|
|
1814
|
+
const t = parseFloat((performance.now() - n).toFixed(2));
|
|
1815
|
+
return { element: null, error: i instanceof Error ? i.message : String(i), renderMs: t };
|
|
1816
|
+
}
|
|
1817
|
+
}
|
|
1818
|
+
function Re({ code: r, lineHeight: e }) {
|
|
1819
|
+
const n = r.split(`
|
|
1820
|
+
`);
|
|
1821
|
+
return /* @__PURE__ */ a(
|
|
1822
|
+
"div",
|
|
1823
|
+
{
|
|
1824
|
+
"aria-hidden": "true",
|
|
1825
|
+
style: {
|
|
1826
|
+
position: "absolute",
|
|
1827
|
+
top: 0,
|
|
1828
|
+
left: 0,
|
|
1829
|
+
width: "36px",
|
|
1830
|
+
padding: "12px 0",
|
|
1831
|
+
textAlign: "right",
|
|
1832
|
+
paddingRight: "8px",
|
|
1833
|
+
userSelect: "none",
|
|
1834
|
+
pointerEvents: "none",
|
|
1835
|
+
fontSize: "12px",
|
|
1836
|
+
lineHeight: `${e}px`,
|
|
1837
|
+
color: "#555577",
|
|
1838
|
+
fontFamily: '"Fira Code", "Cascadia Code", "Consolas", monospace',
|
|
1839
|
+
boxSizing: "border-box"
|
|
1840
|
+
},
|
|
1841
|
+
children: n.map((i, t) => /* @__PURE__ */ a("div", { children: t + 1 }, t))
|
|
1842
|
+
}
|
|
1843
|
+
);
|
|
1844
|
+
}
|
|
1845
|
+
const ae = [
|
|
1846
|
+
"TkxButton",
|
|
1847
|
+
"TkxInput",
|
|
1848
|
+
"TkxCard",
|
|
1849
|
+
"TkxModal",
|
|
1850
|
+
"TkxTable",
|
|
1851
|
+
"TkxSelect",
|
|
1852
|
+
"TkxCheckbox",
|
|
1853
|
+
"TkxRadio",
|
|
1854
|
+
"TkxSwitch",
|
|
1855
|
+
"TkxSlider",
|
|
1856
|
+
"TkxBadge",
|
|
1857
|
+
"TkxAlert",
|
|
1858
|
+
"TkxToast",
|
|
1859
|
+
"TkxTooltip",
|
|
1860
|
+
"TkxPopover",
|
|
1861
|
+
"TkxTabs",
|
|
1862
|
+
"TkxAccordion",
|
|
1863
|
+
"TkxDrawer",
|
|
1864
|
+
"TkxDropdown",
|
|
1865
|
+
"TkxMenu",
|
|
1866
|
+
"TkxForm",
|
|
1867
|
+
"TkxDataGrid",
|
|
1868
|
+
"TkxChart",
|
|
1869
|
+
"TkxSpinner",
|
|
1870
|
+
"TkxSkeleton",
|
|
1871
|
+
"TkxAvatar",
|
|
1872
|
+
"TkxTag",
|
|
1873
|
+
"TkxDivider",
|
|
1874
|
+
"TkxProgress",
|
|
1875
|
+
"TkxStatistic",
|
|
1876
|
+
"TkxQuantumForm",
|
|
1877
|
+
"TkxPlayground"
|
|
1878
|
+
], $e = new ee();
|
|
1879
|
+
function se(r) {
|
|
1880
|
+
const e = r.match(/([A-Z][a-zA-Z0-9]*)$/);
|
|
1881
|
+
return e ? e[1] : "";
|
|
1882
|
+
}
|
|
1883
|
+
function Ee(r, e = 4) {
|
|
1884
|
+
if (!r || r.length < 2) return [];
|
|
1885
|
+
const n = r.toLowerCase();
|
|
1886
|
+
return $e.amplify(
|
|
1887
|
+
ae,
|
|
1888
|
+
(t) => {
|
|
1889
|
+
const l = t.toLowerCase();
|
|
1890
|
+
if (l.startsWith(n)) return 1;
|
|
1891
|
+
if (l.includes(n)) return 0.7;
|
|
1892
|
+
let s = 0;
|
|
1893
|
+
for (let d = 0; d < n.length - 1; d++)
|
|
1894
|
+
l.includes(n.slice(d, d + 2)) && (s += 0.15);
|
|
1895
|
+
return Math.min(s, 0.5);
|
|
1896
|
+
},
|
|
1897
|
+
0.1
|
|
1898
|
+
).slice(0, e).map((t) => ({
|
|
1899
|
+
name: ae[t.index] ?? "",
|
|
1900
|
+
amplitude: parseFloat(t.combined.toFixed(3))
|
|
1901
|
+
})).filter((t) => t.name !== "");
|
|
1902
|
+
}
|
|
1903
|
+
function We({
|
|
1904
|
+
defaultCode: r,
|
|
1905
|
+
examples: e,
|
|
1906
|
+
height: n = 480,
|
|
1907
|
+
imports: i = {}
|
|
1908
|
+
}) {
|
|
1909
|
+
const t = K(), l = [...ie, ...e ?? []], s = r ?? ie[0].code, [d, o] = A(s), [p, f] = A({
|
|
1910
|
+
element: null,
|
|
1911
|
+
error: null,
|
|
1912
|
+
renderMs: 0
|
|
1913
|
+
}), [m, g] = A(null), [b, h] = A([]), [v, C] = A(!1), [k, P] = A(0), F = X(null), w = 18, $ = X(null), q = R(
|
|
1914
|
+
(T) => {
|
|
1915
|
+
g(null);
|
|
1916
|
+
const B = Be(T, i);
|
|
1917
|
+
f(B);
|
|
1918
|
+
},
|
|
1919
|
+
[i]
|
|
1920
|
+
);
|
|
1921
|
+
V(() => ($.current && clearTimeout($.current), $.current = setTimeout(() => q(d), 300), () => {
|
|
1922
|
+
$.current && clearTimeout($.current);
|
|
1923
|
+
}), [d, q]), V(() => {
|
|
1924
|
+
q(s);
|
|
1925
|
+
}, []);
|
|
1926
|
+
const L = R(
|
|
1927
|
+
(T) => {
|
|
1928
|
+
const B = T.target.value;
|
|
1929
|
+
o(B);
|
|
1930
|
+
const H = se(B);
|
|
1931
|
+
H.length >= 2 ? h(Ee(H, 4)) : h([]);
|
|
1932
|
+
},
|
|
1933
|
+
[]
|
|
1934
|
+
), D = R(
|
|
1935
|
+
(T) => {
|
|
1936
|
+
const B = l[T];
|
|
1937
|
+
B && (P(T), o(B.code), h([]));
|
|
1938
|
+
},
|
|
1939
|
+
[l]
|
|
1940
|
+
), E = R(async () => {
|
|
1941
|
+
try {
|
|
1942
|
+
await navigator.clipboard.writeText(d), C(!0), setTimeout(() => C(!1), 1500);
|
|
1943
|
+
} catch {
|
|
1944
|
+
}
|
|
1945
|
+
}, [d]), I = R(() => {
|
|
1946
|
+
o(s), P(0), h([]);
|
|
1947
|
+
}, [s]), j = R(
|
|
1948
|
+
(T) => {
|
|
1949
|
+
const B = se(d);
|
|
1950
|
+
B && o((H) => H.slice(0, H.lastIndexOf(B)) + T), h([]);
|
|
1951
|
+
},
|
|
1952
|
+
[d]
|
|
1953
|
+
), y = p.error !== null || m !== null, u = p.error ?? m ?? "", x = t.bg, M = t.surfaceAlt, S = t.border, z = t.surface, N = {
|
|
1954
|
+
width: "50%",
|
|
1955
|
+
display: "flex",
|
|
1956
|
+
flexDirection: "column",
|
|
1957
|
+
borderRight: `1px solid ${S}`,
|
|
1958
|
+
position: "relative"
|
|
1959
|
+
}, O = {
|
|
1960
|
+
display: "flex",
|
|
1961
|
+
alignItems: "center",
|
|
1962
|
+
gap: "6px",
|
|
1963
|
+
padding: "6px 10px",
|
|
1964
|
+
borderBottom: `1px solid ${S}`,
|
|
1965
|
+
backgroundColor: t.surface,
|
|
1966
|
+
flexWrap: "wrap"
|
|
1967
|
+
}, Q = {
|
|
1968
|
+
padding: "3px 10px",
|
|
1969
|
+
borderRadius: "6px",
|
|
1970
|
+
border: `1px solid ${S}`,
|
|
1971
|
+
backgroundColor: "transparent",
|
|
1972
|
+
color: t.textMuted,
|
|
1973
|
+
fontSize: "11px",
|
|
1974
|
+
fontWeight: 600,
|
|
1975
|
+
cursor: "pointer",
|
|
1976
|
+
fontFamily: "inherit",
|
|
1977
|
+
transition: "color 0.15s, border-color 0.15s"
|
|
1978
|
+
};
|
|
1979
|
+
return /* @__PURE__ */ c(
|
|
1980
|
+
"div",
|
|
1981
|
+
{
|
|
1982
|
+
style: {
|
|
1983
|
+
display: "flex",
|
|
1984
|
+
flexDirection: "column",
|
|
1985
|
+
border: `1px solid ${S}`,
|
|
1986
|
+
borderRadius: "12px",
|
|
1987
|
+
overflow: "hidden",
|
|
1988
|
+
backgroundColor: x,
|
|
1989
|
+
fontFamily: "inherit",
|
|
1990
|
+
boxSizing: "border-box",
|
|
1991
|
+
position: "relative"
|
|
1992
|
+
},
|
|
1993
|
+
children: [
|
|
1994
|
+
/* @__PURE__ */ c(
|
|
1995
|
+
"div",
|
|
1996
|
+
{
|
|
1997
|
+
style: {
|
|
1998
|
+
display: "flex",
|
|
1999
|
+
alignItems: "center",
|
|
2000
|
+
justifyContent: "space-between",
|
|
2001
|
+
padding: "8px 14px",
|
|
2002
|
+
borderBottom: `1px solid ${S}`,
|
|
2003
|
+
backgroundColor: t.surface
|
|
2004
|
+
},
|
|
2005
|
+
children: [
|
|
2006
|
+
/* @__PURE__ */ a("span", { style: { fontSize: "12px", fontWeight: 700, color: t.primary, letterSpacing: "0.05em" }, children: "⚛ TkxPlayground" }),
|
|
2007
|
+
/* @__PURE__ */ a("span", { style: { fontSize: "10px", color: t.textMuted }, children: "Live JSX Preview" })
|
|
2008
|
+
]
|
|
2009
|
+
}
|
|
2010
|
+
),
|
|
2011
|
+
/* @__PURE__ */ a(
|
|
2012
|
+
"div",
|
|
2013
|
+
{
|
|
2014
|
+
style: {
|
|
2015
|
+
display: "flex",
|
|
2016
|
+
gap: "4px",
|
|
2017
|
+
padding: "6px 10px",
|
|
2018
|
+
borderBottom: `1px solid ${S}`,
|
|
2019
|
+
backgroundColor: t.surface,
|
|
2020
|
+
overflowX: "auto"
|
|
2021
|
+
},
|
|
2022
|
+
children: l.map((T, B) => /* @__PURE__ */ a(
|
|
2023
|
+
"button",
|
|
2024
|
+
{
|
|
2025
|
+
onClick: () => D(B),
|
|
2026
|
+
style: {
|
|
2027
|
+
padding: "3px 10px",
|
|
2028
|
+
borderRadius: "6px",
|
|
2029
|
+
border: `1px solid ${B === k ? t.primary : S}`,
|
|
2030
|
+
backgroundColor: B === k ? `${t.primary}20` : "transparent",
|
|
2031
|
+
color: B === k ? t.primary : t.textMuted,
|
|
2032
|
+
fontSize: "11px",
|
|
2033
|
+
fontWeight: B === k ? 700 : 400,
|
|
2034
|
+
cursor: "pointer",
|
|
2035
|
+
whiteSpace: "nowrap",
|
|
2036
|
+
fontFamily: "inherit",
|
|
2037
|
+
transition: "all 0.15s"
|
|
2038
|
+
},
|
|
2039
|
+
children: T.label
|
|
2040
|
+
},
|
|
2041
|
+
B
|
|
2042
|
+
))
|
|
2043
|
+
}
|
|
2044
|
+
),
|
|
2045
|
+
/* @__PURE__ */ c("div", { style: { display: "flex", height: `${n}px` }, children: [
|
|
2046
|
+
/* @__PURE__ */ c("div", { style: N, children: [
|
|
2047
|
+
/* @__PURE__ */ c("div", { style: O, children: [
|
|
2048
|
+
/* @__PURE__ */ a("span", { style: { fontSize: "11px", color: t.textMuted, marginRight: "auto" }, children: "editor.tsx" }),
|
|
2049
|
+
/* @__PURE__ */ a("button", { onClick: E, style: Q, title: "Copy code", children: v ? "✓ Copied" : "⎘ Copy" }),
|
|
2050
|
+
/* @__PURE__ */ a("button", { onClick: I, style: Q, title: "Reset to default", children: "↺ Reset" })
|
|
2051
|
+
] }),
|
|
2052
|
+
/* @__PURE__ */ c("div", { style: { position: "relative", flex: 1, overflow: "hidden" }, children: [
|
|
2053
|
+
/* @__PURE__ */ a(Re, { code: d, lineHeight: w }),
|
|
2054
|
+
/* @__PURE__ */ a(
|
|
2055
|
+
"textarea",
|
|
2056
|
+
{
|
|
2057
|
+
ref: F,
|
|
2058
|
+
value: d,
|
|
2059
|
+
onChange: L,
|
|
2060
|
+
spellCheck: !1,
|
|
2061
|
+
autoCorrect: "off",
|
|
2062
|
+
autoCapitalize: "off",
|
|
2063
|
+
style: {
|
|
2064
|
+
position: "absolute",
|
|
2065
|
+
top: 0,
|
|
2066
|
+
left: 0,
|
|
2067
|
+
width: "100%",
|
|
2068
|
+
height: "100%",
|
|
2069
|
+
padding: "12px 12px 12px 44px",
|
|
2070
|
+
margin: 0,
|
|
2071
|
+
border: "none",
|
|
2072
|
+
outline: "none",
|
|
2073
|
+
resize: "none",
|
|
2074
|
+
backgroundColor: x,
|
|
2075
|
+
color: t.text,
|
|
2076
|
+
fontSize: "12px",
|
|
2077
|
+
lineHeight: `${w}px`,
|
|
2078
|
+
fontFamily: '"Fira Code", "Cascadia Code", "Consolas", "Courier New", monospace',
|
|
2079
|
+
boxSizing: "border-box",
|
|
2080
|
+
overflowY: "auto",
|
|
2081
|
+
tabSize: 2
|
|
2082
|
+
}
|
|
2083
|
+
}
|
|
2084
|
+
)
|
|
2085
|
+
] }),
|
|
2086
|
+
b.length > 0 && /* @__PURE__ */ c(
|
|
2087
|
+
"div",
|
|
2088
|
+
{
|
|
2089
|
+
style: {
|
|
2090
|
+
position: "absolute",
|
|
2091
|
+
bottom: "40px",
|
|
2092
|
+
left: "44px",
|
|
2093
|
+
zIndex: 10,
|
|
2094
|
+
backgroundColor: t.surface,
|
|
2095
|
+
border: `1px solid ${t.primary}44`,
|
|
2096
|
+
borderRadius: "8px",
|
|
2097
|
+
overflow: "hidden",
|
|
2098
|
+
boxShadow: "0 4px 16px rgba(0,0,0,0.3)",
|
|
2099
|
+
minWidth: "180px"
|
|
2100
|
+
},
|
|
2101
|
+
children: [
|
|
2102
|
+
/* @__PURE__ */ a(
|
|
2103
|
+
"div",
|
|
2104
|
+
{
|
|
2105
|
+
style: {
|
|
2106
|
+
padding: "4px 10px 4px",
|
|
2107
|
+
fontSize: "10px",
|
|
2108
|
+
color: t.primary,
|
|
2109
|
+
fontWeight: 700,
|
|
2110
|
+
borderBottom: `1px solid ${S}`,
|
|
2111
|
+
letterSpacing: "0.05em"
|
|
2112
|
+
},
|
|
2113
|
+
children: "⚛ Quantum Suggestions"
|
|
2114
|
+
}
|
|
2115
|
+
),
|
|
2116
|
+
b.map((T) => /* @__PURE__ */ c(
|
|
2117
|
+
"button",
|
|
2118
|
+
{
|
|
2119
|
+
onClick: () => j(T.name),
|
|
2120
|
+
style: {
|
|
2121
|
+
display: "flex",
|
|
2122
|
+
alignItems: "center",
|
|
2123
|
+
justifyContent: "space-between",
|
|
2124
|
+
width: "100%",
|
|
2125
|
+
padding: "6px 10px",
|
|
2126
|
+
border: "none",
|
|
2127
|
+
backgroundColor: "transparent",
|
|
2128
|
+
color: t.text,
|
|
2129
|
+
fontSize: "12px",
|
|
2130
|
+
fontFamily: '"Fira Code", monospace',
|
|
2131
|
+
cursor: "pointer",
|
|
2132
|
+
textAlign: "left",
|
|
2133
|
+
gap: "12px"
|
|
2134
|
+
},
|
|
2135
|
+
children: [
|
|
2136
|
+
/* @__PURE__ */ a("span", { children: T.name }),
|
|
2137
|
+
/* @__PURE__ */ c(
|
|
2138
|
+
"span",
|
|
2139
|
+
{
|
|
2140
|
+
style: {
|
|
2141
|
+
fontSize: "10px",
|
|
2142
|
+
color: t.textMuted,
|
|
2143
|
+
flexShrink: 0
|
|
2144
|
+
},
|
|
2145
|
+
children: [
|
|
2146
|
+
Math.round(T.amplitude * 100),
|
|
2147
|
+
"%"
|
|
2148
|
+
]
|
|
2149
|
+
}
|
|
2150
|
+
)
|
|
2151
|
+
]
|
|
2152
|
+
},
|
|
2153
|
+
T.name
|
|
2154
|
+
))
|
|
2155
|
+
]
|
|
2156
|
+
}
|
|
2157
|
+
)
|
|
2158
|
+
] }),
|
|
2159
|
+
/* @__PURE__ */ c(
|
|
2160
|
+
"div",
|
|
2161
|
+
{
|
|
2162
|
+
style: {
|
|
2163
|
+
width: "50%",
|
|
2164
|
+
display: "flex",
|
|
2165
|
+
flexDirection: "column"
|
|
2166
|
+
},
|
|
2167
|
+
children: [
|
|
2168
|
+
/* @__PURE__ */ a(
|
|
2169
|
+
"div",
|
|
2170
|
+
{
|
|
2171
|
+
style: {
|
|
2172
|
+
padding: "6px 10px",
|
|
2173
|
+
borderBottom: `1px solid ${S}`,
|
|
2174
|
+
backgroundColor: t.surface,
|
|
2175
|
+
fontSize: "11px",
|
|
2176
|
+
color: t.textMuted,
|
|
2177
|
+
fontWeight: 600
|
|
2178
|
+
},
|
|
2179
|
+
children: "Preview"
|
|
2180
|
+
}
|
|
2181
|
+
),
|
|
2182
|
+
/* @__PURE__ */ a(
|
|
2183
|
+
"div",
|
|
2184
|
+
{
|
|
2185
|
+
style: {
|
|
2186
|
+
flex: 1,
|
|
2187
|
+
overflow: "auto",
|
|
2188
|
+
backgroundColor: M,
|
|
2189
|
+
position: "relative"
|
|
2190
|
+
},
|
|
2191
|
+
children: y ? /* @__PURE__ */ c(
|
|
2192
|
+
"div",
|
|
2193
|
+
{
|
|
2194
|
+
style: {
|
|
2195
|
+
padding: "16px",
|
|
2196
|
+
color: t.danger,
|
|
2197
|
+
fontFamily: '"Fira Code", monospace',
|
|
2198
|
+
fontSize: "12px",
|
|
2199
|
+
lineHeight: 1.6,
|
|
2200
|
+
whiteSpace: "pre-wrap",
|
|
2201
|
+
wordBreak: "break-word"
|
|
2202
|
+
},
|
|
2203
|
+
children: [
|
|
2204
|
+
/* @__PURE__ */ c(
|
|
2205
|
+
"div",
|
|
2206
|
+
{
|
|
2207
|
+
style: {
|
|
2208
|
+
marginBottom: "8px",
|
|
2209
|
+
fontWeight: 700,
|
|
2210
|
+
display: "flex",
|
|
2211
|
+
alignItems: "center",
|
|
2212
|
+
gap: "6px"
|
|
2213
|
+
},
|
|
2214
|
+
children: [
|
|
2215
|
+
/* @__PURE__ */ a("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ a("path", { d: "M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z" }) }),
|
|
2216
|
+
"Runtime Error"
|
|
2217
|
+
]
|
|
2218
|
+
}
|
|
2219
|
+
),
|
|
2220
|
+
u
|
|
2221
|
+
]
|
|
2222
|
+
}
|
|
2223
|
+
) : /* @__PURE__ */ a(Te, { onError: g, children: /* @__PURE__ */ a("div", { style: { minHeight: "100%" }, children: p.element }) })
|
|
2224
|
+
}
|
|
2225
|
+
)
|
|
2226
|
+
]
|
|
2227
|
+
}
|
|
2228
|
+
)
|
|
2229
|
+
] }),
|
|
2230
|
+
/* @__PURE__ */ c(
|
|
2231
|
+
"div",
|
|
2232
|
+
{
|
|
2233
|
+
style: {
|
|
2234
|
+
display: "flex",
|
|
2235
|
+
alignItems: "center",
|
|
2236
|
+
gap: "16px",
|
|
2237
|
+
padding: "4px 12px",
|
|
2238
|
+
backgroundColor: z,
|
|
2239
|
+
borderTop: `1px solid ${S}`,
|
|
2240
|
+
fontSize: "11px",
|
|
2241
|
+
color: t.textMuted
|
|
2242
|
+
},
|
|
2243
|
+
children: [
|
|
2244
|
+
/* @__PURE__ */ c(
|
|
2245
|
+
"span",
|
|
2246
|
+
{
|
|
2247
|
+
style: {
|
|
2248
|
+
display: "flex",
|
|
2249
|
+
alignItems: "center",
|
|
2250
|
+
gap: "4px",
|
|
2251
|
+
color: y ? t.danger : t.success,
|
|
2252
|
+
fontWeight: 600
|
|
2253
|
+
},
|
|
2254
|
+
children: [
|
|
2255
|
+
/* @__PURE__ */ a(
|
|
2256
|
+
"span",
|
|
2257
|
+
{
|
|
2258
|
+
style: {
|
|
2259
|
+
width: "6px",
|
|
2260
|
+
height: "6px",
|
|
2261
|
+
borderRadius: "50%",
|
|
2262
|
+
backgroundColor: y ? t.danger : t.success,
|
|
2263
|
+
display: "inline-block"
|
|
2264
|
+
}
|
|
2265
|
+
}
|
|
2266
|
+
),
|
|
2267
|
+
y ? "Error" : "OK"
|
|
2268
|
+
]
|
|
2269
|
+
}
|
|
2270
|
+
),
|
|
2271
|
+
/* @__PURE__ */ c("span", { children: [
|
|
2272
|
+
"⏱ ",
|
|
2273
|
+
p.renderMs,
|
|
2274
|
+
" ms"
|
|
2275
|
+
] }),
|
|
2276
|
+
/* @__PURE__ */ c("span", { children: [
|
|
2277
|
+
d.split(`
|
|
2278
|
+
`).length,
|
|
2279
|
+
" lines"
|
|
2280
|
+
] }),
|
|
2281
|
+
/* @__PURE__ */ c("span", { children: [
|
|
2282
|
+
d.length,
|
|
2283
|
+
" chars"
|
|
2284
|
+
] }),
|
|
2285
|
+
b.length > 0 && /* @__PURE__ */ c("span", { style: { marginLeft: "auto", color: t.primary, fontWeight: 600 }, children: [
|
|
2286
|
+
"⚛ ",
|
|
2287
|
+
b.length,
|
|
2288
|
+
" suggestion",
|
|
2289
|
+
b.length > 1 ? "s" : ""
|
|
2290
|
+
] })
|
|
2291
|
+
]
|
|
2292
|
+
}
|
|
2293
|
+
)
|
|
2294
|
+
]
|
|
2295
|
+
}
|
|
2296
|
+
);
|
|
2297
|
+
}
|
|
2298
|
+
We.displayName = "TkxPlayground";
|
|
2299
|
+
export {
|
|
2300
|
+
ee as AmplitudeAmplifier,
|
|
2301
|
+
Y as QuantumAI,
|
|
2302
|
+
de as QuantumAnnealer,
|
|
2303
|
+
he as QuantumBoltzmannMachine,
|
|
2304
|
+
ue as QuantumRegister,
|
|
2305
|
+
_ as Qubit,
|
|
2306
|
+
We as TkxPlayground,
|
|
2307
|
+
Se as TkxQuantumForm,
|
|
2308
|
+
Ne as TkxThemeBuilder,
|
|
2309
|
+
G as hslToHex,
|
|
2310
|
+
ce as inferFieldIntelligence,
|
|
2311
|
+
ye as optimizeThemeColors
|
|
2312
|
+
};
|