@launchsecure/launch-kit 0.0.26 → 0.0.28

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 (123) hide show
  1. package/dist/beacon/beacon.mjs +1003 -440
  2. package/dist/beacon/beacon.mjs.map +1 -1
  3. package/dist/beacon/beacon.umd.js +45 -24
  4. package/dist/beacon/beacon.umd.js.map +1 -1
  5. package/dist/beacon/types/capture/events.d.ts +20 -0
  6. package/dist/beacon/types/capture/events.d.ts.map +1 -0
  7. package/dist/beacon/types/element.d.ts +1 -0
  8. package/dist/beacon/types/element.d.ts.map +1 -1
  9. package/dist/beacon/types/index.d.ts +2 -1
  10. package/dist/beacon/types/index.d.ts.map +1 -1
  11. package/dist/beacon/types/monitor/dom.d.ts +13 -0
  12. package/dist/beacon/types/monitor/dom.d.ts.map +1 -0
  13. package/dist/beacon/types/monitor/index.d.ts +19 -0
  14. package/dist/beacon/types/monitor/index.d.ts.map +1 -0
  15. package/dist/beacon/types/monitor/network.d.ts +12 -0
  16. package/dist/beacon/types/monitor/network.d.ts.map +1 -0
  17. package/dist/beacon/types/monitor/transport.d.ts +27 -0
  18. package/dist/beacon/types/monitor/transport.d.ts.map +1 -0
  19. package/dist/beacon/types/monitor/types.d.ts +117 -0
  20. package/dist/beacon/types/monitor/types.d.ts.map +1 -0
  21. package/dist/beacon/types/types.d.ts +10 -0
  22. package/dist/beacon/types/types.d.ts.map +1 -1
  23. package/dist/beacon/types/ui/drawer.d.ts +3 -1
  24. package/dist/beacon/types/ui/drawer.d.ts.map +1 -1
  25. package/dist/beacon/types/ui/monitor-panel.d.ts +19 -0
  26. package/dist/beacon/types/ui/monitor-panel.d.ts.map +1 -0
  27. package/dist/chart-client/assets/index-CJ4mgRRF.css +1 -0
  28. package/dist/chart-client/assets/{index-Bk1hawjD.js → index-Ccy-DpI-.js} +46 -42
  29. package/dist/chart-client/index.html +2 -2
  30. package/dist/client/assets/index-DI5qSR_w.css +32 -0
  31. package/dist/client/assets/index-Dp0_okva.js +294 -0
  32. package/dist/client/index.html +2 -2
  33. package/dist/council-client/assets/index-C_-vAM9L.css +1 -0
  34. package/dist/council-client/index.html +2 -2
  35. package/dist/deck-client/assets/{_baseUniq-C2xT_eYu.js → _baseUniq-W2JQDmje.js} +1 -1
  36. package/dist/deck-client/assets/{arc-CmVL9pGd.js → arc-DIBWAId9.js} +1 -1
  37. package/dist/deck-client/assets/{architectureDiagram-Q4EWVU46-BSFgdjve.js → architectureDiagram-Q4EWVU46-CAIRMvJK.js} +1 -1
  38. package/dist/deck-client/assets/{blockDiagram-DXYQGD6D-DuLzscvP.js → blockDiagram-DXYQGD6D-BeNaNiOi.js} +1 -1
  39. package/dist/deck-client/assets/{c4Diagram-AHTNJAMY-CfCJB8eY.js → c4Diagram-AHTNJAMY-B9Ozi62h.js} +1 -1
  40. package/dist/deck-client/assets/channel-CRdozqbp.js +1 -0
  41. package/dist/deck-client/assets/{chunk-4BX2VUAB-DxmLYTWZ.js → chunk-4BX2VUAB-D7AZ47dt.js} +1 -1
  42. package/dist/deck-client/assets/{chunk-4TB4RGXK-CCnf7GFE.js → chunk-4TB4RGXK-DnVnNPcI.js} +1 -1
  43. package/dist/deck-client/assets/{chunk-55IACEB6-Db9DApcj.js → chunk-55IACEB6-UKYs-YNd.js} +1 -1
  44. package/dist/deck-client/assets/{chunk-EDXVE4YY-DmYDq8ZI.js → chunk-EDXVE4YY-D43b-SKn.js} +1 -1
  45. package/dist/deck-client/assets/{chunk-FMBD7UC4-BGhUlF20.js → chunk-FMBD7UC4-QzBAoyyW.js} +1 -1
  46. package/dist/deck-client/assets/{chunk-OYMX7WX6-CpEnicQZ.js → chunk-OYMX7WX6-Cjif4r6W.js} +1 -1
  47. package/dist/deck-client/assets/{chunk-QZHKN3VN-Doa7LKwf.js → chunk-QZHKN3VN-CqLDirEI.js} +1 -1
  48. package/dist/deck-client/assets/{chunk-YZCP3GAM-CpkIlH6V.js → chunk-YZCP3GAM-_FQvmMs4.js} +1 -1
  49. package/dist/deck-client/assets/classDiagram-6PBFFD2Q-lIZMp57W.js +1 -0
  50. package/dist/deck-client/assets/classDiagram-v2-HSJHXN6E-lIZMp57W.js +1 -0
  51. package/dist/deck-client/assets/clone-BtWeSTyJ.js +1 -0
  52. package/dist/deck-client/assets/{cose-bilkent-S5V4N54A-Bkh8Bfcb.js → cose-bilkent-S5V4N54A-rfrocesE.js} +1 -1
  53. package/dist/deck-client/assets/{dagre-KV5264BT-Bp0XpTgH.js → dagre-KV5264BT-Bv_7DJat.js} +1 -1
  54. package/dist/deck-client/assets/{diagram-5BDNPKRD-ZHiyGYPQ.js → diagram-5BDNPKRD-4F1414G5.js} +1 -1
  55. package/dist/deck-client/assets/{diagram-G4DWMVQ6-BW-Q8_H5.js → diagram-G4DWMVQ6-C4-Pszqm.js} +1 -1
  56. package/dist/deck-client/assets/{diagram-MMDJMWI5-6I3LTafu.js → diagram-MMDJMWI5-B647TIx9.js} +1 -1
  57. package/dist/deck-client/assets/{diagram-TYMM5635-CyM5YK28.js → diagram-TYMM5635-BFAqpezd.js} +1 -1
  58. package/dist/deck-client/assets/{erDiagram-SMLLAGMA-CjNxVJHk.js → erDiagram-SMLLAGMA-BfBfrJOC.js} +1 -1
  59. package/dist/deck-client/assets/{flowDiagram-DWJPFMVM-BDQHuAJR.js → flowDiagram-DWJPFMVM-DX9YAYes.js} +1 -1
  60. package/dist/deck-client/assets/{ganttDiagram-T4ZO3ILL-B7MnkpbP.js → ganttDiagram-T4ZO3ILL-DCuiy7wF.js} +1 -1
  61. package/dist/deck-client/assets/{gitGraphDiagram-UUTBAWPF-C9dZAcYD.js → gitGraphDiagram-UUTBAWPF-CGp1IXUh.js} +1 -1
  62. package/dist/deck-client/assets/{graph-CjdBnzUy.js → graph-B7g8aoxv.js} +1 -1
  63. package/dist/deck-client/assets/{index-DeIVPW63.js → index-Dg1r-WSN.js} +3 -3
  64. package/dist/deck-client/assets/index-DsIZ3LqL.css +1 -0
  65. package/dist/deck-client/assets/{infoDiagram-42DDH7IO-C7d3iRC3.js → infoDiagram-42DDH7IO-L3fahMkF.js} +1 -1
  66. package/dist/deck-client/assets/{ishikawaDiagram-UXIWVN3A-BcYGKj09.js → ishikawaDiagram-UXIWVN3A-aS_EjWBZ.js} +1 -1
  67. package/dist/deck-client/assets/{journeyDiagram-VCZTEJTY-DqFlRrOL.js → journeyDiagram-VCZTEJTY-djTSQZF9.js} +1 -1
  68. package/dist/deck-client/assets/{kanban-definition-6JOO6SKY-BJhPp1NR.js → kanban-definition-6JOO6SKY-CcTHo4CM.js} +1 -1
  69. package/dist/deck-client/assets/{layout-DIeS6GvK.js → layout-mEJiadb7.js} +1 -1
  70. package/dist/deck-client/assets/{linear-He_yJy5H.js → linear-XgTKqyRu.js} +1 -1
  71. package/dist/deck-client/assets/{min-DQ6Kx06t.js → min-Ct9jZdpd.js} +1 -1
  72. package/dist/deck-client/assets/{mindmap-definition-QFDTVHPH-sQ62L8T2.js → mindmap-definition-QFDTVHPH-BaFxCGNU.js} +1 -1
  73. package/dist/deck-client/assets/{pieDiagram-DEJITSTG-BqCWmU2K.js → pieDiagram-DEJITSTG-CIbYYjtw.js} +1 -1
  74. package/dist/deck-client/assets/{quadrantDiagram-34T5L4WZ-rQ1TJOoe.js → quadrantDiagram-34T5L4WZ-D9EtCOvh.js} +1 -1
  75. package/dist/deck-client/assets/{requirementDiagram-MS252O5E-BO2MPBOM.js → requirementDiagram-MS252O5E-xeni9eVG.js} +1 -1
  76. package/dist/deck-client/assets/{sankeyDiagram-XADWPNL6-BgsHEVex.js → sankeyDiagram-XADWPNL6-LYeknz9h.js} +1 -1
  77. package/dist/deck-client/assets/{sequenceDiagram-FGHM5R23-B3j1yMLU.js → sequenceDiagram-FGHM5R23-RDbsKFZf.js} +1 -1
  78. package/dist/deck-client/assets/{stateDiagram-FHFEXIEX-C8jFlZou.js → stateDiagram-FHFEXIEX-BH1Zjglk.js} +1 -1
  79. package/dist/deck-client/assets/stateDiagram-v2-QKLJ7IA2-BrV78NDR.js +1 -0
  80. package/dist/deck-client/assets/{timeline-definition-GMOUNBTQ-tM-qo4Zk.js → timeline-definition-GMOUNBTQ-IFXxKptt.js} +1 -1
  81. package/dist/deck-client/assets/{vennDiagram-DHZGUBPP-B0-6kOEu.js → vennDiagram-DHZGUBPP-D-sLkQs9.js} +1 -1
  82. package/dist/deck-client/assets/{wardley-RL74JXVD-HpBk07P-.js → wardley-RL74JXVD-C010F8l4.js} +1 -1
  83. package/dist/deck-client/assets/{wardleyDiagram-NUSXRM2D-BkA1NLDE.js → wardleyDiagram-NUSXRM2D-BTjjuDU3.js} +1 -1
  84. package/dist/deck-client/assets/{xychartDiagram-5P7HB3ND-CEKGSuI-.js → xychartDiagram-5P7HB3ND-AYbv92n-.js} +1 -1
  85. package/dist/deck-client/index.html +2 -2
  86. package/dist/server/beacon-monitor-entry.js +353 -0
  87. package/dist/server/chart-serve.js +3836 -3750
  88. package/dist/server/cli.js +8789 -8219
  89. package/dist/server/council-entry.js +17 -5
  90. package/dist/server/council-serve.js +8 -3
  91. package/dist/server/course-entry.js +246 -0
  92. package/dist/server/deck-mcp-entry.js +24 -12
  93. package/dist/server/deck-serve.js +11 -8
  94. package/dist/server/graph-mcp-entry.js +5005 -4865
  95. package/dist/server/init-entry.js +939 -0
  96. package/dist/server/orbit-entry.js +2435 -0
  97. package/dist/server/parse-worker-entry.js +4721 -0
  98. package/dist/server/recall-entry.js +356 -18
  99. package/package.json +11 -4
  100. package/scaffolds/ls-marketplace/.claude-plugin/marketplace.json +15 -0
  101. package/scaffolds/ls-marketplace/plugins/ls/.claude-plugin/plugin.json +28 -0
  102. package/scaffolds/ls-marketplace/plugins/ls/commands/activate-beacon.md +216 -0
  103. package/scaffolds/ls-marketplace/plugins/ls/commands/beacon-array.md +92 -0
  104. package/scaffolds/ls-marketplace/plugins/ls/commands/beacon-clear.md +68 -0
  105. package/scaffolds/ls-marketplace/plugins/ls/commands/beacon-pulse.md +80 -0
  106. package/scaffolds/ls-marketplace/plugins/ls/commands/beacon-scan.md +62 -0
  107. package/scaffolds/ls-marketplace/plugins/ls/commands/show-mcp-status.md +109 -0
  108. package/scaffolds/ls-marketplace/plugins/ls/commands/standup.md +177 -0
  109. package/scaffolds/migrate-safety/.github/workflows/backup-on-migration.yml +72 -0
  110. package/scaffolds/migrate-safety/docs/migrations-runbook.md +172 -0
  111. package/scaffolds/migrate-safety/scripts/migrate-with-backup.sh +294 -0
  112. package/scaffolds/recall-hook/scripts/ensure-recall.sh +69 -0
  113. package/dist/chart-client/assets/index-DpaGa3bY.css +0 -1
  114. package/dist/client/assets/index-Bfel4OQ5.css +0 -32
  115. package/dist/client/assets/index-eC-WuUWB.js +0 -291
  116. package/dist/council-client/assets/index-P5kMsT5a.css +0 -1
  117. package/dist/deck-client/assets/channel-B4aNO8ZB.js +0 -1
  118. package/dist/deck-client/assets/classDiagram-6PBFFD2Q-BHTI0yWz.js +0 -1
  119. package/dist/deck-client/assets/classDiagram-v2-HSJHXN6E-BHTI0yWz.js +0 -1
  120. package/dist/deck-client/assets/clone-HduFm7qU.js +0 -1
  121. package/dist/deck-client/assets/index-LKZDAS9S.css +0 -1
  122. package/dist/deck-client/assets/stateDiagram-v2-QKLJ7IA2-BoqepHW0.js +0 -1
  123. /package/dist/council-client/assets/{index-Cs_MVXHf.js → index-Dt4zWKSj.js} +0 -0
