@makefully/notefully 0.1.37 → 0.1.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -66,6 +66,8 @@ With `hideLauncher: true`, call `Notefully.open()` / `Notefully.submit()` from y
66
66
 
67
67
  On open, Notefully captures the page automatically: optional `onBeforeCapture` / `capture` hooks first, then a canvas-aware DOM rasterize sized to the viewport (so absolutely positioned apps still capture). Empty results are treated as no screenshot—markup tools stay hidden and the camera **Recapture** control sits beside the mic. With a shot, **Discard** and **Recapture** sit on the far right of the edit tools. Recapture hides the dialog and tries the browser share picker (`getDisplayMedia`); if that fails or is cancelled, it falls back to the automatic path.
68
68
 
69
+ Above Submit, a short disclosure explains that logs and/or diagnostic information will be sent. The list icon opens a review panel (diagnostics as whole fields/objects, plus console lines snapshotted at open). Redact toggles omit items from the report; the disclosure sentence updates when a whole section is redacted or when there are no logs.
70
+
69
71
  ### Hosted relay
70
72
 
71
73
  Makefully hosts a relay at **`https://make.makefullystudios.com/notefully`**. Pass that as `endpoint` (no trailing slash required). You still need a project key from your Showfully Notefully settings.
@@ -1 +1 @@
1
- #notefully{all:initial;--nf-launcher-left: 16px;--nf-launcher-bottom: 16px;--nf-radius: 10px;--nf-z: 2147483000;--nf-accent: #864093;--nf-accent-text: #ffffff;--nf-accent-hot: #e83590;--nf-btn: #864093;--nf-btn-border: #382c74;--nf-btn-text: #ffffff;--nf-panel: #f7f4fb;--nf-text: #2a2140;--nf-muted: rgba(42, 33, 64, .72);--nf-input: #efe8f8;--nf-border: rgba(56, 44, 116, .18);--nf-backdrop: rgba(20, 12, 28, .55);--nf-danger: #e83590;--nf-success: #1a7a3c;--nf-fail: #c2185b;--nf-mark: #fdd341;--nf-mark-text: #2a2140;--nf-canvas-bg: #111;font-family:ui-sans-serif,system-ui,sans-serif;color:var(--nf-text)}#notefully[data-theme=maker]{--nf-accent: #864093;--nf-accent-text: #ffffff;--nf-accent-hot: #e83590;--nf-btn: #864093;--nf-btn-border: #382c74;--nf-btn-text: #ffffff;--nf-panel: #f7f4fb;--nf-text: #2a2140;--nf-muted: rgba(42, 33, 64, .72);--nf-input: #efe8f8;--nf-border: rgba(56, 44, 116, .18);--nf-backdrop: rgba(20, 12, 28, .55);--nf-danger: #e83590;--nf-success: #1a7a3c;--nf-fail: #c2185b;--nf-mark: #fdd341;--nf-mark-text: #2a2140}#notefully[data-theme=all-business]{--nf-accent: #5c6570;--nf-accent-text: #ffffff;--nf-accent-hot: #8a4a4a;--nf-btn: #5c6570;--nf-btn-border: #3a4048;--nf-btn-text: #ffffff;--nf-panel: #ffffff;--nf-text: #1f1f23;--nf-muted: rgba(31, 31, 35, .68);--nf-input: #f0f0f2;--nf-border: rgba(0, 0, 0, .14);--nf-backdrop: rgba(20, 20, 24, .4);--nf-danger: #8a4a4a;--nf-success: #1f7a3a;--nf-fail: #b42318;--nf-mark: #3d6ea8;--nf-mark-text: #ffffff}#notefully[data-theme=brighter-day]{--nf-accent: #5aa8dc;--nf-accent-text: #ffffff;--nf-accent-hot: #f08ab8;--nf-btn: #5aa8dc;--nf-btn-border: #3d7eae;--nf-btn-text: #ffffff;--nf-panel: #fffdf6;--nf-text: #2a2440;--nf-muted: rgba(42, 36, 64, .68);--nf-input: #ffeef5;--nf-border: rgba(90, 168, 220, .28);--nf-backdrop: rgba(60, 40, 70, .35);--nf-danger: #f08ab8;--nf-success: #1f7a3a;--nf-fail: #c4476a;--nf-mark: #5aa8dc;--nf-mark-text: #ffffff}#notefully[data-theme=quiet-night]{--nf-accent: #c4aa5a;--nf-accent-text: #121416;--nf-accent-hot: #6e3a3a;--nf-btn: #3a4048;--nf-btn-border: #0e1012;--nf-btn-text: #d8dbe0;--nf-panel: #1c1f24;--nf-text: #d8dbe0;--nf-muted: rgba(216, 219, 224, .68);--nf-input: #262a30;--nf-border: rgba(255, 255, 255, .12);--nf-backdrop: rgba(0, 0, 0, .65);--nf-danger: #c88888;--nf-success: #7dcea0;--nf-fail: #e89898;--nf-mark: #c4aa5a;--nf-mark-text: #121416}#notefully *{box-sizing:border-box}#notefully .nf-launcher{position:fixed;left:var(--nf-launcher-left);bottom:var(--nf-launcher-bottom);z-index:var(--nf-z);width:48px;height:48px;padding:0;display:grid;place-items:center;background:var(--nf-btn);color:var(--nf-btn-text);border:1px solid var(--nf-btn-border);border-radius:999px;cursor:pointer;box-shadow:0 8px 24px #00000040}#notefully .nf-launcher-icon{width:22px;height:22px;display:block}#notefully .nf-launcher[hidden],#notefully .nf-dialog[hidden],#notefully .nf-stop-video[hidden],#notefully .nf-stage[hidden],#notefully .nf-palette[hidden],#notefully .nf-reset-crop[hidden],#notefully .nf-restore[hidden],#notefully .nf-discard-shot[hidden],#notefully .nf-recapture[hidden],#notefully .nf-video[hidden],#notefully .nf-author[hidden]{display:none!important}#notefully .nf-dialog{position:fixed;top:0;right:0;bottom:0;left:0;z-index:var(--nf-z);background:var(--nf-backdrop);display:flex;align-items:center;justify-content:center;padding:24px}#notefully .nf-panel{width:min(920px,100%);max-height:calc(100vh - 48px);overflow:auto;background:var(--nf-panel);color:var(--nf-text);border:1px solid var(--nf-border);border-radius:var(--nf-radius);padding:16px;display:flex;flex-direction:column;gap:12px}#notefully .nf-panel-body{display:flex;flex-direction:column;gap:12px;min-height:0}#notefully .nf-panel-body[hidden]{display:none!important}#notefully .nf-success-msg{margin:0;text-align:center;font:700 1.35rem/1.2 ui-sans-serif,system-ui,sans-serif;letter-spacing:.01em;color:var(--nf-success)}#notefully .nf-success-msg[hidden]{display:none!important}#notefully .nf-dialog.nf-success{pointer-events:none}#notefully .nf-dialog.nf-success .nf-panel{width:auto;min-width:11rem;max-width:min(280px,90vw);max-height:none;overflow:hidden;padding:1.75rem 2.35rem;align-items:center;justify-content:center;gap:0}@media(prefers-reduced-motion:reduce){#notefully .nf-dialog.nf-success .nf-panel{transform:none!important;transition:none!important}}#notefully .nf-stage{display:flex;flex-direction:column;gap:8px}#notefully .nf-palette{display:flex;flex-wrap:wrap;gap:8px;align-items:center}#notefully .nf-palette .nf-discard-shot{margin-left:auto}#notefully .nf-tool,#notefully .nf-reset-crop,#notefully .nf-icon-btn{background:var(--nf-input);color:var(--nf-text);border:1px solid var(--nf-border);border-radius:8px;padding:6px 10px;cursor:pointer;font:13px ui-sans-serif,system-ui,sans-serif}#notefully .nf-icon-btn{width:36px;height:36px;padding:0;display:grid;place-items:center;flex:0 0 36px}#notefully .nf-icon{width:18px;height:18px;display:block}#notefully .nf-tool[data-active=true],#notefully .nf-icon-btn[data-active=true]{border-color:var(--nf-accent);color:var(--nf-accent);box-shadow:inset 0 0 0 1px var(--nf-accent)}#notefully .nf-canvas{position:relative;width:min(100%,calc(48vh * var(--nf-shot-aspect, 16 / 9)));max-height:48vh;aspect-ratio:var(--nf-shot-aspect, auto);margin-inline:auto;background:var(--nf-canvas-bg);border-radius:8px;overflow:hidden;-webkit-user-select:none;user-select:none;touch-action:none}#notefully .nf-canvas[data-draw=true],#notefully .nf-canvas[data-draw=true] .nf-shot{cursor:crosshair}#notefully .nf-sticker{cursor:grab}#notefully .nf-sticker[data-preview=true]{cursor:crosshair}#notefully .nf-sticker.nf-arrow .nf-arrow-hit{cursor:grab}#notefully[data-grabbing=true] .nf-canvas,#notefully[data-grabbing=true] .nf-shot,#notefully[data-grabbing=true] .nf-sticker,#notefully[data-grabbing=true] .nf-sticker *{cursor:grabbing}#notefully .nf-shot{position:absolute;overflow:hidden;--nf-anno-stroke: 3px;--nf-anno-badge: 20px;--nf-anno-badge-font: 11px;--nf-anno-handle: 10px}#notefully .nf-shot img{position:absolute;display:block;max-height:none;pointer-events:none;-webkit-user-drag:none;user-drag:none}#notefully .nf-canvas video.nf-recording-preview{display:block;width:160px;height:auto;max-height:none;object-fit:contain;pointer-events:auto}#notefully .nf-sticker,#notefully .nf-crop{position:absolute;pointer-events:auto;color:var(--nf-mark)}#notefully .nf-sticker[data-selected=true]{z-index:4}#notefully .nf-sticker[data-preview=true],#notefully .nf-sticker.nf-arrow{pointer-events:none}#notefully .nf-sticker.nf-arrow .nf-handle{pointer-events:auto}#notefully .nf-rect,#notefully .nf-circle{border:var(--nf-anno-stroke) solid var(--nf-mark);background:transparent;box-sizing:border-box}#notefully .nf-circle{border-radius:50%}#notefully .nf-arrow-svg{display:block;overflow:visible;pointer-events:none}#notefully .nf-arrow-hit{fill:none;stroke:transparent;stroke-width:16;pointer-events:stroke}#notefully .nf-arrow-shaft{fill:none;stroke:currentColor;stroke-width:var(--nf-anno-stroke);stroke-linecap:round;pointer-events:none}#notefully .nf-arrow-head{fill:currentColor;stroke:none;pointer-events:none}#notefully .nf-badge{position:absolute;left:50%;top:0;transform:translate(-50%,-50%);box-sizing:border-box;min-width:var(--nf-anno-badge);height:var(--nf-anno-badge);padding:0 calc(var(--nf-anno-badge-font) * .35);border-radius:50%;background:var(--nf-mark);color:var(--nf-mark-text);font:700 var(--nf-anno-badge-font)/var(--nf-anno-badge) ui-sans-serif,system-ui,sans-serif;text-align:center;pointer-events:none;z-index:4}#notefully .nf-sticker.nf-arrow .nf-badge{top:50%}#notefully .nf-handle{position:absolute;width:var(--nf-anno-handle);height:var(--nf-anno-handle);background:#fff;border:2px solid var(--nf-mark);border-radius:2px;z-index:5;box-sizing:border-box}#notefully .nf-handle[data-dir=nw]{left:-6px;top:-6px;cursor:nwse-resize}#notefully .nf-handle[data-dir=ne]{right:-6px;top:-6px;cursor:nesw-resize}#notefully .nf-handle[data-dir=sw]{left:-6px;bottom:-6px;cursor:nesw-resize}#notefully .nf-handle[data-dir=se]{right:-6px;bottom:-6px;cursor:nwse-resize}#notefully .nf-handle[data-dir=start],#notefully .nf-handle[data-dir=end]{margin:0;cursor:grab}#notefully .nf-crop{border:2px dashed var(--nf-accent);background:color-mix(in srgb,var(--nf-accent) 14%,transparent);box-shadow:0 0 0 9999px #00000073;pointer-events:none}#notefully .nf-text{width:100%;min-height:96px;resize:vertical;background:var(--nf-input);color:var(--nf-text);border:1px solid var(--nf-border);border-radius:8px;padding:10px;font:14px/1.4 ui-sans-serif,system-ui,sans-serif}#notefully .nf-author{width:100%;box-sizing:border-box;background:var(--nf-input);color:var(--nf-text);border:1px solid var(--nf-border);border-radius:8px;padding:10px;font:14px/1.4 ui-sans-serif,system-ui,sans-serif}#notefully .nf-author::placeholder{color:var(--nf-muted)}#notefully .nf-kind{display:flex;gap:8px}#notefully .nf-kind button{background:var(--nf-input);color:var(--nf-muted);border:1px solid var(--nf-border);border-radius:999px;padding:6px 12px;cursor:pointer}#notefully .nf-kind button[data-active=true]{color:var(--nf-accent-text);background:var(--nf-accent);border-color:var(--nf-accent)}#notefully .nf-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center}#notefully .nf-actions button{border:1px solid var(--nf-border);border-radius:8px;padding:8px 12px;cursor:pointer;font:600 13px ui-sans-serif,system-ui,sans-serif;background:var(--nf-input);color:var(--nf-text)}#notefully .nf-actions .nf-icon-btn{padding:0}#notefully .nf-submit{margin-left:auto;background:var(--nf-btn)!important;color:var(--nf-btn-text)!important;border-color:var(--nf-btn-border)!important}#notefully .nf-submit:disabled{opacity:.55;cursor:wait}#notefully .nf-status{color:var(--nf-muted);font:13px ui-sans-serif,system-ui,sans-serif;min-height:1.2em}#notefully .nf-stop-video{position:fixed;top:16px;left:50%;transform:translate(-50%);z-index:calc(var(--nf-z) + 1);background:var(--nf-danger);color:#fff;border:0;border-radius:999px;padding:10px 18px;font:700 14px ui-sans-serif,system-ui,sans-serif;cursor:pointer}#notefully[data-nf-hidden-launcher] .nf-launcher{display:none!important}.nf-capture-chrome{position:fixed;top:0;right:0;bottom:0;left:0;z-index:2147483645;display:grid;place-items:center;pointer-events:none;background:#140c1c47;animation:nf-capture-fade .16s ease-out both}.nf-capture-chrome-pill{display:inline-flex;align-items:center;gap:.55em;padding:.65em 1.1em;border-radius:999px;background:#f7f4fbf0;color:#2a2140;font:650 14px ui-sans-serif,system-ui,sans-serif;letter-spacing:.01em;box-shadow:0 10px 28px #140c1c38}.nf-capture-chrome-pill:before{content:"";width:.7em;height:.7em;border-radius:50%;border:2px solid rgba(42,33,64,.22);border-top-color:#864093;animation:nf-capture-spin .7s linear infinite}@keyframes nf-capture-fade{0%{opacity:0}to{opacity:1}}@keyframes nf-capture-spin{to{transform:rotate(360deg)}}
1
+ #notefully{all:initial;--nf-launcher-left: 16px;--nf-launcher-bottom: 16px;--nf-radius: 10px;--nf-z: 2147483000;--nf-accent: #864093;--nf-accent-text: #ffffff;--nf-accent-hot: #e83590;--nf-btn: #864093;--nf-btn-border: #382c74;--nf-btn-text: #ffffff;--nf-panel: #f7f4fb;--nf-text: #2a2140;--nf-muted: rgba(42, 33, 64, .72);--nf-input: #efe8f8;--nf-border: rgba(56, 44, 116, .18);--nf-backdrop: rgba(20, 12, 28, .55);--nf-danger: #e83590;--nf-success: #1a7a3c;--nf-fail: #c2185b;--nf-mark: #fdd341;--nf-mark-text: #2a2140;--nf-canvas-bg: #111;font-family:ui-sans-serif,system-ui,sans-serif;color:var(--nf-text)}#notefully[data-theme=maker]{--nf-accent: #864093;--nf-accent-text: #ffffff;--nf-accent-hot: #e83590;--nf-btn: #864093;--nf-btn-border: #382c74;--nf-btn-text: #ffffff;--nf-panel: #f7f4fb;--nf-text: #2a2140;--nf-muted: rgba(42, 33, 64, .72);--nf-input: #efe8f8;--nf-border: rgba(56, 44, 116, .18);--nf-backdrop: rgba(20, 12, 28, .55);--nf-danger: #e83590;--nf-success: #1a7a3c;--nf-fail: #c2185b;--nf-mark: #fdd341;--nf-mark-text: #2a2140}#notefully[data-theme=all-business]{--nf-accent: #5c6570;--nf-accent-text: #ffffff;--nf-accent-hot: #8a4a4a;--nf-btn: #5c6570;--nf-btn-border: #3a4048;--nf-btn-text: #ffffff;--nf-panel: #ffffff;--nf-text: #1f1f23;--nf-muted: rgba(31, 31, 35, .68);--nf-input: #f0f0f2;--nf-border: rgba(0, 0, 0, .14);--nf-backdrop: rgba(20, 20, 24, .4);--nf-danger: #8a4a4a;--nf-success: #1f7a3a;--nf-fail: #b42318;--nf-mark: #3d6ea8;--nf-mark-text: #ffffff}#notefully[data-theme=brighter-day]{--nf-accent: #5aa8dc;--nf-accent-text: #ffffff;--nf-accent-hot: #f08ab8;--nf-btn: #5aa8dc;--nf-btn-border: #3d7eae;--nf-btn-text: #ffffff;--nf-panel: #fffdf6;--nf-text: #2a2440;--nf-muted: rgba(42, 36, 64, .68);--nf-input: #ffeef5;--nf-border: rgba(90, 168, 220, .28);--nf-backdrop: rgba(60, 40, 70, .35);--nf-danger: #f08ab8;--nf-success: #1f7a3a;--nf-fail: #c4476a;--nf-mark: #5aa8dc;--nf-mark-text: #ffffff}#notefully[data-theme=quiet-night]{--nf-accent: #c4aa5a;--nf-accent-text: #121416;--nf-accent-hot: #6e3a3a;--nf-btn: #3a4048;--nf-btn-border: #0e1012;--nf-btn-text: #d8dbe0;--nf-panel: #1c1f24;--nf-text: #d8dbe0;--nf-muted: rgba(216, 219, 224, .68);--nf-input: #262a30;--nf-border: rgba(255, 255, 255, .12);--nf-backdrop: rgba(0, 0, 0, .65);--nf-danger: #c88888;--nf-success: #7dcea0;--nf-fail: #e89898;--nf-mark: #c4aa5a;--nf-mark-text: #121416}#notefully *{box-sizing:border-box}#notefully .nf-launcher{position:fixed;left:var(--nf-launcher-left);bottom:var(--nf-launcher-bottom);z-index:var(--nf-z);width:48px;height:48px;padding:0;display:grid;place-items:center;background:var(--nf-btn);color:var(--nf-btn-text);border:1px solid var(--nf-btn-border);border-radius:999px;cursor:pointer;box-shadow:0 8px 24px #00000040}#notefully .nf-launcher-icon{width:22px;height:22px;display:block}#notefully .nf-launcher[hidden],#notefully .nf-dialog[hidden],#notefully .nf-stop-video[hidden],#notefully .nf-stage[hidden],#notefully .nf-palette[hidden],#notefully .nf-reset-crop[hidden],#notefully .nf-restore[hidden],#notefully .nf-discard-shot[hidden],#notefully .nf-recapture[hidden],#notefully .nf-privacy[hidden],#notefully .nf-privacy-panel[hidden],#notefully .nf-privacy-text[hidden],#notefully .nf-video[hidden],#notefully .nf-author[hidden]{display:none!important}#notefully .nf-dialog{position:fixed;top:0;right:0;bottom:0;left:0;z-index:var(--nf-z);background:var(--nf-backdrop);display:flex;align-items:center;justify-content:center;padding:24px}#notefully .nf-panel{width:min(920px,100%);max-height:calc(100vh - 48px);overflow:auto;background:var(--nf-panel);color:var(--nf-text);border:1px solid var(--nf-border);border-radius:var(--nf-radius);padding:16px;display:flex;flex-direction:column;gap:12px}#notefully .nf-panel-body{display:flex;flex-direction:column;gap:12px;min-height:0}#notefully .nf-panel-body[hidden]{display:none!important}#notefully .nf-success-msg{margin:0;text-align:center;font:700 1.35rem/1.2 ui-sans-serif,system-ui,sans-serif;letter-spacing:.01em;color:var(--nf-success)}#notefully .nf-success-msg[hidden]{display:none!important}#notefully .nf-dialog.nf-success{pointer-events:none}#notefully .nf-dialog.nf-success .nf-panel{width:auto;min-width:11rem;max-width:min(280px,90vw);max-height:none;overflow:hidden;padding:1.75rem 2.35rem;align-items:center;justify-content:center;gap:0}@media(prefers-reduced-motion:reduce){#notefully .nf-dialog.nf-success .nf-panel{transform:none!important;transition:none!important}}#notefully .nf-stage{display:flex;flex-direction:column;gap:8px}#notefully .nf-palette{display:flex;flex-wrap:wrap;gap:8px;align-items:center}#notefully .nf-palette .nf-discard-shot{margin-left:auto}#notefully .nf-tool,#notefully .nf-reset-crop,#notefully .nf-icon-btn{background:var(--nf-input);color:var(--nf-text);border:1px solid var(--nf-border);border-radius:8px;padding:6px 10px;cursor:pointer;font:13px ui-sans-serif,system-ui,sans-serif}#notefully .nf-icon-btn{width:36px;height:36px;padding:0;display:grid;place-items:center;flex:0 0 36px}#notefully .nf-icon{width:18px;height:18px;display:block}#notefully .nf-tool[data-active=true],#notefully .nf-icon-btn[data-active=true]{border-color:var(--nf-accent);color:var(--nf-accent);box-shadow:inset 0 0 0 1px var(--nf-accent)}#notefully .nf-canvas{position:relative;width:min(100%,calc(48vh * var(--nf-shot-aspect, 16 / 9)));max-height:48vh;aspect-ratio:var(--nf-shot-aspect, auto);margin-inline:auto;background:var(--nf-canvas-bg);border-radius:8px;overflow:hidden;-webkit-user-select:none;user-select:none;touch-action:none}#notefully .nf-canvas[data-draw=true],#notefully .nf-canvas[data-draw=true] .nf-shot{cursor:crosshair}#notefully .nf-sticker{cursor:grab}#notefully .nf-sticker[data-preview=true]{cursor:crosshair}#notefully .nf-sticker.nf-arrow .nf-arrow-hit{cursor:grab}#notefully[data-grabbing=true] .nf-canvas,#notefully[data-grabbing=true] .nf-shot,#notefully[data-grabbing=true] .nf-sticker,#notefully[data-grabbing=true] .nf-sticker *{cursor:grabbing}#notefully .nf-shot{position:absolute;overflow:hidden;--nf-anno-stroke: 3px;--nf-anno-badge: 20px;--nf-anno-badge-font: 11px;--nf-anno-handle: 10px}#notefully .nf-shot img{position:absolute;display:block;max-height:none;pointer-events:none;-webkit-user-drag:none;user-drag:none}#notefully .nf-canvas video.nf-recording-preview{display:block;width:160px;height:auto;max-height:none;object-fit:contain;pointer-events:auto}#notefully .nf-sticker,#notefully .nf-crop{position:absolute;pointer-events:auto;color:var(--nf-mark)}#notefully .nf-sticker[data-selected=true]{z-index:4}#notefully .nf-sticker[data-preview=true],#notefully .nf-sticker.nf-arrow{pointer-events:none}#notefully .nf-sticker.nf-arrow .nf-handle{pointer-events:auto}#notefully .nf-rect,#notefully .nf-circle{border:var(--nf-anno-stroke) solid var(--nf-mark);background:transparent;box-sizing:border-box}#notefully .nf-circle{border-radius:50%}#notefully .nf-arrow-svg{display:block;overflow:visible;pointer-events:none}#notefully .nf-arrow-hit{fill:none;stroke:transparent;stroke-width:16;pointer-events:stroke}#notefully .nf-arrow-shaft{fill:none;stroke:currentColor;stroke-width:var(--nf-anno-stroke);stroke-linecap:round;pointer-events:none}#notefully .nf-arrow-head{fill:currentColor;stroke:none;pointer-events:none}#notefully .nf-badge{position:absolute;left:50%;top:0;transform:translate(-50%,-50%);box-sizing:border-box;min-width:var(--nf-anno-badge);height:var(--nf-anno-badge);padding:0 calc(var(--nf-anno-badge-font) * .35);border-radius:50%;background:var(--nf-mark);color:var(--nf-mark-text);font:700 var(--nf-anno-badge-font)/var(--nf-anno-badge) ui-sans-serif,system-ui,sans-serif;text-align:center;pointer-events:none;z-index:4}#notefully .nf-sticker.nf-arrow .nf-badge{top:50%}#notefully .nf-handle{position:absolute;width:var(--nf-anno-handle);height:var(--nf-anno-handle);background:#fff;border:2px solid var(--nf-mark);border-radius:2px;z-index:5;box-sizing:border-box}#notefully .nf-handle[data-dir=nw]{left:-6px;top:-6px;cursor:nwse-resize}#notefully .nf-handle[data-dir=ne]{right:-6px;top:-6px;cursor:nesw-resize}#notefully .nf-handle[data-dir=sw]{left:-6px;bottom:-6px;cursor:nesw-resize}#notefully .nf-handle[data-dir=se]{right:-6px;bottom:-6px;cursor:nwse-resize}#notefully .nf-handle[data-dir=start],#notefully .nf-handle[data-dir=end]{margin:0;cursor:grab}#notefully .nf-crop{border:2px dashed var(--nf-accent);background:color-mix(in srgb,var(--nf-accent) 14%,transparent);box-shadow:0 0 0 9999px #00000073;pointer-events:none}#notefully .nf-text{width:100%;min-height:96px;resize:vertical;background:var(--nf-input);color:var(--nf-text);border:1px solid var(--nf-border);border-radius:8px;padding:10px;font:14px/1.4 ui-sans-serif,system-ui,sans-serif}#notefully .nf-author{width:100%;box-sizing:border-box;background:var(--nf-input);color:var(--nf-text);border:1px solid var(--nf-border);border-radius:8px;padding:10px;font:14px/1.4 ui-sans-serif,system-ui,sans-serif}#notefully .nf-author::placeholder{color:var(--nf-muted)}#notefully .nf-kind{display:flex;gap:8px}#notefully .nf-kind button{background:var(--nf-input);color:var(--nf-muted);border:1px solid var(--nf-border);border-radius:999px;padding:6px 12px;cursor:pointer}#notefully .nf-kind button[data-active=true]{color:var(--nf-accent-text);background:var(--nf-accent);border-color:var(--nf-accent)}#notefully .nf-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center}#notefully .nf-privacy{display:flex;flex-direction:column;gap:8px}#notefully .nf-privacy-summary{display:flex;flex-wrap:wrap;justify-content:flex-end;align-items:center;gap:8px}#notefully .nf-privacy-text{color:var(--nf-muted);font:12px/1.35 ui-sans-serif,system-ui,sans-serif;text-align:right}#notefully .nf-privacy-done{background:transparent;color:var(--nf-accent);border:0;padding:0;margin:0;cursor:pointer;font:600 12px ui-sans-serif,system-ui,sans-serif;text-decoration:underline;text-underline-offset:2px}#notefully .nf-privacy-done:hover{color:var(--nf-accent-hot)}#notefully .nf-privacy-panel{display:flex;flex-direction:column;gap:8px;border:1px solid var(--nf-border);border-radius:8px;background:var(--nf-input);padding:10px}#notefully .nf-privacy-scroll{max-height:min(240px,36vh);overflow:auto;display:flex;flex-direction:column;gap:12px}#notefully .nf-privacy-section-head{display:flex;align-items:center;gap:8px;margin-bottom:6px}#notefully .nf-privacy-section-title{margin:0;font:600 12px ui-sans-serif,system-ui,sans-serif;color:var(--nf-text)}#notefully .nf-privacy-toggle{margin-left:auto;display:inline-flex;align-items:center;gap:6px;cursor:pointer;color:var(--nf-muted);font:11px ui-sans-serif,system-ui,sans-serif;-webkit-user-select:none;user-select:none}#notefully .nf-privacy-toggle input{margin:0;accent-color:var(--nf-accent)}#notefully .nf-privacy-rows{display:flex;flex-direction:column;gap:6px}#notefully .nf-privacy-row{display:flex;align-items:flex-start;gap:8px;padding:6px 8px;border-radius:6px;background:var(--nf-panel);border:1px solid var(--nf-border)}#notefully .nf-privacy-row-text{min-width:0;flex:1}#notefully .nf-privacy-row-title{font:600 11px ui-sans-serif,system-ui,sans-serif;color:var(--nf-text);text-transform:capitalize}#notefully .nf-privacy-row-detail{margin-top:2px;font:11px/1.35 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;color:var(--nf-muted);word-break:break-word;white-space:pre-wrap}#notefully .nf-privacy-done{align-self:flex-end}#notefully .nf-actions button{border:1px solid var(--nf-border);border-radius:8px;padding:8px 12px;cursor:pointer;font:600 13px ui-sans-serif,system-ui,sans-serif;background:var(--nf-input);color:var(--nf-text)}#notefully .nf-actions .nf-icon-btn{padding:0}#notefully .nf-submit{margin-left:auto;background:var(--nf-btn)!important;color:var(--nf-btn-text)!important;border-color:var(--nf-btn-border)!important}#notefully .nf-submit:disabled{opacity:.55;cursor:wait}#notefully .nf-status{color:var(--nf-muted);font:13px ui-sans-serif,system-ui,sans-serif;min-height:1.2em}#notefully .nf-stop-video{position:fixed;top:16px;left:50%;transform:translate(-50%);z-index:calc(var(--nf-z) + 1);background:var(--nf-danger);color:#fff;border:0;border-radius:999px;padding:10px 18px;font:700 14px ui-sans-serif,system-ui,sans-serif;cursor:pointer}#notefully[data-nf-hidden-launcher] .nf-launcher{display:none!important}.nf-capture-chrome{position:fixed;top:0;right:0;bottom:0;left:0;z-index:2147483645;display:grid;place-items:center;pointer-events:none;background:#140c1c47;animation:nf-capture-fade .16s ease-out both}.nf-capture-chrome-pill{display:inline-flex;align-items:center;gap:.55em;padding:.65em 1.1em;border-radius:999px;background:#f7f4fbf0;color:#2a2140;font:650 14px ui-sans-serif,system-ui,sans-serif;letter-spacing:.01em;box-shadow:0 10px 28px #140c1c38}.nf-capture-chrome-pill:before{content:"";width:.7em;height:.7em;border-radius:50%;border:2px solid rgba(42,33,64,.22);border-top-color:#864093;animation:nf-capture-spin .7s linear infinite}@keyframes nf-capture-fade{0%{opacity:0}to{opacity:1}}@keyframes nf-capture-spin{to{transform:rotate(360deg)}}
@@ -1,33 +1,43 @@
1
- var Notefully=(function(C){"use strict";function _e(t,e){if(t.match(/^[a-z]+:\/\//i))return t;if(t.match(/^\/\//))return window.location.protocol+t;if(t.match(/^[a-z]+:/i))return t;const n=document.implementation.createHTMLDocument(),r=n.createElement("base"),a=n.createElement("a");return n.head.appendChild(r),n.body.appendChild(a),e&&(r.href=e),a.href=t,a.href}const Ve=(()=>{let t=0;const e=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(t+=1,`u${e()}${t}`)})();function O(t){const e=[];for(let n=0,r=t.length;n<r;n++)e.push(t[n]);return e}let W=null;function Vt(t={}){return W||(t.includeStyleProperties?(W=t.includeStyleProperties,W):(W=O(window.getComputedStyle(document.documentElement)),W))}function rt(t,e){const r=(t.ownerDocument.defaultView||window).getComputedStyle(t).getPropertyValue(e);return r?parseFloat(r.replace("px","")):0}function We(t){const e=rt(t,"border-left-width"),n=rt(t,"border-right-width");return t.clientWidth+e+n}function ze(t){const e=rt(t,"border-top-width"),n=rt(t,"border-bottom-width");return t.clientHeight+e+n}function Wt(t,e={}){const n=e.width||We(t),r=e.height||ze(t);return{width:n,height:r}}function qe(){let t,e;try{e=process}catch{}const n=e&&e.env?e.env.devicePixelRatio:null;return n&&(t=parseInt(n,10),Number.isNaN(t)&&(t=1)),t||window.devicePixelRatio||1}const E=16384;function Ke(t){(t.width>E||t.height>E)&&(t.width>E&&t.height>E?t.width>t.height?(t.height*=E/t.width,t.width=E):(t.width*=E/t.height,t.height=E):t.width>E?(t.height*=E/t.width,t.width=E):(t.width*=E/t.height,t.height=E))}function it(t){return new Promise((e,n)=>{const r=new Image;r.onload=()=>{r.decode().then(()=>{requestAnimationFrame(()=>e(r))})},r.onerror=n,r.crossOrigin="anonymous",r.decoding="async",r.src=t})}async function Xe(t){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(t)).then(encodeURIComponent).then(e=>`data:image/svg+xml;charset=utf-8,${e}`)}async function Ye(t,e,n){const r="http://www.w3.org/2000/svg",a=document.createElementNS(r,"svg"),i=document.createElementNS(r,"foreignObject");return a.setAttribute("width",`${e}`),a.setAttribute("height",`${n}`),a.setAttribute("viewBox",`0 0 ${e} ${n}`),i.setAttribute("width","100%"),i.setAttribute("height","100%"),i.setAttribute("x","0"),i.setAttribute("y","0"),i.setAttribute("externalResourcesRequired","true"),a.appendChild(i),i.appendChild(t),Xe(a)}const x=(t,e)=>{if(t instanceof e)return!0;const n=Object.getPrototypeOf(t);return n===null?!1:n.constructor.name===e.name||x(n,e)};function Ge(t){const e=t.getPropertyValue("content");return`${t.cssText} content: '${e.replace(/'|"/g,"")}';`}function Je(t,e){return Vt(e).map(n=>{const r=t.getPropertyValue(n),a=t.getPropertyPriority(n);return`${n}: ${r}${a?" !important":""};`}).join(" ")}function Qe(t,e,n,r){const a=`.${t}:${e}`,i=n.cssText?Ge(n):Je(n,r);return document.createTextNode(`${a}{${i}}`)}function zt(t,e,n,r){const a=window.getComputedStyle(t,n),i=a.getPropertyValue("content");if(i===""||i==="none")return;const o=Ve();try{e.className=`${e.className} ${o}`}catch{return}const c=document.createElement("style");c.appendChild(Qe(o,n,a,r)),e.appendChild(c)}function Ze(t,e,n){zt(t,e,":before",n),zt(t,e,":after",n)}const qt="application/font-woff",Kt="image/jpeg",tn={woff:qt,woff2:qt,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:Kt,jpeg:Kt,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function en(t){const e=/\.([^./]*?)$/g.exec(t);return e?e[1]:""}function yt(t){const e=en(t).toLowerCase();return tn[e]||""}function nn(t){return t.split(/,/)[1]}function gt(t){return t.search(/^(data:)/)!==-1}function rn(t,e){return`data:${e};base64,${t}`}async function Xt(t,e,n){const r=await fetch(t,e);if(r.status===404)throw new Error(`Resource "${r.url}" not found`);const a=await r.blob();return new Promise((i,o)=>{const c=new FileReader;c.onerror=o,c.onloadend=()=>{try{i(n({res:r,result:c.result}))}catch(l){o(l)}},c.readAsDataURL(a)})}const wt={};function an(t,e,n){let r=t.replace(/\?.*/,"");return n&&(r=t),/ttf|otf|eot|woff2?/i.test(r)&&(r=r.replace(/.*\//,"")),e?`[${e}]${r}`:r}async function bt(t,e,n){const r=an(t,e,n.includeQueryParams);if(wt[r]!=null)return wt[r];n.cacheBust&&(t+=(/\?/.test(t)?"&":"?")+new Date().getTime());let a;try{const i=await Xt(t,n.fetchRequestInit,({res:o,result:c})=>(e||(e=o.headers.get("Content-Type")||""),nn(c)));a=rn(i,e)}catch(i){a=n.imagePlaceholder||"";let o=`Failed to fetch resource: ${t}`;i&&(o=typeof i=="string"?i:i.message),o&&console.warn(o)}return wt[r]=a,a}async function on(t){const e=t.toDataURL();return e==="data:,"?t.cloneNode(!1):it(e)}async function sn(t,e){if(t.currentSrc){const i=document.createElement("canvas"),o=i.getContext("2d");i.width=t.clientWidth,i.height=t.clientHeight,o==null||o.drawImage(t,0,0,i.width,i.height);const c=i.toDataURL();return it(c)}const n=t.poster,r=yt(n),a=await bt(n,r,e);return it(a)}async function cn(t,e){var n;try{if(!((n=t==null?void 0:t.contentDocument)===null||n===void 0)&&n.body)return await at(t.contentDocument.body,e,!0)}catch{}return t.cloneNode(!1)}async function ln(t,e){return x(t,HTMLCanvasElement)?on(t):x(t,HTMLVideoElement)?sn(t,e):x(t,HTMLIFrameElement)?cn(t,e):t.cloneNode(Yt(t))}const un=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SLOT",Yt=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SVG";async function dn(t,e,n){var r,a;if(Yt(e))return e;let i=[];return un(t)&&t.assignedNodes?i=O(t.assignedNodes()):x(t,HTMLIFrameElement)&&(!((r=t.contentDocument)===null||r===void 0)&&r.body)?i=O(t.contentDocument.body.childNodes):i=O(((a=t.shadowRoot)!==null&&a!==void 0?a:t).childNodes),i.length===0||x(t,HTMLVideoElement)||await i.reduce((o,c)=>o.then(()=>at(c,n)).then(l=>{l&&e.appendChild(l)}),Promise.resolve()),e}function fn(t,e,n){const r=e.style;if(!r)return;const a=window.getComputedStyle(t);a.cssText?(r.cssText=a.cssText,r.transformOrigin=a.transformOrigin):Vt(n).forEach(i=>{let o=a.getPropertyValue(i);i==="font-size"&&o.endsWith("px")&&(o=`${Math.floor(parseFloat(o.substring(0,o.length-2)))-.1}px`),x(t,HTMLIFrameElement)&&i==="display"&&o==="inline"&&(o="block"),i==="d"&&e.getAttribute("d")&&(o=`path(${e.getAttribute("d")})`),r.setProperty(i,o,a.getPropertyPriority(i))})}function hn(t,e){x(t,HTMLTextAreaElement)&&(e.innerHTML=t.value),x(t,HTMLInputElement)&&e.setAttribute("value",t.value)}function pn(t,e){if(x(t,HTMLSelectElement)){const r=Array.from(e.children).find(a=>t.value===a.getAttribute("value"));r&&r.setAttribute("selected","")}}function mn(t,e,n){return x(e,Element)&&(fn(t,e,n),Ze(t,e,n),hn(t,e),pn(t,e)),e}async function yn(t,e){const n=t.querySelectorAll?t.querySelectorAll("use"):[];if(n.length===0)return t;const r={};for(let i=0;i<n.length;i++){const c=n[i].getAttribute("xlink:href");if(c){const l=t.querySelector(c),u=document.querySelector(c);!l&&u&&!r[c]&&(r[c]=await at(u,e,!0))}}const a=Object.values(r);if(a.length){const i="http://www.w3.org/1999/xhtml",o=document.createElementNS(i,"svg");o.setAttribute("xmlns",i),o.style.position="absolute",o.style.width="0",o.style.height="0",o.style.overflow="hidden",o.style.display="none";const c=document.createElementNS(i,"defs");o.appendChild(c);for(let l=0;l<a.length;l++)c.appendChild(a[l]);t.appendChild(o)}return t}async function at(t,e,n){return!n&&e.filter&&!e.filter(t)?null:Promise.resolve(t).then(r=>ln(r,e)).then(r=>dn(t,r,e)).then(r=>mn(t,r,e)).then(r=>yn(r,e))}const Gt=/url\((['"]?)([^'"]+?)\1\)/g,gn=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,wn=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function bn(t){const e=t.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`,"g")}function Sn(t){const e=[];return t.replace(Gt,(n,r,a)=>(e.push(a),n)),e.filter(n=>!gt(n))}async function vn(t,e,n,r,a){try{const i=n?_e(e,n):e,o=yt(e);let c;return a||(c=await bt(i,o,r)),t.replace(bn(e),`$1${c}$3`)}catch{}return t}function xn(t,{preferredFontFormat:e}){return e?t.replace(wn,n=>{for(;;){const[r,,a]=gn.exec(n)||[];if(!a)return"";if(a===e)return`src: ${r};`}}):t}function Jt(t){return t.search(Gt)!==-1}async function Qt(t,e,n){if(!Jt(t))return t;const r=xn(t,n);return Sn(r).reduce((i,o)=>i.then(c=>vn(c,o,e,n)),Promise.resolve(r))}async function z(t,e,n){var r;const a=(r=e.style)===null||r===void 0?void 0:r.getPropertyValue(t);if(a){const i=await Qt(a,null,n);return e.style.setProperty(t,i,e.style.getPropertyPriority(t)),!0}return!1}async function En(t,e){await z("background",t,e)||await z("background-image",t,e),await z("mask",t,e)||await z("-webkit-mask",t,e)||await z("mask-image",t,e)||await z("-webkit-mask-image",t,e)}async function Cn(t,e){const n=x(t,HTMLImageElement);if(!(n&&!gt(t.src))&&!(x(t,SVGImageElement)&&!gt(t.href.baseVal)))return;const r=n?t.src:t.href.baseVal,a=await bt(r,yt(r),e);await new Promise((i,o)=>{t.onload=i,t.onerror=e.onImageErrorHandler?(...l)=>{try{i(e.onImageErrorHandler(...l))}catch(u){o(u)}}:o;const c=t;c.decode&&(c.decode=i),c.loading==="lazy"&&(c.loading="eager"),n?(t.srcset="",t.src=a):t.href.baseVal=a})}async function Mn(t,e){const r=O(t.childNodes).map(a=>Zt(a,e));await Promise.all(r).then(()=>t)}async function Zt(t,e){x(t,Element)&&(await En(t,e),await Cn(t,e),await Mn(t,e))}function An(t,e){const{style:n}=t;e.backgroundColor&&(n.backgroundColor=e.backgroundColor),e.width&&(n.width=`${e.width}px`),e.height&&(n.height=`${e.height}px`);const r=e.style;return r!=null&&Object.keys(r).forEach(a=>{n[a]=r[a]}),t}const te={};async function ee(t){let e=te[t];if(e!=null)return e;const r=await(await fetch(t)).text();return e={url:t,cssText:r},te[t]=e,e}async function ne(t,e){let n=t.cssText;const r=/url\(["']?([^"')]+)["']?\)/g,i=(n.match(/url\([^)]+\)/g)||[]).map(async o=>{let c=o.replace(r,"$1");return c.startsWith("https://")||(c=new URL(c,t.url).href),Xt(c,e.fetchRequestInit,({result:l})=>(n=n.replace(o,`url(${l})`),[o,l]))});return Promise.all(i).then(()=>n)}function re(t){if(t==null)return[];const e=[],n=/(\/\*[\s\S]*?\*\/)/gi;let r=t.replace(n,"");const a=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const l=a.exec(r);if(l===null)break;e.push(l[0])}r=r.replace(a,"");const i=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,o="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",c=new RegExp(o,"gi");for(;;){let l=i.exec(r);if(l===null){if(l=c.exec(r),l===null)break;i.lastIndex=c.lastIndex}else c.lastIndex=i.lastIndex;e.push(l[0])}return e}async function Ln(t,e){const n=[],r=[];return t.forEach(a=>{if("cssRules"in a)try{O(a.cssRules||[]).forEach((i,o)=>{if(i.type===CSSRule.IMPORT_RULE){let c=o+1;const l=i.href,u=ee(l).then(f=>ne(f,e)).then(f=>re(f).forEach(p=>{try{a.insertRule(p,p.startsWith("@import")?c+=1:a.cssRules.length)}catch(y){console.error("Error inserting rule from remote css",{rule:p,error:y})}})).catch(f=>{console.error("Error loading remote css",f.toString())});r.push(u)}})}catch(i){const o=t.find(c=>c.href==null)||document.styleSheets[0];a.href!=null&&r.push(ee(a.href).then(c=>ne(c,e)).then(c=>re(c).forEach(l=>{o.insertRule(l,o.cssRules.length)})).catch(c=>{console.error("Error loading remote stylesheet",c)})),console.error("Error inlining remote css file",i)}}),Promise.all(r).then(()=>(t.forEach(a=>{if("cssRules"in a)try{O(a.cssRules||[]).forEach(i=>{n.push(i)})}catch(i){console.error(`Error while reading CSS rules from ${a.href}`,i)}}),n))}function Rn(t){return t.filter(e=>e.type===CSSRule.FONT_FACE_RULE).filter(e=>Jt(e.style.getPropertyValue("src")))}async function $n(t,e){if(t.ownerDocument==null)throw new Error("Provided element is not within a Document");const n=O(t.ownerDocument.styleSheets),r=await Ln(n,e);return Rn(r)}function ie(t){return t.trim().replace(/["']/g,"")}function Tn(t){const e=new Set;function n(r){(r.style.fontFamily||getComputedStyle(r).fontFamily).split(",").forEach(i=>{e.add(ie(i))}),Array.from(r.children).forEach(i=>{i instanceof HTMLElement&&n(i)})}return n(t),e}async function Pn(t,e){const n=await $n(t,e),r=Tn(t);return(await Promise.all(n.filter(i=>r.has(ie(i.style.fontFamily))).map(i=>{const o=i.parentStyleSheet?i.parentStyleSheet.href:null;return Qt(i.cssText,o,e)}))).join(`
2
- `)}async function kn(t,e){const n=e.fontEmbedCSS!=null?e.fontEmbedCSS:e.skipFonts?null:await Pn(t,e);if(n){const r=document.createElement("style"),a=document.createTextNode(n);r.appendChild(a),t.firstChild?t.insertBefore(r,t.firstChild):t.appendChild(r)}}async function In(t,e={}){const{width:n,height:r}=Wt(t,e),a=await at(t,e,!0);return await kn(a,e),await Zt(a,e),An(a,e),await Ye(a,n,r)}async function On(t,e={}){const{width:n,height:r}=Wt(t,e),a=await In(t,e),i=await it(a),o=document.createElement("canvas"),c=o.getContext("2d"),l=e.pixelRatio||qe(),u=e.canvasWidth||n,f=e.canvasHeight||r;return o.width=u*l,o.height=f*l,e.skipAutoScale||Ke(o),o.style.width=`${u}`,o.style.height=`${f}`,e.backgroundColor&&(c.fillStyle=e.backgroundColor,c.fillRect(0,0,o.width,o.height)),c.drawImage(i,0,0,o.width,o.height),o}async function ae(t,e={}){return(await On(t,e)).toDataURL()}const ot="data-nf-capture-chrome",Bn="data-nf-canvas-snap",Hn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==";function oe(t){return t instanceof Element&&(t.hasAttribute(ot)||t.hasAttribute("data-nf-mask-cover")||t.id==="notefully")}function Dn(){const t=[];return Array.from(document.styleSheets).forEach(e=>{try{e.cssRules}catch{try{if(e.disabled)return;e.disabled=!0,t.push(e)}catch{const n=e.ownerNode;n&&"disabled"in n&&!n.disabled&&(n.disabled=!0,t.push({node:n}))}}}),()=>{t.forEach(e=>{try{e&&e.node?e.node.disabled=!1:e&&(e.disabled=!1)}catch{}})}}function Fn(){const t=[];return document.querySelectorAll('input[type="password"], [data-notefully-mask]').forEach(n=>{const r=n.getBoundingClientRect(),a=document.createElement("div");a.setAttribute("data-nf-mask-cover","1"),a.style.cssText=["position:fixed",`left:${r.left}px`,`top:${r.top}px`,`width:${Math.max(r.width,4)}px`,`height:${Math.max(r.height,4)}px`,"background:#111","z-index:2147483646","pointer-events:none"].join(";"),document.body.appendChild(a),t.push(a)}),()=>t.forEach(n=>n.remove())}function Un(){const t=document.querySelector(`[${ot}]`);if(t)return t;const e=document.createElement("div");return e.setAttribute(ot,"1"),e.className="nf-capture-chrome",e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.innerHTML='<span class="nf-capture-chrome-pill">Capturing…</span>',document.body.appendChild(e),e}function Nn(){document.querySelectorAll(`[${ot}]`).forEach(t=>t.remove())}function St(){return new Promise(t=>{requestAnimationFrame(()=>requestAnimationFrame(t))})}function B(t){if(typeof t!="string"||!t.startsWith("data:image/"))return!1;const e=t.indexOf(",");return e>0&&e<t.length-1}function jn(){const t=document.documentElement,e=document.body,n=Math.max(window.innerWidth||0,(t==null?void 0:t.clientWidth)||0,(t==null?void 0:t.scrollWidth)||0,(e==null?void 0:e.scrollWidth)||0,1),r=Math.max(window.innerHeight||0,(t==null?void 0:t.clientHeight)||0,(t==null?void 0:t.scrollHeight)||0,(e==null?void 0:e.scrollHeight)||0,1);return{width:n,height:r}}async function _n(){const t=[],e=Array.from(document.querySelectorAll("canvas"));for(const n of e){if(n.closest("#notefully")||oe(n))continue;let r="";try{r=n.toDataURL("image/png")}catch{continue}if(!r||r==="data:,")continue;const a=document.createElement("img"),i=getComputedStyle(n);a.setAttribute(Bn,"1"),a.alt="",a.src=r,a.className=n.className,a.style.cssText=n.style.cssText,a.style.width=i.width,a.style.height=i.height,a.style.maxWidth=i.maxWidth,a.style.maxHeight=i.maxHeight,a.style.objectFit="fill",a.style.display=i.display==="inline"?"inline-block":i.display,n.replaceWith(a),t.push({canvas:n,img:a})}return await Promise.all(t.map(({img:n})=>{if(!n.complete)return new Promise(r=>{n.onload=()=>r(),n.onerror=()=>r()})})),()=>{t.forEach(({canvas:n,img:r})=>{try{r.parentNode&&r.replaceWith(n)}catch{}})}}async function Vn(t){if(!t)return null;if(typeof t=="string")return B(t)?t:null;if(typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement)try{const e=t.toDataURL("image/png");return B(e)?e:null}catch{return null}if(typeof Blob<"u"&&t instanceof Blob){const e=await Wn(t);return B(e)?e:null}return null}async function Wn(t){if(typeof FileReader=="function")return new Promise((r,a)=>{const i=new FileReader;i.onload=()=>r(String(i.result||"")),i.onerror=()=>a(i.error||new Error("Could not read capture blob")),i.readAsDataURL(t)});const e=Buffer.from(await t.arrayBuffer());return`data:${t.type||"application/octet-stream"};base64,${e.toString("base64")}`}async function zn(){var e;if(!((e=navigator.mediaDevices)!=null&&e.getDisplayMedia))throw new Error("Screen capture is not supported in this browser.");const t=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:"browser"},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include"});try{const n=document.createElement("video");n.muted=!0,n.playsInline=!0,n.srcObject=t,await n.play(),n.videoWidth||await new Promise(c=>{n.onloadedmetadata=()=>c()}),await St();const r=n.videoWidth||1,a=n.videoHeight||1,i=document.createElement("canvas");i.width=r,i.height=a,i.getContext("2d").drawImage(n,0,0,r,a);const o=i.toDataURL("image/png");if(!B(o))throw new Error("Screen capture produced an empty image.");return o}finally{t.getTracks().forEach(n=>n.stop())}}async function se(t={}){const e=document.getElementById("notefully"),n=e?e.style.display:"",r=Un(),a=Dn();let i=()=>{};e&&(e.style.display="none");const o=Fn();try{if(typeof t.onBeforeCapture=="function"&&await t.onBeforeCapture(),await St(),typeof t.capture=="function"){const p=await Vn(await t.capture());if(p)return p}i=await _n(),await St();const{width:c,height:l}=jn(),u={cacheBust:!0,width:c,height:l,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:p=>!oe(p),imagePlaceholder:Hn,onImageErrorHandler:()=>{}};let f="";try{f=await ae(document.body,u)}catch{f=await ae(document.body,{...u,skipFonts:!0})}if(!B(f))throw new Error("Screenshot capture produced an empty image.");return f}finally{try{i()}catch{}o(),a(),r.remove(),Nn(),e&&(e.style.display=n)}}function qn(t=""){const e=String(t||"");return e?/Windows NT/i.test(e)?"Windows":/iPhone|iPad|iPod/i.test(e)?"iOS":/Mac OS X|Macintosh/i.test(e)?"macOS":/Android/i.test(e)?"Android":/CrOS/i.test(e)?"ChromeOS":/Linux/i.test(e)?"Linux":"Other":""}function Kn(t=""){const e=String(t||"");return e?/Edg\//i.test(e)?"Edge":/OPR\/|Opera/i.test(e)?"Opera":/Firefox\//i.test(e)?"Firefox":/Chrome\//i.test(e)||/CriOS\//i.test(e)?"Chrome":/Safari\//i.test(e)?"Safari":"Other":""}function Xn(t={}){const e=navigator.userAgent;return{url:location.href,title:document.title,userAgent:e,os:qn(e),browser:Kn(e),language:navigator.language,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,viewport:{width:window.innerWidth,height:window.innerHeight,dpr:window.devicePixelRatio||1},user:{userId:t.userId||null,email:t.email||null,displayName:t.displayName||null}}}const ce=new Set(["userId","email","displayName"]),le={id:"userId",username:"displayName",name:"displayName"},ue=new Set(["endpoint","projectKey","version","name","targets","hideLauncher","theme","video","consoleLogLimit","kinds","capture","onBeforeCapture"]),de={slug:"Use init({ name }) for a per-app report prefix (same idea as package.json name). slug is not a widget option.",projectSlug:"Use init({ name }) for a per-app report prefix. projectSlug is not a widget option.",project:"Pass projectKey (nfk_…) from Showfully Notefully settings — there is no project option on the widget.",username:"Pass people via Notefully.identify({ displayName }) (username is an identify alias), not init().",userId:"Pass people via Notefully.identify({ userId, email, displayName }), not init().",email:"Pass people via Notefully.identify({ userId, email, displayName }), not init().",displayName:"Pass people via Notefully.identify({ userId, email, displayName }), not init()."};function Yn(t={},e={}){const n=e.warn||fe,r=t&&typeof t=="object"?t:{},a={},i=[];for(const o of ce)Object.prototype.hasOwnProperty.call(r,o)&&(a[o]=r[o]);for(const[o,c]of Object.entries(le))Object.prototype.hasOwnProperty.call(r,o)&&(Object.prototype.hasOwnProperty.call(a,c)||(a[c]=r[o]));for(const o of Object.keys(r))ce.has(o)||Object.prototype.hasOwnProperty.call(le,o)||i.push(o);if(i.length){const o=i.some(c=>c==="name"||c==="slug"||c==="projectSlug")?" Pass the package/report name via Notefully.init({ name }), not identify().":"";n(`Notefully.identify: ignoring unknown key(s): ${i.join(", ")}. Supported: userId, email, displayName (aliases: id → userId; username/name → displayName).`+o)}return a}function Gn(t={},e={}){const n=e.warn||fe,r=t&&typeof t=="object"?t:{},a=Object.keys(r).filter(i=>!ue.has(i));if(a.length)for(const i of a){if(de[i]){n(`Notefully.init: ignoring "${i}". ${de[i]}`);continue}n(`Notefully.init: ignoring unknown key "${i}". Supported: ${[...ue].join(", ")}.`)}}function fe(t){typeof console<"u"&&typeof console.warn=="function"&&console.warn(t)}const Jn=80;function Qn(){const t=[],e={};let n=!1;const r=(i,o)=>{let c="";try{c=o.map(l=>l instanceof Error?l.stack||l.message:typeof l=="string"?l:JSON.stringify(l)).join(" ")}catch{c=String(o[0])}t.push({level:i,text:c.slice(0,2e3),at:Date.now()}),t.length>Jn&&t.shift()};return{hook:()=>{n||typeof window>"u"||(n=!0,["log","info","warn","error"].forEach(i=>{e[i]=console[i].bind(console),console[i]=(...o)=>{r(i,o),e[i](...o)}}),window.addEventListener("error",i=>{r("error",[i.message||"window.error"])}),window.addEventListener("unhandledrejection",i=>{r("error",[i.reason||"unhandledrejection"])}))},snapshot(){return t.slice()}}}function Zn(t){const e=window.SpeechRecognition||window.webkitSpeechRecognition;let n=null,r=!1;const a=()=>{if(r=!1,n)try{n.stop()}catch{}};return{start:()=>{if(!e)throw new Error("Speech recognition is not supported in this browser.");return r?(a(),!1):(n=new e,n.continuous=!0,n.interimResults=!0,n.lang=navigator.language||"en-US",n.onresult=o=>{let c="";for(let l=o.resultIndex;l<o.results.length;l+=1)o.results[l].isFinal&&(c+=o.results[l][0].transcript);c&&t(c)},n.onerror=()=>{r=!1},n.onend=()=>{r=!1},n.start(),r=!0,!0)},stop:a,isSupported:()=>!!e,isActive:()=>r}}const tr=60*1e3;function er({onStart:t,onStop:e,onError:n}){let r=null,a=null,i=[],o=null;const c=()=>{if(o&&(clearTimeout(o),o=null),a&&a.state!=="inactive")try{a.stop()}catch{}r&&(r.getTracks().forEach(f=>f.stop()),r=null)},l=()=>{if(a&&a.state==="recording"){a.stop();return}c(),e(null)};return{start:async()=>{var f,p;if(!((f=navigator.mediaDevices)!=null&&f.getDisplayMedia))throw new Error("Screen recording is not supported in this browser.");r=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:"browser"},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include"}),i=[],a=new MediaRecorder(r,{mimeType:MediaRecorder.isTypeSupported("video/webm;codecs=vp9")?"video/webm;codecs=vp9":"video/webm"}),a.ondataavailable=y=>{y.data&&y.data.size&&i.push(y.data)},a.onstop=()=>{const y=i.length?new Blob(i,{type:a.mimeType||"video/webm"}):null;c(),e(y)},(p=r.getVideoTracks()[0])==null||p.addEventListener("ended",()=>l()),a.start(),o=setTimeout(l,tr)},stop:l}}function nr(){const t=new Set;return{alloc(){let e=1;for(;t.has(e);)e+=1;return t.add(e),e},free(e){const n=Number(e);Number.isInteger(n)&&n>0&&t.delete(n)},peekUsed(){return[...t].sort((e,n)=>e-n)}}}const vt={x:0,y:0,w:1,h:1};function xt(){const t=nr();let e=[],n={...vt},r=1;return{list:()=>e.filter(i=>ir(i,n)),all:()=>e.slice(),crop:()=>({...n}),setCrop(i){return n=rr(i),n},resetCrop(){return n={...vt},n},isCropped(){return n.x>1e-6||n.y>1e-6||n.w<.999999||n.h<.999999},add(i,o){const c={id:`s${r++}`,type:i,number:t.alloc(),x:.2,y:.2,w:i==="arrow"?.2:.22,h:i==="arrow"?.05:.16,x2:.4,y2:.28,...o};return e.push(c),c},update(i,o){const c=e.find(l=>l.id===i);return c?(Object.assign(c,o),c):null},remove(i){const o=e.findIndex(l=>l.id===i);if(o<0)return null;const[c]=e.splice(o,1);return t.free(c.number),c},reset(){for(e=[],n={...vt},r=1;t.peekUsed().length;)t.free(t.peekUsed()[0])}}}function rr(t){const e=Math.min(Math.max(t.x,0),.95),n=Math.min(Math.max(t.y,0),.95),r=Math.min(Math.max(t.w,.05),1-e),a=Math.min(Math.max(t.h,.05),1-n);return{x:e,y:n,w:r,h:a}}function ir(t,e){const n=t.type==="arrow"?(t.x+(t.x2??t.x))/2:t.x+(t.w||0)/2,r=t.type==="arrow"?(t.y+(t.y2??t.y))/2:t.y+(t.h||0)/2;return n>=e.x&&r>=e.y&&n<=e.x+e.w&&r<=e.y+e.h}function Et(t){const e=Math.max(1,Number(t)||1);return{stroke:Math.max(2,e*.0075),badgeRadius:Math.max(8,e*.025),fontSize:Math.max(10,e*.0275),arrowHead:Math.max(8,e*.035),arrowHeadAngle:.4}}function ar(t,{stickers:e=[],crop:n={x:0,y:0,w:1,h:1},width:r,height:a,colors:i={}}){const o=i.mark||"#fdd341",c=i.markText||"#2a2140",l=Et(r);t.save(),t.lineWidth=l.stroke,t.lineCap="round",t.lineJoin="round",t.strokeStyle=o,t.fillStyle=o,t.font=`700 ${Math.round(l.fontSize)}px ui-sans-serif, system-ui, sans-serif`,e.forEach(u=>{const f=Ct(u.x,n,r),p=Mt(u.y,n,a),y=u.w/n.w*r,v=u.h/n.h*a,P=l.stroke/2;if(u.type==="rect")t.strokeRect(f+P,p+P,Math.max(0,y-l.stroke),Math.max(0,v-l.stroke));else if(u.type==="circle")t.beginPath(),t.ellipse(f+y/2,p+v/2,Math.max(.5,y/2-P),Math.max(.5,v/2-P),0,0,Math.PI*2),t.stroke();else if(u.type==="arrow"){const X=Ct(u.x2??u.x+u.w,n,r),Y=Mt(u.y2??u.y,n,a);sr(t,f,p,X,Y,l)}if(u.number==null||u.number==="")return;const F=or(u,n,r,a,f,p,y),nt=String(u.number);t.beginPath(),t.arc(F.x,F.y,l.badgeRadius,0,Math.PI*2),t.fillStyle=o,t.fill(),t.fillStyle=c,t.textAlign="center",t.textBaseline="middle",t.fillText(nt,F.x,F.y+.5),t.fillStyle=o}),t.restore()}function Ct(t,e,n){return(t-e.x)/e.w*n}function Mt(t,e,n){return(t-e.y)/e.h*n}function or(t,e,n,r,a,i,o){if(t.type==="arrow"){const c=Ct(t.x2??t.x+t.w,e,n),l=Mt(t.y2??t.y,e,r);return{x:(a+c)/2,y:(i+l)/2}}return{x:a+o/2,y:i}}function he(t,e,n,r,a){const i=Math.atan2(r-e,n-t),o=a.arrowHead,c=Math.min(a.stroke,o*.2),l=n,u=r,f=n-Math.cos(i)*o,p=r-Math.sin(i)*o,y={x:l-o*Math.cos(i-a.arrowHeadAngle),y:u-o*Math.sin(i-a.arrowHeadAngle)},v={x:l-o*Math.cos(i+a.arrowHeadAngle),y:u-o*Math.sin(i+a.arrowHeadAngle)},P={x:n-Math.cos(i)*c,y:r-Math.sin(i)*c};return{angle:i,tipX:l,tipY:u,baseX:f,baseY:p,left:y,right:v,shaftEnd:P}}function sr(t,e,n,r,a,i){const o=he(e,n,r,a,i);t.beginPath(),t.moveTo(e,n),t.lineTo(o.shaftEnd.x,o.shaftEnd.y),t.stroke(),t.beginPath(),t.moveTo(o.tipX,o.tipY),t.lineTo(o.left.x,o.left.y),t.lineTo(o.right.x,o.right.y),t.closePath(),t.fill()}function cr(t,e,n,r={}){return new Promise((a,i)=>{const o=new Image;o.onload=()=>{const c=Math.round(e.x*o.width),l=Math.round(e.y*o.height),u=Math.max(1,Math.round(e.w*o.width)),f=Math.max(1,Math.round(e.h*o.height)),p=document.createElement("canvas");p.width=u,p.height=f;const y=p.getContext("2d");y.drawImage(o,c,l,u,f,0,0,u,f),ar(y,{stickers:n,crop:e,width:u,height:f,colors:r}),p.toBlob(v=>{if(!v){i(new Error("Could not encode screenshot"));return}a(v)},"image/png")},o.onerror=()=>i(new Error("Could not load screenshot")),o.src=t})}const N=[{id:"bug",label:"Bug"},{id:"idea",label:"Idea"},{id:"other",label:"Other"}];function pe(t){return String(t||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32)}function At(t){const e=String(t||"").trim();return e?e.split(/[-_\s]+/).filter(Boolean).map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" "):""}function lr(t){if(!Array.isArray(t)||!t.length)return N.map(r=>({...r}));const e=new Set,n=[];for(const r of t){let a="",i="";typeof r=="string"||typeof r=="number"?(a=pe(r),i=At(a)):r&&typeof r=="object"&&(a=pe(r.id??r.value??r.kind),i=String(r.label||r.name||At(a)).trim()||At(a)),!(!a||e.has(a))&&(e.add(a),n.push({id:a,label:i}))}return n.length?n:N.map(r=>({...r}))}function st(t){var n;const e=Array.isArray(t)&&t.length?t:N;return e.some(r=>r.id==="bug")?"bug":((n=e[0])==null?void 0:n.id)||"other"}const ur=["maker","all-business","brighter-day","quiet-night"],me="maker",dr=new Set(["crop","arrow","rect","circle"]),Lt=.02,ye=.05,fr=`
1
+ var Notefully=(function(C){"use strict";function tn(t,e){if(t.match(/^[a-z]+:\/\//i))return t;if(t.match(/^\/\//))return window.location.protocol+t;if(t.match(/^[a-z]+:/i))return t;const n=document.implementation.createHTMLDocument(),r=n.createElement("base"),i=n.createElement("a");return n.head.appendChild(r),n.body.appendChild(i),e&&(r.href=e),i.href=t,i.href}const en=(()=>{let t=0;const e=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(t+=1,`u${e()}${t}`)})();function D(t){const e=[];for(let n=0,r=t.length;n<r;n++)e.push(t[n]);return e}let X=null;function Xt(t={}){return X||(t.includeStyleProperties?(X=t.includeStyleProperties,X):(X=D(window.getComputedStyle(document.documentElement)),X))}function st(t,e){const r=(t.ownerDocument.defaultView||window).getComputedStyle(t).getPropertyValue(e);return r?parseFloat(r.replace("px","")):0}function nn(t){const e=st(t,"border-left-width"),n=st(t,"border-right-width");return t.clientWidth+e+n}function rn(t){const e=st(t,"border-top-width"),n=st(t,"border-bottom-width");return t.clientHeight+e+n}function Yt(t,e={}){const n=e.width||nn(t),r=e.height||rn(t);return{width:n,height:r}}function an(){let t,e;try{e=process}catch{}const n=e&&e.env?e.env.devicePixelRatio:null;return n&&(t=parseInt(n,10),Number.isNaN(t)&&(t=1)),t||window.devicePixelRatio||1}const E=16384;function on(t){(t.width>E||t.height>E)&&(t.width>E&&t.height>E?t.width>t.height?(t.height*=E/t.width,t.width=E):(t.width*=E/t.height,t.height=E):t.width>E?(t.height*=E/t.width,t.width=E):(t.width*=E/t.height,t.height=E))}function ct(t){return new Promise((e,n)=>{const r=new Image;r.onload=()=>{r.decode().then(()=>{requestAnimationFrame(()=>e(r))})},r.onerror=n,r.crossOrigin="anonymous",r.decoding="async",r.src=t})}async function sn(t){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(t)).then(encodeURIComponent).then(e=>`data:image/svg+xml;charset=utf-8,${e}`)}async function cn(t,e,n){const r="http://www.w3.org/2000/svg",i=document.createElementNS(r,"svg"),a=document.createElementNS(r,"foreignObject");return i.setAttribute("width",`${e}`),i.setAttribute("height",`${n}`),i.setAttribute("viewBox",`0 0 ${e} ${n}`),a.setAttribute("width","100%"),a.setAttribute("height","100%"),a.setAttribute("x","0"),a.setAttribute("y","0"),a.setAttribute("externalResourcesRequired","true"),i.appendChild(a),a.appendChild(t),sn(i)}const x=(t,e)=>{if(t instanceof e)return!0;const n=Object.getPrototypeOf(t);return n===null?!1:n.constructor.name===e.name||x(n,e)};function ln(t){const e=t.getPropertyValue("content");return`${t.cssText} content: '${e.replace(/'|"/g,"")}';`}function un(t,e){return Xt(e).map(n=>{const r=t.getPropertyValue(n),i=t.getPropertyPriority(n);return`${n}: ${r}${i?" !important":""};`}).join(" ")}function dn(t,e,n,r){const i=`.${t}:${e}`,a=n.cssText?ln(n):un(n,r);return document.createTextNode(`${i}{${a}}`)}function Gt(t,e,n,r){const i=window.getComputedStyle(t,n),a=i.getPropertyValue("content");if(a===""||a==="none")return;const o=en();try{e.className=`${e.className} ${o}`}catch{return}const c=document.createElement("style");c.appendChild(dn(o,n,i,r)),e.appendChild(c)}function fn(t,e,n){Gt(t,e,":before",n),Gt(t,e,":after",n)}const Jt="application/font-woff",Qt="image/jpeg",hn={woff:Jt,woff2:Jt,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:Qt,jpeg:Qt,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function pn(t){const e=/\.([^./]*?)$/g.exec(t);return e?e[1]:""}function St(t){const e=pn(t).toLowerCase();return hn[e]||""}function mn(t){return t.split(/,/)[1]}function xt(t){return t.search(/^(data:)/)!==-1}function yn(t,e){return`data:${e};base64,${t}`}async function Zt(t,e,n){const r=await fetch(t,e);if(r.status===404)throw new Error(`Resource "${r.url}" not found`);const i=await r.blob();return new Promise((a,o)=>{const c=new FileReader;c.onerror=o,c.onloadend=()=>{try{a(n({res:r,result:c.result}))}catch(l){o(l)}},c.readAsDataURL(i)})}const Et={};function gn(t,e,n){let r=t.replace(/\?.*/,"");return n&&(r=t),/ttf|otf|eot|woff2?/i.test(r)&&(r=r.replace(/.*\//,"")),e?`[${e}]${r}`:r}async function Ct(t,e,n){const r=gn(t,e,n.includeQueryParams);if(Et[r]!=null)return Et[r];n.cacheBust&&(t+=(/\?/.test(t)?"&":"?")+new Date().getTime());let i;try{const a=await Zt(t,n.fetchRequestInit,({res:o,result:c})=>(e||(e=o.headers.get("Content-Type")||""),mn(c)));i=yn(a,e)}catch(a){i=n.imagePlaceholder||"";let o=`Failed to fetch resource: ${t}`;a&&(o=typeof a=="string"?a:a.message),o&&console.warn(o)}return Et[r]=i,i}async function wn(t){const e=t.toDataURL();return e==="data:,"?t.cloneNode(!1):ct(e)}async function bn(t,e){if(t.currentSrc){const a=document.createElement("canvas"),o=a.getContext("2d");a.width=t.clientWidth,a.height=t.clientHeight,o==null||o.drawImage(t,0,0,a.width,a.height);const c=a.toDataURL();return ct(c)}const n=t.poster,r=St(n),i=await Ct(n,r,e);return ct(i)}async function vn(t,e){var n;try{if(!((n=t==null?void 0:t.contentDocument)===null||n===void 0)&&n.body)return await lt(t.contentDocument.body,e,!0)}catch{}return t.cloneNode(!1)}async function Sn(t,e){return x(t,HTMLCanvasElement)?wn(t):x(t,HTMLVideoElement)?bn(t,e):x(t,HTMLIFrameElement)?vn(t,e):t.cloneNode(te(t))}const xn=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SLOT",te=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SVG";async function En(t,e,n){var r,i;if(te(e))return e;let a=[];return xn(t)&&t.assignedNodes?a=D(t.assignedNodes()):x(t,HTMLIFrameElement)&&(!((r=t.contentDocument)===null||r===void 0)&&r.body)?a=D(t.contentDocument.body.childNodes):a=D(((i=t.shadowRoot)!==null&&i!==void 0?i:t).childNodes),a.length===0||x(t,HTMLVideoElement)||await a.reduce((o,c)=>o.then(()=>lt(c,n)).then(l=>{l&&e.appendChild(l)}),Promise.resolve()),e}function Cn(t,e,n){const r=e.style;if(!r)return;const i=window.getComputedStyle(t);i.cssText?(r.cssText=i.cssText,r.transformOrigin=i.transformOrigin):Xt(n).forEach(a=>{let o=i.getPropertyValue(a);a==="font-size"&&o.endsWith("px")&&(o=`${Math.floor(parseFloat(o.substring(0,o.length-2)))-.1}px`),x(t,HTMLIFrameElement)&&a==="display"&&o==="inline"&&(o="block"),a==="d"&&e.getAttribute("d")&&(o=`path(${e.getAttribute("d")})`),r.setProperty(a,o,i.getPropertyPriority(a))})}function Mn(t,e){x(t,HTMLTextAreaElement)&&(e.innerHTML=t.value),x(t,HTMLInputElement)&&e.setAttribute("value",t.value)}function An(t,e){if(x(t,HTMLSelectElement)){const r=Array.from(e.children).find(i=>t.value===i.getAttribute("value"));r&&r.setAttribute("selected","")}}function Ln(t,e,n){return x(e,Element)&&(Cn(t,e,n),fn(t,e,n),Mn(t,e),An(t,e)),e}async function Rn(t,e){const n=t.querySelectorAll?t.querySelectorAll("use"):[];if(n.length===0)return t;const r={};for(let a=0;a<n.length;a++){const c=n[a].getAttribute("xlink:href");if(c){const l=t.querySelector(c),u=document.querySelector(c);!l&&u&&!r[c]&&(r[c]=await lt(u,e,!0))}}const i=Object.values(r);if(i.length){const a="http://www.w3.org/1999/xhtml",o=document.createElementNS(a,"svg");o.setAttribute("xmlns",a),o.style.position="absolute",o.style.width="0",o.style.height="0",o.style.overflow="hidden",o.style.display="none";const c=document.createElementNS(a,"defs");o.appendChild(c);for(let l=0;l<i.length;l++)c.appendChild(i[l]);t.appendChild(o)}return t}async function lt(t,e,n){return!n&&e.filter&&!e.filter(t)?null:Promise.resolve(t).then(r=>Sn(r,e)).then(r=>En(t,r,e)).then(r=>Ln(t,r,e)).then(r=>Rn(r,e))}const ee=/url\((['"]?)([^'"]+?)\1\)/g,$n=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,kn=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function Tn(t){const e=t.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`,"g")}function Pn(t){const e=[];return t.replace(ee,(n,r,i)=>(e.push(i),n)),e.filter(n=>!xt(n))}async function In(t,e,n,r,i){try{const a=n?tn(e,n):e,o=St(e);let c;return i||(c=await Ct(a,o,r)),t.replace(Tn(e),`$1${c}$3`)}catch{}return t}function On(t,{preferredFontFormat:e}){return e?t.replace(kn,n=>{for(;;){const[r,,i]=$n.exec(n)||[];if(!i)return"";if(i===e)return`src: ${r};`}}):t}function ne(t){return t.search(ee)!==-1}async function re(t,e,n){if(!ne(t))return t;const r=On(t,n);return Pn(r).reduce((a,o)=>a.then(c=>In(c,o,e,n)),Promise.resolve(r))}async function Y(t,e,n){var r;const i=(r=e.style)===null||r===void 0?void 0:r.getPropertyValue(t);if(i){const a=await re(i,null,n);return e.style.setProperty(t,a,e.style.getPropertyPriority(t)),!0}return!1}async function Hn(t,e){await Y("background",t,e)||await Y("background-image",t,e),await Y("mask",t,e)||await Y("-webkit-mask",t,e)||await Y("mask-image",t,e)||await Y("-webkit-mask-image",t,e)}async function Dn(t,e){const n=x(t,HTMLImageElement);if(!(n&&!xt(t.src))&&!(x(t,SVGImageElement)&&!xt(t.href.baseVal)))return;const r=n?t.src:t.href.baseVal,i=await Ct(r,St(r),e);await new Promise((a,o)=>{t.onload=a,t.onerror=e.onImageErrorHandler?(...l)=>{try{a(e.onImageErrorHandler(...l))}catch(u){o(u)}}:o;const c=t;c.decode&&(c.decode=a),c.loading==="lazy"&&(c.loading="eager"),n?(t.srcset="",t.src=i):t.href.baseVal=i})}async function Bn(t,e){const r=D(t.childNodes).map(i=>ie(i,e));await Promise.all(r).then(()=>t)}async function ie(t,e){x(t,Element)&&(await Hn(t,e),await Dn(t,e),await Bn(t,e))}function Fn(t,e){const{style:n}=t;e.backgroundColor&&(n.backgroundColor=e.backgroundColor),e.width&&(n.width=`${e.width}px`),e.height&&(n.height=`${e.height}px`);const r=e.style;return r!=null&&Object.keys(r).forEach(i=>{n[i]=r[i]}),t}const ae={};async function oe(t){let e=ae[t];if(e!=null)return e;const r=await(await fetch(t)).text();return e={url:t,cssText:r},ae[t]=e,e}async function se(t,e){let n=t.cssText;const r=/url\(["']?([^"')]+)["']?\)/g,a=(n.match(/url\([^)]+\)/g)||[]).map(async o=>{let c=o.replace(r,"$1");return c.startsWith("https://")||(c=new URL(c,t.url).href),Zt(c,e.fetchRequestInit,({result:l})=>(n=n.replace(o,`url(${l})`),[o,l]))});return Promise.all(a).then(()=>n)}function ce(t){if(t==null)return[];const e=[],n=/(\/\*[\s\S]*?\*\/)/gi;let r=t.replace(n,"");const i=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const l=i.exec(r);if(l===null)break;e.push(l[0])}r=r.replace(i,"");const a=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,o="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",c=new RegExp(o,"gi");for(;;){let l=a.exec(r);if(l===null){if(l=c.exec(r),l===null)break;a.lastIndex=c.lastIndex}else c.lastIndex=a.lastIndex;e.push(l[0])}return e}async function Un(t,e){const n=[],r=[];return t.forEach(i=>{if("cssRules"in i)try{D(i.cssRules||[]).forEach((a,o)=>{if(a.type===CSSRule.IMPORT_RULE){let c=o+1;const l=a.href,u=oe(l).then(f=>se(f,e)).then(f=>ce(f).forEach(m=>{try{i.insertRule(m,m.startsWith("@import")?c+=1:i.cssRules.length)}catch(g){console.error("Error inserting rule from remote css",{rule:m,error:g})}})).catch(f=>{console.error("Error loading remote css",f.toString())});r.push(u)}})}catch(a){const o=t.find(c=>c.href==null)||document.styleSheets[0];i.href!=null&&r.push(oe(i.href).then(c=>se(c,e)).then(c=>ce(c).forEach(l=>{o.insertRule(l,o.cssRules.length)})).catch(c=>{console.error("Error loading remote stylesheet",c)})),console.error("Error inlining remote css file",a)}}),Promise.all(r).then(()=>(t.forEach(i=>{if("cssRules"in i)try{D(i.cssRules||[]).forEach(a=>{n.push(a)})}catch(a){console.error(`Error while reading CSS rules from ${i.href}`,a)}}),n))}function Nn(t){return t.filter(e=>e.type===CSSRule.FONT_FACE_RULE).filter(e=>ne(e.style.getPropertyValue("src")))}async function jn(t,e){if(t.ownerDocument==null)throw new Error("Provided element is not within a Document");const n=D(t.ownerDocument.styleSheets),r=await Un(n,e);return Nn(r)}function le(t){return t.trim().replace(/["']/g,"")}function _n(t){const e=new Set;function n(r){(r.style.fontFamily||getComputedStyle(r).fontFamily).split(",").forEach(a=>{e.add(le(a))}),Array.from(r.children).forEach(a=>{a instanceof HTMLElement&&n(a)})}return n(t),e}async function Vn(t,e){const n=await jn(t,e),r=_n(t);return(await Promise.all(n.filter(a=>r.has(le(a.style.fontFamily))).map(a=>{const o=a.parentStyleSheet?a.parentStyleSheet.href:null;return re(a.cssText,o,e)}))).join(`
2
+ `)}async function Wn(t,e){const n=e.fontEmbedCSS!=null?e.fontEmbedCSS:e.skipFonts?null:await Vn(t,e);if(n){const r=document.createElement("style"),i=document.createTextNode(n);r.appendChild(i),t.firstChild?t.insertBefore(r,t.firstChild):t.appendChild(r)}}async function zn(t,e={}){const{width:n,height:r}=Yt(t,e),i=await lt(t,e,!0);return await Wn(i,e),await ie(i,e),Fn(i,e),await cn(i,n,r)}async function qn(t,e={}){const{width:n,height:r}=Yt(t,e),i=await zn(t,e),a=await ct(i),o=document.createElement("canvas"),c=o.getContext("2d"),l=e.pixelRatio||an(),u=e.canvasWidth||n,f=e.canvasHeight||r;return o.width=u*l,o.height=f*l,e.skipAutoScale||on(o),o.style.width=`${u}`,o.style.height=`${f}`,e.backgroundColor&&(c.fillStyle=e.backgroundColor,c.fillRect(0,0,o.width,o.height)),c.drawImage(a,0,0,o.width,o.height),o}async function ue(t,e={}){return(await qn(t,e)).toDataURL()}const ut="data-nf-capture-chrome",Kn="data-nf-canvas-snap",Xn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==";function de(t){return t instanceof Element&&(t.hasAttribute(ut)||t.hasAttribute("data-nf-mask-cover")||t.id==="notefully")}function Yn(){const t=[];return Array.from(document.styleSheets).forEach(e=>{try{e.cssRules}catch{try{if(e.disabled)return;e.disabled=!0,t.push(e)}catch{const n=e.ownerNode;n&&"disabled"in n&&!n.disabled&&(n.disabled=!0,t.push({node:n}))}}}),()=>{t.forEach(e=>{try{e&&e.node?e.node.disabled=!1:e&&(e.disabled=!1)}catch{}})}}function Gn(){const t=[];return document.querySelectorAll('input[type="password"], [data-notefully-mask]').forEach(n=>{const r=n.getBoundingClientRect(),i=document.createElement("div");i.setAttribute("data-nf-mask-cover","1"),i.style.cssText=["position:fixed",`left:${r.left}px`,`top:${r.top}px`,`width:${Math.max(r.width,4)}px`,`height:${Math.max(r.height,4)}px`,"background:#111","z-index:2147483646","pointer-events:none"].join(";"),document.body.appendChild(i),t.push(i)}),()=>t.forEach(n=>n.remove())}function Jn(){const t=document.querySelector(`[${ut}]`);if(t)return t;const e=document.createElement("div");return e.setAttribute(ut,"1"),e.className="nf-capture-chrome",e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.innerHTML='<span class="nf-capture-chrome-pill">Capturing…</span>',document.body.appendChild(e),e}function Qn(){document.querySelectorAll(`[${ut}]`).forEach(t=>t.remove())}function Mt(){return new Promise(t=>{requestAnimationFrame(()=>requestAnimationFrame(t))})}function B(t){if(typeof t!="string"||!t.startsWith("data:image/"))return!1;const e=t.indexOf(",");return e>0&&e<t.length-1}function Zn(){const t=document.documentElement,e=document.body,n=Math.max(window.innerWidth||0,(t==null?void 0:t.clientWidth)||0,(t==null?void 0:t.scrollWidth)||0,(e==null?void 0:e.scrollWidth)||0,1),r=Math.max(window.innerHeight||0,(t==null?void 0:t.clientHeight)||0,(t==null?void 0:t.scrollHeight)||0,(e==null?void 0:e.scrollHeight)||0,1);return{width:n,height:r}}async function tr(){const t=[],e=Array.from(document.querySelectorAll("canvas"));for(const n of e){if(n.closest("#notefully")||de(n))continue;let r="";try{r=n.toDataURL("image/png")}catch{continue}if(!r||r==="data:,")continue;const i=document.createElement("img"),a=getComputedStyle(n);i.setAttribute(Kn,"1"),i.alt="",i.src=r,i.className=n.className,i.style.cssText=n.style.cssText,i.style.width=a.width,i.style.height=a.height,i.style.maxWidth=a.maxWidth,i.style.maxHeight=a.maxHeight,i.style.objectFit="fill",i.style.display=a.display==="inline"?"inline-block":a.display,n.replaceWith(i),t.push({canvas:n,img:i})}return await Promise.all(t.map(({img:n})=>{if(!n.complete)return new Promise(r=>{n.onload=()=>r(),n.onerror=()=>r()})})),()=>{t.forEach(({canvas:n,img:r})=>{try{r.parentNode&&r.replaceWith(n)}catch{}})}}async function er(t){if(!t)return null;if(typeof t=="string")return B(t)?t:null;if(typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement)try{const e=t.toDataURL("image/png");return B(e)?e:null}catch{return null}if(typeof Blob<"u"&&t instanceof Blob){const e=await nr(t);return B(e)?e:null}return null}async function nr(t){if(typeof FileReader=="function")return new Promise((r,i)=>{const a=new FileReader;a.onload=()=>r(String(a.result||"")),a.onerror=()=>i(a.error||new Error("Could not read capture blob")),a.readAsDataURL(t)});const e=Buffer.from(await t.arrayBuffer());return`data:${t.type||"application/octet-stream"};base64,${e.toString("base64")}`}async function rr(){var e;if(!((e=navigator.mediaDevices)!=null&&e.getDisplayMedia))throw new Error("Screen capture is not supported in this browser.");const t=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:"browser"},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include"});try{const n=document.createElement("video");n.muted=!0,n.playsInline=!0,n.srcObject=t,await n.play(),n.videoWidth||await new Promise(c=>{n.onloadedmetadata=()=>c()}),await Mt();const r=n.videoWidth||1,i=n.videoHeight||1,a=document.createElement("canvas");a.width=r,a.height=i,a.getContext("2d").drawImage(n,0,0,r,i);const o=a.toDataURL("image/png");if(!B(o))throw new Error("Screen capture produced an empty image.");return o}finally{t.getTracks().forEach(n=>n.stop())}}async function fe(t={}){const e=document.getElementById("notefully"),n=e?e.style.display:"",r=Jn(),i=Yn();let a=()=>{};e&&(e.style.display="none");const o=Gn();try{if(typeof t.onBeforeCapture=="function"&&await t.onBeforeCapture(),await Mt(),typeof t.capture=="function"){const m=await er(await t.capture());if(m)return m}a=await tr(),await Mt();const{width:c,height:l}=Zn(),u={cacheBust:!0,width:c,height:l,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:m=>!de(m),imagePlaceholder:Xn,onImageErrorHandler:()=>{}};let f="";try{f=await ue(document.body,u)}catch{f=await ue(document.body,{...u,skipFonts:!0})}if(!B(f))throw new Error("Screenshot capture produced an empty image.");return f}finally{try{a()}catch{}o(),i(),r.remove(),Qn(),e&&(e.style.display=n)}}function ir(t=""){const e=String(t||"");return e?/Windows NT/i.test(e)?"Windows":/iPhone|iPad|iPod/i.test(e)?"iOS":/Mac OS X|Macintosh/i.test(e)?"macOS":/Android/i.test(e)?"Android":/CrOS/i.test(e)?"ChromeOS":/Linux/i.test(e)?"Linux":"Other":""}function ar(t=""){const e=String(t||"");return e?/Edg\//i.test(e)?"Edge":/OPR\/|Opera/i.test(e)?"Opera":/Firefox\//i.test(e)?"Firefox":/Chrome\//i.test(e)||/CriOS\//i.test(e)?"Chrome":/Safari\//i.test(e)?"Safari":"Other":""}function or(t={}){const e=navigator.userAgent;return{url:location.href,title:document.title,userAgent:e,os:ir(e),browser:ar(e),language:navigator.language,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,viewport:{width:window.innerWidth,height:window.innerHeight,dpr:window.devicePixelRatio||1},user:{userId:t.userId||null,email:t.email||null,displayName:t.displayName||null}}}const he=new Set(["userId","email","displayName"]),pe={id:"userId",username:"displayName",name:"displayName"},me=new Set(["endpoint","projectKey","version","name","targets","hideLauncher","theme","video","consoleLogLimit","kinds","capture","onBeforeCapture"]),ye={slug:"Use init({ name }) for a per-app report prefix (same idea as package.json name). slug is not a widget option.",projectSlug:"Use init({ name }) for a per-app report prefix. projectSlug is not a widget option.",project:"Pass projectKey (nfk_…) from Showfully Notefully settings — there is no project option on the widget.",username:"Pass people via Notefully.identify({ displayName }) (username is an identify alias), not init().",userId:"Pass people via Notefully.identify({ userId, email, displayName }), not init().",email:"Pass people via Notefully.identify({ userId, email, displayName }), not init().",displayName:"Pass people via Notefully.identify({ userId, email, displayName }), not init()."};function sr(t={},e={}){const n=e.warn||ge,r=t&&typeof t=="object"?t:{},i={},a=[];for(const o of he)Object.prototype.hasOwnProperty.call(r,o)&&(i[o]=r[o]);for(const[o,c]of Object.entries(pe))Object.prototype.hasOwnProperty.call(r,o)&&(Object.prototype.hasOwnProperty.call(i,c)||(i[c]=r[o]));for(const o of Object.keys(r))he.has(o)||Object.prototype.hasOwnProperty.call(pe,o)||a.push(o);if(a.length){const o=a.some(c=>c==="name"||c==="slug"||c==="projectSlug")?" Pass the package/report name via Notefully.init({ name }), not identify().":"";n(`Notefully.identify: ignoring unknown key(s): ${a.join(", ")}. Supported: userId, email, displayName (aliases: id → userId; username/name → displayName).`+o)}return i}function cr(t={},e={}){const n=e.warn||ge,r=t&&typeof t=="object"?t:{},i=Object.keys(r).filter(a=>!me.has(a));if(i.length)for(const a of i){if(ye[a]){n(`Notefully.init: ignoring "${a}". ${ye[a]}`);continue}n(`Notefully.init: ignoring unknown key "${a}". Supported: ${[...me].join(", ")}.`)}}function ge(t){typeof console<"u"&&typeof console.warn=="function"&&console.warn(t)}const lr=80;function ur(){const t=[],e={};let n=!1;const r=(a,o)=>{let c="";try{c=o.map(l=>l instanceof Error?l.stack||l.message:typeof l=="string"?l:JSON.stringify(l)).join(" ")}catch{c=String(o[0])}t.push({level:a,text:c.slice(0,2e3),at:Date.now()}),t.length>lr&&t.shift()};return{hook:()=>{n||typeof window>"u"||(n=!0,["log","info","warn","error"].forEach(a=>{e[a]=console[a].bind(console),console[a]=(...o)=>{r(a,o),e[a](...o)}}),window.addEventListener("error",a=>{r("error",[a.message||"window.error"])}),window.addEventListener("unhandledrejection",a=>{r("error",[a.reason||"unhandledrejection"])}))},snapshot(){return t.slice()}}}function dr(t){const e=window.SpeechRecognition||window.webkitSpeechRecognition;let n=null,r=!1;const i=()=>{if(r=!1,n)try{n.stop()}catch{}};return{start:()=>{if(!e)throw new Error("Speech recognition is not supported in this browser.");return r?(i(),!1):(n=new e,n.continuous=!0,n.interimResults=!0,n.lang=navigator.language||"en-US",n.onresult=o=>{let c="";for(let l=o.resultIndex;l<o.results.length;l+=1)o.results[l].isFinal&&(c+=o.results[l][0].transcript);c&&t(c)},n.onerror=()=>{r=!1},n.onend=()=>{r=!1},n.start(),r=!0,!0)},stop:i,isSupported:()=>!!e,isActive:()=>r}}const fr=60*1e3;function hr({onStart:t,onStop:e,onError:n}){let r=null,i=null,a=[],o=null;const c=()=>{if(o&&(clearTimeout(o),o=null),i&&i.state!=="inactive")try{i.stop()}catch{}r&&(r.getTracks().forEach(f=>f.stop()),r=null)},l=()=>{if(i&&i.state==="recording"){i.stop();return}c(),e(null)};return{start:async()=>{var f,m;if(!((f=navigator.mediaDevices)!=null&&f.getDisplayMedia))throw new Error("Screen recording is not supported in this browser.");r=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:"browser"},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include"}),a=[],i=new MediaRecorder(r,{mimeType:MediaRecorder.isTypeSupported("video/webm;codecs=vp9")?"video/webm;codecs=vp9":"video/webm"}),i.ondataavailable=g=>{g.data&&g.data.size&&a.push(g.data)},i.onstop=()=>{const g=a.length?new Blob(a,{type:i.mimeType||"video/webm"}):null;c(),e(g)},(m=r.getVideoTracks()[0])==null||m.addEventListener("ended",()=>l()),i.start(),o=setTimeout(l,fr)},stop:l}}function pr(){const t=new Set;return{alloc(){let e=1;for(;t.has(e);)e+=1;return t.add(e),e},free(e){const n=Number(e);Number.isInteger(n)&&n>0&&t.delete(n)},peekUsed(){return[...t].sort((e,n)=>e-n)}}}const At={x:0,y:0,w:1,h:1};function Lt(){const t=pr();let e=[],n={...At},r=1;return{list:()=>e.filter(a=>yr(a,n)),all:()=>e.slice(),crop:()=>({...n}),setCrop(a){return n=mr(a),n},resetCrop(){return n={...At},n},isCropped(){return n.x>1e-6||n.y>1e-6||n.w<.999999||n.h<.999999},add(a,o){const c={id:`s${r++}`,type:a,number:t.alloc(),x:.2,y:.2,w:a==="arrow"?.2:.22,h:a==="arrow"?.05:.16,x2:.4,y2:.28,...o};return e.push(c),c},update(a,o){const c=e.find(l=>l.id===a);return c?(Object.assign(c,o),c):null},remove(a){const o=e.findIndex(l=>l.id===a);if(o<0)return null;const[c]=e.splice(o,1);return t.free(c.number),c},reset(){for(e=[],n={...At},r=1;t.peekUsed().length;)t.free(t.peekUsed()[0])}}}function mr(t){const e=Math.min(Math.max(t.x,0),.95),n=Math.min(Math.max(t.y,0),.95),r=Math.min(Math.max(t.w,.05),1-e),i=Math.min(Math.max(t.h,.05),1-n);return{x:e,y:n,w:r,h:i}}function yr(t,e){const n=t.type==="arrow"?(t.x+(t.x2??t.x))/2:t.x+(t.w||0)/2,r=t.type==="arrow"?(t.y+(t.y2??t.y))/2:t.y+(t.h||0)/2;return n>=e.x&&r>=e.y&&n<=e.x+e.w&&r<=e.y+e.h}function Rt(t){const e=Math.max(1,Number(t)||1);return{stroke:Math.max(2,e*.0075),badgeRadius:Math.max(8,e*.025),fontSize:Math.max(10,e*.0275),arrowHead:Math.max(8,e*.035),arrowHeadAngle:.4}}function gr(t,{stickers:e=[],crop:n={x:0,y:0,w:1,h:1},width:r,height:i,colors:a={}}){const o=a.mark||"#fdd341",c=a.markText||"#2a2140",l=Rt(r);t.save(),t.lineWidth=l.stroke,t.lineCap="round",t.lineJoin="round",t.strokeStyle=o,t.fillStyle=o,t.font=`700 ${Math.round(l.fontSize)}px ui-sans-serif, system-ui, sans-serif`,e.forEach(u=>{const f=$t(u.x,n,r),m=kt(u.y,n,i),g=u.w/n.w*r,S=u.h/n.h*i,P=l.stroke/2;if(u.type==="rect")t.strokeRect(f+P,m+P,Math.max(0,g-l.stroke),Math.max(0,S-l.stroke));else if(u.type==="circle")t.beginPath(),t.ellipse(f+g/2,m+S/2,Math.max(.5,g/2-P),Math.max(.5,S/2-P),0,0,Math.PI*2),t.stroke();else if(u.type==="arrow"){const Q=$t(u.x2??u.x+u.w,n,r),Z=kt(u.y2??u.y,n,i);br(t,f,m,Q,Z,l)}if(u.number==null||u.number==="")return;const j=wr(u,n,r,i,f,m,g),ot=String(u.number);t.beginPath(),t.arc(j.x,j.y,l.badgeRadius,0,Math.PI*2),t.fillStyle=o,t.fill(),t.fillStyle=c,t.textAlign="center",t.textBaseline="middle",t.fillText(ot,j.x,j.y+.5),t.fillStyle=o}),t.restore()}function $t(t,e,n){return(t-e.x)/e.w*n}function kt(t,e,n){return(t-e.y)/e.h*n}function wr(t,e,n,r,i,a,o){if(t.type==="arrow"){const c=$t(t.x2??t.x+t.w,e,n),l=kt(t.y2??t.y,e,r);return{x:(i+c)/2,y:(a+l)/2}}return{x:i+o/2,y:a}}function we(t,e,n,r,i){const a=Math.atan2(r-e,n-t),o=i.arrowHead,c=Math.min(i.stroke,o*.2),l=n,u=r,f=n-Math.cos(a)*o,m=r-Math.sin(a)*o,g={x:l-o*Math.cos(a-i.arrowHeadAngle),y:u-o*Math.sin(a-i.arrowHeadAngle)},S={x:l-o*Math.cos(a+i.arrowHeadAngle),y:u-o*Math.sin(a+i.arrowHeadAngle)},P={x:n-Math.cos(a)*c,y:r-Math.sin(a)*c};return{angle:a,tipX:l,tipY:u,baseX:f,baseY:m,left:g,right:S,shaftEnd:P}}function br(t,e,n,r,i,a){const o=we(e,n,r,i,a);t.beginPath(),t.moveTo(e,n),t.lineTo(o.shaftEnd.x,o.shaftEnd.y),t.stroke(),t.beginPath(),t.moveTo(o.tipX,o.tipY),t.lineTo(o.left.x,o.left.y),t.lineTo(o.right.x,o.right.y),t.closePath(),t.fill()}function vr(t,e,n,r={}){return new Promise((i,a)=>{const o=new Image;o.onload=()=>{const c=Math.round(e.x*o.width),l=Math.round(e.y*o.height),u=Math.max(1,Math.round(e.w*o.width)),f=Math.max(1,Math.round(e.h*o.height)),m=document.createElement("canvas");m.width=u,m.height=f;const g=m.getContext("2d");g.drawImage(o,c,l,u,f,0,0,u,f),gr(g,{stickers:n,crop:e,width:u,height:f,colors:r}),m.toBlob(S=>{if(!S){a(new Error("Could not encode screenshot"));return}i(S)},"image/png")},o.onerror=()=>a(new Error("Could not load screenshot")),o.src=t})}const Sr=[{key:"url",label:"URL"},{key:"title",label:"Title"},{key:"userAgent",label:"User agent"},{key:"os",label:"OS"},{key:"browser",label:"Browser"},{key:"language",label:"Language"},{key:"timezone",label:"Timezone"},{key:"viewport",label:"Viewport"},{key:"user",label:"User"}];function xr(t){return!t||typeof t!="object"?!1:!!(t.userId||t.email||t.displayName)}function Er(t={}){const e=[];for(const n of Sr){const r=t[n.key];r==null||r===""||n.key==="user"&&!xr(r)||e.push({key:n.key,label:n.label,value:r,redacted:!1})}return e}function Cr(t=[]){return t.map((e,n)=>({id:`log-${n}-${e.at||0}`,level:e.level||"log",text:String(e.text||""),at:e.at||0,redacted:!1}))}function Mr(t=[]){if(!t.length)return{checked:!1,indeterminate:!1};const e=t.filter(n=>n.redacted).length;return e===0?{checked:!1,indeterminate:!1}:e===t.length?{checked:!0,indeterminate:!1}:{checked:!1,indeterminate:!0}}function be(t,e){t.forEach(n=>{n.redacted=!!e})}function Ar(t={}){const e=t.diagnostics||[],n=t.logs||[],r=e.some(a=>!a.redacted),i=n.length>0&&n.some(a=>!a.redacted);return r&&i?"Also sending logs and diagnostic information":r?"Also sending diagnostic information":i?"Also sending logs":""}function Lr(t){if(t==null)return"";if(typeof t=="string"||typeof t=="number"||typeof t=="boolean")return String(t);try{return JSON.stringify(t)}catch{return String(t)}}function Rr(t={}){const e={};t.author!=null&&t.author!==""&&(e.author=t.author);for(const r of t.diagnostics||[])r.redacted||(e[r.key]=r.value);const n=(t.logs||[]).filter(r=>!r.redacted).map(r=>({level:r.level,text:r.text,at:r.at}));return e.console=n,e}const V=[{id:"bug",label:"Bug"},{id:"idea",label:"Idea"},{id:"other",label:"Other"}];function ve(t){return String(t||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32)}function Tt(t){const e=String(t||"").trim();return e?e.split(/[-_\s]+/).filter(Boolean).map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" "):""}function $r(t){if(!Array.isArray(t)||!t.length)return V.map(r=>({...r}));const e=new Set,n=[];for(const r of t){let i="",a="";typeof r=="string"||typeof r=="number"?(i=ve(r),a=Tt(i)):r&&typeof r=="object"&&(i=ve(r.id??r.value??r.kind),a=String(r.label||r.name||Tt(i)).trim()||Tt(i)),!(!i||e.has(i))&&(e.add(i),n.push({id:i,label:a}))}return n.length?n:V.map(r=>({...r}))}function dt(t){var n;const e=Array.isArray(t)&&t.length?t:V;return e.some(r=>r.id==="bug")?"bug":((n=e[0])==null?void 0:n.id)||"other"}const kr=["maker","all-business","brighter-day","quiet-night"],Se="maker",Tr=new Set(["crop","arrow","rect","circle"]),Pt=.02,xe=.05,Pr=`
3
3
  <svg class="nf-launcher-icon" viewBox="0 0 24 24" aria-hidden="true">
4
4
  <path fill="currentColor" d="M5.2 2.8h9.1A2.7 2.7 0 0 1 17 5.5v8.2c0 .4-.3.7-.7.7h-.1a.7.7 0 0 1-.7-.7V5.5c0-.7-.6-1.3-1.3-1.3H5.2c-.7 0-1.3.6-1.3 1.3v12.2c0 .7.6 1.3 1.3 1.3h6.4a.7.7 0 0 1 0 1.4H5.2A2.7 2.7 0 0 1 2.5 17.7V5.5A2.7 2.7 0 0 1 5.2 2.8zm1.6 4.2a.7.7 0 0 0 0 1.4h6.2a.7.7 0 0 0 0-1.4H6.8zm0 3.2a.7.7 0 0 0 0 1.4h6.2a.7.7 0 0 0 0-1.4H6.8zm0 3.2a.7.7 0 0 0 0 1.4h3.6a.7.7 0 0 0 0-1.4H6.8z"/>
5
5
  <path fill="currentColor" d="M14.7 13.05 20.2 7.55a1.55 1.55 0 0 1 2.2 2.2l-5.5 5.5-.45 1.9a.6.6 0 0 1-.72.45l-1.9-.45.87-1.9z"/>
6
6
  </svg>
7
- `;function k(t){return`<svg class="nf-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${t}</svg>`}const L={crop:k('<path d="M6 3v5H1M18 21v-5h5M8 5h8a2 2 0 0 1 2 2v8M16 19H8a2 2 0 0 1-2-2V8"/>'),resetCrop:k('<path d="M3 12a9 9 0 1 0 3-6.7L3 8"/><path d="M3 3v5h5"/>'),arrow:k('<path d="M5 19 19 5"/><path d="M9 5h10v10"/>'),rect:k('<rect x="4" y="6" width="16" height="12" rx="1.5"/>'),circle:k('<circle cx="12" cy="12" r="8"/>'),discard:k('<path d="M4 7h16"/><path d="M9 7V5h6v2"/><path d="M6 7l1 13h10l1-13"/>'),recapture:k('<path d="M4 8h3l2-2h6l2 2h3v11H4z"/><circle cx="12" cy="13" r="3.5"/>'),audio:k('<rect x="9" y="3" width="6" height="11" rx="3"/><path d="M5 11a7 7 0 0 0 14 0"/><path d="M12 18v3"/>'),video:k('<rect x="3" y="7" width="13" height="10" rx="2"/><path d="M16 10.5 21 8v8l-5-2.5z"/>')},ge=Qn();ge.hook();const we=10,hr=80,be="notefully.author",Rt="Anonymous";let d={endpoint:"",projectKey:"",version:"0.0.0",name:"",targets:null,hideLauncher:!1,theme:me,video:!1,consoleLogLimit:we,kinds:N.map(t=>({...t})),capture:null,onBeforeCapture:null},$t=!1,R={},h=null,s={},m=xt(),$="",q="",T=null,j=st(N),H=null,A=null,w=null,b=null,ct=null,_=null,J=null,I={w:0,h:0},Tt=!1,Pt=!1;function g(t){return h.querySelector(t)}function Se(t){const e=String(t||"").trim().toLowerCase().replace(/\s+/g,"-");return ur.includes(e)?e:me}function ve(t,e){return h&&getComputedStyle(h).getPropertyValue(t).trim()||e}async function pr(t){return(await fetch(t)).blob()}function S(t,e=!1){s.status&&(s.status.textContent=t||"",ct&&(clearTimeout(ct),ct=null),t&&!e&&(ct=setTimeout(()=>{s.status.textContent=""},4e3)))}function kt(){return h&&document.body.contains(h)||(h=document.createElement("div"),h.id="notefully",h.innerHTML=`
8
- <button class="nf-launcher" type="button" title="Leave a note…" aria-label="Leave a note…">${fr}</button>
7
+ `;function R(t){return`<svg class="nf-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${t}</svg>`}const A={crop:R('<path d="M6 3v5H1M18 21v-5h5M8 5h8a2 2 0 0 1 2 2v8M16 19H8a2 2 0 0 1-2-2V8"/>'),resetCrop:R('<path d="M3 12a9 9 0 1 0 3-6.7L3 8"/><path d="M3 3v5h5"/>'),arrow:R('<path d="M5 19 19 5"/><path d="M9 5h10v10"/>'),rect:R('<rect x="4" y="6" width="16" height="12" rx="1.5"/>'),circle:R('<circle cx="12" cy="12" r="8"/>'),discard:R('<path d="M4 7h16"/><path d="M9 7V5h6v2"/><path d="M6 7l1 13h10l1-13"/>'),recapture:R('<path d="M4 8h3l2-2h6l2 2h3v11H4z"/><circle cx="12" cy="13" r="3.5"/>'),privacy:R('<path d="M8 6h13M8 12h13M8 18h13"/><path d="M3 6h.01M3 12h.01M3 18h.01"/>'),audio:R('<rect x="9" y="3" width="6" height="11" rx="3"/><path d="M5 11a7 7 0 0 0 14 0"/><path d="M12 18v3"/>'),video:R('<rect x="3" y="7" width="13" height="10" rx="2"/><path d="M16 10.5 21 8v8l-5-2.5z"/>')},Ee=ur();Ee.hook();const Ce=10,Ir=80,Me="notefully.author",It="Anonymous";let d={endpoint:"",projectKey:"",version:"0.0.0",name:"",targets:null,hideLauncher:!1,theme:Se,video:!1,consoleLogLimit:Ce,kinds:V.map(t=>({...t})),capture:null,onBeforeCapture:null},Ot=!1,$={},h=null,s={},y=Lt(),k="",G="",T=null,W=dt(V),F=null,L=null,w=null,b=null,ft=null,z=null,et=null,I={w:0,h:0},Ht=!1,Dt=!1,U=[],O=[],q=!1;function p(t){return h.querySelector(t)}function Ae(t){const e=String(t||"").trim().toLowerCase().replace(/\s+/g,"-");return kr.includes(e)?e:Se}function Le(t,e){return h&&getComputedStyle(h).getPropertyValue(t).trim()||e}async function Or(t){return(await fetch(t)).blob()}function v(t,e=!1){s.status&&(s.status.textContent=t||"",ft&&(clearTimeout(ft),ft=null),t&&!e&&(ft=setTimeout(()=>{s.status.textContent=""},4e3)))}function Bt(){return h&&document.body.contains(h)||(h=document.createElement("div"),h.id="notefully",h.innerHTML=`
8
+ <button class="nf-launcher" type="button" title="Leave a note…" aria-label="Leave a note…">${Pr}</button>
9
9
  <div class="nf-dialog" hidden>
10
10
  <div class="nf-panel">
11
11
  <div class="nf-panel-body">
12
12
  <div class="nf-stage" hidden>
13
13
  <div class="nf-palette">
14
- <button class="nf-tool nf-icon-btn" type="button" data-tool="crop" title="Crop" aria-label="Crop">${L.crop}</button>
15
- <button class="nf-reset-crop nf-icon-btn" type="button" title="Reset crop" aria-label="Reset crop" hidden>${L.resetCrop}</button>
16
- <button class="nf-tool nf-icon-btn" type="button" data-tool="arrow" title="Arrow" aria-label="Arrow">${L.arrow}</button>
17
- <button class="nf-tool nf-icon-btn" type="button" data-tool="rect" title="Rectangle" aria-label="Rectangle">${L.rect}</button>
18
- <button class="nf-tool nf-icon-btn" type="button" data-tool="circle" title="Circle" aria-label="Circle">${L.circle}</button>
19
- <button class="nf-discard-shot nf-icon-btn" type="button" title="Discard screenshot" aria-label="Discard screenshot">${L.discard}</button>
20
- <button class="nf-recapture nf-icon-btn" type="button" title="Recapture screenshot" aria-label="Recapture screenshot">${L.recapture}</button>
14
+ <button class="nf-tool nf-icon-btn" type="button" data-tool="crop" title="Crop" aria-label="Crop">${A.crop}</button>
15
+ <button class="nf-reset-crop nf-icon-btn" type="button" title="Reset crop" aria-label="Reset crop" hidden>${A.resetCrop}</button>
16
+ <button class="nf-tool nf-icon-btn" type="button" data-tool="arrow" title="Arrow" aria-label="Arrow">${A.arrow}</button>
17
+ <button class="nf-tool nf-icon-btn" type="button" data-tool="rect" title="Rectangle" aria-label="Rectangle">${A.rect}</button>
18
+ <button class="nf-tool nf-icon-btn" type="button" data-tool="circle" title="Circle" aria-label="Circle">${A.circle}</button>
19
+ <button class="nf-discard-shot nf-icon-btn" type="button" title="Discard screenshot" aria-label="Discard screenshot">${A.discard}</button>
20
+ <button class="nf-recapture nf-icon-btn" type="button" title="Recapture screenshot" aria-label="Recapture screenshot">${A.recapture}</button>
21
21
  </div>
22
22
  <div class="nf-canvas"></div>
23
23
  </div>
24
24
  <textarea class="nf-text" placeholder="Describe the bug or the change you want…"></textarea>
25
25
  <input class="nf-author" type="text" name="author" autocomplete="nickname" placeholder="Anonymous" aria-label="Author">
26
26
  <div class="nf-kind"></div>
27
+ <div class="nf-privacy">
28
+ <div class="nf-privacy-summary">
29
+ <span class="nf-privacy-text"></span>
30
+ <button class="nf-privacy-change nf-icon-btn" type="button" title="Change what is sent" aria-label="Change what is sent" aria-expanded="false">${A.privacy}</button>
31
+ </div>
32
+ <div class="nf-privacy-panel" hidden>
33
+ <div class="nf-privacy-scroll"></div>
34
+ <button class="nf-privacy-done" type="button">Done</button>
35
+ </div>
36
+ </div>
27
37
  <div class="nf-actions">
28
- <button class="nf-restore nf-icon-btn" type="button" title="Restore screenshot" aria-label="Restore screenshot" hidden>${L.resetCrop}</button>
29
- <button class="nf-audio nf-icon-btn" type="button" title="Record audio" aria-label="Record audio">${L.audio}</button>
30
- <button class="nf-video nf-icon-btn" type="button" title="Record video" aria-label="Record video">${L.video}</button>
38
+ <button class="nf-restore nf-icon-btn" type="button" title="Restore screenshot" aria-label="Restore screenshot" hidden>${A.resetCrop}</button>
39
+ <button class="nf-audio nf-icon-btn" type="button" title="Record audio" aria-label="Record audio">${A.audio}</button>
40
+ <button class="nf-video nf-icon-btn" type="button" title="Record video" aria-label="Record video">${A.video}</button>
31
41
  <button class="nf-submit" type="button">Submit</button>
32
42
  </div>
33
43
  <div class="nf-status"></div>
@@ -36,8 +46,23 @@ var Notefully=(function(C){"use strict";function _e(t,e){if(t.match(/^[a-z]+:\/\
36
46
  </div>
37
47
  </div>
38
48
  <button class="nf-stop-video" type="button" hidden>Stop</button>
39
- `,document.body.appendChild(h),s={launcher:g(".nf-launcher"),dialog:g(".nf-dialog"),panel:g(".nf-panel"),panelBody:g(".nf-panel-body"),successMsg:g(".nf-success-msg"),stage:g(".nf-stage"),palette:g(".nf-palette"),canvas:g(".nf-canvas"),text:g(".nf-text"),author:g(".nf-author"),actions:g(".nf-actions"),restore:g(".nf-restore"),status:g(".nf-status"),audio:g(".nf-audio"),video:g(".nf-video"),discard:g(".nf-discard-shot"),recapture:g(".nf-recapture"),stop:g(".nf-stop-video"),resetCrop:g(".nf-reset-crop"),submit:g(".nf-submit"),shot:null},mr(),Q()),h}function Q(){var t;h&&(h.dataset.theme=Se(d.theme),d.hideLauncher?h.setAttribute("data-nf-hidden-launcher",""):h.removeAttribute("data-nf-hidden-launcher"),s.video&&(s.video.hidden=!d.video),Ee(),(t=s.dialog)!=null&&t.hidden&&lt())}function lt(){s.launcher&&(s.launcher.hidden=!!d.hideLauncher)}function mr(){s.launcher.addEventListener("click",()=>Ut()),g(".nf-dialog").addEventListener("click",e=>{Pt||e.target===s.dialog&&K()}),h.querySelectorAll(".nf-tool").forEach(e=>{e.addEventListener("click",()=>Z(e.dataset.tool))}),s.resetCrop.addEventListener("click",xr),s.canvas.addEventListener("pointerdown",gr),s.canvas.addEventListener("dragstart",e=>e.preventDefault());const t=g(".nf-kind");t&&t.addEventListener("click",e=>{const n=e.target.closest("[data-kind]");n&&It(n.dataset.kind)}),s.discard.addEventListener("click",Er),s.recapture.addEventListener("click",()=>{Mr().catch(e=>S(e.message||"Recapture failed."))}),s.restore.addEventListener("click",Cr),s.audio.addEventListener("click",Ar),s.video.addEventListener("click",Lr),s.stop.addEventListener("click",()=>J==null?void 0:J.stop()),g(".nf-submit").addEventListener("click",()=>{Nt().catch(e=>S(e.message||"Submit failed."))}),Ee(),Z(null)}function xe(t){return String(t||"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Ee(){const t=h==null?void 0:h.querySelector(".nf-kind");if(!t)return;const e=Array.isArray(d.kinds)&&d.kinds.length?d.kinds:N;t.innerHTML=e.map(a=>`<button type="button" data-kind="${xe(a.id)}">${xe(a.label)}</button>`).join("");const r=e.map(a=>a.id).includes(j)?j:st(e);It(r)}function It(t){j=(d.kinds||N).map(n=>n.id).includes(t)?t:st(d.kinds),h==null||h.querySelectorAll("[data-kind]").forEach(n=>{n.dataset.active=String(n.dataset.kind===j)})}function Z(t){H=dr.has(t)?t:null,A=null,h.querySelectorAll(".nf-tool").forEach(e=>{e.dataset.active=String(e.dataset.tool===H)}),s.canvas&&(s.canvas.dataset.draw=H?"true":"false"),D()&&M()}function Ce(t){return Math.min(1,Math.max(0,t))}function tt(){return s.shot||s.canvas}function ut(t){const e=tt().getBoundingClientRect();return{x:Ce((t.clientX-e.left)/Math.max(e.width,1)),y:Ce((t.clientY-e.top)/Math.max(e.height,1))}}function yr(t){const e=tt().getBoundingClientRect();return t.clientX>=e.left&&t.clientX<=e.right&&t.clientY>=e.top&&t.clientY<=e.bottom}function Me(t){const e=ut(t),n=m.crop();return{x:n.x+e.x*n.w,y:n.y+e.y*n.h}}function dt(t,e){const n=Math.min(t.x,e.x),r=Math.min(t.y,e.y);return{x:n,y:r,w:Math.max(Lt,Math.abs(e.x-t.x)),h:Math.max(Lt,Math.abs(e.y-t.y))}}function Ot(t){h&&(t?h.dataset.grabbing="true":delete h.dataset.grabbing)}function Bt(t){try{s.canvas.setPointerCapture(t.pointerId)}catch{}}function Ht(){window.addEventListener("pointermove",Le),window.addEventListener("pointerup",ft),window.addEventListener("pointercancel",ft)}function Ae(){window.removeEventListener("pointermove",Le),window.removeEventListener("pointerup",ft),window.removeEventListener("pointercancel",ft)}function gr(t){if(t.button!==0||!D())return;if(!t.target.closest(".nf-sticker")&&!yr(t)){A=null,M();return}const e=t.target.closest(".nf-handle"),n=t.target.closest(".nf-sticker");if(n&&n.dataset.preview!=="true"){t.preventDefault(),t.stopPropagation(),A=n.dataset.id,Bt(t),wr({kind:"sticker",id:A,dir:(e==null?void 0:e.dataset.dir)||"move"},t),M();return}if(A=null,H==="crop"){t.preventDefault(),Bt(t),w={kind:"crop",start:ut(t),current:ut(t)},Ht(),M();return}if(H==="arrow"||H==="rect"||H==="circle"){t.preventDefault(),Bt(t);const r=Me(t);w={kind:"sticker",type:H,start:r,current:r},Ht(),M();return}M()}function wr(t,e){e.preventDefault(),e.stopPropagation();const n=tt().getBoundingClientRect(),r=m.list().find(a=>a.id===t.id);b={...t,startX:e.clientX,startY:e.clientY,crop:m.crop(),sticker:r?{...r}:null,rect:n},Ot(t.dir==="move"||t.dir==="start"||t.dir==="end"),Ht()}function Le(t){if(w){w.current=w.kind==="crop"?ut(t):Me(t),M();return}if(!b)return;const e=(t.clientX-b.startX)/b.rect.width*b.crop.w,n=(t.clientY-b.startY)/b.rect.height*b.crop.h,r=b.sticker;if(r){if(b.dir==="end")m.update(r.id,{x2:r.x2+e,y2:r.y2+n});else if(b.dir==="start")m.update(r.id,{x:r.x+e,y:r.y+n});else if(b.dir==="move")m.update(r.id,{x:r.x+e,y:r.y+n,x2:(r.x2||r.x)+e,y2:(r.y2||r.y)+n});else{const a={x:r.x,y:r.y,w:r.w,h:r.h};br(a,b.dir,e,n),m.update(r.id,a)}M()}}function br(t,e,n,r){if(e.includes("e")&&(t.w=Math.max(.04,t.w+n)),e.includes("s")&&(t.h=Math.max(.04,t.h+r)),e.includes("w")){const a=Math.max(.04,t.w-n);t.x+=t.w-a,t.w=a}if(e.includes("n")){const a=Math.max(.04,t.h-r);t.y+=t.h-a,t.h=a}}function ft(t){if(Ae(),Ot(!1),w){Sr();return}if(b){if(b.kind==="sticker"){const e=s.canvas.getBoundingClientRect();(t.clientX<e.left-24||t.clientX>e.right+24||t.clientY<e.top-24||t.clientY>e.bottom+24)&&(m.remove(b.id),A=null)}b=null,M()}}function Sr(){const t=w;if(w=null,!t)return;if(t.kind==="crop"){const n=dt(t.start,t.current);if(Math.abs(t.current.x-t.start.x)<ye||Math.abs(t.current.y-t.start.y)<ye){M();return}const a=m.crop();m.setCrop({x:a.x+n.x*a.w,y:a.y+n.y*a.h,w:n.w*a.w,h:n.h*a.h}),V();return}const e=vr(t);e&&(A=e.id),M()}function vr(t){if(t.type==="arrow"){const e=t.current.x-t.start.x,n=t.current.y-t.start.y;return Math.hypot(e,n)<Lt?m.add("arrow",{x:t.start.x,y:t.start.y,x2:t.start.x+.12,y2:t.start.y,w:.12,h:.02}):m.add("arrow",{x:t.start.x,y:t.start.y,x2:t.current.x,y2:t.current.y,w:Math.abs(e),h:Math.abs(n)})}return m.add(t.type,dt(t.start,t.current))}function xr(){m.resetCrop(),A=null,V()}function ht(){s.resetCrop&&(s.resetCrop.hidden=!m.isCropped())}function Dt(t){if(!s.audio)return;const e=t?"Stop audio":"Record audio";s.audio.title=e,s.audio.setAttribute("aria-label",e),s.audio.dataset.active=String(!!t)}function D(){return B($)}function et(){if(!s.stage||!s.palette||!s.actions||!s.recapture)return;const t=D();s.stage.hidden=!t&&!T,s.palette.hidden=!t,s.discard&&(s.discard.hidden=!t),s.restore&&(s.restore.hidden=t||!q),t?(s.palette.appendChild(s.discard),s.palette.appendChild(s.recapture)):s.audio?s.audio.after(s.recapture):s.actions.insertBefore(s.recapture,s.submit||null),s.recapture.hidden=!1}function Er(){D()&&(q=$),$="",Z(null),et(),V()}function Cr(){B(q)&&($=q,et(),V())}function Re(){return{capture:typeof d.capture=="function"?d.capture:void 0,onBeforeCapture:typeof d.onBeforeCapture=="function"?d.onBeforeCapture:void 0}}function $e(t){if(!B(t))throw new Error("Screenshot failed; you can still send text.");$=t,q=t,m=xt(),I={w:0,h:0},A=null,w=null,b=null,Z(null)}async function Mr(){if(!($t||!s.dialog||s.dialog.hidden)){$t=!0,s.recapture.disabled=!0,S("Capturing…",!0),s.dialog.hidden=!0;try{let t="";try{t=await zn()}catch{t=await se(Re())}$e(t),S("")}catch(t){S((t==null?void 0:t.message)||"Screenshot failed; you can still send text.")}finally{s.dialog.hidden=!1,s.recapture.disabled=!1,$t=!1,et(),V()}}}function Ar(){try{if(_||(_=Zn(e=>{const n=s.text.value.trim();s.text.value=n?`${n} ${e}`:e})),!_.isSupported()){S("Audio-to-text is not supported in this browser.");return}const t=_.start();Dt(t),S(t?"Listening…":"")}catch(t){S(t.message)}}async function Lr(){if(!d.video){S("Video is disabled on this host.");return}s.dialog.hidden=!0,s.stop.hidden=!1,Q(),s.launcher.hidden=!0,J=er({onStart(){},onStop(t){T=t,s.stop.hidden=!0,lt(),s.dialog.hidden=!1,et(),V(),S(t?"Video attached.":"Recording cancelled.")},onError(t){S(t.message)}});try{await J.start()}catch(t){s.stop.hidden=!0,lt(),s.dialog.hidden=!1,S(t.message)}}function V(){if(s.shot=null,!D()){s.canvas.style.removeProperty("--nf-shot-aspect"),s.canvas.style.removeProperty("aspect-ratio"),s.canvas.innerHTML=T?`<video class="nf-recording-preview" controls src="${URL.createObjectURL(T)}"></video>`:"",ht();return}s.canvas.innerHTML=`<div class="nf-shot"><img alt="Screenshot" src="${$}" draggable="false"></div>`,s.shot=s.canvas.querySelector(".nf-shot");const t=s.shot.querySelector("img");t.draggable=!1,t.addEventListener("dragstart",n=>n.preventDefault());const e=()=>{Rr(t),M()};t.addEventListener("load",e),t.complete&&t.naturalWidth&&e(),ht()}function Rr(t){const e=t.naturalWidth||I.w,n=t.naturalHeight||I.h;if(e&&n&&(I={w:e,h:n},s.canvas.style.setProperty("--nf-shot-aspect",String(e/n)),s.canvas.style.aspectRatio=`${e} / ${n}`),!s.shot||!I.w||!I.h)return;const r=m.crop(),a=I.w/I.h,i=r.w/r.h*a,o=Math.min(1,i/a),c=Math.min(1,a/i);s.shot.style.left=`${(1-o)/2*100}%`,s.shot.style.top=`${(1-c)/2*100}%`,s.shot.style.width=`${o*100}%`,s.shot.style.height=`${c*100}%`,t.style.width=`${100/r.w}%`,t.style.height=`${100/r.h}%`,t.style.left=`${-r.x/r.w*100}%`,t.style.top=`${-r.y/r.h*100}%`}function $r(t){return t.type==="arrow"?{id:"preview",type:"arrow",number:"",x:t.start.x,y:t.start.y,x2:t.current.x,y2:t.current.y,w:Math.abs(t.current.x-t.start.x),h:Math.abs(t.current.y-t.start.y)}:{id:"preview",type:t.type,number:"",...dt(t.start,t.current)}}function M(){if((s.shot||s.canvas).querySelectorAll(".nf-sticker, .nf-crop").forEach(i=>i.remove()),!D()||!s.shot){ht();return}const e=m.crop(),n=tt(),r=Et(n.clientWidth||400);if(s.shot.style.setProperty("--nf-anno-stroke",`${r.stroke}px`),s.shot.style.setProperty("--nf-anno-badge",`${r.badgeRadius*2}px`),s.shot.style.setProperty("--nf-anno-badge-font",`${r.fontSize}px`),s.shot.style.setProperty("--nf-anno-handle",`${Math.max(8,r.stroke*2.5)}px`),(w==null?void 0:w.kind)==="crop"){const i=document.createElement("div");i.className="nf-crop",Te(i,dt(w.start,w.current),{x:0,y:0,w:1,h:1}),s.shot.appendChild(i)}const a=m.list().slice();if((w==null?void 0:w.kind)==="sticker"&&a.push($r(w)),a.forEach(i=>{const o=i.id==="preview",c=!o&&i.id===A,l=document.createElement("div");if(l.className=`nf-sticker nf-${i.type}`,l.dataset.id=i.id,c&&(l.dataset.selected="true"),o&&(l.dataset.preview="true"),i.type==="arrow"?Tr(l,i,e,c,r):(Te(l,i,e),c&&["nw","ne","sw","se"].forEach(u=>Ft(l,u))),!o&&i.number){const u=document.createElement("span");u.className="nf-badge",u.textContent=String(i.number),l.appendChild(u)}s.shot.appendChild(l)}),s.canvas.querySelectorAll(":scope > .nf-recording-preview").forEach(i=>i.remove()),T){const i=document.createElement("video");i.className="nf-recording-preview",i.controls=!0,i.src=URL.createObjectURL(T),i.style.position="absolute",i.style.right="8px",i.style.bottom="8px",i.style.width="160px",s.canvas.appendChild(i)}ht()}function Tr(t,e,n,r,a=Et(400)){const i=tt(),o=i.clientWidth,c=i.clientHeight,l=(e.x-n.x)/n.w*o,u=(e.y-n.y)/n.h*c,f=((e.x2??e.x+e.w)-n.x)/n.w*o,p=((e.y2??e.y)-n.y)/n.h*c,y=Math.max(18,a.arrowHead+a.stroke*2),v=Math.min(l,f)-y,P=Math.min(u,p)-y,F=Math.max(2,Math.abs(f-l))+y*2,nt=Math.max(2,Math.abs(p-u))+y*2,X=l-v,Y=u-P,jt=f-v,_t=p-P,U=he(X,Y,jt,_t,a),G=document.createElementNS("http://www.w3.org/2000/svg","svg");t.style.left=`${v}px`,t.style.top=`${P}px`,t.style.width=`${F}px`,t.style.height=`${nt}px`,G.setAttribute("class","nf-arrow-svg"),G.setAttribute("viewBox",`0 0 ${F} ${nt}`),G.setAttribute("width",String(F)),G.setAttribute("height",String(nt)),G.innerHTML=`
40
- <line class="nf-arrow-hit" x1="${X}" y1="${Y}" x2="${jt}" y2="${_t}" />
41
- <line class="nf-arrow-shaft" x1="${X}" y1="${Y}" x2="${U.shaftEnd.x}" y2="${U.shaftEnd.y}" />
42
- <polygon class="nf-arrow-head" points="${U.tipX},${U.tipY} ${U.left.x},${U.left.y} ${U.right.x},${U.right.y}" />
43
- `,t.appendChild(G),r&&(Ft(t,"start",{left:X-5,top:Y-5}),Ft(t,"end",{left:jt-5,top:_t-5}))}function Ft(t,e,n){const r=document.createElement("span");r.className="nf-handle",r.dataset.dir=e,n&&(r.style.left=`${n.left}px`,r.style.top=`${n.top}px`),t.appendChild(r)}function Te(t,e,n){t.style.left=`${(e.x-n.x)/n.w*100}%`,t.style.top=`${(e.y-n.y)/n.h*100}%`,t.style.width=`${e.w/n.w*100}%`,t.style.height=`${e.h/n.h*100}%`}function Pr(){try{return String(localStorage.getItem(be)||"").trim()}catch{return""}}function kr(t){const e=String(t||"").trim();if(!(!e||e===Rt))try{localStorage.setItem(be,e)}catch{}}function Pe(){return!!(String(R.userId||"").trim()||String(R.email||"").trim()||String(R.displayName||"").trim())}function Ir(){return String(R.displayName||R.email||R.userId||"").trim()}function Or(){var e;if(Pe())return Ir()||Rt;const t=String(((e=s.author)==null?void 0:e.value)||"").trim();return t?(kr(t),t):Rt}function ke(){if(!s.author)return;const t=Pe();if(s.author.hidden=t,t){s.author.value="";return}s.author.value=Pr()}function Ie(t,e=we){const n=Number(t);return Number.isFinite(n)?Math.min(hr,Math.max(0,Math.floor(n))):e}function Oe(t={}){Gn(t);const e=Object.prototype.hasOwnProperty.call(t,"kinds");d={...d,endpoint:String(t.endpoint||d.endpoint||"").replace(/\/$/,""),projectKey:t.projectKey==null?d.projectKey:String(t.projectKey),version:t.version==null?d.version:String(t.version),name:t.name==null?d.name:String(t.name||""),targets:t.targets===void 0?d.targets:t.targets,hideLauncher:t.hideLauncher==null?d.hideLauncher:!!t.hideLauncher,theme:Se(t.theme??d.theme),video:t.video==null?d.video:!!t.video,consoleLogLimit:t.consoleLogLimit==null?d.consoleLogLimit:Ie(t.consoleLogLimit,d.consoleLogLimit),kinds:e?lr(t.kinds):d.kinds,capture:t.capture===void 0?d.capture:t.capture,onBeforeCapture:t.onBeforeCapture===void 0?d.onBeforeCapture:t.onBeforeCapture}}function pt(t={}){return Oe(t),h&&Q(),mt}function Be(t={}){return Oe(t),kt(),Q(),mt}function He(t){return pt({theme:t})}function De(t){const e=!!t;return!e&&h&&s.dialog&&!s.dialog.hidden&&K(),pt({hideLauncher:!e})}async function Ut(){kt(),Fe(),Q(),s.launcher.hidden=!0,m=xt(),I={w:0,h:0},T=null,$="",q="",A=null,w=null,b=null,j=st(d.kinds),It(j),Z(null),Dt(!1),s.text.value="",ke(),S("");try{$e(await se(Re())),S("")}catch(t){$="",S((t==null?void 0:t.message)||"Screenshot failed; you can still send text.")}et(),s.dialog.hidden=!1,V(),s.text.focus()}function K(){h&&(_==null||_.stop(),Dt(!1),Ae(),w=null,b=null,Ot(!1),Fe(),s.dialog.hidden=!0,s.stop.hidden=!0,lt())}function Br(){const t=s.dialog,e=s.panel,n=s.panelBody,r=s.successMsg;if(!t||!e||!n||!r)return Promise.resolve();Pt=!0,S("");const a=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches,i=e.getBoundingClientRect();if(n.hidden=!0,r.hidden=!1,t.classList.add("nf-success"),t.style.opacity="1",a)return new Promise(u=>{window.setTimeout(()=>u(),1e3)});const o=e.getBoundingClientRect(),c=o.width>0?i.width/o.width:1,l=o.height>0?i.height/o.height:1;return e.style.transformOrigin="center center",e.style.transition="none",e.style.transform=`scale(${c}, ${l})`,e.getBoundingClientRect(),new Promise(u=>{let f=!1;const p=()=>{f||(f=!0,e.removeEventListener("transitionend",y),window.setTimeout(()=>{t.style.transition="opacity 0.28s ease",t.style.opacity="0",window.setTimeout(()=>u(),280)},1e3))},y=v=>{v.target!==e||v.propertyName!=="transform"||p()};e.addEventListener("transitionend",y),requestAnimationFrame(()=>{e.style.transition="transform 0.48s cubic-bezier(0.22, 1, 0.36, 1)",e.style.transform="scale(1)"}),window.setTimeout(p,700)})}function Fe(){Pt=!1,s.dialog&&(s.dialog.classList.remove("nf-success"),s.dialog.style.opacity="",s.dialog.style.transition="",s.panel&&(s.panel.style.transform="",s.panel.style.transition="",s.panel.style.transformOrigin=""),s.panelBody&&(s.panelBody.hidden=!1),s.successMsg&&(s.successMsg.hidden=!0))}function Ue(t={}){R={...R,...Yn(t)},ke()}async function Nt(){if(kt(),Tt)return null;const t=s.text.value.trim();if(!t&&!D()&&!T)return S("Add a note, screenshot, or video first."),null;if(!d.endpoint||!d.projectKey)return S("Notefully is missing endpoint or projectKey."),null;Tt=!0,Ne(!0),S("Submitting…",!0);try{const e=Or(),n=new FormData;if(n.append("message",t),n.append("kind",j),n.append("version",d.version||"0.0.0"),n.append("author",e),d.name&&n.append("name",d.name),n.append("context",JSON.stringify({...Xn({...R,displayName:R.displayName||e}),author:e,console:ge.snapshot().slice(-Ie(d.consoleLogLimit))})),n.append("annotations",JSON.stringify(m.list())),n.append("crop",JSON.stringify(m.crop())),Array.isArray(d.targets)&&n.append("targets",JSON.stringify(d.targets)),D()){const i=await pr($);if(n.append("screenshot",i,"screenshot.png"),m.list().length||m.isCropped()){const o=await cr($,m.crop(),m.list(),{mark:ve("--nf-mark","#fdd341"),markText:ve("--nf-mark-text","#2a2140")});n.append("screenshotBaked",o,"screenshot.baked.png")}}T&&n.append("recording",T,"recording.webm");const r=await fetch(`${d.endpoint}/v1/reports`,{method:"POST",headers:{"X-Notefully-Key":d.projectKey},body:n});let a=null;try{a=await r.json()}catch{a=null}if(!r.ok)throw S((a==null?void 0:a.error)||"Submit failed."),new Error((a==null?void 0:a.error)||`Submit failed (${r.status})`);return await Br(),K(),a}finally{Tt=!1,Ne(!1)}}function Ne(t){s.submit&&(s.submit.disabled=!!t,s.submit.setAttribute("aria-busy",t?"true":"false"))}function je(){K(),h==null||h.remove(),h=null,s={}}const mt={init:Be,configure:pt,setTheme:He,setVisible:De,open:Ut,close:K,identify:Ue,submit:Nt,destroy:je};return typeof window<"u"&&(window.Notefully=mt),C.close=K,C.configure=pt,C.default=mt,C.destroy=je,C.identify=Ue,C.init=Be,C.open=Ut,C.setTheme=He,C.setVisible=De,C.submit=Nt,Object.defineProperties(C,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),C})({});
49
+ `,document.body.appendChild(h),s={launcher:p(".nf-launcher"),dialog:p(".nf-dialog"),panel:p(".nf-panel"),panelBody:p(".nf-panel-body"),successMsg:p(".nf-success-msg"),stage:p(".nf-stage"),palette:p(".nf-palette"),canvas:p(".nf-canvas"),text:p(".nf-text"),author:p(".nf-author"),kind:p(".nf-kind"),privacy:p(".nf-privacy"),privacySummary:p(".nf-privacy-summary"),privacyText:p(".nf-privacy-text"),privacyChange:p(".nf-privacy-change"),privacyPanel:p(".nf-privacy-panel"),privacyScroll:p(".nf-privacy-scroll"),privacyDone:p(".nf-privacy-done"),actions:p(".nf-actions"),restore:p(".nf-restore"),status:p(".nf-status"),audio:p(".nf-audio"),video:p(".nf-video"),discard:p(".nf-discard-shot"),recapture:p(".nf-recapture"),stop:p(".nf-stop-video"),resetCrop:p(".nf-reset-crop"),submit:p(".nf-submit"),shot:null},Hr(),nt()),h}function nt(){var t;h&&(h.dataset.theme=Ae(d.theme),d.hideLauncher?h.setAttribute("data-nf-hidden-launcher",""):h.removeAttribute("data-nf-hidden-launcher"),s.video&&(s.video.hidden=!d.video),Re(),(t=s.dialog)!=null&&t.hidden&&ht())}function ht(){s.launcher&&(s.launcher.hidden=!!d.hideLauncher)}function Hr(){s.launcher.addEventListener("click",()=>Wt()),p(".nf-dialog").addEventListener("click",e=>{Dt||e.target===s.dialog&&J()}),h.querySelectorAll(".nf-tool").forEach(e=>{e.addEventListener("click",()=>rt(e.dataset.tool))}),s.resetCrop.addEventListener("click",_r),s.canvas.addEventListener("pointerdown",Br),s.canvas.addEventListener("dragstart",e=>e.preventDefault());const t=p(".nf-kind");t&&t.addEventListener("click",e=>{const n=e.target.closest("[data-kind]");n&&Ft(n.dataset.kind)}),s.discard.addEventListener("click",Vr),s.recapture.addEventListener("click",()=>{zr().catch(e=>v(e.message||"Recapture failed."))}),s.restore.addEventListener("click",Wr),s.audio.addEventListener("click",qr),s.video.addEventListener("click",Kr),s.stop.addEventListener("click",()=>et==null?void 0:et.stop()),s.privacyChange.addEventListener("click",()=>bt(!q)),s.privacyDone.addEventListener("click",()=>bt(!1)),s.privacyScroll.addEventListener("change",ti),p(".nf-submit").addEventListener("click",()=>{zt().catch(e=>v(e.message||"Submit failed."))}),Re(),rt(null)}function H(t){return String(t||"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Re(){const t=h==null?void 0:h.querySelector(".nf-kind");if(!t)return;const e=Array.isArray(d.kinds)&&d.kinds.length?d.kinds:V;t.innerHTML=e.map(i=>`<button type="button" data-kind="${H(i.id)}">${H(i.label)}</button>`).join("");const r=e.map(i=>i.id).includes(W)?W:dt(e);Ft(r)}function Ft(t){W=(d.kinds||V).map(n=>n.id).includes(t)?t:dt(d.kinds),h==null||h.querySelectorAll("[data-kind]").forEach(n=>{n.dataset.active=String(n.dataset.kind===W)})}function rt(t){F=Tr.has(t)?t:null,L=null,h.querySelectorAll(".nf-tool").forEach(e=>{e.dataset.active=String(e.dataset.tool===F)}),s.canvas&&(s.canvas.dataset.draw=F?"true":"false"),N()&&M()}function $e(t){return Math.min(1,Math.max(0,t))}function it(){return s.shot||s.canvas}function pt(t){const e=it().getBoundingClientRect();return{x:$e((t.clientX-e.left)/Math.max(e.width,1)),y:$e((t.clientY-e.top)/Math.max(e.height,1))}}function Dr(t){const e=it().getBoundingClientRect();return t.clientX>=e.left&&t.clientX<=e.right&&t.clientY>=e.top&&t.clientY<=e.bottom}function ke(t){const e=pt(t),n=y.crop();return{x:n.x+e.x*n.w,y:n.y+e.y*n.h}}function mt(t,e){const n=Math.min(t.x,e.x),r=Math.min(t.y,e.y);return{x:n,y:r,w:Math.max(Pt,Math.abs(e.x-t.x)),h:Math.max(Pt,Math.abs(e.y-t.y))}}function Ut(t){h&&(t?h.dataset.grabbing="true":delete h.dataset.grabbing)}function Nt(t){try{s.canvas.setPointerCapture(t.pointerId)}catch{}}function jt(){window.addEventListener("pointermove",Pe),window.addEventListener("pointerup",yt),window.addEventListener("pointercancel",yt)}function Te(){window.removeEventListener("pointermove",Pe),window.removeEventListener("pointerup",yt),window.removeEventListener("pointercancel",yt)}function Br(t){if(t.button!==0||!N())return;if(!t.target.closest(".nf-sticker")&&!Dr(t)){L=null,M();return}const e=t.target.closest(".nf-handle"),n=t.target.closest(".nf-sticker");if(n&&n.dataset.preview!=="true"){t.preventDefault(),t.stopPropagation(),L=n.dataset.id,Nt(t),Fr({kind:"sticker",id:L,dir:(e==null?void 0:e.dataset.dir)||"move"},t),M();return}if(L=null,F==="crop"){t.preventDefault(),Nt(t),w={kind:"crop",start:pt(t),current:pt(t)},jt(),M();return}if(F==="arrow"||F==="rect"||F==="circle"){t.preventDefault(),Nt(t);const r=ke(t);w={kind:"sticker",type:F,start:r,current:r},jt(),M();return}M()}function Fr(t,e){e.preventDefault(),e.stopPropagation();const n=it().getBoundingClientRect(),r=y.list().find(i=>i.id===t.id);b={...t,startX:e.clientX,startY:e.clientY,crop:y.crop(),sticker:r?{...r}:null,rect:n},Ut(t.dir==="move"||t.dir==="start"||t.dir==="end"),jt()}function Pe(t){if(w){w.current=w.kind==="crop"?pt(t):ke(t),M();return}if(!b)return;const e=(t.clientX-b.startX)/b.rect.width*b.crop.w,n=(t.clientY-b.startY)/b.rect.height*b.crop.h,r=b.sticker;if(r){if(b.dir==="end")y.update(r.id,{x2:r.x2+e,y2:r.y2+n});else if(b.dir==="start")y.update(r.id,{x:r.x+e,y:r.y+n});else if(b.dir==="move")y.update(r.id,{x:r.x+e,y:r.y+n,x2:(r.x2||r.x)+e,y2:(r.y2||r.y)+n});else{const i={x:r.x,y:r.y,w:r.w,h:r.h};Ur(i,b.dir,e,n),y.update(r.id,i)}M()}}function Ur(t,e,n,r){if(e.includes("e")&&(t.w=Math.max(.04,t.w+n)),e.includes("s")&&(t.h=Math.max(.04,t.h+r)),e.includes("w")){const i=Math.max(.04,t.w-n);t.x+=t.w-i,t.w=i}if(e.includes("n")){const i=Math.max(.04,t.h-r);t.y+=t.h-i,t.h=i}}function yt(t){if(Te(),Ut(!1),w){Nr();return}if(b){if(b.kind==="sticker"){const e=s.canvas.getBoundingClientRect();(t.clientX<e.left-24||t.clientX>e.right+24||t.clientY<e.top-24||t.clientY>e.bottom+24)&&(y.remove(b.id),L=null)}b=null,M()}}function Nr(){const t=w;if(w=null,!t)return;if(t.kind==="crop"){const n=mt(t.start,t.current);if(Math.abs(t.current.x-t.start.x)<xe||Math.abs(t.current.y-t.start.y)<xe){M();return}const i=y.crop();y.setCrop({x:i.x+n.x*i.w,y:i.y+n.y*i.h,w:n.w*i.w,h:n.h*i.h}),K();return}const e=jr(t);e&&(L=e.id),M()}function jr(t){if(t.type==="arrow"){const e=t.current.x-t.start.x,n=t.current.y-t.start.y;return Math.hypot(e,n)<Pt?y.add("arrow",{x:t.start.x,y:t.start.y,x2:t.start.x+.12,y2:t.start.y,w:.12,h:.02}):y.add("arrow",{x:t.start.x,y:t.start.y,x2:t.current.x,y2:t.current.y,w:Math.abs(e),h:Math.abs(n)})}return y.add(t.type,mt(t.start,t.current))}function _r(){y.resetCrop(),L=null,K()}function gt(){s.resetCrop&&(s.resetCrop.hidden=!y.isCropped())}function _t(t){if(!s.audio)return;const e=t?"Stop audio":"Record audio";s.audio.title=e,s.audio.setAttribute("aria-label",e),s.audio.dataset.active=String(!!t)}function N(){return B(k)}function at(){if(!s.stage||!s.palette||!s.actions||!s.recapture)return;const t=N();s.stage.hidden=!t&&!T,s.palette.hidden=!t,s.discard&&(s.discard.hidden=!t),s.restore&&(s.restore.hidden=t||!G),t?(s.palette.appendChild(s.discard),s.palette.appendChild(s.recapture)):s.audio?s.audio.after(s.recapture):s.actions.insertBefore(s.recapture,s.submit||null),s.recapture.hidden=!1}function Vr(){N()&&(G=k),k="",rt(null),at(),K()}function Wr(){B(G)&&(k=G,at(),K())}function Ie(){return{capture:typeof d.capture=="function"?d.capture:void 0,onBeforeCapture:typeof d.onBeforeCapture=="function"?d.onBeforeCapture:void 0}}function Oe(t){if(!B(t))throw new Error("Screenshot failed; you can still send text.");k=t,G=t,y=Lt(),I={w:0,h:0},L=null,w=null,b=null,rt(null)}async function zr(){if(!(Ot||!s.dialog||s.dialog.hidden)){Ot=!0,s.recapture.disabled=!0,v("Capturing…",!0),s.dialog.hidden=!0;try{let t="";try{t=await rr()}catch{t=await fe(Ie())}Oe(t),v("")}catch(t){v((t==null?void 0:t.message)||"Screenshot failed; you can still send text.")}finally{s.dialog.hidden=!1,s.recapture.disabled=!1,Ot=!1,at(),K()}}}function qr(){try{if(z||(z=dr(e=>{const n=s.text.value.trim();s.text.value=n?`${n} ${e}`:e})),!z.isSupported()){v("Audio-to-text is not supported in this browser.");return}const t=z.start();_t(t),v(t?"Listening…":"")}catch(t){v(t.message)}}async function Kr(){if(!d.video){v("Video is disabled on this host.");return}s.dialog.hidden=!0,s.stop.hidden=!1,nt(),s.launcher.hidden=!0,et=hr({onStart(){},onStop(t){T=t,s.stop.hidden=!0,ht(),s.dialog.hidden=!1,at(),K(),v(t?"Video attached.":"Recording cancelled.")},onError(t){v(t.message)}});try{await et.start()}catch(t){s.stop.hidden=!0,ht(),s.dialog.hidden=!1,v(t.message)}}function K(){if(s.shot=null,!N()){s.canvas.style.removeProperty("--nf-shot-aspect"),s.canvas.style.removeProperty("aspect-ratio"),s.canvas.innerHTML=T?`<video class="nf-recording-preview" controls src="${URL.createObjectURL(T)}"></video>`:"",gt();return}s.canvas.innerHTML=`<div class="nf-shot"><img alt="Screenshot" src="${k}" draggable="false"></div>`,s.shot=s.canvas.querySelector(".nf-shot");const t=s.shot.querySelector("img");t.draggable=!1,t.addEventListener("dragstart",n=>n.preventDefault());const e=()=>{Xr(t),M()};t.addEventListener("load",e),t.complete&&t.naturalWidth&&e(),gt()}function Xr(t){const e=t.naturalWidth||I.w,n=t.naturalHeight||I.h;if(e&&n&&(I={w:e,h:n},s.canvas.style.setProperty("--nf-shot-aspect",String(e/n)),s.canvas.style.aspectRatio=`${e} / ${n}`),!s.shot||!I.w||!I.h)return;const r=y.crop(),i=I.w/I.h,a=r.w/r.h*i,o=Math.min(1,a/i),c=Math.min(1,i/a);s.shot.style.left=`${(1-o)/2*100}%`,s.shot.style.top=`${(1-c)/2*100}%`,s.shot.style.width=`${o*100}%`,s.shot.style.height=`${c*100}%`,t.style.width=`${100/r.w}%`,t.style.height=`${100/r.h}%`,t.style.left=`${-r.x/r.w*100}%`,t.style.top=`${-r.y/r.h*100}%`}function Yr(t){return t.type==="arrow"?{id:"preview",type:"arrow",number:"",x:t.start.x,y:t.start.y,x2:t.current.x,y2:t.current.y,w:Math.abs(t.current.x-t.start.x),h:Math.abs(t.current.y-t.start.y)}:{id:"preview",type:t.type,number:"",...mt(t.start,t.current)}}function M(){if((s.shot||s.canvas).querySelectorAll(".nf-sticker, .nf-crop").forEach(a=>a.remove()),!N()||!s.shot){gt();return}const e=y.crop(),n=it(),r=Rt(n.clientWidth||400);if(s.shot.style.setProperty("--nf-anno-stroke",`${r.stroke}px`),s.shot.style.setProperty("--nf-anno-badge",`${r.badgeRadius*2}px`),s.shot.style.setProperty("--nf-anno-badge-font",`${r.fontSize}px`),s.shot.style.setProperty("--nf-anno-handle",`${Math.max(8,r.stroke*2.5)}px`),(w==null?void 0:w.kind)==="crop"){const a=document.createElement("div");a.className="nf-crop",He(a,mt(w.start,w.current),{x:0,y:0,w:1,h:1}),s.shot.appendChild(a)}const i=y.list().slice();if((w==null?void 0:w.kind)==="sticker"&&i.push(Yr(w)),i.forEach(a=>{const o=a.id==="preview",c=!o&&a.id===L,l=document.createElement("div");if(l.className=`nf-sticker nf-${a.type}`,l.dataset.id=a.id,c&&(l.dataset.selected="true"),o&&(l.dataset.preview="true"),a.type==="arrow"?Gr(l,a,e,c,r):(He(l,a,e),c&&["nw","ne","sw","se"].forEach(u=>Vt(l,u))),!o&&a.number){const u=document.createElement("span");u.className="nf-badge",u.textContent=String(a.number),l.appendChild(u)}s.shot.appendChild(l)}),s.canvas.querySelectorAll(":scope > .nf-recording-preview").forEach(a=>a.remove()),T){const a=document.createElement("video");a.className="nf-recording-preview",a.controls=!0,a.src=URL.createObjectURL(T),a.style.position="absolute",a.style.right="8px",a.style.bottom="8px",a.style.width="160px",s.canvas.appendChild(a)}gt()}function Gr(t,e,n,r,i=Rt(400)){const a=it(),o=a.clientWidth,c=a.clientHeight,l=(e.x-n.x)/n.w*o,u=(e.y-n.y)/n.h*c,f=((e.x2??e.x+e.w)-n.x)/n.w*o,m=((e.y2??e.y)-n.y)/n.h*c,g=Math.max(18,i.arrowHead+i.stroke*2),S=Math.min(l,f)-g,P=Math.min(u,m)-g,j=Math.max(2,Math.abs(f-l))+g*2,ot=Math.max(2,Math.abs(m-u))+g*2,Q=l-S,Z=u-P,qt=f-S,Kt=m-P,_=we(Q,Z,qt,Kt,i),tt=document.createElementNS("http://www.w3.org/2000/svg","svg");t.style.left=`${S}px`,t.style.top=`${P}px`,t.style.width=`${j}px`,t.style.height=`${ot}px`,tt.setAttribute("class","nf-arrow-svg"),tt.setAttribute("viewBox",`0 0 ${j} ${ot}`),tt.setAttribute("width",String(j)),tt.setAttribute("height",String(ot)),tt.innerHTML=`
50
+ <line class="nf-arrow-hit" x1="${Q}" y1="${Z}" x2="${qt}" y2="${Kt}" />
51
+ <line class="nf-arrow-shaft" x1="${Q}" y1="${Z}" x2="${_.shaftEnd.x}" y2="${_.shaftEnd.y}" />
52
+ <polygon class="nf-arrow-head" points="${_.tipX},${_.tipY} ${_.left.x},${_.left.y} ${_.right.x},${_.right.y}" />
53
+ `,t.appendChild(tt),r&&(Vt(t,"start",{left:Q-5,top:Z-5}),Vt(t,"end",{left:qt-5,top:Kt-5}))}function Vt(t,e,n){const r=document.createElement("span");r.className="nf-handle",r.dataset.dir=e,n&&(r.style.left=`${n.left}px`,r.style.top=`${n.top}px`),t.appendChild(r)}function He(t,e,n){t.style.left=`${(e.x-n.x)/n.w*100}%`,t.style.top=`${(e.y-n.y)/n.h*100}%`,t.style.width=`${e.w/n.w*100}%`,t.style.height=`${e.h/n.h*100}%`}function De(){try{return String(localStorage.getItem(Me)||"").trim()}catch{return""}}function Jr(t){const e=String(t||"").trim();if(!(!e||e===It))try{localStorage.setItem(Me,e)}catch{}}function Be(){return!!(String($.userId||"").trim()||String($.email||"").trim()||String($.displayName||"").trim())}function Fe(){return String($.displayName||$.email||$.userId||"").trim()}function Qr(){var e;if(Be())return Fe()||It;const t=String(((e=s.author)==null?void 0:e.value)||"").trim();return t?(Jr(t),t):It}function Ue(){if(!s.author)return;const t=Be();if(s.author.hidden=t,t){s.author.value="";return}s.author.value=De()}function Ne(t,e=Ce){const n=Number(t);return Number.isFinite(n)?Math.min(Ir,Math.max(0,Math.floor(n))):e}function je(t={}){cr(t);const e=Object.prototype.hasOwnProperty.call(t,"kinds");d={...d,endpoint:String(t.endpoint||d.endpoint||"").replace(/\/$/,""),projectKey:t.projectKey==null?d.projectKey:String(t.projectKey),version:t.version==null?d.version:String(t.version),name:t.name==null?d.name:String(t.name||""),targets:t.targets===void 0?d.targets:t.targets,hideLauncher:t.hideLauncher==null?d.hideLauncher:!!t.hideLauncher,theme:Ae(t.theme??d.theme),video:t.video==null?d.video:!!t.video,consoleLogLimit:t.consoleLogLimit==null?d.consoleLogLimit:Ne(t.consoleLogLimit,d.consoleLogLimit),kinds:e?$r(t.kinds):d.kinds,capture:t.capture===void 0?d.capture:t.capture,onBeforeCapture:t.onBeforeCapture===void 0?d.onBeforeCapture:t.onBeforeCapture}}function wt(t={}){return je(t),h&&nt(),vt}function _e(t={}){return je(t),Bt(),nt(),vt}function Ve(t){return wt({theme:t})}function We(t){const e=!!t;return!e&&h&&s.dialog&&!s.dialog.hidden&&J(),wt({hideLauncher:!e})}function Zr(){const t=Fe()||De()||void 0,e=or({...$,displayName:$.displayName||t});U=Er(e),O=Cr(Ee.snapshot().slice(-Ne(d.consoleLogLimit))),q=!1}function bt(t){q=!!t,s.privacyPanel&&(s.privacyPanel.hidden=!q),s.privacyChange&&(s.privacyChange.setAttribute("aria-expanded",q?"true":"false"),s.privacyChange.dataset.active=String(q)),q&&Ye()}function ze(){if(!s.privacy||!s.privacyText||!s.privacyChange)return;const t=Ar({diagnostics:U,logs:O});s.privacyText.textContent=t,s.privacyText.hidden=!t,s.privacy.hidden=U.length===0&&O.length===0,s.privacyChange.hidden=!1}function qe(t,e,n){return`<label class="nf-privacy-toggle">
54
+ <span class="nf-privacy-toggle-label">Redact</span>
55
+ <input type="checkbox" ${t?"checked":""} ${e?'data-indeterminate="true"':""} aria-label="${H(n)}">
56
+ </label>`}function Ke(t,e,n,r,i){return`<div class="nf-privacy-row" data-kind="${H(t)}" data-id="${H(e)}">
57
+ <div class="nf-privacy-row-text">
58
+ <div class="nf-privacy-row-title">${H(n)}</div>
59
+ <div class="nf-privacy-row-detail">${H(r)}</div>
60
+ </div>
61
+ ${qe(i,!1,`Redact ${n}`)}
62
+ </div>`}function Xe(t,e,n,r){if(!n.length)return"";const i=Mr(n);return`<section class="nf-privacy-section" data-section="${H(t)}">
63
+ <div class="nf-privacy-section-head">
64
+ <h3 class="nf-privacy-section-title">${H(e)}</h3>
65
+ ${qe(i.checked,i.indeterminate,`Redact all ${e.toLowerCase()}`)}
66
+ </div>
67
+ <div class="nf-privacy-rows">${r}</div>
68
+ </section>`}function Ye(){if(!s.privacyScroll)return;const t=U.map(n=>Ke("diagnostic",n.key,n.label,Lr(n.value),n.redacted)).join(""),e=O.map(n=>Ke("log",n.id,n.level,n.text,n.redacted)).join("");s.privacyScroll.innerHTML=[Xe("diagnostics","Diagnostics",U,t),O.length?Xe("logs","Logs",O,e):""].join(""),s.privacyScroll.querySelectorAll('input[data-indeterminate="true"]').forEach(n=>{n.indeterminate=!0,n.removeAttribute("data-indeterminate")}),ze()}function ti(t){const e=t.target;if(!(e instanceof HTMLInputElement)||e.type!=="checkbox")return;const n=e.closest("[data-section]"),r=e.closest(".nf-privacy-row"),i=e.checked;if(r){const a=r.dataset.kind,o=r.dataset.id;if(a==="diagnostic"){const c=U.find(l=>l.key===o);c&&(c.redacted=i)}else if(a==="log"){const c=O.find(l=>l.id===o);c&&(c.redacted=i)}}else if(n){const a=n.dataset.section;a==="diagnostics"?be(U,i):a==="logs"&&be(O,i)}else return;Ye()}async function Wt(){Bt(),Ge(),nt(),s.launcher.hidden=!0,y=Lt(),I={w:0,h:0},T=null,k="",G="",L=null,w=null,b=null,W=dt(d.kinds),Ft(W),rt(null),_t(!1),s.text.value="",Ue(),v(""),Zr();try{Oe(await fe(Ie())),v("")}catch(t){k="",v((t==null?void 0:t.message)||"Screenshot failed; you can still send text.")}at(),bt(!1),ze(),s.dialog.hidden=!1,K(),s.text.focus()}function J(){h&&(z==null||z.stop(),_t(!1),Te(),w=null,b=null,Ut(!1),Ge(),bt(!1),s.dialog.hidden=!0,s.stop.hidden=!0,ht())}function ei(){const t=s.dialog,e=s.panel,n=s.panelBody,r=s.successMsg;if(!t||!e||!n||!r)return Promise.resolve();Dt=!0,v("");const i=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches,a=e.getBoundingClientRect();if(n.hidden=!0,r.hidden=!1,t.classList.add("nf-success"),t.style.opacity="1",i)return new Promise(u=>{window.setTimeout(()=>u(),1e3)});const o=e.getBoundingClientRect(),c=o.width>0?a.width/o.width:1,l=o.height>0?a.height/o.height:1;return e.style.transformOrigin="center center",e.style.transition="none",e.style.transform=`scale(${c}, ${l})`,e.getBoundingClientRect(),new Promise(u=>{let f=!1;const m=()=>{f||(f=!0,e.removeEventListener("transitionend",g),window.setTimeout(()=>{t.style.transition="opacity 0.28s ease",t.style.opacity="0",window.setTimeout(()=>u(),280)},1e3))},g=S=>{S.target!==e||S.propertyName!=="transform"||m()};e.addEventListener("transitionend",g),requestAnimationFrame(()=>{e.style.transition="transform 0.48s cubic-bezier(0.22, 1, 0.36, 1)",e.style.transform="scale(1)"}),window.setTimeout(m,700)})}function Ge(){Dt=!1,s.dialog&&(s.dialog.classList.remove("nf-success"),s.dialog.style.opacity="",s.dialog.style.transition="",s.panel&&(s.panel.style.transform="",s.panel.style.transition="",s.panel.style.transformOrigin=""),s.panelBody&&(s.panelBody.hidden=!1),s.successMsg&&(s.successMsg.hidden=!0))}function Je(t={}){$={...$,...sr(t)},Ue()}async function zt(){if(Bt(),Ht)return null;const t=s.text.value.trim();if(!t&&!N()&&!T)return v("Add a note, screenshot, or video first."),null;if(!d.endpoint||!d.projectKey)return v("Notefully is missing endpoint or projectKey."),null;Ht=!0,Qe(!0),v("Submitting…",!0);try{const e=Qr(),n=new FormData;if(n.append("message",t),n.append("kind",W),n.append("version",d.version||"0.0.0"),n.append("author",e),d.name&&n.append("name",d.name),n.append("context",JSON.stringify(Rr({author:e,diagnostics:U,logs:O}))),n.append("annotations",JSON.stringify(y.list())),n.append("crop",JSON.stringify(y.crop())),Array.isArray(d.targets)&&n.append("targets",JSON.stringify(d.targets)),N()){const a=await Or(k);if(n.append("screenshot",a,"screenshot.png"),y.list().length||y.isCropped()){const o=await vr(k,y.crop(),y.list(),{mark:Le("--nf-mark","#fdd341"),markText:Le("--nf-mark-text","#2a2140")});n.append("screenshotBaked",o,"screenshot.baked.png")}}T&&n.append("recording",T,"recording.webm");const r=await fetch(`${d.endpoint}/v1/reports`,{method:"POST",headers:{"X-Notefully-Key":d.projectKey},body:n});let i=null;try{i=await r.json()}catch{i=null}if(!r.ok)throw v((i==null?void 0:i.error)||"Submit failed."),new Error((i==null?void 0:i.error)||`Submit failed (${r.status})`);return await ei(),J(),i}finally{Ht=!1,Qe(!1)}}function Qe(t){s.submit&&(s.submit.disabled=!!t,s.submit.setAttribute("aria-busy",t?"true":"false"))}function Ze(){J(),h==null||h.remove(),h=null,s={}}const vt={init:_e,configure:wt,setTheme:Ve,setVisible:We,open:Wt,close:J,identify:Je,submit:zt,destroy:Ze};return typeof window<"u"&&(window.Notefully=vt),C.close=J,C.configure=wt,C.default=vt,C.destroy=Ze,C.identify=Je,C.init=_e,C.open=Wt,C.setTheme=Ve,C.setVisible=We,C.submit=zt,Object.defineProperties(C,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),C})({});