@launchsecure/launch-kit 0.0.25 → 0.0.26

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 (126) hide show
  1. package/README.md +50 -0
  2. package/dist/beacon/beacon.mjs +1016 -0
  3. package/dist/beacon/beacon.mjs.map +1 -0
  4. package/dist/beacon/beacon.umd.js +87 -0
  5. package/dist/beacon/beacon.umd.js.map +1 -0
  6. package/dist/beacon/index-DAIDnjfR.mjs +513 -0
  7. package/dist/beacon/index-DAIDnjfR.mjs.map +1 -0
  8. package/dist/beacon/types/capture/element.d.ts +3 -0
  9. package/dist/beacon/types/capture/element.d.ts.map +1 -0
  10. package/dist/beacon/types/capture/framework.d.ts +3 -0
  11. package/dist/beacon/types/capture/framework.d.ts.map +1 -0
  12. package/dist/beacon/types/capture/metadata.d.ts +3 -0
  13. package/dist/beacon/types/capture/metadata.d.ts.map +1 -0
  14. package/dist/beacon/types/capture/overlay.d.ts +7 -0
  15. package/dist/beacon/types/capture/overlay.d.ts.map +1 -0
  16. package/dist/beacon/types/capture/picker.d.ts +12 -0
  17. package/dist/beacon/types/capture/picker.d.ts.map +1 -0
  18. package/dist/beacon/types/capture/screenshot.d.ts +7 -0
  19. package/dist/beacon/types/capture/screenshot.d.ts.map +1 -0
  20. package/dist/beacon/types/capture/selector.d.ts +2 -0
  21. package/dist/beacon/types/capture/selector.d.ts.map +1 -0
  22. package/dist/beacon/types/element.d.ts +50 -0
  23. package/dist/beacon/types/element.d.ts.map +1 -0
  24. package/dist/beacon/types/index.d.ts +4 -0
  25. package/dist/beacon/types/index.d.ts.map +1 -0
  26. package/dist/beacon/types/transport/submit.d.ts +3 -0
  27. package/dist/beacon/types/transport/submit.d.ts.map +1 -0
  28. package/dist/beacon/types/types.d.ts +88 -0
  29. package/dist/beacon/types/types.d.ts.map +1 -0
  30. package/dist/beacon/types/ui/button.d.ts +2 -0
  31. package/dist/beacon/types/ui/button.d.ts.map +1 -0
  32. package/dist/beacon/types/ui/drawer.d.ts +31 -0
  33. package/dist/beacon/types/ui/drawer.d.ts.map +1 -0
  34. package/dist/beacon/types/ui/icons.d.ts +9 -0
  35. package/dist/beacon/types/ui/icons.d.ts.map +1 -0
  36. package/dist/beacon/types/ui/pick-mode-overlay.d.ts +25 -0
  37. package/dist/beacon/types/ui/pick-mode-overlay.d.ts.map +1 -0
  38. package/dist/beacon/types/ui/pin-popover.d.ts +14 -0
  39. package/dist/beacon/types/ui/pin-popover.d.ts.map +1 -0
  40. package/dist/chart-client/assets/{index-C8ANseEa.js → index-Bk1hawjD.js} +63 -58
  41. package/dist/chart-client/assets/index-DpaGa3bY.css +1 -0
  42. package/dist/chart-client/index.html +2 -2
  43. package/dist/client/assets/index-Bfel4OQ5.css +32 -0
  44. package/dist/client/assets/{index-Ds9UP_cj.js → index-eC-WuUWB.js} +58 -58
  45. package/dist/client/index.html +2 -2
  46. package/dist/council-client/assets/{index-Dc41S-R2.js → index-Cs_MVXHf.js} +14 -14
  47. package/dist/council-client/assets/index-P5kMsT5a.css +1 -0
  48. package/dist/council-client/index.html +2 -2
  49. package/dist/deck-client/assets/{_baseUniq-2gclQXo7.js → _baseUniq-C2xT_eYu.js} +1 -1
  50. package/dist/deck-client/assets/{arc-DcMY5Wm0.js → arc-CmVL9pGd.js} +1 -1
  51. package/dist/deck-client/assets/{architectureDiagram-Q4EWVU46-B8iirmmJ.js → architectureDiagram-Q4EWVU46-BSFgdjve.js} +1 -1
  52. package/dist/deck-client/assets/{blockDiagram-DXYQGD6D-B4JBLjmJ.js → blockDiagram-DXYQGD6D-DuLzscvP.js} +1 -1
  53. package/dist/deck-client/assets/{c4Diagram-AHTNJAMY-CojrJAk8.js → c4Diagram-AHTNJAMY-CfCJB8eY.js} +1 -1
  54. package/dist/deck-client/assets/channel-B4aNO8ZB.js +1 -0
  55. package/dist/deck-client/assets/{chunk-4BX2VUAB-Bmb_BMDo.js → chunk-4BX2VUAB-DxmLYTWZ.js} +1 -1
  56. package/dist/deck-client/assets/{chunk-4TB4RGXK-CumBy8qe.js → chunk-4TB4RGXK-CCnf7GFE.js} +1 -1
  57. package/dist/deck-client/assets/{chunk-55IACEB6-Ka8Hb1wD.js → chunk-55IACEB6-Db9DApcj.js} +1 -1
  58. package/dist/deck-client/assets/{chunk-EDXVE4YY-B3sIPiQo.js → chunk-EDXVE4YY-DmYDq8ZI.js} +1 -1
  59. package/dist/deck-client/assets/{chunk-FMBD7UC4-C1tYkaqu.js → chunk-FMBD7UC4-BGhUlF20.js} +1 -1
  60. package/dist/deck-client/assets/{chunk-OYMX7WX6-D7Wacbky.js → chunk-OYMX7WX6-CpEnicQZ.js} +1 -1
  61. package/dist/deck-client/assets/{chunk-QZHKN3VN-ChXI0vO3.js → chunk-QZHKN3VN-Doa7LKwf.js} +1 -1
  62. package/dist/deck-client/assets/{chunk-YZCP3GAM-BXhiqf8u.js → chunk-YZCP3GAM-CpkIlH6V.js} +1 -1
  63. package/dist/deck-client/assets/classDiagram-6PBFFD2Q-BHTI0yWz.js +1 -0
  64. package/dist/deck-client/assets/classDiagram-v2-HSJHXN6E-BHTI0yWz.js +1 -0
  65. package/dist/deck-client/assets/clone-HduFm7qU.js +1 -0
  66. package/dist/deck-client/assets/{cose-bilkent-S5V4N54A-Bqp3p68D.js → cose-bilkent-S5V4N54A-Bkh8Bfcb.js} +1 -1
  67. package/dist/deck-client/assets/{dagre-KV5264BT-BS-rtyhZ.js → dagre-KV5264BT-Bp0XpTgH.js} +1 -1
  68. package/dist/deck-client/assets/{diagram-5BDNPKRD-BIrj9YGI.js → diagram-5BDNPKRD-ZHiyGYPQ.js} +1 -1
  69. package/dist/deck-client/assets/{diagram-G4DWMVQ6-noHWPIg4.js → diagram-G4DWMVQ6-BW-Q8_H5.js} +1 -1
  70. package/dist/deck-client/assets/{diagram-MMDJMWI5-C2qHxvqV.js → diagram-MMDJMWI5-6I3LTafu.js} +1 -1
  71. package/dist/deck-client/assets/{diagram-TYMM5635-BytnGQr-.js → diagram-TYMM5635-CyM5YK28.js} +1 -1
  72. package/dist/deck-client/assets/{erDiagram-SMLLAGMA-BfK5m2YQ.js → erDiagram-SMLLAGMA-CjNxVJHk.js} +1 -1
  73. package/dist/deck-client/assets/{flowDiagram-DWJPFMVM-Cq925G1Z.js → flowDiagram-DWJPFMVM-BDQHuAJR.js} +1 -1
  74. package/dist/deck-client/assets/{ganttDiagram-T4ZO3ILL-DhhHPAmj.js → ganttDiagram-T4ZO3ILL-B7MnkpbP.js} +1 -1
  75. package/dist/deck-client/assets/{gitGraphDiagram-UUTBAWPF-B3Lc0h9q.js → gitGraphDiagram-UUTBAWPF-C9dZAcYD.js} +1 -1
  76. package/dist/deck-client/assets/{graph-RTawgVWm.js → graph-CjdBnzUy.js} +1 -1
  77. package/dist/deck-client/assets/{index-BfIfJXmS.js → index-DeIVPW63.js} +68 -68
  78. package/dist/deck-client/assets/index-LKZDAS9S.css +1 -0
  79. package/dist/deck-client/assets/{infoDiagram-42DDH7IO-BlR584kX.js → infoDiagram-42DDH7IO-C7d3iRC3.js} +1 -1
  80. package/dist/deck-client/assets/{ishikawaDiagram-UXIWVN3A-DygKoNGY.js → ishikawaDiagram-UXIWVN3A-BcYGKj09.js} +1 -1
  81. package/dist/deck-client/assets/{journeyDiagram-VCZTEJTY-BnaiYp9N.js → journeyDiagram-VCZTEJTY-DqFlRrOL.js} +1 -1
  82. package/dist/deck-client/assets/{kanban-definition-6JOO6SKY-BQBUBzJC.js → kanban-definition-6JOO6SKY-BJhPp1NR.js} +1 -1
  83. package/dist/deck-client/assets/{layout-DeZ8HI1T.js → layout-DIeS6GvK.js} +1 -1
  84. package/dist/deck-client/assets/{linear-C6roLi_9.js → linear-He_yJy5H.js} +1 -1
  85. package/dist/deck-client/assets/{min-CbUksbuI.js → min-DQ6Kx06t.js} +1 -1
  86. package/dist/deck-client/assets/{mindmap-definition-QFDTVHPH-iNxV62yN.js → mindmap-definition-QFDTVHPH-sQ62L8T2.js} +1 -1
  87. package/dist/deck-client/assets/{pieDiagram-DEJITSTG-DHVA0jaG.js → pieDiagram-DEJITSTG-BqCWmU2K.js} +1 -1
  88. package/dist/deck-client/assets/{quadrantDiagram-34T5L4WZ-DBeKKLUQ.js → quadrantDiagram-34T5L4WZ-rQ1TJOoe.js} +1 -1
  89. package/dist/deck-client/assets/{requirementDiagram-MS252O5E-CBwITx7p.js → requirementDiagram-MS252O5E-BO2MPBOM.js} +1 -1
  90. package/dist/deck-client/assets/{sankeyDiagram-XADWPNL6-BtE-1YTU.js → sankeyDiagram-XADWPNL6-BgsHEVex.js} +1 -1
  91. package/dist/deck-client/assets/{sequenceDiagram-FGHM5R23-DN96yPP2.js → sequenceDiagram-FGHM5R23-B3j1yMLU.js} +1 -1
  92. package/dist/deck-client/assets/{stateDiagram-FHFEXIEX-VUkKC2uJ.js → stateDiagram-FHFEXIEX-C8jFlZou.js} +1 -1
  93. package/dist/deck-client/assets/stateDiagram-v2-QKLJ7IA2-BoqepHW0.js +1 -0
  94. package/dist/deck-client/assets/{timeline-definition-GMOUNBTQ-oUeZhRns.js → timeline-definition-GMOUNBTQ-tM-qo4Zk.js} +1 -1
  95. package/dist/deck-client/assets/{vennDiagram-DHZGUBPP-D87fK90n.js → vennDiagram-DHZGUBPP-B0-6kOEu.js} +1 -1
  96. package/dist/deck-client/assets/wardley-RL74JXVD-HpBk07P-.js +162 -0
  97. package/dist/deck-client/assets/{wardleyDiagram-NUSXRM2D-Ca_i0QRA.js → wardleyDiagram-NUSXRM2D-BkA1NLDE.js} +1 -1
  98. package/dist/deck-client/assets/{xychartDiagram-5P7HB3ND-CUOJVIvq.js → xychartDiagram-5P7HB3ND-CEKGSuI-.js} +1 -1
  99. package/dist/deck-client/index.html +2 -2
  100. package/dist/server/chart-serve.js +990 -116
  101. package/dist/server/cli.js +28413 -6982
  102. package/dist/server/council-entry.js +0 -0
  103. package/dist/server/deck-mcp-entry.js +332 -3
  104. package/dist/server/deck-serve.js +288 -0
  105. package/dist/server/fb-wizard.js +0 -0
  106. package/dist/server/graph/queries/classify.scm +8 -0
  107. package/dist/server/graph/queries/exports.scm +7 -0
  108. package/dist/server/graph-mcp-entry.js +1639 -197
  109. package/dist/server/recall-entry.js +1112 -0
  110. package/package.json +47 -21
  111. package/dist/chart-client/assets/index--120d9P9.css +0 -1
  112. package/dist/client/assets/index-Bf8zdL3x.css +0 -32
  113. package/dist/council-client/assets/index-CofZh7pS.css +0 -1
  114. package/dist/deck-client/assets/channel-ERh5jKXV.js +0 -1
  115. package/dist/deck-client/assets/classDiagram-6PBFFD2Q-CMi1Gaev.js +0 -1
  116. package/dist/deck-client/assets/classDiagram-v2-HSJHXN6E-CMi1Gaev.js +0 -1
  117. package/dist/deck-client/assets/clone-DfWhlD4X.js +0 -1
  118. package/dist/deck-client/assets/index-765AIQ9z.css +0 -1
  119. package/dist/deck-client/assets/stateDiagram-v2-QKLJ7IA2-CA0IjulK.js +0 -1
  120. package/dist/deck-client/assets/wardley-RL74JXVD-DYbYcpDp.js +0 -162
  121. package/dist/server/deck-server/deck-mcp-entry.js +0 -1789
  122. package/dist/server/deck-server/deck-serve.js +0 -1275
  123. package/dist/server/server/chart-serve.js +0 -4643
  124. package/dist/server/server/cli.js +0 -13360
  125. package/dist/server/server/fb-wizard.js +0 -136
  126. package/dist/server/server/graph-mcp-entry.js +0 -6776
