@codeyam-editor/codeyam-editor 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/npm/cloud.js +361 -18
  2. package/npm/editor-dev.js +24 -2
  3. package/npm/editor.js +15 -5
  4. package/npm/fleet-add-failure.js +355 -21
  5. package/npm/fleet-branch.js +124 -1
  6. package/npm/fleet-build-data.js +12 -1
  7. package/npm/fleet-cleanup.js +84 -3
  8. package/npm/fleet-datastore-health.js +107 -0
  9. package/npm/fleet-revision.js +108 -0
  10. package/npm/fleet-run-setup.js +66 -0
  11. package/npm/fleet-session-activity.js +162 -0
  12. package/npm/fleet-vm-readiness.js +57 -16
  13. package/npm/launch-config.js +126 -2
  14. package/npm/scenario-check.js +697 -34
  15. package/npm/scenario-interactivity.js +477 -23
  16. package/npm/scenario-issues.js +61 -0
  17. package/npm/scenario-playwright.js +67 -14
  18. package/npm/utils.js +262 -22
  19. package/package.json +5 -5
  20. package/ui/dist/assets/{ContainerInspector-DSVZvEkB.js → ContainerInspector-C7I9wctz.js} +1 -1
  21. package/ui/dist/assets/EditorShell-9aYMeOdZ.js +330 -0
  22. package/ui/dist/assets/EditorShell-CE8iG_EM.css +1 -0
  23. package/ui/dist/assets/ScenarioDataPanel-CLwkrex0.js +18 -0
  24. package/ui/dist/assets/{ScenarioDataPanelFullPage-Cyk6efiI.js → ScenarioDataPanelFullPage-DT0TZC4M.js} +1 -1
  25. package/ui/dist/assets/ScenarioRenderer-Bsarhcrl.js +21 -0
  26. package/ui/dist/assets/index-BRoAenc1.css +1 -0
  27. package/ui/dist/assets/{index-BPLKgwon.js → index-iMR5siiG.js} +9 -9
  28. package/ui/dist/index.html +2 -2
  29. package/ui/dist/preview-subdir-demo/index.html +62 -0
  30. package/ui/dist/preview-subdir-demo/sibling.html +48 -0
  31. package/ui/dist/assets/EditorShell-DnXdHrar.js +0 -256
  32. package/ui/dist/assets/EditorShell-FvbXyqqD.css +0 -1
  33. package/ui/dist/assets/ScenarioDataPanel-6qJE-0lA.js +0 -15
  34. package/ui/dist/assets/ScenarioRenderer-Uyt54vHI.js +0 -21
  35. package/ui/dist/assets/index-DKpgJLo3.css +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}.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.xsvc-embedded{min-height:0}.xsvc.xsvc-embedded .xsvc-scroll{overflow-y:visible;padding:0 0 8px}.xsvc-sub.xsvc-sub-lead{font-size:15px;line-height:1.55;margin:0;max-width:62ch}.xsvc.xsvc-embedded .xsvc-head{margin-bottom:20px}.xsvc-askcard.xsvc-askcard-bare{border:0;border-radius:0;background:transparent;padding:0;margin-bottom:26px}.xsvc-listbar{display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap;margin-bottom:16px}.xsvc-count.xsvc-count-row{margin:0}.xsvc-count.xsvc-count-row b{font-weight:600;color:var(--text-strong, #f2f2f2)}.xsvc-count.xsvc-count-row .attn{color:var(--amber-300, #ef9f27)}.xsvc-listbar .xsvc-toolbar{margin:0}.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;margin-bottom:24px}.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:0}.xsvc-group{margin-bottom:34px}.xsvc-group-head{display:flex;align-items:baseline;justify-content:space-between;margin-bottom:14px}.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-row.pending{border-style:dashed;border-color:var(--line-hair, rgba(255, 255, 255, .12));background:#ffffff0b}.xsvc-row.pending:hover{background:#ffffff13}.xsvc-row.pending .xsvc-rname{color:var(--text-body, #aaaaaa);font-weight:500}.xsvc-row.pending .xsvc-rdesc{color:var(--text-subtle, #4a4a4a)}.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);display:flex;align-items:center;transition:.16s}.xsvc-row:hover .xsvc-arr{color:var(--text-body, #aaaaaa);transform:translateY(1px)}.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-tag.origin{background:#ffffff0f;color:var(--text-dim, rgba(255, 255, 255, .45));text-transform:none;letter-spacing:.01em}.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;align-items:center;gap:8px;flex-shrink:0;min-width:0}.xsvc-chip{font:inherit;white-space:nowrap;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-askcard{border:.5px solid var(--line-subtle, rgba(255, 255, 255, .08));border-radius:16px;background:var(--surface-card, #161616);padding:18px;margin-bottom:34px}.xsvc-divider{height:0;border-top:.5px solid var(--line-subtle, rgba(255, 255, 255, .08));margin:0 0 30px}.xsvc-ask-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:13px 13px 13px 17px}.xsvc-ask-composer:hover{border-color:var(--lime-300, #c7f04a)}.xsvc-ask-composer .ai{color:var(--text-subtle, #4a4a4a);display:flex;align-items:center;justify-content:center;flex-shrink:0}.xsvc-ask-composer .ph{flex:1;font-size:13.5px;color:var(--text-faint, #6b6b6b)}.xsvc-ask-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{display:block}.xsvc-ask-chat{margin-top:14px}.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:30px}.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);transform:rotate(180deg)}.xsvc-row:hover .xsvc-arr.down{transform:rotate(180deg) translateY(1px)}.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-ask-composer .send{border:0;cursor:pointer}.xsvc-composer,.xsvc-ask-composer{cursor:text}.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% 12px}.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-head{display:flex;align-items:center;gap:13px;margin-bottom:4px}.home-head .hback{background:none;border:0;font:inherit;font-size:17px;line-height:1;color:var(--text-faint);cursor:pointer;padding:4px;transition:.15s}.home-head .hback:hover:not(:disabled){color:var(--text-strong);transform:translate(-2px)}.home-head .hback:disabled{opacity:.5;cursor:default}.home-head .hmark{width:34px;height:34px;border-radius:9px;flex-shrink:0;display:flex;align-items:center;justify-content:center;background:var(--action-bg);color:var(--action-fg)}.home-head .htitle{font-size:22px;font-weight:700;letter-spacing:-.02em;line-height:1.15;min-width:0}.home-sec{border-top:.5px solid var(--line-subtle);margin-top:26px;padding-top:26px}.home-sechead{display:flex;align-items:center;gap:9px;margin-bottom:16px}.home-sectitle{font-size:16px;font-weight:700;letter-spacing:-.01em}.home-sectitle .count{color:var(--text-subtle);font-weight:600}.home-sectitle.empty{color:var(--text-subtle)}.home-secadd{width:21px;height:21px;border-radius:50%;flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;border:0;padding:0;font:inherit;font-size:15px;line-height:1;background:var(--action-bg);color:var(--action-fg);cursor:pointer;transition:.15s}.home-secadd:hover{filter:brightness(1.08)}.home-sechead .spacer{margin-left:auto}.home-livedot{width:7px;height:7px;border-radius:50%;background:var(--green-300);display:inline-block;animation:home-pulse 1.4s ease-in-out infinite}.home-livedot.warn{background:var(--amber-300)}.hbuild-card{display:flex;align-items:center;gap:18px;width:100%;text-align:left;border:.5px solid var(--line-subtle);border-radius:14px;padding:18px 20px;background:var(--surface-card);font-family:inherit;color:var(--text-strong);cursor:pointer;transition:.18s}.hbuild-card:hover{border-color:var(--line-hair);background:var(--surface-raised)}.hbuild-card.active{border-color:#9bd35a66;background:#9bd35a0d}.hbuild-card.attn{border-color:#e0b24a66;background:#e0b24a0f}.hbuild-card .hbuild-thumb{width:96px;height:62px;border-radius:8px;flex-shrink:0;overflow:hidden;display:flex;align-items:center;justify-content:center;border:.5px solid var(--line-subtle);background:var(--surface-raised)}.hbuild-card .hbuild-nothumb{padding:0 8px;font-size:10px;line-height:1.3;text-align:center;color:var(--text-subtle)}.hbuild-card .hbuild-main{display:block;flex:1;min-width:0}.hbuild-card .hbuild-title{display:flex;align-items:baseline;flex-wrap:wrap;gap:9px;font-size:15px;font-weight:600}.hbuild-card .hbuild-spinner{width:13px;height:13px;flex-shrink:0;align-self:center;border-radius:50%;border:2px solid var(--green-300);border-top-color:transparent;animation:home-spin 1s linear infinite}.hbuild-card .hbuild-state{font-family:IBM Plex Mono,monospace;font-weight:400;font-size:12.5px;color:var(--green-300)}.hbuild-card.attn .hbuild-state{color:var(--amber-300)}.hbuild-card .hbuild-dots>span{animation:hbuild-dot 1.2s ease-in-out infinite}.hbuild-card .hbuild-dots>span:nth-child(2){animation-delay:.4s}.hbuild-card .hbuild-dots>span:nth-child(3){animation-delay:.8s}@keyframes hbuild-dot{0%,60%,to{opacity:.25}30%{opacity:1}}.hbuild-card .hbuild-ready{display:block;font-size:15px;font-weight:600;color:var(--green-300)}.hbuild-card .hbuild-last{display:block;font-size:12.5px;color:var(--text-faint);margin-top:5px;line-height:1.45}.hbuild-card .hbuild-last b{color:var(--text-strong);font-weight:600}.hbuild-card .hbuild-step{display:flex;align-items:center;gap:7px;margin-top:9px;font-size:12px;color:var(--text-faint);font-variant-numeric:tabular-nums}.hbuild-card .hbuild-step .hbuild-pos{color:var(--green-300);font-weight:600}.hbuild-card.attn .hbuild-step .hbuild-pos{color:var(--amber-300)}.hbuild-card .hbuild-step .hbuild-phase{color:var(--text-strong);font-weight:600}.hbuild-card .hbuild-flow{font-weight:600;font-variant-numeric:normal;padding:1px 7px;border-radius:6px;background:var(--green-soft);color:var(--green-300)}.hbuild-card.attn .hbuild-flow{background:var(--amber-soft, rgba(224, 178, 74, .16));color:var(--amber-300)}.hbuild-card .hbuild-bar{display:block;height:4px;background:var(--surface-raised);border-radius:3px;margin-top:10px;overflow:hidden}.hbuild-card .hbuild-bar>span{display:block;height:100%;background:var(--green-300);border-radius:3px;transition:width .6s ease}.hbuild-cta{display:inline-flex;align-items:center;gap:9px;flex-shrink:0;white-space:nowrap;font-size:13px;font-weight:600;padding:9px 16px;border-radius:9px;background:var(--action-bg);color:var(--action-fg);transition:.15s}.hbuild-card:hover .hbuild-cta{filter:brightness(1.08)}.hbuild-reset{display:inline-flex;align-items:center;gap:8px;margin-top:13px;padding:0;border:0;background:none;font-family:inherit;font-size:12.5px;font-weight:500;color:var(--red-300);cursor:pointer}.hbuild-reset:hover{text-decoration:underline}.home-viewall{display:inline-flex;align-items:center;gap:9px;margin-top:16px;padding:0;border:0;background:none;font-family:inherit;font-size:13px;color:var(--text-faint);cursor:pointer;transition:.15s}.home-viewall:hover{color:var(--text-strong)}.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}.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,15 +0,0 @@
1
- import{j as n}from"./markdown-C9tbsVHX.js";import{b as c}from"./react-nrLBr15I.js";import{a as nt,u as at,d as jr,C as re,c as _r}from"./useServerIdentity-CVuHTzjg.js";import{u as wr}from"./useEvents-S3Qk1Y_d.js";import{r as Sr,a as kr}from"./xterm--24IGk-x.js";import{l as W,c as Cr}from"./index-BPLKgwon.js";const st="Connected to the editor server at ";function ot(e){const t=e===null?null:e?"in the cloud container":"on this machine";return t?`, running ${t}.`:"."}function Nr(e,t){return e===null?null:`${st}${e}${ot(t)}`}function Tr({headline:e,explanation:t,nextAction:r,diagnostics:a,connection:s}){const o=[`CodeYam editor — ${e}`,`What happened
2
- ${t}`,`What to do
3
- ${r}`],l=a==null?void 0:a.trim();l&&o.push(`Details
4
- ${l}`);const i=s==null?void 0:s.trim();return i&&o.push(`Connection
5
- ${i}`),o.join(`
6
-
7
- `)}function Ee(e){return typeof e=="string"?e:typeof e=="number"?String(e):Array.isArray(e)?e.map(Ee).join(""):""}const Er={error:{accent:"var(--accent-red, #dc2626)",surface:"var(--bg-base)",label:"Error"},warning:{accent:"var(--accent-amber, #d97706)",surface:"var(--bg-base)",label:"Warning"},blocked:{accent:"var(--accent-primary, #2563eb)",surface:"var(--bg-base)",label:"Blocked"}};function it({headline:e,palette:t,report:r,copyLabel:a}){return n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide",style:{color:t.accent},children:t.label}),n.jsx("h2",{className:"text-base font-semibold leading-snug",children:e})]}),n.jsx(nt,{variant:"subtle",text:r,label:a,ariaLabel:`Copy this report: ${e}`})]})}const Ha=Object.freeze(Object.defineProperty({__proto__:null,ErrorNoticeHeader:it},Symbol.toStringTag,{value:"Module"}));function lt({nextAction:e,palette:t}){return n.jsxs("div",{className:"rounded border-l-2 pl-3",style:{borderLeftColor:t.accent},children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wide",style:{color:t.accent},children:"What to do"}),n.jsx("div",{style:{color:"var(--text-primary)"},children:e})]})}const Ya=Object.freeze(Object.defineProperty({__proto__:null,ErrorNoticeNextAction:lt},Symbol.toStringTag,{value:"Module"}));function ct({diagnostics:e,testId:t}){return n.jsx("pre",{"data-testid":t,className:"m-0 max-h-48 overflow-auto whitespace-pre-wrap rounded px-3 py-2 font-mono text-xs leading-snug",style:{background:"var(--bg-surface)",color:"var(--text-secondary)"},children:e})}const Wa=Object.freeze(Object.defineProperty({__proto__:null,ErrorNoticeDiagnostics:ct},Symbol.toStringTag,{value:"Module"}));function dt({actions:e,palette:t,actionFeedback:r}){return e.length===0&&!r?null:n.jsxs(n.Fragment,{children:[e.length>0?n.jsx("div",{className:"flex flex-wrap items-center gap-2",children:e.map(a=>n.jsx("button",{type:"button",onClick:a.onClick,disabled:a.pending,"aria-label":a.ariaLabel,"data-testid":a.testId,className:"rounded px-3 py-1.5 text-sm font-medium disabled:cursor-not-allowed disabled:opacity-70",style:a.variant==="secondary"?{border:"1px solid var(--border-default)",color:"var(--text-primary)"}:{background:t.accent,color:"var(--bg-base)"},children:a.pending?a.pendingLabel??`${a.label}…`:a.label},a.label))}):null,r?n.jsx("div",{className:"text-xs",style:{color:"var(--text-dim)"},children:r}):null]})}const Ua=Object.freeze(Object.defineProperty({__proto__:null,ErrorNoticeActions:dt},Symbol.toStringTag,{value:"Module"}));function ee({headline:e,explanation:t,nextAction:r,explanationText:a,nextActionText:s,diagnostics:o,severity:l="error",actions:i=[],actionFeedback:p,copyLabel:u="Copy this report",testId:x,className:h}){const{projectDir:d,inContainer:b,loaded:m}=at(),g=Er[l],y=m?Nr(d,b):null,f=Tr({headline:e,explanation:a??Ee(t),nextAction:s??Ee(r),diagnostics:o,connection:y});return n.jsxs("div",{role:"alert","aria-label":e,"data-testid":x,className:h??"flex w-full max-w-2xl flex-col gap-3 rounded-lg border border-l-4 p-5 text-sm shadow-lg",style:{background:g.surface,borderColor:"var(--border-default)",borderLeftColor:g.accent,color:"var(--text-primary)"},children:[n.jsx(it,{headline:e,palette:g,report:f,copyLabel:u}),n.jsx("p",{style:{color:"var(--text-dim)"},children:t}),n.jsx(lt,{nextAction:r,palette:g}),o?n.jsx(ct,{diagnostics:o,testId:x?`${x}-diagnostics`:void 0}):null,n.jsx(dt,{actions:i,palette:g,actionFeedback:p}),d!==null&&m?n.jsxs("p",{className:"text-xs",style:{color:"var(--text-dim)"},children:[st,n.jsx("code",{children:d}),ot(b)]}):null]})}const Va=Object.freeze(Object.defineProperty({__proto__:null,ErrorNotice:ee},Symbol.toStringTag,{value:"Module"}));function ut(){return 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…"})})}const Xa=Object.freeze(Object.defineProperty({__proto__:null,MiniAgentLaunchRetryingHint:ut},Symbol.toStringTag,{value:"Module"})),Or=350;function ne(e,t={}){const{minPendingMs:r=Or}=t,[a,s]=c.useState("idle"),[o,l]=c.useState(0),i=c.useRef(!0);c.useEffect(()=>(i.current=!0,()=>{i.current=!1}),[]);const p=c.useCallback(()=>{s("pending"),l(h=>h+1);let u;try{u=Promise.resolve(e())}catch{u=Promise.resolve()}const x=new Promise(h=>setTimeout(h,r));Promise.allSettled([u,x]).then(()=>{i.current&&s("unchanged")})},[e,r]);return{phase:a,attempts:o,retry:p}}function ft({onRetry:e}){const{phase:t,attempts:r,retry:a}=ne(e);return n.jsx("div",{"data-testid":"mini-agent-launch-failed-banner",className:"absolute inset-0 z-10 flex items-start justify-center bg-black/60 p-3",children:n.jsx(ee,{severity:"error",testId:"mini-agent-launch-failed-notice",headline:"The build agent didn't start",explanation:"CodeYam opened a shell to start the build agent and it never became ready. This is the agent failing to start, not your project — nothing in your code has been touched.",nextAction:"Use Retry. If it fails again, copy this report and send it on — a shell that will not come up is a setup problem on this machine rather than something to fix in your project.",actions:[{label:"Retry",onClick:a,pending:t==="pending",pendingLabel:"Starting…",testId:"mini-agent-launch-failed-retry"}],actionFeedback:t==="unchanged"?n.jsxs("span",{"data-testid":"mini-agent-launch-failed-unchanged",children:["Tried just now — the agent still didn’t start",r>1?` (${r} tries)`:"","."]}):null})})}const Ja=Object.freeze(Object.defineProperty({__proto__:null,MiniAgentLaunchFailed:ft},Symbol.toStringTag,{value:"Module"})),_e=4e3;function He(e){let t;try{t=JSON.stringify(e,null,2)}catch{t=String(e)}return t.length>_e?`${t.slice(0,_e)}
8
- … (truncated, ${t.length-_e} more chars)`:t}function Ar({slug:e,scenarioName:t,seedTabs:r,mockEntries:a,selectedMock:s,selectedSeedTab:o,selectedSeedRows:l}){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 x=u.category?` (${u.category})`:"";i.push(`- **${u.label}**${x} — dataKey \`${u.dataKey}\``)}i.push("")}if(a.length>0){i.push("### HTTP mocks");const u=new Map;for(const x of a){const h=u.get(x.source)??[];h.push(x),u.set(x.source,h)}for(const[x,h]of u){i.push(`**${x}** (${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 x=s.headers??{},h=Object.entries(x);if(h.length>0){i.push("- **Headers**:");for(const[d,b]of h)i.push(` - \`${d}: ${b}\``)}s.body!==void 0&&s.body!==null?(i.push("- **Body**:"),i.push("```json"),i.push(He(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 x=u.isId?" (PK)":"";i.push(` - \`${u.name}\`: ${u.type}${x}`)}}l&&l.length>0?(i.push(`- **Rows** (${l.length}):`),i.push("```json"),i.push(He(l)),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(`
9
- `)}const Oe=new Set;let ie=null;const Pr=150;function qa(e){return Oe.add(e),()=>{Oe.delete(e)}}function G(){ie&&clearTimeout(ie),ie=setTimeout(()=>{ie=null;for(const e of Oe)e()},Pr)}const Ae=new Set;function Ga(e){for(const t of Ae)t(e)}function Mr(e){return Ae.add(e),()=>{Ae.delete(e)}}function Rr({onSelect:e,onFocus:t}){c.useEffect(()=>Mr(({routeKey:r,jsonPath:a})=>{e(r),t(a)}),[e,t])}const De="claude";function Dr(e){return e==="claude"}function ae(e){switch(e){case"codex":return"Codex";case"gemini":return"Gemini";case"opencode":return"OpenCode";default:return"Claude"}}const Ir=3e3;function pt(){const[e,t]=c.useState(null),[r,a]=c.useState(!0),[s,o]=c.useState(null),l=c.useRef(null),i=c.useCallback(async()=>{try{const p=await fetch("/api/config");if(!p.ok)throw new Error(`HTTP ${p.status}`);const u=await p.json(),x={projectTitle:u.projectTitle??null,projectDescription:u.projectDescription??null,provider:u.provider??De,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,previewDedicatedOriginUnavailable:u.previewDedicatedOriginUnavailable??!1},h=JSON.stringify(x);h!==l.current&&(l.current=h,t(x)),o(null)}catch(p){o(p instanceof Error?p.message:"Failed to load config")}finally{a(!1)}},[]);return c.useEffect(()=>{i();const p=setInterval(()=>{i()},Ir);return()=>clearInterval(p)},[i]),{config:e,apps:(e==null?void 0:e.apps)??[],loading:r,error:s,refetch:i}}async function pe(e){try{const t=await e.json();if(t.error)return t.error}catch{}return`Request failed (${e.status})`}async function Lr(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 Ye(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 pe(a))}async function $r(e,t){const r=`/api/scenarios/${encodeURIComponent(e)}/mocks/${encodeURIComponent(t)}`,a=await fetch(r,{method:"DELETE"});if(!a.ok)throw new Error(await pe(a))}async function Fr(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 pe(a))}function X(e){return e.kind==="shared"?`shared:${e.slug}`:e.kind}async function Br(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 Kr(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 pe(s));return(await s.json()).impactedScenarios??[]}function zr(){const[e,t]=c.useState(null),[r,a]=c.useState(null),s=c.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 c.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 Hr(e){const[t,r]=c.useState([]),[a,s]=c.useState(null),[o,l]=c.useState(!1),[i,p]=c.useState(null),{events:u}=wr(),{status:x}=zr(),h=(x==null?void 0:x.lastIframeLoadedAtMs)??null,d=c.useCallback(async()=>{if(!e){r([]),s(null);return}l(!0),p(null);try{const f=await Lr(e,h);r(f.entries),s(f.defaultSlug)}catch(f){p(f instanceof Error?f.message:"Failed to load mocks")}finally{l(!1)}},[e,h]);c.useEffect(()=>{d()},[d]),c.useEffect(()=>{const f=u[u.length-1];!f||f.type!=="http_request"||d()},[u,d]);const b=c.useCallback(async f=>{e&&(await Ye(e,f),await d())},[e,d]),m=c.useCallback(async f=>{e&&(f.scope.kind==="scenario"?await Ye(e,{routeKey:f.routeKey,status:f.status,body:f.body,headers:f.headers}):await Br({scenarioSlug:e,routeKey:f.routeKey,scope:f.scope,status:f.status,body:f.body,headers:f.headers}),await d())},[e,d]),g=c.useCallback(async f=>{e&&(await $r(e,f),await d())},[e,d]),y=c.useCallback(async f=>{e&&(await Fr(e,f),await d())},[e,d]);return{entries:t,defaultSlug:a,loading:o,error:i,refresh:d,upsert:b,upsertScoped:m,remove:g,setPassthrough:y}}function Yr(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 Wr(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 Ur(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 Vr(e,t){return e.length>0?Object.keys(e[0]):t?t.map(r=>r.name):[]}function Xr(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?Ur(t[0][o]):"text");return s}function Jr(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 qr(e,t){const{_metadata:r,...a}=t,s=a.localStorage&&typeof a.localStorage=="object"&&!Array.isArray(a.localStorage)?Yr(a.localStorage):{},o={};if(a.seed&&typeof a.seed=="object"&&!Array.isArray(a.seed))for(const[d,b]of Object.entries(a.seed))Array.isArray(b)&&(o[d]=b);const l={},i=[],p=new Set,u=new Set,x=new Set;for(const d of e){const b=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,b,`${b}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,b,`${b}s`])if(f in o){g=f,y=o[f],x.add(f),f in s&&p.add(f);break}}if(!g){for(const f of[d.name,b,`${b}s`])if(f in s){g=b,y=s[f],p.add(f);break}}if(!g){for(const[f,v]of Object.entries(s))if(!p.has(f)&&v.length>0&&Wr(m,Object.keys(v[0]))){g=b,y=v,p.add(f);break}}g||(g=b),l[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,b]of Object.entries(a))d==="_metadata"||d==="localStorage"||d==="seed"||d==="type"||d==="mocks"||h.has(d)||u.has(d)||Gr(b)&&(l[d]=b,i.push({label:d,dataKey:d}));for(const[d,b]of Object.entries(o))x.has(d)||(l[d]=b,i.push({label:d,dataKey:d}));for(const[d,b]of Object.entries(s))p.has(d)||(l[d]=b,i.push({label:d,dataKey:d}));return{data:l,tabs:i}}function We(e){return e==="null"?null:e==="true"?!0:e==="false"?!1:e===""?"":isNaN(Number(e))?e:Number(e)}function Gr(e){return Array.isArray(e)&&e.length>0&&typeof e[0]=="object"&&e[0]!==null}function Qr(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 Zr(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 en(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 tn(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 rn(e){const[t,r]=c.useState({data:null,tableTabs:[],scenarioOwnedDataKeys:new Set,shares:[],props:null,browserState:null,loading:!0,error:null});return c.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=qr(Array.isArray(a)?a:[],s);r({data:o.data,tableTabs:o.tabs,scenarioOwnedDataKeys:en(o.data,o.tabs),shares:tn(s),props:Qr(s),browserState:Zr(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 Ie(e,t=""){return`/api/scenarios/${encodeURIComponent(e)}/draft${t}`}async function nn(e){const t=await fetch(Ie(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 an(e){const t=await fetch(Ie(e,"/commit"),{method:"POST"});if(!t.ok)throw new Error(`Save failed (${t.status})`)}async function sn(e){const t=await fetch(Ie(e),{method:"DELETE"});if(!t.ok)throw new Error(`Cancel failed (${t.status})`)}function on({slug:e,onPreviewReload:t}){const[r,a]=c.useState(!1),[s,o]=c.useState(null),[l,i]=c.useState(!1),[p,u]=c.useState(!1),[x,h]=c.useState(null),d=c.useRef(null),b=c.useCallback(async()=>{if(!e){a(!1),o(null);return}try{const v=await nn(e);a(v.isDirty),o(v.diffSummary)}catch{}},[e]);c.useEffect(()=>{b()},[b]),c.useEffect(()=>{if(!r)return;const v=k=>{k.preventDefault(),k.returnValue=""};return window.addEventListener("beforeunload",v),()=>window.removeEventListener("beforeunload",v)},[r]);const m=c.useCallback(()=>{d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{b()},100)},[b]),g=c.useCallback(async()=>{if(e){i(!0),h(null);try{await an(e),a(!1),o(null),t&&t()}catch(v){h(v instanceof Error?v.message:"Save failed")}finally{i(!1)}}},[e,t]),y=c.useCallback(async()=>{if(e){u(!0),h(null);try{await sn(e),a(!1),o(null),t&&t()}catch(v){h(v instanceof Error?v.message:"Cancel failed")}finally{u(!1)}}},[e,t]),f=c.useCallback(v=>r?window.confirm(v):!0,[r]);return{isDirty:r,saving:l,cancelling:p,error:x,diffSummary:s,save:g,cancel:y,markDirty:m,confirmIfDirty:f}}const ln={scenario:"Scenario",shared:"Shared",default:"Defaults","catalog-only":"Observed only",passthrough:"Passthrough"},cn={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 ht(e){return ln[e]??e}function dn(e){return cn[e]??null}const un={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 Le({source:e}){const t=dn(e);return n.jsx("span",{className:`px-1.5 py-0.5 rounded border ${un[e]}`,title:t??`source: ${e}`,children:ht(e)})}const Qa=Object.freeze(Object.defineProperty({__proto__:null,MockSourceBadge:Le},Symbol.toStringTag,{value:"Module"}));function mt({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 Za=Object.freeze(Object.defineProperty({__proto__:null,SidebarGroupOverrideHeader:mt},Symbol.toStringTag,{value:"Module"}));function bt({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 es=Object.freeze(Object.defineProperty({__proto__:null,SidebarInheritedSection:bt},Symbol.toStringTag,{value:"Module"}));function xt({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 ts=Object.freeze(Object.defineProperty({__proto__:null,MockSharedSlugBadge:xt},Symbol.toStringTag,{value:"Module"})),fn={GET:"text-emerald-400",POST:"text-[#D7FF63]",PUT:"text-amber-400",PATCH:"text-purple-400",DELETE:"text-red-400"};function gt({entry:e,routeKey:t,active:r,onSelect:a}){const s=fn[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(xt,{slug:e.sharedSlug})]})}const rs=Object.freeze(Object.defineProperty({__proto__:null,SidebarMockEntryRow:gt},Symbol.toStringTag,{value:"Module"})),pn=["scenario","shared","default","catalog-only","passthrough"];function J(e){return`${e.method} ${e.pathPattern}`}function yt({seedTabs:e,mockEntries:t,selection:r,onSelect:a,overrides:s}){const o=new Map;for(const l of t){const i=o.get(l.source)??[];i.push(l),o.set(l.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(ce,{label:"Browser Environment",count:4,emptyHint:"",children:[n.jsx(te,{label:"Cookies",active:(r==null?void 0:r.kind)==="browser"&&r.tab==="cookies",onSelect:()=>a({kind:"browser",tab:"cookies"})}),n.jsx(te,{label:"Local Storage",active:(r==null?void 0:r.kind)==="browser"&&r.tab==="localStorage",onSelect:()=>a({kind:"browser",tab:"localStorage"})}),n.jsx(te,{label:"Session Storage",active:(r==null?void 0:r.kind)==="browser"&&r.tab==="sessionStorage",onSelect:()=>a({kind:"browser",tab:"sessionStorage"})}),n.jsx(te,{label:"Request Headers",active:(r==null?void 0:r.kind)==="browser"&&r.tab==="headers",onSelect:()=>a({kind:"browser",tab:"headers"})})]}),n.jsx(ce,{label:"Seed & Local",count:e.length,emptyHint:"No seed or localStorage data",override:s?{scenarioCount:s.scenarioSeedCount,inheritedCount:s.inheritedSeedCount,renderInherited:()=>Ue({tabs:s.inheritedSeedTabs,selection:r,onSelect:a})}:void 0,children:Ue({tabs:e,selection:r,onSelect:a})}),n.jsx(ce,{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 Ue({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 te({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??hn(e);return pn.flatMap(o=>{const l=s.get(o)??[];return l.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:[ht(o),n.jsx(Le,{source:o})]},`hdr-${o}`),...l.map(i=>{const p=J(i),u=(r==null?void 0:r.kind)==="mock"&&r.routeKey===p;return n.jsx(gt,{entry:i,routeKey:p,active:u,onSelect:()=>a({kind:"mock",routeKey:p})},p)})]})}function hn(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 ce({label:e,count:t,emptyHint:r,children:a,override:s}){const[o,l]=c.useState(!1);if(s){const{scenarioCount:i,inheritedCount:p,renderInherited:u}=s,x=i+(o?p:0);return n.jsxs("section",{className:"py-2",children:[n.jsx(mt,{label:e,scenarioCount:i,inheritedCount:p,expanded:o,onToggle:()=>l(h=>!h)}),x===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(bt,{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 ns=Object.freeze(Object.defineProperty({__proto__:null,BrowserStateButton:te,ScenarioDataPanelSidebar:yt,SidebarGroup:ce,routeKeyFor:J},Symbol.toStringTag,{value:"Module"}));function mn({seedTabs:e,mockEntries:t,initialSection:r,selection:a,setSelection:s}){c.useEffect(()=>{if(a)return;const o=r==="mocks",l=r==="seed";if(o&&t.length>0){s({kind:"mock",routeKey:J(t[0])});return}if(l&&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 Pe={state:"unknown",provider:De,credsPresent:!0,cliInstalled:!0,scannedDirs:[],reason:null,expiresAt:null,probeInFlight:!1,probeAttempts:0,backendFieldAbsent:!1};function bn(e){if(e==null)return{...Pe,backendFieldAbsent:!0};if(typeof e!="object")return Pe;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:De,s=typeof t.credsPresent=="boolean"?t.credsPresent:!0,o=typeof t.cliInstalled=="boolean"?t.cliInstalled:!0,l=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,x=typeof t.probeAttempts=="number"&&Number.isFinite(t.probeAttempts)&&t.probeAttempts>=0?t.probeAttempts:0;return{state:r,provider:a,credsPresent:s,cliInstalled:o,scannedDirs:l,reason:i,expiresAt:p,probeInFlight:u,probeAttempts:x,backendFieldAbsent:!1}}const xn=1e3;function gn(){const[e,t]=c.useState(Pe),r=c.useRef(e.state);r.current=e.state;const a=c.useCallback(async()=>{try{const s=await fetch("/api/config");if(!s.ok)return;const o=await s.json();t(bn(o.providerAuth))}catch{}},[]);return c.useEffect(()=>{a()},[a]),c.useEffect(()=>{if(e.state!=="unknown")return;const s=window.setInterval(()=>{r.current==="unknown"&&a()},xn);return()=>window.clearInterval(s)},[e.state,a]),c.useEffect(()=>{const s=()=>{t(o=>({...o,state:"needs-login"})),a()};return window.addEventListener("agent-auth-required",s),()=>window.removeEventListener("agent-auth-required",s)},[a]),c.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 yn=Sr(),vn=kr();function jn(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 _n=20,wn=1;function Sn(e,t){const r=t===wn?e:e/_n;return Math.trunc(r)||Math.sign(r)}function kn(){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 Cn(e,t,r={}){const a=r.isMac??kn(),s=r.onError,o=r.onCopy;let l=null;async function i(m){if(!m)return!1;let g=!1;try{g=await jr(m)}catch(y){return s==null||s(Xe("copy",y)),!1}if(g){try{e.clearSelection()}catch{}o==null||o()}else s==null||s(Tn("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(Xe("paste",m))}}function x(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(x);function h(){if(!l)return;const{root:m,onDocumentClick:g,onKeyDown:y}=l;document.removeEventListener("mousedown",g,!0),document.removeEventListener("keydown",y,!0),m.remove(),l=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",_=we("Copy",v,!y,()=>{i(y),h()}),w=we("Paste",k,!1,()=>{u(),h()}),M=we("Select All","",!1,()=>{try{e.selectAll()}catch{}const j=e.hasSelection()?e.getSelection():"";i(j),h()});f.appendChild(_),f.appendChild(w),f.appendChild(M),document.body.appendChild(f),Nn(f,m,g);const F=j=>{f.contains(j.target)||h()},T=j=>{j.key==="Escape"&&(j.preventDefault(),h())};document.addEventListener("mousedown",F,!0),document.addEventListener("keydown",T,!0),l={root:f,onDocumentClick:F,onKeyDown:T}}function b(m){m.preventDefault();const g=e.hasSelection()?e.getSelection():"";d(m.clientX,m.clientY,g)}return t.addEventListener("contextmenu",b),()=>{t.removeEventListener("contextmenu",b),h(),e.attachCustomKeyEventHandler(()=>!0)}}function we(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 l=document.createElement("span");l.textContent=t,l.style.color="var(--text-dim)",l.style.fontSize="11px",s.appendChild(l)}return r||(s.addEventListener("mouseenter",()=>{s.style.background="var(--border-subtle)"}),s.addEventListener("mouseleave",()=>{s.style.background="transparent"}),s.addEventListener("click",()=>a())),s}function Nn(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(),l=4;let i=t,p=r;o.width&&t+o.width+l>a&&(i=Math.max(l,a-o.width-l)),o.height&&r+o.height+l>s&&(p=Math.max(l,s-o.height-l)),e.style.left=`${i}px`,e.style.top=`${p}px`}function Xe(e,t){const r=t instanceof Error?t.message:String(t);return`Clipboard ${e} failed: ${r}`}function Tn(e){return`Clipboard ${e} blocked by the browser.`}function En(e,t,r,a,s,o){const l=e.leftBorderCol+1;if(t===a)return s-r;if(a<t){let u=r-l;u+=1;for(let h=a+1;h<t;h++){const d=o(h);if(d===null)return null;u+=Math.max(1,d-l+1)}const x=o(a);return x===null?null:(u+=Math.max(0,x-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 x=o(u);if(x===null)return null;p+=Math.max(1,x-l+1)}return p+=s-l,p}const le=new Set(["│","┃","║","|"]);function On(e,t,r,a){const s=e.baseY,o=(b,m)=>{const g=e.getLine(s+b);if(!g)return null;const y=g.getCell(m);return y?y.getChars():null},l=b=>{let m=-1;for(let y=0;y<r;y++){const f=o(b,y);if(f!==null&&le.has(f)){m=y;break}}if(m===-1)return null;let g=-1;for(let y=r-1;y>m;y--){const f=o(b,y);if(f!==null&&le.has(f)){g=y;break}}return g===-1?null:{leftBorderCol:m,rightBorderCol:g}};let i=t,p=l(t);if(!p){const b=l(t-1);if(b)i=t-1,p=b;else{const m=l(t+1);m&&(i=t+1,p=m)}}if(!p)return null;const{leftBorderCol:u,rightBorderCol:x}=p;let h=i;for(let b=i-1;b>=0;b--){const m=o(b,u);if(m===null)break;if(!(m===""||m===" ")){if(!le.has(m))break;h=b}}let d=i;for(let b=i+1;b<a;b++){const m=o(b,u);if(m===null)break;if(!(m===""||m===" ")){if(!le.has(m))break;d=b}}return{topRow:h,bottomRow:d,leftBorderCol:u,rightBorderCol:x}}function An(e,t,r,a){const s=e.getLine(e.baseY+t);if(!s)return null;for(let o=a;o>=r;o--){const l=s.getCell(o);if(!l)continue;const i=l.getChars();if(i!==""&&i!==" ")return o}return r-1}const Pn=200;function Mn(e){const{click:t,terminal:r,cellSurface:a,debug:s}=e,o=r.buffer.active,l=_=>{s==null||s({cursorY:o.cursorY,cursorX:o.cursorX,originalTargetCol:_.originalTargetCol??_.targetCol,snapped:_.snapped??!1,..._})};if(o.type==="alternate")return l({targetRow:-1,targetCol:-1,box:null,rejected:"alt-screen",emittedDirection:null,emittedByteCount:0,predictedCursorY:null,predictedCursorX:null}),null;if(o.viewportY!==o.baseY)return l({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 l({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 l({targetRow:-1,targetCol:-1,box:null,rejected:"outside-grid",emittedDirection:null,emittedByteCount:0,predictedCursorY:null,predictedCursorX:null}),null;const x=i.width/r.cols,h=i.height/r.rows,d=Math.floor(p/x),b=Math.floor(u/h),m=r.modes.applicationCursorKeysMode,g=m?"\x1BOC":"\x1B[C",y=m?"\x1BOD":"\x1B[D",f=On(o,o.cursorY,r.cols,r.rows);if(f){if(b<f.topRow||b>f.bottomRow)return l({targetRow:b,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 l({targetRow:b,targetCol:d,box:f,rejected:"border",emittedDirection:null,emittedByteCount:0,predictedCursorY:null,predictedCursorX:null}),null;const _=f.leftBorderCol+1,w=f.rightBorderCol-1,M=P=>An(o,P,_,w),F=o.cursorY<f.topRow||o.cursorY>f.bottomRow,T=F?f.bottomRow:o.cursorY,j=F?w:o.cursorX,B=b!==T;let N=null;if(B&&(N=M(b),N===null))return l({targetRow:b,targetCol:d,originalTargetCol:d,snapped:!1,box:f,rejected:"unreadable-row",emittedDirection:null,emittedByteCount:0,predictedCursorY:null,predictedCursorX:null}),null;let D=d,E=!1;if(B&&N!==null){const P=Math.max(_,N);d>P&&(D=P,E=!0)}if(b===T&&D===j)return l({targetRow:b,targetCol:D,originalTargetCol:d,snapped:E,box:f,rejected:"same-cell",emittedDirection:null,emittedByteCount:0,predictedCursorY:null,predictedCursorX:null}),null;const O=En(f,T,j,b,D,M);if(O===null)return l({targetRow:b,targetCol:D,originalTargetCol:d,snapped:E,box:f,rejected:"unreadable-row",emittedDirection:null,emittedByteCount:0,predictedCursorY:null,predictedCursorX:null}),null;if(O===0)return l({targetRow:b,targetCol:D,originalTargetCol:d,snapped:E,box:f,rejected:"same-cell",emittedDirection:null,emittedByteCount:0,predictedCursorY:null,predictedCursorX:null}),null;if(Math.abs(O)>Pn)return l({targetRow:b,targetCol:D,originalTargetCol:d,snapped:E,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 l({targetRow:b,targetCol:D,originalTargetCol:d,snapped:E,box:f,rejected:null,emittedDirection:O<0?"left":"right",emittedByteCount:I.length,predictedCursorY:b,predictedCursorX:D}),I}if(b!==o.cursorY)return l({targetRow:b,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 l({targetRow:b,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 l({targetRow:b,targetCol:d,box:null,rejected:null,emittedDirection:v<0?"left":"right",emittedByteCount:k.length,predictedCursorY:b,predictedCursorX:d}),k}const Je=1;function Rn(e,t){const{sendInput:r,pixelThreshold:a=3,timeThresholdMs:s=300,now:o=()=>Date.now(),onVerificationDisable:l}=t,i=e.element;if(!i)return()=>{};const p=i.querySelector(".xterm-screen")??i;let u=null,x=!1,h=null,d=null;const b=typeof e.onRender=="function"?e.onRender.bind(e):null;b&&(d=b(()=>{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>Je||k>Je){x=!0;const _={predicted:y,actual:{y:f.cursorY,x:f.cursorX}};l?l(_):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 T;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"&&((T=window.localStorage)==null?void 0:T.getItem("codeyam.terminalClickDebug"))==="1";if(_)try{const j=e.buffer.active,B=j.cursorY,N={};for(let D=-2;D<=2;D++){const E=B+D,O=j.getLine(j.baseY+E);if(!O)continue;const I=[];for(let P=0;P<e.cols;P++){const K=O.getCell(P);I.push(K?K.getChars():"")}N[`row${E}`]=I.join("|")}console.log("[click-cursor] buffer dump",{cursorY:B,cursorX:j.cursorX,viewportY:j.viewportY,baseY:j.baseY,rows:N})}catch{}let w=null;const M=j=>{w=j,_&&console.log("[click-cursor] result",j)},F=Mn({click:{clientX:y.clientX,clientY:y.clientY},terminal:e,cellSurface:p,debug:M});if(F){if(w){const j=w,B=j.box!==null&&j.targetRow!==j.cursorY;if(B&&x){_&&console.log("[click-cursor] suppressed by verification-disabled");return}B&&j.predictedCursorY!==null&&j.predictedCursorX!==null&&(h={y:j.predictedCursorY,x:j.predictedCursorX})}r(F)}}return p.addEventListener("mousedown",m),p.addEventListener("mouseup",g),()=>{p.removeEventListener("mousedown",m),p.removeEventListener("mouseup",g),d==null||d.dispose()}}function Dn(){window.focus()}function In(e,t){Dn(),e==null||e.focus({preventScroll:!0}),t()}async function vt(e=1500){try{return(await fetch("/api/health",{signal:AbortSignal.timeout(e)})).ok}catch{return!1}}function Ln(e,t){let r=!1,a=null;async function s(){if(!r){if(await vt(1500)){r||t();return}r||(a=setTimeout(s,e))}}return a=setTimeout(s,e),()=>{r=!0,a&&(clearTimeout(a),a=null)}}const $n="The editor server closed the terminal connection with no further detail.";function Fn(e){if(e&&typeof e=="object"&&"message"in e){const t=e.message;if(typeof t=="string"&&t.length>0)return t}return $n}let jt=!1;function Se(e){jt=e}function as(){return jt}function _t(){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 ss=Object.freeze(Object.defineProperty({__proto__:null,TerminalConnectingHint:_t},Symbol.toStringTag,{value:"Module"}));function wt({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 os=Object.freeze(Object.defineProperty({__proto__:null,TerminalReconnectingBanner:wt},Symbol.toStringTag,{value:"Module"}));function St({onRefresh:e}){const{phase:t,attempts:r,retry:a}=ne(e);return n.jsx("div",{"data-testid":"terminal-failed-banner",className:"absolute inset-0 z-10 flex items-start justify-center bg-black/60 p-3",children:n.jsx(ee,{severity:"error",testId:"terminal-failed-notice",headline:"The terminal lost its connection",explanation:"The terminal tried to reconnect several times and couldn't get through. Either the editor restarted underneath it, or the connection between your browser and this machine dropped. Your files and your work are untouched — it's only the live terminal view that stopped.",nextAction:"Refresh the page to start a fresh terminal. If this keeps happening, copy this report and send it to whoever set up this machine.",actions:[{label:"Refresh page",onClick:a,pending:t==="pending",pendingLabel:"Refreshing…",testId:"terminal-failed-banner-refresh"}],actionFeedback:t==="unchanged"?n.jsxs("span",{"data-testid":"terminal-failed-banner-unchanged",children:["Tried just now — the terminal still isn’t back",r>1?` (${r} tries)`:"","."]}):null})})}const is=Object.freeze(Object.defineProperty({__proto__:null,TerminalFailedBanner:St},Symbol.toStringTag,{value:"Module"}));function kt({onReload:e}){const{phase:t,attempts:r,retry:a}=ne(e);return n.jsx("div",{"data-testid":"terminal-server-stopped-banner",className:"absolute inset-0 z-10 flex items-start justify-center bg-black/60 p-3",children:n.jsx(ee,{severity:"error",testId:"terminal-server-stopped-notice",headline:"The editor has stopped",explanation:"The editor program behind this page is no longer running — it was closed, or it stopped on its own. Nothing you were working on is lost; the page just has nothing to talk to.",nextAction:"Start the editor again from your terminal. This page comes back by itself once it's running — you don't need to keep clicking. Reload page only checks early.",actions:[{label:"Reload page",onClick:a,pending:t==="pending",pendingLabel:"Checking…",testId:"terminal-server-stopped-banner-reload"}],actionFeedback:t==="unchanged"?n.jsxs("span",{"data-testid":"terminal-server-stopped-banner-unchanged",children:["Checked just now — the editor isn’t running yet",r>1?` (${r} tries)`:"","."]}):null})})}const ls=Object.freeze(Object.defineProperty({__proto__:null,TerminalServerStoppedBanner:kt},Symbol.toStringTag,{value:"Module"}));function Ct({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(nt,{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 cs=Object.freeze(Object.defineProperty({__proto__:null,TerminalServerErrorBanner:Ct},Symbol.toStringTag,{value:"Module"}));function Nt({onRefresh:e}){const{phase:t,attempts:r,retry:a}=ne(e);return n.jsx("div",{"data-testid":"terminal-edge-unreachable-banner",className:"absolute inset-0 z-10 flex items-start justify-center bg-black/60 p-3",children:n.jsx(ee,{severity:"warning",testId:"terminal-edge-unreachable-notice",headline:"The terminal can't reach this machine",explanation:"The editor itself is loading fine and you're signed in — it's the terminal's own live connection that isn't getting through. Nothing you did caused this, and your work isn't lost.",nextAction:"Try Retry. If it keeps failing, this one isn't yours to fix — copy this report and send it to whoever set up this machine.",actions:[{label:"Retry",onClick:a,pending:t==="pending",pendingLabel:"Reconnecting…",testId:"terminal-edge-unreachable-banner-retry"}],actionFeedback:t==="unchanged"?n.jsxs("span",{"data-testid":"terminal-edge-unreachable-banner-unchanged",children:["Checked just now — still not connecting",r>1?` (${r} tries)`:"","."]}):null,diagnostics:"The editor answers over HTTP and the session is valid, but the terminal's live connection channel does not complete. Typically the network path in front of this machine is not carrying it."})})}const ds=Object.freeze(Object.defineProperty({__proto__:null,TerminalEdgeUnreachableBanner:Nt},Symbol.toStringTag,{value:"Module"}));function Tt({canRetry:e=!1,onRefresh:t}){const{phase:r,attempts:a,retry:s}=ne(t);return n.jsx("div",{"data-testid":"terminal-session-stale-banner",className:"absolute inset-0 z-10 flex items-start justify-center bg-black/60 p-3",children:n.jsx(ee,{severity:"warning",testId:"terminal-session-stale-notice",headline:e?"Couldn't get this tab signed back in":"Signing this tab back in",explanation:e?"The editor restarted, which signed this tab out. It tried to sign back in automatically and couldn't.":"The editor restarted, which signed this tab out. It's signing back in and reconnecting the terminal now.",nextAction:e?"Use Retry to try again. If that doesn't take, reload the page — that always gets a fresh session.":"Nothing, unless this sticks around. If the terminal hasn't come back after about ten seconds, reload the page.",actions:e?[{label:"Retry",onClick:s,pending:r==="pending",pendingLabel:"Retrying…",testId:"terminal-session-stale-banner-retry"}]:[],actionFeedback:e&&r==="unchanged"?n.jsxs("span",{"data-testid":"terminal-session-stale-banner-unchanged",children:["Tried just now — still signed out",a>1?` (${a} tries)`:"",". Reloading the page will fix it."]}):null})})}const us=Object.freeze(Object.defineProperty({__proto__:null,TerminalSessionStaleBanner:Tt},Symbol.toStringTag,{value:"Module"}));function Et({status:e,pulseKey:t,onRefresh:r}){return e.kind==="open"||e.kind==="ended"?null:e.kind==="connecting"?n.jsx(_t,{}):e.kind==="reconnecting"?n.jsx(wt,{attempt:e.attempt,maxAttempts:e.maxAttempts,pulseKey:t}):e.kind==="server-stopped"?n.jsx(kt,{onReload:r}):e.kind==="server-error"?n.jsx(Ct,{message:e.message,onRefresh:r}):e.kind==="edge-unreachable"?n.jsx(Nt,{onRefresh:r}):e.kind==="session-stale"?n.jsx(Tt,{canRetry:e.canRetry,onRefresh:r}):n.jsx(St,{onRefresh:r})}const fs=Object.freeze(Object.defineProperty({__proto__:null,TerminalDisconnectOverlay:Et},Symbol.toStringTag,{value:"Module"}));function Ot({status:e,onRetry:t}){return e==="retrying"?n.jsx(ut,{}):e==="failed"?n.jsx(ft,{onRetry:t}):null}const ps=Object.freeze(Object.defineProperty({__proto__:null,MiniAgentLaunchOverlay:Ot},Symbol.toStringTag,{value:"Module"})),Bn=40;function Kn(e){const t=e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return t&&t.slice(0,Bn).replace(/-+$/,"")||"session"}const de=new Map;function $e(e,t){const r=de.get(e);if(!r){let a;try{a=t()}catch(s){return Promise.reject(s)}return a instanceof Promise?qe(e,a):Promise.resolve()}return qe(e,r.then(()=>t()))}function qe(e,t){const r=t.catch(()=>{});return de.set(e,r),r.then(()=>{de.get(e)===r&&de.delete(e)}),t}let Z=0,Q=[];function hs(){if(Z+=1,Z===1&&Q.length>0){const e=Q;Q=[];for(const t of e)t()}}function ms(){Z>0&&(Z-=1)}function zn(){return Z>0}function Hn(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 he="build",Ge="miniagent",Qe=3e3;function Yn(e){return zn()?e():Hn(Qe).then(t=>{if(t)return e();console.warn(`[terminal] dropped programmatic injection: no terminal-send-input listener attached within ${Qe}ms`)})}function Fe(e){window.dispatchEvent(new CustomEvent("terminal-send-input",{detail:e}))}function bs(e){$e(he,()=>Yn(()=>Fe(e)))}const ue=50;function Wn(e,t=Fe,r=he){return $e(r,()=>new Promise(a=>{t(e),setTimeout(()=>{t("\r"),a()},ue)}))}const ke=3e3;function Un(e){return e==="codex"?"codex":e==="gemini"?"gemini":e==="opencode"?"opencode":"claude"}function At(e,t){const r=Un(e);return r==="claude"&&t?`${r} --permission-mode auto`:r}function Vn(e,t){return`'${e==="powershell"?t.replaceAll("'","''"):t.replaceAll("'","'\\''")}'`}function Xn(e,t,r=!0,a="posix"){const s=Vn(a,t);return e==="opencode"?`opencode${r?" --auto":""} --prompt ${s}\r`:`${At(e,r)} ${s}\r`}async function Jn(e,t=Fe,r=he){const a=Kn(e);await Wn(`/rename ${a}`,t,r)}function qn(e,t,r,a=he){W("dispatch-rename",{phase:"queued",caller:t,label:e,delayMs:ke}),setTimeout(()=>{W("dispatch-rename",{phase:"fired",caller:t,label:e,delayMs:ke}),Jn(e,r,a)},ke)}const Be=".codeyam/tmp/inline-prompt.md";function Gn(e){return e.split(`
10
- `).map(t=>t.startsWith("'@")?` ${t}`:t).join(`
11
- `)}function Qn(e){return`mkdir -p .codeyam/tmp && cat > ${Be} << 'INLINE_PROMPT_EOF'
12
- ${e}
13
- INLINE_PROMPT_EOF\r`}function Zn(e){return`New-Item -ItemType Directory -Force -Path .codeyam/tmp | Out-Null; @'
14
- ${Gn(e)}
15
- '@ | Set-Content -LiteralPath ${Be} -Encoding utf8\r`}function ea(e,t,r=!0,a="posix"){const s=At(e,r),o=a==="powershell"?Zn(t):Qn(t),l=`${s} "Read the file at '${Be}' for your instructions."\r`;return[o,l]}function ta({attempt:e,sawOutput:t}){return t?e===1?"extend":"confirm":e===1?"retry":"fail"}function ra({idleMs:e,ceilingMs:t}){return new Promise(r=>{let a=null,s=null,o=!1;function l(){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(l,e)}function p(){i()}window.addEventListener("miniagent-output",p),s=setTimeout(l,t),i()})}const na=350,aa=4e3,Ze=8e3,sa=500,U={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 oa(e){const{provider:t,slashCommand:r,prompt:a,chatName:s,sendInput:o,permissionModeAuto:l=!0,shellDialect:i=null}=e,[p,u]=c.useState("idle"),x=c.useRef(o),h=c.useRef(r),d=c.useRef(a),b=c.useRef(s),m=c.useRef(t),g=c.useRef(l),y=c.useRef(i);c.useEffect(()=>{x.current=o},[o]),c.useEffect(()=>{g.current=l},[l]),c.useEffect(()=>{y.current=i},[i]),c.useEffect(()=>{h.current=r},[r]),c.useEffect(()=>{d.current=a},[a]),c.useEffect(()=>{b.current=s},[s]),c.useEffect(()=>{m.current=t},[t]);const f=c.useRef(0),v=c.useRef(!1),k=c.useRef(0),_=c.useRef(0),w=c.useRef(0);c.useEffect(()=>{const E=()=>{_.current+=1};return window.addEventListener("miniagent-output",E),()=>window.removeEventListener("miniagent-output",E)},[]);const M=c.useCallback((E,O)=>{const I=h.current,P=d.current;return $e(Ge,()=>{const K=y.current??"posix";if(I){const z=Xn(m.current,I,g.current,K),q=Ce(z);return E(q),new Promise(S=>{setTimeout(()=>{O()&&E("\r"),S()},ue)})}const[R,Y]=ea(m.current,P??"",g.current,K),V=Ce(R),H=Ce(Y);return E(V),new Promise(z=>{setTimeout(()=>{if(!O())return z();E("\r"),setTimeout(()=>{if(!O())return z();E(H),setTimeout(()=>{O()&&E("\r"),z()},ue)},sa)},ue)})})},[]),F=c.useCallback(()=>{const E=++f.current,O=Date.now();k.current=O,w.current=_.current,u("armed"),W(U.armed,{provider:m.current,slashCommand:h.current,chatName:b.current,hasPrompt:typeof d.current=="string"});function I(){return f.current===E}function P(R){I()&&(u(R===1?"firing":"retrying"),W(R===1?U.fired:U.relaunch,{provider:m.current,slashCommand:h.current,chatName:b.current,attempt:R,elapsedMs:Date.now()-O}),M(x.current,I).then(()=>{I()&&(w.current=_.current)}),!v.current&&Dr(m.current)&&(v.current=!0,qn(b.current,"mini-agent-chat",Y=>x.current(Y),Ge)),setTimeout(()=>K(R),Ze))}function K(R){if(!I())return;const Y=_.current>w.current;switch(ta({attempt:R,sawOutput:Y})){case"retry":P(2);return;case"extend":W(U.relaunch,{provider:m.current,slashCommand:h.current,attempt:2,sawOutput:!0,resent:!1,elapsedMs:Date.now()-O}),setTimeout(()=>K(2),Ze);return;case"confirm":u("confirmed"),W(U.confirmed,{provider:m.current,slashCommand:h.current,reason:"output-without-banner",sawOutput:!0,elapsedMs:Date.now()-O});return;case"fail":u("failed"),W(U.failed,{provider:m.current,slashCommand:h.current,reason:"banner-timeout",sawOutput:!1,elapsedMs:Date.now()-O})}}ra({idleMs:na,ceilingMs:aa}).then(()=>{I()&&P(1)})},[M]),T=c.useCallback(()=>{v.current=!1,F()},[F]),j=c.useCallback(()=>{F()},[F]),B=c.useCallback(()=>{f.current!==0&&(f.current++,u("confirmed"),W(U.confirmed,{elapsedMs:Date.now()-k.current}))},[]),N=c.useCallback(()=>{f.current!==0&&(f.current++,u("failed"),W(U.failed,{reason:"startup-failed",elapsedMs:Date.now()-k.current}))},[]),D=c.useCallback(()=>{f.current++,u("confirmed"),W(U.reattached,{provider:m.current,chatName:b.current})},[]);return c.useEffect(()=>()=>{f.current++},[]),{status:p,arm:T,retry:j,onBannerReady:B,onStartupFailed:N,onReattached:D}}function Ce(e){return e.endsWith("\r")?e.slice(0,-1):e}const me=c.createContext({registerSender:()=>{},setReady:()=>{},sendToAgent:()=>!1,agentReady:!1});function ia({children:e}){const t=c.useRef(null),[r,a]=c.useState(!1),s=c.useCallback(p=>{t.current=p},[]),o=c.useCallback(p=>{a(p)},[]),l=c.useCallback(p=>{const u=t.current;return u?u(p):!1},[]),i=c.useMemo(()=>({registerSender:s,setReady:o,sendToAgent:l,agentReady:r}),[s,o,l,r]);return n.jsx(me.Provider,{value:i,children:e})}function la(){const{sendToAgent:e,agentReady:t}=c.useContext(me);return{sendToAgent:e,agentReady:t}}function ca(e,t){const{registerSender:r,setReady:a}=c.useContext(me);c.useEffect(()=>(r(e),()=>r(null)),[r,e]),c.useEffect(()=>(a(t),()=>a(!1)),[a,t])}function Pt(){const{registerSender:e,setReady:t}=c.useContext(me);return{registerSender:e,setReady:t}}const xs=Object.freeze(Object.defineProperty({__proto__:null,AgentInputProvider:ia,useAgentInput:la,useAgentInputChannel:Pt,useRegisterAgentInput:ca},Symbol.toStringTag,{value:"Module"})),Mt=c.createContext({openPicker:()=>{}});function da({openPicker:e,children:t}){const r=c.useMemo(()=>({openPicker:e}),[e]);return n.jsx(Mt.Provider,{value:r,children:t})}function Rt(){return c.useContext(Mt)}const gs=Object.freeze(Object.defineProperty({__proto__:null,FilePickerProvider:da,useFilePicker:Rt},Symbol.toStringTag,{value:"Module"}));function Dt({className:e=""}){const{openPicker:t}=Rt();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 ys=Object.freeze(Object.defineProperty({__proto__:null,AttachFileButton:Dt},Symbol.toStringTag,{value:"Module"})),et=15;function It({chatName:e,prompt:t,slashCommand:r,height:a=400,onClose:s}){const o=c.useRef(null),l=c.useRef(null),i=c.useRef(null);c.useRef(t);const{config:p}=pt(),u=(p==null?void 0:p.provider)??"claude",[x,h]=c.useState({kind:"connecting"}),[d,b]=c.useState(0),m=c.useCallback(T=>{const j=l.current;(j==null?void 0:j.readyState)===WebSocket.OPEN&&j.send(JSON.stringify({type:"input",data:T}))},[]),{registerSender:g,setReady:y}=Pt(),f=c.useCallback(T=>{var j;return((j=l.current)==null?void 0:j.readyState)===WebSocket.OPEN?(l.current.send(JSON.stringify({type:"input",data:T})),!0):!1},[]),v=x.kind==="open";c.useEffect(()=>(v&&g(f),()=>g(null)),[g,f,v]),c.useEffect(()=>(y(v),()=>y(!1)),[y,v]);const k=c.useCallback(()=>{var T;((T=l.current)==null?void 0:T.readyState)===WebSocket.OPEN&&(g(f),y(!0)),In(o.current,()=>{var j;return(j=i.current)==null?void 0:j.focus()})},[g,y,f]),{shellDialect:_}=at(),w=oa({provider:u,slashCommand:r,prompt:t,chatName:e,sendInput:m,permissionModeAuto:(p==null?void 0:p.claudePermissionModeAuto)??!0,shellDialect:_}),M=c.useRef(w);c.useEffect(()=>{M.current=w});const F=c.useRef(e);return c.useEffect(()=>{F.current=e}),c.useEffect(()=>{const T=o.current;if(!T)return;const j=new yn.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}),B=new vn.FitAddon;j.loadAddon(B),j.open(T);const N=Cn(j,T,{onError:S=>console.warn("[MiniAgentChat]",S)}),D=Rn(j,{sendInput:S=>{const C=l.current;(C==null?void 0:C.readyState)===WebSocket.OPEN&&C.send(JSON.stringify({type:"input",data:S}))}});requestAnimationFrame(()=>{try{B.fit()}catch{}}),i.current=j;const E={current:"inline"},O={current:null},I={current:!1},P={current:!1};let K=0,R=null;function Y(){h({kind:"connecting"});const S=jn({mode:E.current,sessionId:O.current??void 0,chatKey:e,cols:j.cols,rows:j.rows}),C=new WebSocket(S);C.binaryType="arraybuffer",l.current=C,C.onopen=()=>{K=0,h({kind:"open"}),Se(!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"){P.current=!0,h({kind:"server-error",message:Fn($)});return}if($.type==="session-id"){if($.sessionId&&(O.current=$.sessionId,E.current="resume"),$.reattached===!0){I.current=!0,M.current.onReattached();return}I.current||(I.current=!0,M.current.arm());return}if($.type==="agent-idle"||$.type==="claude-idle"){window.dispatchEvent(new CustomEvent("miniagent-agent-idle",{detail:{chatName:F.current}}));return}if($.type==="agent-active"||$.type==="claude-active"){window.dispatchEvent(new CustomEvent("miniagent-agent-active",{detail:{chatName:F.current}}));return}if($.type==="agent-banner-ready"){M.current.onBannerReady();return}if($.type==="agent-auth-required"){window.dispatchEvent(new CustomEvent("agent-auth-required"));return}if($.type==="startup-failed"){M.current.onStartupFailed();return}}catch{j.write(L.data),window.dispatchEvent(new CustomEvent("miniagent-output"))}},C.onerror=()=>{},C.onclose=async()=>{if(Se(!1),P.current){h($=>$.kind==="server-error"?$:{kind:"ended"});return}const L=await vt();if(!P.current){if(!L){h({kind:"server-stopped"}),R==null||R(),R=Ln(2e3,()=>{P.current||window.location.reload()});return}if(K<et){const $=K<4?1e3*Math.pow(2,K):1e4;K++,h({kind:"reconnecting",attempt:K,maxAttempts:et}),setTimeout(()=>{P.current||Y()},$)}else h({kind:"failed"})}}}try{B.fit()}catch{}Y(),j.onData(S=>{const C=l.current;(C==null?void 0:C.readyState)===WebSocket.OPEN?C.send(JSON.stringify({type:"input",data:S})):b(L=>L+1)});const V=new ResizeObserver(()=>{try{B.fit();const S=l.current;(S==null?void 0:S.readyState)===WebSocket.OPEN&&S.send(JSON.stringify({type:"resize",cols:j.cols,rows:j.rows}))}catch{}});V.observe(T);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 oe=Sn(S.deltaY,S.deltaMode);oe!==0&&(C.scrollLines(oe),S.preventDefault(),S.stopPropagation())}T.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=l.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;P.current=!0,Se(!1),R==null||R(),R=null,window.removeEventListener("terminal-focus",z),window.removeEventListener("miniagent-send-input",q),T.removeEventListener("wheel",H),V.disconnect(),N(),D();const S=l.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:ae(u)}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Dt,{}),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(Et,{status:x,pulseKey:d,onRefresh:()=>window.location.reload()}),n.jsx(Ot,{status:w.status,onRetry:w.retry})]})]})}const vs=Object.freeze(Object.defineProperty({__proto__:null,MiniAgentChat:It},Symbol.toStringTag,{value:"Module"}));function Lt(e){return e>=500?"transient":"rejected"}function $t({provider:e,onAuthenticated:t}){const[r,a]=c.useState(""),[s,o]=c.useState(!1),[l,i]=c.useState(null),[p,u]=c.useState(!1),x=ae(e),h=c.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(Lt(d.status)==="transient"){u(!0),i(`The editor was briefly unreachable (HTTP ${d.status}). Your key wasn't rejected — try again.`);return}const b=await d.json().catch(()=>({}));i(b.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 ",x," 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:`${x} 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"})]}),l?n.jsxs("div",{className:"space-y-2",children:[n.jsx("p",{className:"text-sm text-[#FF8B43]",children:l}),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 js=Object.freeze(Object.defineProperty({__proto__:null,ApiKeyFlow:$t,classifyApiKeySaveFailure:Lt},Symbol.toStringTag,{value:"Module"})),ua=500,fa=75e3;function Ft({onAuthenticated:e}){const[t,r]=c.useState({state:"starting"}),[a,s]=c.useState(""),[o,l]=c.useState(!1),[i,p]=c.useState(!1),[u,x]=c.useState(!1),[h,d]=c.useState(!1),b=c.useRef(!1),m=c.useRef(e);m.current=e;const g=c.useCallback(async()=>{try{const w=await fetch("/api/auth/status");if(!w.ok)return;const M=await w.json();r(M),M.state==="authenticated"&&!b.current&&(b.current=!0,m.current())}catch{}},[]),y=c.useCallback(async()=>{b.current=!1,x(!1),r({state:"starting"});try{await fetch("/api/auth/start",{method:"POST"})}catch{r({state:"failed",error:"Could not start the login process."})}},[]);c.useEffect(()=>{y()},[y]),c.useEffect(()=>{const w=window.setInterval(()=>void g(),ua);return()=>window.clearInterval(w)},[g]),c.useEffect(()=>{if(t.state!=="starting"){x(!1);return}const w=window.setTimeout(()=>x(!0),fa);return()=>window.clearTimeout(w)},[t.state]);const f=c.useCallback(async()=>{if(a.trim()){l(!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 M=await w.json().catch(()=>({}));r({state:"failed",error:M.error??"Code not accepted — check the value and try again."})}}catch{r({state:"failed",error:"Could not submit the code."})}finally{l(!1)}}},[a]),v=c.useCallback(async()=>{try{await fetch("/api/auth/cancel",{method:"POST"})}catch{}y()},[y]),k=c.useCallback(async()=>{d(!0);try{await fetch("/api/auth/refresh-cache",{method:"POST"}),e()}catch{}finally{d(!1)}},[e]),_=c.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 _s=Object.freeze(Object.defineProperty({__proto__:null,ClaudeOAuthFlow:Ft},Symbol.toStringTag,{value:"Module"}));function Bt({provider:e,onAuthenticated:t,onClose:r}){const a=ae(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(Ft,{onAuthenticated:t}):n.jsx($t,{provider:e,onAuthenticated:t})]})})}const ws=Object.freeze(Object.defineProperty({__proto__:null,ProviderAuthModal:Bt},Symbol.toStringTag,{value:"Module"}));function pa(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 Kt({provider:e,credsPresent:t=!0,reason:r=null,expiresAt:a=null,sessionOngoing:s=!1,onAuthenticated:o,onAuthorized:l}){const[i,p]=c.useState(!1),[u,x]=c.useState(!1),h=ae(e),d=c.useCallback(()=>{p(!1),o(),l==null||l()},[o,l]),b=c.useCallback(async()=>{x(!0);try{await fetch("/api/auth/refresh-cache",{method:"POST"}),o()}catch{}finally{x(!1)}},[o]),m=e==="claude"&&!t,g=a?` (token expired ${pa(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 b(),"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(Bt,{provider:e,onAuthenticated:d,onClose:()=>p(!1)}):null]})}const Ss=Object.freeze(Object.defineProperty({__proto__:null,ProviderAuthenticateCta:Kt},Symbol.toStringTag,{value:"Module"}));let Ne=!1;function zt(e){const{state:t,provider:r,credsPresent:a,reason:s,expiresAt:o,refresh:l}=gn(),[i]=c.useState(()=>Ne);return c.useEffect(()=>{t==="authenticated"?Ne=!0:t==="needs-login"&&(Ne=!1)},[t]),t==="needs-login"?n.jsx(Kt,{provider:r,credsPresent:a,reason:s,expiresAt:o,onAuthenticated:()=>void l(),onAuthorized:()=>{}}):t==="authenticated"||i?n.jsx(It,{...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 ks=Object.freeze(Object.defineProperty({__proto__:null,GatedAgentChat:zt},Symbol.toStringTag,{value:"Module"}));function Ht(){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 Cs=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanelEmptyState:Ht},Symbol.toStringTag,{value:"Module"}));function Yt({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 Ns=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanelCloseButton:Yt},Symbol.toStringTag,{value:"Module"}));function Wt({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",l=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} ${l}`,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 Ts=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanelEditChatButton:Wt},Symbol.toStringTag,{value:"Module"})),Me=new Set,Re=new Set;let Ut={isActive:!1,previewSlug:null};function ha(){for(const e of Me)e()}function Es(e){return Me.add(e),()=>{Me.delete(e)}}function Os(e){Ut=e;for(const t of Re)t(e)}function ma(e){return Re.add(e),()=>{Re.delete(e)}}function tt(){return Ut}function ba(){const[e,t]=c.useState(()=>tt());return c.useEffect(()=>(t(tt()),ma(t)),[]),e}function Vt({panelSlug:e,scenarioState:t}){const r=ba(),{isActive:a,previewSlug:s}=t??r;return s!==e?null:n.jsxs("button",{type:"button","aria-pressed":a,onClick:()=>ha(),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 As=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanelInspectButton:Vt},Symbol.toStringTag,{value:"Module"}));function Xt({variant:e,slug:t}){const r=()=>window.open(Cr(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 Ps=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanelOpenInNewButton:Xt},Symbol.toStringTag,{value:"Module"}));function Jt(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 qt({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:Jt(e)}),n.jsxs("div",{className:"flex items-center gap-2",children:[a&&n.jsx(re,{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 Ms=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDraftBar:qt,summarizeDraftDiff:Jt},Symbol.toStringTag,{value:"Module"}));function Gt({title:e,slug:t,provider:r,chatOpen:a,onToggleChat:s,variant:o,onClose:l,draftDirty:i,draftDiff:p,draftSaving:u,draftCancelling:x,draftError:h,onSave:d,onCancel:b}){const m=ae(r),g=!!i&&!!d&&!!b;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(Wt,{variant:o,providerLabel:m,chatOpen:a,onToggleChat:s}),n.jsx(Vt,{panelSlug:t}),n.jsx(Xt,{variant:o,slug:t}),l&&n.jsx(Yt,{variant:o,onClose:l})]})]}),g&&d&&b&&n.jsx(qt,{diff:p??null,saving:u??!1,cancelling:x??!1,error:h??null,onSave:d,onCancel:b})]})}const Rs=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanelHeader:Gt},Symbol.toStringTag,{value:"Module"}));function xa(e,t){const[r,a]=c.useState(e.status??200),[s,o]=c.useState(e.body??null),[l,i]=c.useState(()=>Object.entries(e.headers??{}).map(([h,d])=>({name:h,value:d})));c.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=c.useMemo(()=>e.headers??{},[e.headers]),u=c.useMemo(()=>{if((e.status??200)!==r||JSON.stringify(e.body??null)!==JSON.stringify(s))return!0;const h={};for(const g of l)g.name.trim()&&(h[g.name.trim()]=g.value);const d=p,b=Object.keys(d),m=Object.keys(h);if(b.length!==m.length)return!0;for(const g of m)if(d[g]!==h[g])return!0;return!1},[r,s,l,e.status,e.body,p]);return{status:r,setStatus:a,body:s,setBody:o,headers:l,setHeaders:i,isDirty:u,buildPayload:()=>{const h={};for(const d of l)d.name.trim()&&(h[d.name.trim()]=d.value);return{status:r,body:s,headers:h}}}}function Qt({body:e,onBodyChange:t}){const{copied:r,copy:a}=_r();async function s(){try{const l=await navigator.clipboard.readText(),i=JSON.parse(l);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 Ds=Object.freeze(Object.defineProperty({__proto__:null,JsonBodyActions:Qt},Symbol.toStringTag,{value:"Module"}));function se(e){return JSON.stringify(e)}function Zt(e,t){return e?e instanceof Set?e.has(t):e.includes(t):!1}function ga(e){const t=new Set;function r(a,s){if(a!==null&&typeof a=="object")if(t.add(se(s)),Array.isArray(a))a.forEach((o,l)=>r(o,[...s,l]));else for(const[o,l]of Object.entries(a))r(l,[...s,o])}return r(e,[]),t}function ya(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 va(e){return e===null?"null":typeof e=="string"?`"${e}"`:String(e)}function ja(e){return e===null?"null":typeof e=="string"?e:String(e)}function _a(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 be(e){return JSON.parse(JSON.stringify(e))}function wa(e,t,r){if(t.length===0)return r;const a=be(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 Ke(e,t){if(t.length===0)return e;const r=be(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 Sa(e,t){const r=be(e);let a=r;for(const s of t)a=a[s];return Array.isArray(a)&&a.push(null),r}function ka(e,t,r){const a=be(e);let s=a;for(const o of t)s=s[o];return s&&typeof s=="object"&&!Array.isArray(s)&&(s[r]=""),a}function Ca(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 l=Number(o);if(!Number.isInteger(l)||l<0)return null;t.push(l),r=s+1}else return null}return t}function Na(e,t){c.useEffect(()=>{if(!e)return;const r=Ca(e);r&&t(a=>{const s=new Set(a);for(let o=0;o<r.length;o++)s.add(se(r.slice(0,o)));return s})},[e,t])}function xe({collapsible:e,isOpen:t,onToggle:r,parentKey:a,readOnly:s,onRemove:o,children:l}){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:l}),!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 Is=Object.freeze(Object.defineProperty({__proto__:null,JsonTreeNodeLine:xe},Symbol.toStringTag,{value:"Module"}));function er(e){const{value:t,path:r,parentKey:a,expanded:s,onToggle:o,readOnly:l}=e,i=se(r),p=Zt(s,i),u=t.length>0;return n.jsxs("div",{children:[n.jsxs(xe,{collapsible:u,isOpen:p,onToggle:()=>o(i),parentKey:a,readOnly:l,onRemove:r.length>0?()=>e.onValueChange(Ke(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((x,h)=>c.createElement(ge,{...e,key:h,value:x,path:[...r,h],parentKey:h,isLast:h===t.length-1})),!l&&n.jsx("button",{type:"button",onClick:()=>e.onValueChange(Sa(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 Ls=Object.freeze(Object.defineProperty({__proto__:null,JsonTreeArrayNode:er},Symbol.toStringTag,{value:"Module"}));function tr({onSave:e,onCancel:t}){const[r,a]=c.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 $s=Object.freeze(Object.defineProperty({__proto__:null,JsonTreeAddKeyInput:tr},Symbol.toStringTag,{value:"Module"}));function rr(e){const{value:t,path:r,parentKey:a,expanded:s,onToggle:o,readOnly:l,addingKeyAtPath:i,onStartAddKey:p,onStopAddKey:u}=e,x=se(r),h=Zt(s,x),d=Object.entries(t),b=d.length>0,m=i===x;return n.jsxs("div",{children:[n.jsxs(xe,{collapsible:b,isOpen:h,onToggle:()=>o(x),parentKey:a,readOnly:l,onRemove:r.length>0?()=>e.onValueChange(Ke(e.rootValue,r)):null,children:[n.jsx("span",{className:"text-[var(--text-dim)]",children:"{"}),!h&&n.jsxs(n.Fragment,{children:[b&&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)=>c.createElement(ge,{...e,key:g,value:y,path:[...r,g],parentKey:g,isLast:f===d.length-1})),!l&&!m&&n.jsx("button",{type:"button",onClick:()=>p(x),className:"text-[10px] text-[var(--accent-blue)] hover:underline bg-transparent border-none cursor-pointer py-0.5",children:"+ Add key"}),!l&&m&&n.jsx(tr,{onSave:g=>{g.trim()&&e.onValueChange(ka(e.rootValue,r,g.trim())),u()},onCancel:u})]}),h&&n.jsx("div",{className:"text-[var(--text-dim)]",children:"}"})]})}const Fs=Object.freeze(Object.defineProperty({__proto__:null,JsonTreeObjectNode:rr},Symbol.toStringTag,{value:"Module"}));function nr({initial:e,onSave:t,onCancel:r}){const[a,s]=c.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 Bs=Object.freeze(Object.defineProperty({__proto__:null,JsonTreePrimitiveEditor:nr},Symbol.toStringTag,{value:"Module"}));function ar(e){const{value:t,path:r,parentKey:a,readOnly:s,editingPath:o,onStartEdit:l,onStopEdit:i}=e,p=se(r),u=o===p;return n.jsx(xe,{collapsible:!1,isOpen:!1,parentKey:a,readOnly:s,onToggle:()=>{},onRemove:r.length>0?()=>e.onValueChange(Ke(e.rootValue,r)):null,children:u?n.jsx(nr,{initial:ja(t),onSave:x=>{const h=_a(x);e.onValueChange(wa(e.rootValue,r,h)),i()},onCancel:i}):n.jsx("button",{type:"button",onClick:s?void 0:()=>l(p),disabled:s,className:`${s?"":"hover:bg-[var(--bg-card)] cursor-pointer"} bg-transparent border-none px-1 py-0 rounded ${ya(t)} text-left font-mono`,title:s?void 0:"Click to edit",children:va(t)})})}const Ks=Object.freeze(Object.defineProperty({__proto__:null,JsonTreePrimitiveNode:ar},Symbol.toStringTag,{value:"Module"}));function ge(e){const{value:t}=e;return Array.isArray(t)?n.jsx(er,{...e,value:t}):t!==null&&typeof t=="object"?n.jsx(rr,{...e,value:t}):n.jsx(ar,{...e})}const zs=Object.freeze(Object.defineProperty({__proto__:null,JsonTreeNode:ge},Symbol.toStringTag,{value:"Module"}));function ye({value:e,onChange:t,readOnly:r=!1,focusJsonPath:a}){const[s,o]=c.useState(()=>ga(e)),[l,i]=c.useState(null),[p,u]=c.useState(null);Na(a,o);function x(h){o(d=>{const b=new Set(d);return b.has(h)?b.delete(h):b.add(h),b})}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(ge,{value:e,path:[],parentKey:null,isLast:!0,readOnly:r,expanded:s,editingPath:l,addingKeyAtPath:p,onToggle:x,onStartEdit:i,onStopEdit:()=>i(null),onStartAddKey:u,onStopAddKey:()=>u(null),onValueChange:t,rootValue:e})})})}const Hs=Object.freeze(Object.defineProperty({__proto__:null,JsonTreeEditor:ye},Symbol.toStringTag,{value:"Module"}));function sr({headers:e,onChange:t}){function r(o,l){t(e.map((i,p)=>p===o?{...i,...l}:i))}function a(){t([...e,{name:"",value:""}])}function s(o){t(e.filter((l,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,l)=>n.jsxs("div",{className:"flex gap-2",children:[n.jsx("input",{value:o.name,onChange:i=>r(l,{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(l,{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(l),className:"px-2 text-xs text-[var(--text-dim)] hover:text-red-400 bg-transparent border-none cursor-pointer",children:"×"})]},l))]})}const Ys=Object.freeze(Object.defineProperty({__proto__:null,MockBodyHeadersEditor:sr},Symbol.toStringTag,{value:"Module"})),Te=5;function Ta(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,Te).join(", "),s=e.length>Te?`, +${e.length-Te} more`:"";return`Affects ${e.length} ${r}: ${a}${s}`}function Ea(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 Oa(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 Aa(e,t,r){const[a,s]=c.useState({}),o=r.map(l=>X(l.scope)).join("|");return c.useEffect(()=>{let l=!1;return(async()=>{const p={};for(const u of r)p[X(u.scope)]="loading";s(p);for(const u of r)try{const x=await Kr(e,t,u.scope);if(l)return;s(h=>({...h,[X(u.scope)]:x}))}catch{if(l)return;s(x=>({...x,[X(u.scope)]:[]}))}})(),()=>{l=!0}},[e,t,o]),a}function or({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:or},Symbol.toStringTag,{value:"Module"}));function ir({entry:e,scenarioSlug:t,routeKey:r,onCancel:a,onConfirm:s}){const o=Ea(e),[l,i]=c.useState(()=>Oa(e,o)),p=Aa(t,r,o),[u,x]=c.useState(!1),[h,d]=c.useState(null),b=async()=>{const m=o[l];if(m){x(!0),d(null);try{await s(m.scope)}catch(g){d(g instanceof Error?g.message:"Save failed")}finally{x(!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(or,{choice:m,selected:l===g,impactLabel:Ta(p[X(m.scope)],m.scope),onSelect:()=>i(g)},X(m.scope)))}),h&&n.jsx(re,{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 b(),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 Us=Object.freeze(Object.defineProperty({__proto__:null,SaveScopeModal:ir},Symbol.toStringTag,{value:"Module"}));function lr({entry:e,routeKey:t,scenarioSlug:r,onSave:a,focusJsonPath:s}){const o=xa(e,t),[l,i]=c.useState(null),[p,u]=c.useState(!1),[x,h]=c.useState(!1);c.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)}},b=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:[l&&n.jsx(re,{text:l,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 b(),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(sr,{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(Qt,{body:o.body,onBodyChange:o.setBody})]}),n.jsx(ye,{value:o.body,onChange:o.setBody,focusJsonPath:s},t)]}),x&&n.jsx(ir,{entry:e,scenarioSlug:r,routeKey:t,onCancel:()=>h(!1),onConfirm:async m=>{await d(m),h(!1)}})]})}const Vs=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanelMainMockEditable:lr},Symbol.toStringTag,{value:"Module"}));function Pa(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 rt={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 Ma(e){return rt[e]??rt.GET}function cr({entry:e,scenarioHasDefaultFallback:t,onSave:r,onRemove:a,onPassthrough:s}){const o=`${e.method} ${e.pathPattern}`,l=Ma(e.method),i=e.status??e.lastObservedStatus,p=c.useMemo(()=>e.lastObservedMs?Pa(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 ${l}`,children:e.method}),n.jsx("span",{className:"font-mono text-sm text-[var(--text-primary)] break-all",children:e.pathPattern}),n.jsx(Le,{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(x=>x!==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 Xs=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanelMainMockHeader:cr},Symbol.toStringTag,{value:"Module"}));function dr({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(ye,{value:e.body,onChange:()=>{},readOnly:!0},`${e.method} ${e.pathPattern}`)]})]})}const Js=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanelMainMockReadOnly:dr},Symbol.toStringTag,{value:"Module"}));function ur({entry:e,scenarioSlug:t,scenarioHasDefaultFallback:r,onSave:a,onRemove:s,onPassthrough:o,focusJsonPath:l}){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(cr,{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(lr,{entry:e,routeKey:i,scenarioSlug:t,onSave:a,focusJsonPath:l}):n.jsx(dr,{entry:e})})]})}const qs=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanelMainMock:ur},Symbol.toStringTag,{value:"Module"}));function Ra({slug:e,tab:t,initialRows:r,onCellEdited:a}){const[s,o]=c.useState(r),[l,i]=c.useState(null),[p,u]=c.useState(""),[x,h]=c.useState(""),d=c.useRef(null);c.useEffect(()=>{o(r),i(null)},[t.dataKey,r]);function b(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),!l)return;const k=l;d.current=setTimeout(()=>{f(k.row,k.col,v)},600)}function g(){l&&(d.current&&clearTimeout(d.current),f(l.row,l.col,p),i(null))}function y(){if(d.current&&clearTimeout(d.current),!!l){if(p!==x){const v=[...s];v[l.row]={...v[l.row],[l.col]:We(x)},o(v),fetch(`/api/scenarios/${encodeURIComponent(e)}/data`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({table:t.dataKey,rowIndex:l.row,column:l.col,value:x})}).then(()=>{G(),a&&a()}).catch(()=>{})}i(null)}}async function f(v,k,_){const w=[...s];w[v]={...w[v],[k]:We(_)},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:l,editValue:p,handleEditCell:b,handleEditValueChange:m,handleSave:g,handleCancelEdit:y}}function fr({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 Gs=Object.freeze(Object.defineProperty({__proto__:null,DataViewerCategoryBadge:fr},Symbol.toStringTag,{value:"Module"}));function pr({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 Qs=Object.freeze(Object.defineProperty({__proto__:null,DataViewerCellEditor:pr},Symbol.toStringTag,{value:"Module"}));function hr({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(mr,{name:o,type:t[o],isPk:o===r},o))]})}),n.jsx("tbody",{children:a.map((o,l)=>n.jsx(br,{row:o,rowIndex:l,columns:e,pkCol:r,onEditCell:s},l))})]})})}function mr({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 br({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(xr,{value:e[o],isPk:o===a,onEdit:()=>s(t,o)},o))]})}function xr({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 Zs=Object.freeze(Object.defineProperty({__proto__:null,DataViewerCell:xr,DataViewerColumnHeader:mr,DataViewerRow:br,DataViewerTable:hr},Symbol.toStringTag,{value:"Module"}));function gr({slug:e,tab:t,initialRows:r,onCellEdited:a}){const{rows:s,editingCell:o,editValue:l,handleEditCell:i,handleEditValueChange:p,handleSave:u,handleCancelEdit:x}=Ra({slug:e,tab:t,initialRows:r,onCellEdited:a}),h=Vr(s,t.schemaFields),d=Xr(h,s,t.schemaFields),b=Jr(h,t.schemaFields);return n.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[n.jsx(fr,{tab:t}),n.jsx("div",{className:"flex-1 min-h-0 overflow-auto",children:n.jsx(hr,{columns:h,colTypes:d,pkCol:b,rows:s,onEditCell:i})}),o&&n.jsx(pr,{editingCell:o,editValue:l,onEditValueChange:p,onSave:u,onCancel:x})]})}const eo=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanelMainTable:gr},Symbol.toStringTag,{value:"Module"}));function Da({slug:e,browserState:t,tab:r,onCellEdited:a}){const s=c.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=c.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]),l=c.useMemo(()=>{switch(r){case"cookies":return"Cookies";case"localStorage":return"Local Storage";case"sessionStorage":return"Session Storage";case"headers":return"Request Headers"}},[r]),i=c.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:l,description:i}}function yr({slug:e,browserState:t,tab:r,onCellEdited:a}){const{value:s,handleChange:o,label:l,description:i}=Da({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:l}),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(ye,{value:s,onChange:o})})]})}const to=Object.freeze(Object.defineProperty({__proto__:null,BrowserStateTab:yr},Symbol.toStringTag,{value:"Module"}));function fe({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 ro=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanelMockDataBadge:fe},Symbol.toStringTag,{value:"Module"}));function vr({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(fe,{label:"This Page",active:t.kind==="this-page",onClick:()=>r({kind:"this-page"})}),e.map(a=>n.jsx(fe,{label:a,active:t.kind==="share"&&t.slug===a,onClick:()=>r({kind:"share",slug:a})},a)),n.jsx(fe,{label:"Defaults",active:t.kind==="defaults",onClick:()=>r({kind:"defaults"})})]})}const no=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanelMockDataStrip:vr},Symbol.toStringTag,{value:"Module"}));function Ia({slug:e,scenarioName:t,initialSection:r,onClose:a,variant:s="slideOver"}){const{data:o,tableTabs:l,scenarioOwnedDataKeys:i,shares:p,browserState:u,loading:x,error:h}=rn(e),{entries:d,loading:b,error:m,upsertScoped:g,remove:y,setPassthrough:f}=Hr(e),{config:v}=pt(),k=(v==null?void 0:v.provider)??"claude",_=on({slug:e,onPreviewReload:G}),w=c.useCallback(()=>{_.markDirty(),G()},[_]),M=c.useCallback(async A=>{await g(A),w()},[g,w]),F=c.useCallback(async A=>{await y(A),w()},[y,w]),T=c.useCallback(async A=>{await f(A),w()},[f,w]),j=c.useCallback(()=>{_.markDirty(),G()},[_]),B=c.useCallback(()=>{a&&_.confirmIfDirty("Discard unsaved changes to this scenario?")&&a()},[a,_]),[N,D]=c.useState(null),[E,O]=c.useState(null),[I,P]=c.useState(!1),K=c.useCallback(A=>D({kind:"mock",routeKey:A}),[]);Rr({onSelect:K,onFocus:O});const[R,Y]=c.useState({kind:"this-page"}),V=x||b,H=c.useMemo(()=>s==="inline"?l.filter(A=>i.has(A.dataKey)):l,[s,l,i]),z=c.useMemo(()=>{if(s!=="inline")return d;switch(R.kind){case"this-page":return d.filter(A=>A.consumedThisPageLoad);case"defaults":return d.filter(A=>A.source==="default");case"share":return d.filter(A=>A.source==="shared"&&A.sharedSlug===R.slug)}},[s,d,R]);mn({seedTabs:H,mockEntries:z,initialSection:r,selection:N,setSelection:D});const q=c.useMemo(()=>{const A=new Set;for(const ze of d)ze.source==="default"&&A.add(J(ze));return A},[d]),S=(N==null?void 0:N.kind)==="seed"?H.find(A=>A.dataKey===N.dataKey)??null:null,C=(N==null?void 0:N.kind)==="mock"?z.find(A=>J(A)===N.routeKey)??null:null,L=S&&o?o[S.dataKey]??[]:[],$=c.useMemo(()=>Ar({slug:e,scenarioName:t,seedTabs:H,mockEntries:z,selectedMock:C,selectedSeedTab:S,selectedSeedRows:L}),[e,t,H,z,C,S,L]),oe=t??e,ve=H.length>0||z.length>0,je=n.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[n.jsx(Gt,{title:oe,slug:e,provider:k,chatOpen:I,onToggleChat:()=>P(A=>!A),variant:s,onClose:a?B:void 0,draftDirty:_.isDirty,draftDiff:_.diffSummary,draftSaving:_.saving,draftCancelling:_.cancelling,draftError:_.error,onSave:()=>void _.save(),onCancel:()=>void _.cancel()}),s==="inline"&&n.jsx(vr,{shares:p,activeBadge:R,onSelect:Y}),I&&n.jsx("div",{className:"flex-shrink-0 border-b border-[var(--border-subtle)] bg-[var(--bg-deep)]",children:n.jsx(zt,{chatName:`edit-data-${e}`,prompt:$,height:360,onClose:()=>P(!1)})}),n.jsxs("div",{className:"flex flex-1 min-h-0",children:[n.jsx(yt,{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(re,{text:`Seed error: ${h}`,className:"text-xs text-red-400",rowClassName:"p-4"}),m&&n.jsx(re,{text:`Mocks error: ${m}`,className:"text-xs text-red-400",rowClassName:"p-4"}),!V&&!ve&&n.jsx(Ht,{}),S&&n.jsx(gr,{slug:e,tab:S,initialRows:L,onCellEdited:j}),C&&n.jsx(ur,{entry:C,scenarioSlug:e,scenarioHasDefaultFallback:q.has(J(C)),onSave:M,onRemove:F,onPassthrough:T,focusJsonPath:E}),(N==null?void 0:N.kind)==="browser"&&n.jsx(yr,{slug:e,browserState:u,tab:N.tab,onCellEdited:j}),!S&&!C&&(N==null?void 0:N.kind)!=="browser"&&ve&&!V&&n.jsx("p",{className:"p-4 text-xs text-[var(--text-dim)] italic",children:"Select a data source from the left to view it."}),V&&!ve&&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:je}):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:je}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"fixed inset-0 z-40 bg-black/40",onClick:B,"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:je})]})}const ao=Object.freeze(Object.defineProperty({__proto__:null,ScenarioDataPanel:Ia},Symbol.toStringTag,{value:"Module"}));export{ur as $,ia as A,yr as B,st as C,br as D,dt as E,nr as F,rr as G,xe as H,ge as I,ar as J,ye as K,er as L,sr as M,tr as N,Qt as O,qt as P,xt as Q,gt as R,Ia as S,Tt as T,ir as U,or as V,yt as W,vr as X,fe as Y,Xt as Z,cr as _,Le as a,Ks as a$,Vt as a0,Gt as a1,Ht as a2,Wt as a3,Yt as a4,hr as a5,pr as a6,fr as a7,bt as a8,mt as a9,Ms as aA,ns as aB,Ps as aC,no as aD,ro as aE,eo as aF,Js as aG,Xs as aH,Vs as aI,qs as aJ,As as aK,Rs as aL,Cs as aM,Ts as aN,Ns as aO,ao as aP,Us as aQ,Ws as aR,Ss as aS,ws as aT,Qa as aU,ts as aV,Ys as aW,Xa as aX,ps as aY,Ja as aZ,vs as a_,kt as aa,St as ab,wt as ac,_t as ad,Et as ae,Dt as af,$t as ag,Ft as ah,Bt as ai,zt as aj,Kt as ak,gs as al,xs as am,_s as an,js as ao,us as ap,ls as aq,cs as ar,os as as,is as at,ds as au,fs as av,ss as aw,rs as ax,es as ay,Za as az,gr as b,Bs as b0,Fs as b1,Is as b2,zs as b3,Hs as b4,Ls as b5,$s as b6,Ds as b7,ks as b8,Ya as b9,Fn as bA,vt as bB,Ln as bC,Dn as bD,ms as bE,Hn as bF,Qe as bG,zn as bH,ue as bI,ne as bJ,zr as bK,qa as bL,Os as bM,Es as bN,Ga as bO,as as bP,gn as bQ,De as bR,da as bS,Ha as ba,Wa as bb,Ua as bc,Va as bd,Zs as be,Qs as bf,Gs as bg,to as bh,ys as bi,pt as bj,ae as bk,Lt as bl,Fe as bm,Jn as bn,Dr as bo,ke as bp,Wn as bq,bs as br,la as bs,yn as bt,vn as bu,Cn as bv,Rn as bw,hs as bx,In as by,jn as bz,lr as c,dr as d,G as e,Pa as f,on as g,rn as h,Hr as i,ot as j,ut as k,ft as l,ct as m,lt as n,it as o,We as p,ee as q,Nt as r,Ct as s,ce as t,ca as u,mr as v,xr as w,te as x,Ot as y,It as z};