@@ -1,4 +1,4 @@
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 = {
1
+ const V = '.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-events{font-size:12px;border:1px solid var(--beacon-border);border-radius:6px;padding:6px 8px}.beacon-events-summary{cursor:pointer;list-style:none;display:flex;align-items:center;gap:6px;color:var(--beacon-muted);-webkit-user-select:none;-moz-user-select:none;user-select:none}.beacon-events-summary::-webkit-details-marker{display:none}.beacon-events-dot{color:var(--beacon-bug);font-size:10px;line-height:1}.beacon-events-list{list-style:none;margin:8px 0 0;padding:0;display:flex;flex-direction:column;gap:4px;max-height:160px;overflow-y:auto}.beacon-events-item{display:flex;align-items:flex-start;gap:6px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11px;line-height:1.4}.beacon-events-kind{flex-shrink:0;padding:1px 5px;border-radius:3px;font-size:10px;text-transform:uppercase;letter-spacing:.04em}.beacon-events-kind.error{background:#eb141426;color:var(--beacon-bug)}.beacon-events-kind.rejection{background:#f59f0a26;color:#f59f0a}.beacon-events-msg{word-break:break-word;color:var(--beacon-fg)}.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
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
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
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>',
@@ -6,22 +6,23 @@ const R = '.beacon-drawer,.beacon-pin-popover{--beacon-accent: #0ea5e9;--beacon-
6
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
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
8
  };
9
- function Y(n = "Feedback") {
9
+ function ke(t = "Feedback") {
10
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;
11
+ return e.type = "button", e.className = "beacon-default-trigger", e.setAttribute("aria-label", t), e.innerHTML = `${k.feedback}<span>${t}</span>`, e;
12
12
  }
13
- const X = ["bug", "idea", "ux", "a11y"];
14
- class G {
15
- constructor(e, t) {
13
+ const Ae = ["bug", "idea", "ux", "a11y"];
14
+ class Ce {
15
+ constructor(e, n) {
16
16
  this.state = {
17
17
  description: "",
18
18
  severity: "bug",
19
19
  pins: [],
20
+ events: [],
20
21
  annotatedScreenshot: void 0,
21
22
  submitting: !1,
22
23
  status: "",
23
24
  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
+ }, this.severities = e.length > 0 ? e : Ae, this.callbacks = n, this.root = document.createElement("div"), this.root.className = "beacon-drawer", this.root.innerHTML = `
25
26
  <div class="beacon-drawer-header">
26
27
  <div class="beacon-drawer-title">Send feedback</div>
27
28
  <button type="button" class="beacon-icon-btn" data-action="close" aria-label="Close">${k.close}</button>
@@ -38,8 +39,38 @@ class G {
38
39
  minimize() {
39
40
  this.root.classList.add("minimized"), this.root.classList.remove("open");
40
41
  }
41
- setPins(e, t) {
42
- this.state.pins = e, t !== void 0 && (this.state.annotatedScreenshot = t), this.render();
42
+ setPins(e, n) {
43
+ this.state.pins = e, n !== void 0 && (this.state.annotatedScreenshot = n), this.render();
44
+ }
45
+ // Push the latest events buffer into the drawer. element.ts calls this both
46
+ // on open() (initial snapshot) AND from a subscriber so the chip ticks up
47
+ // live as errors fire. We partial-update the chip element only — a full
48
+ // re-render of bodyEl would blow away the textarea's focus + cursor while
49
+ // the user is typing, which is much worse than the chip never animating.
50
+ setEvents(e) {
51
+ this.state.events = e, this.updateEventsChip();
52
+ }
53
+ updateEventsChip() {
54
+ const e = this.bodyEl.querySelector(".beacon-events");
55
+ if (!e) {
56
+ this.render();
57
+ return;
58
+ }
59
+ const n = this.state.events.length;
60
+ if (n === 0) {
61
+ e.hidden = !0;
62
+ return;
63
+ }
64
+ e.hidden = !1, e.dataset.count = String(n);
65
+ const o = e.querySelector(".beacon-events-label");
66
+ o && (o.textContent = `${n} runtime ${n === 1 ? "error" : "errors"} will be included`);
67
+ const s = e.querySelector(".beacon-events-list");
68
+ s && (s.innerHTML = this.state.events.map((i) => `
69
+ <li class="beacon-events-item">
70
+ <span class="beacon-events-kind ${i.kind === "unhandledrejection" ? "rejection" : "error"}">${i.kind === "unhandledrejection" ? "rejection" : "error"}</span>
71
+ <span class="beacon-events-msg">${S(i.message)}</span>
72
+ </li>
73
+ `).join(""));
43
74
  }
44
75
  getAnnotatedScreenshot() {
45
76
  return this.state.annotatedScreenshot;
@@ -50,14 +81,15 @@ class G {
50
81
  setSubmitting(e) {
51
82
  this.state.submitting = e, this.render();
52
83
  }
53
- setStatus(e, t = "") {
54
- this.state.status = e, this.state.statusKind = t, this.render();
84
+ setStatus(e, n = "") {
85
+ this.state.status = e, this.state.statusKind = n, this.render();
55
86
  }
56
87
  reset() {
57
88
  this.state = {
58
89
  description: "",
59
90
  severity: "bug",
60
91
  pins: [],
92
+ events: [],
61
93
  annotatedScreenshot: void 0,
62
94
  submitting: !1,
63
95
  status: "",
@@ -71,21 +103,21 @@ class G {
71
103
  return this.state.severity;
72
104
  }
73
105
  render() {
74
- var o, i;
106
+ var o, s;
75
107
  const e = this.state.description.trim().length > 0 && !this.state.submitting;
76
108
  this.bodyEl.innerHTML = `
77
109
  <div class="beacon-field">
78
110
  <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>
111
+ <textarea id="beacon-desc" class="beacon-textarea" placeholder="Describe what you saw, what you expected, anything that helps reproduce…">${S(this.state.description)}</textarea>
80
112
  </div>
81
113
 
82
114
  <div class="beacon-field">
83
115
  <span class="beacon-label">Severity</span>
84
116
  <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}
117
+ ${this.severities.map((i) => `
118
+ <label class="beacon-severity-opt ${i === this.state.severity ? "selected" : ""}" data-sev="${i}">
119
+ <input type="radio" name="beacon-severity" value="${i}" ${i === this.state.severity ? "checked" : ""}>
120
+ ${i}
89
121
  </label>
90
122
  `).join("")}
91
123
  </div>
@@ -102,20 +134,35 @@ class G {
102
134
  <div class="beacon-field">
103
135
  <span class="beacon-label">Pins (${this.state.pins.length})</span>
104
136
  <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>
137
+ ${this.state.pins.map((i) => `
138
+ <div class="beacon-pin-item" data-pin="${i.number}">
139
+ <span class="beacon-pin-num">${i.number}</span>
108
140
  <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 ?? "")}">
141
+ <div class="beacon-pin-selector" title="${S(i.selector)}">${S(i.selector)}</div>
142
+ <input type="text" class="beacon-pin-note-input" placeholder="Add a note (optional)" value="${S(i.note ?? "")}">
111
143
  </div>
112
- <button type="button" class="beacon-icon-btn" data-pin-delete="${a.number}" aria-label="Remove pin ${a.number}">${k.trash}</button>
144
+ <button type="button" class="beacon-icon-btn" data-pin-delete="${i.number}" aria-label="Remove pin ${i.number}">${k.trash}</button>
113
145
  </div>
114
146
  `).join("")}
115
147
  </div>
116
148
  </div>
117
149
  ` : ""}
118
150
 
151
+ <details class="beacon-events" data-count="${this.state.events.length}" ${this.state.events.length === 0 ? "hidden" : ""}>
152
+ <summary class="beacon-events-summary">
153
+ <span class="beacon-events-dot" aria-hidden="true">●</span>
154
+ <span class="beacon-events-label">${this.state.events.length} runtime ${this.state.events.length === 1 ? "error" : "errors"} will be included</span>
155
+ </summary>
156
+ <ul class="beacon-events-list">
157
+ ${this.state.events.map((i) => `
158
+ <li class="beacon-events-item">
159
+ <span class="beacon-events-kind ${i.kind === "unhandledrejection" ? "rejection" : "error"}">${i.kind === "unhandledrejection" ? "rejection" : "error"}</span>
160
+ <span class="beacon-events-msg">${S(i.message)}</span>
161
+ </li>
162
+ `).join("")}
163
+ </ul>
164
+ </details>
165
+
119
166
  <div class="beacon-actions">
120
167
  <button type="button" class="beacon-btn secondary" data-action="annotate" ${this.state.submitting ? "disabled" : ""}>
121
168
  ${k.pin} ${this.state.pins.length > 0 ? "Add another pin" : "Annotate elements"}
@@ -126,38 +173,38 @@ class G {
126
173
  </button>
127
174
  </div>
128
175
 
129
- ${this.state.status ? `<div class="beacon-status ${this.state.statusKind}">${E(this.state.status)}</div>` : ""}
176
+ ${this.state.status ? `<div class="beacon-status ${this.state.statusKind}">${S(this.state.status)}</div>` : ""}
130
177
  `;
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());
178
+ const n = this.bodyEl.querySelector("#beacon-desc");
179
+ n.addEventListener("input", () => {
180
+ this.state.description = n.value, this.callbacks.onDescriptionChange(n.value);
181
+ const i = this.bodyEl.querySelector('[data-action="submit"]');
182
+ i && (i.disabled = !(n.value.trim().length > 0) || this.state.submitting);
183
+ }), this.bodyEl.querySelectorAll('input[name="beacon-severity"]').forEach((i) => {
184
+ i.addEventListener("change", () => {
185
+ i.checked && (this.state.severity = i.value, this.callbacks.onSeverityChange(this.state.severity), this.render());
139
186
  });
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);
187
+ }), (o = this.bodyEl.querySelector('[data-action="annotate"]')) == null || o.addEventListener("click", () => this.callbacks.onAnnotate()), (s = this.bodyEl.querySelector('[data-action="submit"]')) == null || s.addEventListener("click", () => this.callbacks.onSubmit()), this.bodyEl.querySelectorAll("[data-pin-delete]").forEach((i) => {
188
+ i.addEventListener("click", () => {
189
+ const r = Number(i.getAttribute("data-pin-delete"));
190
+ this.callbacks.onPinDelete(r);
144
191
  });
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));
192
+ }), this.bodyEl.querySelectorAll(".beacon-pin-note-input").forEach((i) => {
193
+ const r = i.closest("[data-pin]"), l = Number((r == null ? void 0 : r.getAttribute("data-pin")) ?? 0);
194
+ i.addEventListener("input", () => this.callbacks.onPinNoteChange(l, i.value));
148
195
  });
149
196
  }