@@ -0,0 +1,1016 @@
1
+ const R = '.beacon-drawer,.beacon-pin-popover{--beacon-accent: #0ea5e9;--beacon-bg: #ffffff;--beacon-fg: #0f172a;--beacon-muted: #64748b;--beacon-border: #e2e8f0;--beacon-radius: 10px;--beacon-shadow: 0 10px 30px rgba(0, 0, 0, .15), 0 2px 6px rgba(0, 0, 0, .08);--beacon-z-index: 2147483647;--beacon-bug: #ef4444;--beacon-idea: #22c55e;--beacon-ux: #a855f7;--beacon-a11y: #06b6d4}.beacon-drawer.beacon-theme-dark,.beacon-pin-popover.beacon-theme-dark{--beacon-bg: #0f172a;--beacon-fg: #f1f5f9;--beacon-muted: #94a3b8;--beacon-border: #334155}@media (prefers-color-scheme: dark){.beacon-drawer.beacon-theme-auto,.beacon-pin-popover.beacon-theme-auto{--beacon-bg: #0f172a;--beacon-fg: #f1f5f9;--beacon-muted: #94a3b8;--beacon-border: #334155}}:host{--beacon-accent: #0ea5e9;--beacon-bg: #ffffff;--beacon-fg: #0f172a;--beacon-muted: #64748b;--beacon-border: #e2e8f0;--beacon-radius: 10px;--beacon-z-index: 2147483645;--beacon-shadow: 0 10px 30px rgba(0, 0, 0, .15), 0 2px 6px rgba(0, 0, 0, .08);--beacon-bug: #ef4444;--beacon-idea: #22c55e;--beacon-ux: #a855f7;--beacon-a11y: #06b6d4;position:fixed;z-index:var(--beacon-z-index);font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;font-size:14px;color:var(--beacon-fg);line-height:1.5}:host([theme="dark"]){--beacon-bg: #0f172a;--beacon-fg: #f1f5f9;--beacon-muted: #94a3b8;--beacon-border: #334155}@media (prefers-color-scheme: dark){:host([theme="auto"]){--beacon-bg: #0f172a;--beacon-fg: #f1f5f9;--beacon-muted: #94a3b8;--beacon-border: #334155}}:host([position="bottom-right"]){right:20px;bottom:20px;left:auto;top:auto}:host([position="bottom-left"]){left:20px;bottom:20px;right:auto;top:auto}:host([position="hidden"]){position:static;display:contents}:host([position="hidden"]) .beacon-default-trigger{display:none}.beacon-default-trigger{display:inline-flex;align-items:center;gap:6px;background:var(--beacon-accent);color:#fff;border:0;border-radius:999px;padding:10px 16px;font:inherit;font-weight:500;cursor:pointer;box-shadow:var(--beacon-shadow);transition:transform .15s ease,box-shadow .15s ease}.beacon-default-trigger:hover{transform:translateY(-1px);box-shadow:0 14px 36px #0003}.beacon-default-trigger svg{width:18px;height:18px}.beacon-drawer{position:fixed;right:20px;bottom:20px;width:380px;max-width:calc(100vw - 24px);max-height:calc(100vh - 24px);background:var(--beacon-bg);color:var(--beacon-fg);border:1px solid var(--beacon-border);border-radius:var(--beacon-radius);box-shadow:var(--beacon-shadow);display:none;flex-direction:column;overflow:hidden;z-index:var(--beacon-z-index)}:host([position="bottom-left"]) .beacon-drawer{left:20px;right:auto}.beacon-drawer.open{display:flex}.beacon-drawer.minimized{display:none}.beacon-drawer-header{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;border-bottom:1px solid var(--beacon-border)}.beacon-drawer-title{font-weight:600}.beacon-icon-btn{background:transparent;border:0;color:var(--beacon-muted);cursor:pointer;padding:4px;border-radius:4px;display:inline-flex}.beacon-icon-btn:hover{background:var(--beacon-border);color:var(--beacon-fg)}.beacon-icon-btn svg{width:16px;height:16px}.beacon-drawer-body{padding:16px;overflow-y:auto;display:flex;flex-direction:column;gap:14px}.beacon-field{display:flex;flex-direction:column;gap:6px}.beacon-label{font-size:12px;color:var(--beacon-muted);font-weight:500}.beacon-textarea{width:100%;min-height:80px;padding:8px 10px;background:var(--beacon-bg);color:var(--beacon-fg);border:1px solid var(--beacon-border);border-radius:6px;font:inherit;resize:vertical;box-sizing:border-box}.beacon-textarea:focus{outline:2px solid var(--beacon-accent);outline-offset:-1px;border-color:var(--beacon-accent)}.beacon-severity{display:grid;grid-template-columns:repeat(4,1fr);gap:6px}.beacon-severity-opt{position:relative;display:flex;align-items:center;justify-content:center;padding:6px 4px;background:transparent;border:1px solid var(--beacon-border);border-radius:6px;cursor:pointer;font-size:12px;font-weight:500;color:var(--beacon-fg);text-transform:capitalize}.beacon-severity-opt input{position:absolute;opacity:0;pointer-events:none}.beacon-severity-opt:hover{background:var(--beacon-border)}.beacon-severity-opt.selected[data-sev=bug]{border-color:var(--beacon-bug);color:var(--beacon-bug)}.beacon-severity-opt.selected[data-sev=idea]{border-color:var(--beacon-idea);color:var(--beacon-idea)}.beacon-severity-opt.selected[data-sev=ux]{border-color:var(--beacon-ux);color:var(--beacon-ux)}.beacon-severity-opt.selected[data-sev=a11y]{border-color:var(--beacon-a11y);color:var(--beacon-a11y)}.beacon-actions{display:flex;gap:8px;align-items:center}.beacon-btn{display:inline-flex;align-items:center;gap:6px;padding:8px 14px;border-radius:6px;border:0;cursor:pointer;font:inherit;font-weight:500;font-size:13px;transition:opacity .15s ease}.beacon-btn[disabled]{opacity:.5;cursor:not-allowed}.beacon-btn svg{width:14px;height:14px}.beacon-btn.primary{background:var(--beacon-accent);color:#fff}.beacon-btn.secondary{background:transparent;color:var(--beacon-fg);border:1px solid var(--beacon-border)}.beacon-btn.secondary:hover{background:var(--beacon-border)}.beacon-pin-list{display:flex;flex-direction:column;gap:6px;max-height:200px;overflow-y:auto}.beacon-pin-item{display:flex;align-items:flex-start;gap:8px;padding:8px;background:var(--beacon-border);border-radius:6px}.beacon-pin-num{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;border-radius:50%;background:var(--beacon-accent);color:#fff;font-size:11px;font-weight:600;flex-shrink:0}.beacon-pin-meta{flex:1;min-width:0}.beacon-pin-selector{font:11px/1.4 ui-monospace,SFMono-Regular,Menlo,monospace;color:var(--beacon-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.beacon-pin-note{margin-top:4px;font-size:12px;color:var(--beacon-fg)}.beacon-pin-note-input{margin-top:4px;width:100%;padding:4px 6px;background:var(--beacon-bg);color:var(--beacon-fg);border:1px solid var(--beacon-border);border-radius:4px;font:inherit;font-size:12px;box-sizing:border-box}.beacon-thumb{width:100%;border:1px solid var(--beacon-border);border-radius:6px;display:block}.beacon-status{font-size:12px;color:var(--beacon-muted);text-align:center;padding:4px}.beacon-status.error{color:var(--beacon-bug)}.beacon-status.success{color:var(--beacon-idea)}.beacon-pin-popover{position:fixed;z-index:2147483647;width:240px;background:var(--beacon-bg);color:var(--beacon-fg);border:1px solid var(--beacon-border);border-radius:6px;box-shadow:var(--beacon-shadow);padding:10px;display:none;flex-direction:column;gap:8px}.beacon-pin-popover.open{display:flex}.beacon-pin-popover-header{display:flex;align-items:center;justify-content:space-between;gap:6px}.beacon-pin-popover-actions{display:flex;gap:6px;justify-content:flex-end}', k = {
2
+ feedback: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>',
3
+ pin: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 17v5"/><path d="M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z"/></svg>',
4
+ close: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>',
5
+ trash: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 6h18"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"/><path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/></svg>',
6
+ send: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m22 2-7 20-4-9-9-4Z"/><path d="M22 2 11 13"/></svg>',
7
+ check: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"/></svg>'
8
+ };
9
+ function Y(n = "Feedback") {
10
+ const e = document.createElement("button");
11
+ return e.type = "button", e.className = "beacon-default-trigger", e.setAttribute("aria-label", n), e.innerHTML = `${k.feedback}<span>${n}</span>`, e;
12
+ }
13
+ const X = ["bug", "idea", "ux", "a11y"];
14
+ class G {
15
+ constructor(e, t) {
16
+ this.state = {
17
+ description: "",
18
+ severity: "bug",
19
+ pins: [],
20
+ annotatedScreenshot: void 0,
21
+ submitting: !1,
22
+ status: "",
23
+ statusKind: ""
24
+ }, this.severities = e.length > 0 ? e : X, this.callbacks = t, this.root = document.createElement("div"), this.root.className = "beacon-drawer", this.root.innerHTML = `
25
+ <div class="beacon-drawer-header">
26
+ <div class="beacon-drawer-title">Send feedback</div>
27
+ <button type="button" class="beacon-icon-btn" data-action="close" aria-label="Close">${k.close}</button>
28
+ </div>
29
+ <div class="beacon-drawer-body"></div>
30
+ `, this.bodyEl = this.root.querySelector(".beacon-drawer-body"), this.root.querySelector('[data-action="close"]').addEventListener("click", () => this.callbacks.onClose()), this.render();
31
+ }
32
+ open() {
33
+ this.root.classList.remove("minimized"), this.root.classList.add("open");
34
+ }
35
+ close() {
36
+ this.root.classList.remove("open");
37
+ }
38
+ minimize() {
39
+ this.root.classList.add("minimized"), this.root.classList.remove("open");
40
+ }
41
+ setPins(e, t) {
42
+ this.state.pins = e, t !== void 0 && (this.state.annotatedScreenshot = t), this.render();
43
+ }
44
+ getAnnotatedScreenshot() {
45
+ return this.state.annotatedScreenshot;
46
+ }
47
+ setAnnotatedScreenshot(e) {
48
+ this.state.annotatedScreenshot = e, this.render();
49
+ }
50
+ setSubmitting(e) {
51
+ this.state.submitting = e, this.render();
52
+ }
53
+ setStatus(e, t = "") {
54
+ this.state.status = e, this.state.statusKind = t, this.render();
55
+ }
56
+ reset() {
57
+ this.state = {
58
+ description: "",
59
+ severity: "bug",
60
+ pins: [],
61
+ annotatedScreenshot: void 0,
62
+ submitting: !1,
63
+ status: "",
64
+ statusKind: ""
65
+ }, this.render();
66
+ }
67
+ getDescription() {
68
+ return this.state.description;
69
+ }
70
+ getSeverity() {
71
+ return this.state.severity;
72
+ }
73
+ render() {
74
+ var o, i;
75
+ const e = this.state.description.trim().length > 0 && !this.state.submitting;
76
+ this.bodyEl.innerHTML = `
77
+ <div class="beacon-field">
78
+ <label class="beacon-label" for="beacon-desc">What's the issue?</label>
79
+ <textarea id="beacon-desc" class="beacon-textarea" placeholder="Describe what you saw, what you expected, anything that helps reproduce…">${E(this.state.description)}</textarea>
80
+ </div>
81
+
82
+ <div class="beacon-field">
83
+ <span class="beacon-label">Severity</span>
84
+ <div class="beacon-severity" role="radiogroup">
85
+ ${this.severities.map((a) => `
86
+ <label class="beacon-severity-opt ${a === this.state.severity ? "selected" : ""}" data-sev="${a}">
87
+ <input type="radio" name="beacon-severity" value="${a}" ${a === this.state.severity ? "checked" : ""}>
88
+ ${a}
89
+ </label>
90
+ `).join("")}
91
+ </div>
92
+ </div>
93
+
94
+ ${this.state.annotatedScreenshot ? `
95
+ <div class="beacon-field">
96
+ <span class="beacon-label">Annotated screenshot</span>
97
+ <img src="${this.state.annotatedScreenshot}" class="beacon-thumb" alt="Annotated screenshot preview">
98
+ </div>
99
+ ` : ""}
100
+
101
+ ${this.state.pins.length > 0 ? `
102
+ <div class="beacon-field">
103
+ <span class="beacon-label">Pins (${this.state.pins.length})</span>
104
+ <div class="beacon-pin-list">
105
+ ${this.state.pins.map((a) => `
106
+ <div class="beacon-pin-item" data-pin="${a.number}">
107
+ <span class="beacon-pin-num">${a.number}</span>
108
+ <div class="beacon-pin-meta">
109
+ <div class="beacon-pin-selector" title="${E(a.selector)}">${E(a.selector)}</div>
110
+ <input type="text" class="beacon-pin-note-input" placeholder="Add a note (optional)" value="${E(a.note ?? "")}">
111
+ </div>
112
+ <button type="button" class="beacon-icon-btn" data-pin-delete="${a.number}" aria-label="Remove pin ${a.number}">${k.trash}</button>
113
+ </div>
114
+ `).join("")}
115
+ </div>
116
+ </div>
117
+ ` : ""}
118
+
119
+ <div class="beacon-actions">
120
+ <button type="button" class="beacon-btn secondary" data-action="annotate" ${this.state.submitting ? "disabled" : ""}>
121
+ ${k.pin} ${this.state.pins.length > 0 ? "Add another pin" : "Annotate elements"}
122
+ </button>
123
+ <span style="flex:1"></span>
124
+ <button type="button" class="beacon-btn primary" data-action="submit" ${e ? "" : "disabled"}>
125
+ ${k.send} ${this.state.submitting ? "Sending…" : "Send"}
126
+ </button>
127
+ </div>
128
+
129
+ ${this.state.status ? `<div class="beacon-status ${this.state.statusKind}">${E(this.state.status)}</div>` : ""}
130
+ `;
131
+ const t = this.bodyEl.querySelector("#beacon-desc");
132
+ t.addEventListener("input", () => {
133
+ this.state.description = t.value, this.callbacks.onDescriptionChange(t.value);
134
+ const a = this.bodyEl.querySelector('[data-action="submit"]');
135
+ a && (a.disabled = !(t.value.trim().length > 0) || this.state.submitting);
136
+ }), this.bodyEl.querySelectorAll('input[name="beacon-severity"]').forEach((a) => {
137
+ a.addEventListener("change", () => {
138
+ a.checked && (this.state.severity = a.value, this.callbacks.onSeverityChange(this.state.severity), this.render());
139
+ });
140
+ }), (o = this.bodyEl.querySelector('[data-action="annotate"]')) == null || o.addEventListener("click", () => this.callbacks.onAnnotate()), (i = this.bodyEl.querySelector('[data-action="submit"]')) == null || i.addEventListener("click", () => this.callbacks.onSubmit()), this.bodyEl.querySelectorAll("[data-pin-delete]").forEach((a) => {
141
+ a.addEventListener("click", () => {
142
+ const s = Number(a.getAttribute("data-pin-delete"));
143
+ this.callbacks.onPinDelete(s);
144
+ });
145
+ }), this.bodyEl.querySelectorAll(".beacon-pin-note-input").forEach((a) => {
146
+ const s = a.closest("[data-pin]"), b = Number((s == null ? void 0 : s.getAttribute("data-pin")) ?? 0);
147
+ a.addEventListener("input", () => this.callbacks.onPinNoteChange(b, a.value));
148
+ });
149
+ }
150
+ }
151
+ function E(n) {
152
+ return n.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
153
+ }
154
+ function Z(n) {
155
+ return new Promise((e) => {
156
+ const t = document.createElement("div");
157
+ t.className = "beacon-pin-popover open beacon-no-capture beacon-theme-auto", t.innerHTML = `
158
+ <div class="beacon-pin-popover-header">
159
+ <div style="display:flex;align-items:center;gap:6px;font-weight:600;font-size:13px;">
160
+ <span class="beacon-pin-num">${n.pinNumber}</span>
161
+ <span>Note for this pin</span>
162
+ </div>
163
+ <button type="button" class="beacon-icon-btn" data-action="cancel" aria-label="Discard this pin">${k.close}</button>
164
+ </div>
165
+ <textarea class="beacon-textarea" rows="2" placeholder="Optional — describe what's wrong here…" style="min-height:48px;"></textarea>
166
+ <div class="beacon-pin-popover-actions">
167
+ <button type="button" class="beacon-btn primary" data-action="save">${k.check} Save</button>
168
+ </div>
169
+ `;
170
+ const o = 240, i = 160, a = Math.min(Math.max(8, n.anchor.x), window.innerWidth - o - 8), s = Math.min(Math.max(8, n.anchor.y + 12), window.innerHeight - i - 8);
171
+ t.style.left = `${a}px`, t.style.top = `${s}px`, document.body.appendChild(t);
172
+ const b = t.querySelector("textarea");
173
+ b.focus();
174
+ function p(h) {
175
+ document.removeEventListener("keydown", u, !0), t.remove(), e(h);
176
+ }
177
+ function u(h) {
178
+ h.key === "Escape" && (h.preventDefault(), h.stopPropagation(), p({ cancelled: "all" }));
179
+ }
180
+ document.addEventListener("keydown", u, !0), t.addEventListener("click", (h) => {
181
+ var m;
182
+ const v = (m = h.target.closest("[data-action]")) == null ? void 0 : m.getAttribute("data-action");
183
+ if (v === "cancel" && p({ cancelled: "pin" }), v === "save") {
184
+ const x = b.value.trim();
185
+ p({ ...x ? { note: x } : {}, cancelled: !1 });
186
+ }
187
+ }), b.addEventListener("keydown", (h) => {
188
+ if (h.key === "Enter" && (h.metaKey || h.ctrlKey)) {
189
+ h.preventDefault();
190
+ const f = b.value.trim();
191
+ p({ ...f ? { note: f } : {}, cancelled: !1 });
192
+ }
193
+ });
194
+ });
195
+ }
196
+ const A = "beacon-no-capture", J = "#0ea5e9", M = "Click any element to pin it · Press Esc to finish";
197
+ function N(n, e) {
198
+ return /^#[0-9a-fA-F]{6}$/.test(n) ? `${n}${e}` : n;
199
+ }
200
+ function Q(n = {}) {
201
+ const e = n.accent ?? J, t = N(e, "b3"), o = N(e, "2e"), i = document.createElement("style");
202
+ i.className = A, i.textContent = "@keyframes beacon-spin { to { transform: rotate(360deg); } }", document.head.appendChild(i);
203
+ const a = document.createElement("div");
204
+ a.className = A, a.setAttribute("aria-hidden", "true"), a.style.cssText = [
205
+ "position: fixed",
206
+ "inset: 0",
207
+ "pointer-events: none",
208
+ "z-index: 2147483646",
209
+ `border: 2px dashed ${t}`,
210
+ "border-radius: 4px",
211
+ `box-shadow: inset 0 0 56px ${o}`,
212
+ "box-sizing: border-box"
213
+ ].join("; ");
214
+ const s = document.createElement("div");
215
+ s.className = A, s.setAttribute("role", "status"), s.style.cssText = [
216
+ "position: fixed",
217
+ "top: 16px",
218
+ "left: 50%",
219
+ "transform: translateX(-50%)",
220
+ `background: ${e}`,
221
+ "color: #fff",
222
+ "padding: 6px 14px",
223
+ "border-radius: 999px",
224
+ "font: 500 12px/1.4 system-ui, -apple-system, sans-serif",
225
+ "letter-spacing: 0.01em",
226
+ "box-shadow: 0 4px 12px #0000004d",
227
+ "pointer-events: none",
228
+ "white-space: nowrap",
229
+ "z-index: 2147483646"
230
+ ].join("; "), s.textContent = M;
231
+ const b = `<span style="
232
+ display: inline-block;
233
+ width: 12px;
234
+ height: 12px;
235
+ border: 2px solid #fff;
236
+ border-top-color: transparent;
237
+ border-radius: 50%;
238
+ animation: beacon-spin 800ms linear infinite;
239
+ vertical-align: middle;
240
+ margin-right: 8px;
241
+ "></span>`;
242
+ function p(r) {
243
+ return r.replace(/[<>&]/g, (d) => ({ "<": "&lt;", ">": "&gt;", "&": "&amp;" })[d]);
244
+ }
245
+ document.body.appendChild(a), document.body.appendChild(s);
246
+ const u = /* @__PURE__ */ new Map();
247
+ function h(r) {
248
+ const d = document.createElement("div");
249
+ return d.className = A, d.setAttribute("aria-hidden", "true"), d.style.cssText = [
250
+ "position: fixed",
251
+ "width: 24px",
252
+ "height: 24px",
253
+ "border-radius: 999px",
254
+ `background: ${e}`,
255
+ "color: #fff",
256
+ "display: flex",
257
+ "align-items: center",
258
+ "justify-content: center",
259
+ "font: 700 12px/1 system-ui, -apple-system, sans-serif",
260
+ "border: 2px solid #fff",
261
+ "box-shadow: 0 2px 8px #00000066",
262
+ "pointer-events: none",
263
+ "z-index: 2147483646"
264
+ ].join("; "), d.textContent = String(r), document.body.appendChild(d), d;
265
+ }
266
+ function f() {
267
+ const r = document.createElement("div");
268
+ return r.className = A, r.setAttribute("aria-hidden", "true"), r.style.cssText = [
269
+ "position: fixed",
270
+ "pointer-events: none",
271
+ `border: 2px solid ${e}`,
272
+ "border-radius: 2px",
273
+ "box-sizing: border-box",
274
+ // Slightly below marker z so the marker visually "sits on" the outline corner.
275
+ "z-index: 2147483645"
276
+ ].join("; "), document.body.appendChild(r), r;
277
+ }
278
+ function v(r, d, c) {
279
+ const l = c ? "0.5" : "1";
280
+ r.outline.style.display = "block", r.outline.style.opacity = l, r.outline.style.left = `${d.x}px`, r.outline.style.top = `${d.y}px`, r.outline.style.width = `${d.w}px`, r.outline.style.height = `${d.h}px`, r.marker.style.display = "flex", r.marker.style.opacity = l, r.marker.style.left = `${d.x + d.w - 12}px`, r.marker.style.top = `${Math.max(2, d.y - 12)}px`;
281
+ }
282
+ function m(r) {
283
+ r.marker.style.display = "none", r.outline.style.display = "none";
284
+ }
285
+ function x() {
286
+ u.forEach((r) => {
287
+ let d = r.anchor.target;
288
+ if (document.contains(d) || (d = null), !d && r.anchor.selector && (d = document.querySelector(r.anchor.selector), d && (r.anchor.target = d)), d) {
289
+ const l = d.getBoundingClientRect();
290
+ if (l.width > 0 || l.height > 0) {
291
+ v(r, { x: l.left, y: l.top, w: l.width, h: l.height }, !1);
292
+ return;
293
+ }
294
+ }
295
+ const c = r.anchor.fallbackRect;
296
+ if (c && (c.w > 0 || c.h > 0)) {
297
+ v(r, c, !0);
298
+ return;
299
+ }
300
+ m(r);
301
+ });
302
+ }
303
+ let w = null;
304
+ function g() {
305
+ w === null && (w = requestAnimationFrame(() => {
306
+ w = null, x();
307
+ }));
308
+ }
309
+ return window.addEventListener("scroll", g, !0), window.addEventListener("resize", g), {
310
+ addPin(r, d) {
311
+ const c = h(r), l = f();
312
+ u.set(r, { anchor: d, marker: c, outline: l }), x();
313
+ },
314
+ setLoading(r) {
315
+ r ? s.innerHTML = b + p(r) : s.textContent = M;
316
+ },
317
+ destroy() {
318
+ window.removeEventListener("scroll", g, !0), window.removeEventListener("resize", g), w !== null && cancelAnimationFrame(w), a.remove(), s.remove(), i.remove(), u.forEach(({ marker: r, outline: d }) => {
319
+ r.remove(), d.remove();
320
+ }), u.clear();
321
+ }
322
+ };
323
+ }
324
+ const ee = "#0ea5e9";
325
+ function te(n, e) {
326
+ return /^#[0-9a-fA-F]{6}$/.test(n) ? `${n}${e}` : n;
327
+ }
328
+ function ne(n) {
329
+ const { shadowRoot: e, onHover: t } = n, o = n.accent ?? ee, i = te(o, "14"), a = document.createElement("div");
330
+ a.style.cssText = [
331
+ "position: fixed",
332
+ "pointer-events: none",
333
+ "z-index: 2147483646",
334
+ `border: 2px solid ${o}`,
335
+ `background: ${i}`,
336
+ "transition: all 60ms ease-out",
337
+ "box-sizing: border-box",
338
+ "border-radius: 2px"
339
+ ].join("; "), document.body.appendChild(a);
340
+ const s = document.createElement("div");
341
+ s.style.cssText = [
342
+ "position: fixed",
343
+ "pointer-events: none",
344
+ "z-index: 2147483647",
345
+ "background: #0f172a",
346
+ "color: #fff",
347
+ "font: 11px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace",
348
+ "padding: 3px 6px",
349
+ "border-radius: 3px",
350
+ "max-width: 280px",
351
+ "overflow: hidden",
352
+ "text-overflow: ellipsis",
353
+ "white-space: nowrap"
354
+ ].join("; "), document.body.appendChild(s);
355
+ const b = document.body.style.cursor;
356
+ document.body.style.cursor = "crosshair";
357
+ let p = !1, u = () => {
358
+ };
359
+ const h = new Promise((c) => {
360
+ u = c;
361
+ });
362
+ function f(c) {
363
+ if (!c || !(c instanceof Node)) return !1;
364
+ let l = c;
365
+ for (; l; ) {
366
+ if (l === e || l === e.host) return !0;
367
+ l = l.parentNode ?? l.host ?? null;
368
+ }
369
+ return !1;
370
+ }
371
+ function v(c, l) {
372
+ a.style.display = "none", s.style.display = "none";
373
+ const L = document.elementsFromPoint(c, l);
374
+ a.style.display = "block", s.style.display = "block";
375
+ for (const S of L)
376
+ if (!f(S)) return S;
377
+ return null;
378
+ }
379
+ function m(c) {
380
+ const l = c.getBoundingClientRect();
381
+ a.style.left = `${l.left}px`, a.style.top = `${l.top}px`, a.style.width = `${l.width}px`, a.style.height = `${l.height}px`;
382
+ const L = c.tagName.toLowerCase(), S = c.classList.length > 0 ? "." + Array.from(c.classList).slice(0, 2).join(".") : "";
383
+ s.textContent = L + S;
384
+ const $ = l.top - 22;
385
+ s.style.left = `${l.left}px`, s.style.top = `${$ >= 0 ? $ : l.bottom + 4}px`;
386
+ }
387
+ function x(c) {
388
+ const l = v(c.clientX, c.clientY);
389
+ l ? (m(l), t == null || t(l)) : (a.style.display = "none", s.style.display = "none", t == null || t(null));
390
+ }
391
+ function w(c) {
392
+ if (c.button !== 0) return;
393
+ c.preventDefault(), c.stopPropagation();
394
+ const l = v(c.clientX, c.clientY);
395
+ l && d(l);
396
+ }
397
+ function g(c) {
398
+ c.preventDefault(), c.stopPropagation();
399
+ }
400
+ function r(c) {
401
+ c.key === "Escape" && (c.preventDefault(), d(null));
402
+ }
403
+ function d(c) {
404
+ p || (p = !0, document.removeEventListener("mousemove", x, !0), document.removeEventListener("pointerdown", w, !0), document.removeEventListener("click", g, !0), document.removeEventListener("mouseup", g, !0), document.removeEventListener("keydown", r, !0), a.remove(), s.remove(), document.body.style.cursor = b, u(c));
405
+ }
406
+ return document.addEventListener("mousemove", x, !0), document.addEventListener("pointerdown", w, !0), document.addEventListener("click", g, !0), document.addEventListener("mouseup", g, !0), document.addEventListener("keydown", r, !0), {
407
+ cancel: () => d(null),
408
+ promise: h
409
+ };
410
+ }
411
+ const oe = 8;
412
+ function _(n, e = document) {
413
+ if (!n) return !1;
414
+ try {
415
+ return e.querySelectorAll(`#${CSS.escape(n)}`).length === 1;
416
+ } catch {
417
+ return !1;
418
+ }
419
+ }
420
+ function ie(n) {
421
+ const e = n.tagName.toLowerCase(), t = Array.from(n.classList).filter((o) => o.length > 0 && o.length < 40).slice(0, 3).map((o) => `.${CSS.escape(o)}`).join("");
422
+ return e + t;
423
+ }
424
+ function ae(n) {
425
+ const e = n.parentElement;
426
+ return e ? Array.from(e.children).filter((o) => o.tagName === n.tagName).indexOf(n) + 1 : 1;
427
+ }
428
+ function se(n) {
429
+ if (!n || n.nodeType !== Node.ELEMENT_NODE) return "";
430
+ if (n.id && _(n.id))
431
+ return `#${CSS.escape(n.id)}`;
432
+ const e = [];
433
+ let t = n, o = 0;
434
+ for (; t && t.tagName.toLowerCase() !== "body" && o < oe; ) {
435
+ const i = t;
436
+ if (i.id && _(i.id)) {
437
+ e.unshift(`#${CSS.escape(i.id)}`);
438
+ break;
439
+ }
440
+ const a = ie(i), s = i.parentElement;
441
+ let b = a;
442
+ if (s)
443
+ try {
444
+ const p = Array.from(i.classList).join(" ");
445
+ Array.from(s.children).filter(
446
+ (h) => h.tagName === i.tagName && Array.from(h.classList).join(" ") === p
447
+ ).length > 1 && (b = `${i.tagName.toLowerCase()}:nth-of-type(${ae(i)})`);
448
+ } catch {
449
+ }
450
+ e.unshift(b), t = s, o++;
451
+ }
452
+ return e.join(" > ");
453
+ }
454
+ function re(n) {
455
+ const e = Object.keys(n).filter((o) => o.startsWith("__reactFiber$") || o.startsWith("__reactInternalInstance$"));
456
+ if (e.length === 0) return null;
457
+ let t = n[e[0]];
458
+ for (let o = 0; o < 10 && t; o++) {
459
+ const i = t, a = i.type;
460
+ if (typeof a == "function") {
461
+ const s = a.displayName ?? a.name;
462
+ if (s && s !== "_default") return { lib: "react", name: s };
463
+ }
464
+ if (typeof a == "object" && a !== null) {
465
+ const s = a.displayName ?? a.name;
466
+ if (s) return { lib: "react", name: s };
467
+ }
468
+ t = i.return;
469
+ }
470
+ return { lib: "react" };
471
+ }
472
+ function ce(n) {
473
+ var o, i;
474
+ const e = n, t = e.__vueParentComponent;
475
+ if (t) {
476
+ const a = ((o = t.type) == null ? void 0 : o.name) ?? ((i = t.type) == null ? void 0 : i.__name);
477
+ return { lib: "vue", ...a ? { name: a } : {} };
478
+ }
479
+ return e.__vue__ ? { lib: "vue" } : null;
480
+ }
481
+ function de(n) {
482
+ const e = window.ng;
483
+ if (!(e != null && e.getComponent)) return null;
484
+ try {
485
+ const t = e.getComponent(n);
486
+ if (!t) return null;
487
+ const o = t.constructor;
488
+ return { lib: "angular", ...o != null && o.name ? { name: o.name } : {} };
489
+ } catch {
490
+ return null;
491
+ }
492
+ }
493
+ function le(n) {
494
+ return "__svelte_meta" in n ? { lib: "svelte" } : null;
495
+ }
496
+ function P(n) {
497
+ return re(n) ?? ce(n) ?? de(n) ?? le(n) ?? void 0;
498
+ }
499
+ const ue = 5e3, pe = 1e3, I = 1e3, D = 200, he = 50, z = 200, be = 500, fe = [
500
+ "display",
501
+ "position",
502
+ "top",
503
+ "right",
504
+ "bottom",
505
+ "left",
506
+ "width",
507
+ "height",
508
+ "min-width",
509
+ "min-height",
510
+ "max-width",
511
+ "max-height",
512
+ "margin",
513
+ "padding",
514
+ "font-family",
515
+ "font-size",
516
+ "font-weight",
517
+ "line-height",
518
+ "text-align",
519
+ "color",
520
+ "background-color",
521
+ "background-image",
522
+ "border",
523
+ "border-radius",
524
+ "opacity",
525
+ "visibility",
526
+ "overflow",
527
+ "z-index",
528
+ "transform",
529
+ "transition",
530
+ "flex",
531
+ "flex-direction",
532
+ "justify-content",
533
+ "align-items",
534
+ "gap",
535
+ "grid-template-columns",
536
+ "grid-template-rows"
537
+ ];
538
+ function B(n, e) {
539
+ return n.length <= e ? n : n.slice(0, e) + `
540
+
541
+ /* … truncated, original was ${n.length} chars */`;
542
+ }
543
+ function me(n) {
544
+ const e = getComputedStyle(n), t = {};
545
+ for (const o of fe) {
546
+ const i = e.getPropertyValue(o);
547
+ i && i !== "normal" && i !== "none" && i !== "auto" && i !== "0px" && (t[o] = i.trim().slice(0, be));
548
+ }
549
+ return t;
550
+ }
551
+ function ge(n) {
552
+ return Array.from(n.classList).slice(0, he).map((t) => t.length > z ? t.slice(0, z) : t);
553
+ }
554
+ function ve(n) {
555
+ const e = n.getBoundingClientRect(), t = se(n), o = n.id || null;
556
+ return {
557
+ selector: t.length > I ? t.slice(0, I) : t,
558
+ tagName: n.tagName.toLowerCase(),
559
+ id: o && o.length > D ? o.slice(0, D) : o,
560
+ classList: ge(n),
561
+ outerHTML: B(n.outerHTML, ue),
562
+ ...n.parentElement ? { parentOuterHTML: B(n.parentElement.outerHTML, pe) } : {},
563
+ computedStyles: me(n),
564
+ boundingRect: {
565
+ x: Math.round(e.x),
566
+ y: Math.round(e.y),
567
+ w: Math.round(e.width),
568
+ h: Math.round(e.height)
569
+ },
570
+ ...P(n) ? { framework: P(n) } : {}
571
+ };
572
+ }
573
+ function O() {
574
+ var t, o;
575
+ const n = navigator;
576
+ return n.userAgentData ? {
577
+ brand: ((t = n.userAgentData.brands.find((i) => !/Not[.\-]?A.?Brand/i.test(i.brand))) == null ? void 0 : t.brand) ?? ((o = n.userAgentData.brands[0]) == null ? void 0 : o.brand) ?? "unknown",
578
+ mobile: n.userAgentData.mobile,
579
+ platform: n.userAgentData.platform
580
+ } : void 0;
581
+ }
582
+ function j() {
583
+ if (window.matchMedia("(prefers-color-scheme: dark)").matches) return "dark";
584
+ if (window.matchMedia("(prefers-color-scheme: light)").matches) return "light";
585
+ }
586
+ function H() {
587
+ return {
588
+ url: window.location.href,
589
+ ...document.referrer ? { referrer: document.referrer } : {},
590
+ userAgent: navigator.userAgent,
591
+ ...O() ? { uaData: O() } : {},
592
+ viewport: {
593
+ w: window.innerWidth,
594
+ h: window.innerHeight,
595
+ dpr: window.devicePixelRatio || 1
596
+ },
597
+ screen: {
598
+ w: window.screen.width,
599
+ h: window.screen.height
600
+ },
601
+ timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
602
+ locale: navigator.language,
603
+ ...j() ? { theme: j() } : {},
604
+ capturedAt: (/* @__PURE__ */ new Date()).toISOString()
605
+ };
606
+ }
607
+ let T = null;
608
+ async function xe() {
609
+ return T || (T = await import("./index-DAIDnjfR.mjs")), T;
610
+ }
611
+ const C = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkAAIAAAoAAv/lxKUAAAAASUVORK5CYII=";
612
+ function F(n, e) {
613
+ if (!n || n.startsWith("data:") || n.startsWith("blob:") || n.startsWith("/") || n.startsWith("#")) return !0;
614
+ try {
615
+ if (new URL(n, window.location.href).origin === window.location.origin) return !0;
616
+ } catch {
617
+ return !1;
618
+ }
619
+ return e === "anonymous" || e === "use-credentials";
620
+ }
621
+ function we() {
622
+ const n = [], e = [];
623
+ return document.querySelectorAll("img").forEach((t) => {
624
+ F(t.src, t.crossOrigin) || (n.push({ el: t, src: t.src }), t.src = C);
625
+ }), document.querySelectorAll("image").forEach((t) => {
626
+ const o = t, i = o.getAttribute("href"), a = o.getAttributeNS("http://www.w3.org/1999/xlink", "href"), s = i || a || "";
627
+ s && !F(s) && (e.push({ el: o, href: i, xlink: a }), i !== null && o.setAttribute("href", C), a !== null && o.setAttributeNS("http://www.w3.org/1999/xlink", "href", C));
628
+ }), () => {
629
+ for (const { el: t, src: o } of n)
630
+ t.src = o;
631
+ for (const { el: t, href: o, xlink: i } of e)
632
+ o !== null && t.setAttribute("href", o), i !== null && t.setAttributeNS("http://www.w3.org/1999/xlink", "href", i);
633
+ };
634
+ }
635
+ async function W(n = {}) {
636
+ const { quality: e = 0.7, pixelRatio: t = Math.min(window.devicePixelRatio || 1, 2), excludeShadowRoot: o } = n, i = await xe(), a = o ? (b) => {
637
+ let p = b;
638
+ for (; p; ) {
639
+ if (p === o.host || p instanceof Element && p.classList.contains("beacon-no-capture")) return !1;
640
+ p = p.parentNode;
641
+ }
642
+ return !0;
643
+ } : void 0, s = we();
644
+ try {
645
+ return await i.toJpeg(document.documentElement, {
646
+ quality: e,
647
+ pixelRatio: t,
648
+ cacheBust: !0,
649
+ ...a ? { filter: a } : {},
650
+ imagePlaceholder: C,
651
+ // Cap dimensions to viewport so we don't accidentally capture full document height.
652
+ width: window.innerWidth,
653
+ height: window.innerHeight,
654
+ style: {
655
+ // Avoid scrolling artifacts.
656
+ transform: "none"
657
+ }
658
+ });
659
+ } finally {
660
+ s();
661
+ }
662
+ }
663
+ const ye = 14, ke = "#ffffff", Ee = "#ffffff", Ae = 3, Se = "#0ea5e9";
664
+ async function U(n, e, t, o, i = Se) {
665
+ const a = i, s = i, b = await Le(n), p = document.createElement("canvas");
666
+ p.width = b.naturalWidth, p.height = b.naturalHeight;
667
+ const u = p.getContext("2d");
668
+ if (!u) throw new Error("Could not get 2D canvas context");
669
+ u.drawImage(b, 0, 0);
670
+ const h = p.width / t.w, f = p.height / t.h;
671
+ for (const v of e) {
672
+ const m = Ce(v, o);
673
+ if (!m) continue;
674
+ const x = m.x * h, w = m.y * f, g = m.w * h, r = m.h * f;
675
+ u.lineWidth = Ae, u.strokeStyle = s, u.strokeRect(x, w, g, r);
676
+ const d = x + g, c = w;
677
+ u.beginPath(), u.fillStyle = a, u.arc(d, c, ye, 0, Math.PI * 2), u.fill(), u.lineWidth = 3, u.strokeStyle = ke, u.stroke(), u.fillStyle = Ee, u.font = "bold 16px system-ui, -apple-system, sans-serif", u.textAlign = "center", u.textBaseline = "middle", u.fillText(String(v.number), d, c + 1);
678
+ }
679
+ return p.toDataURL("image/jpeg", 0.85);
680
+ }
681
+ function Ce(n, e) {
682
+ const t = e == null ? void 0 : e.get(n);
683
+ if (t && document.contains(t)) {
684
+ const o = t.getBoundingClientRect();
685
+ if (o.width > 0 || o.height > 0)
686
+ return { x: o.left, y: o.top, w: o.width, h: o.height };
687
+ }
688
+ if (n.selector)
689
+ try {
690
+ const o = document.querySelector(n.selector);
691
+ if (o) {
692
+ const i = o.getBoundingClientRect();
693
+ if (i.width > 0 || i.height > 0)
694
+ return { x: i.left, y: i.top, w: i.width, h: i.height };
695
+ }
696
+ } catch {
697
+ }
698
+ return n.boundingRect;
699
+ }
700
+ function Le(n) {
701
+ return new Promise((e, t) => {
702
+ const o = new Image();
703
+ o.onload = () => e(o), o.onerror = (i) => t(i), o.src = n;
704
+ });
705
+ }
706
+ async function Te(n, e, t) {
707
+ const o = await fetch(n, {
708
+ method: "POST",
709
+ credentials: "include",
710
+ headers: {
711
+ "Content-Type": "application/json",
712
+ ...t ?? {}
713
+ },
714
+ body: JSON.stringify(e)
715
+ });
716
+ let i = null;
717
+ if ((o.headers.get("Content-Type") ?? "").includes("application/json"))
718
+ try {
719
+ i = await o.json();
720
+ } catch {
721
+ i = null;
722
+ }
723
+ else
724
+ try {
725
+ i = await o.text();
726
+ } catch {
727
+ i = null;
728
+ }
729
+ return {
730
+ ok: o.ok,
731
+ status: o.status,
732
+ body: i
733
+ };
734
+ }
735
+ const $e = ["endpoint", "position", "theme", "severities"], q = "launch-kit-beacon-portal-styles";
736
+ function Re(n) {
737
+ if (document.getElementById(q)) return;
738
+ const e = document.createElement("style");
739
+ e.id = q, e.textContent = n, document.head.appendChild(e);
740
+ }
741
+ const Me = [
742
+ "--beacon-accent",
743
+ "--beacon-bg",
744
+ "--beacon-fg",
745
+ "--beacon-muted",
746
+ "--beacon-border",
747
+ "--beacon-radius",
748
+ "--beacon-shadow",
749
+ "--beacon-z-index",
750
+ "--beacon-bug",
751
+ "--beacon-idea",
752
+ "--beacon-ux",
753
+ "--beacon-a11y"
754
+ ], K = "#0ea5e9";
755
+ class Ne extends HTMLElement {
756
+ constructor() {
757
+ super(...arguments), this._config = null, this.pins = [], this.pinElements = /* @__PURE__ */ new WeakMap(), this.description = "", this.severity = "bug", this.submitSucceeded = !1;
758
+ }
759
+ static get observedAttributes() {
760
+ return $e;
761
+ }
762
+ /** Public — wrappers can set `widget.config = {...}` for dynamic endpoint/headers/context. */
763
+ set config(e) {
764
+ this._config = e;
765
+ }
766
+ get config() {
767
+ if (this._config) return this._config;
768
+ const e = this.getAttribute("endpoint");
769
+ return e ? { endpoint: e } : null;
770
+ }
771
+ connectedCallback() {
772
+ if (!this.shadow) {
773
+ this.shadow = this.attachShadow({ mode: "open" });
774
+ const e = document.createElement("style");
775
+ e.textContent = R, this.shadow.appendChild(e), this.slotEl = document.createElement("slot"), this.slotEl.name = "trigger", this.shadow.appendChild(this.slotEl), this.trigger = Y(), this.shadow.appendChild(this.trigger), this.trigger.addEventListener("click", () => this.open()), this.slotEl.addEventListener("slotchange", () => {
776
+ const t = this.slotEl.assignedElements();
777
+ t.length > 0 && (this.trigger && (this.trigger.style.display = "none"), t.forEach((o) => o.addEventListener("click", () => this.open())));
778
+ }), this.drawer = new G(this.parseSeverities(), {
779
+ onClose: () => this.close(),
780
+ onAnnotate: () => this.startAnnotate(),
781
+ onSubmit: () => this.handleSubmit(),
782
+ onPinNoteChange: (t, o) => this.updatePinNote(t, o),
783
+ onPinDelete: (t) => this.deletePin(t),
784
+ onDescriptionChange: (t) => {
785
+ this.description = t;
786
+ },
787
+ onSeverityChange: (t) => {
788
+ this.severity = t;
789
+ }
790
+ }), Re(R), this.drawer.root.classList.add("beacon-no-capture"), this.drawer.root.classList.add(`beacon-theme-${this.getAttribute("theme") ?? "auto"}`), document.body.appendChild(this.drawer.root);
791
+ }
792
+ this.hasAttribute("position") || this.setAttribute("position", "bottom-right"), this.hasAttribute("theme") || this.setAttribute("theme", "auto");
793
+ }
794
+ attributeChangedCallback(e, t, o) {
795
+ e === "severities" && this.drawer && console.warn("[launch-kit-beacon] severities attribute changed after mount; not yet hot-reloaded."), e === "theme" && this.drawer && t !== o && (this.drawer.root.classList.remove(`beacon-theme-${t ?? "auto"}`), this.drawer.root.classList.add(`beacon-theme-${o ?? "auto"}`));
796
+ }
797
+ // ── Public API ──────────────────────────────────────────
798
+ open() {
799
+ var e;
800
+ if (this.drawer) {
801
+ if (this.getAttribute("position") === "hidden") {
802
+ const t = (e = this.slotEl) == null ? void 0 : e.assignedElements()[0];
803
+ t && Ie(this.drawer.root, t);
804
+ }
805
+ this.submitSucceeded = !1, this.syncCustomProperties(), this.installClickBlocker(), this.drawer.open();
806
+ }
807
+ }
808
+ close() {
809
+ this.drawer && (!this.submitSucceeded && this.hasUnsavedData() && !window.confirm("You have unsaved feedback. Close and discard it?") || this.forceClose());
810
+ }
811
+ disconnectedCallback() {
812
+ this.uninstallClickBlocker(), this.drawer && this.drawer.root.parentNode && this.drawer.root.parentNode.removeChild(this.drawer.root);
813
+ }
814
+ async openWithPicker() {
815
+ this.open(), setTimeout(() => this.startAnnotate(), 0);
816
+ }
817
+ // ── Annotate flow ──────────────────────────────────────────
818
+ async startAnnotate() {
819
+ if (!this.drawer) return;
820
+ this.drawer.minimize();
821
+ const e = this.getAccentColor(), t = Q({ accent: e });
822
+ for (const o of this.pins) {
823
+ const i = this.pinElements.get(o);
824
+ i && t.addPin(o.number, {
825
+ target: i,
826
+ selector: o.selector,
827
+ fallbackRect: o.boundingRect
828
+ });
829
+ }
830
+ try {
831
+ let o = !0;
832
+ for (; o; ) {
833
+ const a = await ne({ shadowRoot: this.shadow, accent: e }).promise;
834
+ if (!a) break;
835
+ const s = a.getBoundingClientRect(), b = await Z({
836
+ shadowRoot: this.shadow,
837
+ anchor: { x: s.left, y: s.bottom },
838
+ pinNumber: this.pins.length + 1
839
+ });
840
+ if (b.cancelled === "all") break;
841
+ if (b.cancelled === "pin") continue;
842
+ const p = ve(a), u = {
843
+ number: this.pins.length + 1,
844
+ ...p,
845
+ ...b.note ? { note: b.note } : {}
846
+ };
847
+ this.pins.push(u), this.pinElements.set(u, a), t.addPin(u.number, {
848
+ target: a,
849
+ selector: p.selector,
850
+ fallbackRect: p.boundingRect
851
+ });
852
+ }
853
+ if (this.pins.length > 0) {
854
+ t.setLoading("Capturing screenshot…"), await new Promise((i) => requestAnimationFrame(() => i()));
855
+ try {
856
+ const i = H(), a = await W({ excludeShadowRoot: this.shadow }), s = await U(a, this.pins, i.viewport, this.pinElements, e);
857
+ this.drawer.setPins(this.pins, s);
858
+ } catch (i) {
859
+ const a = i instanceof Error ? i.message : String(i);
860
+ console.error("[launch-kit-beacon] screenshot capture failed:", i), this.drawer.setPins(this.pins), this.drawer.setStatus(`Screenshot capture failed: ${a}`, "error");
861
+ }
862
+ }
863
+ } finally {
864
+ t.destroy();
865
+ }
866
+ this.drawer.open();
867
+ }
868
+ updatePinNote(e, t) {
869
+ const o = this.pins.find((i) => i.number === e);
870
+ o && (t.trim() ? o.note = t : delete o.note);
871
+ }
872
+ deletePin(e) {
873
+ var t, o;
874
+ this.pins = this.pins.filter((i) => i.number !== e), this.pins.forEach((i, a) => {
875
+ i.number = a + 1;
876
+ }), (t = this.drawer) == null || t.setAnnotatedScreenshot(void 0), (o = this.drawer) == null || o.setPins(this.pins);
877
+ }
878
+ // ── Submit flow ──────────────────────────────────────────
879
+ async handleSubmit() {
880
+ if (!this.drawer) return;
881
+ const e = this.config;
882
+ if (!(e != null && e.endpoint)) {
883
+ this.drawer.setStatus("Missing endpoint configuration", "error");
884
+ return;
885
+ }
886
+ const t = this.drawer.getDescription().trim(), o = this.drawer.getSeverity();
887
+ if (!t) {
888
+ this.drawer.setStatus("Description is required", "error");
889
+ return;
890
+ }
891
+ this.drawer.setSubmitting(!0);
892
+ let i = this.drawer.getAnnotatedScreenshot();
893
+ const a = !i && this.pins.length > 0;
894
+ this.drawer.setStatus(a ? "Capturing screenshot…" : "Sending…"), await new Promise((h) => requestAnimationFrame(() => h()));
895
+ const s = H();
896
+ if (a)
897
+ try {
898
+ const h = await W({ excludeShadowRoot: this.shadow });
899
+ i = await U(h, this.pins, s.viewport, this.pinElements, this.getAccentColor());
900
+ } catch (h) {
901
+ console.error("[launch-kit-beacon] screenshot capture failed at submit:", h);
902
+ }
903
+ const b = {
904
+ description: t,
905
+ severity: o,
906
+ ...i ? { screenshot: { dataUrl: i, mime: "image/jpeg" } } : {},
907
+ metadata: s,
908
+ pins: this.pins,
909
+ ...this.resolveContext() ? { context: this.resolveContext() } : {}
910
+ }, p = new CustomEvent("beacon-before-submit", {
911
+ detail: { payload: b },
912
+ cancelable: !0,
913
+ bubbles: !0,
914
+ composed: !0
915
+ });
916
+ if (!this.dispatchEvent(p)) {
917
+ this.drawer.setSubmitting(!1), this.drawer.setStatus("Submission cancelled", "error");
918
+ return;
919
+ }
920
+ this.drawer.setStatus("Sending…");
921
+ try {
922
+ const h = this.resolveHeaders(), f = await Te(e.endpoint, b, h);
923
+ this.drawer.setSubmitting(!1), f.ok ? (this.submitSucceeded = !0, this.drawer.setStatus("Sent — thanks!", "success"), this.dispatchEvent(new CustomEvent("beacon-after-submit", {
924
+ detail: { response: f },
925
+ bubbles: !0,
926
+ composed: !0
927
+ })), setTimeout(() => {
928
+ this.forceClose();
929
+ }, 1500)) : this.drawer.setStatus(`Failed: ${f.status}`, "error");
930
+ } catch (h) {
931
+ this.drawer.setSubmitting(!1);
932
+ const f = h instanceof Error ? h.message : "Network error";
933
+ this.drawer.setStatus(`Failed: ${f}`, "error");
934
+ }
935
+ }
936
+ // ── Helpers ──────────────────────────────────────────
937
+ /**
938
+ * Resolved accent color — reads --beacon-accent from the host's computed style
939
+ * (which picks up any inline `style="--beacon-accent: …"` or stylesheet override
940
+ * targeting the host). Falls back to the default sky-blue if unset.
941
+ */
942
+ getAccentColor() {
943
+ return typeof window > "u" ? K : getComputedStyle(this).getPropertyValue("--beacon-accent").trim() || K;
944
+ }
945
+ /**
946
+ * Mirror every customizable --beacon-* var from the host onto the body-mounted
947
+ * drawer. CSS inheritance stops at the body boundary, so we copy the host's
948
+ * resolved values forward. Called on open() so changes mid-session are picked up.
949
+ */
950
+ syncCustomProperties() {
951
+ if (!this.drawer) return;
952
+ const e = getComputedStyle(this);
953
+ for (const t of Me) {
954
+ const o = e.getPropertyValue(t).trim();
955
+ o && this.drawer.root.style.setProperty(t, o);
956
+ }
957
+ }
958
+ hasUnsavedData() {
959
+ var t;
960
+ return this.pins.length > 0 ? !0 : (((t = this.drawer) == null ? void 0 : t.getDescription()) ?? "").trim().length > 0;
961
+ }
962
+ resetState() {
963
+ var e;
964
+ this.pins = [], this.description = "", this.severity = "bug", this.pinElements = /* @__PURE__ */ new WeakMap(), (e = this.drawer) == null || e.reset();
965
+ }
966
+ forceClose() {
967
+ var e;
968
+ this.uninstallClickBlocker(), this.resetState(), this.submitSucceeded = !1, (e = this.drawer) == null || e.close();
969
+ }
970
+ installClickBlocker() {
971
+ this.documentClickBlocker || (this.documentClickBlocker = (e) => {
972
+ const t = e.composedPath();
973
+ if (!t.includes(this.shadow.host)) {
974
+ for (const o of t)
975
+ if (o instanceof Element && o.classList.contains("beacon-no-capture")) return;
976
+ e.preventDefault(), e.stopPropagation();
977
+ }
978
+ }, document.addEventListener("click", this.documentClickBlocker, !0));
979
+ }
980
+ uninstallClickBlocker() {
981
+ this.documentClickBlocker && (document.removeEventListener("click", this.documentClickBlocker, !0), this.documentClickBlocker = void 0);
982
+ }
983
+ resolveHeaders() {
984
+ var t;
985
+ const e = (t = this.config) == null ? void 0 : t.headers;
986
+ if (e)
987
+ return typeof e == "function" ? e() : e;
988
+ }
989
+ resolveContext() {
990
+ var t;
991
+ const e = (t = this.config) == null ? void 0 : t.context;
992
+ if (e)
993
+ return typeof e == "function" ? e() : e;
994
+ }
995
+ parseSeverities() {
996
+ const e = this.getAttribute("severities");
997
+ return e ? e.split(",").map((t) => t.trim()).filter(Boolean) : ["bug", "idea", "ux", "a11y"];
998
+ }
999
+ }
1000
+ function _e(n = "launch-kit-beacon") {
1001
+ typeof window > "u" || customElements.get(n) || customElements.define(n, Ne);
1002
+ }
1003
+ const V = 380, y = 8, Pe = 520;
1004
+ function Ie(n, e) {
1005
+ const t = e.getBoundingClientRect(), o = window.innerWidth, i = window.innerHeight;
1006
+ let a = Math.max(y, o - t.right);
1007
+ o - a - V < y && (a = Math.max(y, o - V - y));
1008
+ const b = i - t.bottom - y, p = t.top - y;
1009
+ n.style.left = "auto", n.style.right = `${a}px`, b >= Pe || b >= p ? (n.style.top = `${t.bottom + y}px`, n.style.bottom = "auto") : (n.style.top = "auto", n.style.bottom = `${i - t.top + y}px`);
1010
+ }
1011
+ _e();
1012
+ export {
1013
+ Ne as LaunchKitBeacon,
1014
+ _e as defineBeacon
1015
+ };
1016
+ //# sourceMappingURL=beacon.mjs.map