llm-party-cli 0.11.0 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +3 -10
  2. package/dist/index.js +1319 -1293
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3288,6 +3288,932 @@ import { readFile as readFile6 } from "fs/promises";
3288
3288
  import path11 from "path";
3289
3289
  import { fileURLToPath as fileURLToPath3 } from "url";
3290
3290
 
3291
+ // node_modules/solid-js/dist/server.js
3292
+ var sharedConfig = {
3293
+ context: undefined,
3294
+ registry: undefined,
3295
+ effects: undefined,
3296
+ done: false,
3297
+ getContextId() {
3298
+ return getContextId(this.context.count);
3299
+ },
3300
+ getNextContextId() {
3301
+ return getContextId(this.context.count++);
3302
+ }
3303
+ };
3304
+ function getContextId(count) {
3305
+ const num = String(count), len = num.length - 1;
3306
+ return sharedConfig.context.id + (len ? String.fromCharCode(96 + len) : "") + num;
3307
+ }
3308
+ function setHydrateContext(context) {
3309
+ sharedConfig.context = context;
3310
+ }
3311
+ function nextHydrateContext() {
3312
+ return {
3313
+ ...sharedConfig.context,
3314
+ id: sharedConfig.getNextContextId(),
3315
+ count: 0
3316
+ };
3317
+ }
3318
+ var IS_DEV = false;
3319
+ var equalFn = (a, b) => a === b;
3320
+ var $PROXY = Symbol("solid-proxy");
3321
+ var SUPPORTS_PROXY = typeof Proxy === "function";
3322
+ var $TRACK = Symbol("solid-track");
3323
+ var $DEVCOMP = Symbol("solid-dev-component");
3324
+ var signalOptions = {
3325
+ equals: equalFn
3326
+ };
3327
+ var ERROR = null;
3328
+ var runEffects = runQueue;
3329
+ var STALE = 1;
3330
+ var PENDING = 2;
3331
+ var UNOWNED = {
3332
+ owned: null,
3333
+ cleanups: null,
3334
+ context: null,
3335
+ owner: null
3336
+ };
3337
+ var Owner = null;
3338
+ var Transition = null;
3339
+ var Scheduler = null;
3340
+ var ExternalSourceConfig = null;
3341
+ var Listener = null;
3342
+ var Updates = null;
3343
+ var Effects = null;
3344
+ var ExecCount = 0;
3345
+ function createRoot(fn, detachedOwner) {
3346
+ const listener = Listener, owner = Owner, unowned = fn.length === 0, current = detachedOwner === undefined ? owner : detachedOwner, root = unowned ? UNOWNED : {
3347
+ owned: null,
3348
+ cleanups: null,
3349
+ context: current ? current.context : null,
3350
+ owner: current
3351
+ }, updateFn = unowned ? fn : () => fn(() => untrack(() => cleanNode(root)));
3352
+ Owner = root;
3353
+ Listener = null;
3354
+ try {
3355
+ return runUpdates(updateFn, true);
3356
+ } finally {
3357
+ Listener = listener;
3358
+ Owner = owner;
3359
+ }
3360
+ }
3361
+ function createSignal(value, options) {
3362
+ options = options ? Object.assign({}, signalOptions, options) : signalOptions;
3363
+ const s = {
3364
+ value,
3365
+ observers: null,
3366
+ observerSlots: null,
3367
+ comparator: options.equals || undefined
3368
+ };
3369
+ const setter = (value2) => {
3370
+ if (typeof value2 === "function") {
3371
+ if (Transition && Transition.running && Transition.sources.has(s))
3372
+ value2 = value2(s.tValue);
3373
+ else
3374
+ value2 = value2(s.value);
3375
+ }
3376
+ return writeSignal(s, value2);
3377
+ };
3378
+ return [readSignal.bind(s), setter];
3379
+ }
3380
+ function createRenderEffect(fn, value, options) {
3381
+ const c = createComputation(fn, value, false, STALE);
3382
+ if (Scheduler && Transition && Transition.running)
3383
+ Updates.push(c);
3384
+ else
3385
+ updateComputation(c);
3386
+ }
3387
+ function createEffect(fn, value, options) {
3388
+ runEffects = runUserEffects;
3389
+ const c = createComputation(fn, value, false, STALE), s = SuspenseContext && useContext(SuspenseContext);
3390
+ if (s)
3391
+ c.suspense = s;
3392
+ if (!options || !options.render)
3393
+ c.user = true;
3394
+ Effects ? Effects.push(c) : updateComputation(c);
3395
+ }
3396
+ function createMemo(fn, value, options) {
3397
+ options = options ? Object.assign({}, signalOptions, options) : signalOptions;
3398
+ const c = createComputation(fn, value, true, 0);
3399
+ c.observers = null;
3400
+ c.observerSlots = null;
3401
+ c.comparator = options.equals || undefined;
3402
+ if (Scheduler && Transition && Transition.running) {
3403
+ c.tState = STALE;
3404
+ Updates.push(c);
3405
+ } else
3406
+ updateComputation(c);
3407
+ return readSignal.bind(c);
3408
+ }
3409
+ function untrack(fn) {
3410
+ if (!ExternalSourceConfig && Listener === null)
3411
+ return fn();
3412
+ const listener = Listener;
3413
+ Listener = null;
3414
+ try {
3415
+ if (ExternalSourceConfig)
3416
+ return ExternalSourceConfig.untrack(fn);
3417
+ return fn();
3418
+ } finally {
3419
+ Listener = listener;
3420
+ }
3421
+ }
3422
+ function onMount(fn) {
3423
+ createEffect(() => untrack(fn));
3424
+ }
3425
+ function onCleanup(fn) {
3426
+ if (Owner === null)
3427
+ ;
3428
+ else if (Owner.cleanups === null)
3429
+ Owner.cleanups = [fn];
3430
+ else
3431
+ Owner.cleanups.push(fn);
3432
+ return fn;
3433
+ }
3434
+ function startTransition(fn) {
3435
+ if (Transition && Transition.running) {
3436
+ fn();
3437
+ return Transition.done;
3438
+ }
3439
+ const l = Listener;
3440
+ const o = Owner;
3441
+ return Promise.resolve().then(() => {
3442
+ Listener = l;
3443
+ Owner = o;
3444
+ let t;
3445
+ if (Scheduler || SuspenseContext) {
3446
+ t = Transition || (Transition = {
3447
+ sources: new Set,
3448
+ effects: [],
3449
+ promises: new Set,
3450
+ disposed: new Set,
3451
+ queue: new Set,
3452
+ running: true
3453
+ });
3454
+ t.done || (t.done = new Promise((res) => t.resolve = res));
3455
+ t.running = true;
3456
+ }
3457
+ runUpdates(fn, false);
3458
+ Listener = Owner = null;
3459
+ return t ? t.done : undefined;
3460
+ });
3461
+ }
3462
+ var [transPending, setTransPending] = /* @__PURE__ */ createSignal(false);
3463
+ function createContext(defaultValue, options) {
3464
+ const id = Symbol("context");
3465
+ return {
3466
+ id,
3467
+ Provider: createProvider(id),
3468
+ defaultValue
3469
+ };
3470
+ }
3471
+ function useContext(context) {
3472
+ let value;
3473
+ return Owner && Owner.context && (value = Owner.context[context.id]) !== undefined ? value : context.defaultValue;
3474
+ }
3475
+ function children(fn) {
3476
+ const children2 = createMemo(fn);
3477
+ const memo = createMemo(() => resolveChildren(children2()));
3478
+ memo.toArray = () => {
3479
+ const c = memo();
3480
+ return Array.isArray(c) ? c : c != null ? [c] : [];
3481
+ };
3482
+ return memo;
3483
+ }
3484
+ var SuspenseContext;
3485
+ function readSignal() {
3486
+ const runningTransition = Transition && Transition.running;
3487
+ if (this.sources && (runningTransition ? this.tState : this.state)) {
3488
+ if ((runningTransition ? this.tState : this.state) === STALE)
3489
+ updateComputation(this);
3490
+ else {
3491
+ const updates = Updates;
3492
+ Updates = null;
3493
+ runUpdates(() => lookUpstream(this), false);
3494
+ Updates = updates;
3495
+ }
3496
+ }
3497
+ if (Listener) {
3498
+ const sSlot = this.observers ? this.observers.length : 0;
3499
+ if (!Listener.sources) {
3500
+ Listener.sources = [this];
3501
+ Listener.sourceSlots = [sSlot];
3502
+ } else {
3503
+ Listener.sources.push(this);
3504
+ Listener.sourceSlots.push(sSlot);
3505
+ }
3506
+ if (!this.observers) {
3507
+ this.observers = [Listener];
3508
+ this.observerSlots = [Listener.sources.length - 1];
3509
+ } else {
3510
+ this.observers.push(Listener);
3511
+ this.observerSlots.push(Listener.sources.length - 1);
3512
+ }
3513
+ }
3514
+ if (runningTransition && Transition.sources.has(this))
3515
+ return this.tValue;
3516
+ return this.value;
3517
+ }
3518
+ function writeSignal(node, value, isComp) {
3519
+ let current = Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
3520
+ if (!node.comparator || !node.comparator(current, value)) {
3521
+ if (Transition) {
3522
+ const TransitionRunning = Transition.running;
3523
+ if (TransitionRunning || !isComp && Transition.sources.has(node)) {
3524
+ Transition.sources.add(node);
3525
+ node.tValue = value;
3526
+ }
3527
+ if (!TransitionRunning)
3528
+ node.value = value;
3529
+ } else
3530
+ node.value = value;
3531
+ if (node.observers && node.observers.length) {
3532
+ runUpdates(() => {
3533
+ for (let i = 0;i < node.observers.length; i += 1) {
3534
+ const o = node.observers[i];
3535
+ const TransitionRunning = Transition && Transition.running;
3536
+ if (TransitionRunning && Transition.disposed.has(o))
3537
+ continue;
3538
+ if (TransitionRunning ? !o.tState : !o.state) {
3539
+ if (o.pure)
3540
+ Updates.push(o);
3541
+ else
3542
+ Effects.push(o);
3543
+ if (o.observers)
3544
+ markDownstream(o);
3545
+ }
3546
+ if (!TransitionRunning)
3547
+ o.state = STALE;
3548
+ else
3549
+ o.tState = STALE;
3550
+ }
3551
+ if (Updates.length > 1e6) {
3552
+ Updates = [];
3553
+ if (IS_DEV)
3554
+ ;
3555
+ throw new Error;
3556
+ }
3557
+ }, false);
3558
+ }
3559
+ }
3560
+ return value;
3561
+ }
3562
+ function updateComputation(node) {
3563
+ if (!node.fn)
3564
+ return;
3565
+ cleanNode(node);
3566
+ const time = ExecCount;
3567
+ runComputation(node, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, time);
3568
+ if (Transition && !Transition.running && Transition.sources.has(node)) {
3569
+ queueMicrotask(() => {
3570
+ runUpdates(() => {
3571
+ Transition && (Transition.running = true);
3572
+ Listener = Owner = node;
3573
+ runComputation(node, node.tValue, time);
3574
+ Listener = Owner = null;
3575
+ }, false);
3576
+ });
3577
+ }
3578
+ }
3579
+ function runComputation(node, value, time) {
3580
+ let nextValue;
3581
+ const owner = Owner, listener = Listener;
3582
+ Listener = Owner = node;
3583
+ try {
3584
+ nextValue = node.fn(value);
3585
+ } catch (err) {
3586
+ if (node.pure) {
3587
+ if (Transition && Transition.running) {
3588
+ node.tState = STALE;
3589
+ node.tOwned && node.tOwned.forEach(cleanNode);
3590
+ node.tOwned = undefined;
3591
+ } else {
3592
+ node.state = STALE;
3593
+ node.owned && node.owned.forEach(cleanNode);
3594
+ node.owned = null;
3595
+ }
3596
+ }
3597
+ node.updatedAt = time + 1;
3598
+ return handleError(err);
3599
+ } finally {
3600
+ Listener = listener;
3601
+ Owner = owner;
3602
+ }
3603
+ if (!node.updatedAt || node.updatedAt <= time) {
3604
+ if (node.updatedAt != null && "observers" in node) {
3605
+ writeSignal(node, nextValue, true);
3606
+ } else if (Transition && Transition.running && node.pure) {
3607
+ if (!Transition.sources.has(node))
3608
+ node.value = nextValue;
3609
+ Transition.sources.add(node);
3610
+ node.tValue = nextValue;
3611
+ } else
3612
+ node.value = nextValue;
3613
+ node.updatedAt = time;
3614
+ }
3615
+ }
3616
+ function createComputation(fn, init, pure, state = STALE, options) {
3617
+ const c = {
3618
+ fn,
3619
+ state,
3620
+ updatedAt: null,
3621
+ owned: null,
3622
+ sources: null,
3623
+ sourceSlots: null,
3624
+ cleanups: null,
3625
+ value: init,
3626
+ owner: Owner,
3627
+ context: Owner ? Owner.context : null,
3628
+ pure
3629
+ };
3630
+ if (Transition && Transition.running) {
3631
+ c.state = 0;
3632
+ c.tState = state;
3633
+ }
3634
+ if (Owner === null)
3635
+ ;
3636
+ else if (Owner !== UNOWNED) {
3637
+ if (Transition && Transition.running && Owner.pure) {
3638
+ if (!Owner.tOwned)
3639
+ Owner.tOwned = [c];
3640
+ else
3641
+ Owner.tOwned.push(c);
3642
+ } else {
3643
+ if (!Owner.owned)
3644
+ Owner.owned = [c];
3645
+ else
3646
+ Owner.owned.push(c);
3647
+ }
3648
+ }
3649
+ if (ExternalSourceConfig && c.fn) {
3650
+ const sourceFn = c.fn;
3651
+ const [track, trigger] = createSignal(undefined, {
3652
+ equals: false
3653
+ });
3654
+ const ordinary = ExternalSourceConfig.factory(sourceFn, trigger);
3655
+ onCleanup(() => ordinary.dispose());
3656
+ let inTransition;
3657
+ const triggerInTransition = () => startTransition(trigger).then(() => {
3658
+ if (inTransition) {
3659
+ inTransition.dispose();
3660
+ inTransition = undefined;
3661
+ }
3662
+ });
3663
+ c.fn = (x) => {
3664
+ track();
3665
+ if (Transition && Transition.running) {
3666
+ if (!inTransition)
3667
+ inTransition = ExternalSourceConfig.factory(sourceFn, triggerInTransition);
3668
+ return inTransition.track(x);
3669
+ }
3670
+ return ordinary.track(x);
3671
+ };
3672
+ }
3673
+ return c;
3674
+ }
3675
+ function runTop(node) {
3676
+ const runningTransition = Transition && Transition.running;
3677
+ if ((runningTransition ? node.tState : node.state) === 0)
3678
+ return;
3679
+ if ((runningTransition ? node.tState : node.state) === PENDING)
3680
+ return lookUpstream(node);
3681
+ if (node.suspense && untrack(node.suspense.inFallback))
3682
+ return node.suspense.effects.push(node);
3683
+ const ancestors = [node];
3684
+ while ((node = node.owner) && (!node.updatedAt || node.updatedAt < ExecCount)) {
3685
+ if (runningTransition && Transition.disposed.has(node))
3686
+ return;
3687
+ if (runningTransition ? node.tState : node.state)
3688
+ ancestors.push(node);
3689
+ }
3690
+ for (let i = ancestors.length - 1;i >= 0; i--) {
3691
+ node = ancestors[i];
3692
+ if (runningTransition) {
3693
+ let top = node, prev = ancestors[i + 1];
3694
+ while ((top = top.owner) && top !== prev) {
3695
+ if (Transition.disposed.has(top))
3696
+ return;
3697
+ }
3698
+ }
3699
+ if ((runningTransition ? node.tState : node.state) === STALE) {
3700
+ updateComputation(node);
3701
+ } else if ((runningTransition ? node.tState : node.state) === PENDING) {
3702
+ const updates = Updates;
3703
+ Updates = null;
3704
+ runUpdates(() => lookUpstream(node, ancestors[0]), false);
3705
+ Updates = updates;
3706
+ }
3707
+ }
3708
+ }
3709
+ function runUpdates(fn, init) {
3710
+ if (Updates)
3711
+ return fn();
3712
+ let wait = false;
3713
+ if (!init)
3714
+ Updates = [];
3715
+ if (Effects)
3716
+ wait = true;
3717
+ else
3718
+ Effects = [];
3719
+ ExecCount++;
3720
+ try {
3721
+ const res = fn();
3722
+ completeUpdates(wait);
3723
+ return res;
3724
+ } catch (err) {
3725
+ if (!wait)
3726
+ Effects = null;
3727
+ Updates = null;
3728
+ handleError(err);
3729
+ }
3730
+ }
3731
+ function completeUpdates(wait) {
3732
+ if (Updates) {
3733
+ if (Scheduler && Transition && Transition.running)
3734
+ scheduleQueue(Updates);
3735
+ else
3736
+ runQueue(Updates);
3737
+ Updates = null;
3738
+ }
3739
+ if (wait)
3740
+ return;
3741
+ let res;
3742
+ if (Transition) {
3743
+ if (!Transition.promises.size && !Transition.queue.size) {
3744
+ const sources = Transition.sources;
3745
+ const disposed = Transition.disposed;
3746
+ Effects.push.apply(Effects, Transition.effects);
3747
+ res = Transition.resolve;
3748
+ for (const e2 of Effects) {
3749
+ "tState" in e2 && (e2.state = e2.tState);
3750
+ delete e2.tState;
3751
+ }
3752
+ Transition = null;
3753
+ runUpdates(() => {
3754
+ for (const d of disposed)
3755
+ cleanNode(d);
3756
+ for (const v of sources) {
3757
+ v.value = v.tValue;
3758
+ if (v.owned) {
3759
+ for (let i = 0, len = v.owned.length;i < len; i++)
3760
+ cleanNode(v.owned[i]);
3761
+ }
3762
+ if (v.tOwned)
3763
+ v.owned = v.tOwned;
3764
+ delete v.tValue;
3765
+ delete v.tOwned;
3766
+ v.tState = 0;
3767
+ }
3768
+ setTransPending(false);
3769
+ }, false);
3770
+ } else if (Transition.running) {
3771
+ Transition.running = false;
3772
+ Transition.effects.push.apply(Transition.effects, Effects);
3773
+ Effects = null;
3774
+ setTransPending(true);
3775
+ return;
3776
+ }
3777
+ }
3778
+ const e = Effects;
3779
+ Effects = null;
3780
+ if (e.length)
3781
+ runUpdates(() => runEffects(e), false);
3782
+ if (res)
3783
+ res();
3784
+ }
3785
+ function runQueue(queue) {
3786
+ for (let i = 0;i < queue.length; i++)
3787
+ runTop(queue[i]);
3788
+ }
3789
+ function scheduleQueue(queue) {
3790
+ for (let i = 0;i < queue.length; i++) {
3791
+ const item = queue[i];
3792
+ const tasks = Transition.queue;
3793
+ if (!tasks.has(item)) {
3794
+ tasks.add(item);
3795
+ Scheduler(() => {
3796
+ tasks.delete(item);
3797
+ runUpdates(() => {
3798
+ Transition.running = true;
3799
+ runTop(item);
3800
+ }, false);
3801
+ Transition && (Transition.running = false);
3802
+ });
3803
+ }
3804
+ }
3805
+ }
3806
+ function runUserEffects(queue) {
3807
+ let i, userLength = 0;
3808
+ for (i = 0;i < queue.length; i++) {
3809
+ const e = queue[i];
3810
+ if (!e.user)
3811
+ runTop(e);
3812
+ else
3813
+ queue[userLength++] = e;
3814
+ }
3815
+ if (sharedConfig.context) {
3816
+ if (sharedConfig.count) {
3817
+ sharedConfig.effects || (sharedConfig.effects = []);
3818
+ sharedConfig.effects.push(...queue.slice(0, userLength));
3819
+ return;
3820
+ }
3821
+ setHydrateContext();
3822
+ }
3823
+ if (sharedConfig.effects && (sharedConfig.done || !sharedConfig.count)) {
3824
+ queue = [...sharedConfig.effects, ...queue];
3825
+ userLength += sharedConfig.effects.length;
3826
+ delete sharedConfig.effects;
3827
+ }
3828
+ for (i = 0;i < userLength; i++)
3829
+ runTop(queue[i]);
3830
+ }
3831
+ function lookUpstream(node, ignore) {
3832
+ const runningTransition = Transition && Transition.running;
3833
+ if (runningTransition)
3834
+ node.tState = 0;
3835
+ else
3836
+ node.state = 0;
3837
+ for (let i = 0;i < node.sources.length; i += 1) {
3838
+ const source = node.sources[i];
3839
+ if (source.sources) {
3840
+ const state = runningTransition ? source.tState : source.state;
3841
+ if (state === STALE) {
3842
+ if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount))
3843
+ runTop(source);
3844
+ } else if (state === PENDING)
3845
+ lookUpstream(source, ignore);
3846
+ }
3847
+ }
3848
+ }
3849
+ function markDownstream(node) {
3850
+ const runningTransition = Transition && Transition.running;
3851
+ for (let i = 0;i < node.observers.length; i += 1) {
3852
+ const o = node.observers[i];
3853
+ if (runningTransition ? !o.tState : !o.state) {
3854
+ if (runningTransition)
3855
+ o.tState = PENDING;
3856
+ else
3857
+ o.state = PENDING;
3858
+ if (o.pure)
3859
+ Updates.push(o);
3860
+ else
3861
+ Effects.push(o);
3862
+ o.observers && markDownstream(o);
3863
+ }
3864
+ }
3865
+ }
3866
+ function cleanNode(node) {
3867
+ let i;
3868
+ if (node.sources) {
3869
+ while (node.sources.length) {
3870
+ const source = node.sources.pop(), index = node.sourceSlots.pop(), obs = source.observers;
3871
+ if (obs && obs.length) {
3872
+ const n = obs.pop(), s = source.observerSlots.pop();
3873
+ if (index < obs.length) {
3874
+ n.sourceSlots[s] = index;
3875
+ obs[index] = n;
3876
+ source.observerSlots[index] = s;
3877
+ }
3878
+ }
3879
+ }
3880
+ }
3881
+ if (node.tOwned) {
3882
+ for (i = node.tOwned.length - 1;i >= 0; i--)
3883
+ cleanNode(node.tOwned[i]);
3884
+ delete node.tOwned;
3885
+ }
3886
+ if (Transition && Transition.running && node.pure) {
3887
+ reset(node, true);
3888
+ } else if (node.owned) {
3889
+ for (i = node.owned.length - 1;i >= 0; i--)
3890
+ cleanNode(node.owned[i]);
3891
+ node.owned = null;
3892
+ }
3893
+ if (node.cleanups) {
3894
+ for (i = node.cleanups.length - 1;i >= 0; i--)
3895
+ node.cleanups[i]();
3896
+ node.cleanups = null;
3897
+ }
3898
+ if (Transition && Transition.running)
3899
+ node.tState = 0;
3900
+ else
3901
+ node.state = 0;
3902
+ }
3903
+ function reset(node, top) {
3904
+ if (!top) {
3905
+ node.tState = 0;
3906
+ Transition.disposed.add(node);
3907
+ }
3908
+ if (node.owned) {
3909
+ for (let i = 0;i < node.owned.length; i++)
3910
+ reset(node.owned[i]);
3911
+ }
3912
+ }
3913
+ function castError(err) {
3914
+ if (err instanceof Error)
3915
+ return err;
3916
+ return new Error(typeof err === "string" ? err : "Unknown error", {
3917
+ cause: err
3918
+ });
3919
+ }
3920
+ function runErrors(err, fns, owner) {
3921
+ try {
3922
+ for (const f of fns)
3923
+ f(err);
3924
+ } catch (e) {
3925
+ handleError(e, owner && owner.owner || null);
3926
+ }
3927
+ }
3928
+ function handleError(err, owner = Owner) {
3929
+ const fns = ERROR && owner && owner.context && owner.context[ERROR];
3930
+ const error = castError(err);
3931
+ if (!fns)
3932
+ throw error;
3933
+ if (Effects)
3934
+ Effects.push({
3935
+ fn() {
3936
+ runErrors(error, fns, owner);
3937
+ },
3938
+ state: STALE
3939
+ });
3940
+ else
3941
+ runErrors(error, fns, owner);
3942
+ }
3943
+ function resolveChildren(children2) {
3944
+ if (typeof children2 === "function" && !children2.length)
3945
+ return resolveChildren(children2());
3946
+ if (Array.isArray(children2)) {
3947
+ const results = [];
3948
+ for (let i = 0;i < children2.length; i++) {
3949
+ const result = resolveChildren(children2[i]);
3950
+ Array.isArray(result) ? results.push.apply(results, result) : results.push(result);
3951
+ }
3952
+ return results;
3953
+ }
3954
+ return children2;
3955
+ }
3956
+ function createProvider(id, options) {
3957
+ return function provider(props) {
3958
+ let res;
3959
+ createRenderEffect(() => res = untrack(() => {
3960
+ Owner.context = {
3961
+ ...Owner.context,
3962
+ [id]: props.value
3963
+ };
3964
+ return children(() => props.children);
3965
+ }), undefined);
3966
+ return res;
3967
+ };
3968
+ }
3969
+ var FALLBACK = Symbol("fallback");
3970
+ function dispose(d) {
3971
+ for (let i = 0;i < d.length; i++)
3972
+ d[i]();
3973
+ }
3974
+ function mapArray(list, mapFn, options = {}) {
3975
+ let items = [], mapped = [], disposers = [], len = 0, indexes = mapFn.length > 1 ? [] : null;
3976
+ onCleanup(() => dispose(disposers));
3977
+ return () => {
3978
+ let newItems = list() || [], newLen = newItems.length, i, j;
3979
+ newItems[$TRACK];
3980
+ return untrack(() => {
3981
+ let newIndices, newIndicesNext, temp, tempdisposers, tempIndexes, start, end, newEnd, item;
3982
+ if (newLen === 0) {
3983
+ if (len !== 0) {
3984
+ dispose(disposers);
3985
+ disposers = [];
3986
+ items = [];
3987
+ mapped = [];
3988
+ len = 0;
3989
+ indexes && (indexes = []);
3990
+ }
3991
+ if (options.fallback) {
3992
+ items = [FALLBACK];
3993
+ mapped[0] = createRoot((disposer) => {
3994
+ disposers[0] = disposer;
3995
+ return options.fallback();
3996
+ });
3997
+ len = 1;
3998
+ }
3999
+ } else if (len === 0) {
4000
+ mapped = new Array(newLen);
4001
+ for (j = 0;j < newLen; j++) {
4002
+ items[j] = newItems[j];
4003
+ mapped[j] = createRoot(mapper);
4004
+ }
4005
+ len = newLen;
4006
+ } else {
4007
+ temp = new Array(newLen);
4008
+ tempdisposers = new Array(newLen);
4009
+ indexes && (tempIndexes = new Array(newLen));
4010
+ for (start = 0, end = Math.min(len, newLen);start < end && items[start] === newItems[start]; start++)
4011
+ ;
4012
+ for (end = len - 1, newEnd = newLen - 1;end >= start && newEnd >= start && items[end] === newItems[newEnd]; end--, newEnd--) {
4013
+ temp[newEnd] = mapped[end];
4014
+ tempdisposers[newEnd] = disposers[end];
4015
+ indexes && (tempIndexes[newEnd] = indexes[end]);
4016
+ }
4017
+ newIndices = new Map;
4018
+ newIndicesNext = new Array(newEnd + 1);
4019
+ for (j = newEnd;j >= start; j--) {
4020
+ item = newItems[j];
4021
+ i = newIndices.get(item);
4022
+ newIndicesNext[j] = i === undefined ? -1 : i;
4023
+ newIndices.set(item, j);
4024
+ }
4025
+ for (i = start;i <= end; i++) {
4026
+ item = items[i];
4027
+ j = newIndices.get(item);
4028
+ if (j !== undefined && j !== -1) {
4029
+ temp[j] = mapped[i];
4030
+ tempdisposers[j] = disposers[i];
4031
+ indexes && (tempIndexes[j] = indexes[i]);
4032
+ j = newIndicesNext[j];
4033
+ newIndices.set(item, j);
4034
+ } else
4035
+ disposers[i]();
4036
+ }
4037
+ for (j = start;j < newLen; j++) {
4038
+ if (j in temp) {
4039
+ mapped[j] = temp[j];
4040
+ disposers[j] = tempdisposers[j];
4041
+ if (indexes) {
4042
+ indexes[j] = tempIndexes[j];
4043
+ indexes[j](j);
4044
+ }
4045
+ } else
4046
+ mapped[j] = createRoot(mapper);
4047
+ }
4048
+ mapped = mapped.slice(0, len = newLen);
4049
+ items = newItems.slice(0);
4050
+ }
4051
+ return mapped;
4052
+ });
4053
+ function mapper(disposer) {
4054
+ disposers[j] = disposer;
4055
+ if (indexes) {
4056
+ const [s, set] = createSignal(j);
4057
+ indexes[j] = set;
4058
+ return mapFn(newItems[j], s);
4059
+ }
4060
+ return mapFn(newItems[j]);
4061
+ }
4062
+ };
4063
+ }
4064
+ var hydrationEnabled = false;
4065
+ function createComponent(Comp, props) {
4066
+ if (hydrationEnabled) {
4067
+ if (sharedConfig.context) {
4068
+ const c = sharedConfig.context;
4069
+ setHydrateContext(nextHydrateContext());
4070
+ const r = untrack(() => Comp(props || {}));
4071
+ setHydrateContext(c);
4072
+ return r;
4073
+ }
4074
+ }
4075
+ return untrack(() => Comp(props || {}));
4076
+ }
4077
+ function trueFn() {
4078
+ return true;
4079
+ }
4080
+ var propTraps = {
4081
+ get(_, property, receiver) {
4082
+ if (property === $PROXY)
4083
+ return receiver;
4084
+ return _.get(property);
4085
+ },
4086
+ has(_, property) {
4087
+ if (property === $PROXY)
4088
+ return true;
4089
+ return _.has(property);
4090
+ },
4091
+ set: trueFn,
4092
+ deleteProperty: trueFn,
4093
+ getOwnPropertyDescriptor(_, property) {
4094
+ return {
4095
+ configurable: true,
4096
+ enumerable: true,
4097
+ get() {
4098
+ return _.get(property);
4099
+ },
4100
+ set: trueFn,
4101
+ deleteProperty: trueFn
4102
+ };
4103
+ },
4104
+ ownKeys(_) {
4105
+ return _.keys();
4106
+ }
4107
+ };
4108
+ function resolveSource(s) {
4109
+ return !(s = typeof s === "function" ? s() : s) ? {} : s;
4110
+ }
4111
+ function resolveSources() {
4112
+ for (let i = 0, length = this.length;i < length; ++i) {
4113
+ const v = this[i]();
4114
+ if (v !== undefined)
4115
+ return v;
4116
+ }
4117
+ }
4118
+ function mergeProps(...sources) {
4119
+ let proxy = false;
4120
+ for (let i = 0;i < sources.length; i++) {
4121
+ const s = sources[i];
4122
+ proxy = proxy || !!s && $PROXY in s;
4123
+ sources[i] = typeof s === "function" ? (proxy = true, createMemo(s)) : s;
4124
+ }
4125
+ if (SUPPORTS_PROXY && proxy) {
4126
+ return new Proxy({
4127
+ get(property) {
4128
+ for (let i = sources.length - 1;i >= 0; i--) {
4129
+ const v = resolveSource(sources[i])[property];
4130
+ if (v !== undefined)
4131
+ return v;
4132
+ }
4133
+ },
4134
+ has(property) {
4135
+ for (let i = sources.length - 1;i >= 0; i--) {
4136
+ if (property in resolveSource(sources[i]))
4137
+ return true;
4138
+ }
4139
+ return false;
4140
+ },
4141
+ keys() {
4142
+ const keys = [];
4143
+ for (let i = 0;i < sources.length; i++)
4144
+ keys.push(...Object.keys(resolveSource(sources[i])));
4145
+ return [...new Set(keys)];
4146
+ }
4147
+ }, propTraps);
4148
+ }
4149
+ const sourcesMap = {};
4150
+ const defined = Object.create(null);
4151
+ for (let i = sources.length - 1;i >= 0; i--) {
4152
+ const source = sources[i];
4153
+ if (!source)
4154
+ continue;
4155
+ const sourceKeys = Object.getOwnPropertyNames(source);
4156
+ for (let i2 = sourceKeys.length - 1;i2 >= 0; i2--) {
4157
+ const key = sourceKeys[i2];
4158
+ if (key === "__proto__" || key === "constructor")
4159
+ continue;
4160
+ const desc = Object.getOwnPropertyDescriptor(source, key);
4161
+ if (!defined[key]) {
4162
+ defined[key] = desc.get ? {
4163
+ enumerable: true,
4164
+ configurable: true,
4165
+ get: resolveSources.bind(sourcesMap[key] = [desc.get.bind(source)])
4166
+ } : desc.value !== undefined ? desc : undefined;
4167
+ } else {
4168
+ const sources2 = sourcesMap[key];
4169
+ if (sources2) {
4170
+ if (desc.get)
4171
+ sources2.push(desc.get.bind(source));
4172
+ else if (desc.value !== undefined)
4173
+ sources2.push(() => desc.value);
4174
+ }
4175
+ }
4176
+ }
4177
+ }
4178
+ const target = {};
4179
+ const definedKeys = Object.keys(defined);
4180
+ for (let i = definedKeys.length - 1;i >= 0; i--) {
4181
+ const key = definedKeys[i], desc = defined[key];
4182
+ if (desc && desc.get)
4183
+ Object.defineProperty(target, key, desc);
4184
+ else
4185
+ target[key] = desc ? desc.value : undefined;
4186
+ }
4187
+ return target;
4188
+ }
4189
+ var narrowedError = (name) => `Stale read from <${name}>.`;
4190
+ function For(props) {
4191
+ const fallback = "fallback" in props && {
4192
+ fallback: () => props.fallback
4193
+ };
4194
+ return createMemo(mapArray(() => props.each, props.children, fallback || undefined));
4195
+ }
4196
+ function Show(props) {
4197
+ const keyed = props.keyed;
4198
+ const conditionValue = createMemo(() => props.when, undefined, undefined);
4199
+ const condition = keyed ? conditionValue : createMemo(conditionValue, undefined, {
4200
+ equals: (a, b) => !a === !b
4201
+ });
4202
+ return createMemo(() => {
4203
+ const c = condition();
4204
+ if (c) {
4205
+ const child = props.children;
4206
+ const fn = typeof child === "function" && child.length > 0;
4207
+ return fn ? untrack(() => child(keyed ? c : () => {
4208
+ if (!untrack(condition))
4209
+ throw narrowedError("Show");
4210
+ return conditionValue();
4211
+ })) : child;
4212
+ }
4213
+ return props.fallback;
4214
+ }, undefined, undefined);
4215
+ }
4216
+
3291
4217
  // node_modules/@opentui/solid/node_modules/@opentui/core/index-mdxq0qtt.js