150
197
  }
151
- function E(n) {
152
- return n.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
198
+ function S(t) {
199
+ return t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
153
200
  }
154
- function Z(n) {
201
+ function Le(t) {
155
202
  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 = `
203
+ const n = document.createElement("div");
204
+ n.className = "beacon-pin-popover open beacon-no-capture beacon-theme-auto", n.innerHTML = `
158
205
  <div class="beacon-pin-popover-header">
159
206
  <div style="display:flex;align-items:center;gap:6px;font-weight:600;font-size:13px;">
160
- <span class="beacon-pin-num">${n.pinNumber}</span>
207
+ <span class="beacon-pin-num">${t.pinNumber}</span>
161
208
  <span>Note for this pin</span>
162
209
  </div>
163
210
  <button type="button" class="beacon-icon-btn" data-action="cancel" aria-label="Discard this pin">${k.close}</button>
@@ -167,52 +214,52 @@ function Z(n) {
167
214
  <button type="button" class="beacon-btn primary" data-action="save">${k.check} Save</button>
168
215
  </div>
169
216
  `;
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 });
217
+ const o = 240, s = 160, i = Math.min(Math.max(8, t.anchor.x), window.innerWidth - o - 8), r = Math.min(Math.max(8, t.anchor.y + 12), window.innerHeight - s - 8);
218
+ n.style.left = `${i}px`, n.style.top = `${r}px`, document.body.appendChild(n);
219
+ const l = n.querySelector("textarea");
220
+ l.focus();
221
+ function a(d) {
222
+ document.removeEventListener("keydown", c, !0), n.remove(), e(d);
223
+ }
224
+ function c(d) {
225
+ d.key === "Escape" && (d.preventDefault(), d.stopPropagation(), a({ cancelled: "all" }));
226
+ }
227
+ document.addEventListener("keydown", c, !0), n.addEventListener("click", (d) => {
228
+ var y;
229
+ const g = (y = d.target.closest("[data-action]")) == null ? void 0 : y.getAttribute("data-action");
230
+ if (g === "cancel" && a({ cancelled: "pin" }), g === "save") {
231
+ const w = l.value.trim();
232
+ a({ ...w ? { note: w } : {}, cancelled: !1 });
186
233
  }
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 });
234
+ }), l.addEventListener("keydown", (d) => {
235
+ if (d.key === "Enter" && (d.metaKey || d.ctrlKey)) {
236
+ d.preventDefault();
237
+ const u = l.value.trim();
238
+ a({ ...u ? { note: u } : {}, cancelled: !1 });
192
239
  }
193
240
  });
194
241
  });
195
242
  }
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;
243
+ const A = "beacon-no-capture", Te = "#0ea5e9", K = "Click any element to pin it · Press Esc to finish";
244
+ function X(t, e) {
245
+ return /^#[0-9a-fA-F]{6}$/.test(t) ? `${t}${e}` : t;
199
246
  }
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 = [
247
+ function Me(t = {}) {
248
+ const e = t.accent ?? Te, n = X(e, "b3"), o = X(e, "2e"), s = document.createElement("style");
249
+ s.className = A, s.textContent = "@keyframes beacon-spin { to { transform: rotate(360deg); } }", document.head.appendChild(s);
250
+ const i = document.createElement("div");
251
+ i.className = A, i.setAttribute("aria-hidden", "true"), i.style.cssText = [
205
252
  "position: fixed",
206
253
  "inset: 0",
207
254
  "pointer-events: none",
208
255
  "z-index: 2147483646",
209
- `border: 2px dashed ${t}`,
256
+ `border: 2px dashed ${n}`,
210
257
  "border-radius: 4px",
211
258
  `box-shadow: inset 0 0 56px ${o}`,
212
259
  "box-sizing: border-box"
213
260
  ].join("; ");
214
- const s = document.createElement("div");
215
- s.className = A, s.setAttribute("role", "status"), s.style.cssText = [
261
+ const r = document.createElement("div");
262
+ r.className = A, r.setAttribute("role", "status"), r.style.cssText = [
216
263
  "position: fixed",
217
264
  "top: 16px",
218
265
  "left: 50%",
@@ -227,8 +274,8 @@ function Q(n = {}) {
227
274
  "pointer-events: none",
228
275
  "white-space: nowrap",
229
276
  "z-index: 2147483646"
230
- ].join("; "), s.textContent = M;
231
- const b = `<span style="
277
+ ].join("; "), r.textContent = K;
278
+ const l = `<span style="
232
279
  display: inline-block;
233
280
  width: 12px;
234
281
  height: 12px;
@@ -239,14 +286,14 @@ function Q(n = {}) {
239
286
  vertical-align: middle;
240
287
  margin-right: 8px;
241
288
  "></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 = [
289
+ function a(h) {
290
+ return h.replace(/[<>&]/g, (f) => ({ "<": "&lt;", ">": "&gt;", "&": "&amp;" })[f]);
291
+ }
292
+ document.body.appendChild(i), document.body.appendChild(r);
293
+ const c = /* @__PURE__ */ new Map();
294
+ function d(h) {
295
+ const f = document.createElement("div");
296
+ return f.className = A, f.setAttribute("aria-hidden", "true"), f.style.cssText = [
250
297
  "position: fixed",
251
298
  "width: 24px",
252
299
  "height: 24px",
@@ -261,11 +308,11 @@ function Q(n = {}) {
261
308
  "box-shadow: 0 2px 8px #00000066",
262
309
  "pointer-events: none",
263
310
  "z-index: 2147483646"
264
- ].join("; "), d.textContent = String(r), document.body.appendChild(d), d;
311
+ ].join("; "), f.textContent = String(h), document.body.appendChild(f), f;
265
312
  }
266
- function f() {
267
- const r = document.createElement("div");
268
- return r.className = A, r.setAttribute("aria-hidden", "true"), r.style.cssText = [
313
+ function u() {
314
+ const h = document.createElement("div");
315
+ return h.className = A, h.setAttribute("aria-hidden", "true"), h.style.cssText = [
269
316
  "position: fixed",
270
317
  "pointer-events: none",
271
318
  `border: 2px solid ${e}`,
@@ -273,72 +320,72 @@ function Q(n = {}) {
273
320
  "box-sizing: border-box",
274
321
  // Slightly below marker z so the marker visually "sits on" the outline corner.
275
322
  "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);
323
+ ].join("; "), document.body.appendChild(h), h;
324
+ }
325
+ function g(h, f, p) {
326
+ const b = p ? "0.5" : "1";
327
+ h.outline.style.display = "block", h.outline.style.opacity = b, h.outline.style.left = `${f.x}px`, h.outline.style.top = `${f.y}px`, h.outline.style.width = `${f.w}px`, h.outline.style.height = `${f.h}px`, h.marker.style.display = "flex", h.marker.style.opacity = b, h.marker.style.left = `${f.x + f.w - 12}px`, h.marker.style.top = `${Math.max(2, f.y - 12)}px`;
328
+ }
329
+ function y(h) {
330
+ h.marker.style.display = "none", h.outline.style.display = "none";
331
+ }
332
+ function w() {
333
+ c.forEach((h) => {
334
+ let f = h.anchor.target;
335
+ if (document.contains(f) || (f = null), !f && h.anchor.selector && (f = document.querySelector(h.anchor.selector), f && (h.anchor.target = f)), f) {
336
+ const b = f.getBoundingClientRect();
337
+ if (b.width > 0 || b.height > 0) {
338
+ g(h, { x: b.left, y: b.top, w: b.width, h: b.height }, !1);
292
339
  return;
293
340
  }
294
341
  }
295
- const c = r.anchor.fallbackRect;
296
- if (c && (c.w > 0 || c.h > 0)) {
297
- v(r, c, !0);
342
+ const p = h.anchor.fallbackRect;
343
+ if (p && (p.w > 0 || p.h > 0)) {
344
+ g(h, p, !0);
298
345
  return;
299
346
  }
300
- m(r);
347
+ y(h);
301
348
  });
302
349
  }
303
- let w = null;
304
- function g() {
305
- w === null && (w = requestAnimationFrame(() => {
306
- w = null, x();
350
+ let x = null;
351
+ function v() {
352
+ x === null && (x = requestAnimationFrame(() => {
353
+ x = null, w();
307
354
  }));
308
355
  }
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();
356
+ return window.addEventListener("scroll", v, !0), window.addEventListener("resize", v), {
357
+ addPin(h, f) {
358
+ const p = d(h), b = u();
359
+ c.set(h, { anchor: f, marker: p, outline: b }), w();
313
360
  },
314
- setLoading(r) {
315
- r ? s.innerHTML = b + p(r) : s.textContent = M;
361
+ setLoading(h) {
362
+ h ? r.innerHTML = l + a(h) : r.textContent = K;
316
363
  },
317
364
  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();
365
+ window.removeEventListener("scroll", v, !0), window.removeEventListener("resize", v), x !== null && cancelAnimationFrame(x), i.remove(), r.remove(), s.remove(), c.forEach(({ marker: h, outline: f }) => {
366
+ h.remove(), f.remove();
367
+ }), c.clear();
321
368
  }
322
369
  };
323
370
  }
324
- const ee = "#0ea5e9";
325
- function te(n, e) {
326
- return /^#[0-9a-fA-F]{6}$/.test(n) ? `${n}${e}` : n;
371
+ const Ie = "#0ea5e9";
372
+ function _e(t, e) {
373
+ return /^#[0-9a-fA-F]{6}$/.test(t) ? `${t}${e}` : t;
327
374
  }
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 = [
375
+ function $e(t) {
376
+ const { shadowRoot: e, onHover: n } = t, o = t.accent ?? Ie, s = _e(o, "14"), i = document.createElement("div");
377
+ i.style.cssText = [
331
378
  "position: fixed",
332
379
  "pointer-events: none",
333
380
  "z-index: 2147483646",
334
381
  `border: 2px solid ${o}`,
335
- `background: ${i}`,
382
+ `background: ${s}`,
336
383
  "transition: all 60ms ease-out",
337
384
  "box-sizing: border-box",
338
385
  "border-radius: 2px"
339
- ].join("; "), document.body.appendChild(a);
340
- const s = document.createElement("div");
341
- s.style.cssText = [
386
+ ].join("; "), document.body.appendChild(i);
387
+ const r = document.createElement("div");
388
+ r.style.cssText = [
342
389
  "position: fixed",
343
390
  "pointer-events: none",
344
391
  "z-index: 2147483647",
@@ -351,152 +398,152 @@ function ne(n) {
351
398
  "overflow: hidden",
352
399
  "text-overflow: ellipsis",
353
400
  "white-space: nowrap"
354
- ].join("; "), document.body.appendChild(s);
355
- const b = document.body.style.cursor;
401
+ ].join("; "), document.body.appendChild(r);
402
+ const l = document.body.style.cursor;
356
403
  document.body.style.cursor = "crosshair";
357
- let p = !1, u = () => {
404
+ let a = !1, c = () => {
358
405
  };
359
- const h = new Promise((c) => {
360
- u = c;
406
+ const d = new Promise((p) => {
407
+ c = p;
361
408
  });
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;
409
+ function u(p) {
410
+ if (!p || !(p instanceof Node)) return !1;
411
+ let b = p;
412
+ for (; b; ) {
413
+ if (b === e || b === e.host) return !0;
414
+ b = b.parentNode ?? b.host ?? null;
368
415
  }
369
416
  return !1;
370
417
  }
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;
418
+ function g(p, b) {
419
+ i.style.display = "none", r.style.display = "none";
420
+ const N = document.elementsFromPoint(p, b);
421
+ i.style.display = "block", r.style.display = "block";
422
+ for (const I of N)
423
+ if (!u(I)) return I;
377
424
  return null;
378
425
  }
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`;
426
+ function y(p) {
427
+ const b = p.getBoundingClientRect();
428
+ i.style.left = `${b.left}px`, i.style.top = `${b.top}px`, i.style.width = `${b.width}px`, i.style.height = `${b.height}px`;
429
+ const N = p.tagName.toLowerCase(), I = p.classList.length > 0 ? "." + Array.from(p.classList).slice(0, 2).join(".") : "";
430
+ r.textContent = N + I;
431
+ const W = b.top - 22;
432
+ r.style.left = `${b.left}px`, r.style.top = `${W >= 0 ? W : b.bottom + 4}px`;
386
433
  }
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));
434
+ function w(p) {
435
+ const b = g(p.clientX, p.clientY);
436
+ b ? (y(b), n == null || n(b)) : (i.style.display = "none", r.style.display = "none", n == null || n(null));
390
437
  }
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);
438
+ function x(p) {
439
+ if (p.button !== 0) return;
440
+ p.preventDefault(), p.stopPropagation();
441
+ const b = g(p.clientX, p.clientY);
442
+ b && f(b);
396
443
  }
