@satori-sh/cli 0.0.30 → 0.0.31
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/index.js +13 -11
- package/dist/ui-4LVANHF6.js +2678 -0
- package/package.json +1 -1
- package/dist/ui-OEY6KRG2.js +0 -264
|
@@ -0,0 +1,2678 @@
|
|
|
1
|
+
// node_modules/@opentui/solid/index.js
|
|
2
|
+
import { CliRenderer, createCliRenderer, engine as engine2 } from "@opentui/core";
|
|
3
|
+
import { createTestRenderer } from "@opentui/core/testing";
|
|
4
|
+
import {
|
|
5
|
+
ASCIIFontRenderable,
|
|
6
|
+
BoxRenderable,
|
|
7
|
+
CodeRenderable,
|
|
8
|
+
DiffRenderable,
|
|
9
|
+
InputRenderable as InputRenderable2,
|
|
10
|
+
LineNumberRenderable,
|
|
11
|
+
ScrollBoxRenderable,
|
|
12
|
+
SelectRenderable as SelectRenderable2,
|
|
13
|
+
TabSelectRenderable as TabSelectRenderable2,
|
|
14
|
+
TextareaRenderable,
|
|
15
|
+
TextAttributes,
|
|
16
|
+
TextNodeRenderable as TextNodeRenderable3,
|
|
17
|
+
TextRenderable as TextRenderable3
|
|
18
|
+
} from "@opentui/core";
|
|
19
|
+
import {
|
|
20
|
+
engine,
|
|
21
|
+
Timeline
|
|
22
|
+
} from "@opentui/core";
|
|
23
|
+
|
|
24
|
+
// node_modules/solid-js/dist/solid.js
|
|
25
|
+
var sharedConfig = {
|
|
26
|
+
context: void 0,
|
|
27
|
+
registry: void 0,
|
|
28
|
+
effects: void 0,
|
|
29
|
+
done: false,
|
|
30
|
+
getContextId() {
|
|
31
|
+
return getContextId(this.context.count);
|
|
32
|
+
},
|
|
33
|
+
getNextContextId() {
|
|
34
|
+
return getContextId(this.context.count++);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
function getContextId(count) {
|
|
38
|
+
const num = String(count), len = num.length - 1;
|
|
39
|
+
return sharedConfig.context.id + (len ? String.fromCharCode(96 + len) : "") + num;
|
|
40
|
+
}
|
|
41
|
+
function setHydrateContext(context) {
|
|
42
|
+
sharedConfig.context = context;
|
|
43
|
+
}
|
|
44
|
+
function nextHydrateContext() {
|
|
45
|
+
return {
|
|
46
|
+
...sharedConfig.context,
|
|
47
|
+
id: sharedConfig.getNextContextId(),
|
|
48
|
+
count: 0
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
var IS_DEV = false;
|
|
52
|
+
var equalFn = (a, b) => a === b;
|
|
53
|
+
var $PROXY = /* @__PURE__ */ Symbol("solid-proxy");
|
|
54
|
+
var SUPPORTS_PROXY = typeof Proxy === "function";
|
|
55
|
+
var $TRACK = /* @__PURE__ */ Symbol("solid-track");
|
|
56
|
+
var signalOptions = {
|
|
57
|
+
equals: equalFn
|
|
58
|
+
};
|
|
59
|
+
var ERROR = null;
|
|
60
|
+
var runEffects = runQueue;
|
|
61
|
+
var STALE = 1;
|
|
62
|
+
var PENDING = 2;
|
|
63
|
+
var UNOWNED = {
|
|
64
|
+
owned: null,
|
|
65
|
+
cleanups: null,
|
|
66
|
+
context: null,
|
|
67
|
+
owner: null
|
|
68
|
+
};
|
|
69
|
+
var Owner = null;
|
|
70
|
+
var Transition = null;
|
|
71
|
+
var Scheduler = null;
|
|
72
|
+
var ExternalSourceConfig = null;
|
|
73
|
+
var Listener = null;
|
|
74
|
+
var Updates = null;
|
|
75
|
+
var Effects = null;
|
|
76
|
+
var ExecCount = 0;
|
|
77
|
+
function createRoot(fn, detachedOwner) {
|
|
78
|
+
const listener = Listener, owner = Owner, unowned = fn.length === 0, current = detachedOwner === void 0 ? owner : detachedOwner, root = unowned ? UNOWNED : {
|
|
79
|
+
owned: null,
|
|
80
|
+
cleanups: null,
|
|
81
|
+
context: current ? current.context : null,
|
|
82
|
+
owner: current
|
|
83
|
+
}, updateFn = unowned ? fn : () => fn(() => untrack(() => cleanNode(root)));
|
|
84
|
+
Owner = root;
|
|
85
|
+
Listener = null;
|
|
86
|
+
try {
|
|
87
|
+
return runUpdates(updateFn, true);
|
|
88
|
+
} finally {
|
|
89
|
+
Listener = listener;
|
|
90
|
+
Owner = owner;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function createSignal(value, options) {
|
|
94
|
+
options = options ? Object.assign({}, signalOptions, options) : signalOptions;
|
|
95
|
+
const s = {
|
|
96
|
+
value,
|
|
97
|
+
observers: null,
|
|
98
|
+
observerSlots: null,
|
|
99
|
+
comparator: options.equals || void 0
|
|
100
|
+
};
|
|
101
|
+
const setter = (value2) => {
|
|
102
|
+
if (typeof value2 === "function") {
|
|
103
|
+
if (Transition && Transition.running && Transition.sources.has(s)) value2 = value2(s.tValue);
|
|
104
|
+
else value2 = value2(s.value);
|
|
105
|
+
}
|
|
106
|
+
return writeSignal(s, value2);
|
|
107
|
+
};
|
|
108
|
+
return [readSignal.bind(s), setter];
|
|
109
|
+
}
|
|
110
|
+
function createRenderEffect(fn, value, options) {
|
|
111
|
+
const c = createComputation(fn, value, false, STALE);
|
|
112
|
+
if (Scheduler && Transition && Transition.running) Updates.push(c);
|
|
113
|
+
else updateComputation(c);
|
|
114
|
+
}
|
|
115
|
+
function createEffect(fn, value, options) {
|
|
116
|
+
runEffects = runUserEffects;
|
|
117
|
+
const c = createComputation(fn, value, false, STALE), s = SuspenseContext && useContext(SuspenseContext);
|
|
118
|
+
if (s) c.suspense = s;
|
|
119
|
+
if (!options || !options.render) c.user = true;
|
|
120
|
+
Effects ? Effects.push(c) : updateComputation(c);
|
|
121
|
+
}
|
|
122
|
+
function createMemo(fn, value, options) {
|
|
123
|
+
options = options ? Object.assign({}, signalOptions, options) : signalOptions;
|
|
124
|
+
const c = createComputation(fn, value, true, 0);
|
|
125
|
+
c.observers = null;
|
|
126
|
+
c.observerSlots = null;
|
|
127
|
+
c.comparator = options.equals || void 0;
|
|
128
|
+
if (Scheduler && Transition && Transition.running) {
|
|
129
|
+
c.tState = STALE;
|
|
130
|
+
Updates.push(c);
|
|
131
|
+
} else updateComputation(c);
|
|
132
|
+
return readSignal.bind(c);
|
|
133
|
+
}
|
|
134
|
+
function untrack(fn) {
|
|
135
|
+
if (!ExternalSourceConfig && Listener === null) return fn();
|
|
136
|
+
const listener = Listener;
|
|
137
|
+
Listener = null;
|
|
138
|
+
try {
|
|
139
|
+
if (ExternalSourceConfig) return ExternalSourceConfig.untrack(fn);
|
|
140
|
+
return fn();
|
|
141
|
+
} finally {
|
|
142
|
+
Listener = listener;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
function onMount(fn) {
|
|
146
|
+
createEffect(() => untrack(fn));
|
|
147
|
+
}
|
|
148
|
+
function onCleanup(fn) {
|
|
149
|
+
if (Owner === null) ;
|
|
150
|
+
else if (Owner.cleanups === null) Owner.cleanups = [fn];
|
|
151
|
+
else Owner.cleanups.push(fn);
|
|
152
|
+
return fn;
|
|
153
|
+
}
|
|
154
|
+
function startTransition(fn) {
|
|
155
|
+
if (Transition && Transition.running) {
|
|
156
|
+
fn();
|
|
157
|
+
return Transition.done;
|
|
158
|
+
}
|
|
159
|
+
const l = Listener;
|
|
160
|
+
const o = Owner;
|
|
161
|
+
return Promise.resolve().then(() => {
|
|
162
|
+
Listener = l;
|
|
163
|
+
Owner = o;
|
|
164
|
+
let t;
|
|
165
|
+
if (Scheduler || SuspenseContext) {
|
|
166
|
+
t = Transition || (Transition = {
|
|
167
|
+
sources: /* @__PURE__ */ new Set(),
|
|
168
|
+
effects: [],
|
|
169
|
+
promises: /* @__PURE__ */ new Set(),
|
|
170
|
+
disposed: /* @__PURE__ */ new Set(),
|
|
171
|
+
queue: /* @__PURE__ */ new Set(),
|
|
172
|
+
running: true
|
|
173
|
+
});
|
|
174
|
+
t.done || (t.done = new Promise((res) => t.resolve = res));
|
|
175
|
+
t.running = true;
|
|
176
|
+
}
|
|
177
|
+
runUpdates(fn, false);
|
|
178
|
+
Listener = Owner = null;
|
|
179
|
+
return t ? t.done : void 0;
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
var [transPending, setTransPending] = /* @__PURE__ */ createSignal(false);
|
|
183
|
+
function createContext(defaultValue, options) {
|
|
184
|
+
const id = /* @__PURE__ */ Symbol("context");
|
|
185
|
+
return {
|
|
186
|
+
id,
|
|
187
|
+
Provider: createProvider(id),
|
|
188
|
+
defaultValue
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
function useContext(context) {
|
|
192
|
+
let value;
|
|
193
|
+
return Owner && Owner.context && (value = Owner.context[context.id]) !== void 0 ? value : context.defaultValue;
|
|
194
|
+
}
|
|
195
|
+
function children(fn) {
|
|
196
|
+
const children2 = createMemo(fn);
|
|
197
|
+
const memo3 = createMemo(() => resolveChildren(children2()));
|
|
198
|
+
memo3.toArray = () => {
|
|
199
|
+
const c = memo3();
|
|
200
|
+
return Array.isArray(c) ? c : c != null ? [c] : [];
|
|
201
|
+
};
|
|
202
|
+
return memo3;
|
|
203
|
+
}
|
|
204
|
+
var SuspenseContext;
|
|
205
|
+
function readSignal() {
|
|
206
|
+
const runningTransition = Transition && Transition.running;
|
|
207
|
+
if (this.sources && (runningTransition ? this.tState : this.state)) {
|
|
208
|
+
if ((runningTransition ? this.tState : this.state) === STALE) updateComputation(this);
|
|
209
|
+
else {
|
|
210
|
+
const updates = Updates;
|
|
211
|
+
Updates = null;
|
|
212
|
+
runUpdates(() => lookUpstream(this), false);
|
|
213
|
+
Updates = updates;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
if (Listener) {
|
|
217
|
+
const sSlot = this.observers ? this.observers.length : 0;
|
|
218
|
+
if (!Listener.sources) {
|
|
219
|
+
Listener.sources = [this];
|
|
220
|
+
Listener.sourceSlots = [sSlot];
|
|
221
|
+
} else {
|
|
222
|
+
Listener.sources.push(this);
|
|
223
|
+
Listener.sourceSlots.push(sSlot);
|
|
224
|
+
}
|
|
225
|
+
if (!this.observers) {
|
|
226
|
+
this.observers = [Listener];
|
|
227
|
+
this.observerSlots = [Listener.sources.length - 1];
|
|
228
|
+
} else {
|
|
229
|
+
this.observers.push(Listener);
|
|
230
|
+
this.observerSlots.push(Listener.sources.length - 1);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
if (runningTransition && Transition.sources.has(this)) return this.tValue;
|
|
234
|
+
return this.value;
|
|
235
|
+
}
|
|
236
|
+
function writeSignal(node, value, isComp) {
|
|
237
|
+
let current = Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
|
|
238
|
+
if (!node.comparator || !node.comparator(current, value)) {
|
|
239
|
+
if (Transition) {
|
|
240
|
+
const TransitionRunning = Transition.running;
|
|
241
|
+
if (TransitionRunning || !isComp && Transition.sources.has(node)) {
|
|
242
|
+
Transition.sources.add(node);
|
|
243
|
+
node.tValue = value;
|
|
244
|
+
}
|
|
245
|
+
if (!TransitionRunning) node.value = value;
|
|
246
|
+
} else node.value = value;
|
|
247
|
+
if (node.observers && node.observers.length) {
|
|
248
|
+
runUpdates(() => {
|
|
249
|
+
for (let i = 0; i < node.observers.length; i += 1) {
|
|
250
|
+
const o = node.observers[i];
|
|
251
|
+
const TransitionRunning = Transition && Transition.running;
|
|
252
|
+
if (TransitionRunning && Transition.disposed.has(o)) continue;
|
|
253
|
+
if (TransitionRunning ? !o.tState : !o.state) {
|
|
254
|
+
if (o.pure) Updates.push(o);
|
|
255
|
+
else Effects.push(o);
|
|
256
|
+
if (o.observers) markDownstream(o);
|
|
257
|
+
}
|
|
258
|
+
if (!TransitionRunning) o.state = STALE;
|
|
259
|
+
else o.tState = STALE;
|
|
260
|
+
}
|
|
261
|
+
if (Updates.length > 1e6) {
|
|
262
|
+
Updates = [];
|
|
263
|
+
if (IS_DEV) ;
|
|
264
|
+
throw new Error();
|
|
265
|
+
}
|
|
266
|
+
}, false);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
return value;
|
|
270
|
+
}
|
|
271
|
+
function updateComputation(node) {
|
|
272
|
+
if (!node.fn) return;
|
|
273
|
+
cleanNode(node);
|
|
274
|
+
const time = ExecCount;
|
|
275
|
+
runComputation(node, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, time);
|
|
276
|
+
if (Transition && !Transition.running && Transition.sources.has(node)) {
|
|
277
|
+
queueMicrotask(() => {
|
|
278
|
+
runUpdates(() => {
|
|
279
|
+
Transition && (Transition.running = true);
|
|
280
|
+
Listener = Owner = node;
|
|
281
|
+
runComputation(node, node.tValue, time);
|
|
282
|
+
Listener = Owner = null;
|
|
283
|
+
}, false);
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
function runComputation(node, value, time) {
|
|
288
|
+
let nextValue;
|
|
289
|
+
const owner = Owner, listener = Listener;
|
|
290
|
+
Listener = Owner = node;
|
|
291
|
+
try {
|
|
292
|
+
nextValue = node.fn(value);
|
|
293
|
+
} catch (err) {
|
|
294
|
+
if (node.pure) {
|
|
295
|
+
if (Transition && Transition.running) {
|
|
296
|
+
node.tState = STALE;
|
|
297
|
+
node.tOwned && node.tOwned.forEach(cleanNode);
|
|
298
|
+
node.tOwned = void 0;
|
|
299
|
+
} else {
|
|
300
|
+
node.state = STALE;
|
|
301
|
+
node.owned && node.owned.forEach(cleanNode);
|
|
302
|
+
node.owned = null;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
node.updatedAt = time + 1;
|
|
306
|
+
return handleError(err);
|
|
307
|
+
} finally {
|
|
308
|
+
Listener = listener;
|
|
309
|
+
Owner = owner;
|
|
310
|
+
}
|
|
311
|
+
if (!node.updatedAt || node.updatedAt <= time) {
|
|
312
|
+
if (node.updatedAt != null && "observers" in node) {
|
|
313
|
+
writeSignal(node, nextValue, true);
|
|
314
|
+
} else if (Transition && Transition.running && node.pure) {
|
|
315
|
+
Transition.sources.add(node);
|
|
316
|
+
node.tValue = nextValue;
|
|
317
|
+
} else node.value = nextValue;
|
|
318
|
+
node.updatedAt = time;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
function createComputation(fn, init, pure, state = STALE, options) {
|
|
322
|
+
const c = {
|
|
323
|
+
fn,
|
|
324
|
+
state,
|
|
325
|
+
updatedAt: null,
|
|
326
|
+
owned: null,
|
|
327
|
+
sources: null,
|
|
328
|
+
sourceSlots: null,
|
|
329
|
+
cleanups: null,
|
|
330
|
+
value: init,
|
|
331
|
+
owner: Owner,
|
|
332
|
+
context: Owner ? Owner.context : null,
|
|
333
|
+
pure
|
|
334
|
+
};
|
|
335
|
+
if (Transition && Transition.running) {
|
|
336
|
+
c.state = 0;
|
|
337
|
+
c.tState = state;
|
|
338
|
+
}
|
|
339
|
+
if (Owner === null) ;
|
|
340
|
+
else if (Owner !== UNOWNED) {
|
|
341
|
+
if (Transition && Transition.running && Owner.pure) {
|
|
342
|
+
if (!Owner.tOwned) Owner.tOwned = [c];
|
|
343
|
+
else Owner.tOwned.push(c);
|
|
344
|
+
} else {
|
|
345
|
+
if (!Owner.owned) Owner.owned = [c];
|
|
346
|
+
else Owner.owned.push(c);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
if (ExternalSourceConfig && c.fn) {
|
|
350
|
+
const [track, trigger] = createSignal(void 0, {
|
|
351
|
+
equals: false
|
|
352
|
+
});
|
|
353
|
+
const ordinary = ExternalSourceConfig.factory(c.fn, trigger);
|
|
354
|
+
onCleanup(() => ordinary.dispose());
|
|
355
|
+
const triggerInTransition = () => startTransition(trigger).then(() => inTransition.dispose());
|
|
356
|
+
const inTransition = ExternalSourceConfig.factory(c.fn, triggerInTransition);
|
|
357
|
+
c.fn = (x) => {
|
|
358
|
+
track();
|
|
359
|
+
return Transition && Transition.running ? inTransition.track(x) : ordinary.track(x);
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
return c;
|
|
363
|
+
}
|
|
364
|
+
function runTop(node) {
|
|
365
|
+
const runningTransition = Transition && Transition.running;
|
|
366
|
+
if ((runningTransition ? node.tState : node.state) === 0) return;
|
|
367
|
+
if ((runningTransition ? node.tState : node.state) === PENDING) return lookUpstream(node);
|
|
368
|
+
if (node.suspense && untrack(node.suspense.inFallback)) return node.suspense.effects.push(node);
|
|
369
|
+
const ancestors = [node];
|
|
370
|
+
while ((node = node.owner) && (!node.updatedAt || node.updatedAt < ExecCount)) {
|
|
371
|
+
if (runningTransition && Transition.disposed.has(node)) return;
|
|
372
|
+
if (runningTransition ? node.tState : node.state) ancestors.push(node);
|
|
373
|
+
}
|
|
374
|
+
for (let i = ancestors.length - 1; i >= 0; i--) {
|
|
375
|
+
node = ancestors[i];
|
|
376
|
+
if (runningTransition) {
|
|
377
|
+
let top = node, prev = ancestors[i + 1];
|
|
378
|
+
while ((top = top.owner) && top !== prev) {
|
|
379
|
+
if (Transition.disposed.has(top)) return;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
if ((runningTransition ? node.tState : node.state) === STALE) {
|
|
383
|
+
updateComputation(node);
|
|
384
|
+
} else if ((runningTransition ? node.tState : node.state) === PENDING) {
|
|
385
|
+
const updates = Updates;
|
|
386
|
+
Updates = null;
|
|
387
|
+
runUpdates(() => lookUpstream(node, ancestors[0]), false);
|
|
388
|
+
Updates = updates;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
function runUpdates(fn, init) {
|
|
393
|
+
if (Updates) return fn();
|
|
394
|
+
let wait = false;
|
|
395
|
+
if (!init) Updates = [];
|
|
396
|
+
if (Effects) wait = true;
|
|
397
|
+
else Effects = [];
|
|
398
|
+
ExecCount++;
|
|
399
|
+
try {
|
|
400
|
+
const res = fn();
|
|
401
|
+
completeUpdates(wait);
|
|
402
|
+
return res;
|
|
403
|
+
} catch (err) {
|
|
404
|
+
if (!wait) Effects = null;
|
|
405
|
+
Updates = null;
|
|
406
|
+
handleError(err);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
function completeUpdates(wait) {
|
|
410
|
+
if (Updates) {
|
|
411
|
+
if (Scheduler && Transition && Transition.running) scheduleQueue(Updates);
|
|
412
|
+
else runQueue(Updates);
|
|
413
|
+
Updates = null;
|
|
414
|
+
}
|
|
415
|
+
if (wait) return;
|
|
416
|
+
let res;
|
|
417
|
+
if (Transition) {
|
|
418
|
+
if (!Transition.promises.size && !Transition.queue.size) {
|
|
419
|
+
const sources = Transition.sources;
|
|
420
|
+
const disposed = Transition.disposed;
|
|
421
|
+
Effects.push.apply(Effects, Transition.effects);
|
|
422
|
+
res = Transition.resolve;
|
|
423
|
+
for (const e2 of Effects) {
|
|
424
|
+
"tState" in e2 && (e2.state = e2.tState);
|
|
425
|
+
delete e2.tState;
|
|
426
|
+
}
|
|
427
|
+
Transition = null;
|
|
428
|
+
runUpdates(() => {
|
|
429
|
+
for (const d of disposed) cleanNode(d);
|
|
430
|
+
for (const v of sources) {
|
|
431
|
+
v.value = v.tValue;
|
|
432
|
+
if (v.owned) {
|
|
433
|
+
for (let i = 0, len = v.owned.length; i < len; i++) cleanNode(v.owned[i]);
|
|
434
|
+
}
|
|
435
|
+
if (v.tOwned) v.owned = v.tOwned;
|
|
436
|
+
delete v.tValue;
|
|
437
|
+
delete v.tOwned;
|
|
438
|
+
v.tState = 0;
|
|
439
|
+
}
|
|
440
|
+
setTransPending(false);
|
|
441
|
+
}, false);
|
|
442
|
+
} else if (Transition.running) {
|
|
443
|
+
Transition.running = false;
|
|
444
|
+
Transition.effects.push.apply(Transition.effects, Effects);
|
|
445
|
+
Effects = null;
|
|
446
|
+
setTransPending(true);
|
|
447
|
+
return;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
const e = Effects;
|
|
451
|
+
Effects = null;
|
|
452
|
+
if (e.length) runUpdates(() => runEffects(e), false);
|
|
453
|
+
if (res) res();
|
|
454
|
+
}
|
|
455
|
+
function runQueue(queue) {
|
|
456
|
+
for (let i = 0; i < queue.length; i++) runTop(queue[i]);
|
|
457
|
+
}
|
|
458
|
+
function scheduleQueue(queue) {
|
|
459
|
+
for (let i = 0; i < queue.length; i++) {
|
|
460
|
+
const item = queue[i];
|
|
461
|
+
const tasks = Transition.queue;
|
|
462
|
+
if (!tasks.has(item)) {
|
|
463
|
+
tasks.add(item);
|
|
464
|
+
Scheduler(() => {
|
|
465
|
+
tasks.delete(item);
|
|
466
|
+
runUpdates(() => {
|
|
467
|
+
Transition.running = true;
|
|
468
|
+
runTop(item);
|
|
469
|
+
}, false);
|
|
470
|
+
Transition && (Transition.running = false);
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
function runUserEffects(queue) {
|
|
476
|
+
let i, userLength = 0;
|
|
477
|
+
for (i = 0; i < queue.length; i++) {
|
|
478
|
+
const e = queue[i];
|
|
479
|
+
if (!e.user) runTop(e);
|
|
480
|
+
else queue[userLength++] = e;
|
|
481
|
+
}
|
|
482
|
+
if (sharedConfig.context) {
|
|
483
|
+
if (sharedConfig.count) {
|
|
484
|
+
sharedConfig.effects || (sharedConfig.effects = []);
|
|
485
|
+
sharedConfig.effects.push(...queue.slice(0, userLength));
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
setHydrateContext();
|
|
489
|
+
}
|
|
490
|
+
if (sharedConfig.effects && (sharedConfig.done || !sharedConfig.count)) {
|
|
491
|
+
queue = [...sharedConfig.effects, ...queue];
|
|
492
|
+
userLength += sharedConfig.effects.length;
|
|
493
|
+
delete sharedConfig.effects;
|
|
494
|
+
}
|
|
495
|
+
for (i = 0; i < userLength; i++) runTop(queue[i]);
|
|
496
|
+
}
|
|
497
|
+
function lookUpstream(node, ignore) {
|
|
498
|
+
const runningTransition = Transition && Transition.running;
|
|
499
|
+
if (runningTransition) node.tState = 0;
|
|
500
|
+
else node.state = 0;
|
|
501
|
+
for (let i = 0; i < node.sources.length; i += 1) {
|
|
502
|
+
const source = node.sources[i];
|
|
503
|
+
if (source.sources) {
|
|
504
|
+
const state = runningTransition ? source.tState : source.state;
|
|
505
|
+
if (state === STALE) {
|
|
506
|
+
if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount)) runTop(source);
|
|
507
|
+
} else if (state === PENDING) lookUpstream(source, ignore);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
function markDownstream(node) {
|
|
512
|
+
const runningTransition = Transition && Transition.running;
|
|
513
|
+
for (let i = 0; i < node.observers.length; i += 1) {
|
|
514
|
+
const o = node.observers[i];
|
|
515
|
+
if (runningTransition ? !o.tState : !o.state) {
|
|
516
|
+
if (runningTransition) o.tState = PENDING;
|
|
517
|
+
else o.state = PENDING;
|
|
518
|
+
if (o.pure) Updates.push(o);
|
|
519
|
+
else Effects.push(o);
|
|
520
|
+
o.observers && markDownstream(o);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
function cleanNode(node) {
|
|
525
|
+
let i;
|
|
526
|
+
if (node.sources) {
|
|
527
|
+
while (node.sources.length) {
|
|
528
|
+
const source = node.sources.pop(), index = node.sourceSlots.pop(), obs = source.observers;
|
|
529
|
+
if (obs && obs.length) {
|
|
530
|
+
const n = obs.pop(), s = source.observerSlots.pop();
|
|
531
|
+
if (index < obs.length) {
|
|
532
|
+
n.sourceSlots[s] = index;
|
|
533
|
+
obs[index] = n;
|
|
534
|
+
source.observerSlots[index] = s;
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
if (node.tOwned) {
|
|
540
|
+
for (i = node.tOwned.length - 1; i >= 0; i--) cleanNode(node.tOwned[i]);
|
|
541
|
+
delete node.tOwned;
|
|
542
|
+
}
|
|
543
|
+
if (Transition && Transition.running && node.pure) {
|
|
544
|
+
reset(node, true);
|
|
545
|
+
} else if (node.owned) {
|
|
546
|
+
for (i = node.owned.length - 1; i >= 0; i--) cleanNode(node.owned[i]);
|
|
547
|
+
node.owned = null;
|
|
548
|
+
}
|
|
549
|
+
if (node.cleanups) {
|
|
550
|
+
for (i = node.cleanups.length - 1; i >= 0; i--) node.cleanups[i]();
|
|
551
|
+
node.cleanups = null;
|
|
552
|
+
}
|
|
553
|
+
if (Transition && Transition.running) node.tState = 0;
|
|
554
|
+
else node.state = 0;
|
|
555
|
+
}
|
|
556
|
+
function reset(node, top) {
|
|
557
|
+
if (!top) {
|
|
558
|
+
node.tState = 0;
|
|
559
|
+
Transition.disposed.add(node);
|
|
560
|
+
}
|
|
561
|
+
if (node.owned) {
|
|
562
|
+
for (let i = 0; i < node.owned.length; i++) reset(node.owned[i]);
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
function castError(err) {
|
|
566
|
+
if (err instanceof Error) return err;
|
|
567
|
+
return new Error(typeof err === "string" ? err : "Unknown error", {
|
|
568
|
+
cause: err
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
function runErrors(err, fns, owner) {
|
|
572
|
+
try {
|
|
573
|
+
for (const f of fns) f(err);
|
|
574
|
+
} catch (e) {
|
|
575
|
+
handleError(e, owner && owner.owner || null);
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
function handleError(err, owner = Owner) {
|
|
579
|
+
const fns = ERROR && owner && owner.context && owner.context[ERROR];
|
|
580
|
+
const error = castError(err);
|
|
581
|
+
if (!fns) throw error;
|
|
582
|
+
if (Effects) Effects.push({
|
|
583
|
+
fn() {
|
|
584
|
+
runErrors(error, fns, owner);
|
|
585
|
+
},
|
|
586
|
+
state: STALE
|
|
587
|
+
});
|
|
588
|
+
else runErrors(error, fns, owner);
|
|
589
|
+
}
|
|
590
|
+
function resolveChildren(children2) {
|
|
591
|
+
if (typeof children2 === "function" && !children2.length) return resolveChildren(children2());
|
|
592
|
+
if (Array.isArray(children2)) {
|
|
593
|
+
const results = [];
|
|
594
|
+
for (let i = 0; i < children2.length; i++) {
|
|
595
|
+
const result = resolveChildren(children2[i]);
|
|
596
|
+
Array.isArray(result) ? results.push.apply(results, result) : results.push(result);
|
|
597
|
+
}
|
|
598
|
+
return results;
|
|
599
|
+
}
|
|
600
|
+
return children2;
|
|
601
|
+
}
|
|
602
|
+
function createProvider(id, options) {
|
|
603
|
+
return function provider(props) {
|
|
604
|
+
let res;
|
|
605
|
+
createRenderEffect(() => res = untrack(() => {
|
|
606
|
+
Owner.context = {
|
|
607
|
+
...Owner.context,
|
|
608
|
+
[id]: props.value
|
|
609
|
+
};
|
|
610
|
+
return children(() => props.children);
|
|
611
|
+
}), void 0);
|
|
612
|
+
return res;
|
|
613
|
+
};
|
|
614
|
+
}
|
|
615
|
+
var FALLBACK = /* @__PURE__ */ Symbol("fallback");
|
|
616
|
+
function dispose(d) {
|
|
617
|
+
for (let i = 0; i < d.length; i++) d[i]();
|
|
618
|
+
}
|
|
619
|
+
function mapArray(list, mapFn, options = {}) {
|
|
620
|
+
let items = [], mapped = [], disposers = [], len = 0, indexes = mapFn.length > 1 ? [] : null;
|
|
621
|
+
onCleanup(() => dispose(disposers));
|
|
622
|
+
return () => {
|
|
623
|
+
let newItems = list() || [], newLen = newItems.length, i, j;
|
|
624
|
+
newItems[$TRACK];
|
|
625
|
+
return untrack(() => {
|
|
626
|
+
let newIndices, newIndicesNext, temp, tempdisposers, tempIndexes, start, end, newEnd, item;
|
|
627
|
+
if (newLen === 0) {
|
|
628
|
+
if (len !== 0) {
|
|
629
|
+
dispose(disposers);
|
|
630
|
+
disposers = [];
|
|
631
|
+
items = [];
|
|
632
|
+
mapped = [];
|
|
633
|
+
len = 0;
|
|
634
|
+
indexes && (indexes = []);
|
|
635
|
+
}
|
|
636
|
+
if (options.fallback) {
|
|
637
|
+
items = [FALLBACK];
|
|
638
|
+
mapped[0] = createRoot((disposer) => {
|
|
639
|
+
disposers[0] = disposer;
|
|
640
|
+
return options.fallback();
|
|
641
|
+
});
|
|
642
|
+
len = 1;
|
|
643
|
+
}
|
|
644
|
+
} else if (len === 0) {
|
|
645
|
+
mapped = new Array(newLen);
|
|
646
|
+
for (j = 0; j < newLen; j++) {
|
|
647
|
+
items[j] = newItems[j];
|
|
648
|
+
mapped[j] = createRoot(mapper);
|
|
649
|
+
}
|
|
650
|
+
len = newLen;
|
|
651
|
+
} else {
|
|
652
|
+
temp = new Array(newLen);
|
|
653
|
+
tempdisposers = new Array(newLen);
|
|
654
|
+
indexes && (tempIndexes = new Array(newLen));
|
|
655
|
+
for (start = 0, end = Math.min(len, newLen); start < end && items[start] === newItems[start]; start++) ;
|
|
656
|
+
for (end = len - 1, newEnd = newLen - 1; end >= start && newEnd >= start && items[end] === newItems[newEnd]; end--, newEnd--) {
|
|
657
|
+
temp[newEnd] = mapped[end];
|
|
658
|
+
tempdisposers[newEnd] = disposers[end];
|
|
659
|
+
indexes && (tempIndexes[newEnd] = indexes[end]);
|
|
660
|
+
}
|
|
661
|
+
newIndices = /* @__PURE__ */ new Map();
|
|
662
|
+
newIndicesNext = new Array(newEnd + 1);
|
|
663
|
+
for (j = newEnd; j >= start; j--) {
|
|
664
|
+
item = newItems[j];
|
|
665
|
+
i = newIndices.get(item);
|
|
666
|
+
newIndicesNext[j] = i === void 0 ? -1 : i;
|
|
667
|
+
newIndices.set(item, j);
|
|
668
|
+
}
|
|
669
|
+
for (i = start; i <= end; i++) {
|
|
670
|
+
item = items[i];
|
|
671
|
+
j = newIndices.get(item);
|
|
672
|
+
if (j !== void 0 && j !== -1) {
|
|
673
|
+
temp[j] = mapped[i];
|
|
674
|
+
tempdisposers[j] = disposers[i];
|
|
675
|
+
indexes && (tempIndexes[j] = indexes[i]);
|
|
676
|
+
j = newIndicesNext[j];
|
|
677
|
+
newIndices.set(item, j);
|
|
678
|
+
} else disposers[i]();
|
|
679
|
+
}
|
|
680
|
+
for (j = start; j < newLen; j++) {
|
|
681
|
+
if (j in temp) {
|
|
682
|
+
mapped[j] = temp[j];
|
|
683
|
+
disposers[j] = tempdisposers[j];
|
|
684
|
+
if (indexes) {
|
|
685
|
+
indexes[j] = tempIndexes[j];
|
|
686
|
+
indexes[j](j);
|
|
687
|
+
}
|
|
688
|
+
} else mapped[j] = createRoot(mapper);
|
|
689
|
+
}
|
|
690
|
+
mapped = mapped.slice(0, len = newLen);
|
|
691
|
+
items = newItems.slice(0);
|
|
692
|
+
}
|
|
693
|
+
return mapped;
|
|
694
|
+
});
|
|
695
|
+
function mapper(disposer) {
|
|
696
|
+
disposers[j] = disposer;
|
|
697
|
+
if (indexes) {
|
|
698
|
+
const [s, set] = createSignal(j);
|
|
699
|
+
indexes[j] = set;
|
|
700
|
+
return mapFn(newItems[j], s);
|
|
701
|
+
}
|
|
702
|
+
return mapFn(newItems[j]);
|
|
703
|
+
}
|
|
704
|
+
};
|
|
705
|
+
}
|
|
706
|
+
var hydrationEnabled = false;
|
|
707
|
+
function createComponent(Comp, props) {
|
|
708
|
+
if (hydrationEnabled) {
|
|
709
|
+
if (sharedConfig.context) {
|
|
710
|
+
const c = sharedConfig.context;
|
|
711
|
+
setHydrateContext(nextHydrateContext());
|
|
712
|
+
const r = untrack(() => Comp(props || {}));
|
|
713
|
+
setHydrateContext(c);
|
|
714
|
+
return r;
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
return untrack(() => Comp(props || {}));
|
|
718
|
+
}
|
|
719
|
+
function trueFn() {
|
|
720
|
+
return true;
|
|
721
|
+
}
|
|
722
|
+
var propTraps = {
|
|
723
|
+
get(_, property, receiver) {
|
|
724
|
+
if (property === $PROXY) return receiver;
|
|
725
|
+
return _.get(property);
|
|
726
|
+
},
|
|
727
|
+
has(_, property) {
|
|
728
|
+
if (property === $PROXY) return true;
|
|
729
|
+
return _.has(property);
|
|
730
|
+
},
|
|
731
|
+
set: trueFn,
|
|
732
|
+
deleteProperty: trueFn,
|
|
733
|
+
getOwnPropertyDescriptor(_, property) {
|
|
734
|
+
return {
|
|
735
|
+
configurable: true,
|
|
736
|
+
enumerable: true,
|
|
737
|
+
get() {
|
|
738
|
+
return _.get(property);
|
|
739
|
+
},
|
|
740
|
+
set: trueFn,
|
|
741
|
+
deleteProperty: trueFn
|
|
742
|
+
};
|
|
743
|
+
},
|
|
744
|
+
ownKeys(_) {
|
|
745
|
+
return _.keys();
|
|
746
|
+
}
|
|
747
|
+
};
|
|
748
|
+
function resolveSource(s) {
|
|
749
|
+
return !(s = typeof s === "function" ? s() : s) ? {} : s;
|
|
750
|
+
}
|
|
751
|
+
function resolveSources() {
|
|
752
|
+
for (let i = 0, length = this.length; i < length; ++i) {
|
|
753
|
+
const v = this[i]();
|
|
754
|
+
if (v !== void 0) return v;
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
function mergeProps(...sources) {
|
|
758
|
+
let proxy = false;
|
|
759
|
+
for (let i = 0; i < sources.length; i++) {
|
|
760
|
+
const s = sources[i];
|
|
761
|
+
proxy = proxy || !!s && $PROXY in s;
|
|
762
|
+
sources[i] = typeof s === "function" ? (proxy = true, createMemo(s)) : s;
|
|
763
|
+
}
|
|
764
|
+
if (SUPPORTS_PROXY && proxy) {
|
|
765
|
+
return new Proxy({
|
|
766
|
+
get(property) {
|
|
767
|
+
for (let i = sources.length - 1; i >= 0; i--) {
|
|
768
|
+
const v = resolveSource(sources[i])[property];
|
|
769
|
+
if (v !== void 0) return v;
|
|
770
|
+
}
|
|
771
|
+
},
|
|
772
|
+
has(property) {
|
|
773
|
+
for (let i = sources.length - 1; i >= 0; i--) {
|
|
774
|
+
if (property in resolveSource(sources[i])) return true;
|
|
775
|
+
}
|
|
776
|
+
return false;
|
|
777
|
+
},
|
|
778
|
+
keys() {
|
|
779
|
+
const keys = [];
|
|
780
|
+
for (let i = 0; i < sources.length; i++) keys.push(...Object.keys(resolveSource(sources[i])));
|
|
781
|
+
return [...new Set(keys)];
|
|
782
|
+
}
|
|
783
|
+
}, propTraps);
|
|
784
|
+
}
|
|
785
|
+
const sourcesMap = {};
|
|
786
|
+
const defined = /* @__PURE__ */ Object.create(null);
|
|
787
|
+
for (let i = sources.length - 1; i >= 0; i--) {
|
|
788
|
+
const source = sources[i];
|
|
789
|
+
if (!source) continue;
|
|
790
|
+
const sourceKeys = Object.getOwnPropertyNames(source);
|
|
791
|
+
for (let i2 = sourceKeys.length - 1; i2 >= 0; i2--) {
|
|
792
|
+
const key = sourceKeys[i2];
|
|
793
|
+
if (key === "__proto__" || key === "constructor") continue;
|
|
794
|
+
const desc = Object.getOwnPropertyDescriptor(source, key);
|
|
795
|
+
if (!defined[key]) {
|
|
796
|
+
defined[key] = desc.get ? {
|
|
797
|
+
enumerable: true,
|
|
798
|
+
configurable: true,
|
|
799
|
+
get: resolveSources.bind(sourcesMap[key] = [desc.get.bind(source)])
|
|
800
|
+
} : desc.value !== void 0 ? desc : void 0;
|
|
801
|
+
} else {
|
|
802
|
+
const sources2 = sourcesMap[key];
|
|
803
|
+
if (sources2) {
|
|
804
|
+
if (desc.get) sources2.push(desc.get.bind(source));
|
|
805
|
+
else if (desc.value !== void 0) sources2.push(() => desc.value);
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
const target = {};
|
|
811
|
+
const definedKeys = Object.keys(defined);
|
|
812
|
+
for (let i = definedKeys.length - 1; i >= 0; i--) {
|
|
813
|
+
const key = definedKeys[i], desc = defined[key];
|
|
814
|
+
if (desc && desc.get) Object.defineProperty(target, key, desc);
|
|
815
|
+
else target[key] = desc ? desc.value : void 0;
|
|
816
|
+
}
|
|
817
|
+
return target;
|
|
818
|
+
}
|
|
819
|
+
var narrowedError = (name) => `Stale read from <${name}>.`;
|
|
820
|
+
function For(props) {
|
|
821
|
+
const fallback = "fallback" in props && {
|
|
822
|
+
fallback: () => props.fallback
|
|
823
|
+
};
|
|
824
|
+
return createMemo(mapArray(() => props.each, props.children, fallback || void 0));
|
|
825
|
+
}
|
|
826
|
+
function Show(props) {
|
|
827
|
+
const keyed = props.keyed;
|
|
828
|
+
const conditionValue = createMemo(() => props.when, void 0, void 0);
|
|
829
|
+
const condition = keyed ? conditionValue : createMemo(conditionValue, void 0, {
|
|
830
|
+
equals: (a, b) => !a === !b
|
|
831
|
+
});
|
|
832
|
+
return createMemo(() => {
|
|
833
|
+
const c = condition();
|
|
834
|
+
if (c) {
|
|
835
|
+
const child = props.children;
|
|
836
|
+
const fn = typeof child === "function" && child.length > 0;
|
|
837
|
+
return fn ? untrack(() => child(keyed ? c : () => {
|
|
838
|
+
if (!untrack(condition)) throw narrowedError("Show");
|
|
839
|
+
return conditionValue();
|
|
840
|
+
})) : child;
|
|
841
|
+
}
|
|
842
|
+
return props.fallback;
|
|
843
|
+
}, void 0, void 0);
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
// node_modules/@opentui/solid/index.js
|
|
847
|
+
import {
|
|
848
|
+
BaseRenderable,
|
|
849
|
+
createTextAttributes,
|
|
850
|
+
InputRenderable,
|
|
851
|
+
InputRenderableEvents,
|
|
852
|
+
isTextNodeRenderable,
|
|
853
|
+
parseColor,
|
|
854
|
+
Renderable,
|
|
855
|
+
RootTextNodeRenderable,
|
|
856
|
+
SelectRenderable,
|
|
857
|
+
SelectRenderableEvents,
|
|
858
|
+
TabSelectRenderable,
|
|
859
|
+
TabSelectRenderableEvents,
|
|
860
|
+
TextNodeRenderable,
|
|
861
|
+
TextRenderable
|
|
862
|
+
} from "@opentui/core";
|
|
863
|
+
import { BaseRenderable as BaseRenderable2, isTextNodeRenderable as isTextNodeRenderable2, TextNodeRenderable as TextNodeRenderable2, TextRenderable as TextRenderable2, Yoga } from "@opentui/core";
|
|
864
|
+
var RendererContext = createContext();
|
|
865
|
+
var useRenderer = () => {
|
|
866
|
+
const renderer = useContext(RendererContext);
|
|
867
|
+
if (!renderer) {
|
|
868
|
+
throw new Error("No renderer found");
|
|
869
|
+
}
|
|
870
|
+
return renderer;
|
|
871
|
+
};
|
|
872
|
+
var onResize = (callback) => {
|
|
873
|
+
const renderer = useRenderer();
|
|
874
|
+
onMount(() => {
|
|
875
|
+
renderer.on("resize", callback);
|
|
876
|
+
});
|
|
877
|
+
onCleanup(() => {
|
|
878
|
+
renderer.off("resize", callback);
|
|
879
|
+
});
|
|
880
|
+
};
|
|
881
|
+
var useTerminalDimensions = () => {
|
|
882
|
+
const renderer = useRenderer();
|
|
883
|
+
const [terminalDimensions, setTerminalDimensions] = createSignal({ width: renderer.width, height: renderer.height });
|
|
884
|
+
const callback = (width, height) => {
|
|
885
|
+
setTerminalDimensions({ width, height });
|
|
886
|
+
};
|
|
887
|
+
onResize(callback);
|
|
888
|
+
return terminalDimensions;
|
|
889
|
+
};
|
|
890
|
+
var memo = (fn) => createMemo(() => fn());
|
|
891
|
+
function createRenderer({
|
|
892
|
+
createElement: createElement2,
|
|
893
|
+
createTextNode: createTextNode2,
|
|
894
|
+
createSlotNode: createSlotNode2,
|
|
895
|
+
isTextNode,
|
|
896
|
+
replaceText,
|
|
897
|
+
insertNode: insertNode2,
|
|
898
|
+
removeNode,
|
|
899
|
+
setProperty,
|
|
900
|
+
getParentNode,
|
|
901
|
+
getFirstChild,
|
|
902
|
+
getNextSibling
|
|
903
|
+
}) {
|
|
904
|
+
function insert3(parent, accessor, marker, initial) {
|
|
905
|
+
if (marker !== void 0 && !initial)
|
|
906
|
+
initial = [];
|
|
907
|
+
if (typeof accessor !== "function")
|
|
908
|
+
return insertExpression2(parent, accessor, initial, marker);
|
|
909
|
+
createRenderEffect((current) => insertExpression2(parent, accessor(), current, marker), initial);
|
|
910
|
+
}
|
|
911
|
+
function insertExpression2(parent, value, current, marker, unwrapArray) {
|
|
912
|
+
while (typeof current === "function")
|
|
913
|
+
current = current();
|
|
914
|
+
if (value === current)
|
|
915
|
+
return current;
|
|
916
|
+
const t = typeof value, multi = marker !== void 0;
|
|
917
|
+
if (t === "string" || t === "number") {
|
|
918
|
+
if (t === "number")
|
|
919
|
+
value = value.toString();
|
|
920
|
+
if (multi) {
|
|
921
|
+
let node = current[0];
|
|
922
|
+
if (node && isTextNode(node)) {
|
|
923
|
+
replaceText(node, value);
|
|
924
|
+
} else
|
|
925
|
+
node = createTextNode2(value);
|
|
926
|
+
current = cleanChildren2(parent, current, marker, node);
|
|
927
|
+
} else {
|
|
928
|
+
if (current !== "" && typeof current === "string") {
|
|
929
|
+
replaceText(getFirstChild(parent), current = value);
|
|
930
|
+
} else {
|
|
931
|
+
cleanChildren2(parent, current, marker, createTextNode2(value));
|
|
932
|
+
current = value;
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
} else if (value == null || t === "boolean") {
|
|
936
|
+
current = cleanChildren2(parent, current, marker);
|
|
937
|
+
} else if (t === "function") {
|
|
938
|
+
createRenderEffect(() => {
|
|
939
|
+
let v = value();
|
|
940
|
+
while (typeof v === "function")
|
|
941
|
+
v = v();
|
|
942
|
+
current = insertExpression2(parent, v, current, marker);
|
|
943
|
+
});
|
|
944
|
+
return () => current;
|
|
945
|
+
} else if (Array.isArray(value)) {
|
|
946
|
+
const array = [];
|
|
947
|
+
if (normalizeIncomingArray2(array, value, unwrapArray)) {
|
|
948
|
+
createRenderEffect(() => current = insertExpression2(parent, array, current, marker, true));
|
|
949
|
+
return () => current;
|
|
950
|
+
}
|
|
951
|
+
if (array.length === 0) {
|
|
952
|
+
const replacement = cleanChildren2(parent, current, marker);
|
|
953
|
+
if (multi)
|
|
954
|
+
return current = replacement;
|
|
955
|
+
} else {
|
|
956
|
+
if (Array.isArray(current)) {
|
|
957
|
+
if (current.length === 0) {
|
|
958
|
+
appendNodes2(parent, array, marker);
|
|
959
|
+
} else
|
|
960
|
+
reconcileArrays2(parent, current, array);
|
|
961
|
+
} else if (current == null || current === "") {
|
|
962
|
+
appendNodes2(parent, array);
|
|
963
|
+
} else {
|
|
964
|
+
reconcileArrays2(parent, multi && current || [getFirstChild(parent)], array);
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
current = array;
|
|
968
|
+
} else {
|
|
969
|
+
if (Array.isArray(current)) {
|
|
970
|
+
if (multi)
|
|
971
|
+
return current = cleanChildren2(parent, current, marker, value);
|
|
972
|
+
cleanChildren2(parent, current, null, value);
|
|
973
|
+
} else if (current == null || current === "" || !getFirstChild(parent)) {
|
|
974
|
+
insertNode2(parent, value);
|
|
975
|
+
} else
|
|
976
|
+
replaceNode(parent, value, getFirstChild(parent));
|
|
977
|
+
current = value;
|
|
978
|
+
}
|
|
979
|
+
return current;
|
|
980
|
+
}
|
|
981
|
+
function normalizeIncomingArray2(normalized, array, unwrap) {
|
|
982
|
+
let dynamic = false;
|
|
983
|
+
for (let i = 0, len = array.length; i < len; i++) {
|
|
984
|
+
let item = array[i], t;
|
|
985
|
+
if (item == null || item === true || item === false)
|
|
986
|
+
;
|
|
987
|
+
else if (Array.isArray(item)) {
|
|
988
|
+
dynamic = normalizeIncomingArray2(normalized, item) || dynamic;
|
|
989
|
+
} else if ((t = typeof item) === "string" || t === "number") {
|
|
990
|
+
normalized.push(createTextNode2(item));
|
|
991
|
+
} else if (t === "function") {
|
|
992
|
+
if (unwrap) {
|
|
993
|
+
while (typeof item === "function")
|
|
994
|
+
item = item();
|
|
995
|
+
dynamic = normalizeIncomingArray2(normalized, Array.isArray(item) ? item : [item]) || dynamic;
|
|
996
|
+
} else {
|
|
997
|
+
normalized.push(item);
|
|
998
|
+
dynamic = true;
|
|
999
|
+
}
|
|
1000
|
+
} else
|
|
1001
|
+
normalized.push(item);
|
|
1002
|
+
}
|
|
1003
|
+
return dynamic;
|
|
1004
|
+
}
|
|
1005
|
+
function reconcileArrays2(parentNode, a, b) {
|
|
1006
|
+
let bLength = b.length, aEnd = a.length, bEnd = bLength, aStart = 0, bStart = 0, after = getNextSibling(a[aEnd - 1]), map = null;
|
|
1007
|
+
while (aStart < aEnd || bStart < bEnd) {
|
|
1008
|
+
if (a[aStart] === b[bStart]) {
|
|
1009
|
+
aStart++;
|
|
1010
|
+
bStart++;
|
|
1011
|
+
continue;
|
|
1012
|
+
}
|
|
1013
|
+
while (a[aEnd - 1] === b[bEnd - 1]) {
|
|
1014
|
+
aEnd--;
|
|
1015
|
+
bEnd--;
|
|
1016
|
+
}
|
|
1017
|
+
if (aEnd === aStart) {
|
|
1018
|
+
const node = bEnd < bLength ? bStart ? getNextSibling(b[bStart - 1]) : b[bEnd - bStart] : after;
|
|
1019
|
+
while (bStart < bEnd)
|
|
1020
|
+
insertNode2(parentNode, b[bStart++], node);
|
|
1021
|
+
} else if (bEnd === bStart) {
|
|
1022
|
+
while (aStart < aEnd) {
|
|
1023
|
+
if (!map || !map.has(a[aStart]))
|
|
1024
|
+
removeNode(parentNode, a[aStart]);
|
|
1025
|
+
aStart++;
|
|
1026
|
+
}
|
|
1027
|
+
} else if (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]) {
|
|
1028
|
+
const node = getNextSibling(a[--aEnd]);
|
|
1029
|
+
insertNode2(parentNode, b[bStart++], getNextSibling(a[aStart++]));
|
|
1030
|
+
insertNode2(parentNode, b[--bEnd], node);
|
|
1031
|
+
a[aEnd] = b[bEnd];
|
|
1032
|
+
} else {
|
|
1033
|
+
if (!map) {
|
|
1034
|
+
map = /* @__PURE__ */ new Map();
|
|
1035
|
+
let i = bStart;
|
|
1036
|
+
while (i < bEnd)
|
|
1037
|
+
map.set(b[i], i++);
|
|
1038
|
+
}
|
|
1039
|
+
const index = map.get(a[aStart]);
|
|
1040
|
+
if (index != null) {
|
|
1041
|
+
if (bStart < index && index < bEnd) {
|
|
1042
|
+
let i = aStart, sequence = 1, t;
|
|
1043
|
+
while (++i < aEnd && i < bEnd) {
|
|
1044
|
+
if ((t = map.get(a[i])) == null || t !== index + sequence)
|
|
1045
|
+
break;
|
|
1046
|
+
sequence++;
|
|
1047
|
+
}
|
|
1048
|
+
if (sequence > index - bStart) {
|
|
1049
|
+
const node = a[aStart];
|
|
1050
|
+
while (bStart < index)
|
|
1051
|
+
insertNode2(parentNode, b[bStart++], node);
|
|
1052
|
+
} else
|
|
1053
|
+
replaceNode(parentNode, b[bStart++], a[aStart++]);
|
|
1054
|
+
} else
|
|
1055
|
+
aStart++;
|
|
1056
|
+
} else
|
|
1057
|
+
removeNode(parentNode, a[aStart++]);
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
function cleanChildren2(parent, current, marker, replacement) {
|
|
1062
|
+
if (marker === void 0) {
|
|
1063
|
+
let removed;
|
|
1064
|
+
while (removed = getFirstChild(parent))
|
|
1065
|
+
removeNode(parent, removed);
|
|
1066
|
+
replacement && insertNode2(parent, replacement);
|
|
1067
|
+
return replacement;
|
|
1068
|
+
}
|
|
1069
|
+
const node = replacement || createSlotNode2();
|
|
1070
|
+
if (current.length) {
|
|
1071
|
+
let inserted = false;
|
|
1072
|
+
for (let i = current.length - 1; i >= 0; i--) {
|
|
1073
|
+
const el = current[i];
|
|
1074
|
+
if (node !== el) {
|
|
1075
|
+
const isParent = getParentNode(el) === parent;
|
|
1076
|
+
if (!inserted && !i)
|
|
1077
|
+
isParent ? replaceNode(parent, node, el) : insertNode2(parent, node, marker);
|
|
1078
|
+
else
|
|
1079
|
+
isParent && removeNode(parent, el);
|
|
1080
|
+
} else
|
|
1081
|
+
inserted = true;
|
|
1082
|
+
}
|
|
1083
|
+
} else
|
|
1084
|
+
insertNode2(parent, node, marker);
|
|
1085
|
+
return [node];
|
|
1086
|
+
}
|
|
1087
|
+
function appendNodes2(parent, array, marker) {
|
|
1088
|
+
for (let i = 0, len = array.length; i < len; i++)
|
|
1089
|
+
insertNode2(parent, array[i], marker);
|
|
1090
|
+
}
|
|
1091
|
+
function replaceNode(parent, newNode, oldNode) {
|
|
1092
|
+
insertNode2(parent, newNode, oldNode);
|
|
1093
|
+
removeNode(parent, oldNode);
|
|
1094
|
+
}
|
|
1095
|
+
function spreadExpression(node, props, prevProps = {}, skipChildren) {
|
|
1096
|
+
props || (props = {});
|
|
1097
|
+
if (!skipChildren) {
|
|
1098
|
+
createRenderEffect(() => prevProps.children = insertExpression2(node, props.children, prevProps.children));
|
|
1099
|
+
}
|
|
1100
|
+
createRenderEffect(() => props.ref && props.ref(node));
|
|
1101
|
+
createRenderEffect(() => {
|
|
1102
|
+
for (const prop in props) {
|
|
1103
|
+
if (prop === "children" || prop === "ref")
|
|
1104
|
+
continue;
|
|
1105
|
+
const value = props[prop];
|
|
1106
|
+
if (value === prevProps[prop])
|
|
1107
|
+
continue;
|
|
1108
|
+
setProperty(node, prop, value, prevProps[prop]);
|
|
1109
|
+
prevProps[prop] = value;
|
|
1110
|
+
}
|
|
1111
|
+
});
|
|
1112
|
+
return prevProps;
|
|
1113
|
+
}
|
|
1114
|
+
return {
|
|
1115
|
+
render(code, element) {
|
|
1116
|
+
let disposer;
|
|
1117
|
+
createRoot((dispose2) => {
|
|
1118
|
+
disposer = dispose2;
|
|
1119
|
+
insert3(element, code());
|
|
1120
|
+
});
|
|
1121
|
+
return disposer;
|
|
1122
|
+
},
|
|
1123
|
+
insert: insert3,
|
|
1124
|
+
spread(node, accessor, skipChildren) {
|
|
1125
|
+
if (typeof accessor === "function") {
|
|
1126
|
+
createRenderEffect((current) => spreadExpression(node, accessor(), current, skipChildren));
|
|
1127
|
+
} else
|
|
1128
|
+
spreadExpression(node, accessor, void 0, skipChildren);
|
|
1129
|
+
},
|
|
1130
|
+
createElement: createElement2,
|
|
1131
|
+
createTextNode: createTextNode2,
|
|
1132
|
+
insertNode: insertNode2,
|
|
1133
|
+
setProp(node, name, value, prev) {
|
|
1134
|
+
setProperty(node, name, value, prev);
|
|
1135
|
+
return value;
|
|
1136
|
+
},
|
|
1137
|
+
mergeProps,
|
|
1138
|
+
effect: createRenderEffect,
|
|
1139
|
+
memo,
|
|
1140
|
+
createComponent,
|
|
1141
|
+
use(fn, element, arg) {
|
|
1142
|
+
return untrack(() => fn(element, arg));
|
|
1143
|
+
}
|
|
1144
|
+
};
|
|
1145
|
+
}
|
|
1146
|
+
function createRenderer2(options) {
|
|
1147
|
+
const renderer = createRenderer(options);
|
|
1148
|
+
renderer.mergeProps = mergeProps;
|
|
1149
|
+
return renderer;
|
|
1150
|
+
}
|
|
1151
|
+
var idCounter = /* @__PURE__ */ new Map();
|
|
1152
|
+
function getNextId(elementType) {
|
|
1153
|
+
if (!idCounter.has(elementType)) {
|
|
1154
|
+
idCounter.set(elementType, 0);
|
|
1155
|
+
}
|
|
1156
|
+
const value = idCounter.get(elementType) + 1;
|
|
1157
|
+
idCounter.set(elementType, value);
|
|
1158
|
+
return `${elementType}-${value}`;
|
|
1159
|
+
}
|
|
1160
|
+
var log = (...args) => {
|
|
1161
|
+
if (process.env.DEBUG) {
|
|
1162
|
+
console.log("[Reconciler]", ...args);
|
|
1163
|
+
}
|
|
1164
|
+
};
|
|
1165
|
+
var TextNode = class _TextNode extends TextNodeRenderable {
|
|
1166
|
+
static fromString(text, options = {}) {
|
|
1167
|
+
const node = new _TextNode(options);
|
|
1168
|
+
node.add(text);
|
|
1169
|
+
return node;
|
|
1170
|
+
}
|
|
1171
|
+
};
|
|
1172
|
+
var logId = (node) => {
|
|
1173
|
+
if (!node)
|
|
1174
|
+
return;
|
|
1175
|
+
return node.id;
|
|
1176
|
+
};
|
|
1177
|
+
var getNodeChildren = (node) => {
|
|
1178
|
+
let children2;
|
|
1179
|
+
if (node instanceof TextRenderable) {
|
|
1180
|
+
children2 = node.getTextChildren();
|
|
1181
|
+
} else {
|
|
1182
|
+
children2 = node.getChildren();
|
|
1183
|
+
}
|
|
1184
|
+
return children2;
|
|
1185
|
+
};
|
|
1186
|
+
function _insertNode(parent, node, anchor) {
|
|
1187
|
+
log("Inserting node:", logId(node), "into parent:", logId(parent), "with anchor:", logId(anchor), node instanceof TextNode);
|
|
1188
|
+
if (node instanceof SlotRenderable) {
|
|
1189
|
+
node.parent = parent;
|
|
1190
|
+
node = node.getSlotChild(parent);
|
|
1191
|
+
}
|
|
1192
|
+
if (anchor && anchor instanceof SlotRenderable) {
|
|
1193
|
+
anchor = anchor.getSlotChild(parent);
|
|
1194
|
+
}
|
|
1195
|
+
if (isTextNodeRenderable(node)) {
|
|
1196
|
+
if (!(parent instanceof TextRenderable) && !isTextNodeRenderable(parent)) {
|
|
1197
|
+
throw new Error(`Orphan text error: "${node.toChunks().map((c) => c.text).join("")}" must have a <text> as a parent: ${parent.id} above ${node.id}`);
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
if (!(parent instanceof BaseRenderable)) {
|
|
1201
|
+
console.error("[INSERT]", "Tried to mount a non base renderable");
|
|
1202
|
+
throw new Error("Tried to mount a non base renderable");
|
|
1203
|
+
}
|
|
1204
|
+
if (!anchor) {
|
|
1205
|
+
parent.add(node);
|
|
1206
|
+
return;
|
|
1207
|
+
}
|
|
1208
|
+
const children2 = getNodeChildren(parent);
|
|
1209
|
+
const anchorIndex = children2.findIndex((el) => el.id === anchor.id);
|
|
1210
|
+
if (anchorIndex === -1) {
|
|
1211
|
+
log("[INSERT]", "Could not find anchor", logId(parent), logId(anchor), "[children]", ...children2.map((c) => c.id));
|
|
1212
|
+
}
|
|
1213
|
+
parent.add(node, anchorIndex);
|
|
1214
|
+
}
|
|
1215
|
+
function _removeNode(parent, node) {
|
|
1216
|
+
log("Removing node:", logId(node), "from parent:", logId(parent));
|
|
1217
|
+
if (node instanceof SlotRenderable) {
|
|
1218
|
+
node.parent = null;
|
|
1219
|
+
node = node.getSlotChild(parent);
|
|
1220
|
+
}
|
|
1221
|
+
parent.remove(node.id);
|
|
1222
|
+
process.nextTick(() => {
|
|
1223
|
+
if (node instanceof BaseRenderable && !node.parent) {
|
|
1224
|
+
node.destroyRecursively();
|
|
1225
|
+
return;
|
|
1226
|
+
}
|
|
1227
|
+
});
|
|
1228
|
+
}
|
|
1229
|
+
function _createTextNode(value) {
|
|
1230
|
+
log("Creating text node:", value);
|
|
1231
|
+
const id = getNextId("text-node");
|
|
1232
|
+
if (typeof value === "number") {
|
|
1233
|
+
value = value.toString();
|
|
1234
|
+
}
|
|
1235
|
+
return TextNode.fromString(value, { id });
|
|
1236
|
+
}
|
|
1237
|
+
function createSlotNode() {
|
|
1238
|
+
const id = getNextId("slot-node");
|
|
1239
|
+
log("Creating slot node", id);
|
|
1240
|
+
return new SlotRenderable(id);
|
|
1241
|
+
}
|
|
1242
|
+
function _getParentNode(childNode) {
|
|
1243
|
+
log("Getting parent of node:", logId(childNode));
|
|
1244
|
+
let parent = childNode.parent ?? void 0;
|
|
1245
|
+
if (parent instanceof RootTextNodeRenderable) {
|
|
1246
|
+
parent = parent.textParent ?? void 0;
|
|
1247
|
+
}
|
|
1248
|
+
return parent;
|
|
1249
|
+
}
|
|
1250
|
+
var {
|
|
1251
|
+
render: _render,
|
|
1252
|
+
effect,
|
|
1253
|
+
memo: memo2,
|
|
1254
|
+
createComponent: createComponent2,
|
|
1255
|
+
createElement,
|
|
1256
|
+
createTextNode,
|
|
1257
|
+
insertNode,
|
|
1258
|
+
insert,
|
|
1259
|
+
spread,
|
|
1260
|
+
setProp,
|
|
1261
|
+
mergeProps: mergeProps3,
|
|
1262
|
+
use
|
|
1263
|
+
} = createRenderer2({
|
|
1264
|
+
createElement(tagName) {
|
|
1265
|
+
log("Creating element:", tagName);
|
|
1266
|
+
const id = getNextId(tagName);
|
|
1267
|
+
const solidRenderer = useContext(RendererContext);
|
|
1268
|
+
if (!solidRenderer) {
|
|
1269
|
+
throw new Error("No renderer found");
|
|
1270
|
+
}
|
|
1271
|
+
const elements = getComponentCatalogue();
|
|
1272
|
+
if (!elements[tagName]) {
|
|
1273
|
+
throw new Error(`[Reconciler] Unknown component type: ${tagName}`);
|
|
1274
|
+
}
|
|
1275
|
+
const element = new elements[tagName](solidRenderer, { id });
|
|
1276
|
+
log("Element created with id:", id);
|
|
1277
|
+
return element;
|
|
1278
|
+
},
|
|
1279
|
+
createTextNode: _createTextNode,
|
|
1280
|
+
createSlotNode,
|
|
1281
|
+
replaceText(textNode, value) {
|
|
1282
|
+
log("Replacing text:", value, "in node:", logId(textNode));
|
|
1283
|
+
if (!(textNode instanceof TextNode))
|
|
1284
|
+
return;
|
|
1285
|
+
textNode.replace(value, 0);
|
|
1286
|
+
},
|
|
1287
|
+
setProperty(node, name, value, prev) {
|
|
1288
|
+
if (name.startsWith("on:")) {
|
|
1289
|
+
const eventName = name.slice(3);
|
|
1290
|
+
if (value) {
|
|
1291
|
+
node.on(eventName, value);
|
|
1292
|
+
}
|
|
1293
|
+
if (prev) {
|
|
1294
|
+
node.off(eventName, prev);
|
|
1295
|
+
}
|
|
1296
|
+
return;
|
|
1297
|
+
}
|
|
1298
|
+
if (isTextNodeRenderable(node)) {
|
|
1299
|
+
if (name === "href") {
|
|
1300
|
+
node.link = { url: value };
|
|
1301
|
+
return;
|
|
1302
|
+
}
|
|
1303
|
+
if (name === "style") {
|
|
1304
|
+
node.attributes |= createTextAttributes(value);
|
|
1305
|
+
node.fg = value.fg ? parseColor(value.fg) : node.fg;
|
|
1306
|
+
node.bg = value.bg ? parseColor(value.bg) : node.bg;
|
|
1307
|
+
return;
|
|
1308
|
+
}
|
|
1309
|
+
return;
|
|
1310
|
+
}
|
|
1311
|
+
switch (name) {
|
|
1312
|
+
case "id":
|
|
1313
|
+
log("Id mapped", node.id, "=", value);
|
|
1314
|
+
node[name] = value;
|
|
1315
|
+
break;
|
|
1316
|
+
case "focused":
|
|
1317
|
+
if (!(node instanceof Renderable))
|
|
1318
|
+
return;
|
|
1319
|
+
if (value) {
|
|
1320
|
+
node.focus();
|
|
1321
|
+
} else {
|
|
1322
|
+
node.blur();
|
|
1323
|
+
}
|
|
1324
|
+
break;
|
|
1325
|
+
case "onChange":
|
|
1326
|
+
let event = void 0;
|
|
1327
|
+
if (node instanceof SelectRenderable) {
|
|
1328
|
+
event = SelectRenderableEvents.SELECTION_CHANGED;
|
|
1329
|
+
} else if (node instanceof TabSelectRenderable) {
|
|
1330
|
+
event = TabSelectRenderableEvents.SELECTION_CHANGED;
|
|
1331
|
+
} else if (node instanceof InputRenderable) {
|
|
1332
|
+
event = InputRenderableEvents.CHANGE;
|
|
1333
|
+
}
|
|
1334
|
+
if (!event)
|
|
1335
|
+
break;
|
|
1336
|
+
if (value) {
|
|
1337
|
+
node.on(event, value);
|
|
1338
|
+
}
|
|
1339
|
+
if (prev) {
|
|
1340
|
+
node.off(event, prev);
|
|
1341
|
+
}
|
|
1342
|
+
break;
|
|
1343
|
+
case "onInput":
|
|
1344
|
+
if (node instanceof InputRenderable) {
|
|
1345
|
+
if (value) {
|
|
1346
|
+
node.on(InputRenderableEvents.INPUT, value);
|
|
1347
|
+
}
|
|
1348
|
+
if (prev) {
|
|
1349
|
+
node.off(InputRenderableEvents.INPUT, prev);
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
break;
|
|
1353
|
+
case "onSubmit":
|
|
1354
|
+
if (node instanceof InputRenderable) {
|
|
1355
|
+
if (value) {
|
|
1356
|
+
node.on(InputRenderableEvents.ENTER, value);
|
|
1357
|
+
}
|
|
1358
|
+
if (prev) {
|
|
1359
|
+
node.off(InputRenderableEvents.ENTER, prev);
|
|
1360
|
+
}
|
|
1361
|
+
} else {
|
|
1362
|
+
node[name] = value;
|
|
1363
|
+
}
|
|
1364
|
+
break;
|
|
1365
|
+
case "onSelect":
|
|
1366
|
+
if (node instanceof SelectRenderable) {
|
|
1367
|
+
if (value) {
|
|
1368
|
+
node.on(SelectRenderableEvents.ITEM_SELECTED, value);
|
|
1369
|
+
}
|
|
1370
|
+
if (prev) {
|
|
1371
|
+
node.off(SelectRenderableEvents.ITEM_SELECTED, prev);
|
|
1372
|
+
}
|
|
1373
|
+
} else if (node instanceof TabSelectRenderable) {
|
|
1374
|
+
if (value) {
|
|
1375
|
+
node.on(TabSelectRenderableEvents.ITEM_SELECTED, value);
|
|
1376
|
+
}
|
|
1377
|
+
if (prev) {
|
|
1378
|
+
node.off(TabSelectRenderableEvents.ITEM_SELECTED, prev);
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
break;
|
|
1382
|
+
case "style":
|
|
1383
|
+
for (const prop in value) {
|
|
1384
|
+
const propVal = value[prop];
|
|
1385
|
+
if (prev !== void 0 && propVal === prev[prop])
|
|
1386
|
+
continue;
|
|
1387
|
+
node[prop] = propVal;
|
|
1388
|
+
}
|
|
1389
|
+
break;
|
|
1390
|
+
case "text":
|
|
1391
|
+
case "content":
|
|
1392
|
+
node[name] = typeof value === "string" ? value : Array.isArray(value) ? value.join("") : `${value}`;
|
|
1393
|
+
break;
|
|
1394
|
+
default:
|
|
1395
|
+
node[name] = value;
|
|
1396
|
+
}
|
|
1397
|
+
},
|
|
1398
|
+
isTextNode(node) {
|
|
1399
|
+
return node instanceof TextNode;
|
|
1400
|
+
},
|
|
1401
|
+
insertNode: _insertNode,
|
|
1402
|
+
removeNode: _removeNode,
|
|
1403
|
+
getParentNode: _getParentNode,
|
|
1404
|
+
getFirstChild(node) {
|
|
1405
|
+
log("Getting first child of node:", logId(node));
|
|
1406
|
+
const firstChild = getNodeChildren(node)[0];
|
|
1407
|
+
if (!firstChild) {
|
|
1408
|
+
log("No first child found for node:", logId(node));
|
|
1409
|
+
return;
|
|
1410
|
+
}
|
|
1411
|
+
log("First child found:", logId(firstChild), "for node:", logId(node));
|
|
1412
|
+
return firstChild;
|
|
1413
|
+
},
|
|
1414
|
+
getNextSibling(node) {
|
|
1415
|
+
log("Getting next sibling of node:", logId(node));
|
|
1416
|
+
const parent = _getParentNode(node);
|
|
1417
|
+
if (!parent) {
|
|
1418
|
+
log("No parent found for node:", logId(node));
|
|
1419
|
+
return;
|
|
1420
|
+
}
|
|
1421
|
+
const siblings = getNodeChildren(parent);
|
|
1422
|
+
const index = siblings.indexOf(node);
|
|
1423
|
+
if (index === -1 || index === siblings.length - 1) {
|
|
1424
|
+
log("No next sibling found for node:", logId(node));
|
|
1425
|
+
return;
|
|
1426
|
+
}
|
|
1427
|
+
const nextSibling = siblings[index + 1];
|
|
1428
|
+
if (!nextSibling) {
|
|
1429
|
+
log("Next sibling is null for node:", logId(node));
|
|
1430
|
+
return;
|
|
1431
|
+
}
|
|
1432
|
+
log("Next sibling found:", logId(nextSibling), "for node:", logId(node));
|
|
1433
|
+
return nextSibling;
|
|
1434
|
+
}
|
|
1435
|
+
});
|
|
1436
|
+
var SlotBaseRenderable = class extends BaseRenderable2 {
|
|
1437
|
+
constructor(id) {
|
|
1438
|
+
super({
|
|
1439
|
+
id
|
|
1440
|
+
});
|
|
1441
|
+
}
|
|
1442
|
+
add(obj, index) {
|
|
1443
|
+
throw new Error("Can't add children on an Slot renderable");
|
|
1444
|
+
}
|
|
1445
|
+
getChildren() {
|
|
1446
|
+
return [];
|
|
1447
|
+
}
|
|
1448
|
+
remove(id) {
|
|
1449
|
+
}
|
|
1450
|
+
insertBefore(obj, anchor) {
|
|
1451
|
+
throw new Error("Can't add children on an Slot renderable");
|
|
1452
|
+
}
|
|
1453
|
+
getRenderable(id) {
|
|
1454
|
+
return;
|
|
1455
|
+
}
|
|
1456
|
+
getChildrenCount() {
|
|
1457
|
+
return 0;
|
|
1458
|
+
}
|
|
1459
|
+
requestRender() {
|
|
1460
|
+
}
|
|
1461
|
+
findDescendantById(id) {
|
|
1462
|
+
return;
|
|
1463
|
+
}
|
|
1464
|
+
};
|
|
1465
|
+
var TextSlotRenderable = class extends TextNodeRenderable2 {
|
|
1466
|
+
slotParent;
|
|
1467
|
+
destroyed = false;
|
|
1468
|
+
constructor(id, parent) {
|
|
1469
|
+
super({ id });
|
|
1470
|
+
this._visible = false;
|
|
1471
|
+
this.slotParent = parent;
|
|
1472
|
+
}
|
|
1473
|
+
destroy() {
|
|
1474
|
+
if (this.destroyed) {
|
|
1475
|
+
return;
|
|
1476
|
+
}
|
|
1477
|
+
this.destroyed = true;
|
|
1478
|
+
this.slotParent?.destroy();
|
|
1479
|
+
super.destroy();
|
|
1480
|
+
}
|
|
1481
|
+
};
|
|
1482
|
+
var LayoutSlotRenderable = class extends SlotBaseRenderable {
|
|
1483
|
+
yogaNode;
|
|
1484
|
+
slotParent;
|
|
1485
|
+
destroyed = false;
|
|
1486
|
+
constructor(id, parent) {
|
|
1487
|
+
super(id);
|
|
1488
|
+
this._visible = false;
|
|
1489
|
+
this.slotParent = parent;
|
|
1490
|
+
this.yogaNode = Yoga.default.Node.create();
|
|
1491
|
+
this.yogaNode.setDisplay(Yoga.Display.None);
|
|
1492
|
+
}
|
|
1493
|
+
getLayoutNode() {
|
|
1494
|
+
return this.yogaNode;
|
|
1495
|
+
}
|
|
1496
|
+
updateFromLayout() {
|
|
1497
|
+
}
|
|
1498
|
+
updateLayout() {
|
|
1499
|
+
}
|
|
1500
|
+
onRemove() {
|
|
1501
|
+
}
|
|
1502
|
+
destroy() {
|
|
1503
|
+
if (this.destroyed) {
|
|
1504
|
+
return;
|
|
1505
|
+
}
|
|
1506
|
+
this.destroyed = true;
|
|
1507
|
+
super.destroy();
|
|
1508
|
+
this.slotParent?.destroy();
|
|
1509
|
+
}
|
|
1510
|
+
};
|
|
1511
|
+
var SlotRenderable = class extends SlotBaseRenderable {
|
|
1512
|
+
layoutNode;
|
|
1513
|
+
textNode;
|
|
1514
|
+
destroyed = false;
|
|
1515
|
+
constructor(id) {
|
|
1516
|
+
super(id);
|
|
1517
|
+
this._visible = false;
|
|
1518
|
+
}
|
|
1519
|
+
getSlotChild(parent) {
|
|
1520
|
+
if (isTextNodeRenderable2(parent) || parent instanceof TextRenderable2) {
|
|
1521
|
+
if (!this.textNode) {
|
|
1522
|
+
this.textNode = new TextSlotRenderable(`slot-text-${this.id}`, this);
|
|
1523
|
+
}
|
|
1524
|
+
return this.textNode;
|
|
1525
|
+
}
|
|
1526
|
+
if (!this.layoutNode) {
|
|
1527
|
+
this.layoutNode = new LayoutSlotRenderable(`slot-layout-${this.id}`, this);
|
|
1528
|
+
}
|
|
1529
|
+
return this.layoutNode;
|
|
1530
|
+
}
|
|
1531
|
+
destroy() {
|
|
1532
|
+
if (this.destroyed) {
|
|
1533
|
+
return;
|
|
1534
|
+
}
|
|
1535
|
+
this.destroyed = true;
|
|
1536
|
+
if (this.layoutNode) {
|
|
1537
|
+
this.layoutNode.destroy();
|
|
1538
|
+
}
|
|
1539
|
+
if (this.textNode) {
|
|
1540
|
+
this.textNode.destroy();
|
|
1541
|
+
}
|
|
1542
|
+
}
|
|
1543
|
+
};
|
|
1544
|
+
var SpanRenderable = class extends TextNodeRenderable3 {
|
|
1545
|
+
_ctx;
|
|
1546
|
+
constructor(_ctx, options) {
|
|
1547
|
+
super(options);
|
|
1548
|
+
this._ctx = _ctx;
|
|
1549
|
+
}
|
|
1550
|
+
};
|
|
1551
|
+
var TextModifierRenderable = class extends SpanRenderable {
|
|
1552
|
+
constructor(options, modifier) {
|
|
1553
|
+
super(null, options);
|
|
1554
|
+
if (modifier === "b" || modifier === "strong") {
|
|
1555
|
+
this.attributes = (this.attributes || 0) | TextAttributes.BOLD;
|
|
1556
|
+
} else if (modifier === "i" || modifier === "em") {
|
|
1557
|
+
this.attributes = (this.attributes || 0) | TextAttributes.ITALIC;
|
|
1558
|
+
} else if (modifier === "u") {
|
|
1559
|
+
this.attributes = (this.attributes || 0) | TextAttributes.UNDERLINE;
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
};
|
|
1563
|
+
var BoldSpanRenderable = class extends TextModifierRenderable {
|
|
1564
|
+
constructor(options) {
|
|
1565
|
+
super(options, "b");
|
|
1566
|
+
}
|
|
1567
|
+
};
|
|
1568
|
+
var ItalicSpanRenderable = class extends TextModifierRenderable {
|
|
1569
|
+
constructor(options) {
|
|
1570
|
+
super(options, "i");
|
|
1571
|
+
}
|
|
1572
|
+
};
|
|
1573
|
+
var UnderlineSpanRenderable = class extends TextModifierRenderable {
|
|
1574
|
+
constructor(options) {
|
|
1575
|
+
super(options, "u");
|
|
1576
|
+
}
|
|
1577
|
+
};
|
|
1578
|
+
var LineBreakRenderable = class extends SpanRenderable {
|
|
1579
|
+
constructor(_ctx, options) {
|
|
1580
|
+
super(null, options);
|
|
1581
|
+
this.add();
|
|
1582
|
+
}
|
|
1583
|
+
add() {
|
|
1584
|
+
return super.add(`
|
|
1585
|
+
`);
|
|
1586
|
+
}
|
|
1587
|
+
};
|
|
1588
|
+
var LinkRenderable = class extends SpanRenderable {
|
|
1589
|
+
constructor(_ctx, options) {
|
|
1590
|
+
const linkOptions = {
|
|
1591
|
+
...options,
|
|
1592
|
+
link: { url: options.href }
|
|
1593
|
+
};
|
|
1594
|
+
super(null, linkOptions);
|
|
1595
|
+
}
|
|
1596
|
+
};
|
|
1597
|
+
var baseComponents = {
|
|
1598
|
+
box: BoxRenderable,
|
|
1599
|
+
text: TextRenderable3,
|
|
1600
|
+
input: InputRenderable2,
|
|
1601
|
+
select: SelectRenderable2,
|
|
1602
|
+
textarea: TextareaRenderable,
|
|
1603
|
+
ascii_font: ASCIIFontRenderable,
|
|
1604
|
+
tab_select: TabSelectRenderable2,
|
|
1605
|
+
scrollbox: ScrollBoxRenderable,
|
|
1606
|
+
code: CodeRenderable,
|
|
1607
|
+
diff: DiffRenderable,
|
|
1608
|
+
line_number: LineNumberRenderable,
|
|
1609
|
+
span: SpanRenderable,
|
|
1610
|
+
strong: BoldSpanRenderable,
|
|
1611
|
+
b: BoldSpanRenderable,
|
|
1612
|
+
em: ItalicSpanRenderable,
|
|
1613
|
+
i: ItalicSpanRenderable,
|
|
1614
|
+
u: UnderlineSpanRenderable,
|
|
1615
|
+
br: LineBreakRenderable,
|
|
1616
|
+
a: LinkRenderable
|
|
1617
|
+
};
|
|
1618
|
+
var componentCatalogue = { ...baseComponents };
|
|
1619
|
+
function getComponentCatalogue() {
|
|
1620
|
+
return componentCatalogue;
|
|
1621
|
+
}
|
|
1622
|
+
var render = async (node, rendererOrConfig = {}) => {
|
|
1623
|
+
let isDisposed = false;
|
|
1624
|
+
let dispose2;
|
|
1625
|
+
const renderer = rendererOrConfig instanceof CliRenderer ? rendererOrConfig : await createCliRenderer({
|
|
1626
|
+
...rendererOrConfig,
|
|
1627
|
+
onDestroy: () => {
|
|
1628
|
+
if (!isDisposed) {
|
|
1629
|
+
isDisposed = true;
|
|
1630
|
+
dispose2();
|
|
1631
|
+
}
|
|
1632
|
+
rendererOrConfig.onDestroy?.();
|
|
1633
|
+
}
|
|
1634
|
+
});
|
|
1635
|
+
if (rendererOrConfig instanceof CliRenderer) {
|
|
1636
|
+
renderer.on("destroy", () => {
|
|
1637
|
+
if (!isDisposed) {
|
|
1638
|
+
isDisposed = true;
|
|
1639
|
+
dispose2();
|
|
1640
|
+
}
|
|
1641
|
+
});
|
|
1642
|
+
}
|
|
1643
|
+
engine2.attach(renderer);
|
|
1644
|
+
dispose2 = _render(() => createComponent2(RendererContext.Provider, {
|
|
1645
|
+
get value() {
|
|
1646
|
+
return renderer;
|
|
1647
|
+
},
|
|
1648
|
+
get children() {
|
|
1649
|
+
return createComponent2(node, {});
|
|
1650
|
+
}
|
|
1651
|
+
}), renderer.root);
|
|
1652
|
+
};
|
|
1653
|
+
|
|
1654
|
+
// src/ui.tsx
|
|
1655
|
+
import cliSpinners from "cli-spinners";
|
|
1656
|
+
|
|
1657
|
+
// src/logo.ts
|
|
1658
|
+
import { dirname, join } from "path";
|
|
1659
|
+
import { fileURLToPath } from "url";
|
|
1660
|
+
async function loadLogo() {
|
|
1661
|
+
const { default: fs } = await import("fs");
|
|
1662
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
1663
|
+
const logoPath = join(__dirname, "..", "logos", "satori.ans");
|
|
1664
|
+
return fs.readFileSync(logoPath, "utf8");
|
|
1665
|
+
}
|
|
1666
|
+
|
|
1667
|
+
// node_modules/solid-js/web/dist/web.js
|
|
1668
|
+
var booleans = [
|
|
1669
|
+
"allowfullscreen",
|
|
1670
|
+
"async",
|
|
1671
|
+
"alpha",
|
|
1672
|
+
"autofocus",
|
|
1673
|
+
"autoplay",
|
|
1674
|
+
"checked",
|
|
1675
|
+
"controls",
|
|
1676
|
+
"default",
|
|
1677
|
+
"disabled",
|
|
1678
|
+
"formnovalidate",
|
|
1679
|
+
"hidden",
|
|
1680
|
+
"indeterminate",
|
|
1681
|
+
"inert",
|
|
1682
|
+
"ismap",
|
|
1683
|
+
"loop",
|
|
1684
|
+
"multiple",
|
|
1685
|
+
"muted",
|
|
1686
|
+
"nomodule",
|
|
1687
|
+
"novalidate",
|
|
1688
|
+
"open",
|
|
1689
|
+
"playsinline",
|
|
1690
|
+
"readonly",
|
|
1691
|
+
"required",
|
|
1692
|
+
"reversed",
|
|
1693
|
+
"seamless",
|
|
1694
|
+
"selected",
|
|
1695
|
+
"adauctionheaders",
|
|
1696
|
+
"browsingtopics",
|
|
1697
|
+
"credentialless",
|
|
1698
|
+
"defaultchecked",
|
|
1699
|
+
"defaultmuted",
|
|
1700
|
+
"defaultselected",
|
|
1701
|
+
"defer",
|
|
1702
|
+
"disablepictureinpicture",
|
|
1703
|
+
"disableremoteplayback",
|
|
1704
|
+
"preservespitch",
|
|
1705
|
+
"shadowrootclonable",
|
|
1706
|
+
"shadowrootcustomelementregistry",
|
|
1707
|
+
"shadowrootdelegatesfocus",
|
|
1708
|
+
"shadowrootserializable",
|
|
1709
|
+
"sharedstoragewritable"
|
|
1710
|
+
];
|
|
1711
|
+
var Properties = /* @__PURE__ */ new Set([
|
|
1712
|
+
"className",
|
|
1713
|
+
"value",
|
|
1714
|
+
"readOnly",
|
|
1715
|
+
"noValidate",
|
|
1716
|
+
"formNoValidate",
|
|
1717
|
+
"isMap",
|
|
1718
|
+
"noModule",
|
|
1719
|
+
"playsInline",
|
|
1720
|
+
"adAuctionHeaders",
|
|
1721
|
+
"allowFullscreen",
|
|
1722
|
+
"browsingTopics",
|
|
1723
|
+
"defaultChecked",
|
|
1724
|
+
"defaultMuted",
|
|
1725
|
+
"defaultSelected",
|
|
1726
|
+
"disablePictureInPicture",
|
|
1727
|
+
"disableRemotePlayback",
|
|
1728
|
+
"preservesPitch",
|
|
1729
|
+
"shadowRootClonable",
|
|
1730
|
+
"shadowRootCustomElementRegistry",
|
|
1731
|
+
"shadowRootDelegatesFocus",
|
|
1732
|
+
"shadowRootSerializable",
|
|
1733
|
+
"sharedStorageWritable",
|
|
1734
|
+
...booleans
|
|
1735
|
+
]);
|
|
1736
|
+
var ChildProperties = /* @__PURE__ */ new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
1737
|
+
var Aliases = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
1738
|
+
className: "class",
|
|
1739
|
+
htmlFor: "for"
|
|
1740
|
+
});
|
|
1741
|
+
var PropAliases = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
1742
|
+
class: "className",
|
|
1743
|
+
novalidate: {
|
|
1744
|
+
$: "noValidate",
|
|
1745
|
+
FORM: 1
|
|
1746
|
+
},
|
|
1747
|
+
formnovalidate: {
|
|
1748
|
+
$: "formNoValidate",
|
|
1749
|
+
BUTTON: 1,
|
|
1750
|
+
INPUT: 1
|
|
1751
|
+
},
|
|
1752
|
+
ismap: {
|
|
1753
|
+
$: "isMap",
|
|
1754
|
+
IMG: 1
|
|
1755
|
+
},
|
|
1756
|
+
nomodule: {
|
|
1757
|
+
$: "noModule",
|
|
1758
|
+
SCRIPT: 1
|
|
1759
|
+
},
|
|
1760
|
+
playsinline: {
|
|
1761
|
+
$: "playsInline",
|
|
1762
|
+
VIDEO: 1
|
|
1763
|
+
},
|
|
1764
|
+
readonly: {
|
|
1765
|
+
$: "readOnly",
|
|
1766
|
+
INPUT: 1,
|
|
1767
|
+
TEXTAREA: 1
|
|
1768
|
+
},
|
|
1769
|
+
adauctionheaders: {
|
|
1770
|
+
$: "adAuctionHeaders",
|
|
1771
|
+
IFRAME: 1
|
|
1772
|
+
},
|
|
1773
|
+
allowfullscreen: {
|
|
1774
|
+
$: "allowFullscreen",
|
|
1775
|
+
IFRAME: 1
|
|
1776
|
+
},
|
|
1777
|
+
browsingtopics: {
|
|
1778
|
+
$: "browsingTopics",
|
|
1779
|
+
IMG: 1
|
|
1780
|
+
},
|
|
1781
|
+
defaultchecked: {
|
|
1782
|
+
$: "defaultChecked",
|
|
1783
|
+
INPUT: 1
|
|
1784
|
+
},
|
|
1785
|
+
defaultmuted: {
|
|
1786
|
+
$: "defaultMuted",
|
|
1787
|
+
AUDIO: 1,
|
|
1788
|
+
VIDEO: 1
|
|
1789
|
+
},
|
|
1790
|
+
defaultselected: {
|
|
1791
|
+
$: "defaultSelected",
|
|
1792
|
+
OPTION: 1
|
|
1793
|
+
},
|
|
1794
|
+
disablepictureinpicture: {
|
|
1795
|
+
$: "disablePictureInPicture",
|
|
1796
|
+
VIDEO: 1
|
|
1797
|
+
},
|
|
1798
|
+
disableremoteplayback: {
|
|
1799
|
+
$: "disableRemotePlayback",
|
|
1800
|
+
AUDIO: 1,
|
|
1801
|
+
VIDEO: 1
|
|
1802
|
+
},
|
|
1803
|
+
preservespitch: {
|
|
1804
|
+
$: "preservesPitch",
|
|
1805
|
+
AUDIO: 1,
|
|
1806
|
+
VIDEO: 1
|
|
1807
|
+
},
|
|
1808
|
+
shadowrootclonable: {
|
|
1809
|
+
$: "shadowRootClonable",
|
|
1810
|
+
TEMPLATE: 1
|
|
1811
|
+
},
|
|
1812
|
+
shadowrootdelegatesfocus: {
|
|
1813
|
+
$: "shadowRootDelegatesFocus",
|
|
1814
|
+
TEMPLATE: 1
|
|
1815
|
+
},
|
|
1816
|
+
shadowrootserializable: {
|
|
1817
|
+
$: "shadowRootSerializable",
|
|
1818
|
+
TEMPLATE: 1
|
|
1819
|
+
},
|
|
1820
|
+
sharedstoragewritable: {
|
|
1821
|
+
$: "sharedStorageWritable",
|
|
1822
|
+
IFRAME: 1,
|
|
1823
|
+
IMG: 1
|
|
1824
|
+
}
|
|
1825
|
+
});
|
|
1826
|
+
function getPropAlias(prop, tagName) {
|
|
1827
|
+
const a = PropAliases[prop];
|
|
1828
|
+
return typeof a === "object" ? a[tagName] ? a["$"] : void 0 : a;
|
|
1829
|
+
}
|
|
1830
|
+
var DelegatedEvents = /* @__PURE__ */ new Set(["beforeinput", "click", "dblclick", "contextmenu", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"]);
|
|
1831
|
+
var SVGElements = /* @__PURE__ */ new Set([
|
|
1832
|
+
"altGlyph",
|
|
1833
|
+
"altGlyphDef",
|
|
1834
|
+
"altGlyphItem",
|
|
1835
|
+
"animate",
|
|
1836
|
+
"animateColor",
|
|
1837
|
+
"animateMotion",
|
|
1838
|
+
"animateTransform",
|
|
1839
|
+
"circle",
|
|
1840
|
+
"clipPath",
|
|
1841
|
+
"color-profile",
|
|
1842
|
+
"cursor",
|
|
1843
|
+
"defs",
|
|
1844
|
+
"desc",
|
|
1845
|
+
"ellipse",
|
|
1846
|
+
"feBlend",
|
|
1847
|
+
"feColorMatrix",
|
|
1848
|
+
"feComponentTransfer",
|
|
1849
|
+
"feComposite",
|
|
1850
|
+
"feConvolveMatrix",
|
|
1851
|
+
"feDiffuseLighting",
|
|
1852
|
+
"feDisplacementMap",
|
|
1853
|
+
"feDistantLight",
|
|
1854
|
+
"feDropShadow",
|
|
1855
|
+
"feFlood",
|
|
1856
|
+
"feFuncA",
|
|
1857
|
+
"feFuncB",
|
|
1858
|
+
"feFuncG",
|
|
1859
|
+
"feFuncR",
|
|
1860
|
+
"feGaussianBlur",
|
|
1861
|
+
"feImage",
|
|
1862
|
+
"feMerge",
|
|
1863
|
+
"feMergeNode",
|
|
1864
|
+
"feMorphology",
|
|
1865
|
+
"feOffset",
|
|
1866
|
+
"fePointLight",
|
|
1867
|
+
"feSpecularLighting",
|
|
1868
|
+
"feSpotLight",
|
|
1869
|
+
"feTile",
|
|
1870
|
+
"feTurbulence",
|
|
1871
|
+
"filter",
|
|
1872
|
+
"font",
|
|
1873
|
+
"font-face",
|
|
1874
|
+
"font-face-format",
|
|
1875
|
+
"font-face-name",
|
|
1876
|
+
"font-face-src",
|
|
1877
|
+
"font-face-uri",
|
|
1878
|
+
"foreignObject",
|
|
1879
|
+
"g",
|
|
1880
|
+
"glyph",
|
|
1881
|
+
"glyphRef",
|
|
1882
|
+
"hkern",
|
|
1883
|
+
"image",
|
|
1884
|
+
"line",
|
|
1885
|
+
"linearGradient",
|
|
1886
|
+
"marker",
|
|
1887
|
+
"mask",
|
|
1888
|
+
"metadata",
|
|
1889
|
+
"missing-glyph",
|
|
1890
|
+
"mpath",
|
|
1891
|
+
"path",
|
|
1892
|
+
"pattern",
|
|
1893
|
+
"polygon",
|
|
1894
|
+
"polyline",
|
|
1895
|
+
"radialGradient",
|
|
1896
|
+
"rect",
|
|
1897
|
+
"set",
|
|
1898
|
+
"stop",
|
|
1899
|
+
"svg",
|
|
1900
|
+
"switch",
|
|
1901
|
+
"symbol",
|
|
1902
|
+
"text",
|
|
1903
|
+
"textPath",
|
|
1904
|
+
"tref",
|
|
1905
|
+
"tspan",
|
|
1906
|
+
"use",
|
|
1907
|
+
"view",
|
|
1908
|
+
"vkern"
|
|
1909
|
+
]);
|
|
1910
|
+
var SVGNamespace = {
|
|
1911
|
+
xlink: "http://www.w3.org/1999/xlink",
|
|
1912
|
+
xml: "http://www.w3.org/XML/1998/namespace"
|
|
1913
|
+
};
|
|
1914
|
+
function reconcileArrays(parentNode, a, b) {
|
|
1915
|
+
let bLength = b.length, aEnd = a.length, bEnd = bLength, aStart = 0, bStart = 0, after = a[aEnd - 1].nextSibling, map = null;
|
|
1916
|
+
while (aStart < aEnd || bStart < bEnd) {
|
|
1917
|
+
if (a[aStart] === b[bStart]) {
|
|
1918
|
+
aStart++;
|
|
1919
|
+
bStart++;
|
|
1920
|
+
continue;
|
|
1921
|
+
}
|
|
1922
|
+
while (a[aEnd - 1] === b[bEnd - 1]) {
|
|
1923
|
+
aEnd--;
|
|
1924
|
+
bEnd--;
|
|
1925
|
+
}
|
|
1926
|
+
if (aEnd === aStart) {
|
|
1927
|
+
const node = bEnd < bLength ? bStart ? b[bStart - 1].nextSibling : b[bEnd - bStart] : after;
|
|
1928
|
+
while (bStart < bEnd) parentNode.insertBefore(b[bStart++], node);
|
|
1929
|
+
} else if (bEnd === bStart) {
|
|
1930
|
+
while (aStart < aEnd) {
|
|
1931
|
+
if (!map || !map.has(a[aStart])) a[aStart].remove();
|
|
1932
|
+
aStart++;
|
|
1933
|
+
}
|
|
1934
|
+
} else if (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]) {
|
|
1935
|
+
const node = a[--aEnd].nextSibling;
|
|
1936
|
+
parentNode.insertBefore(b[bStart++], a[aStart++].nextSibling);
|
|
1937
|
+
parentNode.insertBefore(b[--bEnd], node);
|
|
1938
|
+
a[aEnd] = b[bEnd];
|
|
1939
|
+
} else {
|
|
1940
|
+
if (!map) {
|
|
1941
|
+
map = /* @__PURE__ */ new Map();
|
|
1942
|
+
let i = bStart;
|
|
1943
|
+
while (i < bEnd) map.set(b[i], i++);
|
|
1944
|
+
}
|
|
1945
|
+
const index = map.get(a[aStart]);
|
|
1946
|
+
if (index != null) {
|
|
1947
|
+
if (bStart < index && index < bEnd) {
|
|
1948
|
+
let i = aStart, sequence = 1, t;
|
|
1949
|
+
while (++i < aEnd && i < bEnd) {
|
|
1950
|
+
if ((t = map.get(a[i])) == null || t !== index + sequence) break;
|
|
1951
|
+
sequence++;
|
|
1952
|
+
}
|
|
1953
|
+
if (sequence > index - bStart) {
|
|
1954
|
+
const node = a[aStart];
|
|
1955
|
+
while (bStart < index) parentNode.insertBefore(b[bStart++], node);
|
|
1956
|
+
} else parentNode.replaceChild(b[bStart++], a[aStart++]);
|
|
1957
|
+
} else aStart++;
|
|
1958
|
+
} else a[aStart++].remove();
|
|
1959
|
+
}
|
|
1960
|
+
}
|
|
1961
|
+
}
|
|
1962
|
+
var $$EVENTS = "_$DX_DELEGATE";
|
|
1963
|
+
function delegateEvents(eventNames, document2 = window.document) {
|
|
1964
|
+
const e = document2[$$EVENTS] || (document2[$$EVENTS] = /* @__PURE__ */ new Set());
|
|
1965
|
+
for (let i = 0, l = eventNames.length; i < l; i++) {
|
|
1966
|
+
const name = eventNames[i];
|
|
1967
|
+
if (!e.has(name)) {
|
|
1968
|
+
e.add(name);
|
|
1969
|
+
document2.addEventListener(name, eventHandler);
|
|
1970
|
+
}
|
|
1971
|
+
}
|
|
1972
|
+
}
|
|
1973
|
+
function setAttribute(node, name, value) {
|
|
1974
|
+
if (isHydrating(node)) return;
|
|
1975
|
+
if (value == null) node.removeAttribute(name);
|
|
1976
|
+
else node.setAttribute(name, value);
|
|
1977
|
+
}
|
|
1978
|
+
function setAttributeNS(node, namespace, name, value) {
|
|
1979
|
+
if (isHydrating(node)) return;
|
|
1980
|
+
if (value == null) node.removeAttributeNS(namespace, name);
|
|
1981
|
+
else node.setAttributeNS(namespace, name, value);
|
|
1982
|
+
}
|
|
1983
|
+
function setBoolAttribute(node, name, value) {
|
|
1984
|
+
if (isHydrating(node)) return;
|
|
1985
|
+
value ? node.setAttribute(name, "") : node.removeAttribute(name);
|
|
1986
|
+
}
|
|
1987
|
+
function className(node, value) {
|
|
1988
|
+
if (isHydrating(node)) return;
|
|
1989
|
+
if (value == null) node.removeAttribute("class");
|
|
1990
|
+
else node.className = value;
|
|
1991
|
+
}
|
|
1992
|
+
function addEventListener(node, name, handler, delegate) {
|
|
1993
|
+
if (delegate) {
|
|
1994
|
+
if (Array.isArray(handler)) {
|
|
1995
|
+
node[`$$${name}`] = handler[0];
|
|
1996
|
+
node[`$$${name}Data`] = handler[1];
|
|
1997
|
+
} else node[`$$${name}`] = handler;
|
|
1998
|
+
} else if (Array.isArray(handler)) {
|
|
1999
|
+
const handlerFn = handler[0];
|
|
2000
|
+
node.addEventListener(name, handler[0] = (e) => handlerFn.call(node, handler[1], e));
|
|
2001
|
+
} else node.addEventListener(name, handler, typeof handler !== "function" && handler);
|
|
2002
|
+
}
|
|
2003
|
+
function classList(node, value, prev = {}) {
|
|
2004
|
+
const classKeys = Object.keys(value || {}), prevKeys = Object.keys(prev);
|
|
2005
|
+
let i, len;
|
|
2006
|
+
for (i = 0, len = prevKeys.length; i < len; i++) {
|
|
2007
|
+
const key = prevKeys[i];
|
|
2008
|
+
if (!key || key === "undefined" || value[key]) continue;
|
|
2009
|
+
toggleClassKey(node, key, false);
|
|
2010
|
+
delete prev[key];
|
|
2011
|
+
}
|
|
2012
|
+
for (i = 0, len = classKeys.length; i < len; i++) {
|
|
2013
|
+
const key = classKeys[i], classValue = !!value[key];
|
|
2014
|
+
if (!key || key === "undefined" || prev[key] === classValue || !classValue) continue;
|
|
2015
|
+
toggleClassKey(node, key, true);
|
|
2016
|
+
prev[key] = classValue;
|
|
2017
|
+
}
|
|
2018
|
+
return prev;
|
|
2019
|
+
}
|
|
2020
|
+
function style(node, value, prev) {
|
|
2021
|
+
if (!value) return prev ? setAttribute(node, "style") : value;
|
|
2022
|
+
const nodeStyle = node.style;
|
|
2023
|
+
if (typeof value === "string") return nodeStyle.cssText = value;
|
|
2024
|
+
typeof prev === "string" && (nodeStyle.cssText = prev = void 0);
|
|
2025
|
+
prev || (prev = {});
|
|
2026
|
+
value || (value = {});
|
|
2027
|
+
let v, s;
|
|
2028
|
+
for (s in prev) {
|
|
2029
|
+
value[s] == null && nodeStyle.removeProperty(s);
|
|
2030
|
+
delete prev[s];
|
|
2031
|
+
}
|
|
2032
|
+
for (s in value) {
|
|
2033
|
+
v = value[s];
|
|
2034
|
+
if (v !== prev[s]) {
|
|
2035
|
+
nodeStyle.setProperty(s, v);
|
|
2036
|
+
prev[s] = v;
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
return prev;
|
|
2040
|
+
}
|
|
2041
|
+
function spread2(node, props = {}, isSVG, skipChildren) {
|
|
2042
|
+
const prevProps = {};
|
|
2043
|
+
if (!skipChildren) {
|
|
2044
|
+
createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
|
|
2045
|
+
}
|
|
2046
|
+
createRenderEffect(() => typeof props.ref === "function" && use2(props.ref, node));
|
|
2047
|
+
createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
|
|
2048
|
+
return prevProps;
|
|
2049
|
+
}
|
|
2050
|
+
function dynamicProperty(props, key) {
|
|
2051
|
+
const src = props[key];
|
|
2052
|
+
Object.defineProperty(props, key, {
|
|
2053
|
+
get() {
|
|
2054
|
+
return src();
|
|
2055
|
+
},
|
|
2056
|
+
enumerable: true
|
|
2057
|
+
});
|
|
2058
|
+
return props;
|
|
2059
|
+
}
|
|
2060
|
+
function use2(fn, element, arg) {
|
|
2061
|
+
return untrack(() => fn(element, arg));
|
|
2062
|
+
}
|
|
2063
|
+
function insert2(parent, accessor, marker, initial) {
|
|
2064
|
+
if (marker !== void 0 && !initial) initial = [];
|
|
2065
|
+
if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
|
|
2066
|
+
createRenderEffect((current) => insertExpression(parent, accessor(), current, marker), initial);
|
|
2067
|
+
}
|
|
2068
|
+
function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = false) {
|
|
2069
|
+
props || (props = {});
|
|
2070
|
+
for (const prop in prevProps) {
|
|
2071
|
+
if (!(prop in props)) {
|
|
2072
|
+
if (prop === "children") continue;
|
|
2073
|
+
prevProps[prop] = assignProp(node, prop, null, prevProps[prop], isSVG, skipRef, props);
|
|
2074
|
+
}
|
|
2075
|
+
}
|
|
2076
|
+
for (const prop in props) {
|
|
2077
|
+
if (prop === "children") {
|
|
2078
|
+
if (!skipChildren) insertExpression(node, props.children);
|
|
2079
|
+
continue;
|
|
2080
|
+
}
|
|
2081
|
+
const value = props[prop];
|
|
2082
|
+
prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG, skipRef, props);
|
|
2083
|
+
}
|
|
2084
|
+
}
|
|
2085
|
+
function isHydrating(node) {
|
|
2086
|
+
return !!sharedConfig.context && !sharedConfig.done && (!node || node.isConnected);
|
|
2087
|
+
}
|
|
2088
|
+
function toPropertyName(name) {
|
|
2089
|
+
return name.toLowerCase().replace(/-([a-z])/g, (_, w) => w.toUpperCase());
|
|
2090
|
+
}
|
|
2091
|
+
function toggleClassKey(node, key, value) {
|
|
2092
|
+
const classNames = key.trim().split(/\s+/);
|
|
2093
|
+
for (let i = 0, nameLen = classNames.length; i < nameLen; i++) node.classList.toggle(classNames[i], value);
|
|
2094
|
+
}
|
|
2095
|
+
function assignProp(node, prop, value, prev, isSVG, skipRef, props) {
|
|
2096
|
+
let isCE, isProp, isChildProp, propAlias, forceProp;
|
|
2097
|
+
if (prop === "style") return style(node, value, prev);
|
|
2098
|
+
if (prop === "classList") return classList(node, value, prev);
|
|
2099
|
+
if (value === prev) return prev;
|
|
2100
|
+
if (prop === "ref") {
|
|
2101
|
+
if (!skipRef) value(node);
|
|
2102
|
+
} else if (prop.slice(0, 3) === "on:") {
|
|
2103
|
+
const e = prop.slice(3);
|
|
2104
|
+
prev && node.removeEventListener(e, prev, typeof prev !== "function" && prev);
|
|
2105
|
+
value && node.addEventListener(e, value, typeof value !== "function" && value);
|
|
2106
|
+
} else if (prop.slice(0, 10) === "oncapture:") {
|
|
2107
|
+
const e = prop.slice(10);
|
|
2108
|
+
prev && node.removeEventListener(e, prev, true);
|
|
2109
|
+
value && node.addEventListener(e, value, true);
|
|
2110
|
+
} else if (prop.slice(0, 2) === "on") {
|
|
2111
|
+
const name = prop.slice(2).toLowerCase();
|
|
2112
|
+
const delegate = DelegatedEvents.has(name);
|
|
2113
|
+
if (!delegate && prev) {
|
|
2114
|
+
const h2 = Array.isArray(prev) ? prev[0] : prev;
|
|
2115
|
+
node.removeEventListener(name, h2);
|
|
2116
|
+
}
|
|
2117
|
+
if (delegate || value) {
|
|
2118
|
+
addEventListener(node, name, value, delegate);
|
|
2119
|
+
delegate && delegateEvents([name]);
|
|
2120
|
+
}
|
|
2121
|
+
} else if (prop.slice(0, 5) === "attr:") {
|
|
2122
|
+
setAttribute(node, prop.slice(5), value);
|
|
2123
|
+
} else if (prop.slice(0, 5) === "bool:") {
|
|
2124
|
+
setBoolAttribute(node, prop.slice(5), value);
|
|
2125
|
+
} else if ((forceProp = prop.slice(0, 5) === "prop:") || (isChildProp = ChildProperties.has(prop)) || !isSVG && ((propAlias = getPropAlias(prop, node.tagName)) || (isProp = Properties.has(prop))) || (isCE = node.nodeName.includes("-") || "is" in props)) {
|
|
2126
|
+
if (forceProp) {
|
|
2127
|
+
prop = prop.slice(5);
|
|
2128
|
+
isProp = true;
|
|
2129
|
+
} else if (isHydrating(node)) return value;
|
|
2130
|
+
if (prop === "class" || prop === "className") className(node, value);
|
|
2131
|
+
else if (isCE && !isProp && !isChildProp) node[toPropertyName(prop)] = value;
|
|
2132
|
+
else node[propAlias || prop] = value;
|
|
2133
|
+
} else {
|
|
2134
|
+
const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
|
|
2135
|
+
if (ns) setAttributeNS(node, ns, prop, value);
|
|
2136
|
+
else setAttribute(node, Aliases[prop] || prop, value);
|
|
2137
|
+
}
|
|
2138
|
+
return value;
|
|
2139
|
+
}
|
|
2140
|
+
function eventHandler(e) {
|
|
2141
|
+
if (sharedConfig.registry && sharedConfig.events) {
|
|
2142
|
+
if (sharedConfig.events.find(([el, ev]) => ev === e)) return;
|
|
2143
|
+
}
|
|
2144
|
+
let node = e.target;
|
|
2145
|
+
const key = `$$${e.type}`;
|
|
2146
|
+
const oriTarget = e.target;
|
|
2147
|
+
const oriCurrentTarget = e.currentTarget;
|
|
2148
|
+
const retarget = (value) => Object.defineProperty(e, "target", {
|
|
2149
|
+
configurable: true,
|
|
2150
|
+
value
|
|
2151
|
+
});
|
|
2152
|
+
const handleNode = () => {
|
|
2153
|
+
const handler = node[key];
|
|
2154
|
+
if (handler && !node.disabled) {
|
|
2155
|
+
const data = node[`${key}Data`];
|
|
2156
|
+
data !== void 0 ? handler.call(node, data, e) : handler.call(node, e);
|
|
2157
|
+
if (e.cancelBubble) return;
|
|
2158
|
+
}
|
|
2159
|
+
node.host && typeof node.host !== "string" && !node.host._$host && node.contains(e.target) && retarget(node.host);
|
|
2160
|
+
return true;
|
|
2161
|
+
};
|
|
2162
|
+
const walkUpTree = () => {
|
|
2163
|
+
while (handleNode() && (node = node._$host || node.parentNode || node.host)) ;
|
|
2164
|
+
};
|
|
2165
|
+
Object.defineProperty(e, "currentTarget", {
|
|
2166
|
+
configurable: true,
|
|
2167
|
+
get() {
|
|
2168
|
+
return node || document;
|
|
2169
|
+
}
|
|
2170
|
+
});
|
|
2171
|
+
if (sharedConfig.registry && !sharedConfig.done) sharedConfig.done = _$HY.done = true;
|
|
2172
|
+
if (e.composedPath) {
|
|
2173
|
+
const path = e.composedPath();
|
|
2174
|
+
retarget(path[0]);
|
|
2175
|
+
for (let i = 0; i < path.length - 2; i++) {
|
|
2176
|
+
node = path[i];
|
|
2177
|
+
if (!handleNode()) break;
|
|
2178
|
+
if (node._$host) {
|
|
2179
|
+
node = node._$host;
|
|
2180
|
+
walkUpTree();
|
|
2181
|
+
break;
|
|
2182
|
+
}
|
|
2183
|
+
if (node.parentNode === oriCurrentTarget) {
|
|
2184
|
+
break;
|
|
2185
|
+
}
|
|
2186
|
+
}
|
|
2187
|
+
} else walkUpTree();
|
|
2188
|
+
retarget(oriTarget);
|
|
2189
|
+
}
|
|
2190
|
+
function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
2191
|
+
const hydrating = isHydrating(parent);
|
|
2192
|
+
if (hydrating) {
|
|
2193
|
+
!current && (current = [...parent.childNodes]);
|
|
2194
|
+
let cleaned = [];
|
|
2195
|
+
for (let i = 0; i < current.length; i++) {
|
|
2196
|
+
const node = current[i];
|
|
2197
|
+
if (node.nodeType === 8 && node.data.slice(0, 2) === "!$") node.remove();
|
|
2198
|
+
else cleaned.push(node);
|
|
2199
|
+
}
|
|
2200
|
+
current = cleaned;
|
|
2201
|
+
}
|
|
2202
|
+
while (typeof current === "function") current = current();
|
|
2203
|
+
if (value === current) return current;
|
|
2204
|
+
const t = typeof value, multi = marker !== void 0;
|
|
2205
|
+
parent = multi && current[0] && current[0].parentNode || parent;
|
|
2206
|
+
if (t === "string" || t === "number") {
|
|
2207
|
+
if (hydrating) return current;
|
|
2208
|
+
if (t === "number") {
|
|
2209
|
+
value = value.toString();
|
|
2210
|
+
if (value === current) return current;
|
|
2211
|
+
}
|
|
2212
|
+
if (multi) {
|
|
2213
|
+
let node = current[0];
|
|
2214
|
+
if (node && node.nodeType === 3) {
|
|
2215
|
+
node.data !== value && (node.data = value);
|
|
2216
|
+
} else node = document.createTextNode(value);
|
|
2217
|
+
current = cleanChildren(parent, current, marker, node);
|
|
2218
|
+
} else {
|
|
2219
|
+
if (current !== "" && typeof current === "string") {
|
|
2220
|
+
current = parent.firstChild.data = value;
|
|
2221
|
+
} else current = parent.textContent = value;
|
|
2222
|
+
}
|
|
2223
|
+
} else if (value == null || t === "boolean") {
|
|
2224
|
+
if (hydrating) return current;
|
|
2225
|
+
current = cleanChildren(parent, current, marker);
|
|
2226
|
+
} else if (t === "function") {
|
|
2227
|
+
createRenderEffect(() => {
|
|
2228
|
+
let v = value();
|
|
2229
|
+
while (typeof v === "function") v = v();
|
|
2230
|
+
current = insertExpression(parent, v, current, marker);
|
|
2231
|
+
});
|
|
2232
|
+
return () => current;
|
|
2233
|
+
} else if (Array.isArray(value)) {
|
|
2234
|
+
const array = [];
|
|
2235
|
+
const currentArray = current && Array.isArray(current);
|
|
2236
|
+
if (normalizeIncomingArray(array, value, current, unwrapArray)) {
|
|
2237
|
+
createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
|
|
2238
|
+
return () => current;
|
|
2239
|
+
}
|
|
2240
|
+
if (hydrating) {
|
|
2241
|
+
if (!array.length) return current;
|
|
2242
|
+
if (marker === void 0) return current = [...parent.childNodes];
|
|
2243
|
+
let node = array[0];
|
|
2244
|
+
if (node.parentNode !== parent) return current;
|
|
2245
|
+
const nodes = [node];
|
|
2246
|
+
while ((node = node.nextSibling) !== marker) nodes.push(node);
|
|
2247
|
+
return current = nodes;
|
|
2248
|
+
}
|
|
2249
|
+
if (array.length === 0) {
|
|
2250
|
+
current = cleanChildren(parent, current, marker);
|
|
2251
|
+
if (multi) return current;
|
|
2252
|
+
} else if (currentArray) {
|
|
2253
|
+
if (current.length === 0) {
|
|
2254
|
+
appendNodes(parent, array, marker);
|
|
2255
|
+
} else reconcileArrays(parent, current, array);
|
|
2256
|
+
} else {
|
|
2257
|
+
current && cleanChildren(parent);
|
|
2258
|
+
appendNodes(parent, array);
|
|
2259
|
+
}
|
|
2260
|
+
current = array;
|
|
2261
|
+
} else if (value.nodeType) {
|
|
2262
|
+
if (hydrating && value.parentNode) return current = multi ? [value] : value;
|
|
2263
|
+
if (Array.isArray(current)) {
|
|
2264
|
+
if (multi) return current = cleanChildren(parent, current, marker, value);
|
|
2265
|
+
cleanChildren(parent, current, null, value);
|
|
2266
|
+
} else if (current == null || current === "" || !parent.firstChild) {
|
|
2267
|
+
parent.appendChild(value);
|
|
2268
|
+
} else parent.replaceChild(value, parent.firstChild);
|
|
2269
|
+
current = value;
|
|
2270
|
+
} else ;
|
|
2271
|
+
return current;
|
|
2272
|
+
}
|
|
2273
|
+
function normalizeIncomingArray(normalized, array, current, unwrap) {
|
|
2274
|
+
let dynamic = false;
|
|
2275
|
+
for (let i = 0, len = array.length; i < len; i++) {
|
|
2276
|
+
let item = array[i], prev = current && current[normalized.length], t;
|
|
2277
|
+
if (item == null || item === true || item === false) ;
|
|
2278
|
+
else if ((t = typeof item) === "object" && item.nodeType) {
|
|
2279
|
+
normalized.push(item);
|
|
2280
|
+
} else if (Array.isArray(item)) {
|
|
2281
|
+
dynamic = normalizeIncomingArray(normalized, item, prev) || dynamic;
|
|
2282
|
+
} else if (t === "function") {
|
|
2283
|
+
if (unwrap) {
|
|
2284
|
+
while (typeof item === "function") item = item();
|
|
2285
|
+
dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], Array.isArray(prev) ? prev : [prev]) || dynamic;
|
|
2286
|
+
} else {
|
|
2287
|
+
normalized.push(item);
|
|
2288
|
+
dynamic = true;
|
|
2289
|
+
}
|
|
2290
|
+
} else {
|
|
2291
|
+
const value = String(item);
|
|
2292
|
+
if (prev && prev.nodeType === 3 && prev.data === value) normalized.push(prev);
|
|
2293
|
+
else normalized.push(document.createTextNode(value));
|
|
2294
|
+
}
|
|
2295
|
+
}
|
|
2296
|
+
return dynamic;
|
|
2297
|
+
}
|
|
2298
|
+
function appendNodes(parent, array, marker = null) {
|
|
2299
|
+
for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker);
|
|
2300
|
+
}
|
|
2301
|
+
function cleanChildren(parent, current, marker, replacement) {
|
|
2302
|
+
if (marker === void 0) return parent.textContent = "";
|
|
2303
|
+
const node = replacement || document.createTextNode("");
|
|
2304
|
+
if (current.length) {
|
|
2305
|
+
let inserted = false;
|
|
2306
|
+
for (let i = current.length - 1; i >= 0; i--) {
|
|
2307
|
+
const el = current[i];
|
|
2308
|
+
if (node !== el) {
|
|
2309
|
+
const isParent = el.parentNode === parent;
|
|
2310
|
+
if (!inserted && !i) isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);
|
|
2311
|
+
else isParent && el.remove();
|
|
2312
|
+
} else inserted = true;
|
|
2313
|
+
}
|
|
2314
|
+
} else parent.insertBefore(node, marker);
|
|
2315
|
+
return [node];
|
|
2316
|
+
}
|
|
2317
|
+
|
|
2318
|
+
// node_modules/solid-js/h/dist/h.js
|
|
2319
|
+
var $ELEMENT = /* @__PURE__ */ Symbol("hyper-element");
|
|
2320
|
+
function createHyperScript(r) {
|
|
2321
|
+
function h2() {
|
|
2322
|
+
let args = [].slice.call(arguments), e, classes = [], multiExpression = false;
|
|
2323
|
+
while (Array.isArray(args[0])) args = args[0];
|
|
2324
|
+
if (args[0][$ELEMENT]) args.unshift(h2.Fragment);
|
|
2325
|
+
typeof args[0] === "string" && detectMultiExpression(args);
|
|
2326
|
+
const ret = () => {
|
|
2327
|
+
while (args.length) item(args.shift());
|
|
2328
|
+
if (e instanceof Element && classes.length) e.classList.add(...classes);
|
|
2329
|
+
return e;
|
|
2330
|
+
};
|
|
2331
|
+
ret[$ELEMENT] = true;
|
|
2332
|
+
return ret;
|
|
2333
|
+
function item(l) {
|
|
2334
|
+
const type = typeof l;
|
|
2335
|
+
if (l == null) ;
|
|
2336
|
+
else if ("string" === type) {
|
|
2337
|
+
if (!e) parseClass(l);
|
|
2338
|
+
else e.appendChild(document.createTextNode(l));
|
|
2339
|
+
} else if ("number" === type || "boolean" === type || "bigint" === type || "symbol" === type || l instanceof Date || l instanceof RegExp) {
|
|
2340
|
+
e.appendChild(document.createTextNode(l.toString()));
|
|
2341
|
+
} else if (Array.isArray(l)) {
|
|
2342
|
+
for (let i = 0; i < l.length; i++) item(l[i]);
|
|
2343
|
+
} else if (l instanceof Element) {
|
|
2344
|
+
r.insert(e, l, multiExpression ? null : void 0);
|
|
2345
|
+
} else if ("object" === type) {
|
|
2346
|
+
let dynamic = false;
|
|
2347
|
+
const d = Object.getOwnPropertyDescriptors(l);
|
|
2348
|
+
for (const k in d) {
|
|
2349
|
+
if (k === "class" && classes.length !== 0) {
|
|
2350
|
+
const fixedClasses = classes.join(" "), value = typeof d["class"].value === "function" ? () => fixedClasses + " " + d["class"].value() : fixedClasses + " " + l["class"];
|
|
2351
|
+
Object.defineProperty(l, "class", {
|
|
2352
|
+
...d[k],
|
|
2353
|
+
value
|
|
2354
|
+
});
|
|
2355
|
+
classes = [];
|
|
2356
|
+
}
|
|
2357
|
+
if (k !== "ref" && k.slice(0, 2) !== "on" && typeof d[k].value === "function") {
|
|
2358
|
+
r.dynamicProperty(l, k);
|
|
2359
|
+
dynamic = true;
|
|
2360
|
+
} else if (d[k].get) dynamic = true;
|
|
2361
|
+
}
|
|
2362
|
+
dynamic ? r.spread(e, l, e instanceof SVGElement, !!args.length) : r.assign(e, l, e instanceof SVGElement, !!args.length);
|
|
2363
|
+
} else if ("function" === type) {
|
|
2364
|
+
if (!e) {
|
|
2365
|
+
let props, next = args[0];
|
|
2366
|
+
if (next == null || typeof next === "object" && !Array.isArray(next) && !(next instanceof Element)) props = args.shift();
|
|
2367
|
+
props || (props = {});
|
|
2368
|
+
if (args.length) {
|
|
2369
|
+
props.children = args.length > 1 ? args : args[0];
|
|
2370
|
+
}
|
|
2371
|
+
const d = Object.getOwnPropertyDescriptors(props);
|
|
2372
|
+
for (const k in d) {
|
|
2373
|
+
if (Array.isArray(d[k].value)) {
|
|
2374
|
+
const list = d[k].value;
|
|
2375
|
+
props[k] = () => {
|
|
2376
|
+
for (let i = 0; i < list.length; i++) {
|
|
2377
|
+
while (list[i][$ELEMENT]) list[i] = list[i]();
|
|
2378
|
+
}
|
|
2379
|
+
return list;
|
|
2380
|
+
};
|
|
2381
|
+
r.dynamicProperty(props, k);
|
|
2382
|
+
} else if (typeof d[k].value === "function" && !d[k].value.length) r.dynamicProperty(props, k);
|
|
2383
|
+
}
|
|
2384
|
+
e = r.createComponent(l, props);
|
|
2385
|
+
args = [];
|
|
2386
|
+
} else {
|
|
2387
|
+
while (l[$ELEMENT]) l = l();
|
|
2388
|
+
r.insert(e, l, multiExpression ? null : void 0);
|
|
2389
|
+
}
|
|
2390
|
+
}
|
|
2391
|
+
}
|
|
2392
|
+
function parseClass(string) {
|
|
2393
|
+
const m = string.split(/([\.#]?[^\s#.]+)/);
|
|
2394
|
+
if (/^\.|#/.test(m[1])) e = document.createElement("div");
|
|
2395
|
+
for (let i = 0; i < m.length; i++) {
|
|
2396
|
+
const v = m[i], s = v.substring(1, v.length);
|
|
2397
|
+
if (!v) continue;
|
|
2398
|
+
if (!e) e = r.SVGElements.has(v) ? document.createElementNS("http://www.w3.org/2000/svg", v) : document.createElement(v);
|
|
2399
|
+
else if (v[0] === ".") classes.push(s);
|
|
2400
|
+
else if (v[0] === "#") e.setAttribute("id", s);
|
|
2401
|
+
}
|
|
2402
|
+
}
|
|
2403
|
+
function detectMultiExpression(list) {
|
|
2404
|
+
for (let i = 1; i < list.length; i++) {
|
|
2405
|
+
if (typeof list[i] === "function") {
|
|
2406
|
+
multiExpression = true;
|
|
2407
|
+
return;
|
|
2408
|
+
} else if (Array.isArray(list[i])) {
|
|
2409
|
+
detectMultiExpression(list[i]);
|
|
2410
|
+
}
|
|
2411
|
+
}
|
|
2412
|
+
}
|
|
2413
|
+
}
|
|
2414
|
+
h2.Fragment = (props) => props.children;
|
|
2415
|
+
return h2;
|
|
2416
|
+
}
|
|
2417
|
+
var h = createHyperScript({
|
|
2418
|
+
spread: spread2,
|
|
2419
|
+
assign,
|
|
2420
|
+
insert: insert2,
|
|
2421
|
+
createComponent,
|
|
2422
|
+
dynamicProperty,
|
|
2423
|
+
SVGElements
|
|
2424
|
+
});
|
|
2425
|
+
|
|
2426
|
+
// node_modules/solid-js/h/jsx-runtime/dist/jsx.js
|
|
2427
|
+
function jsx(type, props) {
|
|
2428
|
+
return h(type, props);
|
|
2429
|
+
}
|
|
2430
|
+
|
|
2431
|
+
// src/ui.tsx
|
|
2432
|
+
async function runInteractiveApp({
|
|
2433
|
+
initialPrompt,
|
|
2434
|
+
options,
|
|
2435
|
+
processUserInput,
|
|
2436
|
+
infoLine,
|
|
2437
|
+
infoDisplay
|
|
2438
|
+
}) {
|
|
2439
|
+
const logo = await loadLogo();
|
|
2440
|
+
console.log(` ${logo}`);
|
|
2441
|
+
const rows = process.stdout.rows ?? 24;
|
|
2442
|
+
const logoHeight = logo.endsWith("\n") ? logo.slice(0, -1).split("\n").length : logo.split("\n").length;
|
|
2443
|
+
const splitHeight = Math.max(1, rows - logoHeight - 1);
|
|
2444
|
+
render(
|
|
2445
|
+
() => /* @__PURE__ */ jsx(
|
|
2446
|
+
App,
|
|
2447
|
+
{
|
|
2448
|
+
initialPrompt,
|
|
2449
|
+
options,
|
|
2450
|
+
processUserInput,
|
|
2451
|
+
infoLine,
|
|
2452
|
+
infoDisplay
|
|
2453
|
+
}
|
|
2454
|
+
),
|
|
2455
|
+
{
|
|
2456
|
+
useAlternateScreen: false,
|
|
2457
|
+
exitOnCtrlC: true,
|
|
2458
|
+
useMouse: true,
|
|
2459
|
+
enableMouseMovement: true,
|
|
2460
|
+
experimental_splitHeight: splitHeight
|
|
2461
|
+
}
|
|
2462
|
+
);
|
|
2463
|
+
}
|
|
2464
|
+
function App({ initialPrompt, options, processUserInput, infoLine, infoDisplay }) {
|
|
2465
|
+
const renderer = useRenderer();
|
|
2466
|
+
const dimensions = useTerminalDimensions();
|
|
2467
|
+
const [messages, setMessages] = createSignal([]);
|
|
2468
|
+
const [inputValue, setInputValue] = createSignal("");
|
|
2469
|
+
const [showIntro, setShowIntro] = createSignal(true);
|
|
2470
|
+
const [isFullScreen, setIsFullScreen] = createSignal(false);
|
|
2471
|
+
const [spinnerFrame, setSpinnerFrame] = createSignal(0);
|
|
2472
|
+
const [isLoading, setIsLoading] = createSignal(false);
|
|
2473
|
+
const promptFg = "#00ffff";
|
|
2474
|
+
const responseFg = "#ffffff";
|
|
2475
|
+
const promptBg = "#2b2b2b";
|
|
2476
|
+
let inputRef;
|
|
2477
|
+
let currentMemoryId = options.memoryId;
|
|
2478
|
+
let messageId = 0;
|
|
2479
|
+
const usageText = infoDisplay?.usageLine ?? infoLine ?? "";
|
|
2480
|
+
const versionText = infoDisplay?.versionLine ?? "";
|
|
2481
|
+
const modelText = infoDisplay?.modelLine ?? "";
|
|
2482
|
+
const appendMessage = (role, text) => {
|
|
2483
|
+
setMessages((prev) => [...prev, { id: messageId++, role, text }]);
|
|
2484
|
+
};
|
|
2485
|
+
const exitApp = () => {
|
|
2486
|
+
renderer.destroy();
|
|
2487
|
+
process.exit(0);
|
|
2488
|
+
};
|
|
2489
|
+
const submitPrompt = async (raw) => {
|
|
2490
|
+
const trimmed = raw.trim();
|
|
2491
|
+
if (!trimmed) return;
|
|
2492
|
+
if (trimmed.toLowerCase() === "exit" || trimmed.toLowerCase() === "quit") {
|
|
2493
|
+
exitApp();
|
|
2494
|
+
return;
|
|
2495
|
+
}
|
|
2496
|
+
if (showIntro()) {
|
|
2497
|
+
setShowIntro(false);
|
|
2498
|
+
}
|
|
2499
|
+
if (!isFullScreen()) {
|
|
2500
|
+
setIsFullScreen(true);
|
|
2501
|
+
}
|
|
2502
|
+
setInputValue("");
|
|
2503
|
+
if (inputRef) {
|
|
2504
|
+
inputRef.value = "";
|
|
2505
|
+
}
|
|
2506
|
+
appendMessage("prompt", trimmed);
|
|
2507
|
+
try {
|
|
2508
|
+
setIsLoading(true);
|
|
2509
|
+
const result = await processUserInput(trimmed, { ...options, memoryId: currentMemoryId }, "tui");
|
|
2510
|
+
currentMemoryId = result.memoryId;
|
|
2511
|
+
appendMessage("response", result.response);
|
|
2512
|
+
if (result.instruction) {
|
|
2513
|
+
appendMessage("response", result.instruction);
|
|
2514
|
+
}
|
|
2515
|
+
} catch (error) {
|
|
2516
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
2517
|
+
appendMessage("response", `Error: ${message}`);
|
|
2518
|
+
} finally {
|
|
2519
|
+
setIsLoading(false);
|
|
2520
|
+
}
|
|
2521
|
+
};
|
|
2522
|
+
onMount(async () => {
|
|
2523
|
+
const spinner = cliSpinners.dots;
|
|
2524
|
+
const timer = setInterval(() => {
|
|
2525
|
+
if (isLoading()) {
|
|
2526
|
+
setSpinnerFrame((prev) => (prev + 1) % spinner.frames.length);
|
|
2527
|
+
}
|
|
2528
|
+
}, spinner.interval);
|
|
2529
|
+
onCleanup(() => clearInterval(timer));
|
|
2530
|
+
if (initialPrompt) {
|
|
2531
|
+
await submitPrompt(initialPrompt);
|
|
2532
|
+
}
|
|
2533
|
+
if (inputRef) {
|
|
2534
|
+
inputRef.focus();
|
|
2535
|
+
}
|
|
2536
|
+
});
|
|
2537
|
+
const inputBoxWidth = () => Math.max(1, Math.round(dimensions().width * 0.6));
|
|
2538
|
+
const inputBoxLeft = () => Math.max(0, Math.round(dimensions().width * 0.15));
|
|
2539
|
+
const inputBoxHeight = () => isFullScreen() ? 7 : 14;
|
|
2540
|
+
const inputBoxTop = () => isFullScreen() ? Math.max(1, dimensions().height - inputBoxHeight() - 2) : Math.max(1, Math.round(dimensions().height * 0.666));
|
|
2541
|
+
const messagesTop = () => 1;
|
|
2542
|
+
const messagesHeight = () => Math.max(1, inputBoxTop() - messagesTop() - 1);
|
|
2543
|
+
const messagesWidth = () => Math.min(dimensions().width - 2, inputBoxWidth() + 10);
|
|
2544
|
+
const messagesLeft = () => Math.max(1, inputBoxLeft() - 5);
|
|
2545
|
+
return /* @__PURE__ */ jsx("box", { width: "100%", height: "100%", flexDirection: "column", children: [
|
|
2546
|
+
/* @__PURE__ */ jsx(
|
|
2547
|
+
"scrollbox",
|
|
2548
|
+
{
|
|
2549
|
+
id: "messages",
|
|
2550
|
+
width: messagesWidth(),
|
|
2551
|
+
height: messagesHeight(),
|
|
2552
|
+
position: "absolute",
|
|
2553
|
+
left: messagesLeft(),
|
|
2554
|
+
top: messagesTop(),
|
|
2555
|
+
paddingLeft: 1,
|
|
2556
|
+
paddingRight: 1,
|
|
2557
|
+
focused: true,
|
|
2558
|
+
stickyScroll: true,
|
|
2559
|
+
stickyStart: "bottom",
|
|
2560
|
+
children: /* @__PURE__ */ jsx("box", { width: "100%", flexDirection: "column", children: /* @__PURE__ */ jsx(For, { each: messages(), children: (message) => /* @__PURE__ */ jsx(
|
|
2561
|
+
"box",
|
|
2562
|
+
{
|
|
2563
|
+
width: "100%",
|
|
2564
|
+
flexDirection: "row",
|
|
2565
|
+
justifyContent: message.role === "prompt" ? "flex-start" : "flex-end",
|
|
2566
|
+
marginBottom: 1,
|
|
2567
|
+
children: /* @__PURE__ */ jsx(
|
|
2568
|
+
"box",
|
|
2569
|
+
{
|
|
2570
|
+
paddingLeft: 1,
|
|
2571
|
+
paddingRight: 1,
|
|
2572
|
+
paddingTop: 1,
|
|
2573
|
+
paddingBottom: 1,
|
|
2574
|
+
backgroundColor: message.role === "prompt" ? promptBg : void 0,
|
|
2575
|
+
children: /* @__PURE__ */ jsx(
|
|
2576
|
+
"text",
|
|
2577
|
+
{
|
|
2578
|
+
fg: message.role === "prompt" ? promptFg : responseFg,
|
|
2579
|
+
width: "100%",
|
|
2580
|
+
wrapMode: "word",
|
|
2581
|
+
selectable: false,
|
|
2582
|
+
children: message.text
|
|
2583
|
+
}
|
|
2584
|
+
)
|
|
2585
|
+
}
|
|
2586
|
+
)
|
|
2587
|
+
}
|
|
2588
|
+
) }) })
|
|
2589
|
+
}
|
|
2590
|
+
),
|
|
2591
|
+
/* @__PURE__ */ jsx(
|
|
2592
|
+
"box",
|
|
2593
|
+
{
|
|
2594
|
+
id: "input-box",
|
|
2595
|
+
width: inputBoxWidth(),
|
|
2596
|
+
height: inputBoxHeight(),
|
|
2597
|
+
position: "absolute",
|
|
2598
|
+
left: inputBoxLeft(),
|
|
2599
|
+
top: inputBoxTop(),
|
|
2600
|
+
paddingLeft: 1,
|
|
2601
|
+
paddingRight: 1,
|
|
2602
|
+
paddingTop: 1,
|
|
2603
|
+
flexDirection: "column",
|
|
2604
|
+
children: [
|
|
2605
|
+
/* @__PURE__ */ jsx(For, { each: !isFullScreen() && showIntro() ? [
|
|
2606
|
+
"Use Satori just like you would use ChatGPT.",
|
|
2607
|
+
"Except, it stores your conversations in a long term memory.",
|
|
2608
|
+
"The memories you store here can be accessed through the SDK."
|
|
2609
|
+
] : [], children: (line) => /* @__PURE__ */ jsx("text", { fg: "cyan", children: line }) }),
|
|
2610
|
+
/* @__PURE__ */ jsx(
|
|
2611
|
+
"box",
|
|
2612
|
+
{
|
|
2613
|
+
id: "input-box",
|
|
2614
|
+
width: inputBoxWidth(),
|
|
2615
|
+
height: 5,
|
|
2616
|
+
backgroundColor: "#1a1a1a",
|
|
2617
|
+
flexDirection: "column",
|
|
2618
|
+
justifyContent: "center",
|
|
2619
|
+
children: [
|
|
2620
|
+
/* @__PURE__ */ jsx(
|
|
2621
|
+
"input",
|
|
2622
|
+
{
|
|
2623
|
+
id: "input",
|
|
2624
|
+
width: "100%",
|
|
2625
|
+
height: 1,
|
|
2626
|
+
placeholder: "Type a message and press Enter...",
|
|
2627
|
+
focusedBackgroundColor: "#1a1a1a",
|
|
2628
|
+
onInput: (value) => setInputValue(value),
|
|
2629
|
+
onSubmit: () => submitPrompt(inputValue()),
|
|
2630
|
+
ref: (r) => {
|
|
2631
|
+
inputRef = r;
|
|
2632
|
+
}
|
|
2633
|
+
}
|
|
2634
|
+
),
|
|
2635
|
+
/* @__PURE__ */ jsx("box", { flexDirection: "row", flexShrink: 0, paddingTop: 1, children: /* @__PURE__ */ jsx("text", { fg: "#ffffff", children: modelText }) })
|
|
2636
|
+
]
|
|
2637
|
+
}
|
|
2638
|
+
)
|
|
2639
|
+
]
|
|
2640
|
+
}
|
|
2641
|
+
),
|
|
2642
|
+
/* @__PURE__ */ jsx(Show, { when: isLoading(), children: /* @__PURE__ */ jsx(
|
|
2643
|
+
"box",
|
|
2644
|
+
{
|
|
2645
|
+
id: "spinner",
|
|
2646
|
+
position: "absolute",
|
|
2647
|
+
left: inputBoxLeft(),
|
|
2648
|
+
top: inputBoxTop() + inputBoxHeight(),
|
|
2649
|
+
paddingLeft: 1,
|
|
2650
|
+
children: /* @__PURE__ */ jsx("text", { fg: "#00ffff", children: cliSpinners.dots.frames[spinnerFrame()] })
|
|
2651
|
+
}
|
|
2652
|
+
) }),
|
|
2653
|
+
/* @__PURE__ */ jsx(
|
|
2654
|
+
"box",
|
|
2655
|
+
{
|
|
2656
|
+
id: "footer",
|
|
2657
|
+
width: dimensions().width,
|
|
2658
|
+
height: 1,
|
|
2659
|
+
position: "absolute",
|
|
2660
|
+
bottom: 0,
|
|
2661
|
+
left: 0,
|
|
2662
|
+
backgroundColor: "#000000",
|
|
2663
|
+
paddingLeft: 1,
|
|
2664
|
+
paddingRight: 1,
|
|
2665
|
+
flexDirection: "row",
|
|
2666
|
+
justifyContent: "space-between",
|
|
2667
|
+
alignItems: "center",
|
|
2668
|
+
children: [
|
|
2669
|
+
/* @__PURE__ */ jsx("text", { fg: "#00ffff", wrapMode: "none", width: "100%", children: usageText }),
|
|
2670
|
+
/* @__PURE__ */ jsx("box", { flexShrink: 0, paddingLeft: 1, children: /* @__PURE__ */ jsx("text", { fg: "#00ffff", children: versionText }) })
|
|
2671
|
+
]
|
|
2672
|
+
}
|
|
2673
|
+
)
|
|
2674
|
+
] });
|
|
2675
|
+
}
|
|
2676
|
+
export {
|
|
2677
|
+
runInteractiveApp
|
|
2678
|
+
};
|