@makefully/notefully 0.1.53 → 0.1.54
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 +1 -1
- package/dist/notefully.css +1 -1
- package/dist/notefully.iife.js +28 -25
- package/dist/notefully.js +90 -86
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ Notefully.init({
|
|
|
26
26
|
// kinds default to bug / idea / other. Pass kinds to replace the full list:
|
|
27
27
|
// kinds: ['bug', 'idea', { id: 'polish', label: 'Polish' }, 'other'],
|
|
28
28
|
hideLauncher: true, // optional; drive open/submit from your own UI
|
|
29
|
-
// After a successful submit, keep "Submitted!" +
|
|
29
|
+
// After a successful submit, keep "Submitted!" + View Report link until dismiss:
|
|
30
30
|
// displayLink: true, // default false; requires relay to return trackerUrl
|
|
31
31
|
// Optional canvas-game hooks for the automatic (DOM) capture path:
|
|
32
32
|
// onBeforeCapture: async () => { engine.render(); },
|
package/dist/notefully.css
CHANGED
|
@@ -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-privacy[hidden],#notefully .nf-privacy-summary[hidden],#notefully .nf-privacy-panel[hidden],#notefully .nf-privacy-text[hidden],#notefully .nf-privacy-rows[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-success-link{display:block;margin:.65rem 0 0;text-align:center;font:600 .92rem/1.35 ui-sans-serif,system-ui,sans-serif;color:var(--nf-accent, #3d5a80);text-decoration:underline;text-underline-offset:.12em;pointer-events:auto;cursor:pointer}#notefully .nf-success-link[hidden]{display:none!important}#notefully .nf-success-link:hover,#notefully .nf-success-link:focus-visible{color:var(--nf-mark-text, #2a2140)}#notefully .nf-dialog.nf-success{pointer-events:none}#notefully .nf-dialog.nf-success.nf-success-sticky{pointer-events:auto}#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}#notefully .nf-dialog.nf-success.nf-success-sticky .nf-panel{max-width:min(320px,92vw);padding:1.5rem 1.75rem 1.65rem;gap:0;pointer-events:auto}@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-row{display:flex;flex-wrap:wrap;gap:8px;align-items:center}#notefully .nf-kind{display:flex;flex-wrap:wrap;gap:8px;flex:1 1 auto;min-width:0}#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;margin-left:auto;flex:0 1 auto;max-width:100%}#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[data-redacted=true] .nf-privacy-section-head{margin-bottom:0;opacity:.62}#notefully .nf-privacy-section[data-redacted=true] .nf-privacy-section-title{color:var(--nf-muted);text-decoration:line-through}#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[data-redacted=true]{align-items:center;opacity:.55;background:transparent;border-style:dashed}#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-row-summary{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font:11px/1.35 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;color:var(--nf-muted);text-decoration:line-through}#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
|
+
#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-summary[hidden],#notefully .nf-privacy-panel[hidden],#notefully .nf-privacy-text[hidden],#notefully .nf-privacy-rows[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-success-link{display:inline-flex;align-items:center;justify-content:center;gap:.28em;margin:.7rem 0 0;padding:.15rem .1rem;font:500 .78rem/1.2 ui-sans-serif,system-ui,sans-serif;letter-spacing:.01em;color:var(--nf-muted);text-decoration:none;pointer-events:auto;cursor:pointer;opacity:.88}#notefully .nf-success-link .nf-icon{width:.95em;height:.95em;flex:0 0 auto}#notefully .nf-success-link[hidden]{display:none!important}#notefully .nf-success-link:hover,#notefully .nf-success-link:focus-visible{color:var(--nf-text);opacity:1;outline:none}#notefully .nf-success-link:focus-visible{box-shadow:0 0 0 2px color-mix(in srgb,var(--nf-accent) 35%,transparent);border-radius:4px}#notefully .nf-dialog.nf-success{pointer-events:none}#notefully .nf-dialog.nf-success.nf-success-sticky{pointer-events:auto}#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}#notefully .nf-dialog.nf-success.nf-success-sticky .nf-panel{max-width:min(320px,92vw);padding:1.5rem 1.75rem 1.45rem;gap:0;pointer-events:auto;align-items:center}@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-row{display:flex;flex-wrap:wrap;gap:8px;align-items:center}#notefully .nf-kind{display:flex;flex-wrap:wrap;gap:8px;flex:1 1 auto;min-width:0}#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;margin-left:auto;flex:0 1 auto;max-width:100%}#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[data-redacted=true] .nf-privacy-section-head{margin-bottom:0;opacity:.62}#notefully .nf-privacy-section[data-redacted=true] .nf-privacy-section-title{color:var(--nf-muted);text-decoration:line-through}#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[data-redacted=true]{align-items:center;opacity:.55;background:transparent;border-style:dashed}#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-row-summary{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font:11px/1.35 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;color:var(--nf-muted);text-decoration:line-through}#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)}}
|
package/dist/notefully.iife.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
var Notefully=(function(A){"use strict";function sn(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 cn=(()=>{let t=0;const e=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(t+=1,`u${e()}${t}`)})();function _(t){const e=[];for(let n=0,r=t.length;n<r;n++)e.push(t[n]);return e}let Q=null;function Gt(t={}){return Q||(t.includeStyleProperties?(Q=t.includeStyleProperties,Q):(Q=_(window.getComputedStyle(document.documentElement)),Q))}function lt(t,e){const r=(t.ownerDocument.defaultView||window).getComputedStyle(t).getPropertyValue(e);return r?parseFloat(r.replace("px","")):0}function ln(t){const e=lt(t,"border-left-width"),n=lt(t,"border-right-width");return t.clientWidth+e+n}function un(t){const e=lt(t,"border-top-width"),n=lt(t,"border-bottom-width");return t.clientHeight+e+n}function Jt(t,e={}){const n=e.width||ln(t),r=e.height||un(t);return{width:n,height:r}}function dn(){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 C=16384;function fn(t){(t.width>C||t.height>C)&&(t.width>C&&t.height>C?t.width>t.height?(t.height*=C/t.width,t.width=C):(t.width*=C/t.height,t.height=C):t.width>C?(t.height*=C/t.width,t.width=C):(t.width*=C/t.height,t.height=C))}function ut(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 hn(t){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(t)).then(encodeURIComponent).then(e=>`data:image/svg+xml;charset=utf-8,${e}`)}async function pn(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),hn(i)}const E=(t,e)=>{if(t instanceof e)return!0;const n=Object.getPrototypeOf(t);return n===null?!1:n.constructor.name===e.name||E(n,e)};function yn(t){const e=t.getPropertyValue("content");return`${t.cssText} content: '${e.replace(/'|"/g,"")}';`}function mn(t,e){return Gt(e).map(n=>{const r=t.getPropertyValue(n),i=t.getPropertyPriority(n);return`${n}: ${r}${i?" !important":""};`}).join(" ")}function gn(t,e,n,r){const i=`.${t}:${e}`,a=n.cssText?yn(n):mn(n,r);return document.createTextNode(`${i}{${a}}`)}function Qt(t,e,n,r){const i=window.getComputedStyle(t,n),a=i.getPropertyValue("content");if(a===""||a==="none")return;const o=cn();try{e.className=`${e.className} ${o}`}catch{return}const c=document.createElement("style");c.appendChild(gn(o,n,i,r)),e.appendChild(c)}function wn(t,e,n){Qt(t,e,":before",n),Qt(t,e,":after",n)}const Zt="application/font-woff",te="image/jpeg",vn={woff:Zt,woff2:Zt,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:te,jpeg:te,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function bn(t){const e=/\.([^./]*?)$/g.exec(t);return e?e[1]:""}function Lt(t){const e=bn(t).toLowerCase();return vn[e]||""}function Sn(t){return t.split(/,/)[1]}function At(t){return t.search(/^(data:)/)!==-1}function xn(t,e){return`data:${e};base64,${t}`}async function ee(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 Mt={};function En(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 $t(t,e,n){const r=En(t,e,n.includeQueryParams);if(Mt[r]!=null)return Mt[r];n.cacheBust&&(t+=(/\?/.test(t)?"&":"?")+new Date().getTime());let i;try{const a=await ee(t,n.fetchRequestInit,({res:o,result:c})=>(e||(e=o.headers.get("Content-Type")||""),Sn(c)));i=xn(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 Mt[r]=i,i}async function Cn(t){const e=t.toDataURL();return e==="data:,"?t.cloneNode(!1):ut(e)}async function kn(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 ut(c)}const n=t.poster,r=Lt(n),i=await $t(n,r,e);return ut(i)}async function Ln(t,e){var n;try{if(!((n=t==null?void 0:t.contentDocument)===null||n===void 0)&&n.body)return await dt(t.contentDocument.body,e,!0)}catch{}return t.cloneNode(!1)}async function An(t,e){return E(t,HTMLCanvasElement)?Cn(t):E(t,HTMLVideoElement)?kn(t,e):E(t,HTMLIFrameElement)?Ln(t,e):t.cloneNode(ne(t))}const Mn=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SLOT",ne=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SVG";async function $n(t,e,n){var r,i;if(ne(e))return e;let a=[];return Mn(t)&&t.assignedNodes?a=_(t.assignedNodes()):E(t,HTMLIFrameElement)&&(!((r=t.contentDocument)===null||r===void 0)&&r.body)?a=_(t.contentDocument.body.childNodes):a=_(((i=t.shadowRoot)!==null&&i!==void 0?i:t).childNodes),a.length===0||E(t,HTMLVideoElement)||await a.reduce((o,c)=>o.then(()=>dt(c,n)).then(l=>{l&&e.appendChild(l)}),Promise.resolve()),e}function Rn(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):Gt(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`),E(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 Tn(t,e){E(t,HTMLTextAreaElement)&&(e.innerHTML=t.value),E(t,HTMLInputElement)&&e.setAttribute("value",t.value)}function Pn(t,e){if(E(t,HTMLSelectElement)){const r=Array.from(e.children).find(i=>t.value===i.getAttribute("value"));r&&r.setAttribute("selected","")}}function In(t,e,n){return E(e,Element)&&(Rn(t,e,n),wn(t,e,n),Tn(t,e),Pn(t,e)),e}async function On(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 dt(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 dt(t,e,n){return!n&&e.filter&&!e.filter(t)?null:Promise.resolve(t).then(r=>An(r,e)).then(r=>$n(t,r,e)).then(r=>In(t,r,e)).then(r=>On(r,e))}const re=/url\((['"]?)([^'"]+?)\1\)/g,Bn=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,Dn=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function Hn(t){const e=t.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`,"g")}function Fn(t){const e=[];return t.replace(re,(n,r,i)=>(e.push(i),n)),e.filter(n=>!At(n))}async function Un(t,e,n,r,i){try{const a=n?sn(e,n):e,o=Lt(e);let c;return i||(c=await $t(a,o,r)),t.replace(Hn(e),`$1${c}$3`)}catch{}return t}function Nn(t,{preferredFontFormat:e}){return e?t.replace(Dn,n=>{for(;;){const[r,,i]=Bn.exec(n)||[];if(!i)return"";if(i===e)return`src: ${r};`}}):t}function ie(t){return t.search(re)!==-1}async function ae(t,e,n){if(!ie(t))return t;const r=Nn(t,n);return Fn(r).reduce((a,o)=>a.then(c=>Un(c,o,e,n)),Promise.resolve(r))}async function Z(t,e,n){var r;const i=(r=e.style)===null||r===void 0?void 0:r.getPropertyValue(t);if(i){const a=await ae(i,null,n);return e.style.setProperty(t,a,e.style.getPropertyPriority(t)),!0}return!1}async function _n(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 jn(t,e){const n=E(t,HTMLImageElement);if(!(n&&!At(t.src))&&!(E(t,SVGImageElement)&&!At(t.href.baseVal)))return;const r=n?t.src:t.href.baseVal,i=await $t(r,Lt(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 Vn(t,e){const r=_(t.childNodes).map(i=>oe(i,e));await Promise.all(r).then(()=>t)}async function oe(t,e){E(t,Element)&&(await _n(t,e),await jn(t,e),await Vn(t,e))}function Wn(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 se={};async function ce(t){let e=se[t];if(e!=null)return e;const r=await(await fetch(t)).text();return e={url:t,cssText:r},se[t]=e,e}async function le(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),ee(c,e.fetchRequestInit,({result:l})=>(n=n.replace(o,`url(${l})`),[o,l]))});return Promise.all(a).then(()=>n)}function ue(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 zn(t,e){const n=[],r=[];return t.forEach(i=>{if("cssRules"in i)try{_(i.cssRules||[]).forEach((a,o)=>{if(a.type===CSSRule.IMPORT_RULE){let c=o+1;const l=a.href,u=ce(l).then(f=>le(f,e)).then(f=>ue(f).forEach(y=>{try{i.insertRule(y,y.startsWith("@import")?c+=1:i.cssRules.length)}catch(g){console.error("Error inserting rule from remote css",{rule:y,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(ce(i.href).then(c=>le(c,e)).then(c=>ue(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{_(i.cssRules||[]).forEach(a=>{n.push(a)})}catch(a){console.error(`Error while reading CSS rules from ${i.href}`,a)}}),n))}function Kn(t){return t.filter(e=>e.type===CSSRule.FONT_FACE_RULE).filter(e=>ie(e.style.getPropertyValue("src")))}async function qn(t,e){if(t.ownerDocument==null)throw new Error("Provided element is not within a Document");const n=_(t.ownerDocument.styleSheets),r=await zn(n,e);return Kn(r)}function de(t){return t.trim().replace(/["']/g,"")}function Xn(t){const e=new Set;function n(r){(r.style.fontFamily||getComputedStyle(r).fontFamily).split(",").forEach(a=>{e.add(de(a))}),Array.from(r.children).forEach(a=>{a instanceof HTMLElement&&n(a)})}return n(t),e}async function Yn(t,e){const n=await qn(t,e),r=Xn(t);return(await Promise.all(n.filter(a=>r.has(de(a.style.fontFamily))).map(a=>{const o=a.parentStyleSheet?a.parentStyleSheet.href:null;return ae(a.cssText,o,e)}))).join(`
|
|
2
|
-
`)}async function Gn(t,e){const n=e.fontEmbedCSS!=null?e.fontEmbedCSS:e.skipFonts?null:await Yn(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 Jn(t,e={}){const{width:n,height:r}=Jt(t,e),i=await dt(t,e,!0);return await Gn(i,e),await oe(i,e),Wn(i,e),await pn(i,n,r)}async function Qn(t,e={}){const{width:n,height:r}=Jt(t,e),i=await Jn(t,e),a=await ut(i),o=document.createElement("canvas"),c=o.getContext("2d"),l=e.pixelRatio||dn(),u=e.canvasWidth||n,f=e.canvasHeight||r;return o.width=u*l,o.height=f*l,e.skipAutoScale||fn(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 fe(t,e={}){return(await Qn(t,e)).toDataURL()}const ft="data-nf-capture-chrome",Zn="data-nf-canvas-snap",tr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==";function he(t){return t instanceof Element&&(t.hasAttribute(ft)||t.hasAttribute("data-nf-mask-cover")||t.id==="notefully")}function er(){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 nr(){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 rr(){const t=document.querySelector(`[${ft}]`);if(t)return t;const e=document.createElement("div");return e.setAttribute(ft,"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 ir(){document.querySelectorAll(`[${ft}]`).forEach(t=>t.remove())}function Rt(){return new Promise(t=>{requestAnimationFrame(()=>requestAnimationFrame(t))})}function j(t){if(typeof t!="string"||!t.startsWith("data:image/"))return!1;const e=t.indexOf(",");return e>0&&e<t.length-1}function ar(){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 or(){const t=[],e=Array.from(document.querySelectorAll("canvas"));for(const n of e){if(n.closest("#notefully")||he(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(Zn,"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 sr(t){if(!t)return null;if(typeof t=="string")return j(t)?t:null;if(typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement)try{const e=t.toDataURL("image/png");return j(e)?e:null}catch{return null}if(typeof Blob<"u"&&t instanceof Blob){const e=await cr(t);return j(e)?e:null}return null}async function cr(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 lr(){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 Rt();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(!j(o))throw new Error("Screen capture produced an empty image.");return o}finally{t.getTracks().forEach(n=>n.stop())}}async function pe(t={}){const e=document.getElementById("notefully"),n=e?e.style.display:"",r=rr(),i=er();let a=()=>{};e&&(e.style.display="none");const o=nr();try{if(typeof t.onBeforeCapture=="function"&&await t.onBeforeCapture(),await Rt(),typeof t.capture=="function"){const y=await sr(await t.capture());if(y)return y}a=await or(),await Rt();const{width:c,height:l}=ar(),u={cacheBust:!0,width:c,height:l,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:y=>!he(y),imagePlaceholder:tr,onImageErrorHandler:()=>{}};let f="";try{f=await fe(document.body,u)}catch{f=await fe(document.body,{...u,skipFonts:!0})}if(!j(f))throw new Error("Screenshot capture produced an empty image.");return f}finally{try{a()}catch{}o(),i(),r.remove(),ir(),e&&(e.style.display=n)}}function ur(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 dr(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 fr(t={}){const e=navigator.userAgent;return{url:location.href,title:document.title,userAgent:e,os:ur(e),browser:dr(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 ye=new Set(["userId","email","displayName"]),me={id:"userId",username:"displayName",name:"displayName"},ge=new Set(["endpoint","projectKey","version","name","targets","hideLauncher","theme","video","consoleLogLimit","kinds","capture","onBeforeCapture","displayLink"]),we={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 hr(t={},e={}){const n=e.warn||ve,r=t&&typeof t=="object"?t:{},i={},a=[];for(const o of ye)Object.prototype.hasOwnProperty.call(r,o)&&(i[o]=r[o]);for(const[o,c]of Object.entries(me))Object.prototype.hasOwnProperty.call(r,o)&&(Object.prototype.hasOwnProperty.call(i,c)||(i[c]=r[o]));for(const o of Object.keys(r))ye.has(o)||Object.prototype.hasOwnProperty.call(me,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 pr(t={},e={}){const n=e.warn||ve,r=t&&typeof t=="object"?t:{},i=Object.keys(r).filter(a=>!ge.has(a));if(i.length)for(const a of i){if(we[a]){n(`Notefully.init: ignoring "${a}". ${we[a]}`);continue}n(`Notefully.init: ignoring unknown key "${a}". Supported: ${[...ge].join(", ")}.`)}}function ve(t){typeof console<"u"&&typeof console.warn=="function"&&console.warn(t)}const yr=80;function mr(){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>yr&&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 gr(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 wr=60*1e3;function vr({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,y;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)},(y=r.getVideoTracks()[0])==null||y.addEventListener("ended",()=>l()),i.start(),o=setTimeout(l,wr)},stop:l}}function br(){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 Tt={x:0,y:0,w:1,h:1};function Pt(){const t=br();let e=[],n={...Tt},r=1;return{list:()=>e.filter(a=>xr(a,n)),all:()=>e.slice(),crop:()=>({...n}),setCrop(a){return n=Sr(a),n},resetCrop(){return n={...Tt},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={...Tt},r=1;t.peekUsed().length;)t.free(t.peekUsed()[0])}}}function Sr(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 xr(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 It(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 Er(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=It(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=Ot(u.x,n,r),y=Bt(u.y,n,i),g=u.w/n.w*r,w=u.h/n.h*i,x=l.stroke/2;if(u.type==="rect")t.strokeRect(f+x,y+x,Math.max(0,g-l.stroke),Math.max(0,w-l.stroke));else if(u.type==="circle")t.beginPath(),t.ellipse(f+g/2,y+w/2,Math.max(.5,g/2-x),Math.max(.5,w/2-x),0,0,Math.PI*2),t.stroke();else if(u.type==="arrow"){const $=Ot(u.x2??u.x+u.w,n,r),N=Bt(u.y2??u.y,n,i);kr(t,f,y,$,N,l)}if(u.number==null||u.number==="")return;const L=Cr(u,n,r,i,f,y,g),H=String(u.number);t.beginPath(),t.arc(L.x,L.y,l.badgeRadius,0,Math.PI*2),t.fillStyle=o,t.fill(),t.fillStyle=c,t.textAlign="center",t.textBaseline="middle",t.fillText(H,L.x,L.y+.5),t.fillStyle=o}),t.restore()}function Ot(t,e,n){return(t-e.x)/e.w*n}function Bt(t,e,n){return(t-e.y)/e.h*n}function Cr(t,e,n,r,i,a,o){if(t.type==="arrow"){const c=Ot(t.x2??t.x+t.w,e,n),l=Bt(t.y2??t.y,e,r);return{x:(i+c)/2,y:(a+l)/2}}return{x:i+o/2,y:a}}function be(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,y=r-Math.sin(a)*o,g={x:l-o*Math.cos(a-i.arrowHeadAngle),y:u-o*Math.sin(a-i.arrowHeadAngle)},w={x:l-o*Math.cos(a+i.arrowHeadAngle),y:u-o*Math.sin(a+i.arrowHeadAngle)},x={x:n-Math.cos(a)*c,y:r-Math.sin(a)*c};return{angle:a,tipX:l,tipY:u,baseX:f,baseY:y,left:g,right:w,shaftEnd:x}}function kr(t,e,n,r,i,a){const o=be(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 Lr(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)),y=document.createElement("canvas");y.width=u,y.height=f;const g=y.getContext("2d");g.drawImage(o,c,l,u,f,0,0,u,f),Er(g,{stickers:n,crop:e,width:u,height:f,colors:r}),y.toBlob(w=>{if(!w){a(new Error("Could not encode screenshot"));return}i(w)},"image/png")},o.onerror=()=>a(new Error("Could not load screenshot")),o.src=t})}const Ar=[{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 Mr(t){return!t||typeof t!="object"?!1:!!(t.userId||t.email||t.displayName)}function $r(t={}){const e=[];for(const n of Ar){const r=t[n.key];r==null||r===""||n.key==="user"&&!Mr(r)||e.push({key:n.key,label:n.label,value:r,redacted:!1})}return e}function Rr(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 Tr(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 ht(t,e){t.forEach(n=>{n.redacted=!!e})}function Pr(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 Ir(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 Or(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 Se(t){return String(t||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32)}function Dt(t){const e=String(t||"").trim();return e?e.split(/[-_\s]+/).filter(Boolean).map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" "):""}function Br(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=Se(r),a=Dt(i)):r&&typeof r=="object"&&(i=Se(r.id??r.value??r.kind),a=String(r.label||r.name||Dt(i)).trim()||Dt(i)),!(!i||e.has(i))&&(e.add(i),n.push({id:i,label:a}))}return n.length?n:V.map(r=>({...r}))}function pt(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 Dr=["maker","all-business","brighter-day","quiet-night"],xe="maker",Hr=new Set(["crop","arrow","rect","circle"]),Ht=.02,Ee=.05,Fr=`
|
|
1
|
+
var Notefully=(function(A){"use strict";function sn(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;const n=document.implementation.createHTMLDocument(),r=n.createElement("base"),i=n.createElement("a");return n.head.appendChild(r),n.body.appendChild(i),t&&(r.href=t),i.href=e,i.href}const cn=(()=>{let e=0;const t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)})();function _(e){const t=[];for(let n=0,r=e.length;n<r;n++)t.push(e[n]);return t}let Q=null;function Ge(e={}){return Q||(e.includeStyleProperties?(Q=e.includeStyleProperties,Q):(Q=_(window.getComputedStyle(document.documentElement)),Q))}function le(e,t){const r=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return r?parseFloat(r.replace("px","")):0}function ln(e){const t=le(e,"border-left-width"),n=le(e,"border-right-width");return e.clientWidth+t+n}function un(e){const t=le(e,"border-top-width"),n=le(e,"border-bottom-width");return e.clientHeight+t+n}function Je(e,t={}){const n=t.width||ln(e),r=t.height||un(e);return{width:n,height:r}}function dn(){let e,t;try{t=process}catch{}const n=t&&t.env?t.env.devicePixelRatio:null;return n&&(e=parseInt(n,10),Number.isNaN(e)&&(e=1)),e||window.devicePixelRatio||1}const C=16384;function fn(e){(e.width>C||e.height>C)&&(e.width>C&&e.height>C?e.width>e.height?(e.height*=C/e.width,e.width=C):(e.width*=C/e.height,e.height=C):e.width>C?(e.height*=C/e.width,e.width=C):(e.width*=C/e.height,e.height=C))}function ue(e){return new Promise((t,n)=>{const r=new Image;r.onload=()=>{r.decode().then(()=>{requestAnimationFrame(()=>t(r))})},r.onerror=n,r.crossOrigin="anonymous",r.decoding="async",r.src=e})}async function hn(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function pn(e,t,n){const r="http://www.w3.org/2000/svg",i=document.createElementNS(r,"svg"),a=document.createElementNS(r,"foreignObject");return i.setAttribute("width",`${t}`),i.setAttribute("height",`${n}`),i.setAttribute("viewBox",`0 0 ${t} ${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(e),hn(i)}const E=(e,t)=>{if(e instanceof t)return!0;const n=Object.getPrototypeOf(e);return n===null?!1:n.constructor.name===t.name||E(n,t)};function yn(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}function mn(e,t){return Ge(t).map(n=>{const r=e.getPropertyValue(n),i=e.getPropertyPriority(n);return`${n}: ${r}${i?" !important":""};`}).join(" ")}function gn(e,t,n,r){const i=`.${e}:${t}`,a=n.cssText?yn(n):mn(n,r);return document.createTextNode(`${i}{${a}}`)}function Qe(e,t,n,r){const i=window.getComputedStyle(e,n),a=i.getPropertyValue("content");if(a===""||a==="none")return;const o=cn();try{t.className=`${t.className} ${o}`}catch{return}const c=document.createElement("style");c.appendChild(gn(o,n,i,r)),t.appendChild(c)}function wn(e,t,n){Qe(e,t,":before",n),Qe(e,t,":after",n)}const Ze="application/font-woff",et="image/jpeg",vn={woff:Ze,woff2:Ze,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:et,jpeg:et,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function bn(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}function Le(e){const t=bn(e).toLowerCase();return vn[t]||""}function Sn(e){return e.split(/,/)[1]}function Ae(e){return e.search(/^(data:)/)!==-1}function xn(e,t){return`data:${t};base64,${e}`}async function tt(e,t,n){const r=await fetch(e,t);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 Me={};function En(e,t,n){let r=e.replace(/\?.*/,"");return n&&(r=e),/ttf|otf|eot|woff2?/i.test(r)&&(r=r.replace(/.*\//,"")),t?`[${t}]${r}`:r}async function Re(e,t,n){const r=En(e,t,n.includeQueryParams);if(Me[r]!=null)return Me[r];n.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime());let i;try{const a=await tt(e,n.fetchRequestInit,({res:o,result:c})=>(t||(t=o.headers.get("Content-Type")||""),Sn(c)));i=xn(a,t)}catch(a){i=n.imagePlaceholder||"";let o=`Failed to fetch resource: ${e}`;a&&(o=typeof a=="string"?a:a.message),o&&console.warn(o)}return Me[r]=i,i}async function Cn(e){const t=e.toDataURL();return t==="data:,"?e.cloneNode(!1):ue(t)}async function kn(e,t){if(e.currentSrc){const a=document.createElement("canvas"),o=a.getContext("2d");a.width=e.clientWidth,a.height=e.clientHeight,o==null||o.drawImage(e,0,0,a.width,a.height);const c=a.toDataURL();return ue(c)}const n=e.poster,r=Le(n),i=await Re(n,r,t);return ue(i)}async function Ln(e,t){var n;try{if(!((n=e==null?void 0:e.contentDocument)===null||n===void 0)&&n.body)return await de(e.contentDocument.body,t,!0)}catch{}return e.cloneNode(!1)}async function An(e,t){return E(e,HTMLCanvasElement)?Cn(e):E(e,HTMLVideoElement)?kn(e,t):E(e,HTMLIFrameElement)?Ln(e,t):e.cloneNode(nt(e))}const Mn=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SLOT",nt=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SVG";async function Rn(e,t,n){var r,i;if(nt(t))return t;let a=[];return Mn(e)&&e.assignedNodes?a=_(e.assignedNodes()):E(e,HTMLIFrameElement)&&(!((r=e.contentDocument)===null||r===void 0)&&r.body)?a=_(e.contentDocument.body.childNodes):a=_(((i=e.shadowRoot)!==null&&i!==void 0?i:e).childNodes),a.length===0||E(e,HTMLVideoElement)||await a.reduce((o,c)=>o.then(()=>de(c,n)).then(l=>{l&&t.appendChild(l)}),Promise.resolve()),t}function $n(e,t,n){const r=t.style;if(!r)return;const i=window.getComputedStyle(e);i.cssText?(r.cssText=i.cssText,r.transformOrigin=i.transformOrigin):Ge(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`),E(e,HTMLIFrameElement)&&a==="display"&&o==="inline"&&(o="block"),a==="d"&&t.getAttribute("d")&&(o=`path(${t.getAttribute("d")})`),r.setProperty(a,o,i.getPropertyPriority(a))})}function Tn(e,t){E(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),E(e,HTMLInputElement)&&t.setAttribute("value",e.value)}function Pn(e,t){if(E(e,HTMLSelectElement)){const r=Array.from(t.children).find(i=>e.value===i.getAttribute("value"));r&&r.setAttribute("selected","")}}function In(e,t,n){return E(t,Element)&&($n(e,t,n),wn(e,t,n),Tn(e,t),Pn(e,t)),t}async function On(e,t){const n=e.querySelectorAll?e.querySelectorAll("use"):[];if(n.length===0)return e;const r={};for(let a=0;a<n.length;a++){const c=n[a].getAttribute("xlink:href");if(c){const l=e.querySelector(c),u=document.querySelector(c);!l&&u&&!r[c]&&(r[c]=await de(u,t,!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]);e.appendChild(o)}return e}async function de(e,t,n){return!n&&t.filter&&!t.filter(e)?null:Promise.resolve(e).then(r=>An(r,t)).then(r=>Rn(e,r,t)).then(r=>In(e,r,t)).then(r=>On(r,t))}const rt=/url\((['"]?)([^'"]+?)\1\)/g,Bn=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,Dn=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function Hn(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function Fn(e){const t=[];return e.replace(rt,(n,r,i)=>(t.push(i),n)),t.filter(n=>!Ae(n))}async function Un(e,t,n,r,i){try{const a=n?sn(t,n):t,o=Le(t);let c;return i||(c=await Re(a,o,r)),e.replace(Hn(t),`$1${c}$3`)}catch{}return e}function Nn(e,{preferredFontFormat:t}){return t?e.replace(Dn,n=>{for(;;){const[r,,i]=Bn.exec(n)||[];if(!i)return"";if(i===t)return`src: ${r};`}}):e}function it(e){return e.search(rt)!==-1}async function at(e,t,n){if(!it(e))return e;const r=Nn(e,n);return Fn(r).reduce((a,o)=>a.then(c=>Un(c,o,t,n)),Promise.resolve(r))}async function Z(e,t,n){var r;const i=(r=t.style)===null||r===void 0?void 0:r.getPropertyValue(e);if(i){const a=await at(i,null,n);return t.style.setProperty(e,a,t.style.getPropertyPriority(e)),!0}return!1}async function _n(e,t){await Z("background",e,t)||await Z("background-image",e,t),await Z("mask",e,t)||await Z("-webkit-mask",e,t)||await Z("mask-image",e,t)||await Z("-webkit-mask-image",e,t)}async function jn(e,t){const n=E(e,HTMLImageElement);if(!(n&&!Ae(e.src))&&!(E(e,SVGImageElement)&&!Ae(e.href.baseVal)))return;const r=n?e.src:e.href.baseVal,i=await Re(r,Le(r),t);await new Promise((a,o)=>{e.onload=a,e.onerror=t.onImageErrorHandler?(...l)=>{try{a(t.onImageErrorHandler(...l))}catch(u){o(u)}}:o;const c=e;c.decode&&(c.decode=a),c.loading==="lazy"&&(c.loading="eager"),n?(e.srcset="",e.src=i):e.href.baseVal=i})}async function Vn(e,t){const r=_(e.childNodes).map(i=>ot(i,t));await Promise.all(r).then(()=>e)}async function ot(e,t){E(e,Element)&&(await _n(e,t),await jn(e,t),await Vn(e,t))}function Wn(e,t){const{style:n}=e;t.backgroundColor&&(n.backgroundColor=t.backgroundColor),t.width&&(n.width=`${t.width}px`),t.height&&(n.height=`${t.height}px`);const r=t.style;return r!=null&&Object.keys(r).forEach(i=>{n[i]=r[i]}),e}const st={};async function ct(e){let t=st[e];if(t!=null)return t;const r=await(await fetch(e)).text();return t={url:e,cssText:r},st[e]=t,t}async function lt(e,t){let n=e.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,e.url).href),tt(c,t.fetchRequestInit,({result:l})=>(n=n.replace(o,`url(${l})`),[o,l]))});return Promise.all(a).then(()=>n)}function ut(e){if(e==null)return[];const t=[],n=/(\/\*[\s\S]*?\*\/)/gi;let r=e.replace(n,"");const i=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const l=i.exec(r);if(l===null)break;t.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;t.push(l[0])}return t}async function zn(e,t){const n=[],r=[];return e.forEach(i=>{if("cssRules"in i)try{_(i.cssRules||[]).forEach((a,o)=>{if(a.type===CSSRule.IMPORT_RULE){let c=o+1;const l=a.href,u=ct(l).then(f=>lt(f,t)).then(f=>ut(f).forEach(y=>{try{i.insertRule(y,y.startsWith("@import")?c+=1:i.cssRules.length)}catch(g){console.error("Error inserting rule from remote css",{rule:y,error:g})}})).catch(f=>{console.error("Error loading remote css",f.toString())});r.push(u)}})}catch(a){const o=e.find(c=>c.href==null)||document.styleSheets[0];i.href!=null&&r.push(ct(i.href).then(c=>lt(c,t)).then(c=>ut(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(()=>(e.forEach(i=>{if("cssRules"in i)try{_(i.cssRules||[]).forEach(a=>{n.push(a)})}catch(a){console.error(`Error while reading CSS rules from ${i.href}`,a)}}),n))}function Kn(e){return e.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>it(t.style.getPropertyValue("src")))}async function qn(e,t){if(e.ownerDocument==null)throw new Error("Provided element is not within a Document");const n=_(e.ownerDocument.styleSheets),r=await zn(n,t);return Kn(r)}function dt(e){return e.trim().replace(/["']/g,"")}function Xn(e){const t=new Set;function n(r){(r.style.fontFamily||getComputedStyle(r).fontFamily).split(",").forEach(a=>{t.add(dt(a))}),Array.from(r.children).forEach(a=>{a instanceof HTMLElement&&n(a)})}return n(e),t}async function Yn(e,t){const n=await qn(e,t),r=Xn(e);return(await Promise.all(n.filter(a=>r.has(dt(a.style.fontFamily))).map(a=>{const o=a.parentStyleSheet?a.parentStyleSheet.href:null;return at(a.cssText,o,t)}))).join(`
|
|
2
|
+
`)}async function Gn(e,t){const n=t.fontEmbedCSS!=null?t.fontEmbedCSS:t.skipFonts?null:await Yn(e,t);if(n){const r=document.createElement("style"),i=document.createTextNode(n);r.appendChild(i),e.firstChild?e.insertBefore(r,e.firstChild):e.appendChild(r)}}async function Jn(e,t={}){const{width:n,height:r}=Je(e,t),i=await de(e,t,!0);return await Gn(i,t),await ot(i,t),Wn(i,t),await pn(i,n,r)}async function Qn(e,t={}){const{width:n,height:r}=Je(e,t),i=await Jn(e,t),a=await ue(i),o=document.createElement("canvas"),c=o.getContext("2d"),l=t.pixelRatio||dn(),u=t.canvasWidth||n,f=t.canvasHeight||r;return o.width=u*l,o.height=f*l,t.skipAutoScale||fn(o),o.style.width=`${u}`,o.style.height=`${f}`,t.backgroundColor&&(c.fillStyle=t.backgroundColor,c.fillRect(0,0,o.width,o.height)),c.drawImage(a,0,0,o.width,o.height),o}async function ft(e,t={}){return(await Qn(e,t)).toDataURL()}const fe="data-nf-capture-chrome",Zn="data-nf-canvas-snap",er="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==";function ht(e){return e instanceof Element&&(e.hasAttribute(fe)||e.hasAttribute("data-nf-mask-cover")||e.id==="notefully")}function tr(){const e=[];return Array.from(document.styleSheets).forEach(t=>{try{t.cssRules}catch{try{if(t.disabled)return;t.disabled=!0,e.push(t)}catch{const n=t.ownerNode;n&&"disabled"in n&&!n.disabled&&(n.disabled=!0,e.push({node:n}))}}}),()=>{e.forEach(t=>{try{t&&t.node?t.node.disabled=!1:t&&(t.disabled=!1)}catch{}})}}function nr(){const e=[];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),e.push(i)}),()=>e.forEach(n=>n.remove())}function rr(){const e=document.querySelector(`[${fe}]`);if(e)return e;const t=document.createElement("div");return t.setAttribute(fe,"1"),t.className="nf-capture-chrome",t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.innerHTML='<span class="nf-capture-chrome-pill">Capturing…</span>',document.body.appendChild(t),t}function ir(){document.querySelectorAll(`[${fe}]`).forEach(e=>e.remove())}function $e(){return new Promise(e=>{requestAnimationFrame(()=>requestAnimationFrame(e))})}function j(e){if(typeof e!="string"||!e.startsWith("data:image/"))return!1;const t=e.indexOf(",");return t>0&&t<e.length-1}function ar(){const e=document.documentElement,t=document.body,n=Math.max(window.innerWidth||0,(e==null?void 0:e.clientWidth)||0,(e==null?void 0:e.scrollWidth)||0,(t==null?void 0:t.scrollWidth)||0,1),r=Math.max(window.innerHeight||0,(e==null?void 0:e.clientHeight)||0,(e==null?void 0:e.scrollHeight)||0,(t==null?void 0:t.scrollHeight)||0,1);return{width:n,height:r}}async function or(){const e=[],t=Array.from(document.querySelectorAll("canvas"));for(const n of t){if(n.closest("#notefully")||ht(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(Zn,"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),e.push({canvas:n,img:i})}return await Promise.all(e.map(({img:n})=>{if(!n.complete)return new Promise(r=>{n.onload=()=>r(),n.onerror=()=>r()})})),()=>{e.forEach(({canvas:n,img:r})=>{try{r.parentNode&&r.replaceWith(n)}catch{}})}}async function sr(e){if(!e)return null;if(typeof e=="string")return j(e)?e:null;if(typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement)try{const t=e.toDataURL("image/png");return j(t)?t:null}catch{return null}if(typeof Blob<"u"&&e instanceof Blob){const t=await cr(e);return j(t)?t:null}return null}async function cr(e){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(e)});const t=Buffer.from(await e.arrayBuffer());return`data:${e.type||"application/octet-stream"};base64,${t.toString("base64")}`}async function lr(){var t;if(!((t=navigator.mediaDevices)!=null&&t.getDisplayMedia))throw new Error("Screen capture is not supported in this browser.");const e=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=e,await n.play(),n.videoWidth||await new Promise(c=>{n.onloadedmetadata=()=>c()}),await $e();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(!j(o))throw new Error("Screen capture produced an empty image.");return o}finally{e.getTracks().forEach(n=>n.stop())}}async function pt(e={}){const t=document.getElementById("notefully"),n=t?t.style.display:"",r=rr(),i=tr();let a=()=>{};t&&(t.style.display="none");const o=nr();try{if(typeof e.onBeforeCapture=="function"&&await e.onBeforeCapture(),await $e(),typeof e.capture=="function"){const y=await sr(await e.capture());if(y)return y}a=await or(),await $e();const{width:c,height:l}=ar(),u={cacheBust:!0,width:c,height:l,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:y=>!ht(y),imagePlaceholder:er,onImageErrorHandler:()=>{}};let f="";try{f=await ft(document.body,u)}catch{f=await ft(document.body,{...u,skipFonts:!0})}if(!j(f))throw new Error("Screenshot capture produced an empty image.");return f}finally{try{a()}catch{}o(),i(),r.remove(),ir(),t&&(t.style.display=n)}}function ur(e=""){const t=String(e||"");return t?/Windows NT/i.test(t)?"Windows":/iPhone|iPad|iPod/i.test(t)?"iOS":/Mac OS X|Macintosh/i.test(t)?"macOS":/Android/i.test(t)?"Android":/CrOS/i.test(t)?"ChromeOS":/Linux/i.test(t)?"Linux":"Other":""}function dr(e=""){const t=String(e||"");return t?/Edg\//i.test(t)?"Edge":/OPR\/|Opera/i.test(t)?"Opera":/Firefox\//i.test(t)?"Firefox":/Chrome\//i.test(t)||/CriOS\//i.test(t)?"Chrome":/Safari\//i.test(t)?"Safari":"Other":""}function fr(e={}){const t=navigator.userAgent;return{url:location.href,title:document.title,userAgent:t,os:ur(t),browser:dr(t),language:navigator.language,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,viewport:{width:window.innerWidth,height:window.innerHeight,dpr:window.devicePixelRatio||1},user:{userId:e.userId||null,email:e.email||null,displayName:e.displayName||null}}}const yt=new Set(["userId","email","displayName"]),mt={id:"userId",username:"displayName",name:"displayName"},gt=new Set(["endpoint","projectKey","version","name","targets","hideLauncher","theme","video","consoleLogLimit","kinds","capture","onBeforeCapture","displayLink"]),wt={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 hr(e={},t={}){const n=t.warn||vt,r=e&&typeof e=="object"?e:{},i={},a=[];for(const o of yt)Object.prototype.hasOwnProperty.call(r,o)&&(i[o]=r[o]);for(const[o,c]of Object.entries(mt))Object.prototype.hasOwnProperty.call(r,o)&&(Object.prototype.hasOwnProperty.call(i,c)||(i[c]=r[o]));for(const o of Object.keys(r))yt.has(o)||Object.prototype.hasOwnProperty.call(mt,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 pr(e={},t={}){const n=t.warn||vt,r=e&&typeof e=="object"?e:{},i=Object.keys(r).filter(a=>!gt.has(a));if(i.length)for(const a of i){if(wt[a]){n(`Notefully.init: ignoring "${a}". ${wt[a]}`);continue}n(`Notefully.init: ignoring unknown key "${a}". Supported: ${[...gt].join(", ")}.`)}}function vt(e){typeof console<"u"&&typeof console.warn=="function"&&console.warn(e)}const yr=80;function mr(){const e=[],t={};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])}e.push({level:a,text:c.slice(0,2e3),at:Date.now()}),e.length>yr&&e.shift()};return{hook:()=>{n||typeof window>"u"||(n=!0,["log","info","warn","error"].forEach(a=>{t[a]=console[a].bind(console),console[a]=(...o)=>{r(a,o),t[a](...o)}}),window.addEventListener("error",a=>{r("error",[a.message||"window.error"])}),window.addEventListener("unhandledrejection",a=>{r("error",[a.reason||"unhandledrejection"])}))},snapshot(){return e.slice()}}}function gr(e){const t=window.SpeechRecognition||window.webkitSpeechRecognition;let n=null,r=!1;const i=()=>{if(r=!1,n)try{n.stop()}catch{}};return{start:()=>{if(!t)throw new Error("Speech recognition is not supported in this browser.");return r?(i(),!1):(n=new t,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&&e(c)},n.onerror=()=>{r=!1},n.onend=()=>{r=!1},n.start(),r=!0,!0)},stop:i,isSupported:()=>!!t,isActive:()=>r}}const wr=60*1e3;function vr({onStart:e,onStop:t,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(),t(null)};return{start:async()=>{var f,y;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(),t(g)},(y=r.getVideoTracks()[0])==null||y.addEventListener("ended",()=>l()),i.start(),o=setTimeout(l,wr)},stop:l}}function br(){const e=new Set;return{alloc(){let t=1;for(;e.has(t);)t+=1;return e.add(t),t},free(t){const n=Number(t);Number.isInteger(n)&&n>0&&e.delete(n)},peekUsed(){return[...e].sort((t,n)=>t-n)}}}const Te={x:0,y:0,w:1,h:1};function Pe(){const e=br();let t=[],n={...Te},r=1;return{list:()=>t.filter(a=>xr(a,n)),all:()=>t.slice(),crop:()=>({...n}),setCrop(a){return n=Sr(a),n},resetCrop(){return n={...Te},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:e.alloc(),x:.2,y:.2,w:a==="arrow"?.2:.22,h:a==="arrow"?.05:.16,x2:.4,y2:.28,...o};return t.push(c),c},update(a,o){const c=t.find(l=>l.id===a);return c?(Object.assign(c,o),c):null},remove(a){const o=t.findIndex(l=>l.id===a);if(o<0)return null;const[c]=t.splice(o,1);return e.free(c.number),c},reset(){for(t=[],n={...Te},r=1;e.peekUsed().length;)e.free(e.peekUsed()[0])}}}function Sr(e){const t=Math.min(Math.max(e.x,0),.95),n=Math.min(Math.max(e.y,0),.95),r=Math.min(Math.max(e.w,.05),1-t),i=Math.min(Math.max(e.h,.05),1-n);return{x:t,y:n,w:r,h:i}}function xr(e,t){const n=e.type==="arrow"?(e.x+(e.x2??e.x))/2:e.x+(e.w||0)/2,r=e.type==="arrow"?(e.y+(e.y2??e.y))/2:e.y+(e.h||0)/2;return n>=t.x&&r>=t.y&&n<=t.x+t.w&&r<=t.y+t.h}function Ie(e){const t=Math.max(1,Number(e)||1);return{stroke:Math.max(2,t*.0075),badgeRadius:Math.max(8,t*.025),fontSize:Math.max(10,t*.0275),arrowHead:Math.max(8,t*.035),arrowHeadAngle:.4}}function Er(e,{stickers:t=[],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=Ie(r);e.save(),e.lineWidth=l.stroke,e.lineCap="round",e.lineJoin="round",e.strokeStyle=o,e.fillStyle=o,e.font=`700 ${Math.round(l.fontSize)}px ui-sans-serif, system-ui, sans-serif`,t.forEach(u=>{const f=Oe(u.x,n,r),y=Be(u.y,n,i),g=u.w/n.w*r,w=u.h/n.h*i,x=l.stroke/2;if(u.type==="rect")e.strokeRect(f+x,y+x,Math.max(0,g-l.stroke),Math.max(0,w-l.stroke));else if(u.type==="circle")e.beginPath(),e.ellipse(f+g/2,y+w/2,Math.max(.5,g/2-x),Math.max(.5,w/2-x),0,0,Math.PI*2),e.stroke();else if(u.type==="arrow"){const $=Oe(u.x2??u.x+u.w,n,r),N=Be(u.y2??u.y,n,i);kr(e,f,y,$,N,l)}if(u.number==null||u.number==="")return;const L=Cr(u,n,r,i,f,y,g),H=String(u.number);e.beginPath(),e.arc(L.x,L.y,l.badgeRadius,0,Math.PI*2),e.fillStyle=o,e.fill(),e.fillStyle=c,e.textAlign="center",e.textBaseline="middle",e.fillText(H,L.x,L.y+.5),e.fillStyle=o}),e.restore()}function Oe(e,t,n){return(e-t.x)/t.w*n}function Be(e,t,n){return(e-t.y)/t.h*n}function Cr(e,t,n,r,i,a,o){if(e.type==="arrow"){const c=Oe(e.x2??e.x+e.w,t,n),l=Be(e.y2??e.y,t,r);return{x:(i+c)/2,y:(a+l)/2}}return{x:i+o/2,y:a}}function bt(e,t,n,r,i){const a=Math.atan2(r-t,n-e),o=i.arrowHead,c=Math.min(i.stroke,o*.2),l=n,u=r,f=n-Math.cos(a)*o,y=r-Math.sin(a)*o,g={x:l-o*Math.cos(a-i.arrowHeadAngle),y:u-o*Math.sin(a-i.arrowHeadAngle)},w={x:l-o*Math.cos(a+i.arrowHeadAngle),y:u-o*Math.sin(a+i.arrowHeadAngle)},x={x:n-Math.cos(a)*c,y:r-Math.sin(a)*c};return{angle:a,tipX:l,tipY:u,baseX:f,baseY:y,left:g,right:w,shaftEnd:x}}function kr(e,t,n,r,i,a){const o=bt(t,n,r,i,a);e.beginPath(),e.moveTo(t,n),e.lineTo(o.shaftEnd.x,o.shaftEnd.y),e.stroke(),e.beginPath(),e.moveTo(o.tipX,o.tipY),e.lineTo(o.left.x,o.left.y),e.lineTo(o.right.x,o.right.y),e.closePath(),e.fill()}function Lr(e,t,n,r={}){return new Promise((i,a)=>{const o=new Image;o.onload=()=>{const c=Math.round(t.x*o.width),l=Math.round(t.y*o.height),u=Math.max(1,Math.round(t.w*o.width)),f=Math.max(1,Math.round(t.h*o.height)),y=document.createElement("canvas");y.width=u,y.height=f;const g=y.getContext("2d");g.drawImage(o,c,l,u,f,0,0,u,f),Er(g,{stickers:n,crop:t,width:u,height:f,colors:r}),y.toBlob(w=>{if(!w){a(new Error("Could not encode screenshot"));return}i(w)},"image/png")},o.onerror=()=>a(new Error("Could not load screenshot")),o.src=e})}const Ar=[{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 Mr(e){return!e||typeof e!="object"?!1:!!(e.userId||e.email||e.displayName)}function Rr(e={}){const t=[];for(const n of Ar){const r=e[n.key];r==null||r===""||n.key==="user"&&!Mr(r)||t.push({key:n.key,label:n.label,value:r,redacted:!1})}return t}function $r(e=[]){return e.map((t,n)=>({id:`log-${n}-${t.at||0}`,level:t.level||"log",text:String(t.text||""),at:t.at||0,redacted:!1}))}function Tr(e=[]){if(!e.length)return{checked:!1,indeterminate:!1};const t=e.filter(n=>n.redacted).length;return t===0?{checked:!1,indeterminate:!1}:t===e.length?{checked:!0,indeterminate:!1}:{checked:!1,indeterminate:!0}}function he(e,t){e.forEach(n=>{n.redacted=!!t})}function Pr(e={}){const t=e.diagnostics||[],n=e.logs||[],r=t.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 Ir(e){if(e==null)return"";if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e)}catch{return String(e)}}function Or(e={}){const t={};e.author!=null&&e.author!==""&&(t.author=e.author);for(const r of e.diagnostics||[])r.redacted||(t[r.key]=r.value);const n=(e.logs||[]).filter(r=>!r.redacted).map(r=>({level:r.level,text:r.text,at:r.at}));return t.console=n,t}const V=[{id:"bug",label:"Bug"},{id:"idea",label:"Idea"},{id:"other",label:"Other"}];function St(e){return String(e||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,32)}function De(e){const t=String(e||"").trim();return t?t.split(/[-_\s]+/).filter(Boolean).map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" "):""}function Br(e){if(!Array.isArray(e)||!e.length)return V.map(r=>({...r}));const t=new Set,n=[];for(const r of e){let i="",a="";typeof r=="string"||typeof r=="number"?(i=St(r),a=De(i)):r&&typeof r=="object"&&(i=St(r.id??r.value??r.kind),a=String(r.label||r.name||De(i)).trim()||De(i)),!(!i||t.has(i))&&(t.add(i),n.push({id:i,label:a}))}return n.length?n:V.map(r=>({...r}))}function pe(e){var n;const t=Array.isArray(e)&&e.length?e:V;return t.some(r=>r.id==="bug")?"bug":((n=t[0])==null?void 0:n.id)||"other"}const Dr=["maker","all-business","brighter-day","quiet-night"],xt="maker",Hr=new Set(["crop","arrow","rect","circle"]),He=.02,Et=.05,Fr=`
|
|
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
|
|
7
|
+
`;function T(e){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">${e}</svg>`}const M={crop:T('<path d="M6 3v5H1M18 21v-5h5M8 5h8a2 2 0 0 1 2 2v8M16 19H8a2 2 0 0 1-2-2V8"/>'),resetCrop:T('<path d="M3 12a9 9 0 1 0 3-6.7L3 8"/><path d="M3 3v5h5"/>'),arrow:T('<path d="M5 19 19 5"/><path d="M9 5h10v10"/>'),rect:T('<rect x="4" y="6" width="16" height="12" rx="1.5"/>'),circle:T('<circle cx="12" cy="12" r="8"/>'),discard:T('<path d="M4 7h16"/><path d="M9 7V5h6v2"/><path d="M6 7l1 13h10l1-13"/>'),recapture:T('<path d="M4 8h3l2-2h6l2 2h3v11H4z"/><circle cx="12" cy="13" r="3.5"/>'),privacy:T('<path d="M8 6h13M8 12h13M8 18h13"/><path d="M3 6h.01M3 12h.01M3 18h.01"/>'),audio:T('<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:T('<rect x="3" y="7" width="13" height="10" rx="2"/><path d="M16 10.5 21 8v8l-5-2.5z"/>'),openArrow:T('<path d="M5 12h14"/><path d="m13 6 6 6-6 6"/>')},Ct=mr();Ct.hook();const kt=10,Ur=80,Lt="notefully.author",At="notefully.kind",Mt="notefully.redactSections",Fe="Anonymous";let d={endpoint:"",projectKey:"",version:"0.0.0",name:"",targets:null,hideLauncher:!1,theme:xt,video:!1,consoleLogLimit:kt,kinds:V.map(e=>({...e})),capture:null,onBeforeCapture:null,displayLink:!1},Ue=!1,O={},h=null,s={},m=Pe(),B="",ee="",D=null,W=pe(V),z=null,P=null,v=null,b=null,ye=null,X=null,ie=null,F={w:0,h:0},Ne=!1,me=!1,ge=!1,U=[],I=[],Y=!1;function p(e){return h.querySelector(e)}function Rt(e){const t=String(e||"").trim().toLowerCase().replace(/\s+/g,"-");return Dr.includes(t)?t:xt}function $t(e,t){return h&&getComputedStyle(h).getPropertyValue(e).trim()||t}async function Nr(e){return(await fetch(e)).blob()}function S(e,t=!1){s.status&&(s.status.textContent=e||"",ye&&(clearTimeout(ye),ye=null),e&&!t&&(ye=setTimeout(()=>{s.status.textContent=""},4e3)))}function _e(){return h&&document.body.contains(h)||(h=document.createElement("div"),h.id="notefully",h.innerHTML=`
|
|
8
8
|
<button class="nf-launcher" type="button" title="Leave a note…" aria-label="Leave a note…">${Fr}</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">${
|
|
15
|
-
<button class="nf-reset-crop nf-icon-btn" type="button" title="Reset crop" aria-label="Reset crop" hidden>${
|
|
16
|
-
<button class="nf-tool nf-icon-btn" type="button" data-tool="arrow" title="Arrow" aria-label="Arrow">${
|
|
17
|
-
<button class="nf-tool nf-icon-btn" type="button" data-tool="rect" title="Rectangle" aria-label="Rectangle">${
|
|
18
|
-
<button class="nf-tool nf-icon-btn" type="button" data-tool="circle" title="Circle" aria-label="Circle">${
|
|
19
|
-
<button class="nf-discard-shot nf-icon-btn" type="button" title="Discard screenshot" aria-label="Discard screenshot">${
|
|
20
|
-
<button class="nf-recapture nf-icon-btn" type="button" title="Recapture screenshot" aria-label="Recapture screenshot">${
|
|
14
|
+
<button class="nf-tool nf-icon-btn" type="button" data-tool="crop" title="Crop" aria-label="Crop">${M.crop}</button>
|
|
15
|
+
<button class="nf-reset-crop nf-icon-btn" type="button" title="Reset crop" aria-label="Reset crop" hidden>${M.resetCrop}</button>
|
|
16
|
+
<button class="nf-tool nf-icon-btn" type="button" data-tool="arrow" title="Arrow" aria-label="Arrow">${M.arrow}</button>
|
|
17
|
+
<button class="nf-tool nf-icon-btn" type="button" data-tool="rect" title="Rectangle" aria-label="Rectangle">${M.rect}</button>
|
|
18
|
+
<button class="nf-tool nf-icon-btn" type="button" data-tool="circle" title="Circle" aria-label="Circle">${M.circle}</button>
|
|
19
|
+
<button class="nf-discard-shot nf-icon-btn" type="button" title="Discard screenshot" aria-label="Discard screenshot">${M.discard}</button>
|
|
20
|
+
<button class="nf-recapture nf-icon-btn" type="button" title="Recapture screenshot" aria-label="Recapture screenshot">${M.recapture}</button>
|
|
21
21
|
</div>
|
|
22
22
|
<div class="nf-canvas"></div>
|
|
23
23
|
</div>
|
|
@@ -27,7 +27,7 @@ var Notefully=(function(A){"use strict";function sn(t,e){if(t.match(/^[a-z]+:\/\
|
|
|
27
27
|
<div class="nf-kind"></div>
|
|
28
28
|
<div class="nf-privacy-summary">
|
|
29
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">${
|
|
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">${M.privacy}</button>
|
|
31
31
|
</div>
|
|
32
32
|
</div>
|
|
33
33
|
<div class="nf-privacy">
|
|
@@ -37,40 +37,43 @@ var Notefully=(function(A){"use strict";function sn(t,e){if(t.match(/^[a-z]+:\/\
|
|
|
37
37
|
</div>
|
|
38
38
|
</div>
|
|
39
39
|
<div class="nf-actions">
|
|
40
|
-
<button class="nf-restore nf-icon-btn" type="button" title="Restore screenshot" aria-label="Restore screenshot" hidden>${
|
|
41
|
-
<button class="nf-audio nf-icon-btn" type="button" title="Record audio" aria-label="Record audio">${
|
|
42
|
-
<button class="nf-video nf-icon-btn" type="button" title="Record video" aria-label="Record video">${
|
|
40
|
+
<button class="nf-restore nf-icon-btn" type="button" title="Restore screenshot" aria-label="Restore screenshot" hidden>${M.resetCrop}</button>
|
|
41
|
+
<button class="nf-audio nf-icon-btn" type="button" title="Record audio" aria-label="Record audio">${M.audio}</button>
|
|
42
|
+
<button class="nf-video nf-icon-btn" type="button" title="Record video" aria-label="Record video">${M.video}</button>
|
|
43
43
|
<button class="nf-submit" type="button">Submit</button>
|
|
44
44
|
</div>
|
|
45
45
|
<div class="nf-status"></div>
|
|
46
46
|
</div>
|
|
47
47
|
<p class="nf-success-msg" hidden aria-live="polite">Submitted!</p>
|
|
48
|
-
<a class="nf-success-link" hidden target="_blank" rel="noopener noreferrer"
|
|
48
|
+
<a class="nf-success-link" hidden target="_blank" rel="noopener noreferrer" aria-label="View Report">
|
|
49
|
+
<span class="nf-success-link-label">View Report</span>
|
|
50
|
+
${M.openArrow}
|
|
51
|
+
</a>
|
|
49
52
|
</div>
|
|
50
53
|
</div>
|
|
51
54
|
<button class="nf-stop-video" type="button" hidden>Stop</button>
|
|
52
|
-
`,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"),successLink:p(".nf-success-link"),stage:p(".nf-stage"),palette:p(".nf-palette"),canvas:p(".nf-canvas"),text:p(".nf-text"),author:p(".nf-author"),kindRow:p(".nf-kind-row"),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},_r(),at()),h}function at(){var t;h&&(h.dataset.theme=$e(d.theme),d.hideLauncher?h.setAttribute("data-nf-hidden-launcher",""):h.removeAttribute("data-nf-hidden-launcher"),s.video&&(s.video.hidden=!d.video),Te(),(t=s.dialog)!=null&&t.hidden&&wt())}function wt(){s.launcher&&(s.launcher.hidden=!!d.hideLauncher)}function _r(){s.launcher.addEventListener("click",()=>Xt()),p(".nf-dialog").addEventListener("click",e=>{mt&&!gt||e.target===s.dialog&&J()}),document.addEventListener("keydown",Ke),h.querySelectorAll(".nf-tool").forEach(e=>{e.addEventListener("click",()=>ot(e.dataset.tool))}),s.resetCrop.addEventListener("click",Jr),s.canvas.addEventListener("pointerdown",Kr),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&&jt(n.dataset.kind)}),s.discard.addEventListener("click",Qr),s.recapture.addEventListener("click",()=>{ti().catch(e=>S(e.message||"Recapture failed."))}),s.restore.addEventListener("click",Zr),s.audio.addEventListener("click",ei),s.video.addEventListener("click",ni),s.stop.addEventListener("click",()=>it==null?void 0:it.stop()),s.privacyChange.addEventListener("click",()=>Ct(!Y)),s.privacyDone.addEventListener("click",()=>Ct(!1)),s.privacyScroll.addEventListener("change",li),p(".nf-submit").addEventListener("click",()=>{Yt().catch(e=>S(e.message||"Submit failed."))}),Te(),ot(null)}function k(t){return String(t||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Te(){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="${k(i.id)}">${k(i.label)}</button>`).join("");const r=e.map(i=>i.id).includes(W)?W:pt(e);jt(r)}function jt(t){W=(d.kinds||V).map(n=>n.id).includes(t)?t:pt(d.kinds),h==null||h.querySelectorAll("[data-kind]").forEach(n=>{n.dataset.active=String(n.dataset.kind===W)}),Vr(W)}function jr(){try{return String(localStorage.getItem(Ae)||"").trim().toLowerCase()}catch{return""}}function Vr(t){const e=String(t||"").trim().toLowerCase();if(e)try{localStorage.setItem(Ae,e)}catch{}}function Wr(){const t=(d.kinds||V).map(n=>n.id),e=jr();return e&&t.includes(e)?e:pt(d.kinds)}function ot(t){z=Hr.has(t)?t:null,T=null,h.querySelectorAll(".nf-tool").forEach(e=>{e.dataset.active=String(e.dataset.tool===z)}),s.canvas&&(s.canvas.dataset.draw=z?"true":"false"),K()&&M()}function Pe(t){return Math.min(1,Math.max(0,t))}function st(){return s.shot||s.canvas}function vt(t){const e=st().getBoundingClientRect();return{x:Pe((t.clientX-e.left)/Math.max(e.width,1)),y:Pe((t.clientY-e.top)/Math.max(e.height,1))}}function zr(t){const e=st().getBoundingClientRect();return t.clientX>=e.left&&t.clientX<=e.right&&t.clientY>=e.top&&t.clientY<=e.bottom}function Ie(t){const e=vt(t),n=m.crop();return{x:n.x+e.x*n.w,y:n.y+e.y*n.h}}function bt(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(Ht,Math.abs(e.x-t.x)),h:Math.max(Ht,Math.abs(e.y-t.y))}}function Vt(t){h&&(t?h.dataset.grabbing="true":delete h.dataset.grabbing)}function Wt(t){try{s.canvas.setPointerCapture(t.pointerId)}catch{}}function zt(){window.addEventListener("pointermove",Be),window.addEventListener("pointerup",St),window.addEventListener("pointercancel",St)}function Oe(){window.removeEventListener("pointermove",Be),window.removeEventListener("pointerup",St),window.removeEventListener("pointercancel",St)}function Kr(t){if(t.button!==0||!K())return;if(!t.target.closest(".nf-sticker")&&!zr(t)){T=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(),T=n.dataset.id,Wt(t),qr({kind:"sticker",id:T,dir:(e==null?void 0:e.dataset.dir)||"move"},t),M();return}if(T=null,z==="crop"){t.preventDefault(),Wt(t),v={kind:"crop",start:vt(t),current:vt(t)},zt(),M();return}if(z==="arrow"||z==="rect"||z==="circle"){t.preventDefault(),Wt(t);const r=Ie(t);v={kind:"sticker",type:z,start:r,current:r},zt(),M();return}M()}function qr(t,e){e.preventDefault(),e.stopPropagation();const n=st().getBoundingClientRect(),r=m.list().find(i=>i.id===t.id);b={...t,startX:e.clientX,startY:e.clientY,crop:m.crop(),sticker:r?{...r}:null,rect:n},Vt(t.dir==="move"||t.dir==="start"||t.dir==="end"),zt()}function Be(t){if(v){v.current=v.kind==="crop"?vt(t):Ie(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 i={x:r.x,y:r.y,w:r.w,h:r.h};Xr(i,b.dir,e,n),m.update(r.id,i)}M()}}function Xr(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 St(t){if(Oe(),Vt(!1),v){Yr();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),T=null)}b=null,M()}}function Yr(){const t=v;if(v=null,!t)return;if(t.kind==="crop"){const n=bt(t.start,t.current);if(Math.abs(t.current.x-t.start.x)<Ee||Math.abs(t.current.y-t.start.y)<Ee){M();return}const i=m.crop();m.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}),G();return}const e=Gr(t);e&&(T=e.id),M()}function Gr(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)<Ht?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,bt(t.start,t.current))}function Jr(){m.resetCrop(),T=null,G()}function xt(){s.resetCrop&&(s.resetCrop.hidden=!m.isCropped())}function Kt(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 K(){return j(B)}function ct(){if(!s.stage||!s.palette||!s.actions||!s.recapture)return;const t=K();s.stage.hidden=!t&&!D,s.palette.hidden=!t,s.discard&&(s.discard.hidden=!t),s.restore&&(s.restore.hidden=t||!tt),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 Qr(){K()&&(tt=B),B="",ot(null),ct(),G()}function Zr(){j(tt)&&(B=tt,ct(),G())}function De(){return{capture:typeof d.capture=="function"?d.capture:void 0,onBeforeCapture:typeof d.onBeforeCapture=="function"?d.onBeforeCapture:void 0}}function He(t){if(!j(t))throw new Error("Screenshot failed; you can still send text.");B=t,tt=t,m=Pt(),F={w:0,h:0},T=null,v=null,b=null,ot(null)}async function ti(){if(!(Ut||!s.dialog||s.dialog.hidden)){Ut=!0,s.recapture.disabled=!0,S("Capturing…",!0),s.dialog.hidden=!0;try{let t="";try{t=await lr()}catch{t=await pe(De())}He(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,Ut=!1,ct(),G()}}}function ei(){try{if(X||(X=gr(e=>{const n=s.text.value.trim();s.text.value=n?`${n} ${e}`:e})),!X.isSupported()){S("Audio-to-text is not supported in this browser.");return}const t=X.start();Kt(t),S(t?"Listening…":"")}catch(t){S(t.message)}}async function ni(){if(!d.video){S("Video is disabled on this host.");return}s.dialog.hidden=!0,s.stop.hidden=!1,at(),s.launcher.hidden=!0,it=vr({onStart(){},onStop(t){D=t,s.stop.hidden=!0,wt(),s.dialog.hidden=!1,ct(),G(),S(t?"Video attached.":"Recording cancelled.")},onError(t){S(t.message)}});try{await it.start()}catch(t){s.stop.hidden=!0,wt(),s.dialog.hidden=!1,S(t.message)}}function G(){if(s.shot=null,!K()){s.canvas.style.removeProperty("--nf-shot-aspect"),s.canvas.style.removeProperty("aspect-ratio"),s.canvas.innerHTML=D?`<video class="nf-recording-preview" controls src="${URL.createObjectURL(D)}"></video>`:"",xt();return}s.canvas.innerHTML=`<div class="nf-shot"><img alt="Screenshot" src="${B}" 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=()=>{ri(t),M()};t.addEventListener("load",e),t.complete&&t.naturalWidth&&e(),xt()}function ri(t){const e=t.naturalWidth||F.w,n=t.naturalHeight||F.h;if(e&&n&&(F={w:e,h:n},s.canvas.style.setProperty("--nf-shot-aspect",String(e/n)),s.canvas.style.aspectRatio=`${e} / ${n}`),!s.shot||!F.w||!F.h)return;const r=m.crop(),i=F.w/F.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 ii(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:"",...bt(t.start,t.current)}}function M(){if((s.shot||s.canvas).querySelectorAll(".nf-sticker, .nf-crop").forEach(a=>a.remove()),!K()||!s.shot){xt();return}const e=m.crop(),n=st(),r=It(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`),(v==null?void 0:v.kind)==="crop"){const a=document.createElement("div");a.className="nf-crop",Fe(a,bt(v.start,v.current),{x:0,y:0,w:1,h:1}),s.shot.appendChild(a)}const i=m.list().slice();if((v==null?void 0:v.kind)==="sticker"&&i.push(ii(v)),i.forEach(a=>{const o=a.id==="preview",c=!o&&a.id===T,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"?ai(l,a,e,c,r):(Fe(l,a,e),c&&["nw","ne","sw","se"].forEach(u=>qt(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()),D){const a=document.createElement("video");a.className="nf-recording-preview",a.controls=!0,a.src=URL.createObjectURL(D),a.style.position="absolute",a.style.right="8px",a.style.bottom="8px",a.style.width="160px",s.canvas.appendChild(a)}xt()}function ai(t,e,n,r,i=It(400)){const a=st(),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,y=((e.y2??e.y)-n.y)/n.h*c,g=Math.max(18,i.arrowHead+i.stroke*2),w=Math.min(l,f)-g,x=Math.min(u,y)-g,L=Math.max(2,Math.abs(f-l))+g*2,H=Math.max(2,Math.abs(y-u))+g*2,$=l-w,N=u-x,et=f-w,nt=y-x,q=be($,N,et,nt,i),rt=document.createElementNS("http://www.w3.org/2000/svg","svg");t.style.left=`${w}px`,t.style.top=`${x}px`,t.style.width=`${L}px`,t.style.height=`${H}px`,rt.setAttribute("class","nf-arrow-svg"),rt.setAttribute("viewBox",`0 0 ${L} ${H}`),rt.setAttribute("width",String(L)),rt.setAttribute("height",String(H)),rt.innerHTML=`
|
|
53
|
-
<line class="nf-arrow-hit" x1="${$}" y1="${N}" x2="${
|
|
55
|
+
`,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"),successLink:p(".nf-success-link"),stage:p(".nf-stage"),palette:p(".nf-palette"),canvas:p(".nf-canvas"),text:p(".nf-text"),author:p(".nf-author"),kindRow:p(".nf-kind-row"),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},_r(),ae()),h}function ae(){var e;h&&(h.dataset.theme=Rt(d.theme),d.hideLauncher?h.setAttribute("data-nf-hidden-launcher",""):h.removeAttribute("data-nf-hidden-launcher"),s.video&&(s.video.hidden=!d.video),Tt(),(e=s.dialog)!=null&&e.hidden&&we())}function we(){s.launcher&&(s.launcher.hidden=!!d.hideLauncher)}function _r(){s.launcher.addEventListener("click",()=>Xe()),p(".nf-dialog").addEventListener("click",t=>{me&&!ge||t.target===s.dialog&&J()}),document.addEventListener("keydown",Kt),h.querySelectorAll(".nf-tool").forEach(t=>{t.addEventListener("click",()=>oe(t.dataset.tool))}),s.resetCrop.addEventListener("click",Jr),s.canvas.addEventListener("pointerdown",Kr),s.canvas.addEventListener("dragstart",t=>t.preventDefault());const e=p(".nf-kind");e&&e.addEventListener("click",t=>{const n=t.target.closest("[data-kind]");n&&je(n.dataset.kind)}),s.discard.addEventListener("click",Qr),s.recapture.addEventListener("click",()=>{ei().catch(t=>S(t.message||"Recapture failed."))}),s.restore.addEventListener("click",Zr),s.audio.addEventListener("click",ti),s.video.addEventListener("click",ni),s.stop.addEventListener("click",()=>ie==null?void 0:ie.stop()),s.privacyChange.addEventListener("click",()=>Ce(!Y)),s.privacyDone.addEventListener("click",()=>Ce(!1)),s.privacyScroll.addEventListener("change",li),p(".nf-submit").addEventListener("click",()=>{Ye().catch(t=>S(t.message||"Submit failed."))}),Tt(),oe(null)}function k(e){return String(e||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Tt(){const e=h==null?void 0:h.querySelector(".nf-kind");if(!e)return;const t=Array.isArray(d.kinds)&&d.kinds.length?d.kinds:V;e.innerHTML=t.map(i=>`<button type="button" data-kind="${k(i.id)}">${k(i.label)}</button>`).join("");const r=t.map(i=>i.id).includes(W)?W:pe(t);je(r)}function je(e){W=(d.kinds||V).map(n=>n.id).includes(e)?e:pe(d.kinds),h==null||h.querySelectorAll("[data-kind]").forEach(n=>{n.dataset.active=String(n.dataset.kind===W)}),Vr(W)}function jr(){try{return String(localStorage.getItem(At)||"").trim().toLowerCase()}catch{return""}}function Vr(e){const t=String(e||"").trim().toLowerCase();if(t)try{localStorage.setItem(At,t)}catch{}}function Wr(){const e=(d.kinds||V).map(n=>n.id),t=jr();return t&&e.includes(t)?t:pe(d.kinds)}function oe(e){z=Hr.has(e)?e:null,P=null,h.querySelectorAll(".nf-tool").forEach(t=>{t.dataset.active=String(t.dataset.tool===z)}),s.canvas&&(s.canvas.dataset.draw=z?"true":"false"),K()&&R()}function Pt(e){return Math.min(1,Math.max(0,e))}function se(){return s.shot||s.canvas}function ve(e){const t=se().getBoundingClientRect();return{x:Pt((e.clientX-t.left)/Math.max(t.width,1)),y:Pt((e.clientY-t.top)/Math.max(t.height,1))}}function zr(e){const t=se().getBoundingClientRect();return e.clientX>=t.left&&e.clientX<=t.right&&e.clientY>=t.top&&e.clientY<=t.bottom}function It(e){const t=ve(e),n=m.crop();return{x:n.x+t.x*n.w,y:n.y+t.y*n.h}}function be(e,t){const n=Math.min(e.x,t.x),r=Math.min(e.y,t.y);return{x:n,y:r,w:Math.max(He,Math.abs(t.x-e.x)),h:Math.max(He,Math.abs(t.y-e.y))}}function Ve(e){h&&(e?h.dataset.grabbing="true":delete h.dataset.grabbing)}function We(e){try{s.canvas.setPointerCapture(e.pointerId)}catch{}}function ze(){window.addEventListener("pointermove",Bt),window.addEventListener("pointerup",Se),window.addEventListener("pointercancel",Se)}function Ot(){window.removeEventListener("pointermove",Bt),window.removeEventListener("pointerup",Se),window.removeEventListener("pointercancel",Se)}function Kr(e){if(e.button!==0||!K())return;if(!e.target.closest(".nf-sticker")&&!zr(e)){P=null,R();return}const t=e.target.closest(".nf-handle"),n=e.target.closest(".nf-sticker");if(n&&n.dataset.preview!=="true"){e.preventDefault(),e.stopPropagation(),P=n.dataset.id,We(e),qr({kind:"sticker",id:P,dir:(t==null?void 0:t.dataset.dir)||"move"},e),R();return}if(P=null,z==="crop"){e.preventDefault(),We(e),v={kind:"crop",start:ve(e),current:ve(e)},ze(),R();return}if(z==="arrow"||z==="rect"||z==="circle"){e.preventDefault(),We(e);const r=It(e);v={kind:"sticker",type:z,start:r,current:r},ze(),R();return}R()}function qr(e,t){t.preventDefault(),t.stopPropagation();const n=se().getBoundingClientRect(),r=m.list().find(i=>i.id===e.id);b={...e,startX:t.clientX,startY:t.clientY,crop:m.crop(),sticker:r?{...r}:null,rect:n},Ve(e.dir==="move"||e.dir==="start"||e.dir==="end"),ze()}function Bt(e){if(v){v.current=v.kind==="crop"?ve(e):It(e),R();return}if(!b)return;const t=(e.clientX-b.startX)/b.rect.width*b.crop.w,n=(e.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+t,y2:r.y2+n});else if(b.dir==="start")m.update(r.id,{x:r.x+t,y:r.y+n});else if(b.dir==="move")m.update(r.id,{x:r.x+t,y:r.y+n,x2:(r.x2||r.x)+t,y2:(r.y2||r.y)+n});else{const i={x:r.x,y:r.y,w:r.w,h:r.h};Xr(i,b.dir,t,n),m.update(r.id,i)}R()}}function Xr(e,t,n,r){if(t.includes("e")&&(e.w=Math.max(.04,e.w+n)),t.includes("s")&&(e.h=Math.max(.04,e.h+r)),t.includes("w")){const i=Math.max(.04,e.w-n);e.x+=e.w-i,e.w=i}if(t.includes("n")){const i=Math.max(.04,e.h-r);e.y+=e.h-i,e.h=i}}function Se(e){if(Ot(),Ve(!1),v){Yr();return}if(b){if(b.kind==="sticker"){const t=s.canvas.getBoundingClientRect();(e.clientX<t.left-24||e.clientX>t.right+24||e.clientY<t.top-24||e.clientY>t.bottom+24)&&(m.remove(b.id),P=null)}b=null,R()}}function Yr(){const e=v;if(v=null,!e)return;if(e.kind==="crop"){const n=be(e.start,e.current);if(Math.abs(e.current.x-e.start.x)<Et||Math.abs(e.current.y-e.start.y)<Et){R();return}const i=m.crop();m.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}),G();return}const t=Gr(e);t&&(P=t.id),R()}function Gr(e){if(e.type==="arrow"){const t=e.current.x-e.start.x,n=e.current.y-e.start.y;return Math.hypot(t,n)<He?m.add("arrow",{x:e.start.x,y:e.start.y,x2:e.start.x+.12,y2:e.start.y,w:.12,h:.02}):m.add("arrow",{x:e.start.x,y:e.start.y,x2:e.current.x,y2:e.current.y,w:Math.abs(t),h:Math.abs(n)})}return m.add(e.type,be(e.start,e.current))}function Jr(){m.resetCrop(),P=null,G()}function xe(){s.resetCrop&&(s.resetCrop.hidden=!m.isCropped())}function Ke(e){if(!s.audio)return;const t=e?"Stop audio":"Record audio";s.audio.title=t,s.audio.setAttribute("aria-label",t),s.audio.dataset.active=String(!!e)}function K(){return j(B)}function ce(){if(!s.stage||!s.palette||!s.actions||!s.recapture)return;const e=K();s.stage.hidden=!e&&!D,s.palette.hidden=!e,s.discard&&(s.discard.hidden=!e),s.restore&&(s.restore.hidden=e||!ee),e?(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 Qr(){K()&&(ee=B),B="",oe(null),ce(),G()}function Zr(){j(ee)&&(B=ee,ce(),G())}function Dt(){return{capture:typeof d.capture=="function"?d.capture:void 0,onBeforeCapture:typeof d.onBeforeCapture=="function"?d.onBeforeCapture:void 0}}function Ht(e){if(!j(e))throw new Error("Screenshot failed; you can still send text.");B=e,ee=e,m=Pe(),F={w:0,h:0},P=null,v=null,b=null,oe(null)}async function ei(){if(!(Ue||!s.dialog||s.dialog.hidden)){Ue=!0,s.recapture.disabled=!0,S("Capturing…",!0),s.dialog.hidden=!0;try{let e="";try{e=await lr()}catch{e=await pt(Dt())}Ht(e),S("")}catch(e){S((e==null?void 0:e.message)||"Screenshot failed; you can still send text.")}finally{s.dialog.hidden=!1,s.recapture.disabled=!1,Ue=!1,ce(),G()}}}function ti(){try{if(X||(X=gr(t=>{const n=s.text.value.trim();s.text.value=n?`${n} ${t}`:t})),!X.isSupported()){S("Audio-to-text is not supported in this browser.");return}const e=X.start();Ke(e),S(e?"Listening…":"")}catch(e){S(e.message)}}async function ni(){if(!d.video){S("Video is disabled on this host.");return}s.dialog.hidden=!0,s.stop.hidden=!1,ae(),s.launcher.hidden=!0,ie=vr({onStart(){},onStop(e){D=e,s.stop.hidden=!0,we(),s.dialog.hidden=!1,ce(),G(),S(e?"Video attached.":"Recording cancelled.")},onError(e){S(e.message)}});try{await ie.start()}catch(e){s.stop.hidden=!0,we(),s.dialog.hidden=!1,S(e.message)}}function G(){if(s.shot=null,!K()){s.canvas.style.removeProperty("--nf-shot-aspect"),s.canvas.style.removeProperty("aspect-ratio"),s.canvas.innerHTML=D?`<video class="nf-recording-preview" controls src="${URL.createObjectURL(D)}"></video>`:"",xe();return}s.canvas.innerHTML=`<div class="nf-shot"><img alt="Screenshot" src="${B}" draggable="false"></div>`,s.shot=s.canvas.querySelector(".nf-shot");const e=s.shot.querySelector("img");e.draggable=!1,e.addEventListener("dragstart",n=>n.preventDefault());const t=()=>{ri(e),R()};e.addEventListener("load",t),e.complete&&e.naturalWidth&&t(),xe()}function ri(e){const t=e.naturalWidth||F.w,n=e.naturalHeight||F.h;if(t&&n&&(F={w:t,h:n},s.canvas.style.setProperty("--nf-shot-aspect",String(t/n)),s.canvas.style.aspectRatio=`${t} / ${n}`),!s.shot||!F.w||!F.h)return;const r=m.crop(),i=F.w/F.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}%`,e.style.width=`${100/r.w}%`,e.style.height=`${100/r.h}%`,e.style.left=`${-r.x/r.w*100}%`,e.style.top=`${-r.y/r.h*100}%`}function ii(e){return e.type==="arrow"?{id:"preview",type:"arrow",number:"",x:e.start.x,y:e.start.y,x2:e.current.x,y2:e.current.y,w:Math.abs(e.current.x-e.start.x),h:Math.abs(e.current.y-e.start.y)}:{id:"preview",type:e.type,number:"",...be(e.start,e.current)}}function R(){if((s.shot||s.canvas).querySelectorAll(".nf-sticker, .nf-crop").forEach(a=>a.remove()),!K()||!s.shot){xe();return}const t=m.crop(),n=se(),r=Ie(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`),(v==null?void 0:v.kind)==="crop"){const a=document.createElement("div");a.className="nf-crop",Ft(a,be(v.start,v.current),{x:0,y:0,w:1,h:1}),s.shot.appendChild(a)}const i=m.list().slice();if((v==null?void 0:v.kind)==="sticker"&&i.push(ii(v)),i.forEach(a=>{const o=a.id==="preview",c=!o&&a.id===P,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"?ai(l,a,t,c,r):(Ft(l,a,t),c&&["nw","ne","sw","se"].forEach(u=>qe(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()),D){const a=document.createElement("video");a.className="nf-recording-preview",a.controls=!0,a.src=URL.createObjectURL(D),a.style.position="absolute",a.style.right="8px",a.style.bottom="8px",a.style.width="160px",s.canvas.appendChild(a)}xe()}function ai(e,t,n,r,i=Ie(400)){const a=se(),o=a.clientWidth,c=a.clientHeight,l=(t.x-n.x)/n.w*o,u=(t.y-n.y)/n.h*c,f=((t.x2??t.x+t.w)-n.x)/n.w*o,y=((t.y2??t.y)-n.y)/n.h*c,g=Math.max(18,i.arrowHead+i.stroke*2),w=Math.min(l,f)-g,x=Math.min(u,y)-g,L=Math.max(2,Math.abs(f-l))+g*2,H=Math.max(2,Math.abs(y-u))+g*2,$=l-w,N=u-x,te=f-w,ne=y-x,q=bt($,N,te,ne,i),re=document.createElementNS("http://www.w3.org/2000/svg","svg");e.style.left=`${w}px`,e.style.top=`${x}px`,e.style.width=`${L}px`,e.style.height=`${H}px`,re.setAttribute("class","nf-arrow-svg"),re.setAttribute("viewBox",`0 0 ${L} ${H}`),re.setAttribute("width",String(L)),re.setAttribute("height",String(H)),re.innerHTML=`
|
|
56
|
+
<line class="nf-arrow-hit" x1="${$}" y1="${N}" x2="${te}" y2="${ne}" />
|
|
54
57
|
<line class="nf-arrow-shaft" x1="${$}" y1="${N}" x2="${q.shaftEnd.x}" y2="${q.shaftEnd.y}" />
|
|
55
58
|
<polygon class="nf-arrow-head" points="${q.tipX},${q.tipY} ${q.left.x},${q.left.y} ${q.right.x},${q.right.y}" />
|
|
56
|
-
`,
|
|
59
|
+
`,e.appendChild(re),r&&(qe(e,"start",{left:$-5,top:N-5}),qe(e,"end",{left:te-5,top:ne-5}))}function qe(e,t,n){const r=document.createElement("span");r.className="nf-handle",r.dataset.dir=t,n&&(r.style.left=`${n.left}px`,r.style.top=`${n.top}px`),e.appendChild(r)}function Ft(e,t,n){e.style.left=`${(t.x-n.x)/n.w*100}%`,e.style.top=`${(t.y-n.y)/n.h*100}%`,e.style.width=`${t.w/n.w*100}%`,e.style.height=`${t.h/n.h*100}%`}function Ut(){try{return String(localStorage.getItem(Lt)||"").trim()}catch{return""}}function oi(e){const t=String(e||"").trim();if(!(!t||t===Fe))try{localStorage.setItem(Lt,t)}catch{}}function Nt(){try{const e=localStorage.getItem(Mt);if(!e)return{diagnostics:!1,logs:!1};const t=JSON.parse(e);return{diagnostics:!!(t!=null&&t.diagnostics),logs:!!(t!=null&&t.logs)}}catch{return{diagnostics:!1,logs:!1}}}function _t(e={}){const t={...Nt(),...e};try{localStorage.setItem(Mt,JSON.stringify({diagnostics:!!t.diagnostics,logs:!!t.logs}))}catch{}}function jt(){return!!(String(O.userId||"").trim()||String(O.email||"").trim()||String(O.displayName||"").trim())}function Vt(){return String(O.displayName||O.email||O.userId||"").trim()}function si(){var t;if(jt())return Vt()||Fe;const e=String(((t=s.author)==null?void 0:t.value)||"").trim();return e?(oi(e),e):Fe}function Wt(){if(!s.author)return;const e=jt();if(s.author.hidden=e,e){s.author.value="";return}s.author.value=Ut()}function zt(e,t=kt){const n=Number(e);return Number.isFinite(n)?Math.min(Ur,Math.max(0,Math.floor(n))):t}function Kt(e){e.key!=="Escape"||!s.dialog||s.dialog.hidden||me&&!ge||J()}function qt(e={}){pr(e);const t=Object.prototype.hasOwnProperty.call(e,"kinds");d={...d,endpoint:String(e.endpoint||d.endpoint||"").replace(/\/$/,""),projectKey:e.projectKey==null?d.projectKey:String(e.projectKey),version:e.version==null?d.version:String(e.version),name:e.name==null?d.name:String(e.name||""),targets:e.targets===void 0?d.targets:e.targets,hideLauncher:e.hideLauncher==null?d.hideLauncher:!!e.hideLauncher,theme:Rt(e.theme??d.theme),video:e.video==null?d.video:!!e.video,consoleLogLimit:e.consoleLogLimit==null?d.consoleLogLimit:zt(e.consoleLogLimit,d.consoleLogLimit),kinds:t?Br(e.kinds):d.kinds,capture:e.capture===void 0?d.capture:e.capture,onBeforeCapture:e.onBeforeCapture===void 0?d.onBeforeCapture:e.onBeforeCapture,displayLink:e.displayLink==null?d.displayLink:!!e.displayLink}}function Ee(e={}){return qt(e),h&&ae(),ke}function Xt(e={}){return qt(e),_e(),ae(),ke}function Yt(e){return Ee({theme:e})}function Gt(e){const t=!!e;return!t&&h&&s.dialog&&!s.dialog.hidden&&J(),Ee({hideLauncher:!t})}function ci(){const e=Vt()||Ut()||void 0,t=fr({...O,displayName:O.displayName||e});U=Rr(t),I=$r(Ct.snapshot().slice(-zt(d.consoleLogLimit)));const n=Nt();n.diagnostics&&he(U,!0),n.logs&&I.length&&he(I,!0),Y=!1}function Ce(e){Y=!!e,s.privacyPanel&&(s.privacyPanel.hidden=!Y),s.privacyChange&&(s.privacyChange.setAttribute("aria-expanded",Y?"true":"false"),s.privacyChange.dataset.active=String(Y)),Y&&tn()}function Jt(){if(!s.privacy||!s.privacyText||!s.privacyChange)return;const e=Pr({diagnostics:U,logs:I});s.privacyText.textContent=e,s.privacyText.hidden=!e;const t=U.length===0&&I.length===0;s.privacySummary&&(s.privacySummary.hidden=t),s.privacy.hidden=t,s.privacyChange.hidden=!1}function Qt(e,t,n){return`<label class="nf-privacy-toggle">
|
|
57
60
|
<span class="nf-privacy-toggle-label">Redact</span>
|
|
58
|
-
<input type="checkbox" ${
|
|
59
|
-
</label>`}function
|
|
61
|
+
<input type="checkbox" ${e?"checked":""} ${t?'data-indeterminate="true"':""} aria-label="${k(n)}">
|
|
62
|
+
</label>`}function Zt(e,t,n,r,i){const a=Qt(i,!1,`Redact ${n}`);if(i){const o=r?`${n}: ${r}`:n;return`<div class="nf-privacy-row" data-kind="${k(e)}" data-id="${k(t)}" data-redacted="true">
|
|
60
63
|
<div class="nf-privacy-row-text">
|
|
61
64
|
<div class="nf-privacy-row-summary" title="${k(o)}">${k(o)}</div>
|
|
62
65
|
</div>
|
|
63
66
|
${a}
|
|
64
|
-
</div>`}return`<div class="nf-privacy-row" data-kind="${k(
|
|
67
|
+
</div>`}return`<div class="nf-privacy-row" data-kind="${k(e)}" data-id="${k(t)}">
|
|
65
68
|
<div class="nf-privacy-row-text">
|
|
66
69
|
<div class="nf-privacy-row-title">${k(n)}</div>
|
|
67
70
|
<div class="nf-privacy-row-detail">${k(r)}</div>
|
|
68
71
|
</div>
|
|
69
72
|
${a}
|
|
70
|
-
</div>`}function
|
|
73
|
+
</div>`}function en(e,t,n,r){if(!n.length)return"";const i=Tr(n),a=i.checked&&!i.indeterminate;return`<section class="nf-privacy-section" data-section="${k(e)}"${a?' data-redacted="true"':""}>
|
|
71
74
|
<div class="nf-privacy-section-head">
|
|
72
|
-
<h3 class="nf-privacy-section-title">${k(
|
|
73
|
-
${
|
|
75
|
+
<h3 class="nf-privacy-section-title">${k(t)}</h3>
|
|
76
|
+
${Qt(i.checked,i.indeterminate,`Redact all ${t.toLowerCase()}`)}
|
|
74
77
|
</div>
|
|
75
78
|
<div class="nf-privacy-rows"${a?" hidden":""}>${r}</div>
|
|
76
|
-
</section>`}function
|
|
79
|
+
</section>`}function tn(){if(!s.privacyScroll)return;const e=U.map(n=>Zt("diagnostic",n.key,n.label,Ir(n.value),n.redacted)).join(""),t=I.map(n=>Zt("log",n.id,n.level,n.text,n.redacted)).join("");s.privacyScroll.innerHTML=[en("diagnostics","Diagnostics",U,e),I.length?en("logs","Logs",I,t):""].join(""),s.privacyScroll.querySelectorAll('input[data-indeterminate="true"]').forEach(n=>{n.indeterminate=!0,n.removeAttribute("data-indeterminate")}),Jt()}function li(e){const t=e.target;if(!(t instanceof HTMLInputElement)||t.type!=="checkbox")return;const n=t.closest("[data-section]"),r=t.closest(".nf-privacy-row"),i=t.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=I.find(l=>l.id===o);c&&(c.redacted=i)}}else if(n){const a=n.dataset.section;a==="diagnostics"?(he(U,i),_t({diagnostics:i})):a==="logs"&&(he(I,i),_t({logs:i}))}else return;tn()}async function Xe(){_e(),nn(),ae(),s.launcher.hidden=!0,m=Pe(),F={w:0,h:0},D=null,B="",ee="",P=null,v=null,b=null,W=Wr(),je(W),oe(null),Ke(!1),s.text.value="",Wt(),S(""),ci();try{Ht(await pt(Dt())),S("")}catch(e){B="",S((e==null?void 0:e.message)||"Screenshot failed; you can still send text.")}ce(),Ce(!1),Jt(),s.dialog.hidden=!1,G(),s.text.focus()}function J(){h&&(X==null||X.stop(),Ke(!1),Ot(),v=null,b=null,Ve(!1),nn(),Ce(!1),s.dialog.hidden=!0,s.stop.hidden=!0,we())}function ui(e=""){const t=s.dialog,n=s.panel,r=s.panelBody,i=s.successMsg,a=s.successLink,o=String(e||"").trim(),c=!!(d.displayLink&&o);if(!t||!n||!r||!i)return Promise.resolve(!1);me=!0,ge=c,S("");const l=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches,u=n.getBoundingClientRect();if(r.hidden=!0,i.hidden=!1,t.classList.add("nf-success"),t.classList.toggle("nf-success-sticky",c),t.style.opacity="1",a&&(c?(a.hidden=!1,a.href=o):(a.hidden=!0,a.removeAttribute("href"))),c){if(l)return Promise.resolve(!0);const w=n.getBoundingClientRect(),x=w.width>0?u.width/w.width:1,L=w.height>0?u.height/w.height:1;return n.style.transformOrigin="center center",n.style.transition="none",n.style.transform=`scale(${x}, ${L})`,n.getBoundingClientRect(),new Promise(H=>{let $=!1;const N=()=>{$||($=!0,n.removeEventListener("transitionend",te),H(!0))},te=ne=>{ne.target!==n||ne.propertyName!=="transform"||N()};n.addEventListener("transitionend",te),requestAnimationFrame(()=>{n.style.transition="transform 0.48s cubic-bezier(0.22, 1, 0.36, 1)",n.style.transform="scale(1)"}),window.setTimeout(N,700)})}if(l)return new Promise(w=>{window.setTimeout(()=>w(!1),1e3)});const f=n.getBoundingClientRect(),y=f.width>0?u.width/f.width:1,g=f.height>0?u.height/f.height:1;return n.style.transformOrigin="center center",n.style.transition="none",n.style.transform=`scale(${y}, ${g})`,n.getBoundingClientRect(),new Promise(w=>{let x=!1;const L=()=>{x||(x=!0,n.removeEventListener("transitionend",H),window.setTimeout(()=>{t.style.transition="opacity 0.28s ease",t.style.opacity="0",window.setTimeout(()=>w(!1),280)},1e3))},H=$=>{$.target!==n||$.propertyName!=="transform"||L()};n.addEventListener("transitionend",H),requestAnimationFrame(()=>{n.style.transition="transform 0.48s cubic-bezier(0.22, 1, 0.36, 1)",n.style.transform="scale(1)"}),window.setTimeout(L,700)})}function nn(){me=!1,ge=!1,s.dialog&&(s.dialog.classList.remove("nf-success","nf-success-sticky"),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),s.successLink&&(s.successLink.hidden=!0,s.successLink.removeAttribute("href")))}function rn(e={}){O={...O,...hr(e)},Wt()}async function Ye(){if(_e(),Ne)return null;const e=s.text.value.trim();if(!e&&!K()&&!D)return S("Add a note, screenshot, or video first."),null;if(!d.endpoint||!d.projectKey)return S("Notefully is missing endpoint or projectKey."),null;Ne=!0,an(!0),S("Submitting…",!0);try{const t=si(),n=new FormData;if(n.append("message",e),n.append("kind",W),n.append("version",d.version||"0.0.0"),n.append("author",t),d.name&&n.append("name",d.name),n.append("context",JSON.stringify(Or({author:t,diagnostics:U,logs:I}))),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)),K()){const o=await Nr(B);if(n.append("screenshot",o,"screenshot.png"),m.list().length||m.isCropped()){const c=await Lr(B,m.crop(),m.list(),{mark:$t("--nf-mark","#fdd341"),markText:$t("--nf-mark-text","#2a2140")});n.append("screenshotBaked",c,"screenshot.baked.png")}}D&&n.append("recording",D,"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 S((i==null?void 0:i.error)||"Submit failed."),new Error((i==null?void 0:i.error)||`Submit failed (${r.status})`);return await ui((i==null?void 0:i.trackerUrl)||"")||J(),i}finally{Ne=!1,an(!1)}}function an(e){s.submit&&(s.submit.disabled=!!e,s.submit.setAttribute("aria-busy",e?"true":"false"))}function on(){J(),document.removeEventListener("keydown",Kt),h==null||h.remove(),h=null,s={}}const ke={init:Xt,configure:Ee,setTheme:Yt,setVisible:Gt,open:Xe,close:J,identify:rn,submit:Ye,destroy:on};return typeof window<"u"&&(window.Notefully=ke),A.close=J,A.configure=Ee,A.default=ke,A.destroy=on,A.identify=rn,A.init=Xt,A.open=Xe,A.setTheme=Yt,A.setVisible=Gt,A.submit=Ye,Object.defineProperties(A,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),A})({});
|
package/dist/notefully.js
CHANGED
|
@@ -132,7 +132,7 @@ function Ht(t) {
|
|
|
132
132
|
function yn(t) {
|
|
133
133
|
return t.split(/,/)[1];
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function Rt(t) {
|
|
136
136
|
return t.search(/^(data:)/) !== -1;
|
|
137
137
|
}
|
|
138
138
|
function mn(t, e) {
|
|
@@ -260,14 +260,14 @@ async function Mn(t, e) {
|
|
|
260
260
|
async function wt(t, e, n) {
|
|
261
261
|
return !n && e.filter && !e.filter(t) ? null : Promise.resolve(t).then((r) => Sn(r, e)).then((r) => En(t, r, e)).then((r) => An(t, r, e)).then((r) => Mn(r, e));
|
|
262
262
|
}
|
|
263
|
-
const we = /url\((['"]?)([^'"]+?)\1\)/g,
|
|
263
|
+
const we = /url\((['"]?)([^'"]+?)\1\)/g, Rn = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, $n = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
|
|
264
264
|
function Tn(t) {
|
|
265
265
|
const e = t.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
|
|
266
266
|
return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`, "g");
|
|
267
267
|
}
|
|
268
268
|
function Pn(t) {
|
|
269
269
|
const e = [];
|
|
270
|
-
return t.replace(we, (n, r, i) => (e.push(i), n)), e.filter((n) =>
|
|
270
|
+
return t.replace(we, (n, r, i) => (e.push(i), n)), e.filter((n) => !Rt(n));
|
|
271
271
|
}
|
|
272
272
|
async function In(t, e, n, r, i) {
|
|
273
273
|
try {
|
|
@@ -279,9 +279,9 @@ async function In(t, e, n, r, i) {
|
|
|
279
279
|
return t;
|
|
280
280
|
}
|
|
281
281
|
function On(t, { preferredFontFormat: e }) {
|
|
282
|
-
return e ? t.replace(
|
|
282
|
+
return e ? t.replace($n, (n) => {
|
|
283
283
|
for (; ; ) {
|
|
284
|
-
const [r, , i] =
|
|
284
|
+
const [r, , i] = Rn.exec(n) || [];
|
|
285
285
|
if (!i)
|
|
286
286
|
return "";
|
|
287
287
|
if (i === e)
|
|
@@ -312,7 +312,7 @@ async function Bn(t, e) {
|
|
|
312
312
|
}
|
|
313
313
|
async function Dn(t, e) {
|
|
314
314
|
const n = E(t, HTMLImageElement);
|
|
315
|
-
if (!(n &&
|
|
315
|
+
if (!(n && !Rt(t.src)) && !(E(t, SVGImageElement) && !Rt(t.href.baseVal)))
|
|
316
316
|
return;
|
|
317
317
|
const r = n ? t.src : t.href.baseVal, i = await Ft(r, Ht(r), e);
|
|
318
318
|
await new Promise((a, o) => {
|
|
@@ -529,7 +529,7 @@ function Jn() {
|
|
|
529
529
|
function Qn() {
|
|
530
530
|
document.querySelectorAll(`[${dt}]`).forEach((t) => t.remove());
|
|
531
531
|
}
|
|
532
|
-
function
|
|
532
|
+
function $t() {
|
|
533
533
|
return new Promise((t) => {
|
|
534
534
|
requestAnimationFrame(() => requestAnimationFrame(t));
|
|
535
535
|
});
|
|
@@ -627,7 +627,7 @@ async function rr() {
|
|
|
627
627
|
const n = document.createElement("video");
|
|
628
628
|
n.muted = !0, n.playsInline = !0, n.srcObject = t, await n.play(), n.videoWidth || await new Promise((c) => {
|
|
629
629
|
n.onloadedmetadata = () => c();
|
|
630
|
-
}), await
|
|
630
|
+
}), await $t();
|
|
631
631
|
const r = n.videoWidth || 1, i = n.videoHeight || 1, a = document.createElement("canvas");
|
|
632
632
|
a.width = r, a.height = i, a.getContext("2d").drawImage(n, 0, 0, r, i);
|
|
633
633
|
const o = a.toDataURL("image/png");
|
|
@@ -645,12 +645,12 @@ async function Ce(t = {}) {
|
|
|
645
645
|
e && (e.style.display = "none");
|
|
646
646
|
const o = Gn();
|
|
647
647
|
try {
|
|
648
|
-
if (typeof t.onBeforeCapture == "function" && await t.onBeforeCapture(), await
|
|
648
|
+
if (typeof t.onBeforeCapture == "function" && await t.onBeforeCapture(), await $t(), typeof t.capture == "function") {
|
|
649
649
|
const y = await er(await t.capture());
|
|
650
650
|
if (y)
|
|
651
651
|
return y;
|
|
652
652
|
}
|
|
653
|
-
a = await tr(), await
|
|
653
|
+
a = await tr(), await $t();
|
|
654
654
|
const { width: c, height: l } = Zn(), u = {
|
|
655
655
|
cacheBust: !0,
|
|
656
656
|
width: c,
|
|
@@ -986,8 +986,8 @@ function gr(t, {
|
|
|
986
986
|
}
|
|
987
987
|
if (u.number == null || u.number === "")
|
|
988
988
|
return;
|
|
989
|
-
const C = wr(u, n, r, i, f, y, g),
|
|
990
|
-
t.beginPath(), t.arc(C.x, C.y, l.badgeRadius, 0, Math.PI * 2), t.fillStyle = o, t.fill(), t.fillStyle = c, t.textAlign = "center", t.textBaseline = "middle", t.fillText(
|
|
989
|
+
const C = wr(u, n, r, i, f, y, g), I = String(u.number);
|
|
990
|
+
t.beginPath(), t.arc(C.x, C.y, l.badgeRadius, 0, Math.PI * 2), t.fillStyle = o, t.fill(), t.fillStyle = c, t.textAlign = "center", t.textBaseline = "middle", t.fillText(I, C.x, C.y + 0.5), t.fillStyle = o;
|
|
991
991
|
}), t.restore();
|
|
992
992
|
}
|
|
993
993
|
function Tt(t, e, n) {
|
|
@@ -1132,7 +1132,7 @@ function kt(t) {
|
|
|
1132
1132
|
const e = String(t || "").trim();
|
|
1133
1133
|
return e ? e.split(/[-_\s]+/).filter(Boolean).map((n) => n.charAt(0).toUpperCase() + n.slice(1)).join(" ") : "";
|
|
1134
1134
|
}
|
|
1135
|
-
function
|
|
1135
|
+
function Rr(t) {
|
|
1136
1136
|
if (!Array.isArray(t) || !t.length)
|
|
1137
1137
|
return z.map((r) => ({ ...r }));
|
|
1138
1138
|
const e = /* @__PURE__ */ new Set(), n = [];
|
|
@@ -1147,29 +1147,30 @@ function vt(t) {
|
|
|
1147
1147
|
const e = Array.isArray(t) && t.length ? t : z;
|
|
1148
1148
|
return e.some((r) => r.id === "bug") ? "bug" : ((n = e[0]) == null ? void 0 : n.id) || "other";
|
|
1149
1149
|
}
|
|
1150
|
-
const
|
|
1150
|
+
const $r = ["maker", "all-business", "brighter-day", "quiet-night"], Ae = "maker", Tr = /* @__PURE__ */ new Set(["crop", "arrow", "rect", "circle"]), It = 0.02, oe = 0.05, Pr = `
|
|
1151
1151
|
<svg class="nf-launcher-icon" viewBox="0 0 24 24" aria-hidden="true">
|
|
1152
1152
|
<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"/>
|
|
1153
1153
|
<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"/>
|
|
1154
1154
|
</svg>
|
|
1155
1155
|
`;
|
|
1156
|
-
function
|
|
1156
|
+
function $(t) {
|
|
1157
1157
|
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>`;
|
|
1158
1158
|
}
|
|
1159
|
-
const
|
|
1160
|
-
crop:
|
|
1161
|
-
resetCrop:
|
|
1162
|
-
arrow:
|
|
1163
|
-
rect:
|
|
1164
|
-
circle:
|
|
1165
|
-
discard:
|
|
1166
|
-
recapture:
|
|
1167
|
-
privacy:
|
|
1168
|
-
audio:
|
|
1169
|
-
video:
|
|
1159
|
+
const M = {
|
|
1160
|
+
crop: $('<path d="M6 3v5H1M18 21v-5h5M8 5h8a2 2 0 0 1 2 2v8M16 19H8a2 2 0 0 1-2-2V8"/>'),
|
|
1161
|
+
resetCrop: $('<path d="M3 12a9 9 0 1 0 3-6.7L3 8"/><path d="M3 3v5h5"/>'),
|
|
1162
|
+
arrow: $('<path d="M5 19 19 5"/><path d="M9 5h10v10"/>'),
|
|
1163
|
+
rect: $('<rect x="4" y="6" width="16" height="12" rx="1.5"/>'),
|
|
1164
|
+
circle: $('<circle cx="12" cy="12" r="8"/>'),
|
|
1165
|
+
discard: $('<path d="M4 7h16"/><path d="M9 7V5h6v2"/><path d="M6 7l1 13h10l1-13"/>'),
|
|
1166
|
+
recapture: $('<path d="M4 8h3l2-2h6l2 2h3v11H4z"/><circle cx="12" cy="13" r="3.5"/>'),
|
|
1167
|
+
privacy: $('<path d="M8 6h13M8 12h13M8 18h13"/><path d="M3 6h.01M3 12h.01M3 18h.01"/>'),
|
|
1168
|
+
audio: $('<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"/>'),
|
|
1169
|
+
video: $('<rect x="3" y="7" width="13" height="10" rx="2"/><path d="M16 10.5 21 8v8l-5-2.5z"/>'),
|
|
1170
|
+
openArrow: $('<path d="M5 12h14"/><path d="m13 6 6 6-6 6"/>')
|
|
1170
1171
|
}, Me = ur();
|
|
1171
1172
|
Me.hook();
|
|
1172
|
-
const
|
|
1173
|
+
const Re = 10, Ir = 80, $e = "notefully.author", Te = "notefully.kind", Pe = "notefully.redactSections", Ot = "Anonymous";
|
|
1173
1174
|
let d = {
|
|
1174
1175
|
endpoint: "",
|
|
1175
1176
|
projectKey: "",
|
|
@@ -1179,18 +1180,18 @@ let d = {
|
|
|
1179
1180
|
hideLauncher: !1,
|
|
1180
1181
|
theme: Ae,
|
|
1181
1182
|
video: !1,
|
|
1182
|
-
consoleLogLimit:
|
|
1183
|
+
consoleLogLimit: Re,
|
|
1183
1184
|
kinds: z.map((t) => ({ ...t })),
|
|
1184
1185
|
capture: null,
|
|
1185
1186
|
onBeforeCapture: null,
|
|
1186
1187
|
displayLink: !1
|
|
1187
|
-
}, Lt = !1, O = {}, p = null, s = {}, m = Ut(), D = "", et = "", B = null, W = vt(z), _ = null,
|
|
1188
|
+
}, Lt = !1, O = {}, p = null, s = {}, m = Ut(), D = "", et = "", B = null, W = vt(z), _ = null, T = null, b = null, v = null, ct = null, X = null, rt = null, F = { w: 0, h: 0 }, At = !1, bt = !1, St = !1, U = [], P = [], q = !1;
|
|
1188
1189
|
function h(t) {
|
|
1189
1190
|
return p.querySelector(t);
|
|
1190
1191
|
}
|
|
1191
1192
|
function Ie(t) {
|
|
1192
1193
|
const e = String(t || "").trim().toLowerCase().replace(/\s+/g, "-");
|
|
1193
|
-
return
|
|
1194
|
+
return $r.includes(e) ? e : Ae;
|
|
1194
1195
|
}
|
|
1195
1196
|
function se(t, e) {
|
|
1196
1197
|
return p && getComputedStyle(p).getPropertyValue(t).trim() || e;
|
|
@@ -1211,13 +1212,13 @@ function _t() {
|
|
|
1211
1212
|
<div class="nf-panel-body">
|
|
1212
1213
|
<div class="nf-stage" hidden>
|
|
1213
1214
|
<div class="nf-palette">
|
|
1214
|
-
<button class="nf-tool nf-icon-btn" type="button" data-tool="crop" title="Crop" aria-label="Crop">${
|
|
1215
|
-
<button class="nf-reset-crop nf-icon-btn" type="button" title="Reset crop" aria-label="Reset crop" hidden>${
|
|
1216
|
-
<button class="nf-tool nf-icon-btn" type="button" data-tool="arrow" title="Arrow" aria-label="Arrow">${
|
|
1217
|
-
<button class="nf-tool nf-icon-btn" type="button" data-tool="rect" title="Rectangle" aria-label="Rectangle">${
|
|
1218
|
-
<button class="nf-tool nf-icon-btn" type="button" data-tool="circle" title="Circle" aria-label="Circle">${
|
|
1219
|
-
<button class="nf-discard-shot nf-icon-btn" type="button" title="Discard screenshot" aria-label="Discard screenshot">${
|
|
1220
|
-
<button class="nf-recapture nf-icon-btn" type="button" title="Recapture screenshot" aria-label="Recapture screenshot">${
|
|
1215
|
+
<button class="nf-tool nf-icon-btn" type="button" data-tool="crop" title="Crop" aria-label="Crop">${M.crop}</button>
|
|
1216
|
+
<button class="nf-reset-crop nf-icon-btn" type="button" title="Reset crop" aria-label="Reset crop" hidden>${M.resetCrop}</button>
|
|
1217
|
+
<button class="nf-tool nf-icon-btn" type="button" data-tool="arrow" title="Arrow" aria-label="Arrow">${M.arrow}</button>
|
|
1218
|
+
<button class="nf-tool nf-icon-btn" type="button" data-tool="rect" title="Rectangle" aria-label="Rectangle">${M.rect}</button>
|
|
1219
|
+
<button class="nf-tool nf-icon-btn" type="button" data-tool="circle" title="Circle" aria-label="Circle">${M.circle}</button>
|
|
1220
|
+
<button class="nf-discard-shot nf-icon-btn" type="button" title="Discard screenshot" aria-label="Discard screenshot">${M.discard}</button>
|
|
1221
|
+
<button class="nf-recapture nf-icon-btn" type="button" title="Recapture screenshot" aria-label="Recapture screenshot">${M.recapture}</button>
|
|
1221
1222
|
</div>
|
|
1222
1223
|
<div class="nf-canvas"></div>
|
|
1223
1224
|
</div>
|
|
@@ -1227,7 +1228,7 @@ function _t() {
|
|
|
1227
1228
|
<div class="nf-kind"></div>
|
|
1228
1229
|
<div class="nf-privacy-summary">
|
|
1229
1230
|
<span class="nf-privacy-text"></span>
|
|
1230
|
-
<button class="nf-privacy-change nf-icon-btn" type="button" title="Change what is sent" aria-label="Change what is sent" aria-expanded="false">${
|
|
1231
|
+
<button class="nf-privacy-change nf-icon-btn" type="button" title="Change what is sent" aria-label="Change what is sent" aria-expanded="false">${M.privacy}</button>
|
|
1231
1232
|
</div>
|
|
1232
1233
|
</div>
|
|
1233
1234
|
<div class="nf-privacy">
|
|
@@ -1237,15 +1238,18 @@ function _t() {
|
|
|
1237
1238
|
</div>
|
|
1238
1239
|
</div>
|
|
1239
1240
|
<div class="nf-actions">
|
|
1240
|
-
<button class="nf-restore nf-icon-btn" type="button" title="Restore screenshot" aria-label="Restore screenshot" hidden>${
|
|
1241
|
-
<button class="nf-audio nf-icon-btn" type="button" title="Record audio" aria-label="Record audio">${
|
|
1242
|
-
<button class="nf-video nf-icon-btn" type="button" title="Record video" aria-label="Record video">${
|
|
1241
|
+
<button class="nf-restore nf-icon-btn" type="button" title="Restore screenshot" aria-label="Restore screenshot" hidden>${M.resetCrop}</button>
|
|
1242
|
+
<button class="nf-audio nf-icon-btn" type="button" title="Record audio" aria-label="Record audio">${M.audio}</button>
|
|
1243
|
+
<button class="nf-video nf-icon-btn" type="button" title="Record video" aria-label="Record video">${M.video}</button>
|
|
1243
1244
|
<button class="nf-submit" type="button">Submit</button>
|
|
1244
1245
|
</div>
|
|
1245
1246
|
<div class="nf-status"></div>
|
|
1246
1247
|
</div>
|
|
1247
1248
|
<p class="nf-success-msg" hidden aria-live="polite">Submitted!</p>
|
|
1248
|
-
<a class="nf-success-link" hidden target="_blank" rel="noopener noreferrer"
|
|
1249
|
+
<a class="nf-success-link" hidden target="_blank" rel="noopener noreferrer" aria-label="View Report">
|
|
1250
|
+
<span class="nf-success-link-label">View Report</span>
|
|
1251
|
+
${M.openArrow}
|
|
1252
|
+
</a>
|
|
1249
1253
|
</div>
|
|
1250
1254
|
</div>
|
|
1251
1255
|
<button class="nf-stop-video" type="button" hidden>Stop</button>
|
|
@@ -1343,9 +1347,9 @@ function Fr() {
|
|
|
1343
1347
|
return e && t.includes(e) ? e : vt(d.kinds);
|
|
1344
1348
|
}
|
|
1345
1349
|
function it(t) {
|
|
1346
|
-
_ = Tr.has(t) ? t : null,
|
|
1350
|
+
_ = Tr.has(t) ? t : null, T = null, p.querySelectorAll(".nf-tool").forEach((e) => {
|
|
1347
1351
|
e.dataset.active = String(e.dataset.tool === _);
|
|
1348
|
-
}), s.canvas && (s.canvas.dataset.draw = _ ? "true" : "false"), K() &&
|
|
1352
|
+
}), s.canvas && (s.canvas.dataset.draw = _ ? "true" : "false"), K() && R();
|
|
1349
1353
|
}
|
|
1350
1354
|
function ce(t) {
|
|
1351
1355
|
return Math.min(1, Math.max(0, t));
|
|
@@ -1399,29 +1403,29 @@ function Nr(t) {
|
|
|
1399
1403
|
if (t.button !== 0 || !K())
|
|
1400
1404
|
return;
|
|
1401
1405
|
if (!t.target.closest(".nf-sticker") && !Ur(t)) {
|
|
1402
|
-
|
|
1406
|
+
T = null, R();
|
|
1403
1407
|
return;
|
|
1404
1408
|
}
|
|
1405
1409
|
const e = t.target.closest(".nf-handle"), n = t.target.closest(".nf-sticker");
|
|
1406
1410
|
if (n && n.dataset.preview !== "true") {
|
|
1407
|
-
t.preventDefault(), t.stopPropagation(),
|
|
1411
|
+
t.preventDefault(), t.stopPropagation(), T = n.dataset.id, Mt(t), _r({
|
|
1408
1412
|
kind: "sticker",
|
|
1409
|
-
id:
|
|
1413
|
+
id: T,
|
|
1410
1414
|
dir: (e == null ? void 0 : e.dataset.dir) || "move"
|
|
1411
|
-
}, t),
|
|
1415
|
+
}, t), R();
|
|
1412
1416
|
return;
|
|
1413
1417
|
}
|
|
1414
|
-
if (
|
|
1415
|
-
t.preventDefault(), Mt(t), b = { kind: "crop", start: pt(t), current: pt(t) }, Bt(),
|
|
1418
|
+
if (T = null, _ === "crop") {
|
|
1419
|
+
t.preventDefault(), Mt(t), b = { kind: "crop", start: pt(t), current: pt(t) }, Bt(), R();
|
|
1416
1420
|
return;
|
|
1417
1421
|
}
|
|
1418
1422
|
if (_ === "arrow" || _ === "rect" || _ === "circle") {
|
|
1419
1423
|
t.preventDefault(), Mt(t);
|
|
1420
1424
|
const r = Be(t);
|
|
1421
|
-
b = { kind: "sticker", type: _, start: r, current: r }, Bt(),
|
|
1425
|
+
b = { kind: "sticker", type: _, start: r, current: r }, Bt(), R();
|
|
1422
1426
|
return;
|
|
1423
1427
|
}
|
|
1424
|
-
|
|
1428
|
+
R();
|
|
1425
1429
|
}
|
|
1426
1430
|
function _r(t, e) {
|
|
1427
1431
|
e.preventDefault(), e.stopPropagation();
|
|
@@ -1437,7 +1441,7 @@ function _r(t, e) {
|
|
|
1437
1441
|
}
|
|
1438
1442
|
function He(t) {
|
|
1439
1443
|
if (b) {
|
|
1440
|
-
b.current = b.kind === "crop" ? pt(t) : Be(t),
|
|
1444
|
+
b.current = b.kind === "crop" ? pt(t) : Be(t), R();
|
|
1441
1445
|
return;
|
|
1442
1446
|
}
|
|
1443
1447
|
if (!v)
|
|
@@ -1465,7 +1469,7 @@ function He(t) {
|
|
|
1465
1469
|
const i = { x: r.x, y: r.y, w: r.w, h: r.h };
|
|
1466
1470
|
jr(i, v.dir, e, n), m.update(r.id, i);
|
|
1467
1471
|
}
|
|
1468
|
-
|
|
1472
|
+
R();
|
|
1469
1473
|
}
|
|
1470
1474
|
}
|
|
1471
1475
|
function jr(t, e, n, r) {
|
|
@@ -1486,9 +1490,9 @@ function yt(t) {
|
|
|
1486
1490
|
if (v) {
|
|
1487
1491
|
if (v.kind === "sticker") {
|
|
1488
1492
|
const e = s.canvas.getBoundingClientRect();
|
|
1489
|
-
(t.clientX < e.left - 24 || t.clientX > e.right + 24 || t.clientY < e.top - 24 || t.clientY > e.bottom + 24) && (m.remove(v.id),
|
|
1493
|
+
(t.clientX < e.left - 24 || t.clientX > e.right + 24 || t.clientY < e.top - 24 || t.clientY > e.bottom + 24) && (m.remove(v.id), T = null);
|
|
1490
1494
|
}
|
|
1491
|
-
v = null,
|
|
1495
|
+
v = null, R();
|
|
1492
1496
|
}
|
|
1493
1497
|
}
|
|
1494
1498
|
function Vr() {
|
|
@@ -1498,7 +1502,7 @@ function Vr() {
|
|
|
1498
1502
|
if (t.kind === "crop") {
|
|
1499
1503
|
const n = xt(t.start, t.current);
|
|
1500
1504
|
if (Math.abs(t.current.x - t.start.x) < oe || Math.abs(t.current.y - t.start.y) < oe) {
|
|
1501
|
-
|
|
1505
|
+
R();
|
|
1502
1506
|
return;
|
|
1503
1507
|
}
|
|
1504
1508
|
const i = m.crop();
|
|
@@ -1511,7 +1515,7 @@ function Vr() {
|
|
|
1511
1515
|
return;
|
|
1512
1516
|
}
|
|
1513
1517
|
const e = Wr(t);
|
|
1514
|
-
e && (
|
|
1518
|
+
e && (T = e.id), R();
|
|
1515
1519
|
}
|
|
1516
1520
|
function Wr(t) {
|
|
1517
1521
|
if (t.type === "arrow") {
|
|
@@ -1535,7 +1539,7 @@ function Wr(t) {
|
|
|
1535
1539
|
return m.add(t.type, xt(t.start, t.current));
|
|
1536
1540
|
}
|
|
1537
1541
|
function zr() {
|
|
1538
|
-
m.resetCrop(),
|
|
1542
|
+
m.resetCrop(), T = null, Y();
|
|
1539
1543
|
}
|
|
1540
1544
|
function mt() {
|
|
1541
1545
|
s.resetCrop && (s.resetCrop.hidden = !m.isCropped());
|
|
@@ -1570,7 +1574,7 @@ function Fe() {
|
|
|
1570
1574
|
function Ue(t) {
|
|
1571
1575
|
if (!V(t))
|
|
1572
1576
|
throw new Error("Screenshot failed; you can still send text.");
|
|
1573
|
-
D = t, et = t, m = Ut(), F = { w: 0, h: 0 },
|
|
1577
|
+
D = t, et = t, m = Ut(), F = { w: 0, h: 0 }, T = null, b = null, v = null, it(null);
|
|
1574
1578
|
}
|
|
1575
1579
|
async function Xr() {
|
|
1576
1580
|
if (!(Lt || !s.dialog || s.dialog.hidden)) {
|
|
@@ -1635,7 +1639,7 @@ function Y() {
|
|
|
1635
1639
|
const t = s.shot.querySelector("img");
|
|
1636
1640
|
t.draggable = !1, t.addEventListener("dragstart", (n) => n.preventDefault());
|
|
1637
1641
|
const e = () => {
|
|
1638
|
-
Jr(t),
|
|
1642
|
+
Jr(t), R();
|
|
1639
1643
|
};
|
|
1640
1644
|
t.addEventListener("load", e), t.complete && t.naturalWidth && e(), mt();
|
|
1641
1645
|
}
|
|
@@ -1664,7 +1668,7 @@ function Qr(t) {
|
|
|
1664
1668
|
...xt(t.start, t.current)
|
|
1665
1669
|
};
|
|
1666
1670
|
}
|
|
1667
|
-
function
|
|
1671
|
+
function R() {
|
|
1668
1672
|
if ((s.shot || s.canvas).querySelectorAll(".nf-sticker, .nf-crop").forEach((a) => a.remove()), !K() || !s.shot) {
|
|
1669
1673
|
mt();
|
|
1670
1674
|
return;
|
|
@@ -1676,7 +1680,7 @@ function M() {
|
|
|
1676
1680
|
}
|
|
1677
1681
|
const i = m.list().slice();
|
|
1678
1682
|
if ((b == null ? void 0 : b.kind) === "sticker" && i.push(Qr(b)), i.forEach((a) => {
|
|
1679
|
-
const o = a.id === "preview", c = !o && a.id ===
|
|
1683
|
+
const o = a.id === "preview", c = !o && a.id === T, l = document.createElement("div");
|
|
1680
1684
|
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" ? Zr(l, a, e, c, r) : (le(l, a, e), c && ["nw", "ne", "sw", "se"].forEach((u) => Dt(l, u))), !o && a.number) {
|
|
1681
1685
|
const u = document.createElement("span");
|
|
1682
1686
|
u.className = "nf-badge", u.textContent = String(a.number), l.appendChild(u);
|
|
@@ -1689,8 +1693,8 @@ function M() {
|
|
|
1689
1693
|
mt();
|
|
1690
1694
|
}
|
|
1691
1695
|
function Zr(t, e, n, r, i = Nt(400)) {
|
|
1692
|
-
const a = ot(), 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, y = ((e.y2 ?? e.y) - n.y) / n.h * c, g = Math.max(18, i.arrowHead + i.stroke * 2), w = Math.min(l, f) - g, x = Math.min(u, y) - g, C = Math.max(2, Math.abs(f - l)) + g * 2,
|
|
1693
|
-
t.style.left = `${w}px`, t.style.top = `${x}px`, t.style.width = `${C}px`, t.style.height = `${
|
|
1696
|
+
const a = ot(), 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, y = ((e.y2 ?? e.y) - n.y) / n.h * c, g = Math.max(18, i.arrowHead + i.stroke * 2), w = Math.min(l, f) - g, x = Math.min(u, y) - g, C = Math.max(2, Math.abs(f - l)) + g * 2, I = Math.max(2, Math.abs(y - u)) + g * 2, A = l - w, H = u - x, G = f - w, J = y - x, N = Le(A, H, G, J, i), Q = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1697
|
+
t.style.left = `${w}px`, t.style.top = `${x}px`, t.style.width = `${C}px`, t.style.height = `${I}px`, Q.setAttribute("class", "nf-arrow-svg"), Q.setAttribute("viewBox", `0 0 ${C} ${I}`), Q.setAttribute("width", String(C)), Q.setAttribute("height", String(I)), Q.innerHTML = `
|
|
1694
1698
|
<line class="nf-arrow-hit" x1="${A}" y1="${H}" x2="${G}" y2="${J}" />
|
|
1695
1699
|
<line class="nf-arrow-shaft" x1="${A}" y1="${H}" x2="${N.shaftEnd.x}" y2="${N.shaftEnd.y}" />
|
|
1696
1700
|
<polygon class="nf-arrow-head" points="${N.tipX},${N.tipY} ${N.left.x},${N.left.y} ${N.right.x},${N.right.y}" />
|
|
@@ -1705,7 +1709,7 @@ function le(t, e, n) {
|
|
|
1705
1709
|
}
|
|
1706
1710
|
function Ne() {
|
|
1707
1711
|
try {
|
|
1708
|
-
return String(localStorage.getItem(
|
|
1712
|
+
return String(localStorage.getItem($e) || "").trim();
|
|
1709
1713
|
} catch {
|
|
1710
1714
|
return "";
|
|
1711
1715
|
}
|
|
@@ -1714,7 +1718,7 @@ function ti(t) {
|
|
|
1714
1718
|
const e = String(t || "").trim();
|
|
1715
1719
|
if (!(!e || e === Ot))
|
|
1716
1720
|
try {
|
|
1717
|
-
localStorage.setItem(
|
|
1721
|
+
localStorage.setItem($e, e);
|
|
1718
1722
|
} catch {
|
|
1719
1723
|
}
|
|
1720
1724
|
}
|
|
@@ -1770,7 +1774,7 @@ function We() {
|
|
|
1770
1774
|
}
|
|
1771
1775
|
s.author.value = Ne();
|
|
1772
1776
|
}
|
|
1773
|
-
function ze(t, e =
|
|
1777
|
+
function ze(t, e = Re) {
|
|
1774
1778
|
const n = Number(t);
|
|
1775
1779
|
return Number.isFinite(n) ? Math.min(Ir, Math.max(0, Math.floor(n))) : e;
|
|
1776
1780
|
}
|
|
@@ -1791,7 +1795,7 @@ function qe(t = {}) {
|
|
|
1791
1795
|
theme: Ie(t.theme ?? d.theme),
|
|
1792
1796
|
video: t.video == null ? d.video : !!t.video,
|
|
1793
1797
|
consoleLogLimit: t.consoleLogLimit == null ? d.consoleLogLimit : ze(t.consoleLogLimit, d.consoleLogLimit),
|
|
1794
|
-
kinds: e ?
|
|
1798
|
+
kinds: e ? Rr(t.kinds) : d.kinds,
|
|
1795
1799
|
capture: t.capture === void 0 ? d.capture : t.capture,
|
|
1796
1800
|
onBeforeCapture: t.onBeforeCapture === void 0 ? d.onBeforeCapture : t.onBeforeCapture,
|
|
1797
1801
|
displayLink: t.displayLink == null ? d.displayLink : !!t.displayLink
|
|
@@ -1815,11 +1819,11 @@ function ai() {
|
|
|
1815
1819
|
...O,
|
|
1816
1820
|
displayName: O.displayName || t
|
|
1817
1821
|
});
|
|
1818
|
-
U = Er(e),
|
|
1822
|
+
U = Er(e), P = Cr(
|
|
1819
1823
|
Me.snapshot().slice(-ze(d.consoleLogLimit))
|
|
1820
1824
|
);
|
|
1821
1825
|
const n = _e();
|
|
1822
|
-
n.diagnostics && ft(U, !0), n.logs &&
|
|
1826
|
+
n.diagnostics && ft(U, !0), n.logs && P.length && ft(P, !0), q = !1;
|
|
1823
1827
|
}
|
|
1824
1828
|
function gt(t) {
|
|
1825
1829
|
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 && Ge();
|
|
@@ -1829,10 +1833,10 @@ function Xe() {
|
|
|
1829
1833
|
return;
|
|
1830
1834
|
const t = Lr({
|
|
1831
1835
|
diagnostics: U,
|
|
1832
|
-
logs:
|
|
1836
|
+
logs: P
|
|
1833
1837
|
});
|
|
1834
1838
|
s.privacyText.textContent = t, s.privacyText.hidden = !t;
|
|
1835
|
-
const e = U.length === 0 &&
|
|
1839
|
+
const e = U.length === 0 && P.length === 0;
|
|
1836
1840
|
s.privacySummary && (s.privacySummary.hidden = e), s.privacy.hidden = e, s.privacyChange.hidden = !1;
|
|
1837
1841
|
}
|
|
1838
1842
|
function Ye(t, e, n) {
|
|
@@ -1881,7 +1885,7 @@ function Ge() {
|
|
|
1881
1885
|
n.label,
|
|
1882
1886
|
Ar(n.value),
|
|
1883
1887
|
n.redacted
|
|
1884
|
-
)).join(""), e =
|
|
1888
|
+
)).join(""), e = P.map((n) => de(
|
|
1885
1889
|
"log",
|
|
1886
1890
|
n.id,
|
|
1887
1891
|
n.level,
|
|
@@ -1890,7 +1894,7 @@ function Ge() {
|
|
|
1890
1894
|
)).join("");
|
|
1891
1895
|
s.privacyScroll.innerHTML = [
|
|
1892
1896
|
fe("diagnostics", "Diagnostics", U, t),
|
|
1893
|
-
|
|
1897
|
+
P.length ? fe("logs", "Logs", P, e) : ""
|
|
1894
1898
|
].join(""), s.privacyScroll.querySelectorAll('input[data-indeterminate="true"]').forEach((n) => {
|
|
1895
1899
|
n.indeterminate = !0, n.removeAttribute("data-indeterminate");
|
|
1896
1900
|
}), Xe();
|
|
@@ -1906,18 +1910,18 @@ function oi(t) {
|
|
|
1906
1910
|
const c = U.find((l) => l.key === o);
|
|
1907
1911
|
c && (c.redacted = i);
|
|
1908
1912
|
} else if (a === "log") {
|
|
1909
|
-
const c =
|
|
1913
|
+
const c = P.find((l) => l.id === o);
|
|
1910
1914
|
c && (c.redacted = i);
|
|
1911
1915
|
}
|
|
1912
1916
|
} else if (n) {
|
|
1913
1917
|
const a = n.dataset.section;
|
|
1914
|
-
a === "diagnostics" ? (ft(U, i), ue({ diagnostics: i })) : a === "logs" && (ft(
|
|
1918
|
+
a === "diagnostics" ? (ft(U, i), ue({ diagnostics: i })) : a === "logs" && (ft(P, i), ue({ logs: i }));
|
|
1915
1919
|
} else
|
|
1916
1920
|
return;
|
|
1917
1921
|
Ge();
|
|
1918
1922
|
}
|
|
1919
1923
|
async function Je() {
|
|
1920
|
-
_t(), Qe(), at(), s.launcher.hidden = !0, m = Ut(), F = { w: 0, h: 0 }, B = null, D = "", et = "",
|
|
1924
|
+
_t(), Qe(), at(), s.launcher.hidden = !0, m = Ut(), F = { w: 0, h: 0 }, B = null, D = "", et = "", T = null, b = null, v = null, W = Fr(), jt(W), it(null), Wt(!1), s.text.value = "", We(), S(""), ai();
|
|
1921
1925
|
try {
|
|
1922
1926
|
Ue(await Ce(Fe())), S("");
|
|
1923
1927
|
} catch (t) {
|
|
@@ -1934,14 +1938,14 @@ function si(t = "") {
|
|
|
1934
1938
|
return Promise.resolve(!1);
|
|
1935
1939
|
bt = !0, St = c, S("");
|
|
1936
1940
|
const l = typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches, u = n.getBoundingClientRect();
|
|
1937
|
-
if (r.hidden = !0, i.hidden = !1, e.classList.add("nf-success"), e.classList.toggle("nf-success-sticky", c), e.style.opacity = "1", a && (c ? (a.hidden = !1, a.href = o
|
|
1941
|
+
if (r.hidden = !0, i.hidden = !1, e.classList.add("nf-success"), e.classList.toggle("nf-success-sticky", c), e.style.opacity = "1", a && (c ? (a.hidden = !1, a.href = o) : (a.hidden = !0, a.removeAttribute("href"))), c) {
|
|
1938
1942
|
if (l)
|
|
1939
1943
|
return Promise.resolve(!0);
|
|
1940
1944
|
const w = n.getBoundingClientRect(), x = w.width > 0 ? u.width / w.width : 1, C = w.height > 0 ? u.height / w.height : 1;
|
|
1941
|
-
return n.style.transformOrigin = "center center", n.style.transition = "none", n.style.transform = `scale(${x}, ${C})`, n.getBoundingClientRect(), new Promise((
|
|
1945
|
+
return n.style.transformOrigin = "center center", n.style.transition = "none", n.style.transform = `scale(${x}, ${C})`, n.getBoundingClientRect(), new Promise((I) => {
|
|
1942
1946
|
let A = !1;
|
|
1943
1947
|
const H = () => {
|
|
1944
|
-
A || (A = !0, n.removeEventListener("transitionend", G),
|
|
1948
|
+
A || (A = !0, n.removeEventListener("transitionend", G), I(!0));
|
|
1945
1949
|
}, G = (J) => {
|
|
1946
1950
|
J.target !== n || J.propertyName !== "transform" || H();
|
|
1947
1951
|
};
|
|
@@ -1958,19 +1962,19 @@ function si(t = "") {
|
|
|
1958
1962
|
return n.style.transformOrigin = "center center", n.style.transition = "none", n.style.transform = `scale(${y}, ${g})`, n.getBoundingClientRect(), new Promise((w) => {
|
|
1959
1963
|
let x = !1;
|
|
1960
1964
|
const C = () => {
|
|
1961
|
-
x || (x = !0, n.removeEventListener("transitionend",
|
|
1965
|
+
x || (x = !0, n.removeEventListener("transitionend", I), window.setTimeout(() => {
|
|
1962
1966
|
e.style.transition = "opacity 0.28s ease", e.style.opacity = "0", window.setTimeout(() => w(!1), 280);
|
|
1963
1967
|
}, 1e3));
|
|
1964
|
-
},
|
|
1968
|
+
}, I = (A) => {
|
|
1965
1969
|
A.target !== n || A.propertyName !== "transform" || C();
|
|
1966
1970
|
};
|
|
1967
|
-
n.addEventListener("transitionend",
|
|
1971
|
+
n.addEventListener("transitionend", I), requestAnimationFrame(() => {
|
|
1968
1972
|
n.style.transition = "transform 0.48s cubic-bezier(0.22, 1, 0.36, 1)", n.style.transform = "scale(1)";
|
|
1969
1973
|
}), window.setTimeout(C, 700);
|
|
1970
1974
|
});
|
|
1971
1975
|
}
|
|
1972
1976
|
function Qe() {
|
|
1973
|
-
bt = !1, St = !1, s.dialog && (s.dialog.classList.remove("nf-success", "nf-success-sticky"), 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), s.successLink && (s.successLink.hidden = !0, s.successLink.removeAttribute("href")
|
|
1977
|
+
bt = !1, St = !1, s.dialog && (s.dialog.classList.remove("nf-success", "nf-success-sticky"), 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), s.successLink && (s.successLink.hidden = !0, s.successLink.removeAttribute("href")));
|
|
1974
1978
|
}
|
|
1975
1979
|
function ci(t = {}) {
|
|
1976
1980
|
O = { ...O, ...sr(t) }, We();
|
|
@@ -1989,7 +1993,7 @@ async function Ze() {
|
|
|
1989
1993
|
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(Mr({
|
|
1990
1994
|
author: e,
|
|
1991
1995
|
diagnostics: U,
|
|
1992
|
-
logs:
|
|
1996
|
+
logs: P
|
|
1993
1997
|
}))), 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)), K()) {
|
|
1994
1998
|
const o = await Or(D);
|
|
1995
1999
|
if (n.append("screenshot", o, "screenshot.png"), m.list().length || m.isCropped()) {
|