397
- function g(c) {
398
- c.preventDefault(), c.stopPropagation();
444
+ function v(p) {
445
+ p.preventDefault(), p.stopPropagation();
399
446
  }
400
- function r(c) {
401
- c.key === "Escape" && (c.preventDefault(), d(null));
447
+ function h(p) {
448
+ p.key === "Escape" && (p.preventDefault(), f(null));
402
449
  }
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));
450
+ function f(p) {
451
+ a || (a = !0, document.removeEventListener("mousemove", w, !0), document.removeEventListener("pointerdown", x, !0), document.removeEventListener("click", v, !0), document.removeEventListener("mouseup", v, !0), document.removeEventListener("keydown", h, !0), i.remove(), r.remove(), document.body.style.cursor = l, c(p));
405
452
  }
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
453
+ return document.addEventListener("mousemove", w, !0), document.addEventListener("pointerdown", x, !0), document.addEventListener("click", v, !0), document.addEventListener("mouseup", v, !0), document.addEventListener("keydown", h, !0), {
454
+ cancel: () => f(null),
455
+ promise: d
409
456
  };
410
457
  }
411
- const oe = 8;
412
- function _(n, e = document) {
413
- if (!n) return !1;
458
+ const Ne = 8;
459
+ function Y(t, e = document) {
460
+ if (!t) return !1;
414
461
  try {
415
- return e.querySelectorAll(`#${CSS.escape(n)}`).length === 1;
462
+ return e.querySelectorAll(`#${CSS.escape(t)}`).length === 1;
416
463
  } catch {
417
464
  return !1;
418
465
  }
419
466
  }
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;
467
+ function Re(t) {
468
+ const e = t.tagName.toLowerCase(), n = Array.from(t.classList).filter((o) => o.length > 0 && o.length < 40).slice(0, 3).map((o) => `.${CSS.escape(o)}`).join("");
469
+ return e + n;
423
470
  }
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;
471
+ function Pe(t) {
472
+ const e = t.parentElement;
473
+ return e ? Array.from(e.children).filter((o) => o.tagName === t.tagName).indexOf(t) + 1 : 1;
427
474
  }
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)}`;
475
+ function De(t) {
476
+ if (!t || t.nodeType !== Node.ELEMENT_NODE) return "";
477
+ if (t.id && Y(t.id))
478
+ return `#${CSS.escape(t.id)}`;
432
479
  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)}`);
480
+ let n = t, o = 0;
481
+ for (; n && n.tagName.toLowerCase() !== "body" && o < Ne; ) {
482
+ const s = n;
483
+ if (s.id && Y(s.id)) {
484
+ e.unshift(`#${CSS.escape(s.id)}`);
438
485
  break;
439
486
  }
