@codeyam-editor/codeyam-editor 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/npm/cloud.js +116 -23
- package/npm/fleet-add-failure.js +59 -12
- package/npm/fleet-memory.js +29 -4
- package/npm/fleet-queue.js +141 -0
- package/npm/fleet-vm-access.js +162 -0
- package/npm/ingress-invoke.js +46 -2
- package/npm/launch-config.js +43 -0
- package/npm/scenario-check.js +11 -1
- package/npm/scenario-handlers.js +18 -0
- package/npm/scenario-issues.js +11 -0
- package/npm/scenario-mocks.js +245 -39
- package/npm/scenario-playwright.js +70 -12
- package/package.json +5 -5
- package/ui/dist/assets/{ContainerInspector-Cu1tSN-o.js → ContainerInspector-DSVZvEkB.js} +1 -1
- package/ui/dist/assets/EditorShell-DnXdHrar.js +256 -0
- package/ui/dist/assets/EditorShell-FvbXyqqD.css +1 -0
- package/ui/dist/assets/{ProjectLauncherScreen-Dmm6Z0mv.js → ProjectLauncherScreen-E0NYYiwy.js} +1 -1
- package/ui/dist/assets/ScenarioDataPanel-6qJE-0lA.js +15 -0
- package/ui/dist/assets/{ScenarioDataPanelFullPage-BqMxWVKW.js → ScenarioDataPanelFullPage-Cyk6efiI.js} +1 -1
- package/ui/dist/assets/ScenarioRenderer-Uyt54vHI.js +21 -0
- package/ui/dist/assets/{index-VuyqBbGJ.js → index-BPLKgwon.js} +9 -9
- package/ui/dist/assets/index-DKpgJLo3.css +1 -0
- package/ui/dist/assets/useServerIdentity-CVuHTzjg.js +1 -0
- package/ui/dist/index.html +2 -2
- package/ui/dist/assets/EditorShell--V2ExYQ6.js +0 -260
- package/ui/dist/assets/EditorShell-DP5UY20G.css +0 -1
- package/ui/dist/assets/ScenarioDataPanel-DjprZq2L.js +0 -9
- package/ui/dist/assets/ScenarioRenderer-DqLVVMYS.js +0 -21
- package/ui/dist/assets/index-CjxWhkSy.css +0 -1
- package/ui/dist/assets/useServerIdentity-BdXy8TQv.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.fact-fresh{display:inline-flex;align-items:center;margin-left:.4em;padding:.05em .45em;border-radius:999px;font-size:.72em;font-weight:600;letter-spacing:.01em;line-height:1.5;white-space:nowrap;color:#5b6472;background:#636e7d1a;cursor:help;vertical-align:middle}.fact-fresh.stale{color:#9a5b00;background:#d68a0029}.home-landing,.learn-screen,.hosting-screen,.lib-group,.lib-row{--bg: var(--surface-page);--panel: var(--surface-panel);--panel-2: var(--surface-card);--panel-3: var(--surface-raised);--line: var(--line-subtle);--line-2: var(--line-hair);--text: var(--text-strong);--text-2: var(--text-body);--text-3: var(--text-faint);--text-4: var(--text-subtle);--lime: var(--lime-300);--lime-dim: var(--lime-400);--blue: var(--blue-300);--green: var(--green-300);--amber: var(--amber-300);--mono: "IBM Plex Mono", monospace;--sans: "IBM Plex Sans", sans-serif;font-family:var(--sans);color:var(--text);-webkit-font-smoothing:antialiased}.home-landing *,.learn-screen *,.hosting-screen *,.lib-group *,.lib-row *{box-sizing:border-box}@keyframes home-spin{to{transform:rotate(360deg)}}@keyframes home-pulse{0%,to{opacity:1}50%{opacity:.35}}@keyframes home-fade{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:none}}.home-landing{padding:30px 10% 50px}.home-landing .hello{font-size:13px;color:var(--text-3);margin-bottom:5px}.home-landing .project{font-size:27px;font-weight:700;letter-spacing:-.02em;margin-bottom:24px;line-height:1.15}.home-landing .seclabel{font-size:11px;font-weight:700;letter-spacing:.07em;text-transform:uppercase;color:var(--text-4);margin:0 2px 14px}.home-landing .pnopreview{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;background:#ffffff09;color:var(--text-4);font-size:12px;font-family:var(--mono)}.home-landing .exdoor{border:.5px solid var(--line);border-radius:18px;background:var(--panel-2);overflow:hidden;margin-bottom:15px}.home-landing .exhead{display:flex;align-items:center;gap:12px;padding:20px 22px 0;width:100%;text-align:left;background:none;border:0;font:inherit;color:inherit;cursor:pointer}.home-landing .exhead:hover .dname{text-decoration:underline}.home-landing .exhead .dic{width:42px;height:42px;border-radius:12px;display:flex;align-items:center;justify-content:center;font-size:21px;flex-shrink:0;background:var(--blue-soft);color:var(--blue-300)}.home-landing .exhead .grow{flex:1;min-width:0}.home-landing .exhead .dname{font-size:16.5px;font-weight:600}.home-landing .exhead .ddesc{font-size:13px;color:var(--text-3);margin-top:2px}.home-landing .exhead .open{font-size:12.5px;font-weight:600;color:var(--blue);cursor:pointer;display:flex;align-items:center;gap:5px;white-space:nowrap;background:none;border:none;font-family:inherit}.home-landing .exhead .open:hover{text-decoration:underline}.home-landing .rail{display:flex;gap:13px;padding:18px 22px 22px;overflow-x:auto}.home-landing .rail::-webkit-scrollbar{height:7px}.home-landing .rail::-webkit-scrollbar-thumb{background:#2a2a2a;border-radius:4px}.home-landing .pcard{flex-shrink:0;width:158px;cursor:pointer;background:none;border:none;padding:0;text-align:left;font-family:inherit;color:inherit}.home-landing .pthumb{width:158px;height:108px;border-radius:10px;border:.5px solid var(--line-2);overflow:hidden;position:relative;transition:.15s}.home-landing .pcard:hover .pthumb{border-color:var(--blue);transform:translateY(-3px)}.home-landing .pshot{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;object-fit:contain;background:#141414}.home-landing .pcount{position:absolute;bottom:7px;right:7px;font-size:9px;color:var(--text-2);background:#000000a6;border-radius:5px;padding:2px 7px}.home-landing .pname{font-size:13px;font-weight:600;margin-top:9px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.home-landing .allcard{flex-shrink:0;width:90px;display:flex;align-items:center}.home-landing .alltile{width:90px;height:108px;border-radius:10px;border:.5px dashed var(--line-2);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;color:var(--text-3);cursor:pointer;transition:.15s;background:none;font-family:inherit}.home-landing .alltile:hover{border-color:var(--blue);color:var(--blue)}.home-landing .alltile .n{font-size:18px;font-weight:700}.home-landing .alltile .l{font-size:10px}.home-landing .railempty{font-size:13px;color:var(--text-3);padding:4px 0 8px}.home-landing .ic-plan{background:var(--lime-soft);color:var(--lime-300)}.home-landing .ic-learn{background:var(--amber-soft);color:var(--amber-300)}.home-landing .doorrows{display:flex;flex-direction:column;gap:10px}.home-landing .doorrows .exdoor{margin-bottom:0}.home-landing .drow{display:flex;align-items:center;gap:14px;border:.5px solid var(--line);border-radius:14px;padding:15px 18px;background:var(--panel-2);cursor:pointer;transition:.18s;width:100%;text-align:left;font-family:inherit;color:var(--text)}.home-landing .drow:hover{border-color:var(--line-2);background:var(--panel-3);transform:translateY(-1px)}.home-landing .drow .dic{width:40px;height:40px;border-radius:11px;display:flex;align-items:center;justify-content:center;font-size:19px;flex-shrink:0;background:var(--panel-3)}.home-landing .drow .dmain{flex:1;min-width:0}.home-landing .drow .dname{font-size:15px;font-weight:600;display:flex;align-items:center;gap:8px}.home-landing .drow .ddesc{font-size:12.5px;color:var(--text-3);line-height:1.45;margin-top:2px}.home-landing .drow .ddesc b{color:var(--text);font-weight:600}.home-landing .drow .dright{display:flex;align-items:center;gap:13px;flex-shrink:0}.home-landing .drow .dmeta{font-size:11.5px;color:var(--text-3);text-align:right;white-space:nowrap;line-height:1.4}.home-landing .drow .dmeta .stat{font-weight:600;color:var(--text);display:block}.home-landing .drow .arr{color:var(--text-4);font-size:16px;transition:.15s}.home-landing .drow:hover .arr{color:var(--text-2);transform:translate(3px)}.home-landing .drow.building{border-color:#9bd35a66;background:#9bd35a0d}.home-landing .drow.building .dspin{width:40px;height:40px;border-radius:11px;flex-shrink:0;display:flex;align-items:center;justify-content:center;background:var(--green-soft)}.home-landing .drow.building .dspin:after{content:"";width:20px;height:20px;border-radius:50%;border:2.5px solid var(--green);border-top-color:transparent;animation:home-spin 1s linear infinite}.home-landing .drow.building .bstep{display:flex;align-items:center;gap:7px;margin-top:6px;font-size:11px;color:var(--text-3);font-variant-numeric:tabular-nums}.home-landing .drow.building .bflow{font-weight:600;font-variant-numeric:normal;padding:1px 7px;border-radius:6px;background:var(--green-soft);color:var(--green-300)}.home-landing .drow.building.attn .bflow{background:var(--amber-soft, rgba(224, 178, 74, .16));color:var(--amber-300)}.home-landing .drow .bbar{height:5px;background:var(--panel-3);border-radius:3px;margin-top:9px;overflow:hidden;max-width:360px}.home-landing .drow .bbar>div{height:100%;background:var(--green);border-radius:3px;transition:width .6s ease}.home-landing .drow .livedot{width:7px;height:7px;border-radius:50%;background:var(--green);display:inline-block;animation:home-pulse 1.4s ease-in-out infinite}.home-landing .drow.building.attn{border-color:#e0b24a66;background:#e0b24a0f}.home-landing .drow.building.attn .dspin{background:var(--amber-soft, rgba(224, 178, 74, .16))}.home-landing .drow.building.attn .dspin:after{border-color:var(--amber-300);border-top-color:transparent;animation:none}.home-landing .drow .livedot.warn{background:var(--amber-300)}.home-landing .drow.ready .dic.ic-ready{color:var(--blue-300)}.home-landing .cta-pill{display:inline-flex;align-items:center;white-space:nowrap;font-size:12.5px;font-weight:600;padding:8px 14px;border-radius:9px;background:var(--action-bg);color:var(--action-fg)}.home-landing .drow.ready:hover .cta-pill{filter:brightness(1.05)}.home-landing .drow.quiet{background:transparent}.home-landing .drow.quiet .dic{background:var(--panel-2);opacity:.85}.home-landing .drow.quiet .dname{color:var(--text-2)}.home-landing .drow .lines{display:inline-flex;gap:4px;margin-top:5px;justify-content:flex-end}.home-landing .drow .ln{width:16px;height:4px;border-radius:2px;background:var(--line-2)}.home-landing .drow .ln.done{background:var(--green)}.home-landing .bstatus-foot{display:flex;align-items:center;justify-content:flex-end;gap:13px;flex-wrap:wrap;padding:2px 4px 0}.home-landing .bstatus-reset{font-family:inherit;font-size:11.5px;font-weight:600;padding:6px 12px;border-radius:9px;border:.5px solid var(--amber-300);background:transparent;color:var(--amber-300);cursor:pointer;transition:.15s;white-space:nowrap}.home-landing .bstatus-reset:hover{background:#e0b24a1a}.home-landing .crumbs,.learn-screen .crumbs,.hosting-screen .crumbs{font-size:13px;color:var(--text-3);margin-bottom:20px;display:flex;align-items:center;gap:8px;flex-wrap:wrap}.home-landing .crumbs a,.learn-screen .crumbs a,.hosting-screen .crumbs a{color:var(--text-3);text-decoration:none;cursor:pointer;white-space:nowrap;background:none;border:none;font:inherit;padding:0}.home-landing .crumbs a:hover,.learn-screen .crumbs a:hover,.hosting-screen .crumbs a:hover{color:var(--text-2)}.home-landing .crumbs .sep,.learn-screen .crumbs .sep,.hosting-screen .crumbs .sep{color:var(--text-4)}.home-landing .crumbs b,.learn-screen .crumbs b,.hosting-screen .crumbs b{color:var(--text);white-space:nowrap}.home-landing .crumbs .back,.learn-screen .crumbs .back,.hosting-screen .crumbs .back{display:inline-flex;align-items:center;gap:5px;color:var(--text-2);cursor:pointer;font-weight:500;margin-right:6px;background:none;border:none;font:inherit;padding:0}.home-landing .crumbs .back:hover,.learn-screen .crumbs .back:hover,.hosting-screen .crumbs .back:hover{color:var(--text)}.learn-screen{padding:26px 40px 40px}.learn-screen .h{font-size:23px;font-weight:700;letter-spacing:-.01em}.learn-screen .hsub{font-size:14px;color:var(--text-3);line-height:1.6;max-width:680px;margin:8px 0 24px}.learn-screen .tlist{display:flex;flex-direction:column;gap:10px}.learn-screen .trow{display:flex;align-items:center;gap:14px;border:.5px solid var(--line);border-radius:13px;padding:15px 17px;background:var(--panel-2);cursor:pointer;transition:.15s;width:100%;text-align:left;color:var(--text);font-family:inherit}.learn-screen .trow:hover{border-color:var(--line-2);background:var(--panel-3);transform:translateY(-1px)}.learn-screen .trow .tic{width:42px;height:42px;border-radius:11px;display:flex;align-items:center;justify-content:center;font-size:21px;flex-shrink:0;background:var(--panel-3);color:var(--text-2)}.learn-screen .trow.next .tic{color:var(--amber)}.learn-screen .trow .tbody{flex:1;min-width:0}.learn-screen .trow .tn{font-size:15.5px;font-weight:600;color:var(--text)}.learn-screen .trow .td{font-size:12.5px;color:var(--text-3);margin-top:2px}.learn-screen .trow .tt{font-size:11px;font-weight:600;color:var(--text-3);white-space:nowrap;border:.5px solid var(--line-2);border-radius:8px;padding:3px 9px}.learn-screen .trow.done .tt{color:var(--green);border-color:#9bd35a4d}.learn-screen .trow.next .tt{color:var(--amber);border-color:#ef9f2759;background:#ef9f2712}.learn-screen .trow .arrow{margin-left:auto;color:var(--text-4);font-size:18px;transition:.15s}.learn-screen .trow:hover .arrow{color:var(--text-2);transform:translate(3px)}.learn-screen .trow.soon .tn{color:var(--text-2)}.learn-screen .trow.soon .td{color:var(--text-4)}.learn-screen .trow-group{display:flex;flex-direction:column;gap:6px}.learn-screen .detected-services{display:flex;flex-direction:column;gap:6px;margin:0 4px 0 22px}.learn-screen .detected-service{display:flex;align-items:center;gap:10px;border:.5px solid var(--line-2);border-radius:10px;padding:9px 13px;background:var(--panel);font-size:12.5px}.learn-screen .detected-service .ds-tag{font-family:var(--mono);font-size:10.5px;font-weight:600;color:var(--blue);border:.5px solid rgba(110,168,254,.35);background:var(--blue-soft);border-radius:7px;padding:2px 7px;white-space:nowrap}.learn-screen .detected-service .ds-name{font-weight:600;color:var(--text)}.learn-screen .detected-service .ds-why{color:var(--text-3);font-family:var(--mono);font-size:11.5px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.learn-screen .detected-service .ds-key-set{margin-left:auto;flex-shrink:0;font-family:var(--mono);font-size:10.5px;font-weight:600;color:var(--green, #8bd450);border:.5px solid rgba(139,212,80,.35);border-radius:7px;padding:2px 7px;white-space:nowrap}.learn-screen .detected-service .ds-add-key{margin-left:auto;flex-shrink:0;font-family:inherit;font-size:11.5px;font-weight:600;color:#161616;background:var(--accent, #d7ff63);border:none;border-radius:8px;padding:3px 10px;cursor:pointer;transition:.15s}.learn-screen .detected-service .ds-add-key:hover{filter:brightness(1.05)}.learn-screen .detected-service .ds-dismiss{margin-left:auto;flex-shrink:0;font-family:inherit;font-size:11.5px;color:var(--text-3);background:transparent;border:.5px solid var(--line-2);border-radius:8px;padding:3px 10px;cursor:pointer;transition:.15s}.learn-screen .detected-service .ds-dismiss:hover{color:var(--text);border-color:var(--line);background:var(--panel-3)}.hosting-screen{padding:26px 40px 40px}.hosting-screen .htitle{display:flex;align-items:center;gap:15px;margin-bottom:24px}.hosting-screen .htitle>div{min-width:0}.hosting-screen .htitle .hic{width:54px;height:54px;border-radius:15px;background:linear-gradient(160deg,#1d1d1d,#141414);border:.5px solid var(--line);display:flex;align-items:center;justify-content:center;font-size:26px;flex-shrink:0;color:var(--amber)}.hosting-screen .htitle .h{font-size:25px;font-weight:700;letter-spacing:-.02em}.hosting-screen .htitle .hmeta{font-size:13px;color:var(--text-3);margin-top:3px;font-family:var(--mono)}.hosting-screen .lead{font-size:15px;color:var(--text-2);line-height:1.6;max-width:680px;margin-bottom:8px}.hosting-screen .lead b{color:var(--text);font-weight:600}.hosting-screen .lead.dim{font-size:14px;color:var(--text-3);margin-bottom:26px}.hosting-screen .seclabel{font-size:11px;font-weight:700;letter-spacing:.09em;text-transform:uppercase;color:var(--text-4);margin:0 2px 13px}.hosting-screen .journey{position:relative;border:.5px solid var(--line);border-radius:18px;background:linear-gradient(150deg,#161616,#0f0f0f);padding:30px 34px 26px;margin-bottom:26px;overflow:hidden}.hosting-screen .jrow{display:flex;align-items:flex-start;justify-content:center;position:relative;z-index:1}.hosting-screen .jcol{display:flex;flex-direction:column;align-items:center;gap:9px;width:170px;text-align:center}.hosting-screen .jtile{width:62px;height:62px;border-radius:16px;background:var(--panel-3);border:.5px solid var(--line-2);display:flex;align-items:center;justify-content:center;font-size:30px}.hosting-screen .jtile.lime{background:#c7f04a1f;border-color:#c7f04a66;box-shadow:0 0 0 4px #c7f04a0f}.hosting-screen .jlbl{font-size:14px;font-weight:600;color:var(--text)}.hosting-screen .jsub{font-size:12px;color:var(--text-3);line-height:1.4}.hosting-screen .jconn{flex:1;max-width:96px;display:flex;align-items:center;justify-content:center;color:var(--text-4);font-size:18px;padding-top:22px;position:relative}.hosting-screen .jconn:before{content:"";position:absolute;top:31px;left:-6px;right:-6px;height:2px;background:repeating-linear-gradient(90deg,var(--line-2) 0 5px,transparent 5px 11px)}.hosting-screen .jconn span{position:relative;z-index:1;background:#121212;padding:0 6px}.hosting-screen .jpacket{position:absolute;top:25px;width:9px;height:9px;border-radius:50%;background:var(--lime);box-shadow:0 0 10px 2px #c7f04a99;z-index:2;left:0;animation:hs-jtravel 3.6s cubic-bezier(.6,0,.4,1) infinite}@keyframes hs-jtravel{0%{left:14%;opacity:0}12%{opacity:1}88%{opacity:1}to{left:86%;opacity:0}}.home-landing .crumbs,.home-landing .hello,.home-landing .project,.home-landing .seclabel,.home-landing .drow,.home-landing .exdoor{width:100%;max-width:2200px;margin-left:auto;margin-right:auto}@media(prefers-reduced-motion:reduce){.hosting-screen .jpacket{animation:none;left:50%;opacity:.7}.home-landing .drow.building .dspin:after,.hosting-screen .deploy-spin:after,.hosting-screen .dep-step.active .dot:after{animation:none}.home-landing .drow .bbar>div{transition:none}.home-landing .drow .livedot{animation:none}}.wired-provider{border:.5px solid rgba(199,240,74,.45);border-radius:12px;background:linear-gradient(150deg,#c7f04a12,#c7f04a03);padding:12px 15px;margin:0 0 16px;display:flex;flex-direction:column;gap:4px}.wired-provider-title{font-size:14px;color:var(--text-1)}.wired-provider-detail{font-size:13px;color:var(--text-2);line-height:1.5}.hosting-screen .hosting-detected{border:.5px solid rgba(199,240,74,.45);border-radius:14px;background:linear-gradient(150deg,#c7f04a12,#c7f04a03);padding:14px 16px;margin-bottom:18px;display:flex;flex-direction:column;gap:6px}.hosting-screen .hosting-detected-title{font-size:14px;font-weight:600;color:var(--text-1)}.hosting-screen .hosting-detected-detail{font-size:13px;color:var(--text-2);line-height:1.55}.hosting-screen .hosting-detected-detail code{font-family:var(--mono, monospace);font-size:12px;background:var(--panel-3, rgba(255, 255, 255, .05));padding:1px 5px;border-radius:5px}.hosting-screen .provcard{display:flex;gap:18px;border:.5px solid var(--line-2);border-radius:16px;background:var(--panel-2);padding:20px 22px;transition:.15s}.hosting-screen .provcard.best{border-color:#c7f04a73;background:linear-gradient(150deg,#c7f04a0d,#c7f04a03)}.hosting-screen .pv-logo{width:50px;height:50px;border-radius:13px;background:#fff;display:flex;align-items:center;justify-content:center;flex-shrink:0;box-shadow:0 2px 10px #0006}.hosting-screen .provbody{flex:1;min-width:0}.hosting-screen .provtop{display:flex;align-items:center;gap:10px;margin-bottom:5px;flex-wrap:wrap}.hosting-screen .provname{font-size:18px;font-weight:700}.hosting-screen .bestfit{font-size:10.5px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:#0a0a0a;background:var(--lime);border-radius:6px;padding:3px 9px;white-space:nowrap;flex-shrink:0}.hosting-screen .provdesc{font-size:13.5px;color:var(--text-2);line-height:1.55;margin-bottom:14px;max-width:560px}.hosting-screen .reasons{display:flex;flex-direction:column;gap:9px;margin-bottom:15px}.hosting-screen .reason{display:flex;align-items:flex-start;gap:10px;font-size:13.5px;color:var(--text-2);line-height:1.45}.hosting-screen .reason b{color:var(--text);font-weight:600}.hosting-screen .reason svg{margin-top:2px;flex-shrink:0}.hosting-screen .chips{display:flex;gap:8px;flex-wrap:wrap}.hosting-screen .chip{font-size:11.5px;font-weight:500;color:var(--text-2);background:var(--panel-3);border:.5px solid var(--line);border-radius:8px;padding:5px 11px}.hosting-screen .alt-toggle{display:inline-flex;align-items:center;gap:7px;margin-top:15px;font-size:13px;font-weight:600;color:var(--text-3);background:none;border:none;cursor:pointer;transition:.15s;font-family:inherit}.hosting-screen .alt-toggle:hover{color:var(--text)}.hosting-screen .alt-toggle .chev{transition:transform .2s;font-size:11px}.hosting-screen .alts{display:flex;flex-direction:column;gap:10px;margin-top:14px;animation:home-fade .25s ease}.hosting-screen .altcard{display:flex;align-items:center;gap:14px;border:.5px solid var(--line);border-radius:13px;background:var(--panel-2);padding:14px 16px;transition:.15s}.hosting-screen .altcard:hover{border-color:var(--line-2);background:var(--panel-3)}.hosting-screen .altmark{width:42px;height:42px;border-radius:11px;display:flex;align-items:center;justify-content:center;flex-shrink:0;font-weight:800;font-size:18px;color:#fff;font-family:var(--mono)}.hosting-screen .altbody{flex:1;min-width:0}.hosting-screen .altname{font-size:14.5px;font-weight:600}.hosting-screen .altdesc{font-size:12.5px;color:var(--text-3);line-height:1.45;margin-top:2px}.hosting-screen .altpick{font-size:12.5px;font-weight:600;color:var(--text-2);background:none;border:.5px solid var(--line-2);border-radius:9px;padding:8px 14px;cursor:pointer;white-space:nowrap;transition:.15s;font-family:inherit}.hosting-screen .altpick:hover{color:var(--text);border-color:var(--text-3)}.hosting-screen .faq{margin-top:14px;border:.5px solid var(--line);border-radius:14px;background:var(--panel-2);overflow:hidden}.hosting-screen .faqitem{border-bottom:.5px solid var(--line)}.hosting-screen .faqitem:last-child{border-bottom:none}.hosting-screen .faqq{width:100%;text-align:left;display:flex;align-items:center;gap:12px;padding:15px 18px;background:none;border:none;color:var(--text);font-size:14px;font-weight:600;cursor:pointer;font-family:inherit}.hosting-screen .faqq .chev{margin-left:auto;color:var(--text-4);transition:transform .2s;font-size:12px}.hosting-screen .faqq.open .chev{transform:rotate(180deg)}.hosting-screen .faqa{font-size:13.5px;color:var(--text-3);line-height:1.6;padding:0 18px 16px;max-width:640px}.setup-topic .faq{margin-top:22px;border:none;border-top:.5px solid var(--line);border-radius:0;background:transparent}.setup-topic .seclabel{margin-top:40px;color:var(--text-4)}.setup-topic .faqq{color:var(--text-2);font-weight:500;font-size:13.5px;padding:13px 4px}.setup-topic .faqa{padding:0 4px 14px}.hosting-screen .setup-ill{position:relative;border:.5px solid var(--line);border-radius:18px;background:linear-gradient(180deg,rgba(255,255,255,.02),transparent);padding:30px 28px;margin-top:2px;overflow:hidden}.hosting-screen .setup-ill .ill-cap{margin-top:18px;text-align:center;font-size:12.5px;color:var(--text-3)}.hosting-screen .ill-split{display:flex;align-items:stretch;gap:16px}.hosting-screen .isplit{flex:1;border:.5px solid var(--line);border-radius:14px;padding:16px 18px;background:#ffffff03}.hosting-screen .isplit.after{border-color:#c7f04a59;background:#c7f04a0d}.hosting-screen .isplit-tag{font-size:11px;font-weight:700;letter-spacing:.09em;text-transform:uppercase;color:var(--text-4);margin-bottom:12px}.hosting-screen .isplit.after .isplit-tag{color:#c7f04a}.hosting-screen .isplit-row{display:flex;align-items:center;gap:10px;font-size:14px;color:var(--text-2);padding:6px 0}.hosting-screen .isplit-row .mk{width:18px;text-align:center;color:var(--text-4)}.hosting-screen .isplit.after .isplit-row .mk{color:#c7f04a}.hosting-screen .isplit-arrow{align-self:center;color:var(--text-4);font-size:18px}.hosting-screen .ill-stack{display:flex;flex-direction:column;gap:10px;max-width:540px;margin:0 auto}.hosting-screen .istack-row{display:flex;align-items:center;gap:14px;border:.5px solid var(--line);border-radius:12px;padding:12px 16px;background:#ffffff03}.hosting-screen .istack-row.lime{border-color:#c7f04a66;background:#c7f04a0f}.hosting-screen .istack-emoji{font-size:22px;width:28px;text-align:center}.hosting-screen .istack-lbl{font-weight:600;font-size:14px;color:var(--text)}.hosting-screen .istack-sub{font-size:12.5px;color:var(--text-3);margin-left:auto}.hosting-screen .ill-orbit{display:flex;align-items:center;justify-content:center;gap:34px;flex-wrap:wrap}.hosting-screen .iorbit-center{display:flex;flex-direction:column;align-items:center;gap:10px}.hosting-screen .iorbit-tile{width:76px;height:76px;border-radius:18px;display:flex;align-items:center;justify-content:center;font-size:34px;background:#c7f04a1f;border:.5px solid rgba(199,240,74,.4);box-shadow:0 0 0 5px #c7f04a0d}.hosting-screen .iorbit-lbl{font-size:14px;font-weight:600;color:var(--text)}.hosting-screen .iorbit-sats{display:flex;flex-direction:column;gap:10px}.hosting-screen .iorbit-sat{display:flex;align-items:center;gap:10px;border:.5px solid var(--line);border-radius:999px;padding:8px 16px 8px 12px;font-size:13px;color:var(--text-2);background:#ffffff03}.hosting-screen .ill-bars{display:flex;align-items:flex-end;justify-content:center;gap:18px;height:148px}.hosting-screen .ibar{width:46px;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;gap:8px}.hosting-screen .ibar-fill{width:100%;border-radius:7px 7px 3px 3px;background:#ffffff14;min-height:8px}.hosting-screen .ibar.lime .ibar-fill{background:#c7f04a8c}.hosting-screen .ibar-lbl{font-size:11px;color:var(--text-3);text-align:center}.hosting-screen .ill-emblem{display:flex;flex-direction:column;align-items:center;gap:18px;text-align:center}.hosting-screen .iemblem-tile{width:88px;height:88px;border-radius:22px;display:flex;align-items:center;justify-content:center;font-size:42px;background:#c7f04a1f;border:.5px solid rgba(199,240,74,.4);box-shadow:0 0 0 6px #c7f04a0d}.hosting-screen .iemblem-chips{display:flex;gap:8px;flex-wrap:wrap;justify-content:center}.hosting-screen .iemblem-chip{border:.5px solid var(--line);border-radius:999px;padding:7px 14px;font-size:12.5px;color:var(--text-2);background:#ffffff03}.hosting-screen .ill-channels{display:flex;flex-direction:column;gap:18px;max-width:560px;margin:0 auto}.hosting-screen .ichan{display:flex;align-items:center;gap:16px}.hosting-screen .ichan-lbl{width:92px;font-size:13px;font-weight:600;color:var(--text-2);text-align:right}.hosting-screen .ichan-track{flex:1;display:flex;align-items:center;gap:10px}.hosting-screen .ichan-dot{width:12px;height:12px;border-radius:50%;background:var(--line)}.hosting-screen .ichan.on .ichan-lbl{color:#c7f04a}.hosting-screen .ichan.on .ichan-dot{background:#c7f04a99}.hosting-screen .ichan-line{flex:1;height:.5px;background:var(--line)}.hosting-screen .ask{margin-top:26px}.hosting-screen .askrow{display:flex;gap:10px;align-items:stretch}.hosting-screen .askrow input{flex:1;font-family:inherit;font-size:14px;color:var(--text);background:var(--panel-2);border:.5px solid var(--line-2);border-radius:12px;padding:14px 16px;outline:none;transition:.15s}.hosting-screen .askrow input::placeholder{color:var(--text-4)}.hosting-screen .askrow input:focus{border-color:var(--blue)}.hosting-screen .askrow button{width:50px;border-radius:12px;background:var(--panel-3);border:.5px solid var(--line-2);color:var(--text-2);font-size:17px;cursor:pointer;transition:.15s}.hosting-screen .askrow button:hover{background:#252525;color:var(--text)}.hosting-screen .asknote{font-size:11.5px;color:var(--text-4);margin-top:9px;display:flex;align-items:center;gap:6px}.hosting-screen .askans{display:flex;gap:11px;margin-top:14px;border:.5px solid rgba(133,183,235,.25);background:#85b7eb0f;border-radius:13px;padding:14px 16px;animation:home-fade .25s ease}.hosting-screen .askav{font-family:var(--mono);font-size:12px;font-weight:700;color:var(--lime);flex-shrink:0;width:26px;height:26px;border-radius:8px;background:#000;display:flex;align-items:center;justify-content:center}.hosting-screen .askans .at{font-size:13.5px;color:var(--text-2);line-height:1.6}.hosting-screen .setup-extlink{display:inline-flex;align-items:center;gap:8px;margin-top:10px;padding:9px 14px;border-radius:10px;font-size:13.5px;font-weight:600;text-decoration:none;color:var(--blue);background:var(--panel-2);border:.5px solid var(--line-2);transition:.15s}.hosting-screen .setup-extlink:hover{background:var(--panel-3);border-color:var(--blue)}.hosting-screen .setup-extlink-glyph{font-size:13px;opacity:.85}.hosting-screen .setup-note{margin-top:14px;padding:14px 16px;border:.5px solid var(--line-2);background:var(--panel-2);border-radius:13px;font-size:13.5px;line-height:1.6;color:var(--text-2)}.hosting-screen .setup-note p{margin:0}.hosting-screen .setup-note p+p{margin-top:10px}.hosting-screen .setup-note b{color:var(--text)}.hosting-screen .setup-note-links{display:flex;flex-wrap:wrap;gap:10px;margin-top:6px}.hosting-screen .setup-note-links .setup-extlink{margin-top:6px}.hosting-screen .cta-wrap{margin-top:28px}.hosting-screen .cta{width:100%;display:flex;align-items:center;justify-content:center;gap:10px;font-size:16px;font-weight:700;color:var(--action-fg);background:var(--action-bg);border:none;border-radius:14px;padding:18px;cursor:pointer;transition:.15s;font-family:inherit}.hosting-screen .cta:hover{background:#d4f76a;transform:translateY(-1px)}.hosting-screen .cta .ce{font-size:18px}.hosting-screen .cta-note{font-size:12.5px;color:var(--text-4);text-align:center;margin-top:13px;display:flex;align-items:center;justify-content:center;gap:6px}.hosting-screen .cta-done,.run-locally-screen .cta-done{display:flex;align-items:center;gap:12px;width:100%;border:.5px solid rgba(155,211,90,.4);background:#9bd35a0f;border-radius:14px;padding:16px 18px}.hosting-screen .cta-done-check,.run-locally-screen .cta-done-check{display:inline-flex;align-items:center;gap:10px;font-size:15px;font-weight:700;color:var(--green)}.hosting-screen .cta-done-check .ce,.run-locally-screen .cta-done-check .ce{font-size:18px}.hosting-screen .cta-done-actions,.run-locally-screen .cta-done-actions{display:flex;align-items:center;gap:8px;margin-left:auto}.hosting-screen .cta-done .lf-back,.run-locally-screen .cta-done .lf-back{font-size:13.5px;font-weight:600;color:#0a0a0a;background:var(--lime);border:none;border-radius:11px;padding:11px 18px;cursor:pointer;transition:.15s;white-space:nowrap;font-family:inherit}.hosting-screen .cta-done .lf-back:hover,.run-locally-screen .cta-done .lf-back:hover{background:#d4f76a}.hosting-screen .cta-revert,.run-locally-screen .cta-revert,.hosting-screen .live-foot .lf-revert{font-size:13px;font-weight:600;color:var(--text-4);background:transparent;border:none;border-radius:11px;padding:11px 12px;cursor:pointer;transition:.15s;white-space:nowrap;font-family:inherit}.hosting-screen .cta-revert:hover,.run-locally-screen .cta-revert:hover,.hosting-screen .live-foot .lf-revert:hover{color:var(--text-1);background:#7f7f7f1f}.hosting-screen .reason-foot{font-size:12.5px;line-height:1.5;color:var(--text-4);margin:12px 0 0;padding-top:11px;border-top:1px solid var(--border-1, rgba(255, 255, 255, .07))}.hosting-screen .flowbar{display:flex;align-items:center;gap:8px;margin-bottom:26px;font-size:12px;font-family:var(--mono)}.hosting-screen .flowbar .fstep{display:flex;align-items:center;gap:7px;color:var(--text-4);white-space:nowrap}.hosting-screen .flowbar .fstep .fn{width:20px;height:20px;border-radius:50%;border:1.5px solid var(--line-2);display:flex;align-items:center;justify-content:center;font-size:10.5px;color:var(--text-4)}.hosting-screen .flowbar .fstep.done .fn{background:var(--green);border-color:var(--green);color:#0a0a0a}.hosting-screen .flowbar .fstep.active{color:var(--text)}.hosting-screen .flowbar .fstep.active .fn{border-color:var(--lime);color:var(--lime)}.hosting-screen .flowbar .fsep{flex:1;max-width:38px;height:1px;background:var(--line-2)}.hosting-screen .panel{border:.5px solid var(--line);border-radius:18px;background:var(--panel-2);padding:26px 28px}.hosting-screen .panel .ph{font-size:19px;font-weight:700;letter-spacing:-.01em;margin-bottom:6px;display:flex;align-items:center;gap:10px}.hosting-screen .panel .psub{font-size:14px;color:var(--text-3);line-height:1.55;margin-bottom:22px;max-width:600px}.hosting-screen .connect-box{border:.5px solid var(--line-2);border-radius:14px;background:var(--panel-3);padding:22px;margin-bottom:18px}.hosting-screen .connect-box .cbtitle{display:flex;align-items:center;gap:12px;margin-bottom:18px}.hosting-screen .connect-box .cbtitle .pv-logo{width:42px;height:42px}.hosting-screen .connect-box .cbt{font-size:15px;font-weight:600}.hosting-screen .connect-box .cbd{font-size:12.5px;color:var(--text-3);margin-top:2px}.hosting-screen .grant{display:flex;flex-direction:column;gap:11px;margin-bottom:20px}.hosting-screen .grantrow{display:flex;align-items:flex-start;gap:10px;font-size:13px;color:var(--text-2);line-height:1.4}.hosting-screen .grantrow svg{margin-top:2px;flex-shrink:0}.hosting-screen .grantrow b{color:var(--text);font-weight:600}.hosting-screen .auth-btn{width:100%;display:flex;align-items:center;justify-content:center;gap:10px;font-size:14.5px;font-weight:700;color:#fff;background:#000;border:.5px solid var(--line-2);border-radius:12px;padding:14px;cursor:pointer;transition:.15s;font-family:inherit}.hosting-screen .auth-btn:hover{background:#111;border-color:var(--text-4)}.hosting-screen .auth-row{display:flex;gap:11px;margin-top:11px}.hosting-screen .auth-ghost{flex:1;font-size:13px;font-weight:600;color:var(--text-3);background:none;border:.5px solid var(--line-2);border-radius:11px;padding:12px;cursor:pointer;transition:.15s;font-family:inherit}.hosting-screen .auth-ghost:hover{color:var(--text);border-color:var(--text-3)}.hosting-screen .reassure{font-size:12.5px;color:var(--text-4);line-height:1.55;margin-top:18px;display:flex;align-items:flex-start;gap:7px}.hosting-screen .deploy-head{display:flex;align-items:center;gap:14px;margin-bottom:20px}.hosting-screen .deploy-spin{width:46px;height:46px;border-radius:13px;flex-shrink:0;display:flex;align-items:center;justify-content:center;background:var(--green-soft)}.hosting-screen .deploy-spin:after{content:"";width:23px;height:23px;border-radius:50%;border:2.5px solid var(--green);border-top-color:transparent;animation:home-spin 1s linear infinite}.hosting-screen .deploy-t{font-size:17px;font-weight:700}.hosting-screen .deploy-d{font-size:13px;color:var(--text-3);margin-top:2px}.hosting-screen .dep-bar{height:6px;background:var(--panel-3);border-radius:4px;overflow:hidden;margin-bottom:22px}.hosting-screen .dep-bar>div{height:100%;background:var(--green);border-radius:4px;transition:width .5s ease}.hosting-screen .dep-steps{display:flex;flex-direction:column;gap:2px}.hosting-screen .dep-step{display:flex;align-items:flex-start;gap:13px;padding:9px 0;position:relative}.hosting-screen .dep-step .dot{width:21px;height:21px;border-radius:50%;flex-shrink:0;display:flex;align-items:center;justify-content:center;z-index:1;background:var(--panel-3);border:1.5px solid var(--line-2)}.hosting-screen .dep-step:not(:last-child):before{content:"";position:absolute;left:10px;top:26px;bottom:-7px;width:1px;background:var(--line-2)}.hosting-screen .dep-step.done .dot{background:var(--green);border-color:var(--green)}.hosting-screen .dep-step.done:not(:last-child):before{background:#9bd35a66}.hosting-screen .dep-step.active .dot{border:none;background:transparent}.hosting-screen .dep-step.active .dot:after{content:"";width:19px;height:19px;border-radius:50%;border:2px solid var(--green);border-top-color:transparent;animation:home-spin 1s linear infinite}.hosting-screen .dep-step .sl{font-size:14px;color:var(--text-4);line-height:1.4;padding-top:1px}.hosting-screen .dep-step.done .sl{color:var(--text-3)}.hosting-screen .dep-step.active .sl{color:var(--text);font-weight:600}.hosting-screen .live-hero{text-align:center;padding:6px 0 22px}.hosting-screen .live-hero .lh-em{font-size:42px}.hosting-screen .live-hero .lh-t{font-size:23px;font-weight:800;letter-spacing:-.02em;margin-top:10px}.hosting-screen .live-hero .lh-d{font-size:14px;color:var(--text-3);margin-top:7px}.hosting-screen .url-card{display:flex;align-items:center;gap:14px;border:.5px solid rgba(155,211,90,.35);background:#9bd35a0d;border-radius:14px;padding:16px 18px;margin-bottom:14px}.hosting-screen .url-card .ucglobe{font-size:22px}.hosting-screen .url-card .uc-l{font-size:11px;color:var(--text-4);text-transform:uppercase;letter-spacing:.07em;font-weight:700}.hosting-screen .url-card .uc-u{font-family:var(--mono);font-size:15px;color:var(--text);margin-top:3px;white-space:nowrap}.hosting-screen .url-card .uc-actions{margin-left:auto;display:flex;gap:9px;flex-shrink:0}.hosting-screen .btn-copy,.hosting-screen .btn-visit{font-size:13px;font-weight:600;border-radius:10px;padding:10px 15px;cursor:pointer;transition:.15s;white-space:nowrap;border:.5px solid var(--line-2);font-family:inherit}.hosting-screen .btn-copy{color:var(--text-2);background:var(--panel-3)}.hosting-screen .btn-copy:hover{color:var(--text)}.hosting-screen .btn-visit{color:#0a0a0a;background:var(--lime);border-color:var(--lime)}.hosting-screen .btn-visit:hover{background:#d4f76a}.hosting-screen .domain-row{display:flex;align-items:center;gap:13px;border:.5px solid var(--line);border-radius:13px;background:var(--panel-2);padding:15px 17px;margin-bottom:14px}.hosting-screen .domain-row .dre{font-size:19px}.hosting-screen .domain-row .drt{font-size:13.5px;font-weight:600}.hosting-screen .domain-row .drd{font-size:12px;color:var(--text-3);margin-top:1px}.hosting-screen .domain-row .drbtn{margin-left:auto;font-size:12.5px;font-weight:600;color:var(--blue);background:#85b7eb1a;border:.5px solid rgba(133,183,235,.25);border-radius:9px;padding:8px 14px;cursor:pointer;transition:.15s;font-family:inherit}.hosting-screen .domain-row .drbtn:hover{background:#85b7eb29;color:var(--text)}.hosting-screen .live-foot{display:flex;align-items:center;gap:12px;margin-top:20px}.hosting-screen .live-foot .done-pill{display:inline-flex;align-items:center;gap:8px;font-size:13px;font-weight:600;color:var(--green);white-space:nowrap}.hosting-screen .live-foot .lf-back{margin-left:auto;font-size:13.5px;font-weight:600;color:#0a0a0a;background:var(--lime);border:none;border-radius:11px;padding:11px 18px;cursor:pointer;transition:.15s;white-space:nowrap;font-family:inherit}.hosting-screen .live-foot .lf-back:hover{background:#d4f76a}.hosting-screen .conn-card{display:flex;align-items:center;gap:16px;border:.5px solid rgba(155,211,90,.4);background:#9bd35a0f;border-radius:16px;padding:16px 18px;margin-bottom:28px}.hosting-screen .conn-card .pv-logo{width:44px;height:44px}.hosting-screen .conn-body{flex:1;min-width:0}.hosting-screen .conn-top{display:flex;align-items:center;gap:11px}.hosting-screen .conn-name{font-size:16px;font-weight:700}.hosting-screen .conn-live{display:inline-flex;align-items:center;gap:7px;font-size:12px;font-weight:600;color:var(--green);font-family:var(--mono)}.hosting-screen .conn-live .lbdot{width:8px;height:8px;border-radius:50%;background:var(--green);box-shadow:0 0 0 4px #9bd35a2e}.hosting-screen .conn-acct{font-size:12.5px;color:var(--text-3);margin-top:3px}.hosting-screen .conn-acct b{color:var(--text-2);font-weight:600;font-family:var(--mono)}.hosting-screen .conn-disc{font-size:12.5px;font-weight:600;color:var(--text-3);background:none;border:.5px solid var(--line-2);border-radius:9px;padding:9px 14px;cursor:pointer;white-space:nowrap;transition:.15s;font-family:inherit}.hosting-screen .conn-disc:hover{color:#e98b8b;border-color:#e98b8b66}.hosting-screen .dep-card{border:.5px solid var(--line);border-radius:14px;background:var(--panel-2);overflow:hidden}.hosting-screen .depc-row{display:flex;align-items:center;gap:13px;padding:16px 18px}.hosting-screen .depc-dot{width:9px;height:9px;border-radius:50%;background:var(--green);box-shadow:0 0 0 4px #9bd35a29;flex-shrink:0}.hosting-screen .depc-main{flex:1;min-width:0}.hosting-screen .depc-t{font-size:14px;font-weight:600}.hosting-screen .depc-d{font-size:12.5px;color:var(--text-3);margin-top:2px}.hosting-screen .depc-btn{font-size:12.5px;font-weight:600;color:var(--text-2);background:var(--panel-3);border:.5px solid var(--line-2);border-radius:9px;padding:9px 15px;cursor:pointer;white-space:nowrap;transition:.15s;font-family:inherit}.hosting-screen .depc-btn:hover{color:var(--text);border-color:var(--text-3)}.hosting-screen .live-banner{display:flex;align-items:center;gap:14px;border:.5px solid rgba(155,211,90,.4);background:#9bd35a0f;border-radius:16px;padding:18px 20px;margin-bottom:24px}.hosting-screen .live-banner .lbdot{width:9px;height:9px;border-radius:50%;background:var(--green);box-shadow:0 0 0 4px #9bd35a2e;flex-shrink:0}.hosting-screen .live-banner .lbt{font-size:14.5px;font-weight:600}.hosting-screen .live-banner .lbu{font-family:var(--mono);font-size:12.5px;color:var(--green);margin-top:2px}.hosting-screen .live-banner .lbview{margin-left:auto;font-size:12.5px;font-weight:600;color:var(--green);background:#9bd35a1f;border:.5px solid rgba(155,211,90,.3);border-radius:9px;padding:8px 14px;cursor:pointer;text-decoration:none;font-family:inherit}.run-locally-screen .seclabel{font-size:11px;font-weight:700;letter-spacing:.09em;text-transform:uppercase;color:var(--text-4);margin:0 2px 11px}.run-locally-screen .rl-loading{color:var(--text-3);font-size:14px;padding:18px 2px}.run-locally-screen .setup-ai-assist{margin-bottom:24px}.run-locally-screen .rl-sec{margin-bottom:26px}.run-locally-screen .rl-prereqs,.run-locally-screen .rl-notes{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:10px}.run-locally-screen .rl-prereq{display:flex;flex-direction:column;gap:3px;border:.5px solid var(--line);border-radius:11px;background:var(--panel-2);padding:12px 15px}.run-locally-screen .rl-prereq-label{font-size:13.5px;font-weight:600;color:var(--text)}.run-locally-screen .rl-prereq-detail{font-size:12.5px;color:var(--text-3);line-height:1.5}.run-locally-screen .rl-load-steps{margin:0;padding:14px 16px 14px 38px;border:.5px solid var(--line);border-radius:11px;background:var(--panel-2);list-style:decimal outside;display:flex;flex-direction:column;gap:9px}.run-locally-screen .rl-load-step{font-size:13px;color:var(--text-2);line-height:1.55;padding-left:4px}.run-locally-screen .rl-load-step::marker{color:var(--text-4);font-weight:700}.run-locally-screen .rl-load-target{margin-top:10px;display:flex;flex-direction:column;gap:6px}.run-locally-screen .rl-load-target-label{font-size:12px;font-weight:600;color:var(--text-3)}.run-locally-screen .rl-cmd,.libraries-screen .rl-cmd,.lib-row .rl-cmd{display:flex;align-items:center;gap:10px;border:.5px solid var(--line);border-radius:11px;background:var(--panel-3);padding:11px 12px 11px 15px}.run-locally-screen .rl-cmd-text,.libraries-screen .rl-cmd-text,.lib-row .rl-cmd-text{flex:1;font-family:var(--mono);font-size:13px;color:var(--lime);overflow-x:auto;white-space:pre}.run-locally-screen .rl-copy,.libraries-screen .rl-copy,.lib-row .rl-copy{flex-shrink:0;font-size:11.5px;font-weight:600;color:var(--text-2);background:var(--panel);border:.5px solid var(--line);border-radius:8px;padding:6px 12px;cursor:pointer;font-family:inherit;transition:.15s}.run-locally-screen .rl-copy:hover,.libraries-screen .rl-copy:hover,.lib-row .rl-copy:hover{color:var(--text);border-color:var(--line-2)}.run-locally-screen .rl-reachable{font-size:13.5px;color:var(--text-2);line-height:1.6}.run-locally-screen .rl-url{color:var(--blue);text-decoration:none;font-family:var(--mono);font-size:13px}.run-locally-screen .rl-url:hover{text-decoration:underline}.run-locally-screen .rl-note{font-size:12.5px;color:var(--text-3);line-height:1.55}.run-locally-screen .cta-wrap{margin-top:28px}.run-locally-screen .cta{width:100%;display:flex;align-items:center;justify-content:center;gap:10px;font-size:15px;font-weight:700;color:var(--action-fg);background:var(--action-bg);border:none;border-radius:14px;padding:16px;cursor:pointer;transition:.15s;font-family:inherit}.run-locally-screen .cta:hover{background:#d4f76a;transform:translateY(-1px)}.learn-screen .setup-libraries-section{margin-top:26px}.learn-screen .setup-libraries-section .seclabel{font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.07em;color:var(--text-2);margin-bottom:10px}.libraries-screen .lib-loading,.libraries-screen .lib-empty-body{font-size:13.5px;color:var(--text-2);line-height:1.6}.libraries-screen .lib-empty{border:.5px solid var(--line);border-radius:12px;background:var(--panel-3);padding:22px;margin-top:8px}.libraries-screen .lib-empty-title{font-size:15px;font-weight:600;color:var(--text);margin-bottom:6px}.libraries-screen .lib-searchbar{margin:4px 0 16px}.libraries-screen .lib-search{width:100%;box-sizing:border-box;font-size:13.5px;font-family:inherit;color:var(--text);background:var(--panel-3);border:.5px solid var(--line);border-radius:10px;padding:10px 14px}.libraries-screen .lib-search:focus{outline:none;border-color:var(--line-2)}.libraries-screen .lib-groups{display:flex;flex-direction:column;gap:12px}.lib-group{border:.5px solid var(--line);border-radius:12px;background:var(--panel-2);overflow:hidden}.lib-group-head{display:flex;align-items:center;gap:10px;width:100%;padding:13px 15px;background:transparent;border:none;cursor:pointer;font-family:inherit;text-align:left}.lib-group-head:hover{background:var(--panel-3)}.lib-group-icon{display:inline-flex;color:var(--text-2)}.lib-group-title{font-size:14px;font-weight:600;color:var(--text)}.lib-group-count{font-size:12px;color:var(--text-2)}.lib-group-path{flex:1;font-family:var(--mono);font-size:11.5px;color:var(--text-3, var(--text-2));text-align:right;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.lib-group-chevron{font-size:12px;color:var(--text-2)}.lib-rows{display:flex;flex-direction:column;border-top:.5px solid var(--line)}.lib-row{display:flex;flex-direction:column;gap:8px;padding:14px 16px}.lib-row+.lib-row{border-top:.5px solid var(--line)}.lib-head{display:flex;align-items:center;gap:9px;flex-wrap:wrap}.lib-name{font-size:14px;font-weight:600;color:var(--text);font-family:var(--mono)}.lib-version{font-size:12px;font-family:var(--mono);color:var(--text-2)}.lib-kind{font-size:10.5px;font-weight:600;text-transform:uppercase;letter-spacing:.04em;padding:2px 7px;border-radius:6px;background:var(--panel-3);color:var(--text-2);border:.5px solid var(--line)}.lib-kind.dev{color:#c9a227}.lib-outdated{font-size:10.5px;font-weight:600;text-transform:uppercase;letter-spacing:.04em;padding:2px 7px;border-radius:6px;background:#d6606029;color:#d66060;border:.5px solid rgba(214,96,96,.4)}.lib-desc{font-size:13px;color:var(--text);line-height:1.55}.lib-desc.muted{color:var(--text-2);font-style:italic}.lib-meta{display:flex;align-items:center;gap:12px;flex-wrap:wrap;font-size:12px;color:var(--text-2)}.lib-tag{padding:2px 8px;border-radius:6px;background:var(--panel-3);border:.5px solid var(--line)}.lib-docs{color:var(--lime);text-decoration:none}.lib-docs:hover{text-decoration:underline}.learn-screen .setup-addrow{margin-top:22px;padding:16px 18px;border:.5px dashed var(--line-2);border-radius:13px;background:var(--panel-2);display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap}.learn-screen .setup-addrow-copy{font-size:13px;color:var(--text-3);line-height:1.5;max-width:420px}.learn-screen .setup-addrow-btns{display:flex;gap:10px;flex-shrink:0}.learn-screen .setup-addbtn{font-family:inherit;font-size:13px;font-weight:600;color:var(--text);background:var(--panel-3);border:.5px solid var(--line-2);border-radius:9px;padding:9px 14px;cursor:pointer;transition:.15s;white-space:nowrap}.learn-screen .setup-addbtn:hover{border-color:var(--blue);transform:translateY(-1px)}.learn-screen .setup-addbtn-ask{color:var(--blue);background:var(--blue-soft);border-color:var(--blue-300)}.learn-screen .atf-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;background:#00000073;z-index:40}.learn-screen .atf-modal{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);z-index:41;width:min(440px,calc(100vw - 48px));background:var(--panel);border:.5px solid var(--line-2);border-radius:16px;padding:24px;box-shadow:0 18px 48px #0006}.learn-screen .atf-title{font-size:17px;font-weight:700;color:var(--text)}.learn-screen .atf-lead{font-size:13px;color:var(--text-3);line-height:1.55;margin:8px 0 18px}.learn-screen .atf-field{display:block;margin-bottom:14px}.learn-screen .atf-label{display:block;font-size:12px;font-weight:600;color:var(--text-2);margin-bottom:6px}.learn-screen .atf-optional{font-weight:400;color:var(--text-4)}.learn-screen .atf-input{width:100%;box-sizing:border-box;font-family:inherit;font-size:14px;color:var(--text);background:var(--panel-2);border:.5px solid var(--line-2);border-radius:9px;padding:10px 12px;transition:.15s}.learn-screen .atf-input:focus{outline:none;border-color:var(--blue)}.learn-screen .atf-textarea{resize:vertical;min-height:44px;line-height:1.5}.learn-screen .atf-error{font-size:12.5px;color:var(--amber);margin:-4px 0 12px}.learn-screen .atf-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:6px}.learn-screen .atf-btn{font-family:inherit;font-size:13px;font-weight:600;border-radius:9px;padding:9px 16px;cursor:pointer;transition:.15s;border:.5px solid var(--line-2)}.learn-screen .atf-btn:disabled{opacity:.5;cursor:default}.learn-screen .atf-btn-ghost{color:var(--text-2);background:transparent}.learn-screen .atf-btn-ghost:hover:not(:disabled){background:var(--panel-3)}.learn-screen .atf-btn-primary{color:var(--action-fg);background:var(--action-bg);border-color:transparent}.learn-screen .atf-btn-primary:hover:not(:disabled){transform:translateY(-1px)}.hosting-screen .real-token-label{display:block;font-size:12px;font-weight:600;color:var(--text-2);margin:14px 0 6px}.hosting-screen .real-token-input{width:100%;box-sizing:border-box;padding:10px 12px;font-size:14px;font-family:inherit;color:var(--text-1);background:var(--panel-2);border:1px solid var(--border-1);border-radius:8px;margin-bottom:14px}.hosting-screen .real-token-input:focus{outline:none;border-color:var(--blue-300)}.hosting-screen .auth-btn:disabled{opacity:.5;cursor:not-allowed}.hosting-screen .real-error{background:color-mix(in srgb,var(--red, #e5484d) 12%,transparent);border:1px solid color-mix(in srgb,var(--red, #e5484d) 40%,transparent);border-radius:10px;padding:14px 16px;margin-bottom:16px}.hosting-screen .real-error-title{font-weight:600;color:var(--red, #e5484d);margin-bottom:4px}.hosting-screen .real-error-msg{font-size:13px;color:var(--text-2);word-break:break-word}.hosting-screen .dep-bar-indeterminate{width:40%;height:100%;background:var(--green);border-radius:4px;animation:real-provision-slide 1.1s ease-in-out infinite}@keyframes real-provision-slide{0%{transform:translate(-100%)}to{transform:translate(250%)}}.concept-term-wrap{position:relative;display:inline}.concept-term{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:none;border:none;padding:0;margin:0;font:inherit;color:inherit;cursor:pointer;text-decoration:underline dotted;text-underline-offset:2px;text-decoration-color:var(--accent, #6b8afd)}.concept-term:hover,.concept-term[aria-expanded=true]{color:var(--accent, #6b8afd)}.concept-popover{position:fixed;z-index:1000;display:block;width:300px;max-width:min(300px,80vw);padding:12px 14px;background:var(--surface, #1b1f2a);border:1px solid var(--border, #2c3242);border-radius:10px;box-shadow:0 8px 28px #00000059;text-align:left;white-space:normal;cursor:default}.concept-popover-term{display:block;font-weight:600;font-size:14px;color:var(--text-primary, #e8ebf2)}.concept-popover-cat{display:inline-block;margin:2px 0 6px;font-size:11px;letter-spacing:.02em;text-transform:uppercase;color:var(--text-tertiary, #8a92a6)}.concept-popover-body{display:block}.learn-screen .concepts-nudge{margin:0 0 18px;padding:12px 14px;font-size:13px;line-height:1.6;color:var(--text-secondary, #b6bdcc);background:var(--surface-muted, rgba(107, 138, 253, .08));border:1px solid var(--border, #2c3242);border-radius:10px}.learn-screen .concepts-nudge-link{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:none;border:none;padding:0;font:inherit;color:var(--accent, #6b8afd);cursor:pointer;text-decoration:underline}.setup-screen{--bg: var(--surface-page);--panel-2: var(--surface-card);--panel-3: var(--surface-raised);--inset: #0d0d0d;--line: var(--line-subtle);--line-2: var(--line-hair);--text: var(--text-strong);--text-2: var(--text-body);--text-3: var(--text-faint);--text-4: var(--text-subtle);--lime: var(--lime-300);--green: var(--green-300);--blue: var(--blue-300);--amber: var(--amber-300);--indigo: var(--indigo-300);--mono: "IBM Plex Mono", monospace;--sans: "IBM Plex Sans", sans-serif;--accent: var(--blue-300);--accent-soft: var(--blue-soft);background:var(--bg);font-family:var(--sans);color:var(--text);-webkit-font-smoothing:antialiased;padding:18px 28px 50px}.setup-screen.accent-blue{--accent: var(--blue-300);--accent-soft: var(--blue-soft)}.setup-screen.accent-amber{--accent: var(--amber-300);--accent-soft: var(--amber-soft)}.setup-screen.accent-green{--accent: var(--green-300);--accent-soft: var(--green-soft)}.setup-screen.accent-indigo{--accent: var(--indigo-300);--accent-soft: var(--indigo-soft)}.setup-screen *,.setup-screen *:before,.setup-screen *:after{box-sizing:border-box}.setup-screen .su-wrap{max-width:760px;margin:0 auto}.setup-screen .su-crumbs{display:flex;align-items:center;gap:8px;font-size:12.5px;color:var(--text-3);max-width:760px;margin:0 auto 18px}.setup-screen .su-crumbs .back,.setup-screen .su-crumbs button{background:none;border:none;cursor:pointer;color:var(--text-3);font:inherit;padding:0}.setup-screen .su-crumbs button:hover{color:var(--text-2)}.setup-screen .su-crumbs .sep{color:var(--text-4)}.setup-screen .su-crumbs b{color:var(--text-2);font-weight:600}.setup-screen .su-shead{display:flex;align-items:flex-start;gap:15px;margin-bottom:20px}.setup-screen .su-badge{width:48px;height:48px;border-radius:13px;flex-shrink:0;display:flex;align-items:center;justify-content:center;background:var(--accent-soft);color:var(--accent)}.setup-screen .su-title{font-size:22px;font-weight:700;letter-spacing:-.02em;display:flex;align-items:center;gap:11px}.setup-screen .su-chip{font-family:var(--mono);font-size:10px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;border-radius:6px;padding:3px 8px;transform:translateY(-2px);display:inline-flex;align-items:center;gap:5px}.setup-screen .su-chip.notset{color:var(--text-3);background:var(--panel-3);border:.5px solid var(--line-2)}.setup-screen .su-chip.connected{color:var(--green);background:var(--green-soft);border:.5px solid color-mix(in srgb,var(--green) 30%,transparent)}.setup-screen .su-via{display:inline-flex;align-items:center;gap:6px;font-size:11.5px;color:var(--text-3);font-family:var(--mono);margin-top:4px}.setup-screen .su-via b{color:var(--accent);font-weight:600}.setup-screen .su-lead{font-size:13.5px;color:var(--text-3);line-height:1.5;margin-top:9px}.setup-screen .su-explain{border:.5px solid var(--line);border-radius:16px;background:var(--panel-2);padding:20px 22px;margin-bottom:18px}.setup-screen .su-eh{font-size:14.5px;font-weight:700;letter-spacing:-.01em;display:flex;align-items:center;gap:9px}.setup-screen .su-q{width:22px;height:22px;border-radius:7px;background:var(--accent-soft);color:var(--accent);display:flex;align-items:center;justify-content:center;font-weight:800;font-size:13px;flex-shrink:0}.setup-screen .su-lede{font-size:13px;color:var(--text-2);line-height:1.55;margin-top:11px}.setup-screen .su-lede b{color:var(--text);font-weight:600}.setup-screen .su-erows{display:flex;flex-direction:column;gap:2px;margin-top:16px}.setup-screen .su-erow{display:flex;align-items:flex-start;gap:13px;padding:12px 0;border-top:.5px solid var(--line)}.setup-screen .su-en{width:30px;height:30px;border-radius:9px;flex-shrink:0;display:flex;align-items:center;justify-content:center;background:var(--panel-3);color:var(--accent)}.setup-screen .su-et{flex:1}.setup-screen .su-et b{font-size:13.5px;font-weight:600}.setup-screen .su-et span{display:block;font-size:12.5px;color:var(--text-3);line-height:1.5;margin-top:2px}.setup-screen .su-et span em{color:var(--text-2);font-style:normal;font-weight:500}.setup-screen .su-why{margin-top:16px;border:.5px solid var(--line);border-radius:13px;background:var(--inset);padding:15px 16px}.setup-screen .su-wh{font-size:12px;font-weight:700;color:var(--text-2);display:flex;align-items:center;gap:8px;margin-bottom:12px}.setup-screen .su-wh svg{color:var(--accent)}.setup-screen .su-whyrow{display:flex;align-items:flex-start;gap:11px}.setup-screen .su-whyrow+.su-whyrow{margin-top:10px}.setup-screen .su-wc{width:18px;height:18px;border-radius:50%;background:var(--accent-soft);color:var(--accent);display:flex;align-items:center;justify-content:center;flex-shrink:0;margin-top:1px}.setup-screen .su-whyrow p{font-size:12.5px;color:var(--text-2);line-height:1.5}.setup-screen .su-whyrow p b{color:var(--text);font-weight:600}.setup-screen .su-connect{border:.5px solid color-mix(in srgb,var(--connect, var(--lime)) 30%,transparent);border-radius:16px;background:linear-gradient(135deg,color-mix(in srgb,var(--connect, var(--lime)) 7%,transparent),color-mix(in srgb,var(--connect, var(--lime)) 1.5%,transparent));padding:20px 22px;margin-bottom:13px}.setup-screen .su-ct{font-size:14.5px;font-weight:700}.setup-screen .su-cd{font-size:12.5px;color:var(--text-3);line-height:1.5;margin-top:5px}.setup-screen .su-cbtn{display:inline-flex;align-items:center;gap:10px;background:var(--connect, var(--lime));color:var(--bg);font-family:var(--sans);font-size:13.5px;font-weight:700;border:none;border-radius:11px;padding:13px 20px;cursor:pointer;transition:.15s;margin-top:16px}.setup-screen .su-cbtn:hover:not(:disabled){filter:brightness(1.08);transform:translateY(-1px)}.setup-screen .su-cbtn:disabled{cursor:default;opacity:.85}.setup-screen .su-reassure{display:flex;flex-wrap:wrap;gap:8px 18px;margin-top:14px}.setup-screen .su-reassure span{display:inline-flex;align-items:center;gap:7px;font-size:11.5px;color:var(--text-3)}.setup-screen .su-reassure span svg{color:var(--connect, var(--lime));flex-shrink:0}.setup-screen .su-alt-toggle{display:inline-flex;align-items:center;gap:7px;margin:0 2px 14px;font-family:var(--sans);font-size:12.5px;font-weight:600;color:var(--text-3);background:none;border:none;cursor:pointer;transition:.15s}.setup-screen .su-alt-toggle:hover{color:var(--text-2)}.setup-screen .su-chev{transition:transform .2s;font-size:11px;line-height:1}.setup-screen .su-chev.open{transform:rotate(180deg)}.setup-screen .su-alts{display:flex;flex-direction:column;gap:9px;margin-bottom:22px}.setup-screen .su-altrow{display:flex;align-items:center;gap:13px;border:.5px solid var(--line);border-radius:12px;background:var(--panel-2);padding:12px 14px}.setup-screen .su-altmark{width:38px;height:38px;border-radius:10px;display:flex;align-items:center;justify-content:center;flex-shrink:0;font-weight:800;font-size:16px;color:#fff;font-family:var(--mono)}.setup-screen .su-altbody{flex:1;min-width:0}.setup-screen .su-altname{font-size:13.5px;font-weight:600}.setup-screen .su-altdesc{font-size:12px;color:var(--text-3);line-height:1.45;margin-top:2px}.setup-screen .su-altfact{display:flex;align-items:center;flex-wrap:wrap;font-size:12px;font-weight:600;color:var(--text-2);margin-top:4px}.setup-screen .su-altpick{font-family:var(--sans);font-size:12px;font-weight:600;color:var(--text-2);background:none;border:.5px solid var(--line-2);border-radius:9px;padding:8px 13px;cursor:pointer;white-space:nowrap;transition:.15s}.setup-screen .su-altpick:hover{color:var(--text);border-color:var(--text-3)}.setup-screen .su-altpick.picked{color:var(--accent);border-color:color-mix(in srgb,var(--accent) 50%,transparent)}.setup-screen .su-uplabel{font-size:11px;font-weight:700;letter-spacing:.07em;text-transform:uppercase;color:var(--text-4);margin:0 2px 12px}.setup-screen .su-locked{display:flex;flex-direction:column;gap:9px}.setup-screen .su-lrow{display:flex;align-items:center;gap:13px;border:.5px solid var(--line);border-radius:12px;background:color-mix(in srgb,var(--panel-2) 50%,transparent);padding:13px 15px;opacity:.62}.setup-screen .su-ln{width:30px;height:30px;border-radius:9px;flex-shrink:0;display:flex;align-items:center;justify-content:center;background:var(--panel-3);color:var(--text-4)}.setup-screen .su-lt b{font-size:13.5px;font-weight:600;color:var(--text-2)}.setup-screen .su-lt span{display:block;font-size:12px;color:var(--text-4);line-height:1.45;margin-top:2px}.setup-screen .su-lk{margin-left:auto;color:var(--text-4);flex-shrink:0;display:flex}.setup-screen .su-statusbar,.setup-screen .su-remember,.setup-screen .su-modebar{display:flex;align-items:center;gap:11px;margin:20px 0 24px;padding:11px 14px;border:.5px solid var(--line);border-radius:12px;background:var(--panel-2)}.setup-screen .su-statusbar{border-color:color-mix(in srgb,var(--green) 28%,transparent);background:linear-gradient(120deg,color-mix(in srgb,var(--green) 6%,transparent),transparent 70%)}.setup-screen .su-remember{background:linear-gradient(120deg,color-mix(in srgb,var(--green) 6%,transparent),transparent 70%)}.setup-screen .su-widget-ic{width:30px;height:30px;border-radius:9px;display:flex;align-items:center;justify-content:center;flex-shrink:0;background:var(--green-soft);color:var(--green)}.setup-screen .su-modebar .su-widget-ic{background:var(--amber-soft);color:var(--amber)}.setup-screen .su-widget-body{flex:1;min-width:0}.setup-screen .su-widget-body b{font-size:13px;font-weight:600}.setup-screen .su-widget-body span{display:block;font-size:11.5px;color:var(--text-3);margin-top:1px}.setup-screen .su-widget-body code{font-family:var(--mono);color:var(--green)}.setup-screen .su-rdot{width:8px;height:8px;border-radius:50%;background:var(--green);flex-shrink:0;box-shadow:0 0 0 4px color-mix(in srgb,var(--green) 12%,transparent)}.setup-screen .su-ago{margin-left:auto;flex-shrink:0;font-family:var(--mono);font-size:10.5px;color:var(--text-4);white-space:nowrap}.setup-screen .su-chg{font-size:12px;color:var(--text-3);cursor:pointer;background:none;border:.5px solid var(--line-2);border-radius:8px;padding:7px 12px;font-family:var(--sans);flex-shrink:0}.setup-screen .su-chg:hover{color:var(--text);border-color:var(--text-3)}.setup-screen .su-seg{display:inline-flex;background:var(--inset);border:.5px solid var(--line);border-radius:10px;padding:3px;gap:3px;flex-shrink:0}.setup-screen .su-seg button{font-family:var(--sans);font-size:12px;font-weight:600;color:var(--text-3);background:none;border:none;cursor:pointer;padding:7px 13px;border-radius:7px;transition:.15s}.setup-screen .su-seg button.on{background:var(--panel-3);color:var(--text);box-shadow:inset 0 0 0 .5px var(--line-2)}.setup-screen .su-seg button.on.live{color:var(--green)}.setup-screen .su-seclabel{font-size:11px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--text-4);margin:0 2px 13px}.setup-screen .su-steps{position:relative;padding-left:6px}.setup-screen .su-step{position:relative;display:flex;gap:16px;padding-bottom:22px}.setup-screen .su-step:last-child{padding-bottom:0}.setup-screen .su-rail{position:relative;flex-shrink:0;display:flex;flex-direction:column;align-items:center}.setup-screen .su-node{width:28px;height:28px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-family:var(--mono);font-size:12px;font-weight:700;flex-shrink:0;z-index:1}.setup-screen .su-node.done{background:var(--lime);color:var(--bg)}.setup-screen .su-node.todo{background:var(--panel-3);color:var(--text-2);border:.5px solid var(--line-2)}.setup-screen .su-line{flex:1;width:1.5px;background:var(--line-2);margin:4px 0}.setup-screen .su-step:last-child .su-line{display:none}.setup-screen .su-scon{flex:1;min-width:0;padding-top:3px}.setup-screen .su-stitle{font-size:14.5px;font-weight:600;display:flex;align-items:center;gap:9px}.setup-screen .su-pill{font-family:var(--mono);font-size:10px;font-weight:600;letter-spacing:.03em;text-transform:uppercase;padding:2px 7px;border-radius:6px;color:var(--green);background:var(--green-soft)}.setup-screen .su-sdesc{font-size:12.5px;color:var(--text-3);line-height:1.5;margin-top:5px}.setup-screen .su-methods{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}.setup-screen .su-mchip{display:inline-flex;align-items:center;gap:8px;font-size:12.5px;font-weight:500;color:var(--text-2);background:var(--panel-2);border:.5px solid var(--line);border-radius:10px;padding:9px 12px;cursor:pointer;transition:.15s;font-family:var(--sans)}.setup-screen .su-mchip:hover{border-color:var(--line-2)}.setup-screen .su-mchip .su-ck{width:16px;height:16px;border-radius:5px;border:1.5px solid var(--line-2);display:flex;align-items:center;justify-content:center;flex-shrink:0}.setup-screen .su-mchip .su-ck svg{opacity:0}.setup-screen .su-mchip.on{border-color:color-mix(in srgb,var(--accent) 50%,transparent);background:color-mix(in srgb,var(--accent) 8%,transparent);color:var(--text)}.setup-screen .su-mchip.on .su-ck{background:var(--accent);border-color:var(--accent);color:var(--bg)}.setup-screen .su-mchip.on .su-ck svg{opacity:1}.setup-screen .su-acct{display:flex;align-items:center;gap:11px;margin-top:11px;border:.5px solid var(--line);border-radius:11px;background:var(--panel-2);padding:11px 13px}.setup-screen .su-av{width:30px;height:30px;border-radius:8px;background:var(--accent);color:var(--bg);font-weight:700;font-size:13px;display:flex;align-items:center;justify-content:center;flex-shrink:0;font-family:var(--mono)}.setup-screen .su-ainfo{flex:1;min-width:0}.setup-screen .su-ainfo b{font-size:13px;font-weight:600}.setup-screen .su-ainfo span{display:block;font-size:11.5px;color:var(--text-3);font-family:var(--mono);margin-top:1px}.setup-screen .su-field{margin-top:11px;border:.5px solid var(--line);border-radius:11px;background:var(--panel-2);padding:13px 14px;font-size:13.5px;color:var(--text);line-height:1.55}.setup-screen .su-edit{float:right;font-size:12px;color:var(--blue);cursor:pointer;margin-left:12px}.setup-screen .su-field b{font-weight:600}.setup-screen .su-examples{display:flex;flex-wrap:wrap;gap:7px;margin-top:11px}.setup-screen .su-ex{font-size:11.5px;color:var(--text-3);background:var(--bg);border:.5px solid var(--line);border-radius:8px;padding:6px 10px;cursor:pointer;transition:.15s;font-family:var(--sans)}.setup-screen .su-ex:hover{border-color:var(--line-2);color:var(--text-2)}.setup-screen .su-ex.added{border-color:color-mix(in srgb,var(--blue) 50%,transparent);color:var(--blue)}.setup-screen .su-plus{color:var(--blue);margin-right:5px;font-weight:600}.setup-screen .su-builds{margin-top:12px;display:flex;flex-direction:column;gap:8px}.setup-screen .su-bitem{display:flex;align-items:flex-start;gap:11px;border:.5px solid var(--line);border-radius:11px;background:var(--panel-2);padding:12px 14px}.setup-screen .su-bx{width:22px;height:22px;border-radius:7px;background:var(--lime-soft);color:var(--lime);display:flex;align-items:center;justify-content:center;flex-shrink:0;margin-top:1px}.setup-screen .su-bmain{flex:1;min-width:0}.setup-screen .su-bmain b{font-size:13.5px;font-weight:600}.setup-screen .su-bmain span{display:block;font-size:12px;color:var(--text-3);line-height:1.45;margin-top:2px}.setup-screen .su-where{margin-left:auto;flex-shrink:0;font-family:var(--mono);font-size:10.5px;color:var(--text-4);border:.5px solid var(--line);border-radius:6px;padding:3px 7px;white-space:nowrap;align-self:center}.setup-screen .su-learn{border:.5px solid var(--line);border-radius:14px;background:var(--panel-2);padding:15px 16px;margin-bottom:24px}.setup-screen .su-lhd{display:flex;align-items:center;gap:9px;font-size:11px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--amber);margin-bottom:9px}.setup-screen .su-learn p{font-size:13px;color:var(--text-2);line-height:1.55}.setup-screen .su-learn p+p{margin-top:8px}.setup-screen .su-learn b{color:var(--text);font-weight:600}.setup-screen .su-note{display:flex;gap:11px;margin-top:16px;border:.5px solid color-mix(in srgb,var(--note-accent, var(--blue)) 28%,transparent);background:linear-gradient(120deg,color-mix(in srgb,var(--note-accent, var(--blue)) 6%,transparent),transparent 70%);border-radius:12px;padding:13px 15px}.setup-screen .su-note svg{color:var(--note-accent, var(--blue));flex-shrink:0;margin-top:1px}.setup-screen .su-note p{font-size:12.5px;color:var(--text-2);line-height:1.5}.setup-screen .su-note p b{color:var(--note-accent, var(--blue))}.setup-screen .su-foot{display:flex;align-items:center;gap:14px;margin-top:24px;padding-top:20px;border-top:.5px solid var(--line)}.setup-screen .su-cta{display:inline-flex;align-items:center;gap:9px;background:var(--lime);color:var(--bg);font-family:var(--sans);font-size:13.5px;font-weight:700;border:none;border-radius:11px;padding:13px 19px;cursor:pointer;transition:.15s;white-space:nowrap}.setup-screen .su-cta:hover:not(:disabled){filter:brightness(1.06);transform:translateY(-1px)}.setup-screen .su-cta:disabled{cursor:default}.setup-screen .su-ar{font-size:16px;margin-top:-1px}.setup-screen .su-fnote{font-size:12px;color:var(--text-3);line-height:1.45}.setup-screen .su-fnote b{color:var(--text-2)}@keyframes su-spin{to{transform:rotate(360deg)}}.setup-screen .su-spin{animation:su-spin .8s linear infinite}.concepts-glossary .concept-search{width:100%;box-sizing:border-box;margin:4px 0 16px;padding:10px 12px;font:inherit;font-size:14px;color:var(--text-primary, #e8ebf2);background:var(--surface, #1b1f2a);border:1px solid var(--border, #2c3242);border-radius:10px}.concepts-glossary .concept-search:focus{outline:none;border-color:var(--accent, #6b8afd)}.concepts-glossary .concept-row{display:block}.concepts-glossary .concept-row .trow{width:100%}.concepts-glossary .concept-row-body{padding:0 16px 14px;margin-top:-4px}.concepts-glossary .concept-empty{padding:24px 4px;color:var(--text-tertiary, #8a92a6);font-size:14px}.xsvc{display:flex;flex-direction:column;min-height:100%;background:transparent;color:var(--text-body, #aaaaaa);font-family:IBM Plex Sans,system-ui,sans-serif}.xsvc-scroll{flex:1;overflow-y:auto;padding:26px 10% 40px}.xsvc-crumbs{margin-bottom:14px}.xsvc-back{background:none;border:0;padding:0;cursor:pointer;font:inherit;font-size:12.5px;color:var(--text-faint, #6b6b6b)}.xsvc-back:hover{color:var(--text-body, #aaaaaa)}.xsvc-head{display:block}.xsvc-head h1{font-size:26px;font-weight:700;color:var(--text-strong, #f2f2f2);letter-spacing:-.02em;margin:0}.xsvc-sub{font-size:13.5px;color:var(--text-faint, #6b6b6b);margin:7px 0 0;max-width:54ch}.xsvc-headbtn{font:inherit;font-size:12.5px;font-weight:600;color:var(--text-body, #aaaaaa);background:var(--surface-raised, #1c1c1c);border:.5px solid var(--line-subtle, rgba(255, 255, 255, .08));border-radius:9px;padding:9px 14px;cursor:pointer;white-space:nowrap}.xsvc-headbtn:hover{border-color:var(--line-hair, rgba(255, 255, 255, .12));color:var(--text-strong, #f2f2f2)}.xsvc-groups{margin-top:26px}.xsvc-group{margin-bottom:24px}.xsvc-group-head{display:flex;align-items:baseline;justify-content:space-between;margin-bottom:11px}.xsvc-seclabel{font-family:IBM Plex Mono,ui-monospace,monospace;font-size:11px;font-weight:600;letter-spacing:.08em;text-transform:uppercase;color:var(--text-subtle, #4a4a4a)}.xsvc-seccount{font-size:11.5px;color:var(--text-subtle, #4a4a4a);font-variant-numeric:tabular-nums}.xsvc-rows{display:flex;flex-direction:column;gap:9px}.xsvc-row{display:flex;align-items:center;gap:14px;border:.5px solid var(--line-subtle, rgba(255, 255, 255, .08));border-radius:14px;padding:14px 16px;background:var(--surface-card, #161616);transition:.16s;cursor:pointer}.xsvc-row:hover{border-color:var(--line-hair, rgba(255, 255, 255, .12));background:var(--surface-raised, #1c1c1c);transform:translateY(-1px)}.xsvc-row.attn{border-color:#ef9f2766;background:linear-gradient(150deg,#ef9f270f,#ef9f2703)}.xsvc-tile{width:40px;height:40px;border-radius:11px;flex-shrink:0;display:flex;align-items:center;justify-content:center;font-family:IBM Plex Mono,ui-monospace,monospace;font-size:13px;font-weight:600}.xsvc-tile.t-lime{background:var(--lime-soft, rgba(199, 240, 74, .15));color:var(--lime-300, #c7f04a)}.xsvc-tile.t-blue{background:var(--blue-soft, rgba(133, 183, 235, .13));color:var(--blue-300, #85b7eb)}.xsvc-tile.t-green{background:var(--green-soft, rgba(155, 211, 90, .13));color:var(--green-300, #9bd35a)}.xsvc-tile.t-amber{background:var(--amber-soft, rgba(239, 159, 39, .13));color:var(--amber-300, #ef9f27)}.xsvc-tile.t-indigo{background:var(--indigo-soft, rgba(139, 133, 255, .13));color:var(--indigo-300, #8b85ff)}.xsvc-rmain{min-width:0;flex:1}.xsvc-rname{font-size:14.5px;font-weight:600;color:var(--text-strong, #f2f2f2);display:flex;align-items:center;gap:9px;flex-wrap:wrap}.xsvc-rdesc{font-size:12.5px;color:var(--text-faint, #6b6b6b);margin-top:3px}.xsvc-rright{display:flex;align-items:center;gap:16px;flex-shrink:0}.xsvc-rmeta{text-align:right;line-height:1.3}.xsvc-rmeta .big{font-size:13px;font-weight:600;color:var(--text-strong, #f2f2f2);font-variant-numeric:tabular-nums}.xsvc-rmeta .lil{font-size:11px;color:var(--text-faint, #6b6b6b);margin-top:2px}.xsvc-arr{color:var(--text-subtle, #4a4a4a);font-size:15px;transition:.16s}.xsvc-row:hover .xsvc-arr{color:var(--text-body, #aaaaaa);transform:translate(2px)}.xsvc-tag{font-family:IBM Plex Mono,ui-monospace,monospace;font-size:10px;font-weight:500;padding:2.5px 7px;border-radius:6px;text-transform:uppercase}.xsvc-tag.set{background:var(--green-soft, rgba(155, 211, 90, .13));color:var(--green-300, #9bd35a)}.xsvc-tag.env{background:var(--lime-soft, rgba(199, 240, 74, .15));color:var(--lime-300, #c7f04a);text-transform:none}.xsvc-tag.miss{background:var(--amber-soft, rgba(239, 159, 39, .13));color:var(--amber-300, #ef9f27)}.xsvc-addkey{font:inherit;font-size:11.5px;font-weight:600;color:#0a0a0a;background:var(--amber-300, #ef9f27);border:0;border-radius:8px;padding:6px 11px;cursor:pointer}.xsvc-empty-wrap{margin-top:30px;display:flex;justify-content:center}.xsvc-empty-card{width:100%;max-width:700px;text-align:center;padding:42px 34px 28px;border:.5px solid var(--line-subtle, rgba(255, 255, 255, .08));border-radius:20px;background:radial-gradient(120% 120% at 50% -10%,rgba(199,240,74,.05),transparent 60%),var(--surface-panel, #111111)}.xsvc-empty-mark{width:52px;height:52px;border-radius:14px;margin:0 auto 18px;display:flex;align-items:center;justify-content:center;background:var(--lime-soft, rgba(199, 240, 74, .15));color:var(--lime-300, #c7f04a)}.xsvc-empty-card h2{font-size:20px;font-weight:700;color:var(--text-strong, #f2f2f2);margin:0 0 10px}.xsvc-empty-card p{font-size:13.5px;color:var(--text-body, #aaaaaa);margin:0 auto;max-width:50ch}.xsvc-chat-hero{margin-top:26px;text-align:left}.xsvc-lead{font-family:IBM Plex Mono,ui-monospace,monospace;font-size:10.5px;letter-spacing:.14em;text-transform:uppercase;color:var(--lime-300, #c7f04a);display:flex;align-items:center;gap:7px;margin-bottom:11px}.xsvc-composer{display:flex;align-items:center;gap:10px;width:100%;font:inherit;text-align:left;cursor:pointer;background:var(--surface-card, #161616);border:.5px solid var(--line-hair, rgba(255, 255, 255, .12));border-radius:13px;padding:11px 12px 11px 15px}.xsvc-composer:hover{border-color:var(--lime-300, #c7f04a)}.xsvc-composer .ph{flex:1;font-size:13.5px;color:var(--text-faint, #6b6b6b)}.xsvc-composer .send{width:32px;height:32px;border-radius:9px;background:var(--lime-300, #c7f04a);color:#0a0a0a;display:flex;align-items:center;justify-content:center;flex-shrink:0}.xsvc-chips{display:flex;flex-wrap:wrap;gap:8px;margin-top:13px}.xsvc-chip{font:inherit;font-size:12px;color:var(--text-body, #aaaaaa);background:var(--surface-raised, #1c1c1c);border:.5px solid var(--line-subtle, rgba(255, 255, 255, .08));border-radius:999px;padding:7px 13px;cursor:pointer}.xsvc-chip:hover{border-color:var(--line-hair, rgba(255, 255, 255, .12));color:var(--text-strong, #f2f2f2)}.xsvc-chip .g{color:var(--lime-300, #c7f04a);font-family:IBM Plex Mono,ui-monospace,monospace;margin-right:5px}.xsvc-bottombar{flex-shrink:0;border-top:.5px solid var(--line-subtle, rgba(255, 255, 255, .08));background:linear-gradient(180deg,rgba(199,240,74,.02),transparent),var(--surface-panel, #111111);padding:12px clamp(18px,6%,64px) 14px}.xsvc-bb-sugg{display:flex;flex-wrap:wrap;gap:7px;margin-bottom:10px}.xsvc-bb-sugg .xsvc-chip{font-size:11.5px}.xsvc-bb-composer{display:flex;align-items:center;gap:11px;width:100%;font:inherit;text-align:left;cursor:pointer;background:var(--surface-card, #161616);border:.5px solid var(--line-hair, rgba(255, 255, 255, .12));border-radius:12px;padding:10px 11px 10px 15px}.xsvc-bb-composer:hover{border-color:var(--lime-300, #c7f04a)}.xsvc-bb-composer .ai{width:24px;height:24px;border-radius:7px;background:var(--lime-soft, rgba(199, 240, 74, .15));color:var(--lime-300, #c7f04a);display:flex;align-items:center;justify-content:center;flex-shrink:0}.xsvc-bb-composer .ph{flex:1;font-size:13.5px;color:var(--text-faint, #6b6b6b)}.xsvc-bb-composer .send{width:30px;height:30px;border-radius:9px;background:var(--lime-300, #c7f04a);color:#0a0a0a;display:flex;align-items:center;justify-content:center;flex-shrink:0}.xsvc-connected{position:relative;display:flex;flex-direction:column;min-height:100%;height:100%}.xsvc-connected>.xsvc{flex:1}.xsvc-chatdock{position:absolute;left:0;right:0;bottom:0;z-index:20;background:var(--surface-page, #0a0a0a);border-top:.5px solid var(--line-hair, rgba(255, 255, 255, .12));padding:10px 10% 16px;box-shadow:0 -18px 40px #0000008c}.xsvc-chatdock-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px;font-family:IBM Plex Sans,system-ui,sans-serif;font-size:12.5px;color:var(--text-faint, #6b6b6b)}.xsvc-chatdock-close{background:none;border:0;padding:4px 6px;cursor:pointer;font:inherit;color:var(--text-faint, #6b6b6b)}.xsvc-chatdock-close:hover{color:var(--text-body, #aaaaaa)}.xsvc-toolbar{display:flex;align-items:center;gap:10px;margin-bottom:16px}.xsvc-sortlbl{font-size:12px;color:var(--text-faint, #6b6b6b)}.xsvc-seg{display:inline-flex;border:.5px solid var(--line-hair, rgba(255, 255, 255, .12));border-radius:9px;overflow:hidden}.xsvc-seg button{font:inherit;font-size:12.5px;padding:5px 14px;background:transparent;color:var(--text-faint, #6b6b6b);border:0;cursor:pointer}.xsvc-seg button:hover{color:var(--text-body, #aaaaaa)}.xsvc-seg button.on{background:var(--lime-soft, rgba(199, 240, 74, .15));color:var(--lime-300, #c7f04a)}.xsvc-tile svg{display:block}.xsvc-rowwrap{border-radius:14px}.xsvc-arr.down{color:var(--lime-300, #c7f04a)}.xsvc-detail{padding:12px 16px 14px 70px;border:.5px solid var(--line-subtle, rgba(255, 255, 255, .08));border-top:0;border-radius:0 0 14px 14px;background:var(--surface-card, #161616);display:flex;flex-direction:column;gap:8px}.xsvc-detrow{display:flex;align-items:center;gap:12px;font-size:12.5px}.xsvc-detlabel{min-width:92px;color:var(--text-faint, #6b6b6b)}.xsvc-detval{color:var(--text-body, #aaaaaa)}.xsvc-detval.mono,.xsvc-keyval .mono{font-family:IBM Plex Mono,ui-monospace,monospace;color:var(--lime-300, #c7f04a);font-size:12px;letter-spacing:.02em}.xsvc-keyval{display:inline-flex;align-items:center;gap:10px;font:inherit;background:var(--surface-page, #0a0a0a);border:.5px solid var(--line-hair, rgba(255, 255, 255, .12));border-radius:8px;padding:5px 10px;cursor:pointer}.xsvc-keyval:hover{border-color:var(--lime-300, #c7f04a)}.xsvc-keyval .eye{display:flex;color:var(--text-faint, #6b6b6b)}.xsvc-keyval:hover .eye{color:var(--lime-300, #c7f04a)}.xsvc-titlerow{display:flex;align-items:baseline;gap:14px;flex-wrap:wrap}.xsvc-count{font-size:13px;color:var(--text-faint, #6b6b6b);font-variant-numeric:tabular-nums}.xsvc-cinput{flex:1;min-width:0;font:inherit;font-size:13.5px;color:var(--text-strong, #f2f2f2);background:transparent;border:0;outline:none}.xsvc-cinput::placeholder{color:var(--text-faint, #6b6b6b)}.xsvc-composer .send,.xsvc-bb-composer .send{border:0;cursor:pointer}.xsvc-composer,.xsvc-bb-composer{cursor:text}.hosting-screen .sd-callout{display:flex;gap:12px;padding:13px 15px;border-radius:11px;background:var(--surface-card);border:1px solid var(--line-subtle);border-left-width:3px;margin:14px 0}.hosting-screen .sd-callout.cost{border-left-color:var(--amber-300)}.hosting-screen .sd-callout.wait{border-left-color:var(--blue-300)}.hosting-screen .sd-callout.size{border-left-color:var(--lime-400)}.hosting-screen .sd-callout-ic{flex:none;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;border-radius:7px;background:var(--surface-raised);font-size:14px;font-weight:700}.hosting-screen .sd-callout-t{font-size:14px;font-weight:600;margin-bottom:2px}.hosting-screen .sd-callout-b{font-size:13.5px;line-height:1.55;color:var(--text-body)}.hosting-screen .sd-store{display:flex;gap:13px;padding:15px;border-radius:12px;background:var(--surface-card);border:1px solid var(--line-subtle);margin-bottom:12px}.hosting-screen .sd-store-mark{flex:none;display:inline-flex;align-items:center;justify-content:center;width:38px;height:38px;border-radius:10px;font-size:20px;color:#fff}.hosting-screen .sd-store.ios .sd-store-mark{background:linear-gradient(140deg,#555,#111)}.hosting-screen .sd-store.android .sd-store-mark{background:linear-gradient(140deg,#3ddc84,#14a05a)}.hosting-screen .sd-store-top{display:flex;align-items:center;gap:10px;margin-bottom:4px}.hosting-screen .sd-store-name{font-size:15px;font-weight:600}.hosting-screen .sd-store-badge{font-size:11.5px;padding:2px 8px;border-radius:999px;background:var(--surface-raised);color:var(--text-body);border:1px solid var(--line-subtle)}.hosting-screen .sd-store-desc{font-size:13.5px;line-height:1.55;color:var(--text-body)}.hosting-screen .sd-store-enroll{display:inline-flex;align-items:center;margin-top:10px;padding:6px 12px;border-radius:8px;font-size:13px;font-weight:600;text-decoration:none;color:var(--accent-strong, #2563eb);background:var(--surface-raised);border:1px solid var(--line-subtle)}.hosting-screen .sd-store-enroll:hover{text-decoration:underline}.hosting-screen .sd-checks{display:flex;flex-direction:column;gap:9px;margin:6px 0}.hosting-screen .sd-check{display:flex;gap:9px;font-size:14px;line-height:1.5;color:var(--text-body)}.hosting-screen .sd-check svg{flex:none;margin-top:3px}.hosting-screen .sd-check b{color:var(--text-strong)}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{j as n}from"./markdown-C9tbsVHX.js";import{b as l}from"./react-nrLBr15I.js";import{d as cr,a as lr,c as dr,C as te,u as ur}from"./useServerIdentity-BdXy8TQv.js";import{u as fr}from"./useEvents-S3Qk1Y_d.js";import{r as pr,a as hr}from"./xterm--24IGk-x.js";import{l as Y,c as mr}from"./index-VuyqBbGJ.js";const ve=4e3;function Fe(e){let t;try{t=JSON.stringify(e,null,2)}catch{t=String(e)}return t.length>ve?`${t.slice(0,ve)}
|
|
2
|
-
… (truncated, ${t.length-ve} more chars)`:t}function xr({slug:e,scenarioName:t,seedTabs:r,mockEntries:a,selectedMock:s,selectedSeedTab:o,selectedSeedRows:c}){const i=[],p=t??e;if(i.push(`# Edit Scenario Data: "${p}"`),i.push(""),i.push(`**Slug**: ${e}`),i.push(`**Scenario file**: .codeyam/scenarios/${e}.json`),i.push(""),i.push("## Scenario overview"),r.length>0){i.push("### Seed & Local tables");for(const u of r){const b=u.category?` (${u.category})`:"";i.push(`- **${u.label}**${b} — dataKey \`${u.dataKey}\``)}i.push("")}if(a.length>0){i.push("### HTTP mocks");const u=new Map;for(const b of a){const h=u.get(b.source)??[];h.push(b),u.set(b.source,h)}for(const[b,h]of u){i.push(`**${b}** (${h.length}):`);for(const d of h)i.push(`- \`${d.method} ${d.pathPattern}\``)}i.push("")}if(s){const u=`${s.method} ${s.pathPattern}`;i.push(`## Currently viewing: mock \`${u}\``),i.push(`- **Source**: ${s.source}`),s.status!==void 0&&i.push(`- **Status**: ${s.status}`);const b=s.headers??{},h=Object.entries(b);if(h.length>0){i.push("- **Headers**:");for(const[d,x]of h)i.push(` - \`${d}: ${x}\``)}s.body!==void 0&&s.body!==null?(i.push("- **Body**:"),i.push("```json"),i.push(Fe(s.body)),i.push("```")):i.push("- **Body**: (empty)"),i.push("")}else if(o){if(i.push(`## Currently viewing: seed table **${o.label}**`),i.push(`- **dataKey**: \`${o.dataKey}\``),o.category&&i.push(`- **Category**: ${o.category}`),o.description&&i.push(`- **Description**: ${o.description}`),o.schemaFields&&o.schemaFields.length>0){i.push("- **Schema**:");for(const u of o.schemaFields){const b=u.isId?" (PK)":"";i.push(` - \`${u.name}\`: ${u.type}${b}`)}}c&&c.length>0?(i.push(`- **Rows** (${c.length}):`),i.push("```json"),i.push(Fe(c)),i.push("```")):i.push("- **Rows**: (none yet)"),i.push("")}return i.push("## Your task"),i.push("The user is looking at the Scenario Data Panel and wants your help adjusting its data. Ask what change they'd like to make."),i.push(""),i.push("Typical edits:"),i.push('- Tweak an HTTP mock body, status, or headers → update `mocks.http["METHOD /path"]` in the scenario JSON'),i.push("- Add or remove seed rows → update the `seed` section"),i.push("- Adjust `localStorage` values → update the `localStorage` section"),i.push(""),i.push("To save changes:"),i.push("1. Write the updated scenario JSON to `.codeyam/tmp/scenario.json`"),i.push("2. Run: `codeyam-editor editor register @.codeyam/tmp/scenario.json`"),i.push("3. The editor will reload automatically and the panel will reflect the new data."),i.join(`
|
|
3
|
-
`)}const Ne=new Set;let se=null;const br=150;function Ea(e){return Ne.add(e),()=>{Ne.delete(e)}}function G(){se&&clearTimeout(se),se=setTimeout(()=>{se=null;for(const e of Ne)e()},br)}const Ee=new Set;function Ta(e){for(const t of Ee)t(e)}function gr(e){return Ee.add(e),()=>{Ee.delete(e)}}function yr({onSelect:e,onFocus:t}){l.useEffect(()=>gr(({routeKey:r,jsonPath:a})=>{e(r),t(a)}),[e,t])}const Ae="claude";function vr(e){return e==="claude"}function re(e){switch(e){case"codex":return"Codex";case"gemini":return"Gemini";case"opencode":return"OpenCode";default:return"Claude"}}const jr=3e3;function et(){const[e,t]=l.useState(null),[r,a]=l.useState(!0),[s,o]=l.useState(null),c=l.useRef(null),i=l.useCallback(async()=>{try{const p=await fetch("/api/config");if(!p.ok)throw new Error(`HTTP ${p.status}`);const u=await p.json(),b={projectTitle:u.projectTitle??null,projectDescription:u.projectDescription??null,provider:u.provider??Ae,port:u.port??3e3,previewOrigin:u.previewOrigin??null,screenSizes:u.screenSizes??{},defaultScreenSize:u.defaultScreenSize??null,apps:u.apps??[],admin:u.admin??!1,mobileTerminalCommands:u.mobileTerminalCommands??[],launcherUrl:u.launcherUrl??null,projectCount:u.projectCount??0,setupBrowserEnabled:u.setupBrowserEnabled??!1,claudePermissionModeAuto:u.claudePermissionModeAuto??!0},h=JSON.stringify(b);h!==c.current&&(c.current=h,t(b)),o(null)}catch(p){o(p instanceof Error?p.message:"Failed to load config")}finally{a(!1)}},[]);return l.useEffect(()=>{i();const p=setInterval(()=>{i()},jr);return()=>clearInterval(p)},[i]),{config:e,apps:(e==null?void 0:e.apps)??[],loading:r,error:s,refetch:i}}async function ue(e){try{const t=await e.json();if(t.error)return t.error}catch{}return`Request failed (${e.status})`}async function _r(e,t=null){const r=t!=null?`?since_ms=${encodeURIComponent(t)}`:"",s=await(await fetch(`/api/mock-panel/${encodeURIComponent(e)}${r}`)).json();if("error"in s)throw new Error(s.error);return s}async function Ke(e,t){const r=`/api/scenarios/${encodeURIComponent(e)}/mocks/${encodeURIComponent(t.routeKey)}`,a=await fetch(r,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:t.status,body:t.body,headers:t.headers})});if(!a.ok)throw new Error(await ue(a))}async function wr(e,t){const r=`/api/scenarios/${encodeURIComponent(e)}/mocks/${encodeURIComponent(t)}`,a=await fetch(r,{method:"DELETE"});if(!a.ok)throw new Error(await ue(a))}async function Sr(e,t){const r=`/api/scenarios/${encodeURIComponent(e)}/mocks/${encodeURIComponent(t)}/passthrough`,a=await fetch(r,{method:"POST"});if(!a.ok)throw new Error(await ue(a))}function X(e){return e.kind==="shared"?`shared:${e.slug}`:e.kind}async function kr(e){const t=await fetch("/api/mocks/save-scoped",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),r=await t.json();if(!t.ok||"success"in r&&r.success===!1)throw new Error("error"in r?r.error:`Save failed (${t.status})`);return r}async function Cr(e,t,r){const a=new URLSearchParams({scenarioSlug:e,routeKey:t,scope:X(r)}),s=await fetch(`/api/mocks/save-scope-impact?${a.toString()}`);if(!s.ok)throw new Error(await ue(s));return(await s.json()).impactedScenarios??[]}function Nr(){const[e,t]=l.useState(null),[r,a]=l.useState(null),s=l.useRef(null),o=async()=>{try{const i=await fetch("/api/editor-dev-server");if(!i.ok)throw new Error(`Failed to fetch dev server status: ${i.statusText}`);const p=await i.json(),u=JSON.stringify(p);if(u===s.current){a(null);return}s.current=u,t(p),a(null)}catch(i){a(i instanceof Error?i.message:String(i))}};return l.useEffect(()=>{o();const i=setInterval(o,1e3);return()=>clearInterval(i)},[]),{status:e,error:r,restart:async()=>{try{const i=await fetch("/api/editor-dev-server",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"restart"})});if(!i.ok)throw new Error(`Failed to restart dev server: ${i.statusText}`);o()}catch(i){a(i instanceof Error?i.message:String(i))}}}}function Er(e){const[t,r]=l.useState([]),[a,s]=l.useState(null),[o,c]=l.useState(!1),[i,p]=l.useState(null),{events:u}=fr(),{status:b}=Nr(),h=(b==null?void 0:b.lastIframeLoadedAtMs)??null,d=l.useCallback(async()=>{if(!e){r([]),s(null);return}c(!0),p(null);try{const f=await _r(e,h);r(f.entries),s(f.defaultSlug)}catch(f){p(f instanceof Error?f.message:"Failed to load mocks")}finally{c(!1)}},[e,h]);l.useEffect(()=>{d()},[d]),l.useEffect(()=>{const f=u[u.length-1];!f||f.type!=="http_request"||d()},[u,d]);const x=l.useCallback(async f=>{e&&(await Ke(e,f),await d())},[e,d]),m=l.useCallback(async f=>{e&&(f.scope.kind==="scenario"?await Ke(e,{routeKey:f.routeKey,status:f.status,body:f.body,headers:f.headers}):await kr({scenarioSlug:e,routeKey:f.routeKey,scope:f.scope,status:f.status,body:f.body,headers:f.headers}),await d())},[e,d]),g=l.useCallback(async f=>{e&&(await wr(e,f),await d())},[e,d]),y=l.useCallback(async f=>{e&&(await Sr(e,f),await d())},[e,d]);return{entries:t,defaultSlug:a,loading:o,error:i,refresh:d,upsert:x,upsertScoped:m,remove:g,setPassthrough:y}}function Tr(e){const t={};for(const[r,a]of Object.entries(e))if(typeof a=="string")try{const s=JSON.parse(a);Array.isArray(s)?t[r]=s:typeof s=="object"&&s!==null&&(t[r]=[s])}catch{}else Array.isArray(a)&&(t[r]=a);return t}function Or(e,t){return e.length===0||t.length===0?!1:e.filter(a=>t.includes(a)).length>=Math.min(e.length,t.length)*.5}function Mr(e){return e==null?"null":typeof e=="number"?Number.isInteger(e)?"int4":"float":typeof e=="boolean"?"bool":typeof e=="object"?Array.isArray(e)?"array":"json":"text"}function Ar(e,t){return e.length>0?Object.keys(e[0]):t?t.map(r=>r.name):[]}function Pr(e,t,r){const a=new Map((r||[]).map(o=>[o.name,o.type])),s={};for(const o of e)s[o]=a.get(o)||(t.length>0?Mr(t[0][o]):"text");return s}function Rr(e,t){var r;return((r=t==null?void 0:t.find(a=>a.isId))==null?void 0:r.name)||e.find(a=>a==="id")||null}function Dr(e,t){const{_metadata:r,...a}=t,s=a.localStorage&&typeof a.localStorage=="object"&&!Array.isArray(a.localStorage)?Tr(a.localStorage):{},o={};if(a.seed&&typeof a.seed=="object"&&!Array.isArray(a.seed))for(const[d,x]of Object.entries(a.seed))Array.isArray(x)&&(o[d]=x);const c={},i=[],p=new Set,u=new Set,b=new Set;for(const d of e){const x=d.name.charAt(0).toLowerCase()+d.name.slice(1),m=d.fields.map(f=>f.name);let g=null,y=[];for(const f of[d.name,x,`${x}s`])if(f in a&&Array.isArray(a[f])){g=f,y=a[f],u.add(f);break}if(!g){for(const f of[d.name,x,`${x}s`])if(f in o){g=f,y=o[f],b.add(f),f in s&&p.add(f);break}}if(!g){for(const f of[d.name,x,`${x}s`])if(f in s){g=x,y=s[f],p.add(f);break}}if(!g){for(const[f,v]of Object.entries(s))if(!p.has(f)&&v.length>0&&Or(m,Object.keys(v[0]))){g=x,y=v,p.add(f);break}}g||(g=x),c[g]=y,i.push({label:d.name,dataKey:g,category:d.category,description:d.description,schemaFields:d.fields.map(f=>({name:f.name,type:f.type,isId:f.isId??!1}))})}const h=new Set(["name","id","url","dimensions","componentName","scenarioType","pageFilePath","routeName","description","props","env"]);for(const[d,x]of Object.entries(a))d==="_metadata"||d==="localStorage"||d==="seed"||d==="type"||d==="mocks"||h.has(d)||u.has(d)||Ir(x)&&(c[d]=x,i.push({label:d,dataKey:d}));for(const[d,x]of Object.entries(o))b.has(d)||(c[d]=x,i.push({label:d,dataKey:d}));for(const[d,x]of Object.entries(s))p.has(d)||(c[d]=x,i.push({label:d,dataKey:d}));return{data:c,tabs:i}}function ze(e){return e==="null"?null:e==="true"?!0:e==="false"?!1:e===""?"":isNaN(Number(e))?e:Number(e)}function Ir(e){return Array.isArray(e)&&e.length>0&&typeof e[0]=="object"&&e[0]!==null}function Lr(e){if(typeof e!="object"||e===null||!("props"in e))return null;const t=e.props;return typeof t!="object"||t===null||Array.isArray(t)?null:t}function $r(e){if(typeof e!="object"||e===null||!("browserState"in e))return null;const t=e.browserState;return typeof t!="object"||t===null||Array.isArray(t)?null:t}function Br(e,t){const r=new Set;for(const a of t){const s=e[a.dataKey];Array.isArray(s)&&s.length>0&&r.add(a.dataKey)}return r}function Fr(e){if(typeof e=="object"&&e!==null&&"shares"in e){const t=e.shares;if(Array.isArray(t))return t.filter(r=>typeof r=="string")}return[]}function Kr(e){const[t,r]=l.useState({data:null,tableTabs:[],scenarioOwnedDataKeys:new Set,shares:[],props:null,browserState:null,loading:!0,error:null});return l.useEffect(()=>{r(a=>({...a,loading:!0,error:null})),Promise.all([fetch("/api/data-structure").then(a=>a.json()).catch(()=>[]),fetch(`/api/scenarios/${encodeURIComponent(e)}`).then(a=>{if(!a.ok)throw new Error(`HTTP ${a.status}`);return a.json()})]).then(([a,s])=>{const o=Dr(Array.isArray(a)?a:[],s);r({data:o.data,tableTabs:o.tabs,scenarioOwnedDataKeys:Br(o.data,o.tabs),shares:Fr(s),props:Lr(s),browserState:$r(s),loading:!1,error:null})}).catch(a=>r({data:null,tableTabs:[],scenarioOwnedDataKeys:new Set,shares:[],props:null,browserState:null,loading:!1,error:a instanceof Error?a.message:"Failed to load"}))},[e]),t}function Pe(e,t=""){return`/api/scenarios/${encodeURIComponent(e)}/draft${t}`}async function zr(e){const t=await fetch(Pe(e,"/status"));if(!t.ok)return{isDirty:!1,diffSummary:null};const r=await t.json();return{isDirty:!!r.isDirty,diffSummary:r.diffSummary??null}}async function Hr(e){const t=await fetch(Pe(e,"/commit"),{method:"POST"});if(!t.ok)throw new Error(`Save failed (${t.status})`)}async function Vr(e){const t=await fetch(Pe(e),{method:"DELETE"});if(!t.ok)throw new Error(`Cancel failed (${t.status})`)}function Yr({slug:e,onPreviewReload:t}){const[r,a]=l.useState(!1),[s,o]=l.useState(null),[c,i]=l.useState(!1),[p,u]=l.useState(!1),[b,h]=l.useState(null),d=l.useRef(null),x=l.useCallback(async()=>{if(!e){a(!1),o(null);return}try{const v=await zr(e);a(v.isDirty),o(v.diffSummary)}catch{}},[e]);l.useEffect(()=>{x()},[x]),l.useEffect(()=>{if(!r)return;const v=k=>{k.preventDefault(),k.returnValue=""};return window.addEventListener("beforeunload",v),()=>window.removeEventListener("beforeunload",v)},[r]);const m=l.useCallback(()=>{d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{x()},100)},[x]),g=l.useCallback(async()=>{if(e){i(!0),h(null);try{await Hr(e),a(!1),o(null),t&&t()}catch(v){h(v instanceof Error?v.message:"Save failed")}finally{i(!1)}}},[e,t]),y=l.useCallback(async()=>{if(e){u(!0),h(null);try{await Vr(e),a(!1),o(null),t&&t()}catch(v){h(v instanceof Error?v.message:"Cancel failed")}finally{u(!1)}}},[e,t]),f=l.useCallback(v=>r?window.confirm(v):!0,[r]);return{isDirty:r,saving:c,cancelling:p,error:b,diffSummary:s,save:g,cancel:y,markDirty:m,confirmIfDirty:f}}const Wr={scenario:"Scenario",shared:"Shared",default:"Defaults","catalog-only":"Observed only",passthrough:"Passthrough"},Ur={scenario:null,shared:null,default:null,"catalog-only":"Observed during live traffic but not mocked yet. Promote it to a scenario mock to capture and edit the response.",passthrough:null};function tt(e){return Wr[e]??e}function Xr(e){return Ur[e]??null}const Jr={scenario:"bg-emerald-500/15 text-emerald-300 border-emerald-500/40",shared:"bg-violet-500/15 text-violet-300 border-violet-500/40",default:"bg-[#D7FF63]/15 text-[#D7FF63] border-[#D7FF63]/40","catalog-only":"bg-slate-500/15 text-slate-300 border-slate-500/40",passthrough:"bg-zinc-500/15 text-zinc-300 border-zinc-500/40"};function Re({source:e}){const t=Xr(e);return n.jsx("span",{className:`px-1.5 py-0.5 rounded border ${Jr[e]}`,title:t??`source: ${e}`,children:tt(e)})}const Oa=Object.freeze(Object.defineProperty({__proto__:null,MockSourceBadge:Re},Symbol.toStringTag,{value:"Module"}));function rt({label:e,scenarioCount:t,inheritedCount:r,expanded:a,onToggle:s}){const o=r===0;return n.jsxs("h3",{className:"px-3 pb-1 text-[10px] font-semibold uppercase tracking-wider text-[var(--text-dim)]",children:[n.jsx("div",{className:"mb-0.5",children:e}),n.jsxs("div",{className:"flex items-center gap-1 normal-case tracking-normal font-normal",children:[n.jsxs("span",{children:[t," scenario-specific"]}),n.jsx("span",{"aria-hidden":!0,children:"·"}),n.jsxs("button",{type:"button",onClick:s,disabled:o,"aria-expanded":a,className:`inline-flex items-center gap-0.5 ${o?"cursor-default text-[var(--text-dim)]":"cursor-pointer hover:text-[var(--text-primary)]"}`,children:[n.jsx("span",{"aria-hidden":!0,className:"inline-block w-2 text-[9px]",children:o?"":a?"▾":"▸"}),n.jsxs("span",{children:[r," inherited from default"]})]})]})]})}const Ma=Object.freeze(Object.defineProperty({__proto__:null,SidebarGroupOverrideHeader:rt},Symbol.toStringTag,{value:"Module"}));function nt({children:e}){return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"mx-3 my-1 border-t border-[var(--border-subtle)]"}),n.jsx("div",{className:"px-3 pb-1 text-[9px] uppercase tracking-wider text-[var(--text-dim)]",children:"Inherited from default"}),e]})}const Aa=Object.freeze(Object.defineProperty({__proto__:null,SidebarInheritedSection:nt},Symbol.toStringTag,{value:"Module"}));function at({slug:e}){return n.jsx("span",{className:"px-1 py-0.5 rounded border text-[9px] font-mono bg-violet-500/10 text-violet-300 border-violet-500/30",title:`from shared-data set: ${e}`,children:e})}const Pa=Object.freeze(Object.defineProperty({__proto__:null,MockSharedSlugBadge:at},Symbol.toStringTag,{value:"Module"})),qr={GET:"text-emerald-400",POST:"text-[#D7FF63]",PUT:"text-amber-400",PATCH:"text-purple-400",DELETE:"text-red-400"};function st({entry:e,routeKey:t,active:r,onSelect:a}){const s=qr[e.method]??"text-[var(--text-muted)]";return n.jsxs("button",{onClick:a,className:`w-full text-left px-3 py-1.5 text-xs flex items-center gap-2 border-l-2 transition-colors cursor-pointer ${r?"bg-[var(--accent-blue)]/10 border-[var(--accent-blue)] text-[var(--text-primary)]":"border-transparent text-[var(--text-muted)] hover:bg-[var(--bg-card)] hover:text-[var(--text-primary)]"}`,title:t,children:[n.jsx("span",{className:`font-mono text-[9px] font-semibold ${s}`,children:e.method}),n.jsx("span",{className:"truncate flex-1 font-mono",children:e.pathPattern}),e.source==="shared"&&e.sharedSlug&&n.jsx(at,{slug:e.sharedSlug})]})}const Ra=Object.freeze(Object.defineProperty({__proto__:null,SidebarMockEntryRow:st},Symbol.toStringTag,{value:"Module"})),Gr=["scenario","shared","default","catalog-only","passthrough"];function J(e){return`${e.method} ${e.pathPattern}`}function ot({seedTabs:e,mockEntries:t,selection:r,onSelect:a,overrides:s}){const o=new Map;for(const c of t){const i=o.get(c.source)??[];i.push(c),o.set(c.source,i)}return n.jsxs("nav",{className:"w-56 shrink-0 border-r border-[var(--border-subtle)] bg-[var(--bg-deep)] overflow-y-auto",children:[n.jsxs(ie,{label:"Browser Environment",count:4,emptyHint:"",children:[n.jsx(ee,{label:"Cookies",active:(r==null?void 0:r.kind)==="browser"&&r.tab==="cookies",onSelect:()=>a({kind:"browser",tab:"cookies"})}),n.jsx(ee,{label:"Local Storage",active:(r==null?void 0:r.kind)==="browser"&&r.tab==="localStorage",onSelect:()=>a({kind:"browser",tab:"localStorage"})}),n.jsx(ee,{label:"Session Storage",active:(r==null?void 0:r.kind)==="browser"&&r.tab==="sessionStorage",onSelect:()=>a({kind:"browser",tab:"sessionStorage"})}),n.jsx(ee,{label:"Request Headers",active:(r==null?void 0:r.kind)==="browser"&&r.tab==="headers",onSelect:()=>a({kind:"browser",tab:"headers"})})]}),n.jsx(ie,{label:"Seed & Local",count:e.length,emptyHint:"No seed or localStorage data",override:s?{scenarioCount:s.scenarioSeedCount,inheritedCount:s.inheritedSeedCount,renderInherited:()=>He({tabs:s.inheritedSeedTabs,selection:r,onSelect:a})}:void 0,children:He({tabs:e,selection:r,onSelect:a})}),n.jsx(ie,{label:"Mock APIs",count:t.length,emptyHint:"No HTTP mocks registered",override:s?{scenarioCount:s.scenarioMockCount,inheritedCount:s.inheritedMockCount,renderInherited:()=>Ve({entries:s.inheritedMockEntries,selection:r,onSelect:a})}:void 0,children:Ve({entries:t,grouped:o,selection:r,onSelect:a})})]})}function He({tabs:e,selection:t,onSelect:r}){return e.map(a=>{const s=(t==null?void 0:t.kind)==="seed"&&t.dataKey===a.dataKey;return n.jsxs("button",{onClick:()=>r({kind:"seed",dataKey:a.dataKey}),className:`w-full text-left px-3 py-1.5 text-xs flex items-center gap-2 border-l-2 transition-colors cursor-pointer ${s?"bg-[var(--accent-active)]/10 border-[var(--accent-active)] text-[var(--text-primary)]":"border-transparent text-[var(--text-muted)] hover:bg-[var(--bg-card)] hover:text-[var(--text-primary)]"}`,children:[n.jsx("span",{className:"truncate flex-1",children:a.label}),a.category&&n.jsx("span",{className:"text-[9px] uppercase tracking-wide text-[var(--text-dim)]",children:a.category==="mock-api"?"API":a.category})]},a.dataKey)})}function ee({label:e,active:t,onSelect:r}){return n.jsxs("button",{onClick:r,className:`w-full text-left px-3 py-1.5 text-xs flex items-center gap-2 border-l-2 transition-colors cursor-pointer ${t?"bg-[var(--accent-active)]/10 border-[var(--accent-active)] text-[var(--text-primary)]":"border-transparent text-[var(--text-muted)] hover:bg-[var(--bg-card)] hover:text-[var(--text-primary)]"}`,children:[n.jsx("span",{className:"truncate flex-1",children:e}),n.jsx("span",{className:"text-[9px] uppercase tracking-wide text-[var(--text-dim)]",children:"ENV"})]})}function Ve({entries:e,grouped:t,selection:r,onSelect:a}){const s=t??Qr(e);return Gr.flatMap(o=>{const c=s.get(o)??[];return c.length===0?[]:[n.jsxs("div",{className:"px-3 pt-2 pb-1 text-[9px] uppercase tracking-wider text-[var(--text-dim)] font-semibold flex items-center gap-1.5",children:[tt(o),n.jsx(Re,{source:o})]},`hdr-${o}`),...c.map(i=>{const p=J(i),u=(r==null?void 0:r.kind)==="mock"&&r.routeKey===p;return n.jsx(st,{entry:i,routeKey:p,active:u,onSelect:()=>a({kind:"mock",routeKey:p})},p)})]})}function Qr(e){const t=new Map;for(const r of e){const a=t.get(r.source)??[];a.push(r),t.set(r.source,a)}return t}function ie({label:e,count:t,emptyHint:r,children:a,override:s}){const[o,c]=l.useState(!1);if(s){const{scenarioCount:i,inheritedCount:p,renderInherited:u}=s,b=i+(o?p:0);return n.jsxs("section",{className:"py-2",children:[n.jsx(rt,{label:e,scenarioCount:i,inheritedCount:p,expanded:o,onToggle:()=>c(h=>!h)}),b===0?n.jsx("p",{className:"px-3 py-1 text-[10px] italic text-[var(--text-dim)]",children:r}):n.jsxs("div",{children:[a,o&&p>0&&n.jsx(nt,{children:u()})]})]})}return n.jsxs("section",{className:"py-2",children:[n.jsxs("h3",{className:"px-3 pb-1 text-[10px] font-semibold uppercase tracking-wider text-[var(--text-dim)] flex items-center justify-between",children:[n.jsx("span",{children:e}),n.jsx("span",{children:t})]}),t===0?n.jsx("p",{className:"px-3 py-1 text-[10px] italic text-[var(--text-dim)]",children:r}):n.jsx("div",{children:a})]})}const Da=Object.freeze(Object.defineProperty({__proto__:null,BrowserStateButton:ee,ScenarioDataPanelSidebar:ot,SidebarGroup:ie,routeKeyFor:J},Symbol.toStringTag,{value:"Module"}));function Zr({seedTabs:e,mockEntries:t,initialSection:r,selection:a,setSelection:s}){l.useEffect(()=>{if(a)return;const o=r==="mocks",c=r==="seed";if(o&&t.length>0){s({kind:"mock",routeKey:J(t[0])});return}if(c&&e.length>0){s({kind:"seed",dataKey:e[0].dataKey});return}e.length>0?s({kind:"seed",dataKey:e[0].dataKey}):t.length>0&&s({kind:"mock",routeKey:J(t[0])})},[r,t,e,a,s])}const Te={state:"unknown",provider:Ae,credsPresent:!0,cliInstalled:!0,scannedDirs:[],reason:null,expiresAt:null,probeInFlight:!1,probeAttempts:0,backendFieldAbsent:!1};function en(e){if(e==null)return{...Te,backendFieldAbsent:!0};if(typeof e!="object")return Te;const t=e,r=t.state==="authenticated"||t.state==="needs-login"||t.state==="unknown"?t.state:"unknown",a=t.provider==="claude"||t.provider==="codex"||t.provider==="gemini"||t.provider==="opencode"?t.provider:Ae,s=typeof t.credsPresent=="boolean"?t.credsPresent:!0,o=typeof t.cliInstalled=="boolean"?t.cliInstalled:!0,c=Array.isArray(t.scannedDirs)?t.scannedDirs.filter(h=>typeof h=="string"):[],i=t.reason==="token-expired"||t.reason==="api-401"||t.reason==="no-credentials"||t.reason==="probe-timeout"||t.reason==="config-corrupt"||t.reason==="cli-not-found"?t.reason:null,p=typeof t.tokenExpiresAt=="string"?t.tokenExpiresAt:typeof t.expiresAt=="string"?t.expiresAt:null,u=typeof t.probeInFlight=="boolean"?t.probeInFlight:!1,b=typeof t.probeAttempts=="number"&&Number.isFinite(t.probeAttempts)&&t.probeAttempts>=0?t.probeAttempts:0;return{state:r,provider:a,credsPresent:s,cliInstalled:o,scannedDirs:c,reason:i,expiresAt:p,probeInFlight:u,probeAttempts:b,backendFieldAbsent:!1}}const tn=1e3;function rn(){const[e,t]=l.useState(Te),r=l.useRef(e.state);r.current=e.state;const a=l.useCallback(async()=>{try{const s=await fetch("/api/config");if(!s.ok)return;const o=await s.json();t(en(o.providerAuth))}catch{}},[]);return l.useEffect(()=>{a()},[a]),l.useEffect(()=>{if(e.state!=="unknown")return;const s=window.setInterval(()=>{r.current==="unknown"&&a()},tn);return()=>window.clearInterval(s)},[e.state,a]),l.useEffect(()=>{const s=()=>{t(o=>({...o,state:"needs-login"})),a()};return window.addEventListener("agent-auth-required",s),()=>window.removeEventListener("agent-auth-required",s)},[a]),l.useEffect(()=>{const s=()=>{t(o=>({...o,state:"authenticated"})),a()};return window.addEventListener("agent-auth-resolved",s),()=>window.removeEventListener("agent-auth-resolved",s)},[a]),{state:e.state,provider:e.provider,credsPresent:e.credsPresent,cliInstalled:e.cliInstalled,scannedDirs:e.scannedDirs,reason:e.reason,expiresAt:e.expiresAt,probeInFlight:e.probeInFlight,probeAttempts:e.probeAttempts,backendFieldAbsent:e.backendFieldAbsent,refresh:a}}var nn=pr(),an=hr();function sn(e){const t=window.location.protocol==="https:"?"wss:":"ws:",r=new URL(`${t}//${window.location.host}/ws/terminal`);return e!=null&&e.provider&&r.searchParams.set("provider",e.provider),e!=null&&e.mode&&r.searchParams.set("mode",e.mode),e!=null&&e.sessionId&&r.searchParams.set("sessionId",e.sessionId),e!=null&&e.chatKey&&r.searchParams.set("chatKey",e.chatKey),e!=null&&e.launch&&r.searchParams.set("launch","1"),e!=null&&e.cols&&e.cols>0&&r.searchParams.set("cols",String(e.cols)),e!=null&&e.rows&&e.rows>0&&r.searchParams.set("rows",String(e.rows)),r.toString()}const on=20,cn=1;function ln(e,t){const r=t===cn?e:e/on;return Math.trunc(r)||Math.sign(r)}function dn(){if(typeof navigator>"u")return!1;const e=navigator.platform??"";return e?/Mac|iPhone|iPad|iPod/i.test(e):/Mac|iPhone|iPad|iPod/i.test(navigator.userAgent??"")}function un(e,t,r={}){const a=r.isMac??dn(),s=r.onError,o=r.onCopy;let c=null;async function i(m){if(!m)return!1;let g=!1;try{g=await cr(m)}catch(y){return s==null||s(Ye("copy",y)),!1}if(g){try{e.clearSelection()}catch{}o==null||o()}else s==null||s(pn("copy"));return g}async function p(){return e.hasSelection()?i(e.getSelection()):!1}async function u(){try{const m=await navigator.clipboard.readText();m&&e.paste(m)}catch(m){s==null||s(Ye("paste",m))}}function b(m){return m.type!=="keydown"?!0:a?(m.metaKey&&!m.ctrlKey&&!m.altKey&&m.key.toLowerCase()==="c"||m.ctrlKey&&!m.metaKey&&!m.altKey&&!m.shiftKey&&m.key.toLowerCase()==="c")&&e.hasSelection()?(p(),!1):!0:(m.ctrlKey&&m.shiftKey&&!m.metaKey&&!m.altKey&&m.key.toLowerCase()==="c"||m.ctrlKey&&!m.shiftKey&&!m.metaKey&&!m.altKey&&m.key.toLowerCase()==="c")&&e.hasSelection()?(p(),!1):!0}e.attachCustomKeyEventHandler(b);function h(){if(!c)return;const{root:m,onDocumentClick:g,onKeyDown:y}=c;document.removeEventListener("mousedown",g,!0),document.removeEventListener("keydown",y,!0),m.remove(),c=null}function d(m,g,y){h();const f=document.createElement("div");f.setAttribute("data-terminal-clipboard-menu","true"),f.style.position="fixed",f.style.left=`${m}px`,f.style.top=`${g}px`,f.style.zIndex="1000",f.style.minWidth="180px",f.style.padding="4px 0",f.style.background="var(--bg-card)",f.style.border="1px solid var(--border-subtle)",f.style.borderRadius="6px",f.style.boxShadow="0 8px 24px rgba(0, 0, 0, 0.35)",f.style.fontSize="12px",f.style.color="var(--text-primary)",f.style.userSelect="none";const v=a?"⌘C":"Ctrl+Shift+C",k=a?"⌘V":"Ctrl+Shift+V",_=je("Copy",v,!y,()=>{i(y),h()}),w=je("Paste",k,!1,()=>{u(),h()}),P=je("Select All","",!1,()=>{try{e.selectAll()}catch{}const j=e.hasSelection()?e.getSelection():"";i(j),h()});f.appendChild(_),f.appendChild(w),f.appendChild(P),document.body.appendChild(f),fn(f,m,g);const B=j=>{f.contains(j.target)||h()},E=j=>{j.key==="Escape"&&(j.preventDefault(),h())};document.addEventListener("mousedown",B,!0),document.addEventListener("keydown",E,!0),c={root:f,onDocumentClick:B,onKeyDown:E}}function x(m){m.preventDefault();const g=e.hasSelection()?e.getSelection():"";d(m.clientX,m.clientY,g)}return t.addEventListener("contextmenu",x),()=>{t.removeEventListener("contextmenu",x),h(),e.attachCustomKeyEventHandler(()=>!0)}}function je(e,t,r,a){const s=document.createElement("button");s.type="button",s.disabled=r,s.style.display="flex",s.style.justifyContent="space-between",s.style.alignItems="center",s.style.gap="16px",s.style.width="100%",s.style.padding="6px 12px",s.style.border="none",s.style.background="transparent",s.style.textAlign="left",s.style.fontSize="12px",s.style.cursor=r?"default":"pointer",s.style.color=r?"var(--text-dim)":"var(--text-primary)";const o=document.createElement("span");if(o.textContent=e,s.appendChild(o),t){const c=document.createElement("span");c.textContent=t,c.style.color="var(--text-dim)",c.style.fontSize="11px",s.appendChild(c)}return r||(s.addEventListener("mouseenter",()=>{s.style.background="var(--border-subtle)"}),s.addEventListener("mouseleave",()=>{s.style.background="transparent"}),s.addEventListener("click",()=>a())),s}function fn(e,t,r){const a=typeof window<"u"?window.innerWidth:0,s=typeof window<"u"?window.innerHeight:0;if(!a||!s)return;const o=e.getBoundingClientRect(),c=4;let i=t,p=r;o.width&&t+o.width+c>a&&(i=Math.max(c,a-o.width-c)),o.height&&r+o.height+c>s&&(p=Math.max(c,s-o.height-c)),e.style.left=`${i}px`,e.style.top=`${p}px`}function Ye(e,t){const r=t instanceof Error?t.message:String(t);return`Clipboard ${e} failed: ${r}`}function pn(e){return`Clipboard ${e} blocked by the browser.`}function hn(e,t,r,a,s,o){const c=e.leftBorderCol+1;if(t===a)return s-r;if(a<t){let u=r-c;u+=1;for(let h=a+1;h<t;h++){const d=o(h);if(d===null)return null;u+=Math.max(1,d-c+1)}const b=o(a);return b===null?null:(u+=Math.max(0,b-s),-u)}const i=o(t);if(i===null)return null;let p=Math.max(0,i-r)+1;for(let u=t+1;u<a;u++){const b=o(u);if(b===null)return null;p+=Math.max(1,b-c+1)}return p+=s-c,p}const oe=new Set(["│","┃","║","|"]);function mn(e,t,r,a){const s=e.baseY,o=(x,m)=>{const g=e.getLine(s+x);if(!g)return null;const y=g.getCell(m);return y?y.getChars():null},c=x=>{let m=-1;for(let y=0;y<r;y++){const f=o(x,y);if(f!==null&&oe.has(f)){m=y;break}}if(m===-1)return null;let g=-1;for(let y=r-1;y>m;y--){const f=o(x,y);if(f!==null&&oe.has(f)){g=y;break}}return g===-1?null:{leftBorderCol:m,rightBorderCol:g}};let i=t,p=c(t);if(!p){const x=c(t-1);if(x)i=t-1,p=x;else{const m=c(t+1);m&&(i=t+1,p=m)}}if(!p)return null;const{leftBorderCol:u,rightBorderCol:b}=p;let h=i;for(let x=i-1;x>=0;x--){const m=o(x,u);if(m===null)break;if(!(m===""||m===" ")){if(!oe.has(m))break;h=x}}let d=i;for(let x=i+1;x<a;x++){const m=o(x,u);if(m===null)break;if(!(m===""||m===" ")){if(!oe.has(m))break;d=x}}return{topRow:h,bottomRow:d,leftBorderCol:u,rightBorderCol:b}}function xn(e,t,r,a){const s=e.getLine(e.baseY+t);if(!s)return null;for(let o=a;o>=r;o--){const c=s.getCell(o);if(!c)continue;const i=c.getChars();if(i!==""&&i!==" ")return o}return r-1}const bn=200;function gn(e){const{click:t,terminal:r,cellSurface:a,debug:s}=e,o=r.buffer.active,c=_=>{s==null||s({cursorY:o.cursorY,cursorX:o.cursorX,originalTargetCol:_.originalTargetCol??_.targetCol,snapped:_.snapped??!1,..._})};if(o.type==="alternate")return c({targetRow:-1,targetCol:-1,box:null,rejected:"alt-screen",emittedDirection:null,emittedByteCount:0,predictedCursorY:null,predictedCursorX:null}),null;if(o.viewportY!==o.baseY)return c({targetRow:-1,targetCol:-1,box:null,rejected:"scrollback",emittedDirection:null,emittedByteCount:0,predictedCursorY:null,predictedCursorX:null}),null;const i=a.getBoundingClientRect();if(i.width===0||i.height===0)return c({targetRow:-1,targetCol:-1,box:null,rejected:"outside-grid",emittedDirection:null,emittedByteCount:0,predictedCursorY:null,predictedCursorX:null}),null;const p=t.clientX-i.left,u=t.clientY-i.top;if(p<0||u<0||p>=i.width||u>=i.height)return c({targetRow:-1,targetCol:-1,box:null,rejected:"outside-grid",emittedDirection:null,emittedByteCount:0,predictedCursorY:null,predictedCursorX:null}),null;const b=i.width/r.cols,h=i.height/r.rows,d=Math.floor(p/b),x=Math.floor(u/h),m=r.modes.applicationCursorKeysMode,g=m?"\x1BOC":"\x1B[C",y=m?"\x1BOD":"\x1B[D",f=mn(o,o.cursorY,r.cols,r.rows);if(f){if(x<f.topRow||x>f.bottomRow)return c({targetRow:x,targetCol:d,box:f,rejected:"out-of-box",emittedDirection:null,emittedByteCount:0,predictedCursorY:null,predictedCursorX:null}),null;if(d<=f.leftBorderCol||d>=f.rightBorderCol)return c({targetRow:x,targetCol:d,box:f,rejected:"border",emittedDirection:null,emittedByteCount:0,predictedCursorY:null,predictedCursorX:null}),null;const _=f.leftBorderCol+1,w=f.rightBorderCol-1,P=A=>xn(o,A,_,w),B=o.cursorY<f.topRow||o.cursorY>f.bottomRow,E=B?f.bottomRow:o.cursorY,j=B?w:o.cursorX,F=x!==E;let N=null;if(F&&(N=P(x),N===null))return c({targetRow:x,targetCol:d,originalTargetCol:d,snapped:!1,box:f,rejected:"unreadable-row",emittedDirection:null,emittedByteCount:0,predictedCursorY:null,predictedCursorX:null}),null;let D=d,T=!1;if(F&&N!==null){const A=Math.max(_,N);d>A&&(D=A,T=!0)}if(x===E&&D===j)return c({targetRow:x,targetCol:D,originalTargetCol:d,snapped:T,box:f,rejected:"same-cell",emittedDirection:null,emittedByteCount:0,predictedCursorY:null,predictedCursorX:null}),null;const O=hn(f,E,j,x,D,P);if(O===null)return c({targetRow:x,targetCol:D,originalTargetCol:d,snapped:T,box:f,rejected:"unreadable-row",emittedDirection:null,emittedByteCount:0,predictedCursorY:null,predictedCursorX:null}),null;if(O===0)return c({targetRow:x,targetCol:D,originalTargetCol:d,snapped:T,box:f,rejected:"same-cell",emittedDirection:null,emittedByteCount:0,predictedCursorY:null,predictedCursorX:null}),null;if(Math.abs(O)>bn)return c({targetRow:x,targetCol:D,originalTargetCol:d,snapped:T,box:f,rejected:"emit-cap",emittedDirection:null,emittedByteCount:0,predictedCursorY:null,predictedCursorX:null}),null;const I=O<0?y.repeat(-O):g.repeat(O);return c({targetRow:x,targetCol:D,originalTargetCol:d,snapped:T,box:f,rejected:null,emittedDirection:O<0?"left":"right",emittedByteCount:I.length,predictedCursorY:x,predictedCursorX:D}),I}if(x!==o.cursorY)return c({targetRow:x,targetCol:d,box:null,rejected:"out-of-box",emittedDirection:null,emittedByteCount:0,predictedCursorY:null,predictedCursorX:null}),null;const v=d-o.cursorX;if(v===0)return c({targetRow:x,targetCol:d,box:null,rejected:"same-cell",emittedDirection:null,emittedByteCount:0,predictedCursorY:null,predictedCursorX:null}),null;const k=v<0?y.repeat(-v):g.repeat(v);return c({targetRow:x,targetCol:d,box:null,rejected:null,emittedDirection:v<0?"left":"right",emittedByteCount:k.length,predictedCursorY:x,predictedCursorX:d}),k}const We=1;function yn(e,t){const{sendInput:r,pixelThreshold:a=3,timeThresholdMs:s=300,now:o=()=>Date.now(),onVerificationDisable:c}=t,i=e.element;if(!i)return()=>{};const p=i.querySelector(".xterm-screen")??i;let u=null,b=!1,h=null,d=null;const x=typeof e.onRender=="function"?e.onRender.bind(e):null;x&&(d=x(()=>{const y=h;if(!y)return;h=null;const f=e.buffer.active,v=Math.abs(f.cursorY-y.y),k=Math.abs(f.cursorX-y.x);if(v>We||k>We){b=!0;const _={predicted:y,actual:{y:f.cursorY,x:f.cursorX}};c?c(_):console.warn("[click-cursor] disabled — cursor diverged from prediction",_)}}));function m(y){if(y.button!==0||y.altKey||y.shiftKey||y.metaKey||y.ctrlKey){u=null;return}u={clientX:y.clientX,clientY:y.clientY,at:o()}}function g(y){var E;const f=u;if(u=null,!f)return;const v=y.clientX-f.clientX,k=y.clientY-f.clientY;if(Math.hypot(v,k)>a||o()-f.at>s)return;const _=typeof window<"u"&&((E=window.localStorage)==null?void 0:E.getItem("codeyam.terminalClickDebug"))==="1";if(_)try{const j=e.buffer.active,F=j.cursorY,N={};for(let D=-2;D<=2;D++){const T=F+D,O=j.getLine(j.baseY+T);if(!O)continue;const I=[];for(let A=0;A<e.cols;A++){const K=O.getCell(A);I.push(K?K.getChars():"")}N[`row${T}`]=I.join("|")}console.log("[click-cursor] buffer dump",{cursorY:F,cursorX:j.cursorX,viewportY:j.viewportY,baseY:j.baseY,rows:N})}catch{}let w=null;const P=j=>{w=j,_&&console.log("[click-cursor] result",j)},B=gn({click:{clientX:y.clientX,clientY:y.clientY},terminal:e,cellSurface:p,debug:P});if(B){if(w){const j=w,F=j.box!==null&&j.targetRow!==j.cursorY;if(F&&b){_&&console.log("[click-cursor] suppressed by verification-disabled");return}F&&j.predictedCursorY!==null&&j.predictedCursorX!==null&&(h={y:j.predictedCursorY,x:j.predictedCursorX})}r(B)}}return p.addEventListener("mousedown",m),p.addEventListener("mouseup",g),()=>{p.removeEventListener("mousedown",m),p.removeEventListener("mouseup",g),d==null||d.dispose()}}function vn(){window.focus()}function jn(e,t){vn(),e==null||e.focus({preventScroll:!0}),t()}async function it(e=1500){try{return(await fetch("/api/health",{signal:AbortSignal.timeout(e)})).ok}catch{return!1}}function _n(e,t){let r=!1,a=null;async function s(){if(!r){if(await it(1500)){r||t();return}r||(a=setTimeout(s,e))}}return a=setTimeout(s,e),()=>{r=!0,a&&(clearTimeout(a),a=null)}}const wn="The editor server closed the terminal connection with no further detail.";function Sn(e){if(e&&typeof e=="object"&&"message"in e){const t=e.message;if(typeof t=="string"&&t.length>0)return t}return wn}let ct=!1;function _e(e){ct=e}function Ia(){return ct}function lt(){return n.jsx("div",{"data-testid":"terminal-connecting-hint",className:"absolute top-2 right-3 text-xs font-mono text-[#aaa] pointer-events-none z-10 select-none",children:"Connecting…"})}const La=Object.freeze(Object.defineProperty({__proto__:null,TerminalConnectingHint:lt},Symbol.toStringTag,{value:"Module"}));function dt({attempt:e,maxAttempts:t,pulseKey:r}){return n.jsx("div",{"data-testid":"terminal-reconnecting-banner",className:"absolute inset-0 flex items-start justify-center pt-3 z-10 bg-black/40",children:n.jsxs("div",{"data-testid":"terminal-reconnecting-banner-label",className:"px-4 py-2 rounded font-mono text-sm shadow terminal-disconnect-pulse bg-amber-500/90 text-black",children:["Reconnecting… (attempt ",e," of ",t,")"]},r)})}const $a=Object.freeze(Object.defineProperty({__proto__:null,TerminalReconnectingBanner:dt},Symbol.toStringTag,{value:"Module"}));function ut({onRefresh:e}){return n.jsx("div",{"data-testid":"terminal-failed-banner",className:"absolute inset-0 flex items-start justify-center pt-3 z-10 bg-black/60",children:n.jsxs("div",{className:"px-4 py-2 rounded font-mono text-sm shadow flex items-center gap-3 terminal-disconnect-pulse bg-red-500/90 text-white",children:[n.jsx("span",{children:"Connection lost. The page must be refreshed to continue."}),n.jsx("button",{type:"button",onClick:e,"data-testid":"terminal-failed-banner-refresh",className:"px-2 py-1 rounded bg-white text-red-700 font-medium cursor-pointer hover:bg-red-50",children:"Refresh page"})]})})}const Ba=Object.freeze(Object.defineProperty({__proto__:null,TerminalFailedBanner:ut},Symbol.toStringTag,{value:"Module"}));function ft({onReload:e}){return n.jsx("div",{"data-testid":"terminal-server-stopped-banner",className:"absolute inset-0 flex items-start justify-center pt-3 z-10 bg-black/60",children:n.jsxs("div",{className:"px-4 py-2 rounded font-mono text-sm shadow flex items-center gap-3 terminal-disconnect-pulse bg-red-500/90 text-white",children:[n.jsx("span",{children:"Editor stopped — restart it from your terminal to continue."}),n.jsx("button",{type:"button",onClick:e,"data-testid":"terminal-server-stopped-banner-reload",className:"px-2 py-1 rounded bg-white text-red-700 font-medium cursor-pointer hover:bg-red-50",children:"Reload page"})]})})}const Fa=Object.freeze(Object.defineProperty({__proto__:null,TerminalServerStoppedBanner:ft},Symbol.toStringTag,{value:"Module"}));function pt({message:e,onRefresh:t}){return n.jsx("div",{"data-testid":"terminal-server-error-banner",className:"absolute inset-0 flex items-start justify-center pt-3 z-10 bg-black/60",children:n.jsxs("div",{className:"px-4 py-3 rounded font-mono text-sm shadow flex items-start gap-3 max-w-2xl bg-amber-500/95 text-black border border-amber-700",children:[n.jsx("pre",{"data-testid":"terminal-server-error-banner-message",className:"whitespace-pre-wrap break-words flex-1 m-0 font-mono text-xs leading-snug",children:e}),n.jsxs("div",{className:"flex items-start gap-2 self-start shrink-0",children:[n.jsx(lr,{variant:"subtle",text:e,label:"Copy",className:"px-2 py-1 rounded bg-white text-amber-900 font-medium cursor-pointer hover:bg-amber-50 disabled:opacity-50 disabled:cursor-not-allowed"}),n.jsx("button",{type:"button",onClick:t,"data-testid":"terminal-server-error-banner-refresh",className:"px-2 py-1 rounded bg-white text-amber-900 font-medium cursor-pointer hover:bg-amber-50",children:"Refresh"})]})]})})}const Ka=Object.freeze(Object.defineProperty({__proto__:null,TerminalServerErrorBanner:pt},Symbol.toStringTag,{value:"Module"}));function ht({onRefresh:e}){return n.jsx("div",{"data-testid":"terminal-edge-unreachable-banner",className:"absolute inset-0 flex items-start justify-center pt-3 z-10 bg-black/60",children:n.jsxs("div",{className:"px-4 py-3 rounded font-mono text-sm shadow flex items-start gap-3 max-w-2xl bg-amber-500/95 text-black border border-amber-700",children:[n.jsx("span",{className:"flex-1 leading-snug",children:"The editor is reachable and this session is valid, but the live terminal connection (WebSocket) still can't be established — the WebSocket path itself isn't carrying the connection, which usually means the VM's tunnel/ingress. Retry to reconnect; if it persists, the VM's ingress needs attention."}),n.jsx("button",{type:"button",onClick:e,"data-testid":"terminal-edge-unreachable-banner-retry",className:"px-2 py-1 rounded bg-white text-amber-900 font-medium cursor-pointer hover:bg-amber-50 self-start",children:"Retry"})]})})}const za=Object.freeze(Object.defineProperty({__proto__:null,TerminalEdgeUnreachableBanner:ht},Symbol.toStringTag,{value:"Module"}));function mt({canRetry:e=!1,onRefresh:t}){return n.jsx("div",{"data-testid":"terminal-session-stale-banner",className:"absolute inset-0 flex items-start justify-center pt-3 z-10 bg-black/60",children:n.jsxs("div",{className:"px-4 py-3 rounded font-mono text-sm shadow flex items-start gap-3 max-w-2xl bg-amber-500/95 text-black border border-amber-700",children:[n.jsx("span",{className:"flex-1 leading-snug",children:e?"The editor restarted and this tab's session couldn't be re-established automatically. Retry to pick up a fresh session; if it keeps failing, reload the page.":"The editor restarted, so this tab's session expired. Re-establishing it and reconnecting the terminal — no action needed."}),e&&n.jsx("button",{type:"button",onClick:t,"data-testid":"terminal-session-stale-banner-retry",className:"px-2 py-1 rounded bg-white text-amber-900 font-medium cursor-pointer hover:bg-amber-50 self-start",children:"Retry"})]})})}const Ha=Object.freeze(Object.defineProperty({__proto__:null,TerminalSessionStaleBanner:mt},Symbol.toStringTag,{value:"Module"}));function xt({status:e,pulseKey:t,onRefresh:r}){return e.kind==="open"||e.kind==="ended"?null:e.kind==="connecting"?n.jsx(lt,{}):e.kind==="reconnecting"?n.jsx(dt,{attempt:e.attempt,maxAttempts:e.maxAttempts,pulseKey:t}):e.kind==="server-stopped"?n.jsx(ft,{onReload:r}):e.kind==="server-error"?n.jsx(pt,{message:e.message,onRefresh:r}):e.kind==="edge-unreachable"?n.jsx(ht,{onRefresh:r}):e.kind==="session-stale"?n.jsx(mt,{canRetry:e.canRetry,onRefresh:r}):n.jsx(ut,{onRefresh:r})}const Va=Object.freeze(Object.defineProperty({__proto__:null,TerminalDisconnectOverlay:xt},Symbol.toStringTag,{value:"Module"}));function bt({status:e,onRetry:t}){return e==="retrying"?n.jsx("div",{"data-testid":"mini-agent-launch-retrying",className:"absolute inset-x-0 top-2 z-10 flex justify-center pointer-events-none",children:n.jsx("span",{className:"font-mono text-xs italic text-[var(--text-dim)] bg-black/40 px-2 py-1 rounded",children:"Launch slow — retrying…"})}):e==="failed"?n.jsx("div",{role:"alert","data-testid":"mini-agent-launch-failed-banner",className:"absolute inset-0 flex items-start justify-center pt-3 z-10 bg-black/60",children:n.jsxs("div",{className:"px-4 py-2 rounded font-mono text-sm shadow flex items-center gap-3 terminal-disconnect-pulse bg-red-500/90 text-white",children:[n.jsx("span",{children:"Couldn't launch the build agent — the shell prompt didn't respond in time."}),n.jsx("button",{type:"button",onClick:t,"data-testid":"mini-agent-launch-failed-retry",className:"px-2 py-1 rounded bg-white text-red-700 font-medium cursor-pointer hover:bg-red-50",children:"Retry"})]})}):null}const Ya=Object.freeze(Object.defineProperty({__proto__:null,MiniAgentLaunchOverlay:bt},Symbol.toStringTag,{value:"Module"})),kn=40;function Cn(e){const t=e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return t&&t.slice(0,kn).replace(/-+$/,"")||"session"}const ce=new Map;function De(e,t){const r=ce.get(e);if(!r){let a;try{a=t()}catch(s){return Promise.reject(s)}return a instanceof Promise?Ue(e,a):Promise.resolve()}return Ue(e,r.then(()=>t()))}function Ue(e,t){const r=t.catch(()=>{});return ce.set(e,r),r.then(()=>{ce.get(e)===r&&ce.delete(e)}),t}let Z=0,Q=[];function Wa(){if(Z+=1,Z===1&&Q.length>0){const e=Q;Q=[];for(const t of e)t()}}function Ua(){Z>0&&(Z-=1)}function Nn(){return Z>0}function En(e){return Z>0?Promise.resolve(!0):new Promise(t=>{let r=!1;const a=()=>{r||(r=!0,t(!0))};Q.push(a),setTimeout(()=>{r||(r=!0,Q=Q.filter(s=>s!==a),t(!1))},e)})}const fe="build",Xe="miniagent",Je=3e3;function Tn(e){return Nn()?e():En(Je).then(t=>{if(t)return e();console.warn(`[terminal] dropped programmatic injection: no terminal-send-input listener attached within ${Je}ms`)})}function Ie(e){window.dispatchEvent(new CustomEvent("terminal-send-input",{detail:e}))}function Xa(e){De(fe,()=>Tn(()=>Ie(e)))}const le=50;function On(e,t=Ie,r=fe){return De(r,()=>new Promise(a=>{t(e),setTimeout(()=>{t("\r"),a()},le)}))}const we=3e3;function Mn(e){return e==="codex"?"codex":e==="gemini"?"gemini":e==="opencode"?"opencode":"claude"}function gt(e,t){const r=Mn(e);return r==="claude"&&t?`${r} --permission-mode auto`:r}function An(e,t){return`'${e==="powershell"?t.replaceAll("'","''"):t.replaceAll("'","'\\''")}'`}function Pn(e,t,r=!0,a="posix"){const s=An(a,t);return e==="opencode"?`opencode${r?" --auto":""} --prompt ${s}\r`:`${gt(e,r)} ${s}\r`}async function Rn(e,t=Ie,r=fe){const a=Cn(e);await On(`/rename ${a}`,t,r)}function Dn(e,t,r,a=fe){Y("dispatch-rename",{phase:"queued",caller:t,label:e,delayMs:we}),setTimeout(()=>{Y("dispatch-rename",{phase:"fired",caller:t,label:e,delayMs:we}),Rn(e,r,a)},we)}const Le=".codeyam/tmp/inline-prompt.md";function In(e){return e.split(`
|
|
4
|
-
`).map(t=>t.startsWith("'@")?` ${t}`:t).join(`
|
|
5
|
-
`)}function Ln(e){return`mkdir -p .codeyam/tmp && cat > ${Le} << 'INLINE_PROMPT_EOF'
|
|
6
|
-
${e}
|
|
7
|
-
INLINE_PROMPT_EOF\r`}function $n(e){return`New-Item -ItemType Directory -Force -Path .codeyam/tmp | Out-Null; @'
|
|
8
|
-
${In(e)}
|
|
9
|
-
'@ | Set-Content -LiteralPath ${Le} -Encoding utf8\r`}function Bn(e,t,r=!0,a="posix"){const s=gt(e,r),o=a==="powershell"?$n(t):Ln(t),c=`${s} "Read the file at '${Le}' for your instructions."\r`;return[o,c]}function Fn({attempt:e,sawOutput:t}){return t?e===1?"extend":"confirm":e===1?"retry":"fail"}function Kn({idleMs:e,ceilingMs:t}){return new Promise(r=>{let a=null,s=null,o=!1;function c(){o||(o=!0,a!==null&&clearTimeout(a),s!==null&&clearTimeout(s),window.removeEventListener("miniagent-output",p),r())}function i(){a!==null&&clearTimeout(a),a=setTimeout(c,e)}function p(){i()}window.addEventListener("miniagent-output",p),s=setTimeout(c,t),i()})}const zn=350,Hn=4e3,qe=8e3,Vn=500,W={armed:"mini-agent-launch-armed",fired:"mini-agent-launch-fired",confirmed:"mini-agent-launch-confirmed",relaunch:"mini-agent-relaunch",failed:"mini-agent-launch-failed",reattached:"mini-agent-launch-reattached"};function Yn(e){const{provider:t,slashCommand:r,prompt:a,chatName:s,sendInput:o,permissionModeAuto:c=!0,shellDialect:i=null}=e,[p,u]=l.useState("idle"),b=l.useRef(o),h=l.useRef(r),d=l.useRef(a),x=l.useRef(s),m=l.useRef(t),g=l.useRef(c),y=l.useRef(i);l.useEffect(()=>{b.current=o},[o]),l.useEffect(()=>{g.current=c},[c]),l.useEffect(()=>{y.current=i},[i]),l.useEffect(()=>{h.current=r},[r]),l.useEffect(()=>{d.current=a},[a]),l.useEffect(()=>{x.current=s},[s]),l.useEffect(()=>{m.current=t},[t]);const f=l.useRef(0),v=l.useRef(!1),k=l.useRef(0),_=l.useRef(0),w=l.useRef(0);l.useEffect(()=>{const T=()=>{_.current+=1};return window.addEventListener("miniagent-output",T),()=>window.removeEventListener("miniagent-output",T)},[]);const P=l.useCallback((T,O)=>{const I=h.current,A=d.current;return De(Xe,()=>{const K=y.current??"posix";if(I){const z=Pn(m.current,I,g.current,K),q=Se(z);return T(q),new Promise(S=>{setTimeout(()=>{O()&&T("\r"),S()},le)})}const[R,V]=Bn(m.current,A??"",g.current,K),U=Se(R),H=Se(V);return T(U),new Promise(z=>{setTimeout(()=>{if(!O())return z();T("\r"),setTimeout(()=>{if(!O())return z();T(H),setTimeout(()=>{O()&&T("\r"),z()},le)},Vn)},le)})})},[]),B=l.useCallback(()=>{const T=++f.current,O=Date.now();k.current=O,w.current=_.current,u("armed"),Y(W.armed,{provider:m.current,slashCommand:h.current,chatName:x.current,hasPrompt:typeof d.current=="string"});function I(){return f.current===T}function A(R){I()&&(u(R===1?"firing":"retrying"),Y(R===1?W.fired:W.relaunch,{provider:m.current,slashCommand:h.current,chatName:x.current,attempt:R,elapsedMs:Date.now()-O}),P(b.current,I).then(()=>{I()&&(w.current=_.current)}),!v.current&&vr(m.current)&&(v.current=!0,Dn(x.current,"mini-agent-chat",V=>b.current(V),Xe)),setTimeout(()=>K(R),qe))}function K(R){if(!I())return;const V=_.current>w.current;switch(Fn({attempt:R,sawOutput:V})){case"retry":A(2);return;case"extend":Y(W.relaunch,{provider:m.current,slashCommand:h.current,attempt:2,sawOutput:!0,resent:!1,elapsedMs:Date.now()-O}),setTimeout(()=>K(2),qe);return;case"confirm":u("confirmed"),Y(W.confirmed,{provider:m.current,slashCommand:h.current,reason:"output-without-banner",sawOutput:!0,elapsedMs:Date.now()-O});return;case"fail":u("failed"),Y(W.failed,{provider:m.current,slashCommand:h.current,reason:"banner-timeout",sawOutput:!1,elapsedMs:Date.now()-O})}}Kn({idleMs:zn,ceilingMs:Hn}).then(()=>{I()&&A(1)})},[P]),E=l.useCallback(()=>{v.current=!1,B()},[B]),j=l.useCallback(()=>{B()},[B]),F=l.useCallback(()=>{f.current!==0&&(f.current++,u("confirmed"),Y(W.confirmed,{elapsedMs:Date.now()-k.current}))},[]),N=l.useCallback(()=>{f.current!==0&&(f.current++,u("failed"),Y(W.failed,{reason:"startup-failed",elapsedMs:Date.now()-k.current}))},[]),D=l.useCallback(()=>{f.current++,u("confirmed"),Y(W.reattached,{provider:m.current,chatName:x.current})},[]);return l.useEffect(()=>()=>{f.current++},[]),{status:p,arm:E,retry:j,onBannerReady:F,onStartupFailed:N,onReattached:D}}function Se(e){return e.endsWith("\r")?e.slice(0,-1):e}const pe=l.createContext({registerSender:()=>{},setReady:()=>{},sendToAgent:()=>!1,agentReady:!1});function Wn({children:e}){const t=l.useRef(null),[r,a]=l.useState(!1),s=l.useCallback(p=>{t.current=p},[]),o=l.useCallback(p=>{a(p)},[]),c=l.useCallback(p=>{const u=t.current;return u?u(p):!1},[]),i=l.useMemo(()=>({registerSender:s,setReady:o,sendToAgent:c,agentReady:r}),[s,o,c,r]);return n.jsx(pe.Provider,{value:i,children:e})}function Un(){const{sendToAgent:e,agentReady:t}=l.useContext(pe);return{sendToAgent:e,agentReady:t}}function Xn(e,t){const{registerSender:r,setReady:a}=l.useContext(pe);l.useEffect(()=>(r(e),()=>r(null)),[r,e]),l.useEffect(()=>(a(t),()=>a(!1)),[a,t])}function yt(){const{registerSender:e,setReady:t}=l.useContext(pe);return{registerSender:e,setReady:t}}const Ja=Object.freeze(Object.defineProperty({__proto__:null,AgentInputProvider:Wn,useAgentInput:Un,useAgentInputChannel:yt,useRegisterAgentInput:Xn},Symbol.toStringTag,{value:"Module"})),vt=l.createContext({openPicker:()=>{}});function Jn({openPicker:e,children:t}){const r=l.useMemo(()=>({openPicker:e}),[e]);return n.jsx(vt.Provider,{value:r,children:t})}function jt(){return l.useContext(vt)}const qa=Object.freeze(Object.defineProperty({__proto__:null,FilePickerProvider:Jn,useFilePicker:jt},Symbol.toStringTag,{value:"Module"}));function _t({className:e=""}){const{openPicker:t}=jt();return n.jsxs("button",{type:"button",onClick:t,title:"Attach a file","aria-label":"Attach a file","data-testid":"attach-file-button",className:`inline-flex items-center gap-1 text-xs font-medium cursor-pointer bg-transparent border-none text-[var(--text-dim)] hover:text-[var(--text-primary)] transition ${e}`,children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:n.jsx("path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})}),"Attach file"]})}const Ga=Object.freeze(Object.defineProperty({__proto__:null,AttachFileButton:_t},Symbol.toStringTag,{value:"Module"})),Ge=15;function wt({chatName:e,prompt:t,slashCommand:r,height:a=400,onClose:s}){const o=l.useRef(null),c=l.useRef(null),i=l.useRef(null);l.useRef(t);const{config:p}=et(),u=(p==null?void 0:p.provider)??"claude",[b,h]=l.useState({kind:"connecting"}),[d,x]=l.useState(0),m=l.useCallback(E=>{const j=c.current;(j==null?void 0:j.readyState)===WebSocket.OPEN&&j.send(JSON.stringify({type:"input",data:E}))},[]),{registerSender:g,setReady:y}=yt(),f=l.useCallback(E=>{var j;return((j=c.current)==null?void 0:j.readyState)===WebSocket.OPEN?(c.current.send(JSON.stringify({type:"input",data:E})),!0):!1},[]),v=b.kind==="open";l.useEffect(()=>(v&&g(f),()=>g(null)),[g,f,v]),l.useEffect(()=>(y(v),()=>y(!1)),[y,v]);const k=l.useCallback(()=>{var E;((E=c.current)==null?void 0:E.readyState)===WebSocket.OPEN&&(g(f),y(!0)),jn(o.current,()=>{var j;return(j=i.current)==null?void 0:j.focus()})},[g,y,f]),{shellDialect:_}=dr(),w=Yn({provider:u,slashCommand:r,prompt:t,chatName:e,sendInput:m,permissionModeAuto:(p==null?void 0:p.claudePermissionModeAuto)??!0,shellDialect:_}),P=l.useRef(w);l.useEffect(()=>{P.current=w});const B=l.useRef(e);return l.useEffect(()=>{B.current=e}),l.useEffect(()=>{const E=o.current;if(!E)return;const j=new nn.Terminal({theme:{background:"#1a1a1a",foreground:"#d4d4d4",cursor:"#d4d4d4",selectionBackground:"#264f78"},fontSize:12,fontFamily:"'IBM Plex Mono', 'Menlo', 'Monaco', monospace",cursorBlink:!0,scrollback:5e3,allowProposedApi:!0}),F=new an.FitAddon;j.loadAddon(F),j.open(E);const N=un(j,E,{onError:S=>console.warn("[MiniAgentChat]",S)}),D=yn(j,{sendInput:S=>{const C=c.current;(C==null?void 0:C.readyState)===WebSocket.OPEN&&C.send(JSON.stringify({type:"input",data:S}))}});requestAnimationFrame(()=>{try{F.fit()}catch{}}),i.current=j;const T={current:"inline"},O={current:null},I={current:!1},A={current:!1};let K=0,R=null;function V(){h({kind:"connecting"});const S=sn({mode:T.current,sessionId:O.current??void 0,chatKey:e,cols:j.cols,rows:j.rows}),C=new WebSocket(S);C.binaryType="arraybuffer",c.current=C,C.onopen=()=>{K=0,h({kind:"open"}),_e(!0),window.dispatchEvent(new CustomEvent("miniagent-ws-open")),C.send(JSON.stringify({type:"resize",cols:j.cols,rows:j.rows}))},C.onmessage=L=>{if(L.data instanceof ArrayBuffer){j.write(new Uint8Array(L.data)),window.dispatchEvent(new CustomEvent("miniagent-output"));return}try{const $=JSON.parse(L.data);if($.type==="error"){A.current=!0,h({kind:"server-error",message:Sn($)});return}if($.type==="session-id"){if($.sessionId&&(O.current=$.sessionId,T.current="resume"),$.reattached===!0){I.current=!0,P.current.onReattached();return}I.current||(I.current=!0,P.current.arm());return}if($.type==="agent-idle"||$.type==="claude-idle"){window.dispatchEvent(new CustomEvent("miniagent-agent-idle",{detail:{chatName:B.current}}));return}if($.type==="agent-active"||$.type==="claude-active"){window.dispatchEvent(new CustomEvent("miniagent-agent-active",{detail:{chatName:B.current}}));return}if($.type==="agent-banner-ready"){P.current.onBannerReady();return}if($.type==="agent-auth-required"){window.dispatchEvent(new CustomEvent("agent-auth-required"));return}if($.type==="startup-failed"){P.current.onStartupFailed();return}}catch{j.write(L.data),window.dispatchEvent(new CustomEvent("miniagent-output"))}},C.onerror=()=>{},C.onclose=async()=>{if(_e(!1),A.current){h($=>$.kind==="server-error"?$:{kind:"ended"});return}const L=await it();if(!A.current){if(!L){h({kind:"server-stopped"}),R==null||R(),R=_n(2e3,()=>{A.current||window.location.reload()});return}if(K<Ge){const $=K<4?1e3*Math.pow(2,K):1e4;K++,h({kind:"reconnecting",attempt:K,maxAttempts:Ge}),setTimeout(()=>{A.current||V()},$)}else h({kind:"failed"})}}}try{F.fit()}catch{}V(),j.onData(S=>{const C=c.current;(C==null?void 0:C.readyState)===WebSocket.OPEN?C.send(JSON.stringify({type:"input",data:S})):x(L=>L+1)});const U=new ResizeObserver(()=>{try{F.fit();const S=c.current;(S==null?void 0:S.readyState)===WebSocket.OPEN&&S.send(JSON.stringify({type:"resize",cols:j.cols,rows:j.rows}))}catch{}});U.observe(E);function H(S){const C=i.current;if(!C)return;const L=S.target;if(L!=null&&L.closest(".xterm-viewport")||C.buffer.active.length<=C.rows)return;const ae=ln(S.deltaY,S.deltaMode);ae!==0&&(C.scrollLines(ae),S.preventDefault(),S.stopPropagation())}E.addEventListener("wheel",H,{passive:!1});function z(){var S;(S=i.current)==null||S.focus()}window.addEventListener("terminal-focus",z);function q(S){const C=S.detail,L=c.current;typeof C=="string"&&(L==null?void 0:L.readyState)===WebSocket.OPEN&&L.send(JSON.stringify({type:"input",data:C}))}return window.addEventListener("miniagent-send-input",q),()=>{var C;A.current=!0,_e(!1),R==null||R(),R=null,window.removeEventListener("terminal-focus",z),window.removeEventListener("miniagent-send-input",q),E.removeEventListener("wheel",H),U.disconnect(),N(),D();const S=c.current;(S==null?void 0:S.readyState)===WebSocket.OPEN&&S.close(),(C=i.current)==null||C.dispose()}},[u]),n.jsxs("div",{"data-codeyam-hydrated":"MiniAgentChat",className:"mt-2 border border-[var(--border-subtle)] rounded-lg overflow-hidden",children:[n.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 bg-[var(--bg-card)]",children:[n.jsx("span",{className:"text-xs font-medium text-[var(--accent-active)]",children:re(u)}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(_t,{}),s&&n.jsx("button",{onClick:s,className:"text-[var(--text-dim)] hover:text-[var(--text-primary)] text-xs bg-transparent border-none cursor-pointer",children:"Close"})]})]}),n.jsxs("div",{ref:o,className:"mini-agent-terminal",tabIndex:-1,onPointerDown:k,onClick:k,style:{height:a,background:"#1a1a1a",padding:"6px 10px",position:"relative",overflow:"hidden",outline:"none"},children:[n.jsx(xt,{status:b,pulseKey:d,onRefresh:()=>window.location.reload()}),n.jsx(bt,{status:w.status,onRetry:w.retry})]})]})}const Qa=Object.freeze(Object.defineProperty({__proto__:null,MiniAgentChat:wt},Symbol.toStringTag,{value:"Module"}));function St(e){return e>=500?"transient":"rejected"}function kt({provider:e,onAuthenticated:t}){const[r,a]=l.useState(""),[s,o]=l.useState(!1),[c,i]=l.useState(null),[p,u]=l.useState(!1),b=re(e),h=l.useCallback(async()=>{if(r.trim()){o(!0),i(null),u(!1);try{const d=await fetch("/api/auth/api-key",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({provider:e,key:r.trim()})});if(!d.ok){if(St(d.status)==="transient"){u(!0),i(`The editor was briefly unreachable (HTTP ${d.status}). Your key wasn't rejected — try again.`);return}const x=await d.json().catch(()=>({}));i(x.error??`Could not save the key (HTTP ${d.status}).`);return}a(""),t()}catch{u(!0),i("Could not reach the editor to save the key. Try again.")}finally{o(!1)}}},[r,e,t]);return n.jsxs("div",{"data-testid":"api-key-flow",className:"space-y-3",children:[n.jsxs("p",{className:"text-sm text-[#8E8E8E]",children:["Paste your ",b," API key. It is stored locally in",n.jsx("code",{className:"mx-1 text-[#D7FF63]",children:".codeyam/editor.local.json"}),"and never committed."]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("input",{type:"password",value:r,onChange:d=>a(d.target.value),placeholder:`${b} API key`,className:"flex-1 min-w-0 px-2 py-1.5 rounded bg-black border border-[#3A3A3A] text-white text-sm"}),n.jsx("button",{onClick:()=>void h(),disabled:s||!r.trim(),className:"px-3 py-1.5 text-sm rounded-md bg-[#D7FF63] text-black font-medium cursor-pointer disabled:opacity-50",children:s?"Saving…":"Save"})]}),c?n.jsxs("div",{className:"space-y-2",children:[n.jsx("p",{className:"text-sm text-[#FF8B43]",children:c}),p?n.jsx("button",{"data-testid":"api-key-flow-retry",onClick:()=>void h(),disabled:s||!r.trim(),className:"px-3 py-1.5 text-sm rounded-md border border-[#3A3A3A] text-white font-medium cursor-pointer disabled:opacity-50",children:s?"Saving…":"Retry"}):null]}):null]})}const Za=Object.freeze(Object.defineProperty({__proto__:null,ApiKeyFlow:kt,classifyApiKeySaveFailure:St},Symbol.toStringTag,{value:"Module"})),qn=500,Gn=75e3;function Ct({onAuthenticated:e}){const[t,r]=l.useState({state:"starting"}),[a,s]=l.useState(""),[o,c]=l.useState(!1),[i,p]=l.useState(!1),[u,b]=l.useState(!1),[h,d]=l.useState(!1),x=l.useRef(!1),m=l.useRef(e);m.current=e;const g=l.useCallback(async()=>{try{const w=await fetch("/api/auth/status");if(!w.ok)return;const P=await w.json();r(P),P.state==="authenticated"&&!x.current&&(x.current=!0,m.current())}catch{}},[]),y=l.useCallback(async()=>{x.current=!1,b(!1),r({state:"starting"});try{await fetch("/api/auth/start",{method:"POST"})}catch{r({state:"failed",error:"Could not start the login process."})}},[]);l.useEffect(()=>{y()},[y]),l.useEffect(()=>{const w=window.setInterval(()=>void g(),qn);return()=>window.clearInterval(w)},[g]),l.useEffect(()=>{if(t.state!=="starting"){b(!1);return}const w=window.setTimeout(()=>b(!0),Gn);return()=>window.clearTimeout(w)},[t.state]);const f=l.useCallback(async()=>{if(a.trim()){c(!0);try{const w=await fetch("/api/auth/code",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({code:a.trim()})});if(w.ok)s("");else{const P=await w.json().catch(()=>({}));r({state:"failed",error:P.error??"Code not accepted — check the value and try again."})}}catch{r({state:"failed",error:"Could not submit the code."})}finally{c(!1)}}},[a]),v=l.useCallback(async()=>{try{await fetch("/api/auth/cancel",{method:"POST"})}catch{}y()},[y]),k=l.useCallback(async()=>{d(!0);try{await fetch("/api/auth/refresh-cache",{method:"POST"}),e()}catch{}finally{d(!1)}},[e]),_=l.useCallback(()=>{var w;t.url&&((w=navigator.clipboard)==null||w.writeText(t.url),p(!0),window.setTimeout(()=>p(!1),1500))},[t.url]);return u&&t.state==="starting"?n.jsxs("div",{"data-testid":"claude-oauth-timeout",className:"space-y-3",children:[n.jsxs("p",{className:"text-sm text-[#FF8B43]",children:["Login link preparation timed out — the backend may be wedged. Try again, recheck if you already authenticated elsewhere, or open a terminal and run ",n.jsx("code",{className:"text-white",children:"claude /login"})," ","directly."]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx("button",{onClick:()=>void v(),"data-testid":"claude-oauth-timeout-retry",className:"px-3 py-2 text-sm rounded-md bg-[#D7FF63] text-black font-medium cursor-pointer",children:"Retry"}),n.jsx("button",{onClick:()=>void k(),"data-testid":"claude-oauth-timeout-recheck",disabled:h,className:"px-3 py-2 text-sm rounded-md border border-[#3A3A3A] text-white cursor-pointer disabled:opacity-50",children:h?"Rechecking…":"I already logged in — recheck"})]})]}):t.state==="failed"?n.jsxs("div",{"data-testid":"claude-oauth-failed",className:"space-y-3",children:[n.jsx("p",{className:"text-sm text-[#FF8B43]",children:t.error??"Login failed."}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx("button",{onClick:()=>void v(),className:"px-3 py-2 text-sm rounded-md bg-[#D7FF63] text-black font-medium cursor-pointer",children:"Try again"}),n.jsx("button",{onClick:()=>void k(),"data-testid":"claude-oauth-failed-recheck",disabled:h,className:"px-3 py-2 text-sm rounded-md border border-[#3A3A3A] text-white cursor-pointer disabled:opacity-50",children:h?"Rechecking…":"I already logged in — recheck"})]})]}):t.state==="authenticated"?n.jsx("p",{"data-testid":"claude-oauth-authenticated",className:"text-sm text-[#D7FF63]",children:"Connected. Opening Build…"}):t.state==="url-ready"&&t.url?n.jsxs("div",{"data-testid":"claude-oauth-url-ready",className:"space-y-3",children:[n.jsx("p",{className:"text-sm text-[#8E8E8E]",children:"Open this URL in your browser, approve access, then paste the code back here:"}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("code",{className:"flex-1 min-w-0 truncate px-2 py-1.5 rounded bg-black text-[#D7FF63] text-xs",children:t.url}),n.jsx("button",{onClick:_,className:"px-2 py-1.5 text-xs rounded-md border border-[#3A3A3A] text-white cursor-pointer",children:i?"Copied":"Copy"}),n.jsx("a",{href:t.url,target:"_blank",rel:"noreferrer",className:"px-2 py-1.5 text-xs rounded-md border border-[#3A3A3A] text-white cursor-pointer",children:"Open"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("input",{type:"text",value:a,onChange:w=>s(w.target.value),placeholder:"Paste the code from the browser here",className:"flex-1 min-w-0 px-2 py-1.5 rounded bg-black border border-[#3A3A3A] text-white text-sm"}),n.jsx("button",{onClick:()=>void f(),disabled:o||!a.trim(),className:"px-3 py-1.5 text-sm rounded-md bg-[#D7FF63] text-black font-medium cursor-pointer disabled:opacity-50",children:o?"Submitting…":"Submit"})]})]}):n.jsx("p",{"data-testid":"claude-oauth-starting",className:"text-sm text-[#8E8E8E]",children:"Preparing the login link…"})}const es=Object.freeze(Object.defineProperty({__proto__:null,ClaudeOAuthFlow:Ct},Symbol.toStringTag,{value:"Module"}));function Nt({provider:e,onAuthenticated:t,onClose:r}){const a=re(e);return n.jsx("div",{"data-testid":"provider-auth-modal",className:"fixed inset-0 z-[100] flex items-center justify-center",style:{background:"rgba(30, 30, 30, 0.90)"},children:n.jsxs("div",{className:"w-[32rem] max-w-[90vw] rounded-lg border border-[#3A3A3A] bg-[#1E1E1E] p-6 space-y-4",children:[n.jsxs("div",{className:"flex items-start justify-between",children:[n.jsxs("h2",{className:"text-base font-medium text-white",children:["Connect your ",a," account"]}),n.jsx("button",{onClick:r,"aria-label":"Close",className:"text-[#8E8E8E] hover:text-white cursor-pointer",children:"✕"})]}),e==="claude"?n.jsx(Ct,{onAuthenticated:t}):n.jsx(kt,{provider:e,onAuthenticated:t})]})})}const ts=Object.freeze(Object.defineProperty({__proto__:null,ProviderAuthModal:Nt},Symbol.toStringTag,{value:"Module"}));function Qn(e){const t=new Date(e).getTime()-Date.now(),r=Math.abs(Math.round(t/36e5));if(r<1)return t<0?"just now":"very soon";if(r<48)return t<0?`${r} h ago`:`in ${r} h`;const a=Math.round(r/24);return t<0?`${a} d ago`:`in ${a} d`}function Et({provider:e,credsPresent:t=!0,reason:r=null,expiresAt:a=null,sessionOngoing:s=!1,onAuthenticated:o,onAuthorized:c}){const[i,p]=l.useState(!1),[u,b]=l.useState(!1),h=re(e),d=l.useCallback(()=>{p(!1),o(),c==null||c()},[o,c]),x=l.useCallback(async()=>{b(!0);try{await fetch("/api/auth/refresh-cache",{method:"POST"}),o()}catch{}finally{b(!1)}},[o]),m=e==="claude"&&!t,g=a?` (token expired ${Qn(a)})`:"",y=m?`${h} credentials file is missing`:r==="token-expired"?`Your ${h} token has expired`:r==="api-401"?`${h} authentication rejected (401)`:`Connect your ${h} account`,f=s?" Your Build session stays open — you can finish logging in here or directly in the Build terminal.":"",v=m?"The editor couldn't find ~/.claude/.credentials.json on this machine — likely deleted between editor restarts (operator-side action, a Reconfigure, or a stale image). Re-seed by clicking Authenticate to run OAuth, or — on a fleet VM — copy the file from a donor VM through the dashboard.":r==="token-expired"?`Your ${h} token has expired${g} — click Authenticate to refresh it. On a fleet VM the dashboard can copy a fresh token from a donor VM.${f}`:r==="api-401"?`The ${h} server rejected your credentials (401)${g}. This usually means the token was revoked or expired. Click Authenticate to re-connect.${f}`:s?"You can finish logging in here or directly in the Build terminal — your session stays open either way. On a cloud VM the dashboard usually does this for you; locally you connect once here.":`Authentication used to happen inside the Build terminal. Now it lives here, out of your way. Connect ${h} to unlock the Build tab. On a cloud VM the dashboard usually does this for you; locally you connect once here.`;return n.jsxs("div",{"data-testid":"provider-auth-gate","data-auth-variant":m?"creds-missing":"needs-login","data-auth-card":!0,className:"m-4 rounded-lg border border-[#D7FF63]/40 bg-[#1E1E1E] p-5 space-y-3",children:[n.jsx("h2",{className:"text-base font-medium text-white",children:y}),n.jsx("p",{className:"text-sm text-[#8E8E8E]",children:v}),n.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[n.jsx("button",{onClick:()=>p(!0),className:"px-3 py-2 text-sm rounded-md bg-[#D7FF63] text-black font-medium cursor-pointer",children:"Authenticate"}),n.jsx("button",{onClick:()=>void x(),"data-testid":"provider-auth-gate-recheck",disabled:u,className:"px-3 py-2 text-sm rounded-md border border-[#3A3A3A] text-white cursor-pointer disabled:opacity-50",children:u?"Rechecking…":"Already logged in? Recheck"})]}),i?n.jsx(Nt,{provider:e,onAuthenticated:d,onClose:()=>p(!1)}):null]})}const rs=Object.freeze(Object.defineProperty({__proto__:null,ProviderAuthenticateCta:Et},Symbol.toStringTag,{value:"Module"}));let ke=!1;function Tt(e){const{state:t,provider:r,credsPresent:a,reason:s,expiresAt:o,refresh:c}=rn(),[i]=l.useState(()=>ke);return l.useEffect(()=>{t==="authenticated"?ke=!0:t==="needs-login"&&(ke=!1)},[t]),t==="needs-login"?n.jsx(Et,{provider:r,credsPresent:a,reason:s,expiresAt:o,onAuthenticated:()=>void c(),onAuthorized:()=>{}}):t==="authenticated"||i?n.jsx(wt,{...e}):n.jsxs("div",{"data-testid":"gated-agent-chat-checking",className:"mt-2 flex items-center gap-3 rounded-lg border border-[var(--border-subtle)] px-3 py-4",children:[n.jsx("span",{"aria-hidden":"true",className:"h-4 w-4 rounded-full border-2 border-[var(--text-dim)] border-t-transparent animate-spin"}),n.jsx("span",{className:"text-xs text-[var(--text-dim)]",children:"Checking your account…"})]})}const ns=Object.freeze(Object.defineProperty({__proto__:null,GatedAgentChat:Tt},Symbol.toStringTag,{value:"Module"}));function Ot(){return n.jsx("div",{className:"flex h-full items-center justify-center p-6",children:n.jsxs("div",{className:"max-w-xs text-center space-y-2",children:[n.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:"No scenario data yet."}),n.jsx("p",{className:"text-xs text-[var(--text-dim)]",children:"Seed data and HTTP mocks will appear here as the scenario captures them, or add them with the scenario editor."})]})})}const as=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanelEmptyState:Ot},Symbol.toStringTag,{value:"Module"}));function Mt({variant:e,onClose:t}){return e!=="slideOver"?null:n.jsx("button",{onClick:t,className:"rounded border border-[var(--border-default)] bg-transparent px-2 py-1 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] cursor-pointer",children:"Close"})}const ss=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanelCloseButton:Mt},Symbol.toStringTag,{value:"Module"}));function At({variant:e,providerLabel:t,chatOpen:r,onToggleChat:a}){const s=e==="inline",o=s?"flex items-center gap-1.5 px-3 py-1.5 rounded border text-xs font-medium cursor-pointer transition-colors":"flex items-center gap-1.5 px-2.5 py-1 rounded border text-xs cursor-pointer transition-colors",c=r?"border-[var(--accent-active)] bg-[var(--accent-active)]/15 text-[var(--accent-active)]":s?"border-[var(--accent-active)] bg-[var(--accent-active)] text-black hover:bg-[var(--accent-active)]/90":"border-[var(--border-default)] bg-transparent text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:border-[var(--accent-active)]/40";return n.jsxs("button",{type:"button",onClick:a,className:`${o} ${c}`,title:`Open a chat with ${t} seeded with this scenario's context`,children:[n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:n.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),"Edit with ",t]})}const os=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanelEditChatButton:At},Symbol.toStringTag,{value:"Module"})),Oe=new Set,Me=new Set;let Pt={isActive:!1,previewSlug:null};function Zn(){for(const e of Oe)e()}function is(e){return Oe.add(e),()=>{Oe.delete(e)}}function cs(e){Pt=e;for(const t of Me)t(e)}function ea(e){return Me.add(e),()=>{Me.delete(e)}}function Qe(){return Pt}function ta(){const[e,t]=l.useState(()=>Qe());return l.useEffect(()=>(t(Qe()),ea(t)),[]),e}function Rt({panelSlug:e,scenarioState:t}){const r=ta(),{isActive:a,previewSlug:s}=t??r;return s!==e?null:n.jsxs("button",{type:"button","aria-pressed":a,onClick:()=>Zn(),title:a?"Exit inspect data source":"Inspect data source — click a value in the live preview to see its mock",className:a?"flex items-center gap-1.5 px-2.5 py-1 rounded border text-xs cursor-pointer transition-colors border-[var(--accent-active)] bg-[var(--accent-active)]/15 text-[var(--accent-active)]":"flex items-center gap-1.5 px-2.5 py-1 rounded border text-xs cursor-pointer transition-colors border-[var(--border-default)] bg-transparent text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:border-[var(--accent-active)]/40",children:[n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("circle",{cx:"11",cy:"11",r:"8"}),n.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),a?"Inspecting…":"Inspect data"]})}const ls=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanelInspectButton:Rt},Symbol.toStringTag,{value:"Module"}));function Dt({variant:e,slug:t}){const r=()=>window.open(mr(t),"_blank");return e==="slideOver"?n.jsx("button",{type:"button",onClick:r,className:"p-1.5 rounded text-[var(--text-dim)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-card)] transition-colors cursor-pointer",title:"Open in new window",children:n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),n.jsx("polyline",{points:"15 3 21 3 21 9"}),n.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})}):e==="inline"?n.jsxs("button",{type:"button",onClick:r,className:"flex items-center gap-1.5 px-2.5 py-1 rounded border border-[var(--border-default)] bg-transparent text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] hover:border-[var(--accent-active)]/40 transition-colors cursor-pointer",title:"Open the full data editor in a new browser tab",children:[n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),n.jsx("polyline",{points:"15 3 21 3 21 9"}),n.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]}),"Open in new tab"]}):null}const ds=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanelOpenInNewButton:Dt},Symbol.toStringTag,{value:"Module"}));function It(e){if(!e)return"Unsaved changes";const t=[];e.mocks.length>0&&t.push(`${e.mocks.length} mock${e.mocks.length===1?"":"s"}`);const r=e.seed.length;return r>0&&t.push(`${r} seed ${r===1?"table":"tables"}`),t.length>0?`Unsaved changes (${t.join(", ")})`:"Unsaved changes"}function Lt({diff:e,saving:t,cancelling:r,error:a,onSave:s,onCancel:o}){return n.jsxs("div",{className:"flex items-center justify-between gap-2 rounded border border-amber-500/40 bg-amber-500/10 px-2 py-1.5","data-testid":"scenario-draft-bar",children:[n.jsx("span",{className:"text-xs text-amber-300 font-medium",children:It(e)}),n.jsxs("div",{className:"flex items-center gap-2",children:[a&&n.jsx(te,{text:a,className:"text-xs text-red-400"}),n.jsx("button",{type:"button",onClick:o,disabled:r||t,className:"px-2 py-0.5 text-xs rounded border border-[var(--border-default)] bg-[var(--bg-surface)] text-[var(--text-primary)] hover:bg-[var(--bg-input)] disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer",children:r?"Discarding…":"Cancel"}),n.jsx("button",{type:"button",onClick:s,disabled:r||t,className:"px-3 py-0.5 text-xs rounded border border-[var(--accent-blue)] bg-[var(--accent-blue)]/20 text-[var(--accent-blue)] hover:bg-[var(--accent-blue)]/30 disabled:opacity-40 disabled:cursor-not-allowed cursor-pointer",children:t?"Saving…":"Save"})]})]})}const us=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDraftBar:Lt,summarizeDraftDiff:It},Symbol.toStringTag,{value:"Module"}));function $t({title:e,slug:t,provider:r,chatOpen:a,onToggleChat:s,variant:o,onClose:c,draftDirty:i,draftDiff:p,draftSaving:u,draftCancelling:b,draftError:h,onSave:d,onCancel:x}){const m=re(r),g=!!i&&!!d&&!!x;return n.jsxs("header",{className:"flex flex-col gap-2 border-b border-[var(--border-subtle)] bg-[var(--bg-deep)] px-4 py-3",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsx("div",{className:"min-w-0",children:n.jsxs("h2",{className:"text-sm font-medium text-[var(--text-primary)] truncate",children:["Scenario data: ",e]})}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(At,{variant:o,providerLabel:m,chatOpen:a,onToggleChat:s}),n.jsx(Rt,{panelSlug:t}),n.jsx(Dt,{variant:o,slug:t}),c&&n.jsx(Mt,{variant:o,onClose:c})]})]}),g&&d&&x&&n.jsx(Lt,{diff:p??null,saving:u??!1,cancelling:b??!1,error:h??null,onSave:d,onCancel:x})]})}const fs=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanelHeader:$t},Symbol.toStringTag,{value:"Module"}));function ra(e,t){const[r,a]=l.useState(e.status??200),[s,o]=l.useState(e.body??null),[c,i]=l.useState(()=>Object.entries(e.headers??{}).map(([h,d])=>({name:h,value:d})));l.useEffect(()=>{a(e.status??200),o(e.body??null),i(Object.entries(e.headers??{}).map(([h,d])=>({name:h,value:d})))},[t,e.status,e.body,e.headers]);const p=l.useMemo(()=>e.headers??{},[e.headers]),u=l.useMemo(()=>{if((e.status??200)!==r||JSON.stringify(e.body??null)!==JSON.stringify(s))return!0;const h={};for(const g of c)g.name.trim()&&(h[g.name.trim()]=g.value);const d=p,x=Object.keys(d),m=Object.keys(h);if(x.length!==m.length)return!0;for(const g of m)if(d[g]!==h[g])return!0;return!1},[r,s,c,e.status,e.body,p]);return{status:r,setStatus:a,body:s,setBody:o,headers:c,setHeaders:i,isDirty:u,buildPayload:()=>{const h={};for(const d of c)d.name.trim()&&(h[d.name.trim()]=d.value);return{status:r,body:s,headers:h}}}}function Bt({body:e,onBodyChange:t}){const{copied:r,copy:a}=ur();async function s(){try{const c=await navigator.clipboard.readText(),i=JSON.parse(c);t(i)}catch{}}function o(){a(JSON.stringify(e,null,2))}return n.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[n.jsx("button",{type:"button",onClick:()=>void s(),className:"text-[10px] px-2 py-0.5 rounded border border-[var(--border-default)] bg-transparent text-[var(--text-muted)] hover:text-[var(--text-primary)] cursor-pointer",children:"Paste"}),n.jsx("button",{type:"button",onClick:o,className:"text-[10px] px-2 py-0.5 rounded border border-[var(--border-default)] bg-transparent text-[var(--text-muted)] hover:text-[var(--text-primary)] cursor-pointer",children:r?"Copied":"Copy"})]})}const ps=Object.freeze(Object.defineProperty({__proto__:null,JsonBodyActions:Bt},Symbol.toStringTag,{value:"Module"}));function ne(e){return JSON.stringify(e)}function Ft(e,t){return e?e instanceof Set?e.has(t):e.includes(t):!1}function na(e){const t=new Set;function r(a,s){if(a!==null&&typeof a=="object")if(t.add(ne(s)),Array.isArray(a))a.forEach((o,c)=>r(o,[...s,c]));else for(const[o,c]of Object.entries(a))r(c,[...s,o])}return r(e,[]),t}function aa(e){return e===null?"text-slate-400 italic":typeof e=="string"?"text-emerald-300":typeof e=="number"?"text-amber-300":typeof e=="boolean"?"text-[#D7FF63]":"text-[var(--text-primary)]"}function sa(e){return e===null?"null":typeof e=="string"?`"${e}"`:String(e)}function oa(e){return e===null?"null":typeof e=="string"?e:String(e)}function ia(e){const t=e.trim();if(t==="")return"";if(t==="null")return null;if(t==="true")return!0;if(t==="false")return!1;try{return JSON.parse(t)}catch{return e}}function he(e){return JSON.parse(JSON.stringify(e))}function ca(e,t,r){if(t.length===0)return r;const a=he(e);let s=a;for(let o=0;o<t.length-1;o++)s=s[t[o]];return s[t[t.length-1]]=r,a}function $e(e,t){if(t.length===0)return e;const r=he(e);let a=r;for(let o=0;o<t.length-1;o++)a=a[t[o]];const s=t[t.length-1];return Array.isArray(a)?a.splice(s,1):delete a[s],r}function la(e,t){const r=he(e);let a=r;for(const s of t)a=a[s];return Array.isArray(a)&&a.push(null),r}function da(e,t,r){const a=he(e);let s=a;for(const o of t)s=s[o];return s&&typeof s=="object"&&!Array.isArray(s)&&(s[r]=""),a}function ua(e){if(typeof e!="string"||e.length===0||e!=="$"&&!e.startsWith("$.")&&!e.startsWith("$["))return null;const t=[];let r=e[0]==="$"?1:0;for(;r<e.length;){const a=e[r];if(a==="."){r+=1;const s=r;for(;r<e.length&&e[r]!=="."&&e[r]!=="[";)r+=1;const o=e.slice(s,r);if(o.length===0)return null;t.push(o)}else if(a==="["){const s=e.indexOf("]",r);if(s===-1)return null;const o=e.slice(r+1,s);if(o.length===0)return null;const c=Number(o);if(!Number.isInteger(c)||c<0)return null;t.push(c),r=s+1}else return null}return t}function fa(e,t){l.useEffect(()=>{if(!e)return;const r=ua(e);r&&t(a=>{const s=new Set(a);for(let o=0;o<r.length;o++)s.add(ne(r.slice(0,o)));return s})},[e,t])}function me({collapsible:e,isOpen:t,onToggle:r,parentKey:a,readOnly:s,onRemove:o,children:c}){return n.jsxs("div",{className:"group/row flex items-center gap-1 min-h-[1.5em] hover:bg-[var(--bg-card)]/30 rounded px-1",children:[e?n.jsx("button",{type:"button",onClick:r,className:"w-4 h-4 flex items-center justify-center text-[var(--text-dim)] hover:text-[var(--text-primary)] bg-transparent border-none cursor-pointer p-0","aria-label":t?"Collapse":"Expand",children:n.jsx("span",{className:"text-[10px]",children:t?"▾":"▸"})}):n.jsx("span",{className:"w-4"}),a!==null&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"text-cyan-300",children:typeof a=="number"?`[${a}]`:a}),n.jsx("span",{className:"text-[var(--text-dim)]",children:":"})]}),n.jsx("div",{className:"flex-1 min-w-0 flex items-center gap-1",children:c}),!s&&o&&n.jsx("button",{type:"button",onClick:o,className:"opacity-0 group-hover/row:opacity-100 text-[10px] text-[var(--text-dim)] hover:text-red-400 bg-transparent border-none cursor-pointer px-1",title:"Remove",children:"×"})]})}const hs=Object.freeze(Object.defineProperty({__proto__:null,JsonTreeNodeLine:me},Symbol.toStringTag,{value:"Module"}));function Kt(e){const{value:t,path:r,parentKey:a,expanded:s,onToggle:o,readOnly:c}=e,i=ne(r),p=Ft(s,i),u=t.length>0;return n.jsxs("div",{children:[n.jsxs(me,{collapsible:u,isOpen:p,onToggle:()=>o(i),parentKey:a,readOnly:c,onRemove:r.length>0?()=>e.onValueChange($e(e.rootValue,r)):null,children:[n.jsx("span",{className:"text-[var(--text-dim)]",children:"["}),!p&&n.jsxs(n.Fragment,{children:[u&&n.jsxs("span",{className:"text-[var(--text-dim)] italic",children:[" ","…",t.length," item",t.length===1?"":"s"," "]}),n.jsx("span",{className:"text-[var(--text-dim)]",children:"]"})]})]}),p&&n.jsxs("div",{className:"ml-4 border-l border-[var(--border-subtle)] pl-2",children:[t.map((b,h)=>l.createElement(xe,{...e,key:h,value:b,path:[...r,h],parentKey:h,isLast:h===t.length-1})),!c&&n.jsx("button",{type:"button",onClick:()=>e.onValueChange(la(e.rootValue,r)),className:"text-[10px] text-[var(--accent-blue)] hover:underline bg-transparent border-none cursor-pointer py-0.5",children:"+ Add item"})]}),p&&n.jsx("div",{className:"text-[var(--text-dim)]",children:"]"})]})}const ms=Object.freeze(Object.defineProperty({__proto__:null,JsonTreeArrayNode:Kt},Symbol.toStringTag,{value:"Module"}));function zt({onSave:e,onCancel:t}){const[r,a]=l.useState("");return n.jsxs("div",{className:"flex items-center gap-1 py-0.5",children:[n.jsx("span",{className:"text-[var(--text-dim)] text-[10px]",children:"+ key:"}),n.jsx("input",{autoFocus:!0,value:r,onChange:s=>a(s.target.value),onBlur:()=>e(r),onKeyDown:s=>{s.key==="Enter"?(s.preventDefault(),e(r)):s.key==="Escape"&&(s.preventDefault(),t())},placeholder:"keyName",className:"rounded border border-[var(--accent-active)]/50 bg-[var(--bg-surface)] px-1 py-0 text-xs font-mono text-[var(--text-primary)] min-w-[6rem]"})]})}const xs=Object.freeze(Object.defineProperty({__proto__:null,JsonTreeAddKeyInput:zt},Symbol.toStringTag,{value:"Module"}));function Ht(e){const{value:t,path:r,parentKey:a,expanded:s,onToggle:o,readOnly:c,addingKeyAtPath:i,onStartAddKey:p,onStopAddKey:u}=e,b=ne(r),h=Ft(s,b),d=Object.entries(t),x=d.length>0,m=i===b;return n.jsxs("div",{children:[n.jsxs(me,{collapsible:x,isOpen:h,onToggle:()=>o(b),parentKey:a,readOnly:c,onRemove:r.length>0?()=>e.onValueChange($e(e.rootValue,r)):null,children:[n.jsx("span",{className:"text-[var(--text-dim)]",children:"{"}),!h&&n.jsxs(n.Fragment,{children:[x&&n.jsxs("span",{className:"text-[var(--text-dim)] italic",children:[" ","…",d.length," key",d.length===1?"":"s"," "]}),n.jsx("span",{className:"text-[var(--text-dim)]",children:"}"})]})]}),h&&n.jsxs("div",{className:"ml-4 border-l border-[var(--border-subtle)] pl-2",children:[d.map(([g,y],f)=>l.createElement(xe,{...e,key:g,value:y,path:[...r,g],parentKey:g,isLast:f===d.length-1})),!c&&!m&&n.jsx("button",{type:"button",onClick:()=>p(b),className:"text-[10px] text-[var(--accent-blue)] hover:underline bg-transparent border-none cursor-pointer py-0.5",children:"+ Add key"}),!c&&m&&n.jsx(zt,{onSave:g=>{g.trim()&&e.onValueChange(da(e.rootValue,r,g.trim())),u()},onCancel:u})]}),h&&n.jsx("div",{className:"text-[var(--text-dim)]",children:"}"})]})}const bs=Object.freeze(Object.defineProperty({__proto__:null,JsonTreeObjectNode:Ht},Symbol.toStringTag,{value:"Module"}));function Vt({initial:e,onSave:t,onCancel:r}){const[a,s]=l.useState(e);return n.jsx("input",{autoFocus:!0,value:a,onChange:o=>s(o.target.value),onBlur:()=>t(a),onKeyDown:o=>{o.key==="Enter"?(o.preventDefault(),t(a)):o.key==="Escape"&&(o.preventDefault(),r())},className:"flex-1 min-w-[4rem] rounded border border-[var(--accent-active)]/50 bg-[var(--bg-surface)] px-1 py-0 text-xs font-mono text-[var(--text-primary)]"})}const gs=Object.freeze(Object.defineProperty({__proto__:null,JsonTreePrimitiveEditor:Vt},Symbol.toStringTag,{value:"Module"}));function Yt(e){const{value:t,path:r,parentKey:a,readOnly:s,editingPath:o,onStartEdit:c,onStopEdit:i}=e,p=ne(r),u=o===p;return n.jsx(me,{collapsible:!1,isOpen:!1,parentKey:a,readOnly:s,onToggle:()=>{},onRemove:r.length>0?()=>e.onValueChange($e(e.rootValue,r)):null,children:u?n.jsx(Vt,{initial:oa(t),onSave:b=>{const h=ia(b);e.onValueChange(ca(e.rootValue,r,h)),i()},onCancel:i}):n.jsx("button",{type:"button",onClick:s?void 0:()=>c(p),disabled:s,className:`${s?"":"hover:bg-[var(--bg-card)] cursor-pointer"} bg-transparent border-none px-1 py-0 rounded ${aa(t)} text-left font-mono`,title:s?void 0:"Click to edit",children:sa(t)})})}const ys=Object.freeze(Object.defineProperty({__proto__:null,JsonTreePrimitiveNode:Yt},Symbol.toStringTag,{value:"Module"}));function xe(e){const{value:t}=e;return Array.isArray(t)?n.jsx(Kt,{...e,value:t}):t!==null&&typeof t=="object"?n.jsx(Ht,{...e,value:t}):n.jsx(Yt,{...e})}const vs=Object.freeze(Object.defineProperty({__proto__:null,JsonTreeNode:xe},Symbol.toStringTag,{value:"Module"}));function be({value:e,onChange:t,readOnly:r=!1,focusJsonPath:a}){const[s,o]=l.useState(()=>na(e)),[c,i]=l.useState(null),[p,u]=l.useState(null);fa(a,o);function b(h){o(d=>{const x=new Set(d);return x.has(h)?x.delete(h):x.add(h),x})}return n.jsx("div",{className:"flex flex-col h-full min-h-0",children:n.jsx("div",{className:"flex-1 min-h-0 overflow-auto font-mono text-xs leading-relaxed text-[var(--text-primary)] bg-[var(--bg-input)] border border-[var(--border-default)] rounded p-3",children:n.jsx(xe,{value:e,path:[],parentKey:null,isLast:!0,readOnly:r,expanded:s,editingPath:c,addingKeyAtPath:p,onToggle:b,onStartEdit:i,onStopEdit:()=>i(null),onStartAddKey:u,onStopAddKey:()=>u(null),onValueChange:t,rootValue:e})})})}const js=Object.freeze(Object.defineProperty({__proto__:null,JsonTreeEditor:be},Symbol.toStringTag,{value:"Module"}));function Wt({headers:e,onChange:t}){function r(o,c){t(e.map((i,p)=>p===o?{...i,...c}:i))}function a(){t([...e,{name:"",value:""}])}function s(o){t(e.filter((c,i)=>i!==o))}return n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"Headers"}),n.jsx("button",{type:"button",onClick:a,className:"text-xs text-[var(--accent-blue)] hover:underline bg-transparent border-none cursor-pointer",children:"+ Add"})]}),e.length===0&&n.jsx("p",{className:"text-xs text-[var(--text-dim)] italic",children:"No headers"}),e.map((o,c)=>n.jsxs("div",{className:"flex gap-2",children:[n.jsx("input",{value:o.name,onChange:i=>r(c,{name:i.target.value}),placeholder:"Name",className:"flex-1 rounded border border-[var(--border-default)] bg-[var(--bg-surface)] px-2 py-1 text-xs font-mono"}),n.jsx("input",{value:o.value,onChange:i=>r(c,{value:i.target.value}),placeholder:"Value",className:"flex-1 rounded border border-[var(--border-default)] bg-[var(--bg-surface)] px-2 py-1 text-xs font-mono"}),n.jsx("button",{type:"button",onClick:()=>s(c),className:"px-2 text-xs text-[var(--text-dim)] hover:text-red-400 bg-transparent border-none cursor-pointer",children:"×"})]},c))]})}const _s=Object.freeze(Object.defineProperty({__proto__:null,MockBodyHeadersEditor:Wt},Symbol.toStringTag,{value:"Module"})),Ce=5;function pa(e,t){if(e==="loading")return"Computing impact…";if(e==null)return"";if(t.kind==="scenario")return"Affects only this scenario.";if(e.length===0)return"Affects no other scenarios.";const r=e.length===1?"scenario":"scenarios",a=e.slice(0,Ce).join(", "),s=e.length>Ce?`, +${e.length-Ce} more`:"";return`Affects ${e.length} ${r}: ${a}${s}`}function ha(e){const t=[{label:"This scenario only",description:"Write to this scenario's mocks file. The row's source flips to scenario.",scope:{kind:"scenario"}}];return e.source==="shared"&&e.sharedSlug&&t.push({label:`Shared data set "${e.sharedSlug}"`,description:"Write to the shared set this row came from. Affects every scenario opted into it.",scope:{kind:"shared",slug:e.sharedSlug}}),(e.source==="default"||e.source==="shared")&&t.push({label:"Defaults",description:"Write to _default.json. Affects every scenario that falls through to defaults for this route.",scope:{kind:"default"}}),t}function ma(e,t){if(e.source==="default"){const r=t.findIndex(a=>a.scope.kind==="default");if(r>=0)return r}if(e.source==="shared"){const r=t.findIndex(a=>a.scope.kind==="shared"&&a.scope.slug===(e.sharedSlug??""));if(r>=0)return r}return 0}function xa(e,t,r){const[a,s]=l.useState({}),o=r.map(c=>X(c.scope)).join("|");return l.useEffect(()=>{let c=!1;return(async()=>{const p={};for(const u of r)p[X(u.scope)]="loading";s(p);for(const u of r)try{const b=await Cr(e,t,u.scope);if(c)return;s(h=>({...h,[X(u.scope)]:b}))}catch{if(c)return;s(b=>({...b,[X(u.scope)]:[]}))}})(),()=>{c=!0}},[e,t,o]),a}function Ut({choice:e,selected:t,impactLabel:r,onSelect:a}){return n.jsxs("label",{className:`flex cursor-pointer flex-col rounded border p-3 text-xs transition-colors ${t?"border-violet-500 bg-violet-500/10":"border-[var(--border-subtle)] hover:bg-[var(--bg-elevated)]"}`,children:[n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx("input",{type:"radio",name:"save-scope",checked:t,onChange:a}),n.jsx("span",{className:"font-medium text-[var(--text-primary)]",children:e.label})]}),n.jsx("span",{className:"mt-1 pl-6 text-[var(--text-muted)]",children:e.description}),n.jsx("span",{className:"mt-1 pl-6 text-[var(--text-dim)] italic",children:r})]})}const ws=Object.freeze(Object.defineProperty({__proto__:null,SaveScopeChoiceRow:Ut},Symbol.toStringTag,{value:"Module"}));function Xt({entry:e,scenarioSlug:t,routeKey:r,onCancel:a,onConfirm:s}){const o=ha(e),[c,i]=l.useState(()=>ma(e,o)),p=xa(t,r,o),[u,b]=l.useState(!1),[h,d]=l.useState(null),x=async()=>{const m=o[c];if(m){b(!0),d(null);try{await s(m.scope)}catch(g){d(g instanceof Error?g.message:"Save failed")}finally{b(!1)}}};return n.jsx("div",{role:"dialog","aria-modal":"true","aria-labelledby":"save-scope-modal-title",className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",children:n.jsxs("div",{className:"w-[28rem] max-w-[90vw] rounded-lg border border-[var(--border-default)] bg-[var(--bg-surface)] p-5 shadow-xl",children:[n.jsx("h2",{id:"save-scope-modal-title",className:"text-sm font-semibold text-[var(--text-primary)]",children:"Where should this save land?"}),n.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:r}),n.jsx("div",{className:"mt-4 space-y-2",children:o.map((m,g)=>n.jsx(Ut,{choice:m,selected:c===g,impactLabel:pa(p[X(m.scope)],m.scope),onSelect:()=>i(g)},X(m.scope)))}),h&&n.jsx(te,{text:h,className:"text-xs text-red-400",rowClassName:"mt-3"}),n.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[n.jsx("button",{type:"button",onClick:a,disabled:u,className:"rounded border border-[var(--border-default)] px-3 py-1.5 text-xs text-[var(--text-primary)] hover:bg-[var(--bg-elevated)] disabled:opacity-50",children:"Cancel"}),n.jsx("button",{type:"button",onClick:()=>void x(),disabled:u,className:"rounded bg-violet-500 px-3 py-1.5 text-xs font-medium text-white hover:bg-violet-400 disabled:opacity-50",children:u?"Saving…":"Save"})]})]})})}const Ss=Object.freeze(Object.defineProperty({__proto__:null,SaveScopeModal:Xt},Symbol.toStringTag,{value:"Module"}));function Jt({entry:e,routeKey:t,scenarioSlug:r,onSave:a,focusJsonPath:s}){const o=ra(e,t),[c,i]=l.useState(null),[p,u]=l.useState(!1),[b,h]=l.useState(!1);l.useEffect(()=>{i(null),h(!1)},[t]);const d=async m=>{u(!0),i(null);try{const g=o.buildPayload();await a({routeKey:t,...g,scope:m})}catch(g){throw i(g instanceof Error?g.message:"Save failed"),g}finally{u(!1)}},x=async()=>{if(o.isDirty){if(e.source==="scenario"){try{await d({kind:"scenario"})}catch{}return}h(!0)}};return n.jsxs("div",{className:"flex flex-col gap-3 h-full min-h-0",children:[c&&n.jsx(te,{text:c,className:"text-xs text-red-400"}),n.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[n.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"Status"}),n.jsx("input",{type:"number",value:o.status,onChange:m=>o.setStatus(Number(m.target.value)),className:"w-20 rounded border border-[var(--border-default)] bg-[var(--bg-surface)] px-2 py-1 text-xs font-mono"}),n.jsx("div",{className:"flex-1"}),n.jsx("button",{type:"button",onClick:()=>void x(),disabled:!o.isDirty||p,className:"rounded bg-violet-500 px-3 py-1 text-xs font-medium text-white hover:bg-violet-400 disabled:opacity-50",children:p?"Saving…":o.isDirty?"Save changes":"Saved"})]}),n.jsx(Wt,{headers:o.headers,onChange:o.setHeaders}),n.jsxs("div",{className:"flex-1 min-h-0 flex flex-col",children:[n.jsxs("div",{className:"flex items-center gap-2 pb-1",children:[n.jsx("label",{className:"text-xs text-[var(--text-muted)]",children:"Body"}),n.jsx(Bt,{body:o.body,onBodyChange:o.setBody})]}),n.jsx(be,{value:o.body,onChange:o.setBody,focusJsonPath:s},t)]}),b&&n.jsx(Xt,{entry:e,scenarioSlug:r,routeKey:t,onCancel:()=>h(!1),onConfirm:async m=>{await d(m),h(!1)}})]})}const ks=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanelMainMockEditable:Jt},Symbol.toStringTag,{value:"Module"}));function ba(e,t){if(e==null)return"never";const r=Math.max(0,Math.floor((t-e)/1e3));if(r<60)return`${r}s ago`;const a=Math.floor(r/60);return a<60?`${a}m ago`:`${Math.floor(a/60)}h ago`}const Ze={GET:"text-emerald-400 border-emerald-400/40",POST:"text-[#D7FF63] border-[#D7FF63]/40",PUT:"text-amber-400 border-amber-400/40",PATCH:"text-purple-400 border-purple-400/40",DELETE:"text-red-400 border-red-400/40"};function ga(e){return Ze[e]??Ze.GET}function qt({entry:e,scenarioHasDefaultFallback:t,onSave:r,onRemove:a,onPassthrough:s}){const o=`${e.method} ${e.pathPattern}`,c=ga(e.method),i=e.status??e.lastObservedStatus,p=l.useMemo(()=>e.lastObservedMs?ba(e.lastObservedMs,Date.now()):null,[e.lastObservedMs]),u="px-3 py-1 rounded border border-[var(--border-default)] bg-transparent text-[var(--text-muted)] hover:text-[var(--text-primary)] cursor-pointer text-xs";return n.jsxs("header",{className:"border-b border-[var(--border-subtle)] bg-[var(--bg-deep)] px-4 py-3 space-y-2 flex-shrink-0",children:[n.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[n.jsx("span",{className:`px-2 py-0.5 rounded border font-mono text-xs ${c}`,children:e.method}),n.jsx("span",{className:"font-mono text-sm text-[var(--text-primary)] break-all",children:e.pathPattern}),n.jsx(Re,{source:e.source}),i!==void 0&&n.jsx("span",{className:"px-1.5 py-0.5 rounded border border-[var(--border-default)] text-[var(--text-muted)] font-mono text-xs",children:i}),e.observedCount>0&&n.jsxs("span",{className:"ml-auto text-xs text-[var(--text-dim)]",children:[e.observedCount,"× ",p?`· ${p}`:""]})]}),e.variants.length>1&&n.jsxs("div",{className:"text-[10px] text-[var(--text-dim)] font-mono",children:["variants: ",e.variants.filter(b=>b!==o).join(", ")]}),n.jsxs("div",{className:"flex flex-wrap gap-2 pt-1",children:[e.source==="scenario"&&t&&n.jsx("button",{onClick:()=>void a(o),className:u,title:"Remove this scenario mock and fall back to the default",children:"Revert to default"}),e.source==="scenario"&&n.jsx("button",{onClick:()=>void s(o),className:u,children:"Mark passthrough"}),e.source==="default"&&n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:()=>void r({routeKey:o,status:e.status??200,body:e.body,headers:e.headers??{},scope:{kind:"scenario"}}),className:"px-3 py-1 rounded border border-emerald-500/50 bg-emerald-500/10 text-emerald-300 hover:bg-emerald-500/20 cursor-pointer text-xs",title:"Copy default body into this scenario",children:"Promote to scenario"}),n.jsx("button",{onClick:()=>void s(o),className:u,children:"Mark passthrough"})]}),e.source==="passthrough"&&n.jsx("button",{onClick:()=>void a(o),className:u,children:"Undo passthrough"})]})]})}const Cs=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanelMainMockHeader:qt},Symbol.toStringTag,{value:"Module"}));function Gt({entry:e}){const t=Object.entries(e.headers??{}),r=e.body!==void 0&&e.body!==null;return!r&&t.length===0?n.jsx("p",{className:"text-xs italic text-[var(--text-dim)]",children:e.source==="catalog-only"?"No mock body yet — this endpoint has only been observed, not mocked. Promote it to a scenario to start editing.":e.source==="passthrough"?"This endpoint passes through to the upstream service.":"No body configured."}):n.jsxs("div",{className:"space-y-3 h-full min-h-0 flex flex-col",children:[t.length>0&&n.jsxs("section",{className:"space-y-1 flex-shrink-0",children:[n.jsx("h4",{className:"text-xs font-medium uppercase tracking-wide text-[var(--text-dim)]",children:"Headers"}),n.jsx("dl",{className:"text-xs font-mono space-y-0.5",children:t.map(([a,s])=>n.jsxs("div",{className:"flex gap-2",children:[n.jsxs("dt",{className:"text-[var(--text-muted)]",children:[a,":"]}),n.jsx("dd",{className:"text-[var(--text-primary)] break-all",children:s})]},a))})]}),r&&n.jsxs("section",{className:"flex-1 min-h-0 flex flex-col",children:[n.jsx("h4",{className:"text-xs font-medium uppercase tracking-wide text-[var(--text-dim)] pb-1",children:"Body"}),n.jsx(be,{value:e.body,onChange:()=>{},readOnly:!0},`${e.method} ${e.pathPattern}`)]})]})}const Ns=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanelMainMockReadOnly:Gt},Symbol.toStringTag,{value:"Module"}));function Qt({entry:e,scenarioSlug:t,scenarioHasDefaultFallback:r,onSave:a,onRemove:s,onPassthrough:o,focusJsonPath:c}){const i=`${e.method} ${e.pathPattern}`,p=e.source==="scenario"||e.source==="default"||e.source==="shared";return n.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[n.jsx(qt,{entry:e,scenarioHasDefaultFallback:r,onSave:a,onRemove:s,onPassthrough:o}),n.jsx("div",{className:"flex-1 min-h-0 overflow-auto p-4",children:p?n.jsx(Jt,{entry:e,routeKey:i,scenarioSlug:t,onSave:a,focusJsonPath:c}):n.jsx(Gt,{entry:e})})]})}const Es=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanelMainMock:Qt},Symbol.toStringTag,{value:"Module"}));function ya({slug:e,tab:t,initialRows:r,onCellEdited:a}){const[s,o]=l.useState(r),[c,i]=l.useState(null),[p,u]=l.useState(""),[b,h]=l.useState(""),d=l.useRef(null);l.useEffect(()=>{o(r),i(null)},[t.dataKey,r]);function x(v,k){const _=s[v];i({row:v,col:k});const w=_[k]===null?"":typeof _[k]=="object"?JSON.stringify(_[k]):String(_[k]);u(w),h(w)}function m(v){if(u(v),d.current&&clearTimeout(d.current),!c)return;const k=c;d.current=setTimeout(()=>{f(k.row,k.col,v)},600)}function g(){c&&(d.current&&clearTimeout(d.current),f(c.row,c.col,p),i(null))}function y(){if(d.current&&clearTimeout(d.current),!!c){if(p!==b){const v=[...s];v[c.row]={...v[c.row],[c.col]:ze(b)},o(v),fetch(`/api/scenarios/${encodeURIComponent(e)}/data`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({table:t.dataKey,rowIndex:c.row,column:c.col,value:b})}).then(()=>{G(),a&&a()}).catch(()=>{})}i(null)}}async function f(v,k,_){const w=[...s];w[v]={...w[v],[k]:ze(_)},o(w);try{await fetch(`/api/scenarios/${encodeURIComponent(e)}/data`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({table:t.dataKey,rowIndex:v,column:k,value:_})}),G(),a&&a()}catch{}}return{rows:s,editingCell:c,editValue:p,handleEditCell:x,handleEditValueChange:m,handleSave:g,handleCancelEdit:y}}function Zt({tab:e}){return!e.description&&!e.category?null:n.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-[var(--bg-deep)] border-b border-[var(--border-subtle)]",children:[e.category&&n.jsx("span",{className:`text-[9px] rounded px-1.5 py-0 border ${e.category==="datastore"?"text-[var(--accent-active)]/80 bg-[var(--accent-active)]/10 border-[var(--accent-active)]/30":e.category==="mock-api"?"text-[#D7FF63]/80 bg-[#D7FF63]/10 border-[#D7FF63]/30":"text-[var(--text-muted)] bg-[var(--bg-surface)]/30 border-[var(--text-dim)]/30"}`,children:e.category==="mock-api"?"API Mock":e.category}),e.description&&n.jsx("span",{className:"text-[10px] text-[var(--text-dim)]",children:e.description})]})}const Ts=Object.freeze(Object.defineProperty({__proto__:null,DataViewerCategoryBadge:Zt},Symbol.toStringTag,{value:"Module"}));function er({editingCell:e,editValue:t,onEditValueChange:r,onSave:a,onCancel:s}){return n.jsxs("div",{className:"border-t border-[var(--border-default)] bg-[var(--bg-deep)] px-3 py-2",children:[n.jsx("div",{className:"flex items-center gap-2 mb-1.5",children:n.jsxs("span",{className:"text-[10px] text-[var(--text-muted)]",children:["Editing"," ",n.jsx("strong",{className:"text-[var(--text-secondary)]",children:e.col})," ","in row ",e.row+1]})}),n.jsx("textarea",{value:t,onChange:o=>r(o.target.value),className:"w-full px-2 py-1.5 text-[11px] bg-[var(--bg-card)] text-[var(--text-primary)] border border-[var(--border-default)] rounded outline-none focus:border-[var(--accent-active)]/50 resize-y min-h-[60px] max-h-[200px] font-mono",autoFocus:!0,rows:t.length>100?4:2,onKeyDown:o=>{o.key==="Escape"&&s(),o.key==="Enter"&&(o.metaKey||o.ctrlKey)&&a()}}),n.jsxs("div",{className:"flex items-center gap-2 mt-1.5",children:[n.jsx("button",{onClick:a,className:"px-3 py-1 text-[10px] font-medium text-[var(--bg-deep)] bg-[var(--accent-active)] rounded cursor-pointer border-none hover:bg-[var(--accent-active)]/80 transition-colors",children:"Save"}),n.jsx("button",{onClick:s,className:"px-3 py-1 text-[10px] text-[var(--text-muted)] hover:text-[var(--text-primary)] bg-transparent border-none cursor-pointer",children:"Cancel"}),n.jsxs("span",{className:"text-[9px] text-[var(--text-dim)] ml-auto",children:["⌘","+Enter to save, Esc to cancel"]})]})]})}const Os=Object.freeze(Object.defineProperty({__proto__:null,DataViewerCellEditor:er},Symbol.toStringTag,{value:"Module"}));function tr({columns:e,colTypes:t,pkCol:r,rows:a,onEditCell:s}){return e.length===0?n.jsx("div",{className:"px-3 py-4 text-[10px] text-[var(--text-dim)] text-center",children:"No columns defined for this table"}):n.jsx("div",{className:"overflow-x-auto max-h-[300px] overflow-y-auto",children:n.jsxs("table",{className:"w-full text-[10px] border-collapse table-fixed",children:[n.jsx("thead",{children:n.jsxs("tr",{className:"bg-[var(--bg-deep)] sticky top-0 z-10",children:[n.jsx("th",{className:"text-right text-[var(--text-dim)] font-normal px-2 py-1.5 border-b border-[var(--border-default)] w-8",children:"#"}),e.map(o=>n.jsx(rr,{name:o,type:t[o],isPk:o===r},o))]})}),n.jsx("tbody",{children:a.map((o,c)=>n.jsx(nr,{row:o,rowIndex:c,columns:e,pkCol:r,onEditCell:s},c))})]})})}function rr({name:e,type:t,isPk:r}){return n.jsxs("th",{className:"text-left px-2 py-1.5 border-b border-[var(--border-default)] whitespace-nowrap overflow-hidden",children:[r&&n.jsx("span",{className:"inline-block text-[8px] font-bold text-[var(--bg-deep)] bg-[var(--accent-active)] rounded px-1 py-0 mr-1.5 align-middle",children:"PK"}),n.jsx("span",{className:"text-[var(--text-secondary)] font-medium",children:e}),n.jsx("span",{className:"text-[var(--text-dim)] font-normal ml-1",children:t})]})}function nr({row:e,rowIndex:t,columns:r,pkCol:a,onEditCell:s}){return n.jsxs("tr",{className:"border-b border-[var(--border-subtle)] hover:bg-[var(--bg-card)] group/row",children:[n.jsx("td",{className:"text-right text-[var(--text-dim)] px-2 py-1.5 w-8 select-none",children:t+1}),r.map(o=>n.jsx(ar,{value:e[o],isPk:o===a,onEdit:()=>s(t,o)},o))]})}function ar({value:e,isPk:t,onEdit:r}){return n.jsxs("td",{className:`px-2 py-1.5 overflow-hidden relative group/cell ${t?"text-[var(--accent-active)] font-medium":"text-[var(--text-secondary)]"}`,title:String(e??""),children:[n.jsx("span",{className:"truncate block whitespace-nowrap",children:e===null?n.jsx("span",{className:"text-[var(--text-dim)] italic",children:"null"}):typeof e=="object"?n.jsx("span",{className:"text-[var(--text-dim)]",children:JSON.stringify(e)}):typeof e=="number"?n.jsx("span",{className:"text-amber-400",children:String(e)}):String(e)}),n.jsx("button",{onClick:a=>{a.stopPropagation(),r()},className:"absolute right-1 top-1/2 -translate-y-1/2 opacity-0 group-hover/cell:opacity-100 text-[var(--text-dim)] hover:text-[var(--text-primary)] bg-[var(--bg-card)] border border-[var(--border-default)] rounded cursor-pointer p-0.5 transition-opacity",title:"Edit",children:n.jsxs("svg",{width:"9",height:"9",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),n.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]})})]})}const Ms=Object.freeze(Object.defineProperty({__proto__:null,DataViewerCell:ar,DataViewerColumnHeader:rr,DataViewerRow:nr,DataViewerTable:tr},Symbol.toStringTag,{value:"Module"}));function sr({slug:e,tab:t,initialRows:r,onCellEdited:a}){const{rows:s,editingCell:o,editValue:c,handleEditCell:i,handleEditValueChange:p,handleSave:u,handleCancelEdit:b}=ya({slug:e,tab:t,initialRows:r,onCellEdited:a}),h=Ar(s,t.schemaFields),d=Pr(h,s,t.schemaFields),x=Rr(h,t.schemaFields);return n.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[n.jsx(Zt,{tab:t}),n.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:n.jsx(tr,{columns:h,colTypes:d,pkCol:x,rows:s,onEditCell:i})}),o&&n.jsx(er,{editingCell:o,editValue:c,onEditValueChange:p,onSave:u,onCancel:b})]})}const As=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanelMainTable:sr},Symbol.toStringTag,{value:"Module"}));function va({slug:e,browserState:t,tab:r,onCellEdited:a}){const s=l.useMemo(()=>{if(!t)return{};switch(r){case"cookies":return t.cookies??{};case"localStorage":return t.localStorage??{};case"sessionStorage":return t.sessionStorage??{};case"headers":return t.requestHeaders??{};default:return{}}},[t,r]),o=l.useCallback(async p=>{const u=r==="headers"?"browserState.requestHeaders":`browserState.${r}`;try{await fetch(`/api/scenarios/${encodeURIComponent(e)}/data`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:u,value:JSON.stringify(p)})}),G(),a&&a()}catch{}},[e,r,a]),c=l.useMemo(()=>{switch(r){case"cookies":return"Cookies";case"localStorage":return"Local Storage";case"sessionStorage":return"Session Storage";case"headers":return"Request Headers"}},[r]),i=l.useMemo(()=>{switch(r){case"cookies":return"Cookies injected via Set-Cookie headers on the scenario's initial response.";case"localStorage":return"localStorage items set before the app's JavaScript executes.";case"sessionStorage":return"sessionStorage items set before the app's JavaScript executes.";case"headers":return"Custom headers added to every outbound HTTP request from the iframe."}},[r]);return{value:s,handleChange:o,label:c,description:i}}function or({slug:e,browserState:t,tab:r,onCellEdited:a}){const{value:s,handleChange:o,label:c,description:i}=va({slug:e,browserState:t,tab:r,onCellEdited:a});return n.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[n.jsxs("div",{className:"px-4 py-3 border-b border-[var(--border-subtle)]",children:[n.jsx("h2",{className:"text-sm font-semibold text-[var(--text-primary)]",children:c}),n.jsx("p",{className:"text-xs text-[var(--text-dim)] mt-1",children:i})]}),n.jsx("div",{className:"flex-1 min-h-0 p-4 overflow-auto",children:n.jsx(be,{value:s,onChange:o})})]})}const Ps=Object.freeze(Object.defineProperty({__proto__:null,BrowserStateTab:or},Symbol.toStringTag,{value:"Module"}));function de({label:e,active:t,onClick:r}){return n.jsx("button",{type:"button",onClick:r,className:`px-2 py-0.5 rounded-full border text-[10px] font-mono transition-colors cursor-pointer ${t?"bg-violet-500/25 text-violet-100 border-violet-400/70":"bg-violet-500/10 text-violet-300 border-violet-500/40 hover:bg-violet-500/20"}`,"aria-pressed":t,children:e})}const Rs=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanelMockDataBadge:de},Symbol.toStringTag,{value:"Module"}));function ir({shares:e,activeBadge:t,onSelect:r}){return n.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap border-b border-[var(--border-subtle)] bg-[var(--bg-deep)] px-4 py-2","data-testid":"scenario-mock-data-strip",children:[n.jsx("span",{className:"text-[10px] uppercase tracking-wider text-[var(--text-dim)] font-semibold",children:"Mock Data:"}),n.jsx(de,{label:"This Page",active:t.kind==="this-page",onClick:()=>r({kind:"this-page"})}),e.map(a=>n.jsx(de,{label:a,active:t.kind==="share"&&t.slug===a,onClick:()=>r({kind:"share",slug:a})},a)),n.jsx(de,{label:"Defaults",active:t.kind==="defaults",onClick:()=>r({kind:"defaults"})})]})}const Ds=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanelMockDataStrip:ir},Symbol.toStringTag,{value:"Module"}));function ja({slug:e,scenarioName:t,initialSection:r,onClose:a,variant:s="slideOver"}){const{data:o,tableTabs:c,scenarioOwnedDataKeys:i,shares:p,browserState:u,loading:b,error:h}=Kr(e),{entries:d,loading:x,error:m,upsertScoped:g,remove:y,setPassthrough:f}=Er(e),{config:v}=et(),k=(v==null?void 0:v.provider)??"claude",_=Yr({slug:e,onPreviewReload:G}),w=l.useCallback(()=>{_.markDirty(),G()},[_]),P=l.useCallback(async M=>{await g(M),w()},[g,w]),B=l.useCallback(async M=>{await y(M),w()},[y,w]),E=l.useCallback(async M=>{await f(M),w()},[f,w]),j=l.useCallback(()=>{_.markDirty(),G()},[_]),F=l.useCallback(()=>{a&&_.confirmIfDirty("Discard unsaved changes to this scenario?")&&a()},[a,_]),[N,D]=l.useState(null),[T,O]=l.useState(null),[I,A]=l.useState(!1),K=l.useCallback(M=>D({kind:"mock",routeKey:M}),[]);yr({onSelect:K,onFocus:O});const[R,V]=l.useState({kind:"this-page"}),U=b||x,H=l.useMemo(()=>s==="inline"?c.filter(M=>i.has(M.dataKey)):c,[s,c,i]),z=l.useMemo(()=>{if(s!=="inline")return d;switch(R.kind){case"this-page":return d.filter(M=>M.consumedThisPageLoad);case"defaults":return d.filter(M=>M.source==="default");case"share":return d.filter(M=>M.source==="shared"&&M.sharedSlug===R.slug)}},[s,d,R]);Zr({seedTabs:H,mockEntries:z,initialSection:r,selection:N,setSelection:D});const q=l.useMemo(()=>{const M=new Set;for(const Be of d)Be.source==="default"&&M.add(J(Be));return M},[d]),S=(N==null?void 0:N.kind)==="seed"?H.find(M=>M.dataKey===N.dataKey)??null:null,C=(N==null?void 0:N.kind)==="mock"?z.find(M=>J(M)===N.routeKey)??null:null,L=S&&o?o[S.dataKey]??[]:[],$=l.useMemo(()=>xr({slug:e,scenarioName:t,seedTabs:H,mockEntries:z,selectedMock:C,selectedSeedTab:S,selectedSeedRows:L}),[e,t,H,z,C,S,L]),ae=t??e,ge=H.length>0||z.length>0,ye=n.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[n.jsx($t,{title:ae,slug:e,provider:k,chatOpen:I,onToggleChat:()=>A(M=>!M),variant:s,onClose:a?F:void 0,draftDirty:_.isDirty,draftDiff:_.diffSummary,draftSaving:_.saving,draftCancelling:_.cancelling,draftError:_.error,onSave:()=>void _.save(),onCancel:()=>void _.cancel()}),s==="inline"&&n.jsx(ir,{shares:p,activeBadge:R,onSelect:V}),I&&n.jsx("div",{className:"flex-shrink-0 border-b border-[var(--border-subtle)] bg-[var(--bg-deep)]",children:n.jsx(Tt,{chatName:`edit-data-${e}`,prompt:$,height:360,onClose:()=>A(!1)})}),n.jsxs("div",{className:"flex flex-1 min-h-0",children:[n.jsx(ot,{seedTabs:H,mockEntries:z,selection:N,onSelect:D}),n.jsx("main",{className:"flex-1 min-w-0 min-h-0 bg-[var(--bg-deep)] flex flex-col",children:n.jsxs("div",{className:"flex-1 min-h-0 flex flex-col",children:[h&&n.jsx(te,{text:`Seed error: ${h}`,className:"text-xs text-red-400",rowClassName:"p-4"}),m&&n.jsx(te,{text:`Mocks error: ${m}`,className:"text-xs text-red-400",rowClassName:"p-4"}),!U&&!ge&&n.jsx(Ot,{}),S&&n.jsx(sr,{slug:e,tab:S,initialRows:L,onCellEdited:j}),C&&n.jsx(Qt,{entry:C,scenarioSlug:e,scenarioHasDefaultFallback:q.has(J(C)),onSave:P,onRemove:B,onPassthrough:E,focusJsonPath:T}),(N==null?void 0:N.kind)==="browser"&&n.jsx(or,{slug:e,browserState:u,tab:N.tab,onCellEdited:j}),!S&&!C&&(N==null?void 0:N.kind)!=="browser"&&ge&&!U&&n.jsx("p",{className:"p-4 text-xs text-[var(--text-dim)] italic",children:"Select a data source from the left to view it."}),U&&!ge&&n.jsx("p",{className:"p-4 text-xs text-[var(--text-dim)]",children:"Loading scenario data…"})]})})]})]});return s==="fullPage"?n.jsx("div",{className:"fixed inset-0 bg-[var(--bg-deep)] text-[var(--text-primary)]",children:ye}):s==="inline"?n.jsx("div",{className:"rounded-md border border-[var(--border-subtle)] bg-[var(--bg-deep)] max-h-[min(640px,70vh)] min-h-0 flex flex-col overflow-hidden",children:ye}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"fixed inset-0 z-40 bg-black/40",onClick:F,"aria-label":"Close scenario data panel"}),n.jsx("aside",{className:"fixed right-0 top-0 z-50 h-full w-full max-w-4xl border-l border-[var(--border-default)] bg-[var(--bg-deep)] shadow-2xl",children:ye})]})}const Is=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanel:ja},Symbol.toStringTag,{value:"Module"}));export{nt as $,Wn as A,or as B,Bt as C,nr as D,Lt as E,at as F,st as G,Xt as H,Ut as I,Yt as J,ot as K,ir as L,Wt as M,de as N,Dt as O,qt as P,Qt as Q,Rt as R,ja as S,mt as T,$t as U,Ot as V,At as W,Mt as X,tr as Y,er as Z,Zt as _,Re as a,Os as a$,rt as a0,ft as a1,ut as a2,dt as a3,lt as a4,xt as a5,_t as a6,kt as a7,Ct as a8,Nt as a9,Es as aA,ls as aB,fs as aC,as as aD,os as aE,ss as aF,Is as aG,Ss as aH,ws as aI,rs as aJ,ts as aK,Oa as aL,Pa as aM,_s as aN,Ya as aO,Qa as aP,ys as aQ,gs as aR,bs as aS,hs as aT,vs as aU,js as aV,ms as aW,xs as aX,ps as aY,ns as aZ,Ms as a_,Tt as aa,Et as ab,qa as ac,Ja as ad,es as ae,Za as af,Ha as ag,Fa as ah,Ka as ai,$a as aj,Ba as ak,za as al,Va as am,La as an,Ra as ao,Aa as ap,Ma as aq,us as ar,Da as as,ds as at,Ds as au,Rs as av,As as aw,Ns as ax,Cs as ay,ks as az,sr as b,Ts as b0,Ps as b1,Ga as b2,et as b3,re as b4,Ie as b5,Rn as b6,vr as b7,we as b8,On as b9,Ae as bA,Jn as bB,Xa as ba,nn as bb,an as bc,un as bd,yn as be,Wa as bf,jn as bg,sn as bh,Sn as bi,it as bj,_n as bk,vn as bl,Ua as bm,St as bn,En as bo,Je as bp,Nn as bq,le as br,Nr as bs,Ea as bt,cs as bu,is as bv,Ta as bw,Ia as bx,Un as by,rn as bz,Jt as c,Gt as d,G as e,ba as f,Yr as g,Kr as h,Er as i,ht as j,pt as k,ie as l,rr as m,ar as n,ee as o,ze as p,bt as q,wt as r,Vt as s,Ht as t,Xn as u,me as v,xe as w,be as x,Kt as y,zt as z};
|