3292
4218
  import { EventEmitter } from "events";
3293
4219
  import { Buffer as Buffer2 } from "buffer";
@@ -8446,11 +9372,11 @@ function visualizeRenderableTree(renderable, maxDepth = 10) {
8446
9372
  return [`${prefix}${node.id} ... (max depth reached)`];
8447
9373
  }
8448
9374
  const lines = [];
8449
- const children = node.getChildren();
9375
+ const children2 = node.getChildren();
8450
9376
  lines.push(`${prefix}${node.id}`);
8451
- if (children.length > 0) {
8452
- const lastChildIndex = children.length - 1;
8453
- children.forEach((child, index) => {
9377
+ if (children2.length > 0) {
9378
+ const lastChildIndex = children2.length - 1;
9379
+ children2.forEach((child, index) => {
8454
9380
  const childIsLast = index === lastChildIndex;
8455
9381
  const connector = childIsLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
8456
9382
  const childPrefix = parentPrefix + (isLastChild ? " " : "\u2502 ");
@@ -18779,8 +19705,8 @@ class Renderable extends BaseRenderable {
18779
19705
  } catch (e) {}
18780
19706
  }
18781
19707
  destroyRecursively() {
18782
- const children = [...this._childrenInLayoutOrder];
18783
- for (const child of children) {
19708
+ const children2 = [...this._childrenInLayoutOrder];
19709
+ for (const child of children2) {
18784
19710
  child.destroyRecursively();
18785
19711
  }
18786
19712
  this.destroy();
@@ -18966,9 +19892,9 @@ var BrandedVNode = Symbol.for("@opentui/core/VNode");
18966
19892
  function isRenderableConstructor(value) {
18967
19893
  return typeof value === "function" && value.prototype && Renderable.prototype.isPrototypeOf(value.prototype);
18968
19894
  }
18969
- function flattenChildren(children) {
19895
+ function flattenChildren(children2) {
18970
19896
  const result = [];
18971
- for (const child of children) {
19897
+ for (const child of children2) {
18972
19898
  if (Array.isArray(child)) {
18973
19899
  result.push(...flattenChildren(child));
18974
19900
  } else if (child !== null && child !== undefined && child !== false) {
@@ -18977,7 +19903,7 @@ function flattenChildren(children) {
18977
19903
  }
18978
19904
  return result;
18979
19905
  }
18980
- function h(type, props, ...children) {
19906
+ function h(type, props, ...children2) {
18981
19907
  if (typeof type !== "function") {
18982
19908
  throw new TypeError("h() received an invalid vnode type");
18983
19909
  }
@@ -18985,7 +19911,7 @@ function h(type, props, ...children) {
18985
19911
  [BrandedVNode]: true,
18986
19912
  type,
18987
19913
  props,
18988
- children: flattenChildren(children),
19914
+ children: flattenChildren(children2),
18989
19915
  __pendingCalls: []
18990
19916
  };
18991
19917
  if (isRenderableConstructor(type)) {
@@ -19087,11 +20013,11 @@ function instantiate(ctx, node) {
19087
20013
  }
19088
20014
  const vnode = node;
19089
20015
  const { type, props } = vnode;
19090
- const children = flattenChildren(vnode.children || []);
20016
+ const children2 = flattenChildren(vnode.children || []);
19091
20017
  const delegateMap = vnode.__delegateMap;
19092
20018
  if (isRenderableConstructor(type)) {
19093
20019
  const instance = new type(ctx, props || {});
19094
- for (const child of children) {
20020
+ for (const child of children2) {
19095
20021
  if (isRenderable(child)) {
19096
20022
  instance.add(child);
19097
20023
  } else {
@@ -19112,7 +20038,7 @@ function instantiate(ctx, node) {
19112
20038
  }
19113
20039
  return delegatedInstance;
19114
20040
  }
19115
- const resolved = type(props || {}, children);
20041
+ const resolved = type(props || {}, children2);
19116
20042
  const inst = instantiate(ctx, resolved);
19117
20043
  return wrapWithDelegates(inst, delegateMap);
19118
20044
  }
@@ -20249,8 +21175,8 @@ function getObjectsInViewport(viewport, objects, direction = "column", padding =
20249
21175
  const viewportLeft = viewport.x - padding;
20250
21176
  const viewportRight = viewport.x + viewport.width + padding;
20251
21177
  const isRow = direction === "row";
20252
- const children = objects;
20253
- const totalChildren = children.length;
21178
+ const children2 = objects;
21179
+ const totalChildren = children2.length;
20254
21180
  if (totalChildren === 0)
20255
21181
  return [];
20256
21182
  const vpStart = isRow ? viewportLeft : viewportTop;
@@ -20260,7 +21186,7 @@ function getObjectsInViewport(viewport, objects, direction = "column", padding =
20260
21186
  let candidate = -1;
20261
21187
  while (lo <= hi) {
20262
21188
  const mid = lo + hi >> 1;
20263
- const c = children[mid];
21189
+ const c = children2[mid];
20264
21190
  const start = isRow ? c.x : c.y;
20265
21191
  const end = isRow ? c.x + c.width : c.y + c.height;
20266
21192
  if (end < vpStart) {
@@ -20280,7 +21206,7 @@ function getObjectsInViewport(viewport, objects, direction = "column", padding =
20280
21206
  let left = candidate;
20281
21207
  let gapCount = 0;
20282
21208
  while (left - 1 >= 0) {
20283
- const prev = children[left - 1];
21209
+ const prev = children2[left - 1];
20284
21210
  const prevEnd = isRow ? prev.x + prev.width : prev.y + prev.height;
20285
21211
  if (prevEnd <= vpStart) {
20286
21212
  gapCount++;
@@ -20294,13 +21220,13 @@ function getObjectsInViewport(viewport, objects, direction = "column", padding =
20294
21220
  }
20295
21221
  let right = candidate + 1;
20296
21222
  while (right < totalChildren) {
20297
- const next = children[right];
21223
+ const next = children2[right];
20298
21224
  if ((isRow ? next.x : next.y) >= vpEnd)
20299
21225
  break;
20300
21226
  right++;
20301
21227
  }
20302
21228
  for (let i = left;i < right; i++) {
20303
- const child = children[i];
21229
+ const child = children2[i];
20304
21230
  const start = isRow ? child.x : child.y;
20305
21231
  const end = isRow ? child.x + child.width : child.y + child.height;
20306
21232
  if (end <= vpStart)
@@ -22132,8 +23058,8 @@ Captured output:
22132
23058
  }
22133
23059
  }
22134
23060
  walkSelectableRenderables(container, selectionBounds, selectedRenderables, touchedRenderables) {
22135
- const children = getObjectsInViewport(selectionBounds, container.getChildrenSortedByPrimaryAxis(), container.primaryAxis, 0, 0);
22136
- for (const child of children) {
23061
+ const children2 = getObjectsInViewport(selectionBounds, container.getChildrenSortedByPrimaryAxis(), container.primaryAxis, 0, 0);
23062
+ for (const child of children2) {
22137
23063
  if (child.selectable) {
22138
23064
  const hasSelection = child.onSelectionChanged(this.currentSelection);
22139
23065
  if (hasSelection) {
@@ -26874,8 +27800,8 @@ class TextNodeRenderable extends BaseRenderable {
26874
27800
  get children() {
26875
27801
  return this._children;
26876
27802
  }
26877
- set children(children) {
26878
- this._children = children;
27803
+ set children(children2) {
27804
+ this._children = children2;
26879
27805
  this.requestRender();
26880
27806
  }
26881
27807
  requestRender() {
@@ -27088,66 +28014,66 @@ class RootTextNodeRenderable extends TextNodeRenderable {
27088
28014
  this.ctx.requestRender();
27089
28015
  }
27090
28016
  }
27091
- function Generic(props, ...children) {
27092
- return h(VRenderable, props || {}, ...children);
28017
+ function Generic(props, ...children2) {
28018
+ return h(VRenderable, props || {}, ...children2);
27093
28019
  }
27094
- function Box(props, ...children) {
27095
- return h(BoxRenderable, props || {}, ...children);
28020
+ function Box(props, ...children2) {
28021
+ return h(BoxRenderable, props || {}, ...children2);
27096
28022
  }
27097
- function Text(props, ...children) {
27098
- return h(TextRenderable, props || {}, ...children);
28023
+ function Text(props, ...children2) {
28024
+ return h(TextRenderable, props || {}, ...children2);
27099
28025
  }
27100
- function ASCIIFont(props, ...children) {
27101
- return h(ASCIIFontRenderable, props || {}, ...children);
28026
+ function ASCIIFont(props, ...children2) {
28027
+ return h(ASCIIFontRenderable, props || {}, ...children2);
27102
28028
  }
27103
- function Input(props, ...children) {
27104
- return h(InputRenderable, props || {}, ...children);
28029
+ function Input(props, ...children2) {
28030
+ return h(InputRenderable, props || {}, ...children2);
27105
28031
  }
27106
- function Select(props, ...children) {
27107
- return h(SelectRenderable, props || {}, ...children);
28032
+ function Select(props, ...children2) {
28033
+ return h(SelectRenderable, props || {}, ...children2);
27108
28034
  }
27109
- function TabSelect(props, ...children) {
27110
- return h(TabSelectRenderable, props || {}, ...children);
28035
+ function TabSelect(props, ...children2) {
28036
+ return h(TabSelectRenderable, props || {}, ...children2);
27111
28037
  }
27112
- function FrameBuffer(props, ...children) {
27113
- return h(FrameBufferRenderable, props, ...children);
28038
+ function FrameBuffer(props, ...children2) {
28039
+ return h(FrameBufferRenderable, props, ...children2);
27114
28040
  }
27115
- function Code(props, ...children) {
27116
- return h(CodeRenderable, props, ...children);
28041
+ function Code(props, ...children2) {
28042
+ return h(CodeRenderable, props, ...children2);
27117
28043
  }
27118
- function ScrollBox(props, ...children) {
27119
- return h(ScrollBoxRenderable, props || {}, ...children);
28044
+ function ScrollBox(props, ...children2) {
28045
+ return h(ScrollBoxRenderable, props || {}, ...children2);
27120
28046
  }
27121
- function StyledText2(props, ...children) {
28047
+ function StyledText2(props, ...children2) {
27122
28048
  const styledProps = props;
27123
28049
  const textNodeOptions = {
27124
28050
  ...styledProps,
27125
28051
  attributes: styledProps?.attributes ?? 0
27126
28052
  };
27127
28053
  const textNode = new TextNodeRenderable(textNodeOptions);
27128
- for (const child of children) {
28054
+ for (const child of children2) {
27129
28055
  textNode.add(child);
27130
28056
  }
27131
28057
  return textNode;
27132
28058
  }
27133
28059
  var vstyles = {
27134
- bold: (...children) => StyledText2({ attributes: TextAttributes.BOLD }, ...children),
27135
- italic: (...children) => StyledText2({ attributes: TextAttributes.ITALIC }, ...children),
27136
- underline: (...children) => StyledText2({ attributes: TextAttributes.UNDERLINE }, ...children),
27137
- dim: (...children) => StyledText2({ attributes: TextAttributes.DIM }, ...children),
27138
- blink: (...children) => StyledText2({ attributes: TextAttributes.BLINK }, ...children),
27139
- inverse: (...children) => StyledText2({ attributes: TextAttributes.INVERSE }, ...children),
27140
- hidden: (...children) => StyledText2({ attributes: TextAttributes.HIDDEN }, ...children),
27141
- strikethrough: (...children) => StyledText2({ attributes: TextAttributes.STRIKETHROUGH }, ...children),
27142
- boldItalic: (...children) => StyledText2({ attributes: TextAttributes.BOLD | TextAttributes.ITALIC }, ...children),
27143
- boldUnderline: (...children) => StyledText2({ attributes: TextAttributes.BOLD | TextAttributes.UNDERLINE }, ...children),
27144
- italicUnderline: (...children) => StyledText2({ attributes: TextAttributes.ITALIC | TextAttributes.UNDERLINE }, ...children),
27145
- boldItalicUnderline: (...children) => StyledText2({ attributes: TextAttributes.BOLD | TextAttributes.ITALIC | TextAttributes.UNDERLINE }, ...children),
27146
- color: (color, ...children) => StyledText2({ fg: color }, ...children),
27147
- bgColor: (bgColor, ...children) => StyledText2({ bg: bgColor }, ...children),
27148
- fg: (color, ...children) => StyledText2({ fg: color }, ...children),
27149
- bg: (bgColor, ...children) => StyledText2({ bg: bgColor }, ...children),
27150
- styled: (attributes = 0, ...children) => StyledText2({ attributes }, ...children)
28060
+ bold: (...children2) => StyledText2({ attributes: TextAttributes.BOLD }, ...children2),
28061
+ italic: (...children2) => StyledText2({ attributes: TextAttributes.ITALIC }, ...children2),
28062
+ underline: (...children2) => StyledText2({ attributes: TextAttributes.UNDERLINE }, ...children2),
28063
+ dim: (...children2) => StyledText2({ attributes: TextAttributes.DIM }, ...children2),
28064
+ blink: (...children2) => StyledText2({ attributes: TextAttributes.BLINK }, ...children2),
28065
+ inverse: (...children2) => StyledText2({ attributes: TextAttributes.INVERSE }, ...children2),
28066
+ hidden: (...children2) => StyledText2({ attributes: TextAttributes.HIDDEN }, ...children2),
28067
+ strikethrough: (...children2) => StyledText2({ attributes: TextAttributes.STRIKETHROUGH }, ...children2),
28068
+ boldItalic: (...children2) => StyledText2({ attributes: TextAttributes.BOLD | TextAttributes.ITALIC }, ...children2),
28069
+ boldUnderline: (...children2) => StyledText2({ attributes: TextAttributes.BOLD | TextAttributes.UNDERLINE }, ...children2),
28070
+ italicUnderline: (...children2) => StyledText2({ attributes: TextAttributes.ITALIC | TextAttributes.UNDERLINE }, ...children2),
28071
+ boldItalicUnderline: (...children2) => StyledText2({ attributes: TextAttributes.BOLD | TextAttributes.ITALIC | TextAttributes.UNDERLINE }, ...children2),
28072
+ color: (color, ...children2) => StyledText2({ fg: color }, ...children2),
28073
+ bgColor: (bgColor, ...children2) => StyledText2({ bg: bgColor }, ...children2),
28074
+ fg: (color, ...children2) => StyledText2({ fg: color }, ...children2),
28075
+ bg: (bgColor, ...children2) => StyledText2({ bg: bgColor }, ...children2),
28076
+ styled: (attributes = 0, ...children2) => StyledText2({ attributes }, ...children2)
27151
28077
  };
27152
28078
 
27153
28079
  class VRenderable extends Renderable {
@@ -34981,1288 +35907,362 @@ class TabSelectRenderable extends Renderable {
34981
35907
  this.frameBuffer.drawText(descContent, contentX + 1, descriptionY, descColor);
34982
35908
  }
34983
35909
  }
34984
- if (this._showScrollArrows && this._options.length > this.maxVisibleTabs) {
34985
- this.renderScrollArrowsToFrameBuffer(contentX, contentY, contentWidth, contentHeight);
34986
- }
34987
- }
34988
- truncateText(text, maxWidth) {
34989
- if (text.length <= maxWidth)
34990
- return text;
34991
- return text.substring(0, Math.max(0, maxWidth - 1)) + "\u2026";
34992
- }
34993
- renderScrollArrowsToFrameBuffer(contentX, contentY, contentWidth, contentHeight) {
34994
- if (!this.frameBuffer)
34995
- return;
34996
- const hasMoreLeft = this.scrollOffset > 0;
34997
- const hasMoreRight = this.scrollOffset + this.maxVisibleTabs < this._options.length;
34998
- if (hasMoreLeft) {
34999
- this.frameBuffer.drawText("\u2039", contentX, contentY, parseColor("#AAAAAA"));
35000
- }
35001
- if (hasMoreRight) {
35002
- this.frameBuffer.drawText("\u203A", contentX + contentWidth - 1, contentY, parseColor("#AAAAAA"));
35003
- }
35004
- }
35005
- setOptions(options) {
35006
- this._options = options;
35007
- this.selectedIndex = Math.min(this.selectedIndex, Math.max(0, options.length - 1));
35008
- this.updateScrollOffset();
35009
- this.requestRender();
35010
- }
35011
- getSelectedOption() {
35012
- return this._options[this.selectedIndex] || null;
35013
- }
35014
- getSelectedIndex() {
35015
- return this.selectedIndex;
35016
- }
35017
- moveLeft() {
35018
- if (this.selectedIndex > 0) {
35019
- this.selectedIndex--;
35020
- } else if (this._wrapSelection && this._options.length > 0) {
35021
- this.selectedIndex = this._options.length - 1;
35022
- } else {
35023
- return;
35024
- }
35025
- this.updateScrollOffset();
35026
- this.requestRender();
35027
- this.emit("selectionChanged", this.selectedIndex, this.getSelectedOption());
35028
- }
35029
- moveRight() {
35030
- if (this.selectedIndex < this._options.length - 1) {
35031
- this.selectedIndex++;
35032
- } else if (this._wrapSelection && this._options.length > 0) {
35033
- this.selectedIndex = 0;
35034
- } else {
35035
- return;
35036
- }
35037
- this.updateScrollOffset();
35038
- this.requestRender();
35039
- this.emit("selectionChanged", this.selectedIndex, this.getSelectedOption());
35040
- }
35041
- selectCurrent() {
35042
- const selected = this.getSelectedOption();
35043
- if (selected) {
35044
- this.emit("itemSelected", this.selectedIndex, selected);
35045
- }
35046
- }
35047
- setSelectedIndex(index) {
35048
- if (index >= 0 && index < this._options.length) {
35049
- this.selectedIndex = index;
35050
- this.updateScrollOffset();
35051
- this.requestRender();
35052
- this.emit("selectionChanged", this.selectedIndex, this.getSelectedOption());
35053
- }
35054
- }
35055
- updateScrollOffset() {
35056
- const halfVisible = Math.floor(this.maxVisibleTabs / 2);
35057
- const newScrollOffset = Math.max(0, Math.min(this.selectedIndex - halfVisible, this._options.length - this.maxVisibleTabs));
35058
- if (newScrollOffset !== this.scrollOffset) {
35059
- this.scrollOffset = newScrollOffset;
35060
- this.requestRender();
35061
- }
35062
- }
35063
- onResize(width, height) {
35064
- this.maxVisibleTabs = Math.max(1, Math.floor(width / this._tabWidth));
35065
- this.updateScrollOffset();
35066
- this.requestRender();
35067
- }
35068
- setTabWidth(tabWidth) {
35069
- if (this._tabWidth === tabWidth)
35070
- return;
35071
- this._tabWidth = tabWidth;
35072
- this.maxVisibleTabs = Math.max(1, Math.floor(this.width / this._tabWidth));
35073
- this.updateScrollOffset();
35074
- this.requestRender();
35075
- }
35076
- getTabWidth() {
35077
- return this._tabWidth;
35078
- }
35079
- handleKeyPress(key) {
35080
- const bindingKey = getKeyBindingKey({
35081
- name: key.name,
35082
- ctrl: key.ctrl,
35083
- shift: key.shift,
35084
- meta: key.meta,
35085
- super: key.super,
35086
- action: "move-left"
35087
- });
35088
- const action = this._keyBindingsMap.get(bindingKey);
35089
- if (action) {
35090
- switch (action) {
35091
- case "move-left":
35092
- this.moveLeft();
35093
- return true;
35094
- case "move-right":
35095
- this.moveRight();
35096
- return true;
35097
- case "select-current":
35098
- this.selectCurrent();
35099
- return true;
35100
- }
35101
- }
35102
- return false;
35103
- }
35104
- get options() {
35105
- return this._options;
35106
- }
35107
- set options(options) {
35108
- this._options = options;
35109
- this.selectedIndex = Math.min(this.selectedIndex, Math.max(0, options.length - 1));
35110
- this.updateScrollOffset();
35111
- this.requestRender();
35112
- }
35113
- set backgroundColor(color) {
35114
- this._backgroundColor = parseColor(color);
35115
- this.requestRender();
35116
- }
35117
- set textColor(color) {
35118
- this._textColor = parseColor(color);
35119
- this.requestRender();
35120
- }
35121
- set focusedBackgroundColor(color) {
35122
- this._focusedBackgroundColor = parseColor(color);
35123
- this.requestRender();
35124
- }
35125
- set focusedTextColor(color) {
35126
- this._focusedTextColor = parseColor(color);
35127
- this.requestRender();
35128
- }
35129
- set selectedBackgroundColor(color) {
35130
- this._selectedBackgroundColor = parseColor(color);
35131
- this.requestRender();
35132
- }
35133
- set selectedTextColor(color) {
35134
- this._selectedTextColor = parseColor(color);
35135
- this.requestRender();
35136
- }
35137
- set selectedDescriptionColor(color) {
35138
- this._selectedDescriptionColor = parseColor(color);
35139
- this.requestRender();
35140
- }
35141
- get showDescription() {
35142
- return this._showDescription;
35143
- }
35144
- set showDescription(show) {
35145
- if (this._showDescription !== show) {
35146
- this._showDescription = show;
35147
- const newHeight = this.calculateDynamicHeight();
35148
- this.height = newHeight;
35149
- this.requestRender();
35150
- }
35151
- }
35152
- get showUnderline() {
35153
- return this._showUnderline;
35154
- }
35155
- set showUnderline(show) {
35156
- if (this._showUnderline !== show) {
35157
- this._showUnderline = show;
35158
- const newHeight = this.calculateDynamicHeight();
35159
- this.height = newHeight;
35160
- this.requestRender();
35161
- }
35162
- }
35163
- get showScrollArrows() {
35164
- return this._showScrollArrows;
35165
- }
35166
- set showScrollArrows(show) {
35167
- if (this._showScrollArrows !== show) {
35168
- this._showScrollArrows = show;
35169
- this.requestRender();
35170
- }
35171
- }
35172
- get wrapSelection() {
35173
- return this._wrapSelection;
35174
- }
35175
- set wrapSelection(wrap) {
35176
- this._wrapSelection = wrap;
35177
- }
35178
- get tabWidth() {
35179
- return this._tabWidth;
35180
- }
35181
- set tabWidth(tabWidth) {
35182
- if (this._tabWidth === tabWidth)
35183
- return;
35184
- this._tabWidth = tabWidth;
35185
- this.maxVisibleTabs = Math.max(1, Math.floor(this.width / this._tabWidth));
35186
- this.updateScrollOffset();
35187
- this.requestRender();
35188
- }
35189
- set keyBindings(bindings) {
35190
- this._keyBindings = bindings;
35191
- const mergedBindings = mergeKeyBindings(defaultTabSelectKeybindings, bindings);
35192
- this._keyBindingsMap = buildKeyBindingsMap(mergedBindings, this._keyAliasMap);
35193
- }
35194
- set keyAliasMap(aliases) {
35195
- this._keyAliasMap = mergeKeyAliases(defaultKeyAliases, aliases);
35196
- const mergedBindings = mergeKeyBindings(defaultTabSelectKeybindings, this._keyBindings);
35197
- this._keyBindingsMap = buildKeyBindingsMap(mergedBindings, this._keyAliasMap);
35198
- }
35199
- }
35200
-
35201
- class TimeToFirstDrawRenderable extends Renderable {
35202
- _runtimeMs = null;
35203
- textColor;
35204
- label;
35205
- precision;
35206
- constructor(ctx, options = {}) {
35207
- super(ctx, {
35208
- width: "100%",
35209
- height: 1,
35210
- flexShrink: 0,
35211
- alignSelf: "center",
35212
- ...options
35213
- });
35214
- this.textColor = parseColor(options.fg ?? "#AAAAAA");
35215
- this.label = options.label ?? "Time to first draw";
35216
- this.precision = this.normalizePrecision(options.precision ?? 2);
35217
- }
35218
- get runtimeMs() {
35219
- return this._runtimeMs;
35220
- }
35221
- set fg(value) {
35222
- this.textColor = parseColor(value);
35223
- this.requestRender();
35224
- }
35225
- set color(value) {
35226
- this.fg = value;
35227
- }
35228
- set textLabel(value) {
35229
- if (value === this.label) {
35230
- return;
35231
- }
35232
- this.label = value;
35233
- this.requestRender();
35234
- }
35235
- set decimals(value) {
35236
- const nextPrecision = this.normalizePrecision(value);
35237
- if (nextPrecision === this.precision) {
35238
- return;
35239
- }
35240
- this.precision = nextPrecision;
35241
- this.requestRender();
35242
- }
35243
- reset() {
35244
- this._runtimeMs = null;
35245
- this.requestRender();
35246
- }
35247
- renderSelf(buffer) {
35248
- if (this._runtimeMs === null) {
35249
- this._runtimeMs = performance.now();
35250
- }
35251
- const content = `${this.label}: ${this._runtimeMs.toFixed(this.precision)}ms`;
35252
- const maxWidth = Math.max(this.width, 1);
35253
- const visibleContent = content.length > maxWidth ? content.slice(0, maxWidth) : content;
35254
- const centeredX = this.x + Math.max(0, Math.floor((maxWidth - visibleContent.length) / 2));
35255
- buffer.drawText(visibleContent, centeredX, this.y, this.textColor);
35256
- }
35257
- normalizePrecision(value) {
35258
- if (!Number.isFinite(value)) {
35259
- return 2;
35260
- }
35261
- return Math.max(0, Math.floor(value));
35262
- }
35263
- }
35264
-
35265
- // node_modules/@opentui/solid/node_modules/@opentui/core/testing.js
35266
- var decoder2 = new TextDecoder;
35267
- class TestRecorder {
35268
- renderer;
35269
- frames = [];
35270
- recording = false;
35271
- frameNumber = 0;
35272
- startTime = 0;
35273
- originalRenderNative;
35274
- decoder = new TextDecoder;
35275
- recordBuffers;
35276
- now;
35277
- constructor(renderer, options) {
35278
- this.renderer = renderer;
35279
- this.recordBuffers = options?.recordBuffers || {};
35280
- this.now = options?.now ?? (() => performance.now());
35281
- }
35282
- rec() {
35283
- if (this.recording) {
35284
- return;
35285
- }
35286
- this.recording = true;
35287
- this.frames = [];
35288
- this.frameNumber = 0;
35289
- this.startTime = this.now();
35290
- this.originalRenderNative = this.renderer["renderNative"].bind(this.renderer);
35291
- this.renderer["renderNative"] = () => {
35292
- this.originalRenderNative();
35293
- this.captureFrame();
35294
- };
35295
- }
35296
- stop() {
35297
- if (!this.recording) {
35298
- return;
35299
- }
35300
- this.recording = false;
35301
- if (this.originalRenderNative) {
35302
- this.renderer["renderNative"] = this.originalRenderNative;
35303
- this.originalRenderNative = undefined;
35304
- }
35305
- }
35306
- get recordedFrames() {
35307
- return [...this.frames];
35308
- }
35309
- clear() {
35310
- this.frames = [];
35311
- this.frameNumber = 0;
35312
- }
35313
- get isRecording() {
35314
- return this.recording;
35315
- }
35316
- captureFrame() {
35317
- const currentBuffer = this.renderer.currentRenderBuffer;
35318
- const frameBytes = currentBuffer.getRealCharBytes(true);
35319
- const frame = this.decoder.decode(frameBytes);
35320
- const recordedFrame = {
35321
- frame,
35322
- timestamp: this.now() - this.startTime,
35323
- frameNumber: this.frameNumber++
35324
- };
35325
- if (this.recordBuffers.fg || this.recordBuffers.bg || this.recordBuffers.attributes) {
35326
- const buffers = currentBuffer.buffers;
35327
- recordedFrame.buffers = {};
35328
- if (this.recordBuffers.fg) {
35329
- recordedFrame.buffers.fg = new Float32Array(buffers.fg);
35330
- }
35331
- if (this.recordBuffers.bg) {
35332
- recordedFrame.buffers.bg = new Float32Array(buffers.bg);
35333
- }
35334
- if (this.recordBuffers.attributes) {
35335
- recordedFrame.buffers.attributes = new Uint8Array(buffers.attributes);
35336
- }
35337
- }
35338
- this.frames.push(recordedFrame);
35339
- }
35340
- }
35341
-
35342
- // node_modules/solid-js/dist/server.js
35343
- var sharedConfig = {
35344
- context: undefined,
35345
- registry: undefined,
35346
- effects: undefined,
35347
- done: false,
35348
- getContextId() {
35349
- return getContextId(this.context.count);
35350
- },
35351
- getNextContextId() {
35352
- return getContextId(this.context.count++);
35353
- }
35354
- };
35355
- function getContextId(count) {
35356
- const num = String(count), len = num.length - 1;
35357
- return sharedConfig.context.id + (len ? String.fromCharCode(96 + len) : "") + num;
35358
- }
35359
- function setHydrateContext(context) {
35360
- sharedConfig.context = context;
35361
- }
35362
- function nextHydrateContext() {
35363
- return {
35364
- ...sharedConfig.context,
35365
- id: sharedConfig.getNextContextId(),
35366
- count: 0
35367
- };
35368
- }
35369
- var IS_DEV = false;
35370
- var equalFn = (a, b2) => a === b2;
35371
- var $PROXY = Symbol("solid-proxy");
35372
- var SUPPORTS_PROXY = typeof Proxy === "function";
35373
- var $TRACK = Symbol("solid-track");
35374
- var $DEVCOMP = Symbol("solid-dev-component");
35375
- var signalOptions = {
35376
- equals: equalFn
35377
- };
35378
- var ERROR = null;
35379
- var runEffects = runQueue;
35380
- var STALE = 1;
35381
- var PENDING = 2;
35382
- var UNOWNED = {
35383
- owned: null,
35384
- cleanups: null,
35385
- context: null,
35386
- owner: null
35387
- };
35388
- var Owner = null;
35389
- var Transition = null;
35390
- var Scheduler = null;
35391
- var ExternalSourceConfig = null;
35392
- var Listener = null;
35393
- var Updates = null;
35394
- var Effects = null;
35395
- var ExecCount = 0;
35396
- function createRoot(fn, detachedOwner) {
35397
- const listener = Listener, owner = Owner, unowned = fn.length === 0, current = detachedOwner === undefined ? owner : detachedOwner, root = unowned ? UNOWNED : {
35398
- owned: null,
35399
- cleanups: null,
35400
- context: current ? current.context : null,
35401
- owner: current
35402
- }, updateFn = unowned ? fn : () => fn(() => untrack(() => cleanNode(root)));
35403
- Owner = root;
35404
- Listener = null;
35405
- try {
35406
- return runUpdates(updateFn, true);
35407
- } finally {
35408
- Listener = listener;
35409
- Owner = owner;
35410
- }
35411
- }
35412
- function createSignal(value, options) {
35413
- options = options ? Object.assign({}, signalOptions, options) : signalOptions;
35414
- const s = {
35415
- value,
35416
- observers: null,
35417
- observerSlots: null,
35418
- comparator: options.equals || undefined
35419
- };
35420
- const setter = (value2) => {
35421
- if (typeof value2 === "function") {
35422
- if (Transition && Transition.running && Transition.sources.has(s))
35423
- value2 = value2(s.tValue);
35424
- else
35425
- value2 = value2(s.value);
35426
- }
35427
- return writeSignal(s, value2);
35428
- };
35429
- return [readSignal.bind(s), setter];
35430
- }
35431
- function createRenderEffect(fn, value, options) {
35432
- const c = createComputation(fn, value, false, STALE);
35433
- if (Scheduler && Transition && Transition.running)
35434
- Updates.push(c);
35435
- else
35436
- updateComputation(c);
35437
- }
35438
- function createEffect(fn, value, options) {
35439
- runEffects = runUserEffects;
35440
- const c = createComputation(fn, value, false, STALE), s = SuspenseContext && useContext(SuspenseContext);
35441
- if (s)
35442
- c.suspense = s;
35443
- if (!options || !options.render)
35444
- c.user = true;
35445
- Effects ? Effects.push(c) : updateComputation(c);
35446
- }
35447
- function createMemo(fn, value, options) {
35448
- options = options ? Object.assign({}, signalOptions, options) : signalOptions;
35449
- const c = createComputation(fn, value, true, 0);
35450
- c.observers = null;
35451
- c.observerSlots = null;
35452
- c.comparator = options.equals || undefined;
35453
- if (Scheduler && Transition && Transition.running) {
35454
- c.tState = STALE;
35455
- Updates.push(c);
35456
- } else
35457
- updateComputation(c);
35458
- return readSignal.bind(c);
35459
- }
35460
- function untrack(fn) {
35461
- if (!ExternalSourceConfig && Listener === null)
35462
- return fn();
35463
- const listener = Listener;
35464
- Listener = null;
35465
- try {
35466
- if (ExternalSourceConfig)
35467
- return ExternalSourceConfig.untrack(fn);
35468
- return fn();
35469
- } finally {
35470
- Listener = listener;
35910
+ if (this._showScrollArrows && this._options.length > this.maxVisibleTabs) {
35911
+ this.renderScrollArrowsToFrameBuffer(contentX, contentY, contentWidth, contentHeight);
35912
+ }
35471
35913
  }
35472
- }
35473
- function onMount(fn) {
35474
- createEffect(() => untrack(fn));
35475
- }
35476
- function onCleanup(fn) {
35477
- if (Owner === null)
35478
- ;
35479
- else if (Owner.cleanups === null)
35480
- Owner.cleanups = [fn];
35481
- else
35482
- Owner.cleanups.push(fn);
35483
- return fn;
35484
- }
35485
- function startTransition(fn) {
35486
- if (Transition && Transition.running) {
35487
- fn();
35488
- return Transition.done;
35914
+ truncateText(text, maxWidth) {
35915
+ if (text.length <= maxWidth)
35916
+ return text;
35917
+ return text.substring(0, Math.max(0, maxWidth - 1)) + "\u2026";
35489
35918
  }
35490
- const l = Listener;
35491
- const o = Owner;
35492
- return Promise.resolve().then(() => {
35493
- Listener = l;
35494
- Owner = o;
35495
- let t2;
35496
- if (Scheduler || SuspenseContext) {
35497
- t2 = Transition || (Transition = {
35498
- sources: new Set,
35499
- effects: [],
35500
- promises: new Set,
35501
- disposed: new Set,
35502
- queue: new Set,
35503
- running: true
35504
- });
35505
- t2.done || (t2.done = new Promise((res) => t2.resolve = res));
35506
- t2.running = true;
35919
+ renderScrollArrowsToFrameBuffer(contentX, contentY, contentWidth, contentHeight) {
35920
+ if (!this.frameBuffer)
35921
+ return;
35922
+ const hasMoreLeft = this.scrollOffset > 0;
35923
+ const hasMoreRight = this.scrollOffset + this.maxVisibleTabs < this._options.length;
35924
+ if (hasMoreLeft) {
35925
+ this.frameBuffer.drawText("\u2039", contentX, contentY, parseColor("#AAAAAA"));
35507
35926
  }
35508
- runUpdates(fn, false);
35509
- Listener = Owner = null;
35510
- return t2 ? t2.done : undefined;
35511
- });
35512
- }
35513
- var [transPending, setTransPending] = /* @__PURE__ */ createSignal(false);
35514
- function createContext(defaultValue, options) {
35515
- const id = Symbol("context");
35516
- return {
35517
- id,
35518
- Provider: createProvider(id),
35519
- defaultValue
35520
- };
35521
- }
35522
- function useContext(context) {
35523
- let value;
35524
- return Owner && Owner.context && (value = Owner.context[context.id]) !== undefined ? value : context.defaultValue;
35525
- }
35526
- function children(fn) {
35527
- const children2 = createMemo(fn);
35528
- const memo = createMemo(() => resolveChildren(children2()));
35529
- memo.toArray = () => {
35530
- const c = memo();
35531
- return Array.isArray(c) ? c : c != null ? [c] : [];
35532
- };
35533
- return memo;
35534
- }
35535
- var SuspenseContext;
35536
- function readSignal() {
35537
- const runningTransition = Transition && Transition.running;
35538
- if (this.sources && (runningTransition ? this.tState : this.state)) {
35539
- if ((runningTransition ? this.tState : this.state) === STALE)
35540
- updateComputation(this);
35541
- else {
35542
- const updates = Updates;
35543
- Updates = null;
35544
- runUpdates(() => lookUpstream(this), false);
35545
- Updates = updates;
35927
+ if (hasMoreRight) {
35928
+ this.frameBuffer.drawText("\u203A", contentX + contentWidth - 1, contentY, parseColor("#AAAAAA"));
35546
35929
  }
35547
35930
  }
35548
- if (Listener) {
35549
- const sSlot = this.observers ? this.observers.length : 0;
35550
- if (!Listener.sources) {
35551
- Listener.sources = [this];
35552
- Listener.sourceSlots = [sSlot];
35931
+ setOptions(options) {
35932
+ this._options = options;
35933
+ this.selectedIndex = Math.min(this.selectedIndex, Math.max(0, options.length - 1));
35934
+ this.updateScrollOffset();
35935
+ this.requestRender();
35936
+ }
35937
+ getSelectedOption() {
35938
+ return this._options[this.selectedIndex] || null;
35939
+ }
35940
+ getSelectedIndex() {
35941
+ return this.selectedIndex;
35942
+ }
35943
+ moveLeft() {
35944
+ if (this.selectedIndex > 0) {
35945
+ this.selectedIndex--;
35946
+ } else if (this._wrapSelection && this._options.length > 0) {
35947
+ this.selectedIndex = this._options.length - 1;
35553
35948
  } else {
35554
- Listener.sources.push(this);
35555
- Listener.sourceSlots.push(sSlot);
35949
+ return;
35556
35950
  }
35557
- if (!this.observers) {
35558
- this.observers = [Listener];
35559
- this.observerSlots = [Listener.sources.length - 1];
35951
+ this.updateScrollOffset();
35952
+ this.requestRender();
35953
+ this.emit("selectionChanged", this.selectedIndex, this.getSelectedOption());
35954
+ }
35955
+ moveRight() {
35956
+ if (this.selectedIndex < this._options.length - 1) {
35957
+ this.selectedIndex++;
35958
+ } else if (this._wrapSelection && this._options.length > 0) {
35959
+ this.selectedIndex = 0;
35560
35960
  } else {
35561
- this.observers.push(Listener);
35562
- this.observerSlots.push(Listener.sources.length - 1);
35961
+ return;
35563
35962
  }
35963
+ this.updateScrollOffset();
35964
+ this.requestRender();
35965
+ this.emit("selectionChanged", this.selectedIndex, this.getSelectedOption());
35564
35966
  }
35565
- if (runningTransition && Transition.sources.has(this))
35566
- return this.tValue;
35567
- return this.value;
35568
- }
35569
- function writeSignal(node, value, isComp) {
35570
- let current = Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
35571
- if (!node.comparator || !node.comparator(current, value)) {
35572
- if (Transition) {
35573
- const TransitionRunning = Transition.running;
35574
- if (TransitionRunning || !isComp && Transition.sources.has(node)) {
35575
- Transition.sources.add(node);
35576
- node.tValue = value;
35577
- }
35578
- if (!TransitionRunning)
35579
- node.value = value;
35580
- } else
35581
- node.value = value;
35582
- if (node.observers && node.observers.length) {
35583
- runUpdates(() => {
35584
- for (let i = 0;i < node.observers.length; i += 1) {
35585
- const o = node.observers[i];
35586
- const TransitionRunning = Transition && Transition.running;
35587
- if (TransitionRunning && Transition.disposed.has(o))
35588
- continue;
35589
- if (TransitionRunning ? !o.tState : !o.state) {
35590
- if (o.pure)
35591
- Updates.push(o);
35592
- else
35593
- Effects.push(o);
35594
- if (o.observers)
35595
- markDownstream(o);
35596
- }
35597
- if (!TransitionRunning)
35598
- o.state = STALE;
35599
- else
35600
- o.tState = STALE;
35601
- }
35602
- if (Updates.length > 1e6) {
35603
- Updates = [];
35604
- if (IS_DEV)
35605
- ;
35606
- throw new Error;
35607
- }
35608
- }, false);
35967
+ selectCurrent() {
35968
+ const selected = this.getSelectedOption();
35969
+ if (selected) {
35970
+ this.emit("itemSelected", this.selectedIndex, selected);
35609
35971
  }
35610
35972
  }
35611
- return value;
35612
- }
35613
- function updateComputation(node) {
35614
- if (!node.fn)
35615
- return;
35616
- cleanNode(node);
35617
- const time = ExecCount;
35618
- runComputation(node, Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value, time);
35619
- if (Transition && !Transition.running && Transition.sources.has(node)) {
35620
- queueMicrotask(() => {
35621
- runUpdates(() => {
35622
- Transition && (Transition.running = true);
35623
- Listener = Owner = node;
35624
- runComputation(node, node.tValue, time);
35625
- Listener = Owner = null;
35626
- }, false);
35627
- });
35973
+ setSelectedIndex(index) {
35974
+ if (index >= 0 && index < this._options.length) {
35975
+ this.selectedIndex = index;
35976
+ this.updateScrollOffset();
35977
+ this.requestRender();
35978
+ this.emit("selectionChanged", this.selectedIndex, this.getSelectedOption());
35979
+ }
35628
35980
  }
35629
- }
35630
- function runComputation(node, value, time) {
35631
- let nextValue;
35632
- const owner = Owner, listener = Listener;
35633
- Listener = Owner = node;
35634
- try {
35635
- nextValue = node.fn(value);
35636
- } catch (err) {
35637
- if (node.pure) {
35638
- if (Transition && Transition.running) {
35639
- node.tState = STALE;
35640
- node.tOwned && node.tOwned.forEach(cleanNode);
35641
- node.tOwned = undefined;
35642
- } else {
35643
- node.state = STALE;
35644
- node.owned && node.owned.forEach(cleanNode);
35645
- node.owned = null;
35646
- }
35981
+ updateScrollOffset() {
35982
+ const halfVisible = Math.floor(this.maxVisibleTabs / 2);
35983
+ const newScrollOffset = Math.max(0, Math.min(this.selectedIndex - halfVisible, this._options.length - this.maxVisibleTabs));
35984
+ if (newScrollOffset !== this.scrollOffset) {
35985
+ this.scrollOffset = newScrollOffset;
35986
+ this.requestRender();
35647
35987
  }
35648
- node.updatedAt = time + 1;
35649
- return handleError(err);
35650
- } finally {
35651
- Listener = listener;
35652
- Owner = owner;
35653
35988
  }
35654
- if (!node.updatedAt || node.updatedAt <= time) {
35655
- if (node.updatedAt != null && "observers" in node) {
35656
- writeSignal(node, nextValue, true);
35657
- } else if (Transition && Transition.running && node.pure) {
35658
- if (!Transition.sources.has(node))
35659
- node.value = nextValue;
35660
- Transition.sources.add(node);
35661
- node.tValue = nextValue;
35662
- } else
35663
- node.value = nextValue;
35664
- node.updatedAt = time;
35989
+ onResize(width, height) {
35990
+ this.maxVisibleTabs = Math.max(1, Math.floor(width / this._tabWidth));
35991
+ this.updateScrollOffset();
35992
+ this.requestRender();
35665
35993
  }
35666
- }
35667
- function createComputation(fn, init, pure, state = STALE, options) {
35668
- const c = {
35669
- fn,
35670
- state,
35671
- updatedAt: null,
35672
- owned: null,
35673
- sources: null,
35674
- sourceSlots: null,
35675
- cleanups: null,
35676
- value: init,
35677
- owner: Owner,
35678
- context: Owner ? Owner.context : null,
35679
- pure
35680
- };
35681
- if (Transition && Transition.running) {
35682
- c.state = 0;
35683
- c.tState = state;
35994
+ setTabWidth(tabWidth) {
35995
+ if (this._tabWidth === tabWidth)
35996
+ return;
35997
+ this._tabWidth = tabWidth;
35998
+ this.maxVisibleTabs = Math.max(1, Math.floor(this.width / this._tabWidth));
35999
+ this.updateScrollOffset();
36000
+ this.requestRender();
35684
36001
  }
35685
- if (Owner === null)
35686
- ;
35687
- else if (Owner !== UNOWNED) {
35688
- if (Transition && Transition.running && Owner.pure) {
35689
- if (!Owner.tOwned)
35690
- Owner.tOwned = [c];
35691
- else
35692
- Owner.tOwned.push(c);
35693
- } else {
35694
- if (!Owner.owned)
35695
- Owner.owned = [c];
35696
- else
35697
- Owner.owned.push(c);
35698
- }
36002
+ getTabWidth() {
36003
+ return this._tabWidth;
35699
36004
  }
35700
- if (ExternalSourceConfig && c.fn) {
35701
- const sourceFn = c.fn;
35702
- const [track, trigger] = createSignal(undefined, {
35703
- equals: false
35704
- });
35705
- const ordinary = ExternalSourceConfig.factory(sourceFn, trigger);
35706
- onCleanup(() => ordinary.dispose());
35707
- let inTransition;
35708
- const triggerInTransition = () => startTransition(trigger).then(() => {
35709
- if (inTransition) {
35710
- inTransition.dispose();
35711
- inTransition = undefined;
35712
- }
36005
+ handleKeyPress(key) {
36006
+ const bindingKey = getKeyBindingKey({
36007
+ name: key.name,
36008
+ ctrl: key.ctrl,
36009
+ shift: key.shift,
36010
+ meta: key.meta,
36011
+ super: key.super,
36012
+ action: "move-left"
35713
36013
  });
35714
- c.fn = (x2) => {
35715
- track();
35716
- if (Transition && Transition.running) {
35717
- if (!inTransition)
35718
- inTransition = ExternalSourceConfig.factory(sourceFn, triggerInTransition);
35719
- return inTransition.track(x2);
36014
+ const action = this._keyBindingsMap.get(bindingKey);
36015
+ if (action) {
36016
+ switch (action) {
36017
+ case "move-left":
36018
+ this.moveLeft();
36019
+ return true;
36020
+ case "move-right":
36021
+ this.moveRight();
36022
+ return true;
36023
+ case "select-current":
36024
+ this.selectCurrent();
36025
+ return true;
35720
36026
  }
35721
- return ordinary.track(x2);
35722
- };
36027
+ }
36028
+ return false;
35723
36029
  }
35724
- return c;
35725
- }
35726
- function runTop(node) {
35727
- const runningTransition = Transition && Transition.running;
35728
- if ((runningTransition ? node.tState : node.state) === 0)
35729
- return;
35730
- if ((runningTransition ? node.tState : node.state) === PENDING)
35731
- return lookUpstream(node);
35732
- if (node.suspense && untrack(node.suspense.inFallback))
35733
- return node.suspense.effects.push(node);
35734
- const ancestors = [node];
35735
- while ((node = node.owner) && (!node.updatedAt || node.updatedAt < ExecCount)) {
35736
- if (runningTransition && Transition.disposed.has(node))
35737
- return;
35738
- if (runningTransition ? node.tState : node.state)
35739
- ancestors.push(node);
36030
+ get options() {
36031
+ return this._options;
35740
36032
  }
35741
- for (let i = ancestors.length - 1;i >= 0; i--) {
35742
- node = ancestors[i];
35743
- if (runningTransition) {
35744
- let top = node, prev = ancestors[i + 1];
35745
- while ((top = top.owner) && top !== prev) {
35746
- if (Transition.disposed.has(top))
35747
- return;
35748
- }
35749
- }
35750
- if ((runningTransition ? node.tState : node.state) === STALE) {
35751
- updateComputation(node);
35752
- } else if ((runningTransition ? node.tState : node.state) === PENDING) {
35753
- const updates = Updates;
35754
- Updates = null;
35755
- runUpdates(() => lookUpstream(node, ancestors[0]), false);
35756
- Updates = updates;
35757
- }
36033
+ set options(options) {
36034
+ this._options = options;
36035
+ this.selectedIndex = Math.min(this.selectedIndex, Math.max(0, options.length - 1));
36036
+ this.updateScrollOffset();
36037
+ this.requestRender();
35758
36038
  }
35759
- }
35760
- function runUpdates(fn, init) {
35761
- if (Updates)
35762
- return fn();
35763
- let wait = false;
35764
- if (!init)
35765
- Updates = [];
35766
- if (Effects)
35767
- wait = true;
35768
- else
35769
- Effects = [];
35770
- ExecCount++;
35771
- try {
35772
- const res = fn();
35773
- completeUpdates(wait);
35774
- return res;
35775
- } catch (err) {
35776
- if (!wait)
35777
- Effects = null;
35778
- Updates = null;
35779
- handleError(err);
36039
+ set backgroundColor(color) {
36040
+ this._backgroundColor = parseColor(color);
36041
+ this.requestRender();
35780
36042
  }
35781
- }
35782
- function completeUpdates(wait) {
35783
- if (Updates) {
35784
- if (Scheduler && Transition && Transition.running)
35785
- scheduleQueue(Updates);
35786
- else
35787
- runQueue(Updates);
35788
- Updates = null;
36043
+ set textColor(color) {
36044
+ this._textColor = parseColor(color);
36045
+ this.requestRender();
35789
36046
  }
35790
- if (wait)
35791
- return;
35792
- let res;
35793
- if (Transition) {
35794
- if (!Transition.promises.size && !Transition.queue.size) {
35795
- const sources = Transition.sources;
35796
- const disposed = Transition.disposed;
35797
- Effects.push.apply(Effects, Transition.effects);
35798
- res = Transition.resolve;
35799
- for (const e2 of Effects) {
35800
- "tState" in e2 && (e2.state = e2.tState);
35801
- delete e2.tState;
35802
- }
35803
- Transition = null;
35804
- runUpdates(() => {
35805
- for (const d2 of disposed)
35806
- cleanNode(d2);
35807
- for (const v2 of sources) {
35808
- v2.value = v2.tValue;
35809
- if (v2.owned) {
35810
- for (let i = 0, len = v2.owned.length;i < len; i++)
35811
- cleanNode(v2.owned[i]);
35812
- }
35813
- if (v2.tOwned)
35814
- v2.owned = v2.tOwned;
35815
- delete v2.tValue;
35816
- delete v2.tOwned;
35817
- v2.tState = 0;
35818
- }
35819
- setTransPending(false);
35820
- }, false);
35821
- } else if (Transition.running) {
35822
- Transition.running = false;
35823
- Transition.effects.push.apply(Transition.effects, Effects);
35824
- Effects = null;
35825
- setTransPending(true);
35826
- return;
35827
- }
36047
+ set focusedBackgroundColor(color) {
36048
+ this._focusedBackgroundColor = parseColor(color);
36049
+ this.requestRender();
35828
36050
  }
35829
- const e = Effects;
35830
- Effects = null;
35831
- if (e.length)
35832
- runUpdates(() => runEffects(e), false);
35833
- if (res)
35834
- res();
35835
- }
35836
- function runQueue(queue) {
35837
- for (let i = 0;i < queue.length; i++)
35838
- runTop(queue[i]);
35839
- }
35840
- function scheduleQueue(queue) {
35841
- for (let i = 0;i < queue.length; i++) {
35842
- const item = queue[i];
35843
- const tasks = Transition.queue;
35844
- if (!tasks.has(item)) {
35845
- tasks.add(item);
35846
- Scheduler(() => {
35847
- tasks.delete(item);
35848
- runUpdates(() => {
35849
- Transition.running = true;
35850
- runTop(item);
35851
- }, false);
35852
- Transition && (Transition.running = false);
35853
- });
35854
- }
36051
+ set focusedTextColor(color) {
36052
+ this._focusedTextColor = parseColor(color);
36053
+ this.requestRender();
36054
+ }
36055
+ set selectedBackgroundColor(color) {
36056
+ this._selectedBackgroundColor = parseColor(color);
36057
+ this.requestRender();
36058
+ }
36059
+ set selectedTextColor(color) {
36060
+ this._selectedTextColor = parseColor(color);
36061
+ this.requestRender();
36062
+ }
36063
+ set selectedDescriptionColor(color) {
36064
+ this._selectedDescriptionColor = parseColor(color);
36065
+ this.requestRender();
35855
36066
  }
35856
- }
35857
- function runUserEffects(queue) {
35858
- let i, userLength = 0;
35859
- for (i = 0;i < queue.length; i++) {
35860
- const e = queue[i];
35861
- if (!e.user)
35862
- runTop(e);
35863
- else
35864
- queue[userLength++] = e;
36067
+ get showDescription() {
36068
+ return this._showDescription;
35865
36069
  }
35866
- if (sharedConfig.context) {
35867
- if (sharedConfig.count) {
35868
- sharedConfig.effects || (sharedConfig.effects = []);
35869
- sharedConfig.effects.push(...queue.slice(0, userLength));
35870
- return;
36070
+ set showDescription(show) {
36071
+ if (this._showDescription !== show) {
36072
+ this._showDescription = show;
36073
+ const newHeight = this.calculateDynamicHeight();
36074
+ this.height = newHeight;
36075
+ this.requestRender();
35871
36076
  }
35872
- setHydrateContext();
35873
36077
  }
35874
- if (sharedConfig.effects && (sharedConfig.done || !sharedConfig.count)) {
35875
- queue = [...sharedConfig.effects, ...queue];
35876
- userLength += sharedConfig.effects.length;
35877
- delete sharedConfig.effects;
36078
+ get showUnderline() {
36079
+ return this._showUnderline;
35878
36080
  }
35879
- for (i = 0;i < userLength; i++)
35880
- runTop(queue[i]);
35881
- }
35882
- function lookUpstream(node, ignore) {
35883
- const runningTransition = Transition && Transition.running;
35884
- if (runningTransition)
35885
- node.tState = 0;
35886
- else
35887
- node.state = 0;
35888
- for (let i = 0;i < node.sources.length; i += 1) {
35889
- const source = node.sources[i];
35890
- if (source.sources) {
35891
- const state = runningTransition ? source.tState : source.state;
35892
- if (state === STALE) {
35893
- if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount))
35894
- runTop(source);
35895
- } else if (state === PENDING)
35896
- lookUpstream(source, ignore);
36081
+ set showUnderline(show) {
36082
+ if (this._showUnderline !== show) {
36083
+ this._showUnderline = show;
36084
+ const newHeight = this.calculateDynamicHeight();
36085
+ this.height = newHeight;
36086
+ this.requestRender();
35897
36087
  }
35898
36088
  }
35899
- }
35900
- function markDownstream(node) {
35901
- const runningTransition = Transition && Transition.running;
35902
- for (let i = 0;i < node.observers.length; i += 1) {
35903
- const o = node.observers[i];
35904
- if (runningTransition ? !o.tState : !o.state) {
35905
- if (runningTransition)
35906
- o.tState = PENDING;
35907
- else
35908
- o.state = PENDING;
35909
- if (o.pure)
35910
- Updates.push(o);
35911
- else
35912
- Effects.push(o);
35913
- o.observers && markDownstream(o);
35914
- }
36089
+ get showScrollArrows() {
36090
+ return this._showScrollArrows;
35915
36091
  }
35916
- }
35917
- function cleanNode(node) {
35918
- let i;
35919
- if (node.sources) {
35920
- while (node.sources.length) {
35921
- const source = node.sources.pop(), index = node.sourceSlots.pop(), obs = source.observers;
35922
- if (obs && obs.length) {
35923
- const n = obs.pop(), s = source.observerSlots.pop();
35924
- if (index < obs.length) {
35925
- n.sourceSlots[s] = index;
35926
- obs[index] = n;
35927
- source.observerSlots[index] = s;
35928
- }
35929
- }
36092
+ set showScrollArrows(show) {
36093
+ if (this._showScrollArrows !== show) {
36094
+ this._showScrollArrows = show;
36095
+ this.requestRender();
35930
36096
  }
35931
36097
  }
35932
- if (node.tOwned) {
35933
- for (i = node.tOwned.length - 1;i >= 0; i--)
35934
- cleanNode(node.tOwned[i]);
35935
- delete node.tOwned;
36098
+ get wrapSelection() {
36099
+ return this._wrapSelection;
35936
36100
  }
35937
- if (Transition && Transition.running && node.pure) {
35938
- reset(node, true);
35939
- } else if (node.owned) {
35940
- for (i = node.owned.length - 1;i >= 0; i--)
35941
- cleanNode(node.owned[i]);
35942
- node.owned = null;
36101
+ set wrapSelection(wrap) {
36102
+ this._wrapSelection = wrap;
35943
36103
  }
35944
- if (node.cleanups) {
35945
- for (i = node.cleanups.length - 1;i >= 0; i--)
35946
- node.cleanups[i]();
35947
- node.cleanups = null;
36104
+ get tabWidth() {
36105
+ return this._tabWidth;
35948
36106
  }
35949
- if (Transition && Transition.running)
35950
- node.tState = 0;
35951
- else
35952
- node.state = 0;
35953
- }
35954
- function reset(node, top) {
35955
- if (!top) {
35956
- node.tState = 0;
35957
- Transition.disposed.add(node);
36107
+ set tabWidth(tabWidth) {
36108
+ if (this._tabWidth === tabWidth)
36109
+ return;
36110
+ this._tabWidth = tabWidth;
36111
+ this.maxVisibleTabs = Math.max(1, Math.floor(this.width / this._tabWidth));
36112
+ this.updateScrollOffset();
36113
+ this.requestRender();
35958
36114
  }
35959
- if (node.owned) {
35960
- for (let i = 0;i < node.owned.length; i++)
35961
- reset(node.owned[i]);
36115
+ set keyBindings(bindings) {
36116
+ this._keyBindings = bindings;
36117
+ const mergedBindings = mergeKeyBindings(defaultTabSelectKeybindings, bindings);
36118
+ this._keyBindingsMap = buildKeyBindingsMap(mergedBindings, this._keyAliasMap);
35962
36119
  }
35963
- }
35964
- function castError(err) {
35965
- if (err instanceof Error)
35966
- return err;
35967
- return new Error(typeof err === "string" ? err : "Unknown error", {
35968
- cause: err
35969
- });
35970
- }
35971
- function runErrors(err, fns, owner) {
35972
- try {
35973
- for (const f of fns)
35974
- f(err);
35975
- } catch (e) {
35976
- handleError(e, owner && owner.owner || null);
36120
+ set keyAliasMap(aliases) {
36121
+ this._keyAliasMap = mergeKeyAliases(defaultKeyAliases, aliases);
36122
+ const mergedBindings = mergeKeyBindings(defaultTabSelectKeybindings, this._keyBindings);
36123
+ this._keyBindingsMap = buildKeyBindingsMap(mergedBindings, this._keyAliasMap);
35977
36124
  }
35978
36125
  }
35979
- function handleError(err, owner = Owner) {
35980
- const fns = ERROR && owner && owner.context && owner.context[ERROR];
35981
- const error = castError(err);
35982
- if (!fns)
35983
- throw error;
35984
- if (Effects)
35985
- Effects.push({
35986
- fn() {
35987
- runErrors(error, fns, owner);
35988
- },
35989
- state: STALE
36126
+
36127
+ class TimeToFirstDrawRenderable extends Renderable {
36128
+ _runtimeMs = null;
36129
+ textColor;
36130
+ label;
36131
+ precision;
36132
+ constructor(ctx, options = {}) {
36133
+ super(ctx, {
36134
+ width: "100%",
36135
+ height: 1,
36136
+ flexShrink: 0,
36137
+ alignSelf: "center",
36138
+ ...options
35990
36139
  });
35991
- else
35992
- runErrors(error, fns, owner);
35993
- }
35994
- function resolveChildren(children2) {
35995
- if (typeof children2 === "function" && !children2.length)
35996
- return resolveChildren(children2());
35997
- if (Array.isArray(children2)) {
35998
- const results = [];
35999
- for (let i = 0;i < children2.length; i++) {
36000
- const result = resolveChildren(children2[i]);
36001
- Array.isArray(result) ? results.push.apply(results, result) : results.push(result);
36140
+ this.textColor = parseColor(options.fg ?? "#AAAAAA");
36141
+ this.label = options.label ?? "Time to first draw";
36142
+ this.precision = this.normalizePrecision(options.precision ?? 2);
36143
+ }
36144
+ get runtimeMs() {
36145
+ return this._runtimeMs;
36146
+ }
36147
+ set fg(value) {
36148
+ this.textColor = parseColor(value);
36149
+ this.requestRender();
36150
+ }
36151
+ set color(value) {
36152
+ this.fg = value;
36153
+ }
36154
+ set textLabel(value) {
36155
+ if (value === this.label) {
36156
+ return;
36002
36157
  }
36003
- return results;
36158
+ this.label = value;
36159
+ this.requestRender();
36004
36160
  }
36005
- return children2;
36006
- }
36007
- function createProvider(id, options) {
36008
- return function provider(props) {
36009
- let res;
36010
- createRenderEffect(() => res = untrack(() => {
36011
- Owner.context = {
36012
- ...Owner.context,
36013
- [id]: props.value
36014
- };
36015
- return children(() => props.children);
36016
- }), undefined);
36017
- return res;
36018
- };
36019
- }
36020
- var FALLBACK = Symbol("fallback");
36021
- function dispose(d2) {
36022
- for (let i = 0;i < d2.length; i++)
36023
- d2[i]();
36024
- }
36025
- function mapArray(list, mapFn, options = {}) {
36026
- let items = [], mapped = [], disposers = [], len = 0, indexes = mapFn.length > 1 ? [] : null;
36027
- onCleanup(() => dispose(disposers));
36028
- return () => {
36029
- let newItems = list() || [], newLen = newItems.length, i, j2;
36030
- newItems[$TRACK];
36031
- return untrack(() => {
36032
- let newIndices, newIndicesNext, temp, tempdisposers, tempIndexes, start, end, newEnd, item;
36033
- if (newLen === 0) {
36034
- if (len !== 0) {
36035
- dispose(disposers);
36036
- disposers = [];
36037
- items = [];
36038
- mapped = [];
36039
- len = 0;
36040
- indexes && (indexes = []);
36041
- }
36042
- if (options.fallback) {
36043
- items = [FALLBACK];
36044
- mapped[0] = createRoot((disposer) => {
36045
- disposers[0] = disposer;
36046
- return options.fallback();
36047
- });
36048
- len = 1;
36049
- }
36050
- } else if (len === 0) {
36051
- mapped = new Array(newLen);
36052
- for (j2 = 0;j2 < newLen; j2++) {
36053
- items[j2] = newItems[j2];
36054
- mapped[j2] = createRoot(mapper);
36055
- }
36056
- len = newLen;
36057
- } else {
36058
- temp = new Array(newLen);
36059
- tempdisposers = new Array(newLen);
36060
- indexes && (tempIndexes = new Array(newLen));
36061
- for (start = 0, end = Math.min(len, newLen);start < end && items[start] === newItems[start]; start++)
36062
- ;
36063
- for (end = len - 1, newEnd = newLen - 1;end >= start && newEnd >= start && items[end] === newItems[newEnd]; end--, newEnd--) {
36064
- temp[newEnd] = mapped[end];
36065
- tempdisposers[newEnd] = disposers[end];
36066
- indexes && (tempIndexes[newEnd] = indexes[end]);
36067
- }
36068
- newIndices = new Map;
36069
- newIndicesNext = new Array(newEnd + 1);
36070
- for (j2 = newEnd;j2 >= start; j2--) {
36071
- item = newItems[j2];
36072
- i = newIndices.get(item);
36073
- newIndicesNext[j2] = i === undefined ? -1 : i;
36074
- newIndices.set(item, j2);
36075
- }
36076
- for (i = start;i <= end; i++) {
36077
- item = items[i];
36078
- j2 = newIndices.get(item);
36079
- if (j2 !== undefined && j2 !== -1) {
36080
- temp[j2] = mapped[i];
36081
- tempdisposers[j2] = disposers[i];
36082
- indexes && (tempIndexes[j2] = indexes[i]);
36083
- j2 = newIndicesNext[j2];
36084
- newIndices.set(item, j2);
36085
- } else
36086
- disposers[i]();
36087
- }
36088
- for (j2 = start;j2 < newLen; j2++) {
36089
- if (j2 in temp) {
36090
- mapped[j2] = temp[j2];
36091
- disposers[j2] = tempdisposers[j2];
36092
- if (indexes) {
36093
- indexes[j2] = tempIndexes[j2];
36094
- indexes[j2](j2);
36095
- }
36096
- } else
36097
- mapped[j2] = createRoot(mapper);
36098
- }
36099
- mapped = mapped.slice(0, len = newLen);
36100
- items = newItems.slice(0);
36101
- }
36102
- return mapped;
36103
- });
36104
- function mapper(disposer) {
36105
- disposers[j2] = disposer;
36106
- if (indexes) {
36107
- const [s, set] = createSignal(j2);
36108
- indexes[j2] = set;
36109
- return mapFn(newItems[j2], s);
36110
- }
36111
- return mapFn(newItems[j2]);
36161
+ set decimals(value) {
36162
+ const nextPrecision = this.normalizePrecision(value);
36163
+ if (nextPrecision === this.precision) {
36164
+ return;
36112
36165
  }
36113
- };
36114
- }
36115
- var hydrationEnabled = false;
36116
- function createComponent(Comp, props) {
36117
- if (hydrationEnabled) {
36118
- if (sharedConfig.context) {
36119
- const c = sharedConfig.context;
36120
- setHydrateContext(nextHydrateContext());
36121
- const r = untrack(() => Comp(props || {}));
36122
- setHydrateContext(c);
36123
- return r;
36166
+ this.precision = nextPrecision;
36167
+ this.requestRender();
36168
+ }
36169
+ reset() {
36170
+ this._runtimeMs = null;
36171
+ this.requestRender();
36172
+ }
36173
+ renderSelf(buffer) {
36174
+ if (this._runtimeMs === null) {
36175
+ this._runtimeMs = performance.now();
36124
36176
  }
36177
+ const content = `${this.label}: ${this._runtimeMs.toFixed(this.precision)}ms`;
36178
+ const maxWidth = Math.max(this.width, 1);
36179
+ const visibleContent = content.length > maxWidth ? content.slice(0, maxWidth) : content;
36180
+ const centeredX = this.x + Math.max(0, Math.floor((maxWidth - visibleContent.length) / 2));
36181
+ buffer.drawText(visibleContent, centeredX, this.y, this.textColor);
36182
+ }
36183
+ normalizePrecision(value) {
36184
+ if (!Number.isFinite(value)) {
36185
+ return 2;
36186
+ }
36187
+ return Math.max(0, Math.floor(value));
36125
36188
  }
36126
- return untrack(() => Comp(props || {}));
36127
- }
36128
- function trueFn() {
36129
- return true;
36130
36189
  }
36131
- var propTraps = {
36132
- get(_2, property, receiver) {
36133
- if (property === $PROXY)
36134
- return receiver;
36135
- return _2.get(property);
36136
- },
36137
- has(_2, property) {
36138
- if (property === $PROXY)
36139
- return true;
36140
- return _2.has(property);
36141
- },
36142
- set: trueFn,
36143
- deleteProperty: trueFn,
36144
- getOwnPropertyDescriptor(_2, property) {
36145
- return {
36146
- configurable: true,
36147
- enumerable: true,
36148
- get() {
36149
- return _2.get(property);
36150
- },
36151
- set: trueFn,
36152
- deleteProperty: trueFn
36190
+
36191
+ // node_modules/@opentui/solid/node_modules/@opentui/core/testing.js
36192
+ var decoder2 = new TextDecoder;
36193
+ class TestRecorder {
36194
+ renderer;
36195
+ frames = [];
36196
+ recording = false;
36197
+ frameNumber = 0;
36198
+ startTime = 0;
36199
+ originalRenderNative;
36200
+ decoder = new TextDecoder;
36201
+ recordBuffers;
36202
+ now;
36203
+ constructor(renderer, options) {
36204
+ this.renderer = renderer;
36205
+ this.recordBuffers = options?.recordBuffers || {};
36206
+ this.now = options?.now ?? (() => performance.now());
36207
+ }
36208
+ rec() {
36209
+ if (this.recording) {
36210
+ return;
36211
+ }
36212
+ this.recording = true;
36213
+ this.frames = [];
36214
+ this.frameNumber = 0;
36215
+ this.startTime = this.now();
36216
+ this.originalRenderNative = this.renderer["renderNative"].bind(this.renderer);
36217
+ this.renderer["renderNative"] = () => {
36218
+ this.originalRenderNative();
36219
+ this.captureFrame();
36153
36220
  };
36154
- },
36155
- ownKeys(_2) {
36156
- return _2.keys();
36157
36221
  }
36158
- };
36159
- function resolveSource(s) {
36160
- return !(s = typeof s === "function" ? s() : s) ? {} : s;
36161
- }
36162
- function resolveSources() {
36163
- for (let i = 0, length = this.length;i < length; ++i) {
36164
- const v2 = this[i]();
36165
- if (v2 !== undefined)
36166
- return v2;
36222
+ stop() {
36223
+ if (!this.recording) {
36224
+ return;
36225
+ }
36226
+ this.recording = false;
36227
+ if (this.originalRenderNative) {
36228
+ this.renderer["renderNative"] = this.originalRenderNative;
36229
+ this.originalRenderNative = undefined;
36230
+ }
36167
36231
  }
36168
- }
36169
- function mergeProps(...sources) {
36170
- let proxy = false;
36171
- for (let i = 0;i < sources.length; i++) {
36172
- const s = sources[i];
36173
- proxy = proxy || !!s && $PROXY in s;
36174
- sources[i] = typeof s === "function" ? (proxy = true, createMemo(s)) : s;
36232
+ get recordedFrames() {
36233
+ return [...this.frames];
36175
36234
  }
36176
- if (SUPPORTS_PROXY && proxy) {
36177
- return new Proxy({
36178
- get(property) {
36179
- for (let i = sources.length - 1;i >= 0; i--) {
36180
- const v2 = resolveSource(sources[i])[property];
36181
- if (v2 !== undefined)
36182
- return v2;
36183
- }
36184
- },
36185
- has(property) {
36186
- for (let i = sources.length - 1;i >= 0; i--) {
36187
- if (property in resolveSource(sources[i]))
36188
- return true;
36189
- }
36190
- return false;
36191
- },
36192
- keys() {
36193
- const keys = [];
36194
- for (let i = 0;i < sources.length; i++)
36195
- keys.push(...Object.keys(resolveSource(sources[i])));
36196
- return [...new Set(keys)];
36197
- }
36198
- }, propTraps);
36235
+ clear() {
36236
+ this.frames = [];
36237
+ this.frameNumber = 0;
36199
36238
  }
36200
- const sourcesMap = {};
36201
- const defined = Object.create(null);
36202
- for (let i = sources.length - 1;i >= 0; i--) {
36203
- const source = sources[i];
36204
- if (!source)
36205
- continue;
36206
- const sourceKeys = Object.getOwnPropertyNames(source);
36207
- for (let i2 = sourceKeys.length - 1;i2 >= 0; i2--) {
36208
- const key = sourceKeys[i2];
36209
- if (key === "__proto__" || key === "constructor")
36210
- continue;
36211
- const desc = Object.getOwnPropertyDescriptor(source, key);
36212
- if (!defined[key]) {
36213
- defined[key] = desc.get ? {
36214
- enumerable: true,
36215
- configurable: true,
36216
- get: resolveSources.bind(sourcesMap[key] = [desc.get.bind(source)])
36217
- } : desc.value !== undefined ? desc : undefined;
36218
- } else {
36219
- const sources2 = sourcesMap[key];
36220
- if (sources2) {
36221
- if (desc.get)
36222
- sources2.push(desc.get.bind(source));
36223
- else if (desc.value !== undefined)
36224
- sources2.push(() => desc.value);
36225
- }
36239
+ get isRecording() {
36240
+ return this.recording;
36241
+ }
36242
+ captureFrame() {
36243
+ const currentBuffer = this.renderer.currentRenderBuffer;
36244
+ const frameBytes = currentBuffer.getRealCharBytes(true);
36245
+ const frame = this.decoder.decode(frameBytes);
36246
+ const recordedFrame = {
36247
+ frame,
36248
+ timestamp: this.now() - this.startTime,
36249
+ frameNumber: this.frameNumber++
36250
+ };
36251
+ if (this.recordBuffers.fg || this.recordBuffers.bg || this.recordBuffers.attributes) {
36252
+ const buffers = currentBuffer.buffers;
36253
+ recordedFrame.buffers = {};
36254
+ if (this.recordBuffers.fg) {
36255
+ recordedFrame.buffers.fg = new Float32Array(buffers.fg);
36256
+ }
36257
+ if (this.recordBuffers.bg) {
36258
+ recordedFrame.buffers.bg = new Float32Array(buffers.bg);
36259
+ }
36260
+ if (this.recordBuffers.attributes) {
36261
+ recordedFrame.buffers.attributes = new Uint8Array(buffers.attributes);
36226
36262
  }
36227
36263
  }
36264
+ this.frames.push(recordedFrame);
36228
36265
  }
36229
- const target = {};
36230
- const definedKeys = Object.keys(defined);
36231
- for (let i = definedKeys.length - 1;i >= 0; i--) {
36232
- const key = definedKeys[i], desc = defined[key];
36233
- if (desc && desc.get)
36234
- Object.defineProperty(target, key, desc);
36235
- else
36236
- target[key] = desc ? desc.value : undefined;
36237
- }
36238
- return target;
36239
- }
36240
- var narrowedError = (name) => `Stale read from <${name}>.`;
36241
- function For(props) {
36242
- const fallback = "fallback" in props && {
36243
- fallback: () => props.fallback
36244
- };
36245
- return createMemo(mapArray(() => props.each, props.children, fallback || undefined));
36246
- }
36247
- function Show(props) {
36248
- const keyed = props.keyed;
36249
- const conditionValue = createMemo(() => props.when, undefined, undefined);
36250
- const condition = keyed ? conditionValue : createMemo(conditionValue, undefined, {
36251
- equals: (a, b2) => !a === !b2
36252
- });
36253
- return createMemo(() => {
36254
- const c = condition();
36255
- if (c) {
36256
- const child = props.children;
36257
- const fn = typeof child === "function" && child.length > 0;
36258
- return fn ? untrack(() => child(keyed ? c : () => {
36259
- if (!untrack(condition))
36260
- throw narrowedError("Show");
36261
- return conditionValue();
36262
- })) : child;
36263
- }
36264
- return props.fallback;
36265
- }, undefined, undefined);
36266
36266
  }
36267
36267
 
36268
36268
  // node_modules/entities/dist/esm/decode-codepoint.js
@@ -43208,17 +43208,43 @@ async function main2() {
43208
43208
  };
43209
43209
  const hasConfig = await configExists();
43210
43210
  if (!hasConfig) {
43211
- await render(() => ConfigWizard({
43212
- isFirstRun: true,
43213
- onComplete: async () => {
43214
- await bootApp(appRoot, rendererConfig, resumeSessionId);
43211
+ const [boot, setBoot] = createSignal(null);
43212
+ await render(() => Show({
43213
+ get when() {
43214
+ return boot();
43215
+ },
43216
+ get fallback() {
43217
+ return ConfigWizard({
43218
+ isFirstRun: true,
43219
+ onComplete: async () => {
43220
+ const result = await buildOrchestrator(appRoot, resumeSessionId);
43221
+ setBoot(result);
43222
+ }
43223
+ });
43224
+ },
43225
+ get children() {
43226
+ const b2 = boot();
43227
+ if (!b2)
43228
+ return null;
43229
+ return App({
43230
+ orchestrator: b2.orchestrator,
43231
+ config: b2.config,
43232
+ configPath: b2.configPath,
43233
+ resumeSessionId
43234
+ });
43215
43235
  }
43216
43236
  }), rendererConfig);
43217
43237
  } else {
43218
- await bootApp(appRoot, rendererConfig, resumeSessionId);
43238
+ const result = await buildOrchestrator(appRoot, resumeSessionId);
43239
+ await render(() => App({
43240
+ orchestrator: result.orchestrator,
43241
+ config: result.config,
43242
+ configPath: result.configPath,
43243
+ resumeSessionId
43244
+ }), rendererConfig);
43219
43245
  }
43220
43246
  }
43221
- async function bootApp(appRoot, rendererConfig, resumeSessionId) {
43247
+ async function buildOrchestrator(appRoot, resumeSessionId) {
43222
43248
  const configPath = await resolveConfigPath(appRoot);
43223
43249
  const config = await loadConfig2(configPath);
43224
43250
  const humanName = config.humanName?.trim() || "USER";
@@ -43309,7 +43335,7 @@ ${mySkills.map((s) => `- ${s}`).join(`
43309
43335
  const defaultTimeout = typeof config.timeout === "number" && config.timeout > 0 ? config.timeout * 1000 : 600000;
43310
43336
  const agentTimeouts = Object.fromEntries(activeAgents.filter((agent) => typeof agent.timeout === "number" && agent.timeout > 0).map((agent) => [agent.name, agent.timeout * 1000]));
43311
43337
  const orchestrator = new Orchestrator(adapters, humanName, Object.fromEntries(activeAgents.map((agent) => [agent.name, agent.tag?.trim() || toTag(agent.name)])), humanTag, defaultTimeout, agentTimeouts, { reminderInterval: config.reminderInterval, maxAutoHops });
43312
- await render(() => App({ orchestrator, config, configPath, resumeSessionId }), rendererConfig);
43338
+ return { orchestrator, config, configPath };
43313
43339
  }
43314
43340
  function resolveMaxAutoHops(value) {
43315
43341
  if (typeof value === "number" && value === 0) {