440
- const a = ie(i), s = i.parentElement;
441
- let b = a;
442
- if (s)
487
+ const i = Re(s), r = s.parentElement;
488
+ let l = i;
489
+ if (r)
443
490
  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)})`);
491
+ const a = Array.from(s.classList).join(" ");
492
+ Array.from(r.children).filter(
493
+ (d) => d.tagName === s.tagName && Array.from(d.classList).join(" ") === a
494
+ ).length > 1 && (l = `${s.tagName.toLowerCase()}:nth-of-type(${Pe(s)})`);
448
495
  } catch {
449
496
  }
450
- e.unshift(b), t = s, o++;
497
+ e.unshift(l), n = r, o++;
451
498
  }
452
499
  return e.join(" > ");
453
500
  }
454
- function re(n) {
455
- const e = Object.keys(n).filter((o) => o.startsWith("__reactFiber$") || o.startsWith("__reactInternalInstance$"));
501
+ function Be(t) {
502
+ const e = Object.keys(t).filter((o) => o.startsWith("__reactFiber$") || o.startsWith("__reactInternalInstance$"));
456
503
  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 };
504
+ let n = t[e[0]];
505
+ for (let o = 0; o < 10 && n; o++) {
506
+ const s = n, i = s.type;
507
+ if (typeof i == "function") {
508
+ const r = i.displayName ?? i.name;
509
+ if (r && r !== "_default") return { lib: "react", name: r };
463
510
  }
464
- if (typeof a == "object" && a !== null) {
465
- const s = a.displayName ?? a.name;
466
- if (s) return { lib: "react", name: s };
511
+ if (typeof i == "object" && i !== null) {
512
+ const r = i.displayName ?? i.name;
513
+ if (r) return { lib: "react", name: r };
467
514
  }
468
- t = i.return;
515
+ n = s.return;
469
516
  }
470
517
  return { lib: "react" };
471
518
  }
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 } : {} };
519
+ function je(t) {
520
+ var o, s;
521
+ const e = t, n = e.__vueParentComponent;
522
+ if (n) {
523
+ const i = ((o = n.type) == null ? void 0 : o.name) ?? ((s = n.type) == null ? void 0 : s.__name);
524
+ return { lib: "vue", ...i ? { name: i } : {} };
478
525
  }
479
526
  return e.__vue__ ? { lib: "vue" } : null;
480
527
  }
481
- function de(n) {
528
+ function Oe(t) {
482
529
  const e = window.ng;
483
530
  if (!(e != null && e.getComponent)) return null;
484
531
  try {
485
- const t = e.getComponent(n);
486
- if (!t) return null;
487
- const o = t.constructor;
532
+ const n = e.getComponent(t);
533
+ if (!n) return null;
534
+ const o = n.constructor;
488
535
  return { lib: "angular", ...o != null && o.name ? { name: o.name } : {} };
489
536
  } catch {
490
537
  return null;
491
538
  }
492
539
  }
493
- function le(n) {
494
- return "__svelte_meta" in n ? { lib: "svelte" } : null;
540
+ function ze(t) {
541
+ return "__svelte_meta" in t ? { lib: "svelte" } : null;
495
542
  }
496
- function P(n) {
497
- return re(n) ?? ce(n) ?? de(n) ?? le(n) ?? void 0;
543
+ function G(t) {
544
+ return Be(t) ?? je(t) ?? Oe(t) ?? ze(t) ?? void 0;
498
545
  }
499
- const ue = 5e3, pe = 1e3, I = 1e3, D = 200, he = 50, z = 200, be = 500, fe = [
546
+ const Ue = 5e3, He = 1e3, J = 1e3, Z = 200, qe = 50, Q = 200, Fe = 500, We = [
500
547
  "display",
501
548
  "position",
502
549
  "top",
@@ -535,60 +582,60 @@ const ue = 5e3, pe = 1e3, I = 1e3, D = 200, he = 50, z = 200, be = 500, fe = [
535
582
  "grid-template-columns",
536
583
  "grid-template-rows"
537
584
  ];
538
- function B(n, e) {
539
- return n.length <= e ? n : n.slice(0, e) + `
585
+ function ee(t, e) {
586
+ return t.length <= e ? t : t.slice(0, e) + `
540
587
 
541
- /* … truncated, original was ${n.length} chars */`;
588
+ /* … truncated, original was ${t.length} chars */`;
542
589
  }
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));
590
+ function Ve(t) {
591
+ const e = getComputedStyle(t), n = {};
592
+ for (const o of We) {
593
+ const s = e.getPropertyValue(o);
594
+ s && s !== "normal" && s !== "none" && s !== "auto" && s !== "0px" && (n[o] = s.trim().slice(0, Fe));
548
595
  }
549
- return t;
596
+ return n;
550
597
  }
551
- function ge(n) {
552
- return Array.from(n.classList).slice(0, he).map((t) => t.length > z ? t.slice(0, z) : t);
598
+ function Ke(t) {
599
+ return Array.from(t.classList).slice(0, qe).map((n) => n.length > Q ? n.slice(0, Q) : n);
553
600
  }
554
- function ve(n) {
555
- const e = n.getBoundingClientRect(), t = se(n), o = n.id || null;
601
+ function Xe(t) {
602
+ const e = t.getBoundingClientRect(), n = De(t), o = t.id || null;
556
603
  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),
604
+ selector: n.length > J ? n.slice(0, J) : n,
605
+ tagName: t.tagName.toLowerCase(),
606
+ id: o && o.length > Z ? o.slice(0, Z) : o,
607
+ classList: Ke(t),
608
+ outerHTML: ee(t.outerHTML, Ue),
609
+ ...t.parentElement ? { parentOuterHTML: ee(t.parentElement.outerHTML, He) } : {},
610
+ computedStyles: Ve(t),
564
611
  boundingRect: {
565
612
  x: Math.round(e.x),
566
613
  y: Math.round(e.y),
567
614
  w: Math.round(e.width),
568
615
  h: Math.round(e.height)
569
616
  },
570
- ...P(n) ? { framework: P(n) } : {}
617
+ ...G(t) ? { framework: G(t) } : {}
571
618
  };
572
619
  }
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
620
+ function te() {
621
+ var n, o;
622
+ const t = navigator;
623
+ return t.userAgentData ? {
624
+ brand: ((n = t.userAgentData.brands.find((s) => !/Not[.\-]?A.?Brand/i.test(s.brand))) == null ? void 0 : n.brand) ?? ((o = t.userAgentData.brands[0]) == null ? void 0 : o.brand) ?? "unknown",
625
+ mobile: t.userAgentData.mobile,
626
+ platform: t.userAgentData.platform
580
627
  } : void 0;
581
628
  }
582
- function j() {
629
+ function ne() {
583
630
  if (window.matchMedia("(prefers-color-scheme: dark)").matches) return "dark";
584
631
  if (window.matchMedia("(prefers-color-scheme: light)").matches) return "light";
585
632
  }
586
- function H() {
633
+ function oe() {
587
634
  return {
588
635
  url: window.location.href,
589
636
  ...document.referrer ? { referrer: document.referrer } : {},
590
637
  userAgent: navigator.userAgent,
591
- ...O() ? { uaData: O() } : {},
638
+ ...te() ? { uaData: te() } : {},
592
639
  viewport: {
593
640
  w: window.innerWidth,
594
641
  h: window.innerHeight,
@@ -600,54 +647,54 @@ function H() {
600
647
  },
601
648
  timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
602
649
  locale: navigator.language,
603
- ...j() ? { theme: j() } : {},
650
+ ...ne() ? { theme: ne() } : {},
604
651
  capturedAt: (/* @__PURE__ */ new Date()).toISOString()
605
652
  };
606
653
  }
607
- let T = null;
608
- async function xe() {
609
- return T || (T = await import("./index-DAIDnjfR.mjs")), T;
654
+ let R = null;
655
+ async function Ye() {
656
+ return R || (R = await import("./index-DAIDnjfR.mjs")), R;
610
657
  }
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;
658
+ const _ = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkAAIAAAoAAv/lxKUAAAAASUVORK5CYII=";
659
+ function se(t, e) {
660
+ if (!t || t.startsWith("data:") || t.startsWith("blob:") || t.startsWith("/") || t.startsWith("#")) return !0;
614
661
  try {
615
- if (new URL(n, window.location.href).origin === window.location.origin) return !0;
662
+ if (new URL(t, window.location.href).origin === window.location.origin) return !0;
616
663
  } catch {
617
664
  return !1;
618
665
  }
619
666
  return e === "anonymous" || e === "use-credentials";
620
667
  }
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));
668
+ function Ge() {
669
+ const t = [], e = [];
670
+ return document.querySelectorAll("img").forEach((n) => {
671
+ se(n.src, n.crossOrigin) || (t.push({ el: n, src: n.src }), n.src = _);
672
+ }), document.querySelectorAll("image").forEach((n) => {
673
+ const o = n, s = o.getAttribute("href"), i = o.getAttributeNS("http://www.w3.org/1999/xlink", "href"), r = s || i || "";
674
+ r && !se(r) && (e.push({ el: o, href: s, xlink: i }), s !== null && o.setAttribute("href", _), i !== null && o.setAttributeNS("http://www.w3.org/1999/xlink", "href", _));
628
675
  }), () => {
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);
676
+ for (const { el: n, src: o } of t)
677
+ n.src = o;
678
+ for (const { el: n, href: o, xlink: s } of e)
679
+ o !== null && n.setAttribute("href", o), s !== null && n.setAttributeNS("http://www.w3.org/1999/xlink", "href", s);
633
680
  };
634
681
  }
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;
682
+ async function ie(t = {}) {
683
+ const { quality: e = 0.7, pixelRatio: n = Math.min(window.devicePixelRatio || 1, 2), excludeShadowRoot: o } = t, s = await Ye(), i = o ? (l) => {
684
+ let a = l;
685
+ for (; a; ) {
686
+ if (a === o.host || a instanceof Element && a.classList.contains("beacon-no-capture")) return !1;
687
+ a = a.parentNode;
641
688
  }
642
689
  return !0;
643
- } : void 0, s = we();
690
+ } : void 0, r = Ge();
644
691
  try {
645
- return await i.toJpeg(document.documentElement, {
692
+ return await s.toJpeg(document.documentElement, {
646
693
  quality: e,
647
- pixelRatio: t,
694
+ pixelRatio: n,
648
695
  cacheBust: !0,
649
- ...a ? { filter: a } : {},
650
- imagePlaceholder: C,
696
+ ...i ? { filter: i } : {},
697
+ imagePlaceholder: _,
651
698
  // Cap dimensions to viewport so we don't accidentally capture full document height.
652
699
  width: window.innerWidth,
653
700
  height: window.innerHeight,
@@ -657,88 +704,159 @@ async function W(n = {}) {
657
704
  }
658
705
  });
659
706
  } 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();
707
+ r();
708
+ }
709
+ }
710
+ const Je = 14, Ze = "#ffffff", Qe = "#ffffff", et = 3, tt = "#0ea5e9";
711
+ async function re(t, e, n, o, s = tt) {
712
+ const i = s, r = s, l = await ot(t), a = document.createElement("canvas");
713
+ a.width = l.naturalWidth, a.height = l.naturalHeight;
714
+ const c = a.getContext("2d");
715
+ if (!c) throw new Error("Could not get 2D canvas context");
716
+ c.drawImage(l, 0, 0);
717
+ const d = a.width / n.w, u = a.height / n.h;
718
+ for (const g of e) {
719
+ const y = nt(g, o);
720
+ if (!y) continue;
721
+ const w = y.x * d, x = y.y * u, v = y.w * d, h = y.h * u;
722
+ c.lineWidth = et, c.strokeStyle = r, c.strokeRect(w, x, v, h);
723
+ const f = w + v, p = x;
724
+ c.beginPath(), c.fillStyle = i, c.arc(f, p, Je, 0, Math.PI * 2), c.fill(), c.lineWidth = 3, c.strokeStyle = Ze, c.stroke(), c.fillStyle = Qe, c.font = "bold 16px system-ui, -apple-system, sans-serif", c.textAlign = "center", c.textBaseline = "middle", c.fillText(String(g.number), f, p + 1);
725
+ }
726
+ return a.toDataURL("image/jpeg", 0.85);
727
+ }
728
+ function nt(t, e) {
729
+ const n = e == null ? void 0 : e.get(t);
730
+ if (n && document.contains(n)) {
731
+ const o = n.getBoundingClientRect();
685
732
  if (o.width > 0 || o.height > 0)
686
733
  return { x: o.left, y: o.top, w: o.width, h: o.height };
687
734
  }
688
- if (n.selector)
735
+ if (t.selector)
689
736
  try {
690
- const o = document.querySelector(n.selector);
737
+ const o = document.querySelector(t.selector);
691
738
  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 };
739
+ const s = o.getBoundingClientRect();
740
+ if (s.width > 0 || s.height > 0)
741
+ return { x: s.left, y: s.top, w: s.width, h: s.height };
695
742
  }
696
743
  } catch {
697
744
  }
698
- return n.boundingRect;
745
+ return t.boundingRect;
699
746
  }
700
- function Le(n) {
701
- return new Promise((e, t) => {
747
+ function ot(t) {
748
+ return new Promise((e, n) => {
702
749
  const o = new Image();
703
- o.onload = () => e(o), o.onerror = (i) => t(i), o.src = n;
750
+ o.onload = () => e(o), o.onerror = (s) => n(s), o.src = t;
704
751
  });
705
752
  }
706
- async function Te(n, e, t) {
707
- const o = await fetch(n, {
753
+ const st = 30, D = 500, ae = 2e3, it = 500, rt = 5e3, at = /launch-kit-beacon|beacon-client|beacon\.(?:es|umd|mjs)/i, $ = [], P = /* @__PURE__ */ new Map(), B = /* @__PURE__ */ new Set();
754
+ let ce = !1;
755
+ function C(t, e) {
756
+ if (t)
757
+ return t.length > e ? t.slice(0, e) : t;
758
+ }
759
+ function ct(t, e) {
760
+ const n = (e == null ? void 0 : e.split(`
761
+ `).slice(0, 3).join("|")) ?? "";
762
+ return `${t}::${n}`;
763
+ }
764
+ function lt(t) {
765
+ return !!t && at.test(t);
766
+ }
767
+ function dt(t) {
768
+ try {
769
+ return JSON.stringify(t).slice(0, D);
770
+ } catch {
771
+ return String(t);
772
+ }
773
+ }
774
+ function le(t) {
775
+ if (lt(t.stack) || t.kind === "unhandledrejection" && /AbortError/i.test(t.message)) return;
776
+ const e = ct(t.message, t.stack), n = P.get(e);
777
+ if (n !== void 0 && t.ts - n < rt) {
778
+ P.set(e, t.ts);
779
+ return;
780
+ }
781
+ P.set(e, t.ts), $.push(t), $.length > st && $.shift();
782
+ for (const o of B)
783
+ try {
784
+ o();
785
+ } catch {
786
+ }
787
+ }
788
+ function ut() {
789
+ ce || typeof window > "u" || (ce = !0, window.addEventListener("error", (t) => {
790
+ try {
791
+ const e = t.error instanceof Error ? t.error.message : void 0, n = t.error instanceof Error ? t.error.stack : void 0;
792
+ le({
793
+ ts: Date.now(),
794
+ kind: "error",
795
+ message: C(t.message || e || "Unknown error", D) ?? "Unknown error",
796
+ ...n ? { stack: C(n, ae) } : {},
797
+ ...t.filename ? { source: C(t.filename, it) } : {},
798
+ ...Number.isFinite(t.lineno) ? { line: t.lineno } : {},
799
+ ...Number.isFinite(t.colno) ? { col: t.colno } : {}
800
+ });
801
+ } catch {
802
+ }
803
+ }), window.addEventListener("unhandledrejection", (t) => {
804
+ try {
805
+ const e = t.reason, n = e instanceof Error ? e.message : typeof e == "string" ? e : dt(e), o = e instanceof Error ? e.stack : void 0;
806
+ le({
807
+ ts: Date.now(),
808
+ kind: "unhandledrejection",
809
+ message: C(n || "Unknown rejection", D) ?? "Unknown rejection",
810
+ ...o ? { stack: C(o, ae) } : {}
811
+ });
812
+ } catch {
813
+ }
814
+ }));
815
+ }
816
+ function M() {
817
+ return $.slice();
818
+ }
819
+ function ge(t) {
820
+ return B.add(t), () => {
821
+ B.delete(t);
822
+ };
823
+ }
824
+ async function ht(t, e, n) {
825
+ const o = await fetch(t, {
708
826
  method: "POST",
709
827
  credentials: "include",
710
828
  headers: {
711
829
  "Content-Type": "application/json",
712
- ...t ?? {}
830
+ ...n ?? {}
713
831
  },
714
832
  body: JSON.stringify(e)
715
833
  });
716
- let i = null;
834
+ let s = null;
717
835
  if ((o.headers.get("Content-Type") ?? "").includes("application/json"))
718
836
  try {
719
- i = await o.json();
837
+ s = await o.json();
720
838
  } catch {
721
- i = null;
839
+ s = null;
722
840
  }
723
841
  else
724
842
  try {
725
- i = await o.text();
843
+ s = await o.text();
726
844
  } catch {
727
- i = null;
845
+ s = null;
728
846
  }
729
847
  return {
730
848
  ok: o.ok,
731
849
  status: o.status,
732
- body: i
850
+ body: s
733
851
  };
734
852
  }
735
- const $e = ["endpoint", "position", "theme", "severities"], q = "launch-kit-beacon-portal-styles";
736
- function Re(n) {
737
- if (document.getElementById(q)) return;
853
+ const pt = ["endpoint", "position", "theme", "severities"], de = "launch-kit-beacon-portal-styles";
854
+ function ft(t) {
855
+ if (document.getElementById(de)) return;
738
856
  const e = document.createElement("style");
739
- e.id = q, e.textContent = n, document.head.appendChild(e);
857
+ e.id = de, e.textContent = t, document.head.appendChild(e);
740
858
  }
741
- const Me = [
859
+ const bt = [
742
860
  "--beacon-accent",
743
861
  "--beacon-bg",
744
862
  "--beacon-fg",
@@ -751,13 +869,13 @@ const Me = [
751
869
  "--beacon-idea",
752
870
  "--beacon-ux",
753
871
  "--beacon-a11y"
754
- ], K = "#0ea5e9";
755
- class Ne extends HTMLElement {
872
+ ], ue = "#0ea5e9";
873
+ class mt extends HTMLElement {
756
874
  constructor() {
757
875
  super(...arguments), this._config = null, this.pins = [], this.pinElements = /* @__PURE__ */ new WeakMap(), this.description = "", this.severity = "bug", this.submitSucceeded = !1;
758
876
  }
759
877
  static get observedAttributes() {
760
- return $e;
878
+ return pt;
761
879
  }
762
880
  /** Public — wrappers can set `widget.config = {...}` for dynamic endpoint/headers/context. */
763
881
  set config(e) {
@@ -772,44 +890,48 @@ class Ne extends HTMLElement {
772
890
  if (!this.shadow) {
773
891
  this.shadow = this.attachShadow({ mode: "open" });
774
892
  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(), {
893
+ e.textContent = V, this.shadow.appendChild(e), this.slotEl = document.createElement("slot"), this.slotEl.name = "trigger", this.shadow.appendChild(this.slotEl), this.trigger = ke(), this.shadow.appendChild(this.trigger), this.trigger.addEventListener("click", () => this.open()), this.slotEl.addEventListener("slotchange", () => {
894
+ const n = this.slotEl.assignedElements();
895
+ n.length > 0 && (this.trigger && (this.trigger.style.display = "none"), n.forEach((o) => o.addEventListener("click", () => this.open())));
896
+ }), this.drawer = new Ce(this.parseSeverities(), {
779
897
  onClose: () => this.close(),
780
898
  onAnnotate: () => this.startAnnotate(),
781
899
  onSubmit: () => this.handleSubmit(),
782
- onPinNoteChange: (t, o) => this.updatePinNote(t, o),
783
- onPinDelete: (t) => this.deletePin(t),
784
- onDescriptionChange: (t) => {
785
- this.description = t;
900
+ onPinNoteChange: (n, o) => this.updatePinNote(n, o),
901
+ onPinDelete: (n) => this.deletePin(n),
902
+ onDescriptionChange: (n) => {
903
+ this.description = n;
786
904
  },
787
- onSeverityChange: (t) => {
788
- this.severity = t;
905
+ onSeverityChange: (n) => {
906
+ this.severity = n;
789
907
  }
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);
908
+ }), ft(V), 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), this.eventsUnsubscribe = ge(() => {
909
+ var n;
910
+ (n = this.drawer) == null || n.setEvents(M());
911
+ });
791
912
  }
792
913
  this.hasAttribute("position") || this.setAttribute("position", "bottom-right"), this.hasAttribute("theme") || this.setAttribute("theme", "auto");
793
914
  }
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"}`));
915
+ attributeChangedCallback(e, n, o) {
916
+ e === "severities" && this.drawer && console.warn("[launch-kit-beacon] severities attribute changed after mount; not yet hot-reloaded."), e === "theme" && this.drawer && n !== o && (this.drawer.root.classList.remove(`beacon-theme-${n ?? "auto"}`), this.drawer.root.classList.add(`beacon-theme-${o ?? "auto"}`));
796
917
  }
797
918
  // ── Public API ──────────────────────────────────────────
798
919
  open() {
799
920
  var e;
800
921
  if (this.drawer) {
801
922
  if (this.getAttribute("position") === "hidden") {
802
- const t = (e = this.slotEl) == null ? void 0 : e.assignedElements()[0];
803
- t && Ie(this.drawer.root, t);
923
+ const n = (e = this.slotEl) == null ? void 0 : e.assignedElements()[0];
924
+ n && wt(this.drawer.root, n);
804
925
  }
805
- this.submitSucceeded = !1, this.syncCustomProperties(), this.installClickBlocker(), this.drawer.open();
926
+ this.submitSucceeded = !1, this.drawer.setEvents(M()), this.syncCustomProperties(), this.installClickBlocker(), this.drawer.open();
806
927
  }
807
928
  }
808
929
  close() {
809
930
  this.drawer && (!this.submitSucceeded && this.hasUnsavedData() && !window.confirm("You have unsaved feedback. Close and discard it?") || this.forceClose());
810
931
  }
811
932
  disconnectedCallback() {
812
- this.uninstallClickBlocker(), this.drawer && this.drawer.root.parentNode && this.drawer.root.parentNode.removeChild(this.drawer.root);
933
+ var e;
934
+ this.uninstallClickBlocker(), (e = this.eventsUnsubscribe) == null || e.call(this), this.eventsUnsubscribe = void 0, this.drawer && this.drawer.root.parentNode && this.drawer.root.parentNode.removeChild(this.drawer.root);
813
935
  }
814
936
  async openWithPicker() {
815
937
  this.open(), setTimeout(() => this.startAnnotate(), 0);
@@ -818,11 +940,11 @@ class Ne extends HTMLElement {
818
940
  async startAnnotate() {
819
941
  if (!this.drawer) return;
820
942
  this.drawer.minimize();
821
- const e = this.getAccentColor(), t = Q({ accent: e });
943
+ const e = this.getAccentColor(), n = Me({ accent: e });
822
944
  for (const o of this.pins) {
823
- const i = this.pinElements.get(o);
824
- i && t.addPin(o.number, {
825
- target: i,
945
+ const s = this.pinElements.get(o);
946
+ s && n.addPin(o.number, {
947
+ target: s,
826
948
  selector: o.selector,
827
949
  fallbackRect: o.boundingRect
828
950
  });
@@ -830,50 +952,50 @@ class Ne extends HTMLElement {
830
952
  try {
831
953
  let o = !0;
832
954
  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({
955
+ const i = await $e({ shadowRoot: this.shadow, accent: e }).promise;
956
+ if (!i) break;
957
+ const r = i.getBoundingClientRect(), l = await Le({
836
958
  shadowRoot: this.shadow,
837
- anchor: { x: s.left, y: s.bottom },
959
+ anchor: { x: r.left, y: r.bottom },
838
960
  pinNumber: this.pins.length + 1
839
961
  });
840
- if (b.cancelled === "all") break;
841
- if (b.cancelled === "pin") continue;
842
- const p = ve(a), u = {
962
+ if (l.cancelled === "all") break;
963
+ if (l.cancelled === "pin") continue;
964
+ const a = Xe(i), c = {
843
965
  number: this.pins.length + 1,
844
- ...p,
845
- ...b.note ? { note: b.note } : {}
966
+ ...a,
967
+ ...l.note ? { note: l.note } : {}
846
968
  };
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
969
+ this.pins.push(c), this.pinElements.set(c, i), n.addPin(c.number, {
970
+ target: i,
971
+ selector: a.selector,
972
+ fallbackRect: a.boundingRect
851
973
  });
852
974
  }
853
975
  if (this.pins.length > 0) {
854
- t.setLoading("Capturing screenshot…"), await new Promise((i) => requestAnimationFrame(() => i()));
976
+ n.setLoading("Capturing screenshot…"), await new Promise((s) => requestAnimationFrame(() => s()));
855
977
  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");
978
+ const s = oe(), i = await ie({ excludeShadowRoot: this.shadow }), r = await re(i, this.pins, s.viewport, this.pinElements, e);
979
+ this.drawer.setPins(this.pins, r);
980
+ } catch (s) {
981
+ const i = s instanceof Error ? s.message : String(s);
982
+ console.error("[launch-kit-beacon] screenshot capture failed:", s), this.drawer.setPins(this.pins), this.drawer.setStatus(`Screenshot capture failed: ${i}`, "error");
861
983
  }
862
984
  }
863
985
  } finally {
864
- t.destroy();
986
+ n.destroy();
865
987
  }
866
988
  this.drawer.open();
867
989
  }
868
- updatePinNote(e, t) {
869
- const o = this.pins.find((i) => i.number === e);
870
- o && (t.trim() ? o.note = t : delete o.note);
990
+ updatePinNote(e, n) {
991
+ const o = this.pins.find((s) => s.number === e);
992
+ o && (n.trim() ? o.note = n : delete o.note);
871
993
  }
872
994
  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);
995
+ var n, o;
996
+ this.pins = this.pins.filter((s) => s.number !== e), this.pins.forEach((s, i) => {
997
+ s.number = i + 1;
998
+ }), (n = this.drawer) == null || n.setAnnotatedScreenshot(void 0), (o = this.drawer) == null || o.setPins(this.pins);
877
999
  }
878
1000
  // ── Submit flow ──────────────────────────────────────────
879
1001
  async handleSubmit() {
@@ -883,54 +1005,55 @@ class Ne extends HTMLElement {
883
1005
  this.drawer.setStatus("Missing endpoint configuration", "error");
884
1006
  return;
885
1007
  }
886
- const t = this.drawer.getDescription().trim(), o = this.drawer.getSeverity();
887
- if (!t) {
1008
+ const n = this.drawer.getDescription().trim(), o = this.drawer.getSeverity();
1009
+ if (!n) {
888
1010
  this.drawer.setStatus("Description is required", "error");
889
1011
  return;
890
1012
  }
891
1013
  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)
1014
+ let s = this.drawer.getAnnotatedScreenshot();
1015
+ const i = !s && this.pins.length > 0;
1016
+ this.drawer.setStatus(i ? "Capturing screenshot…" : "Sending…"), await new Promise((u) => requestAnimationFrame(() => u()));
1017
+ const r = oe();
1018
+ if (i)
897
1019
  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);
1020
+ const u = await ie({ excludeShadowRoot: this.shadow });
1021
+ s = await re(u, this.pins, r.viewport, this.pinElements, this.getAccentColor());
1022
+ } catch (u) {
1023
+ console.error("[launch-kit-beacon] screenshot capture failed at submit:", u);
902
1024
  }
903
- const b = {
904
- description: t,
1025
+ const l = M(), a = {
1026
+ description: n,
905
1027
  severity: o,
906
- ...i ? { screenshot: { dataUrl: i, mime: "image/jpeg" } } : {},
907
- metadata: s,
1028
+ ...s ? { screenshot: { dataUrl: s, mime: "image/jpeg" } } : {},
1029
+ metadata: r,
908
1030
  pins: this.pins,
1031
+ ...l.length > 0 ? { events: l } : {},
909
1032
  ...this.resolveContext() ? { context: this.resolveContext() } : {}
910
- }, p = new CustomEvent("beacon-before-submit", {
911
- detail: { payload: b },
1033
+ }, c = new CustomEvent("beacon-before-submit", {
1034
+ detail: { payload: a },
912
1035
  cancelable: !0,
913
1036
  bubbles: !0,
914
1037
  composed: !0
915
1038
  });
916
- if (!this.dispatchEvent(p)) {
1039
+ if (!this.dispatchEvent(c)) {
917
1040
  this.drawer.setSubmitting(!1), this.drawer.setStatus("Submission cancelled", "error");
918
1041
  return;
919
1042
  }
920
1043
  this.drawer.setStatus("Sending…");
921
1044
  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 },
1045
+ const u = this.resolveHeaders(), g = await ht(e.endpoint, a, u);
1046
+ this.drawer.setSubmitting(!1), g.ok ? (this.submitSucceeded = !0, this.drawer.setStatus("Sent — thanks!", "success"), this.dispatchEvent(new CustomEvent("beacon-after-submit", {
1047
+ detail: { response: g },
925
1048
  bubbles: !0,
926
1049
  composed: !0
927
1050
  })), setTimeout(() => {
928
1051
  this.forceClose();
929
- }, 1500)) : this.drawer.setStatus(`Failed: ${f.status}`, "error");
930
- } catch (h) {
1052
+ }, 1500)) : this.drawer.setStatus(`Failed: ${g.status}`, "error");
1053
+ } catch (u) {
931
1054
  this.drawer.setSubmitting(!1);
932
- const f = h instanceof Error ? h.message : "Network error";
933
- this.drawer.setStatus(`Failed: ${f}`, "error");
1055
+ const g = u instanceof Error ? u.message : "Network error";
1056
+ this.drawer.setStatus(`Failed: ${g}`, "error");
934
1057
  }
935
1058
  }
936
1059
  // ── Helpers ──────────────────────────────────────────
@@ -940,7 +1063,7 @@ class Ne extends HTMLElement {
940
1063
  * targeting the host). Falls back to the default sky-blue if unset.
941
1064
  */
942
1065
  getAccentColor() {
943
- return typeof window > "u" ? K : getComputedStyle(this).getPropertyValue("--beacon-accent").trim() || K;
1066
+ return typeof window > "u" ? ue : getComputedStyle(this).getPropertyValue("--beacon-accent").trim() || ue;
944
1067
  }
945
1068
  /**
946
1069
  * Mirror every customizable --beacon-* var from the host onto the body-mounted
@@ -950,14 +1073,14 @@ class Ne extends HTMLElement {
950
1073
  syncCustomProperties() {
951
1074
  if (!this.drawer) return;
952
1075
  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);
1076
+ for (const n of bt) {
1077
+ const o = e.getPropertyValue(n).trim();
1078
+ o && this.drawer.root.style.setProperty(n, o);
956
1079
  }
957
1080
  }
958
1081
  hasUnsavedData() {
959
- var t;
960
- return this.pins.length > 0 ? !0 : (((t = this.drawer) == null ? void 0 : t.getDescription()) ?? "").trim().length > 0;
1082
+ var n;
1083
+ return this.pins.length > 0 ? !0 : (((n = this.drawer) == null ? void 0 : n.getDescription()) ?? "").trim().length > 0;
961
1084
  }
962
1085
  resetState() {
963
1086
  var e;
@@ -969,9 +1092,9 @@ class Ne extends HTMLElement {
969
1092
  }
970
1093
  installClickBlocker() {
971
1094
  this.documentClickBlocker || (this.documentClickBlocker = (e) => {
972
- const t = e.composedPath();
973
- if (!t.includes(this.shadow.host)) {
974
- for (const o of t)
1095
+ const n = e.composedPath();
1096
+ if (!n.includes(this.shadow.host)) {
1097
+ for (const o of n)
975
1098
  if (o instanceof Element && o.classList.contains("beacon-no-capture")) return;
976
1099
  e.preventDefault(), e.stopPropagation();
977
1100
  }
@@ -981,36 +1104,476 @@ class Ne extends HTMLElement {
981
1104
  this.documentClickBlocker && (document.removeEventListener("click", this.documentClickBlocker, !0), this.documentClickBlocker = void 0);
982
1105
  }
983
1106
  resolveHeaders() {
984
- var t;
985
- const e = (t = this.config) == null ? void 0 : t.headers;
1107
+ var n;
1108
+ const e = (n = this.config) == null ? void 0 : n.headers;
986
1109
  if (e)
987
1110
  return typeof e == "function" ? e() : e;
988
1111
  }
989
1112
  resolveContext() {
990
- var t;
991
- const e = (t = this.config) == null ? void 0 : t.context;
1113
+ var n;
1114
+ const e = (n = this.config) == null ? void 0 : n.context;
992
1115
  if (e)
993
1116
  return typeof e == "function" ? e() : e;
994
1117
  }
995
1118
  parseSeverities() {
996
1119
  const e = this.getAttribute("severities");
997
- return e ? e.split(",").map((t) => t.trim()).filter(Boolean) : ["bug", "idea", "ux", "a11y"];
1120
+ return e ? e.split(",").map((n) => n.trim()).filter(Boolean) : ["bug", "idea", "ux", "a11y"];
1121
+ }
1122
+ }
1123
+ function gt(t = "launch-kit-beacon") {
1124
+ typeof window > "u" || customElements.get(t) || customElements.define(t, mt);
1125
+ }
1126
+ const he = 380, E = 8, yt = 520;
1127
+ function wt(t, e) {
1128
+ const n = e.getBoundingClientRect(), o = window.innerWidth, s = window.innerHeight;
1129
+ let i = Math.max(E, o - n.right);
1130
+ o - i - he < E && (i = Math.max(E, o - he - E));
1131
+ const l = s - n.bottom - E, a = n.top - E;
1132
+ t.style.left = "auto", t.style.right = `${i}px`, l >= yt || l >= a ? (t.style.top = `${n.bottom + E}px`, t.style.bottom = "auto") : (t.style.top = "auto", t.style.bottom = `${s - n.top + E}px`);
1133
+ }
1134
+ const vt = 1024, xt = 5;
1135
+ function Et(t, e) {
1136
+ return t.length > e ? t.slice(0, e) : t;
1137
+ }
1138
+ function ye(t) {
1139
+ if (t.id) return `#${CSS.escape(t.id)}`;
1140
+ const e = [];
1141
+ let n = t;
1142
+ for (let o = 0; o < 3 && n; o++) {
1143
+ const s = n.tagName.toLowerCase(), i = n.id ? `#${CSS.escape(n.id)}` : "", r = n.classList.length > 0 ? "." + Array.from(n.classList).slice(0, 3).map(CSS.escape).join(".") : "";
1144
+ if (e.unshift(`${s}${i}${r}`), i) break;
1145
+ n = n.parentElement;
1146
+ }
1147
+ return e.join(" > ");
1148
+ }
1149
+ function pe(t) {
1150
+ return {
1151
+ tag: t.tagName.toLowerCase(),
1152
+ id: t.id || null,
1153
+ classes: Array.from(t.classList).slice(0, 10),
1154
+ role: t.getAttribute("role"),
1155
+ selector: ye(t)
1156
+ };
1157
+ }
1158
+ function St(t, e) {
1159
+ const n = [], o = document.querySelectorAll("body *");
1160
+ for (const s of Array.from(o)) {
1161
+ const i = getComputedStyle(s);
1162
+ if (i.position !== "fixed" && i.position !== "sticky") continue;
1163
+ const r = s.getBoundingClientRect();
1164
+ if (t < r.left || t > r.right || e < r.top || e > r.bottom) continue;
1165
+ const l = parseInt(i.zIndex, 10);
1166
+ !Number.isFinite(l) && i.zIndex !== "auto" || n.push({
1167
+ tag: s.tagName.toLowerCase(),
1168
+ zIndex: Number.isFinite(l) ? l : 0,
1169
+ pointerEvents: i.pointerEvents,
1170
+ classes: Array.from(s.classList).slice(0, 5).join(" ")
1171
+ });
1172
+ }
1173
+ return n.sort((s, i) => i.zIndex - s.zIndex).slice(0, xt);
1174
+ }
1175
+ function kt(t) {
1176
+ const e = (s) => (i) => {
1177
+ const r = i, l = r.target;
1178
+ if (!(l instanceof Element)) return;
1179
+ const a = r.clientX, c = r.clientY, d = document.elementFromPoint(a, c), u = d === l || (d ? l.contains(d) || d.contains(l) : !1), g = document.querySelectorAll('[role="dialog"][data-state="open"]').length, y = getComputedStyle(document.body).pointerEvents, w = St(a, c);
1180
+ t.emitClick({
1181
+ kind: s,
1182
+ target: pe(l),
1183
+ hitMatchesTarget: u,
1184
+ ...!u && d instanceof Element ? { hitTarget: pe(d) } : {},
1185
+ coords: { x: a, y: c },
1186
+ openDialogs: g,
1187
+ bodyPointerEvents: y,
1188
+ ...w.length > 0 ? { overlaysAtPoint: w } : {}
1189
+ });
1190
+ }, n = e("click"), o = e("mousedown");
1191
+ return document.addEventListener("click", n, { capture: !0, passive: !0 }), document.addEventListener("mousedown", o, { capture: !0, passive: !0 }), () => {
1192
+ document.removeEventListener("click", n, { capture: !0 }), document.removeEventListener("mousedown", o, { capture: !0 });
1193
+ };
1194
+ }
1195
+ function At(t) {
1196
+ const e = history.pushState, n = history.replaceState;
1197
+ let o = window.location.href;
1198
+ const s = (l) => {
1199
+ const a = window.location.href;
1200
+ if (a === o) return;
1201
+ const c = o;
1202
+ o = a, t.emitRoute({ kind: "route", from: c, to: a, via: l });
1203
+ };
1204
+ history.pushState = function(...a) {
1205
+ const c = e.apply(this, a);
1206
+ return s("pushState"), c;
1207
+ }, history.replaceState = function(...a) {
1208
+ const c = n.apply(this, a);
1209
+ return s("replaceState"), c;
1210
+ };
1211
+ const i = () => s("popstate"), r = () => s("hashchange");
1212
+ return window.addEventListener("popstate", i), window.addEventListener("hashchange", r), () => {
1213
+ history.pushState = e, history.replaceState = n, window.removeEventListener("popstate", i), window.removeEventListener("hashchange", r);
1214
+ };
1215
+ }
1216
+ function Ct(t) {
1217
+ const e = /* @__PURE__ */ new WeakSet(), n = (s, i) => {
1218
+ const r = ye(s);
1219
+ t.emitDialog({
1220
+ kind: "dialog",
1221
+ action: i,
1222
+ selector: r,
1223
+ state: s.getAttribute("data-state"),
1224
+ ...i === "mount" ? { outerHTML: Et(s.outerHTML, vt) } : {}
1225
+ });
1226
+ };
1227
+ for (const s of Array.from(document.querySelectorAll('[role="dialog"]')))
1228
+ e.add(s);
1229
+ const o = new MutationObserver((s) => {
1230
+ var i, r, l, a;
1231
+ for (const c of s) {
1232
+ for (const d of Array.from(c.addedNodes)) {
1233
+ if (!(d instanceof Element)) continue;
1234
+ const u = (i = d.matches) != null && i.call(d, '[role="dialog"]') ? [d] : Array.from(((r = d.querySelectorAll) == null ? void 0 : r.call(d, '[role="dialog"]')) ?? []);
1235
+ for (const g of u)
1236
+ e.has(g) || (e.add(g), n(g, "mount"));
1237
+ }
1238
+ for (const d of Array.from(c.removedNodes)) {
1239
+ if (!(d instanceof Element)) continue;
1240
+ const u = (l = d.matches) != null && l.call(d, '[role="dialog"]') ? [d] : Array.from(((a = d.querySelectorAll) == null ? void 0 : a.call(d, '[role="dialog"]')) ?? []);
1241
+ for (const g of u)
1242
+ e.has(g) && (e.delete(g), n(g, "unmount"));
1243
+ }
1244
+ c.type === "attributes" && c.attributeName === "data-state" && c.target instanceof Element && c.target.getAttribute("role") === "dialog" && n(c.target, "state");
1245
+ }
1246
+ });
1247
+ return o.observe(document.body, {
1248
+ childList: !0,
1249
+ subtree: !0,
1250
+ attributes: !0,
1251
+ attributeFilter: ["data-state"]
1252
+ }), () => o.disconnect();
1253
+ }
1254
+ function Lt(t) {
1255
+ const e = kt(t), n = At(t), o = Ct(t);
1256
+ return {
1257
+ uninstall() {
1258
+ e(), n(), o();
1259
+ }
1260
+ };
1261
+ }
1262
+ const j = 1e3;
1263
+ function O(t, e) {
1264
+ return t.length > e ? t.slice(0, e) : t;
1265
+ }
1266
+ function Tt(t) {
1267
+ const e = window.fetch;
1268
+ if (typeof e != "function") return () => {
1269
+ };
1270
+ const n = async (o, s) => {
1271
+ const i = performance.now(), r = ((s == null ? void 0 : s.method) ?? (o instanceof Request ? o.method : "GET")).toUpperCase(), l = typeof o == "string" ? o : o instanceof URL ? o.toString() : o.url;
1272
+ try {
1273
+ const a = await e.call(window, o, s), c = Math.round(performance.now() - i), d = a.status >= 400;
1274
+ return (d || t.verbose) && t.emit({
1275
+ kind: "fetch",
1276
+ url: O(l, j),
1277
+ method: r,
1278
+ status: a.status,
1279
+ durationMs: c,
1280
+ failed: d
1281
+ }), a;
1282
+ } catch (a) {
1283
+ const c = Math.round(performance.now() - i);
1284
+ throw t.emit({
1285
+ kind: "fetch",
1286
+ url: O(l, j),
1287
+ method: r,
1288
+ status: 0,
1289
+ durationMs: c,
1290
+ failed: !0,
1291
+ error: a instanceof Error ? a.message : String(a)
1292
+ }), a;
1293
+ }
1294
+ };
1295
+ return n.__lsBeaconWrapped = !0, window.fetch = n, () => {
1296
+ window.fetch.__lsBeaconWrapped && (window.fetch = e);
1297
+ };
1298
+ }
1299
+ function Mt(t) {
1300
+ const e = XMLHttpRequest.prototype, n = e.open, o = e.send, s = /* @__PURE__ */ new WeakMap();
1301
+ return e.open = function(r, l, ...a) {
1302
+ return s.set(this, {
1303
+ method: r.toUpperCase(),
1304
+ url: typeof l == "string" ? l : l.toString(),
1305
+ start: 0
1306
+ }), n.call(this, r, l, ...a);
1307
+ }, e.send = function(r) {
1308
+ const l = s.get(this);
1309
+ l && (l.start = performance.now());
1310
+ const a = () => {
1311
+ this.removeEventListener("loadend", a);
1312
+ const c = s.get(this);
1313
+ if (!c) return;
1314
+ const d = Math.round(performance.now() - c.start), u = this.status === 0 || this.status >= 400;
1315
+ (u || t.verbose) && t.emit({
1316
+ kind: "xhr",
1317
+ url: O(c.url, j),
1318
+ method: c.method,
1319
+ status: this.status,
1320
+ durationMs: d,
1321
+ failed: u
1322
+ }), s.delete(this);
1323
+ };
1324
+ return this.addEventListener("loadend", a), o.call(this, r);
1325
+ }, () => {
1326
+ e.open = n, e.send = o;
1327
+ };
1328
+ }
1329
+ function It(t) {
1330
+ const e = Tt(t), n = Mt(t);
1331
+ return {
1332
+ uninstall() {
1333
+ e(), n();
1334
+ }
1335
+ };
1336
+ }
1337
+ const _t = 1e3, fe = 50, $t = 500;
1338
+ class Nt {
1339
+ constructor(e) {
1340
+ this.buffer = [], this.inflight = !1, this.timer = null, this.destroyed = !1, this.handleVisibilityChange = () => {
1341
+ document.visibilityState === "hidden" && this.flushSync();
1342
+ }, this.url = e.url, this.sessionId = e.sessionId, this.onError = e.onError, this.timer = setInterval(() => this.flush(), _t), this.pagehideHandler = () => this.flushSync(), window.addEventListener("pagehide", this.pagehideHandler), document.addEventListener("visibilitychange", this.handleVisibilityChange);
1343
+ }
1344
+ enqueue(e) {
1345
+ this.destroyed || (this.buffer.push(e), this.buffer.length >= $t && this.buffer.shift(), this.buffer.length >= fe && this.flush());
1346
+ }
1347
+ /** Async flush via fetch. No-op when in-flight or empty. */
1348
+ async flush() {
1349
+ var o, s;
1350
+ if (this.destroyed || this.inflight || this.buffer.length === 0) return;
1351
+ const e = this.buffer.splice(0, fe), n = this.makeBatch(e);
1352
+ this.inflight = !0;
1353
+ try {
1354
+ const i = await fetch(this.url, {
1355
+ method: "POST",
1356
+ // No credentials — this is going to the developer's local server,
1357
+ // not the app's own backend. Avoid leaking session cookies.
1358
+ credentials: "omit",
1359
+ headers: { "Content-Type": "application/json" },
1360
+ body: JSON.stringify(n),
1361
+ // keepalive lets the request survive a same-tick navigation when
1362
+ // we missed pagehide (e.g. a window.location.assign from script).
1363
+ keepalive: !0
1364
+ });
1365
+ i.ok || (o = this.onError) == null || o.call(this, new Error(`monitor flush: HTTP ${i.status}`));
1366
+ } catch (i) {
1367
+ (s = this.onError) == null || s.call(this, i instanceof Error ? i : new Error(String(i)));
1368
+ } finally {
1369
+ this.inflight = !1;
1370
+ }
1371
+ }
1372
+ /** Synchronous flush via sendBeacon, used on pagehide. */
1373
+ flushSync() {
1374
+ if (this.destroyed || this.buffer.length === 0) return;
1375
+ if (!navigator.sendBeacon) {
1376
+ this.flush();
1377
+ return;
1378
+ }
1379
+ const e = this.buffer.splice(0), n = this.makeBatch(e), o = new Blob([JSON.stringify(n)], { type: "application/json" });
1380
+ try {
1381
+ navigator.sendBeacon(this.url, o);
1382
+ } catch {
1383
+ }
1384
+ }
1385
+ destroy() {
1386
+ this.destroyed || (this.destroyed = !0, this.timer && clearInterval(this.timer), this.pagehideHandler && window.removeEventListener("pagehide", this.pagehideHandler), document.removeEventListener("visibilitychange", this.handleVisibilityChange), this.flushSync());
1387
+ }
1388
+ makeBatch(e) {
1389
+ return {
1390
+ sessionId: this.sessionId,
1391
+ events: e,
1392
+ meta: {
1393
+ url: window.location.href,
1394
+ userAgent: navigator.userAgent,
1395
+ viewport: {
1396
+ w: window.innerWidth,
1397
+ h: window.innerHeight,
1398
+ dpr: window.devicePixelRatio || 1
1399
+ },
1400
+ v: 1
1401
+ }
1402
+ };
1403
+ }
1404
+ }
1405
+ const U = "__lsBeaconMonitorUrl", H = "__lsBeaconMonitorSession", q = "__lsBeaconMonitorVerbose", F = "__lsBeaconMonitorDeadline", we = 30 * 6e4, be = 4096;
1406
+ let m = null;
1407
+ const Rt = /* @__PURE__ */ new Set();
1408
+ let L = 0;
1409
+ function ve() {
1410
+ return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID().slice(0, 8) : Math.random().toString(36).slice(2, 10);
1411
+ }
1412
+ function Pt(t) {
1413
+ const e = /* @__PURE__ */ new WeakSet(), n = (o) => {
1414
+ if (o === null || typeof o != "object")
1415
+ return typeof o == "string" && o.length > be ? o.slice(0, be) : o;
1416
+ if (e.has(o)) return "[cyclic]";
1417
+ if (e.add(o), Array.isArray(o)) return o.map(n);
1418
+ const s = {};
1419
+ for (const i of Object.keys(o).slice(0, 50))
1420
+ try {
1421
+ s[i] = n(o[i]);
1422
+ } catch {
1423
+ s[i] = "[unreadable]";
1424
+ }
1425
+ return s;
1426
+ };
1427
+ try {
1428
+ return n(t);
1429
+ } catch {
1430
+ return "[unserialisable]";
998
1431
  }
999
1432
  }
1000
- function _e(n = "launch-kit-beacon") {
1001
- typeof window > "u" || customElements.get(n) || customElements.define(n, Ne);
1433
+ function xe() {
1434
+ for (const t of Rt)
1435
+ try {
1436
+ t(m !== null, (m == null ? void 0 : m.url) ?? null);
1437
+ } catch {
1438
+ }
1439
+ }
1440
+ function Dt(t) {
1441
+ return m ? (m.seq += 1, {
1442
+ ...t,
1443
+ ts: Date.now(),
1444
+ sessionId: m.sessionId,
1445
+ seq: m.seq
1446
+ }) : {
1447
+ ...t,
1448
+ ts: Date.now(),
1449
+ sessionId: "",
1450
+ seq: 0
1451
+ };
1452
+ }
1453
+ function T(t) {
1454
+ if (!m) return;
1455
+ const e = Dt(t);
1456
+ m.transport.enqueue(e);
1457
+ }
1458
+ function Bt() {
1459
+ if (m)
1460
+ try {
1461
+ sessionStorage.setItem(U, m.url), sessionStorage.setItem(H, m.sessionId), sessionStorage.setItem(q, m.verbose ? "1" : "0"), sessionStorage.setItem(F, String(m.deadlineMs));
1462
+ } catch {
1463
+ }
1464
+ }
1465
+ function Ee() {
1466
+ try {
1467
+ sessionStorage.removeItem(U), sessionStorage.removeItem(H), sessionStorage.removeItem(q), sessionStorage.removeItem(F);
1468
+ } catch {
1469
+ }
1470
+ }
1471
+ function jt() {
1472
+ try {
1473
+ const t = sessionStorage.getItem(U);
1474
+ if (!t) return null;
1475
+ const e = sessionStorage.getItem(H) ?? ve(), n = sessionStorage.getItem(q) === "1", o = sessionStorage.getItem(F), s = o ? Number(o) : Date.now() + we;
1476
+ return Number.isFinite(s) && s <= Date.now() ? (Ee(), null) : { url: t, sessionId: e, verbose: n, deadlineMs: s };
1477
+ } catch {
1478
+ return null;
1479
+ }
1480
+ }
1481
+ function Se(t) {
1482
+ if (m && z(), !t.url) return;
1483
+ const e = t.maxSessionMs ?? we, n = Date.now() + e, o = ve(), s = !!t.verbose, i = new Nt({
1484
+ url: t.url,
1485
+ sessionId: o,
1486
+ onError: (u) => {
1487
+ console.warn("[launch-kit-beacon] monitor transport error:", u.message);
1488
+ }
1489
+ }), r = M();
1490
+ L = r.length;
1491
+ for (const u of r) me(u, i, o);
1492
+ const l = ge(() => {
1493
+ const u = M();
1494
+ for (; L < u.length; ) {
1495
+ const g = u[L];
1496
+ g && me(g, i, o), L += 1;
1497
+ }
1498
+ }), a = It({
1499
+ emit: (u) => T(u),
1500
+ verbose: s
1501
+ }), c = Lt({
1502
+ emitClick: (u) => T(u),
1503
+ emitRoute: (u) => T(u),
1504
+ emitDialog: (u) => T(u)
1505
+ }), d = setTimeout(() => {
1506
+ console.info("[launch-kit-beacon] monitor session expired (max duration reached)"), z();
1507
+ }, Math.max(0, n - Date.now()));
1508
+ m = {
1509
+ url: t.url,
1510
+ sessionId: o,
1511
+ verbose: s,
1512
+ deadlineMs: n,
1513
+ seq: 0,
1514
+ transport: i,
1515
+ uninstallNetwork: a.uninstall,
1516
+ uninstallDom: c.uninstall,
1517
+ uninstallErrors: l,
1518
+ deadlineTimer: d
1519
+ }, Bt(), xe();
1520
+ }
1521
+ function me(t, e, n) {
1522
+ m && (m.seq += 1, e.enqueue({
1523
+ kind: t.kind,
1524
+ ts: t.ts,
1525
+ sessionId: n,
1526
+ seq: m.seq,
1527
+ message: t.message,
1528
+ ...t.stack ? { stack: t.stack } : {},
1529
+ ...t.source ? { source: t.source } : {},
1530
+ ...typeof t.line == "number" ? { line: t.line } : {},
1531
+ ...typeof t.col == "number" ? { col: t.col } : {}
1532
+ }));
1533
+ }
1534
+ function z() {
1535
+ m && (clearTimeout(m.deadlineTimer), m.uninstallNetwork(), m.uninstallDom(), m.uninstallErrors(), m.transport.destroy(), m = null, L = 0, Ee(), xe());
1536
+ }
1537
+ function Ot(t, e) {
1538
+ m && T({
1539
+ kind: "probe",
1540
+ label: t.slice(0, 200),
1541
+ data: Pt(e)
1542
+ });
1543
+ }
1544
+ function zt() {
1545
+ return m !== null;
1546
+ }
1547
+ function Ut() {
1548
+ return (m == null ? void 0 : m.url) ?? null;
1549
+ }
1550
+ const Ht = {
1551
+ start: Se,
1552
+ stop: z,
1553
+ probe: Ot,
1554
+ isActive: zt,
1555
+ currentUrl: Ut
1556
+ };
1557
+ function qt() {
1558
+ if (m) return;
1559
+ const t = jt();
1560
+ t && Se({
1561
+ url: t.url,
1562
+ verbose: t.verbose,
1563
+ maxSessionMs: Math.max(6e4, t.deadlineMs - Date.now())
1564
+ });
1002
1565
  }
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`);
1566
+ function Ft() {
1567
+ if (typeof window > "u") return;
1568
+ const t = window;
1569
+ t.__lsBeacon || (t.__lsBeacon = Ht);
1010
1570
  }
1011
- _e();
1571
+ gt();
1572
+ ut();
1573
+ Ft();
1574
+ qt();
1012
1575
  export {
1013
- Ne as LaunchKitBeacon,
1014
- _e as defineBeacon
1576
+ mt as LaunchKitBeacon,
1577
+ gt as defineBeacon
1015
1578
  };
1016
1579
  //# sourceMappingURL=beacon.mjs.map