@makefully/notefully 0.1.6 → 0.1.8
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/dist/notefully.css +1 -1
- package/dist/notefully.iife.js +17 -21
- package/dist/notefully.js +771 -722
- package/package.json +1 -1
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-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-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-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-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-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-reset-crop[hidden],#notefully .nf-restore[hidden],#notefully .nf-video[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-stage{display:flex;flex-direction:column;gap:8px}#notefully .nf-palette{display:flex;flex-wrap:wrap;gap:8px;align-items:center}#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}#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:
|
|
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-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-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-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-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-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-reset-crop[hidden],#notefully .nf-restore[hidden],#notefully .nf-video[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-stage{display:flex;flex-direction:column;gap:8px}#notefully .nf-palette{display:flex;flex-wrap:wrap;gap:8px;align-items:center}#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-kind{display:flex;gap:8px}#notefully .nf-kind button{background:var(--nf-input);color:var(--nf-muted);border:1px solid var(--nf-border);border-radius:999px;padding:6px 12px;cursor:pointer}#notefully .nf-kind button[data-active=true]{color:var(--nf-accent-text);background:var(--nf-accent);border-color:var(--nf-accent)}#notefully .nf-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center}#notefully .nf-actions button{border:1px solid var(--nf-border);border-radius:8px;padding:8px 12px;cursor:pointer;font:600 13px ui-sans-serif,system-ui,sans-serif;background:var(--nf-input);color:var(--nf-text)}#notefully .nf-actions .nf-icon-btn{padding:0}#notefully .nf-submit{margin-left:auto;background:var(--nf-btn)!important;color:var(--nf-btn-text)!important;border-color:var(--nf-btn-border)!important}#notefully .nf-submit:disabled{opacity:.55;cursor:wait}#notefully .nf-restore{background:transparent;color:var(--nf-muted);border:0;cursor:pointer;font:13px ui-sans-serif,system-ui,sans-serif;text-decoration:underline}#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,20 +1,20 @@
|
|
|
1
|
-
var Notefully=(function(L){"use strict";function de(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 r=document.implementation.createHTMLDocument(),n=r.createElement("base"),i=r.createElement("a");return r.head.appendChild(n),r.body.appendChild(i),e&&(n.href=e),i.href=t,i.href}const fe=(()=>{let t=0;const e=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(t+=1,`u${e()}${t}`)})();function T(t){const e=[];for(let r=0,n=t.length;r<n;r++)e.push(t[r]);return e}let N=null;function Pt(t={}){return N||(t.includeStyleProperties?(N=t.includeStyleProperties,N):(N=T(window.getComputedStyle(document.documentElement)),N))}function Y(t,e){const n=(t.ownerDocument.defaultView||window).getComputedStyle(t).getPropertyValue(e);return n?parseFloat(n.replace("px","")):0}function he(t){const e=Y(t,"border-left-width"),r=Y(t,"border-right-width");return t.clientWidth+e+r}function me(t){const e=Y(t,"border-top-width"),r=Y(t,"border-bottom-width");return t.clientHeight+e+r}function Tt(t,e={}){const r=e.width||he(t),n=e.height||me(t);return{width:r,height:n}}function pe(){let t,e;try{e=process}catch{}const r=e&&e.env?e.env.devicePixelRatio:null;return r&&(t=parseInt(r,10),Number.isNaN(t)&&(t=1)),t||window.devicePixelRatio||1}const M=16384;function ye(t){(t.width>M||t.height>M)&&(t.width>M&&t.height>M?t.width>t.height?(t.height*=M/t.width,t.width=M):(t.width*=M/t.height,t.height=M):t.width>M?(t.height*=M/t.width,t.width=M):(t.width*=M/t.height,t.height=M))}function G(t){return new Promise((e,r)=>{const n=new Image;n.onload=()=>{n.decode().then(()=>{requestAnimationFrame(()=>e(n))})},n.onerror=r,n.crossOrigin="anonymous",n.decoding="async",n.src=t})}async function ge(t){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(t)).then(encodeURIComponent).then(e=>`data:image/svg+xml;charset=utf-8,${e}`)}async function we(t,e,r){const n="http://www.w3.org/2000/svg",i=document.createElementNS(n,"svg"),a=document.createElementNS(n,"foreignObject");return i.setAttribute("width",`${e}`),i.setAttribute("height",`${r}`),i.setAttribute("viewBox",`0 0 ${e} ${r}`),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),ge(i)}const C=(t,e)=>{if(t instanceof e)return!0;const r=Object.getPrototypeOf(t);return r===null?!1:r.constructor.name===e.name||C(r,e)};function be(t){const e=t.getPropertyValue("content");return`${t.cssText} content: '${e.replace(/'|"/g,"")}';`}function ve(t,e){return Pt(e).map(r=>{const n=t.getPropertyValue(r),i=t.getPropertyPriority(r);return`${r}: ${n}${i?" !important":""};`}).join(" ")}function Se(t,e,r,n){const i=`.${t}:${e}`,a=r.cssText?be(r):ve(r,n);return document.createTextNode(`${i}{${a}}`)}function kt(t,e,r,n){const i=window.getComputedStyle(t,r),a=i.getPropertyValue("content");if(a===""||a==="none")return;const o=fe();try{e.className=`${e.className} ${o}`}catch{return}const s=document.createElement("style");s.appendChild(Se(o,r,i,n)),e.appendChild(s)}function xe(t,e,r){kt(t,e,":before",r),kt(t,e,":after",r)}const At="application/font-woff",It="image/jpeg",Ee={woff:At,woff2:At,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:It,jpeg:It,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function Ce(t){const e=/\.([^./]*?)$/g.exec(t);return e?e[1]:""}function st(t){const e=Ce(t).toLowerCase();return Ee[e]||""}function Me(t){return t.split(/,/)[1]}function ct(t){return t.search(/^(data:)/)!==-1}function $e(t,e){return`data:${e};base64,${t}`}async function Dt(t,e,r){const n=await fetch(t,e);if(n.status===404)throw new Error(`Resource "${n.url}" not found`);const i=await n.blob();return new Promise((a,o)=>{const s=new FileReader;s.onerror=o,s.onloadend=()=>{try{a(r({res:n,result:s.result}))}catch(l){o(l)}},s.readAsDataURL(i)})}const lt={};function Re(t,e,r){let n=t.replace(/\?.*/,"");return r&&(n=t),/ttf|otf|eot|woff2?/i.test(n)&&(n=n.replace(/.*\//,"")),e?`[${e}]${n}`:n}async function ut(t,e,r){const n=Re(t,e,r.includeQueryParams);if(lt[n]!=null)return lt[n];r.cacheBust&&(t+=(/\?/.test(t)?"&":"?")+new Date().getTime());let i;try{const a=await Dt(t,r.fetchRequestInit,({res:o,result:s})=>(e||(e=o.headers.get("Content-Type")||""),Me(s)));i=$e(a,e)}catch(a){i=r.imagePlaceholder||"";let o=`Failed to fetch resource: ${t}`;a&&(o=typeof a=="string"?a:a.message),o&&console.warn(o)}return lt[n]=i,i}async function Le(t){const e=t.toDataURL();return e==="data:,"?t.cloneNode(!1):G(e)}async function Pe(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 s=a.toDataURL();return G(s)}const r=t.poster,n=st(r),i=await ut(r,n,e);return G(i)}async function Te(t,e){var r;try{if(!((r=t==null?void 0:t.contentDocument)===null||r===void 0)&&r.body)return await J(t.contentDocument.body,e,!0)}catch{}return t.cloneNode(!1)}async function ke(t,e){return C(t,HTMLCanvasElement)?Le(t):C(t,HTMLVideoElement)?Pe(t,e):C(t,HTMLIFrameElement)?Te(t,e):t.cloneNode(Ot(t))}const Ae=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SLOT",Ot=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SVG";async function Ie(t,e,r){var n,i;if(Ot(e))return e;let a=[];return Ae(t)&&t.assignedNodes?a=T(t.assignedNodes()):C(t,HTMLIFrameElement)&&(!((n=t.contentDocument)===null||n===void 0)&&n.body)?a=T(t.contentDocument.body.childNodes):a=T(((i=t.shadowRoot)!==null&&i!==void 0?i:t).childNodes),a.length===0||C(t,HTMLVideoElement)||await a.reduce((o,s)=>o.then(()=>J(s,r)).then(l=>{l&&e.appendChild(l)}),Promise.resolve()),e}function De(t,e,r){const n=e.style;if(!n)return;const i=window.getComputedStyle(t);i.cssText?(n.cssText=i.cssText,n.transformOrigin=i.transformOrigin):Pt(r).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`),C(t,HTMLIFrameElement)&&a==="display"&&o==="inline"&&(o="block"),a==="d"&&e.getAttribute("d")&&(o=`path(${e.getAttribute("d")})`),n.setProperty(a,o,i.getPropertyPriority(a))})}function Oe(t,e){C(t,HTMLTextAreaElement)&&(e.innerHTML=t.value),C(t,HTMLInputElement)&&e.setAttribute("value",t.value)}function Fe(t,e){if(C(t,HTMLSelectElement)){const n=Array.from(e.children).find(i=>t.value===i.getAttribute("value"));n&&n.setAttribute("selected","")}}function He(t,e,r){return C(e,Element)&&(De(t,e,r),xe(t,e,r),Oe(t,e),Fe(t,e)),e}async function je(t,e){const r=t.querySelectorAll?t.querySelectorAll("use"):[];if(r.length===0)return t;const n={};for(let a=0;a<r.length;a++){const s=r[a].getAttribute("xlink:href");if(s){const l=t.querySelector(s),v=document.querySelector(s);!l&&v&&!n[s]&&(n[s]=await J(v,e,!0))}}const i=Object.values(n);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 s=document.createElementNS(a,"defs");o.appendChild(s);for(let l=0;l<i.length;l++)s.appendChild(i[l]);t.appendChild(o)}return t}async function J(t,e,r){return!r&&e.filter&&!e.filter(t)?null:Promise.resolve(t).then(n=>ke(n,e)).then(n=>Ie(t,n,e)).then(n=>He(t,n,e)).then(n=>je(n,e))}const Ft=/url\((['"]?)([^'"]+?)\1\)/g,Ue=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,Be=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function Ve(t){const e=t.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`,"g")}function _e(t){const e=[];return t.replace(Ft,(r,n,i)=>(e.push(i),r)),e.filter(r=>!ct(r))}async function Ne(t,e,r,n,i){try{const a=r?de(e,r):e,o=st(e);let s;return i||(s=await ut(a,o,n)),t.replace(Ve(e),`$1${s}$3`)}catch{}return t}function We(t,{preferredFontFormat:e}){return e?t.replace(Be,r=>{for(;;){const[n,,i]=Ue.exec(r)||[];if(!i)return"";if(i===e)return`src: ${n};`}}):t}function Ht(t){return t.search(Ft)!==-1}async function jt(t,e,r){if(!Ht(t))return t;const n=We(t,r);return _e(n).reduce((a,o)=>a.then(s=>Ne(s,o,e,r)),Promise.resolve(n))}async function W(t,e,r){var n;const i=(n=e.style)===null||n===void 0?void 0:n.getPropertyValue(t);if(i){const a=await jt(i,null,r);return e.style.setProperty(t,a,e.style.getPropertyPriority(t)),!0}return!1}async function qe(t,e){await W("background",t,e)||await W("background-image",t,e),await W("mask",t,e)||await W("-webkit-mask",t,e)||await W("mask-image",t,e)||await W("-webkit-mask-image",t,e)}async function ze(t,e){const r=C(t,HTMLImageElement);if(!(r&&!ct(t.src))&&!(C(t,SVGImageElement)&&!ct(t.href.baseVal)))return;const n=r?t.src:t.href.baseVal,i=await ut(n,st(n),e);await new Promise((a,o)=>{t.onload=a,t.onerror=e.onImageErrorHandler?(...l)=>{try{a(e.onImageErrorHandler(...l))}catch(v){o(v)}}:o;const s=t;s.decode&&(s.decode=a),s.loading==="lazy"&&(s.loading="eager"),r?(t.srcset="",t.src=i):t.href.baseVal=i})}async function Ke(t,e){const n=T(t.childNodes).map(i=>Ut(i,e));await Promise.all(n).then(()=>t)}async function Ut(t,e){C(t,Element)&&(await qe(t,e),await ze(t,e),await Ke(t,e))}function Xe(t,e){const{style:r}=t;e.backgroundColor&&(r.backgroundColor=e.backgroundColor),e.width&&(r.width=`${e.width}px`),e.height&&(r.height=`${e.height}px`);const n=e.style;return n!=null&&Object.keys(n).forEach(i=>{r[i]=n[i]}),t}const Bt={};async function Vt(t){let e=Bt[t];if(e!=null)return e;const n=await(await fetch(t)).text();return e={url:t,cssText:n},Bt[t]=e,e}async function _t(t,e){let r=t.cssText;const n=/url\(["']?([^"')]+)["']?\)/g,a=(r.match(/url\([^)]+\)/g)||[]).map(async o=>{let s=o.replace(n,"$1");return s.startsWith("https://")||(s=new URL(s,t.url).href),Dt(s,e.fetchRequestInit,({result:l})=>(r=r.replace(o,`url(${l})`),[o,l]))});return Promise.all(a).then(()=>r)}function Nt(t){if(t==null)return[];const e=[],r=/(\/\*[\s\S]*?\*\/)/gi;let n=t.replace(r,"");const i=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const l=i.exec(n);if(l===null)break;e.push(l[0])}n=n.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]*?)})",s=new RegExp(o,"gi");for(;;){let l=a.exec(n);if(l===null){if(l=s.exec(n),l===null)break;a.lastIndex=s.lastIndex}else s.lastIndex=a.lastIndex;e.push(l[0])}return e}async function Ye(t,e){const r=[],n=[];return t.forEach(i=>{if("cssRules"in i)try{T(i.cssRules||[]).forEach((a,o)=>{if(a.type===CSSRule.IMPORT_RULE){let s=o+1;const l=a.href,v=Vt(l).then(y=>_t(y,e)).then(y=>Nt(y).forEach(m=>{try{i.insertRule(m,m.startsWith("@import")?s+=1:i.cssRules.length)}catch(b){console.error("Error inserting rule from remote css",{rule:m,error:b})}})).catch(y=>{console.error("Error loading remote css",y.toString())});n.push(v)}})}catch(a){const o=t.find(s=>s.href==null)||document.styleSheets[0];i.href!=null&&n.push(Vt(i.href).then(s=>_t(s,e)).then(s=>Nt(s).forEach(l=>{o.insertRule(l,o.cssRules.length)})).catch(s=>{console.error("Error loading remote stylesheet",s)})),console.error("Error inlining remote css file",a)}}),Promise.all(n).then(()=>(t.forEach(i=>{if("cssRules"in i)try{T(i.cssRules||[]).forEach(a=>{r.push(a)})}catch(a){console.error(`Error while reading CSS rules from ${i.href}`,a)}}),r))}function Ge(t){return t.filter(e=>e.type===CSSRule.FONT_FACE_RULE).filter(e=>Ht(e.style.getPropertyValue("src")))}async function Je(t,e){if(t.ownerDocument==null)throw new Error("Provided element is not within a Document");const r=T(t.ownerDocument.styleSheets),n=await Ye(r,e);return Ge(n)}function Wt(t){return t.trim().replace(/["']/g,"")}function Ze(t){const e=new Set;function r(n){(n.style.fontFamily||getComputedStyle(n).fontFamily).split(",").forEach(a=>{e.add(Wt(a))}),Array.from(n.children).forEach(a=>{a instanceof HTMLElement&&r(a)})}return r(t),e}async function Qe(t,e){const r=await Je(t,e),n=Ze(t);return(await Promise.all(r.filter(a=>n.has(Wt(a.style.fontFamily))).map(a=>{const o=a.parentStyleSheet?a.parentStyleSheet.href:null;return jt(a.cssText,o,e)}))).join(`
|
|
2
|
-
`)}async function tn(t,e){const r=e.fontEmbedCSS!=null?e.fontEmbedCSS:e.skipFonts?null:await Qe(t,e);if(r){const n=document.createElement("style"),i=document.createTextNode(r);n.appendChild(i),t.firstChild?t.insertBefore(n,t.firstChild):t.appendChild(n)}}async function en(t,e={}){const{width:r,height:n}=Tt(t,e),i=await J(t,e,!0);return await tn(i,e),await Ut(i,e),Xe(i,e),await we(i,r,n)}async function nn(t,e={}){const{width:r,height:n}=Tt(t,e),i=await en(t,e),a=await G(i),o=document.createElement("canvas"),s=o.getContext("2d"),l=e.pixelRatio||pe(),v=e.canvasWidth||r,y=e.canvasHeight||n;return o.width=v*l,o.height=y*l,e.skipAutoScale||ye(o),o.style.width=`${v}`,o.style.height=`${y}`,e.backgroundColor&&(s.fillStyle=e.backgroundColor,s.fillRect(0,0,o.width,o.height)),s.drawImage(a,0,0,o.width,o.height),o}async function rn(t,e={}){return(await nn(t,e)).toDataURL()}const Z="data-nf-capture-chrome";function an(t){return t instanceof Element&&(t.hasAttribute(Z)||t.hasAttribute("data-nf-mask-cover")||t.id==="notefully")}function on(){const t=[];return document.querySelectorAll('input[type="password"], [data-notefully-mask]').forEach(r=>{const n=r.getBoundingClientRect(),i=document.createElement("div");i.setAttribute("data-nf-mask-cover","1"),i.style.cssText=["position:fixed",`left:${n.left}px`,`top:${n.top}px`,`width:${Math.max(n.width,4)}px`,`height:${Math.max(n.height,4)}px`,"background:#111","z-index:2147483646","pointer-events:none"].join(";"),document.body.appendChild(i),t.push(i)}),()=>t.forEach(r=>r.remove())}function sn(){const t=document.querySelector(`[${Z}]`);if(t)return t;const e=document.createElement("div");return e.setAttribute(Z,"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 cn(){document.querySelectorAll(`[${Z}]`).forEach(t=>t.remove())}async function ln(){const t=document.getElementById("notefully"),e=t?t.style.display:"",r=sn();t&&(t.style.display="none");const n=on();await new Promise(i=>requestAnimationFrame(()=>requestAnimationFrame(i)));try{return await rn(document.body,{cacheBust:!0,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:i=>!an(i)})}finally{n(),r.remove(),cn(),t&&(t.style.display=e)}}function un(t={}){return{url:location.href,title:document.title,userAgent:navigator.userAgent,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 qt=new Set(["userId","email","displayName"]),zt={id:"userId",username:"displayName",name:"displayName"},Kt=new Set(["endpoint","projectKey","version","name","targets","hideLauncher","theme","video"]),Xt={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 dn(t={},e={}){const r=e.warn||Yt,n=t&&typeof t=="object"?t:{},i={},a=[];for(const o of qt)Object.prototype.hasOwnProperty.call(n,o)&&(i[o]=n[o]);for(const[o,s]of Object.entries(zt))Object.prototype.hasOwnProperty.call(n,o)&&(Object.prototype.hasOwnProperty.call(i,s)||(i[s]=n[o]));for(const o of Object.keys(n))qt.has(o)||Object.prototype.hasOwnProperty.call(zt,o)||a.push(o);if(a.length){const o=a.some(s=>s==="name"||s==="slug"||s==="projectSlug")?" Pass the package/report name via Notefully.init({ name }), not identify().":"";r(`Notefully.identify: ignoring unknown key(s): ${a.join(", ")}. Supported: userId, email, displayName (aliases: id → userId; username/name → displayName).`+o)}return i}function fn(t={},e={}){const r=e.warn||Yt,n=t&&typeof t=="object"?t:{},i=Object.keys(n).filter(a=>!Kt.has(a));if(i.length)for(const a of i){if(Xt[a]){r(`Notefully.init: ignoring "${a}". ${Xt[a]}`);continue}r(`Notefully.init: ignoring unknown key "${a}". Supported: ${[...Kt].join(", ")}.`)}}function Yt(t){typeof console<"u"&&typeof console.warn=="function"&&console.warn(t)}const hn=80;function mn(){const t=[],e={};let r=!1;const n=(a,o)=>{let s="";try{s=o.map(l=>l instanceof Error?l.stack||l.message:typeof l=="string"?l:JSON.stringify(l)).join(" ")}catch{s=String(o[0])}t.push({level:a,text:s.slice(0,2e3),at:Date.now()}),t.length>hn&&t.shift()};return{hook:()=>{r||typeof window>"u"||(r=!0,["log","info","warn","error"].forEach(a=>{e[a]=console[a].bind(console),console[a]=(...o)=>{n(a,o),e[a](...o)}}),window.addEventListener("error",a=>{n("error",[a.message||"window.error"])}),window.addEventListener("unhandledrejection",a=>{n("error",[a.reason||"unhandledrejection"])}))},snapshot(){return t.slice()}}}function pn(t){const e=window.SpeechRecognition||window.webkitSpeechRecognition;let r=null,n=!1;const i=()=>{if(n=!1,r)try{r.stop()}catch{}};return{start:()=>{if(!e)throw new Error("Speech recognition is not supported in this browser.");return n?(i(),!1):(r=new e,r.continuous=!0,r.interimResults=!0,r.lang=navigator.language||"en-US",r.onresult=o=>{let s="";for(let l=o.resultIndex;l<o.results.length;l+=1)o.results[l].isFinal&&(s+=o.results[l][0].transcript);s&&t(s)},r.onerror=()=>{n=!1},r.onend=()=>{n=!1},r.start(),n=!0,!0)},stop:i,isSupported:()=>!!e,isActive:()=>n}}const yn=60*1e3;function gn({onStart:t,onStop:e,onError:r}){let n=null,i=null,a=[],o=null;const s=()=>{if(o&&(clearTimeout(o),o=null),i&&i.state!=="inactive")try{i.stop()}catch{}n&&(n.getTracks().forEach(y=>y.stop()),n=null)},l=()=>{if(i&&i.state==="recording"){i.stop();return}s(),e(null)};return{start:async()=>{var y,m;if(!((y=navigator.mediaDevices)!=null&&y.getDisplayMedia))throw new Error("Screen recording is not supported in this browser.");n=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:"browser"},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include"}),a=[],i=new MediaRecorder(n,{mimeType:MediaRecorder.isTypeSupported("video/webm;codecs=vp9")?"video/webm;codecs=vp9":"video/webm"}),i.ondataavailable=b=>{b.data&&b.data.size&&a.push(b.data)},i.onstop=()=>{const b=a.length?new Blob(a,{type:i.mimeType||"video/webm"}):null;s(),e(b)},(m=n.getVideoTracks()[0])==null||m.addEventListener("ended",()=>l()),i.start(),o=setTimeout(l,yn)},stop:l}}function wn(){const t=new Set;return{alloc(){let e=1;for(;t.has(e);)e+=1;return t.add(e),e},free(e){const r=Number(e);Number.isInteger(r)&&r>0&&t.delete(r)},peekUsed(){return[...t].sort((e,r)=>e-r)}}}const dt={x:0,y:0,w:1,h:1};function Gt(){const t=wn();let e=[],r={...dt},n=1;return{list:()=>e.filter(a=>vn(a,r)),all:()=>e.slice(),crop:()=>({...r}),setCrop(a){return r=bn(a),r},resetCrop(){return r={...dt},r},isCropped(){return r.x>1e-6||r.y>1e-6||r.w<.999999||r.h<.999999},add(a,o){const s={id:`s${n++}`,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(s),s},update(a,o){const s=e.find(l=>l.id===a);return s?(Object.assign(s,o),s):null},remove(a){const o=e.findIndex(l=>l.id===a);if(o<0)return null;const[s]=e.splice(o,1);return t.free(s.number),s},reset(){for(e=[],r={...dt},n=1;t.peekUsed().length;)t.free(t.peekUsed()[0])}}}function bn(t){const e=Math.min(Math.max(t.x,0),.95),r=Math.min(Math.max(t.y,0),.95),n=Math.min(Math.max(t.w,.05),1-e),i=Math.min(Math.max(t.h,.05),1-r);return{x:e,y:r,w:n,h:i}}function vn(t,e){const r=t.type==="arrow"?(t.x+(t.x2??t.x))/2:t.x+(t.w||0)/2,n=t.type==="arrow"?(t.y+(t.y2??t.y))/2:t.y+(t.h||0)/2;return r>=e.x&&n>=e.y&&r<=e.x+e.w&&n<=e.y+e.h}function Sn(t,e,r,n={}){const i=n.mark||"#fdd341",a=n.markText||"#2a2140";return new Promise((o,s)=>{const l=new Image;l.onload=()=>{const v=Math.round(e.x*l.width),y=Math.round(e.y*l.height),m=Math.max(1,Math.round(e.w*l.width)),b=Math.max(1,Math.round(e.h*l.height)),O=document.createElement("canvas");O.width=m,O.height=b;const h=O.getContext("2d");h.drawImage(l,v,y,m,b,0,0,m,b),h.lineWidth=Math.max(3,Math.round(m/400)),h.strokeStyle=i,h.fillStyle=i,h.font=`700 ${Math.max(14,Math.round(m/40))}px sans-serif`,r.forEach(p=>{const F=ft(p.x,e,m),H=ht(p.y,e,b),j=p.w/e.w*m,V=p.h/e.h*b;if(p.type==="rect")h.strokeRect(F,H,j,V);else if(p.type==="circle")h.beginPath(),h.ellipse(F+j/2,H+V/2,j/2,V/2,0,0,Math.PI*2),h.stroke();else if(p.type==="arrow"){const Nn=ft(p.x2??p.x+p.w,e,m),Wn=ht(p.y2??p.y,e,b);En(h,F,H,Nn,Wn)}const _=xn(p,e,m,b,F,H,j),U=String(p.number);h.beginPath(),h.arc(_.x,_.y,11,0,Math.PI*2),h.fill(),h.fillStyle=a,h.textAlign="center",h.textBaseline="middle",h.fillText(U,_.x,_.y),h.fillStyle=i}),O.toBlob(p=>{if(!p){s(new Error("Could not encode screenshot"));return}o(p)},"image/png")},l.onerror=()=>s(new Error("Could not load screenshot")),l.src=t})}function ft(t,e,r){return(t-e.x)/e.w*r}function ht(t,e,r){return(t-e.y)/e.h*r}function xn(t,e,r,n,i,a,o){if(t.type==="arrow"){const s=ft(t.x2??t.x+t.w,e,r),l=ht(t.y2??t.y,e,n);return{x:(i+s)/2,y:(a+l)/2}}return{x:i+o/2,y:a}}function En(t,e,r,n,i){const a=Math.atan2(i-r,n-e),o=14,s=2,l=n-Math.cos(a)*s,v=i-Math.sin(a)*s;t.beginPath(),t.moveTo(e,r),t.lineTo(l,v),t.stroke(),t.beginPath(),t.moveTo(n,i),t.lineTo(n-o*Math.cos(a-.4),i-o*Math.sin(a-.4)),t.lineTo(n-o*Math.cos(a+.4),i-o*Math.sin(a+.4)),t.closePath(),t.fill()}const Cn=["bug","idea","other"],Mn=["maker","all-business","brighter-day","quiet-night"],Jt="maker",$n=new Set(["crop","arrow","rect","circle"]),mt=.02,Zt=.05,Rn=`
|
|
1
|
+
var Notefully=(function(P){"use strict";function pe(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 me=(()=>{let t=0;const e=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(t+=1,`u${e()}${t}`)})();function A(t){const e=[];for(let n=0,r=t.length;n<r;n++)e.push(t[n]);return e}let j=null;function kt(t={}){return j||(t.includeStyleProperties?(j=t.includeStyleProperties,j):(j=A(window.getComputedStyle(document.documentElement)),j))}function Y(t,e){const r=(t.ownerDocument.defaultView||window).getComputedStyle(t).getPropertyValue(e);return r?parseFloat(r.replace("px","")):0}function ye(t){const e=Y(t,"border-left-width"),n=Y(t,"border-right-width");return t.clientWidth+e+n}function ge(t){const e=Y(t,"border-top-width"),n=Y(t,"border-bottom-width");return t.clientHeight+e+n}function Tt(t,e={}){const n=e.width||ye(t),r=e.height||ge(t);return{width:n,height:r}}function we(){let t,e;try{e=process}catch{}const n=e&&e.env?e.env.devicePixelRatio:null;return n&&(t=parseInt(n,10),Number.isNaN(t)&&(t=1)),t||window.devicePixelRatio||1}const E=16384;function be(t){(t.width>E||t.height>E)&&(t.width>E&&t.height>E?t.width>t.height?(t.height*=E/t.width,t.width=E):(t.width*=E/t.height,t.height=E):t.width>E?(t.height*=E/t.width,t.width=E):(t.width*=E/t.height,t.height=E))}function G(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 ve(t){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(t)).then(encodeURIComponent).then(e=>`data:image/svg+xml;charset=utf-8,${e}`)}async function Se(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),ve(i)}const x=(t,e)=>{if(t instanceof e)return!0;const n=Object.getPrototypeOf(t);return n===null?!1:n.constructor.name===e.name||x(n,e)};function xe(t){const e=t.getPropertyValue("content");return`${t.cssText} content: '${e.replace(/'|"/g,"")}';`}function Ee(t,e){return kt(e).map(n=>{const r=t.getPropertyValue(n),i=t.getPropertyPriority(n);return`${n}: ${r}${i?" !important":""};`}).join(" ")}function Ce(t,e,n,r){const i=`.${t}:${e}`,a=n.cssText?xe(n):Ee(n,r);return document.createTextNode(`${i}{${a}}`)}function It(t,e,n,r){const i=window.getComputedStyle(t,n),a=i.getPropertyValue("content");if(a===""||a==="none")return;const o=me();try{e.className=`${e.className} ${o}`}catch{return}const s=document.createElement("style");s.appendChild(Ce(o,n,i,r)),e.appendChild(s)}function Me(t,e,n){It(t,e,":before",n),It(t,e,":after",n)}const Ht="application/font-woff",Dt="image/jpeg",$e={woff:Ht,woff2:Ht,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:Dt,jpeg:Dt,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function Re(t){const e=/\.([^./]*?)$/g.exec(t);return e?e[1]:""}function ot(t){const e=Re(t).toLowerCase();return $e[e]||""}function Pe(t){return t.split(/,/)[1]}function st(t){return t.search(/^(data:)/)!==-1}function Le(t,e){return`data:${e};base64,${t}`}async function Ot(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 s=new FileReader;s.onerror=o,s.onloadend=()=>{try{a(n({res:r,result:s.result}))}catch(l){o(l)}},s.readAsDataURL(i)})}const ct={};function Ae(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 lt(t,e,n){const r=Ae(t,e,n.includeQueryParams);if(ct[r]!=null)return ct[r];n.cacheBust&&(t+=(/\?/.test(t)?"&":"?")+new Date().getTime());let i;try{const a=await Ot(t,n.fetchRequestInit,({res:o,result:s})=>(e||(e=o.headers.get("Content-Type")||""),Pe(s)));i=Le(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 ct[r]=i,i}async function ke(t){const e=t.toDataURL();return e==="data:,"?t.cloneNode(!1):G(e)}async function Te(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 s=a.toDataURL();return G(s)}const n=t.poster,r=ot(n),i=await lt(n,r,e);return G(i)}async function Ie(t,e){var n;try{if(!((n=t==null?void 0:t.contentDocument)===null||n===void 0)&&n.body)return await J(t.contentDocument.body,e,!0)}catch{}return t.cloneNode(!1)}async function He(t,e){return x(t,HTMLCanvasElement)?ke(t):x(t,HTMLVideoElement)?Te(t,e):x(t,HTMLIFrameElement)?Ie(t,e):t.cloneNode(Ft(t))}const De=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SLOT",Ft=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SVG";async function Oe(t,e,n){var r,i;if(Ft(e))return e;let a=[];return De(t)&&t.assignedNodes?a=A(t.assignedNodes()):x(t,HTMLIFrameElement)&&(!((r=t.contentDocument)===null||r===void 0)&&r.body)?a=A(t.contentDocument.body.childNodes):a=A(((i=t.shadowRoot)!==null&&i!==void 0?i:t).childNodes),a.length===0||x(t,HTMLVideoElement)||await a.reduce((o,s)=>o.then(()=>J(s,n)).then(l=>{l&&e.appendChild(l)}),Promise.resolve()),e}function Fe(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):kt(n).forEach(a=>{let o=i.getPropertyValue(a);a==="font-size"&&o.endsWith("px")&&(o=`${Math.floor(parseFloat(o.substring(0,o.length-2)))-.1}px`),x(t,HTMLIFrameElement)&&a==="display"&&o==="inline"&&(o="block"),a==="d"&&e.getAttribute("d")&&(o=`path(${e.getAttribute("d")})`),r.setProperty(a,o,i.getPropertyPriority(a))})}function je(t,e){x(t,HTMLTextAreaElement)&&(e.innerHTML=t.value),x(t,HTMLInputElement)&&e.setAttribute("value",t.value)}function Ue(t,e){if(x(t,HTMLSelectElement)){const r=Array.from(e.children).find(i=>t.value===i.getAttribute("value"));r&&r.setAttribute("selected","")}}function Be(t,e,n){return x(e,Element)&&(Fe(t,e,n),Me(t,e,n),je(t,e),Ue(t,e)),e}async function Ve(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 s=n[a].getAttribute("xlink:href");if(s){const l=t.querySelector(s),u=document.querySelector(s);!l&&u&&!r[s]&&(r[s]=await J(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 s=document.createElementNS(a,"defs");o.appendChild(s);for(let l=0;l<i.length;l++)s.appendChild(i[l]);t.appendChild(o)}return t}async function J(t,e,n){return!n&&e.filter&&!e.filter(t)?null:Promise.resolve(t).then(r=>He(r,e)).then(r=>Oe(t,r,e)).then(r=>Be(t,r,e)).then(r=>Ve(r,e))}const jt=/url\((['"]?)([^'"]+?)\1\)/g,_e=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,Ne=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function We(t){const e=t.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`,"g")}function qe(t){const e=[];return t.replace(jt,(n,r,i)=>(e.push(i),n)),e.filter(n=>!st(n))}async function ze(t,e,n,r,i){try{const a=n?pe(e,n):e,o=ot(e);let s;return i||(s=await lt(a,o,r)),t.replace(We(e),`$1${s}$3`)}catch{}return t}function Xe(t,{preferredFontFormat:e}){return e?t.replace(Ne,n=>{for(;;){const[r,,i]=_e.exec(n)||[];if(!i)return"";if(i===e)return`src: ${r};`}}):t}function Ut(t){return t.search(jt)!==-1}async function Bt(t,e,n){if(!Ut(t))return t;const r=Xe(t,n);return qe(r).reduce((a,o)=>a.then(s=>ze(s,o,e,n)),Promise.resolve(r))}async function U(t,e,n){var r;const i=(r=e.style)===null||r===void 0?void 0:r.getPropertyValue(t);if(i){const a=await Bt(i,null,n);return e.style.setProperty(t,a,e.style.getPropertyPriority(t)),!0}return!1}async function Ke(t,e){await U("background",t,e)||await U("background-image",t,e),await U("mask",t,e)||await U("-webkit-mask",t,e)||await U("mask-image",t,e)||await U("-webkit-mask-image",t,e)}async function Ye(t,e){const n=x(t,HTMLImageElement);if(!(n&&!st(t.src))&&!(x(t,SVGImageElement)&&!st(t.href.baseVal)))return;const r=n?t.src:t.href.baseVal,i=await lt(r,ot(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 s=t;s.decode&&(s.decode=a),s.loading==="lazy"&&(s.loading="eager"),n?(t.srcset="",t.src=i):t.href.baseVal=i})}async function Ge(t,e){const r=A(t.childNodes).map(i=>Vt(i,e));await Promise.all(r).then(()=>t)}async function Vt(t,e){x(t,Element)&&(await Ke(t,e),await Ye(t,e),await Ge(t,e))}function Je(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 _t={};async function Nt(t){let e=_t[t];if(e!=null)return e;const r=await(await fetch(t)).text();return e={url:t,cssText:r},_t[t]=e,e}async function Wt(t,e){let n=t.cssText;const r=/url\(["']?([^"')]+)["']?\)/g,a=(n.match(/url\([^)]+\)/g)||[]).map(async o=>{let s=o.replace(r,"$1");return s.startsWith("https://")||(s=new URL(s,t.url).href),Ot(s,e.fetchRequestInit,({result:l})=>(n=n.replace(o,`url(${l})`),[o,l]))});return Promise.all(a).then(()=>n)}function qt(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]*?)})",s=new RegExp(o,"gi");for(;;){let l=a.exec(r);if(l===null){if(l=s.exec(r),l===null)break;a.lastIndex=s.lastIndex}else s.lastIndex=a.lastIndex;e.push(l[0])}return e}async function Qe(t,e){const n=[],r=[];return t.forEach(i=>{if("cssRules"in i)try{A(i.cssRules||[]).forEach((a,o)=>{if(a.type===CSSRule.IMPORT_RULE){let s=o+1;const l=a.href,u=Nt(l).then(d=>Wt(d,e)).then(d=>qt(d).forEach(m=>{try{i.insertRule(m,m.startsWith("@import")?s+=1:i.cssRules.length)}catch(y){console.error("Error inserting rule from remote css",{rule:m,error:y})}})).catch(d=>{console.error("Error loading remote css",d.toString())});r.push(u)}})}catch(a){const o=t.find(s=>s.href==null)||document.styleSheets[0];i.href!=null&&r.push(Nt(i.href).then(s=>Wt(s,e)).then(s=>qt(s).forEach(l=>{o.insertRule(l,o.cssRules.length)})).catch(s=>{console.error("Error loading remote stylesheet",s)})),console.error("Error inlining remote css file",a)}}),Promise.all(r).then(()=>(t.forEach(i=>{if("cssRules"in i)try{A(i.cssRules||[]).forEach(a=>{n.push(a)})}catch(a){console.error(`Error while reading CSS rules from ${i.href}`,a)}}),n))}function Ze(t){return t.filter(e=>e.type===CSSRule.FONT_FACE_RULE).filter(e=>Ut(e.style.getPropertyValue("src")))}async function tn(t,e){if(t.ownerDocument==null)throw new Error("Provided element is not within a Document");const n=A(t.ownerDocument.styleSheets),r=await Qe(n,e);return Ze(r)}function zt(t){return t.trim().replace(/["']/g,"")}function en(t){const e=new Set;function n(r){(r.style.fontFamily||getComputedStyle(r).fontFamily).split(",").forEach(a=>{e.add(zt(a))}),Array.from(r.children).forEach(a=>{a instanceof HTMLElement&&n(a)})}return n(t),e}async function nn(t,e){const n=await tn(t,e),r=en(t);return(await Promise.all(n.filter(a=>r.has(zt(a.style.fontFamily))).map(a=>{const o=a.parentStyleSheet?a.parentStyleSheet.href:null;return Bt(a.cssText,o,e)}))).join(`
|
|
2
|
+
`)}async function rn(t,e){const n=e.fontEmbedCSS!=null?e.fontEmbedCSS:e.skipFonts?null:await nn(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 an(t,e={}){const{width:n,height:r}=Tt(t,e),i=await J(t,e,!0);return await rn(i,e),await Vt(i,e),Je(i,e),await Se(i,n,r)}async function on(t,e={}){const{width:n,height:r}=Tt(t,e),i=await an(t,e),a=await G(i),o=document.createElement("canvas"),s=o.getContext("2d"),l=e.pixelRatio||we(),u=e.canvasWidth||n,d=e.canvasHeight||r;return o.width=u*l,o.height=d*l,e.skipAutoScale||be(o),o.style.width=`${u}`,o.style.height=`${d}`,e.backgroundColor&&(s.fillStyle=e.backgroundColor,s.fillRect(0,0,o.width,o.height)),s.drawImage(a,0,0,o.width,o.height),o}async function sn(t,e={}){return(await on(t,e)).toDataURL()}const Q="data-nf-capture-chrome";function cn(t){return t instanceof Element&&(t.hasAttribute(Q)||t.hasAttribute("data-nf-mask-cover")||t.id==="notefully")}function ln(){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 un(){const t=document.querySelector(`[${Q}]`);if(t)return t;const e=document.createElement("div");return e.setAttribute(Q,"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 dn(){document.querySelectorAll(`[${Q}]`).forEach(t=>t.remove())}async function fn(){const t=document.getElementById("notefully"),e=t?t.style.display:"",n=un();t&&(t.style.display="none");const r=ln();await new Promise(i=>requestAnimationFrame(()=>requestAnimationFrame(i)));try{return await sn(document.body,{cacheBust:!0,pixelRatio:Math.min(window.devicePixelRatio||1,2),filter:i=>!cn(i)})}finally{r(),n.remove(),dn(),t&&(t.style.display=e)}}function hn(t={}){return{url:location.href,title:document.title,userAgent:navigator.userAgent,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 Xt=new Set(["userId","email","displayName"]),Kt={id:"userId",username:"displayName",name:"displayName"},Yt=new Set(["endpoint","projectKey","version","name","targets","hideLauncher","theme","video"]),Gt={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 pn(t={},e={}){const n=e.warn||Jt,r=t&&typeof t=="object"?t:{},i={},a=[];for(const o of Xt)Object.prototype.hasOwnProperty.call(r,o)&&(i[o]=r[o]);for(const[o,s]of Object.entries(Kt))Object.prototype.hasOwnProperty.call(r,o)&&(Object.prototype.hasOwnProperty.call(i,s)||(i[s]=r[o]));for(const o of Object.keys(r))Xt.has(o)||Object.prototype.hasOwnProperty.call(Kt,o)||a.push(o);if(a.length){const o=a.some(s=>s==="name"||s==="slug"||s==="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 mn(t={},e={}){const n=e.warn||Jt,r=t&&typeof t=="object"?t:{},i=Object.keys(r).filter(a=>!Yt.has(a));if(i.length)for(const a of i){if(Gt[a]){n(`Notefully.init: ignoring "${a}". ${Gt[a]}`);continue}n(`Notefully.init: ignoring unknown key "${a}". Supported: ${[...Yt].join(", ")}.`)}}function Jt(t){typeof console<"u"&&typeof console.warn=="function"&&console.warn(t)}const yn=80;function gn(){const t=[],e={};let n=!1;const r=(a,o)=>{let s="";try{s=o.map(l=>l instanceof Error?l.stack||l.message:typeof l=="string"?l:JSON.stringify(l)).join(" ")}catch{s=String(o[0])}t.push({level:a,text:s.slice(0,2e3),at:Date.now()}),t.length>yn&&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 wn(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 s="";for(let l=o.resultIndex;l<o.results.length;l+=1)o.results[l].isFinal&&(s+=o.results[l][0].transcript);s&&t(s)},n.onerror=()=>{r=!1},n.onend=()=>{r=!1},n.start(),r=!0,!0)},stop:i,isSupported:()=>!!e,isActive:()=>r}}const bn=60*1e3;function vn({onStart:t,onStop:e,onError:n}){let r=null,i=null,a=[],o=null;const s=()=>{if(o&&(clearTimeout(o),o=null),i&&i.state!=="inactive")try{i.stop()}catch{}r&&(r.getTracks().forEach(d=>d.stop()),r=null)},l=()=>{if(i&&i.state==="recording"){i.stop();return}s(),e(null)};return{start:async()=>{var d,m;if(!((d=navigator.mediaDevices)!=null&&d.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=y=>{y.data&&y.data.size&&a.push(y.data)},i.onstop=()=>{const y=a.length?new Blob(a,{type:i.mimeType||"video/webm"}):null;s(),e(y)},(m=r.getVideoTracks()[0])==null||m.addEventListener("ended",()=>l()),i.start(),o=setTimeout(l,bn)},stop:l}}function Sn(){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 ut={x:0,y:0,w:1,h:1};function Qt(){const t=Sn();let e=[],n={...ut},r=1;return{list:()=>e.filter(a=>En(a,n)),all:()=>e.slice(),crop:()=>({...n}),setCrop(a){return n=xn(a),n},resetCrop(){return n={...ut},n},isCropped(){return n.x>1e-6||n.y>1e-6||n.w<.999999||n.h<.999999},add(a,o){const s={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(s),s},update(a,o){const s=e.find(l=>l.id===a);return s?(Object.assign(s,o),s):null},remove(a){const o=e.findIndex(l=>l.id===a);if(o<0)return null;const[s]=e.splice(o,1);return t.free(s.number),s},reset(){for(e=[],n={...ut},r=1;t.peekUsed().length;)t.free(t.peekUsed()[0])}}}function xn(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 En(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 dt(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 Cn(t,{stickers:e=[],crop:n={x:0,y:0,w:1,h:1},width:r,height:i,colors:a={}}){const o=a.mark||"#fdd341",s=a.markText||"#2a2140",l=dt(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 d=ft(u.x,n,r),m=ht(u.y,n,i),y=u.w/n.w*r,M=u.h/n.h*i,R=l.stroke/2;if(u.type==="rect")t.strokeRect(d+R,m+R,Math.max(0,y-l.stroke),Math.max(0,M-l.stroke));else if(u.type==="circle")t.beginPath(),t.ellipse(d+y/2,m+M/2,Math.max(.5,y/2-R),Math.max(.5,M/2-R),0,0,Math.PI*2),t.stroke();else if(u.type==="arrow"){const B=ft(u.x2??u.x+u.w,n,r),V=ht(u.y2??u.y,n,i);$n(t,d,m,B,V,l)}if(u.number==null||u.number==="")return;const D=Mn(u,n,r,i,d,m,y),K=String(u.number);t.beginPath(),t.arc(D.x,D.y,l.badgeRadius,0,Math.PI*2),t.fillStyle=o,t.fill(),t.fillStyle=s,t.textAlign="center",t.textBaseline="middle",t.fillText(K,D.x,D.y+.5),t.fillStyle=o}),t.restore()}function ft(t,e,n){return(t-e.x)/e.w*n}function ht(t,e,n){return(t-e.y)/e.h*n}function Mn(t,e,n,r,i,a,o){if(t.type==="arrow"){const s=ft(t.x2??t.x+t.w,e,n),l=ht(t.y2??t.y,e,r);return{x:(i+s)/2,y:(a+l)/2}}return{x:i+o/2,y:a}}function Zt(t,e,n,r,i){const a=Math.atan2(r-e,n-t),o=i.arrowHead,s=Math.min(i.stroke,o*.2),l=n,u=r,d=n-Math.cos(a)*o,m=r-Math.sin(a)*o,y={x:l-o*Math.cos(a-i.arrowHeadAngle),y:u-o*Math.sin(a-i.arrowHeadAngle)},M={x:l-o*Math.cos(a+i.arrowHeadAngle),y:u-o*Math.sin(a+i.arrowHeadAngle)},R={x:n-Math.cos(a)*s,y:r-Math.sin(a)*s};return{angle:a,tipX:l,tipY:u,baseX:d,baseY:m,left:y,right:M,shaftEnd:R}}function $n(t,e,n,r,i,a){const o=Zt(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 Rn(t,e,n,r={}){return new Promise((i,a)=>{const o=new Image;o.onload=()=>{const s=Math.round(e.x*o.width),l=Math.round(e.y*o.height),u=Math.max(1,Math.round(e.w*o.width)),d=Math.max(1,Math.round(e.h*o.height)),m=document.createElement("canvas");m.width=u,m.height=d;const y=m.getContext("2d");y.drawImage(o,s,l,u,d,0,0,u,d),Cn(y,{stickers:n,crop:e,width:u,height:d,colors:r}),m.toBlob(M=>{if(!M){a(new Error("Could not encode screenshot"));return}i(M)},"image/png")},o.onerror=()=>a(new Error("Could not load screenshot")),o.src=t})}const Pn=["bug","idea","other"],Ln=["maker","all-business","brighter-day","quiet-night"],te="maker",An=new Set(["crop","arrow","rect","circle"]),pt=.02,ee=.05,kn=`
|
|
3
3
|
<svg class="nf-launcher-icon" viewBox="0 0 24 24" aria-hidden="true">
|
|
4
4
|
<path fill="currentColor" d="M5.2 2.8h9.1A2.7 2.7 0 0 1 17 5.5v8.2c0 .4-.3.7-.7.7h-.1a.7.7 0 0 1-.7-.7V5.5c0-.7-.6-1.3-1.3-1.3H5.2c-.7 0-1.3.6-1.3 1.3v12.2c0 .7.6 1.3 1.3 1.3h6.4a.7.7 0 0 1 0 1.4H5.2A2.7 2.7 0 0 1 2.5 17.7V5.5A2.7 2.7 0 0 1 5.2 2.8zm1.6 4.2a.7.7 0 0 0 0 1.4h6.2a.7.7 0 0 0 0-1.4H6.8zm0 3.2a.7.7 0 0 0 0 1.4h6.2a.7.7 0 0 0 0-1.4H6.8zm0 3.2a.7.7 0 0 0 0 1.4h3.6a.7.7 0 0 0 0-1.4H6.8z"/>
|
|
5
5
|
<path fill="currentColor" d="M14.7 13.05 20.2 7.55a1.55 1.55 0 0 1 2.2 2.2l-5.5 5.5-.45 1.9a.6.6 0 0 1-.72.45l-1.9-.45.87-1.9z"/>
|
|
6
6
|
</svg>
|
|
7
|
-
`;function k(t){return`<svg class="nf-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${t}</svg>`}const
|
|
8
|
-
<button class="nf-launcher" type="button" title="Leave a note…" aria-label="Leave a note…">${
|
|
7
|
+
`;function k(t){return`<svg class="nf-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${t}</svg>`}const T={crop:k('<path d="M6 3v5H1M18 21v-5h5M8 5h8a2 2 0 0 1 2 2v8M16 19H8a2 2 0 0 1-2-2V8"/>'),resetCrop:k('<path d="M3 12a9 9 0 1 0 3-6.7L3 8"/><path d="M3 3v5h5"/>'),arrow:k('<path d="M5 19 19 5"/><path d="M9 5h10v10"/>'),rect:k('<rect x="4" y="6" width="16" height="12" rx="1.5"/>'),circle:k('<circle cx="12" cy="12" r="8"/>'),discard:k('<path d="M4 7h16"/><path d="M9 7V5h6v2"/><path d="M6 7l1 13h10l1-13"/>'),audio:k('<rect x="9" y="3" width="6" height="11" rx="3"/><path d="M5 11a7 7 0 0 0 14 0"/><path d="M12 18v3"/>'),video:k('<rect x="3" y="7" width="13" height="10" rx="2"/><path d="M16 10.5 21 8v8l-5-2.5z"/>')},ne=gn();ne.hook();let h={endpoint:"",projectKey:"",version:"0.0.0",name:"",targets:null,hideLauncher:!1,theme:te,video:!1},mt={},f=null,c={},p=Qt(),v="",N="",L=null,Z="bug",I=null,$=null,g=null,w=null,tt=null,F=null,W=null,H={w:0,h:0},yt=!1;function S(t){return f.querySelector(t)}function re(t){const e=String(t||"").trim().toLowerCase().replace(/\s+/g,"-");return Ln.includes(e)?e:te}function ae(t,e){return f&&getComputedStyle(f).getPropertyValue(t).trim()||e}function b(t,e=!1){c.status&&(c.status.textContent=t||"",tt&&(clearTimeout(tt),tt=null),t&&!e&&(tt=setTimeout(()=>{c.status.textContent=""},4e3)))}function gt(){return f&&document.body.contains(f)||(f=document.createElement("div"),f.id="notefully",f.innerHTML=`
|
|
8
|
+
<button class="nf-launcher" type="button" title="Leave a note…" aria-label="Leave a note…">${kn}</button>
|
|
9
9
|
<div class="nf-dialog" hidden>
|
|
10
10
|
<div class="nf-panel">
|
|
11
11
|
<div class="nf-stage">
|
|
12
12
|
<div class="nf-palette">
|
|
13
|
-
<button class="nf-tool nf-icon-btn" type="button" data-tool="crop" title="Crop" aria-label="Crop">${
|
|
14
|
-
<button class="nf-reset-crop nf-icon-btn" type="button" title="Reset crop" aria-label="Reset crop" hidden>${
|
|
15
|
-
<button class="nf-tool nf-icon-btn" type="button" data-tool="arrow" title="Arrow" aria-label="Arrow">${
|
|
16
|
-
<button class="nf-tool nf-icon-btn" type="button" data-tool="rect" title="Rectangle" aria-label="Rectangle">${
|
|
17
|
-
<button class="nf-tool nf-icon-btn" type="button" data-tool="circle" title="Circle" aria-label="Circle">${
|
|
13
|
+
<button class="nf-tool nf-icon-btn" type="button" data-tool="crop" title="Crop" aria-label="Crop">${T.crop}</button>
|
|
14
|
+
<button class="nf-reset-crop nf-icon-btn" type="button" title="Reset crop" aria-label="Reset crop" hidden>${T.resetCrop}</button>
|
|
15
|
+
<button class="nf-tool nf-icon-btn" type="button" data-tool="arrow" title="Arrow" aria-label="Arrow">${T.arrow}</button>
|
|
16
|
+
<button class="nf-tool nf-icon-btn" type="button" data-tool="rect" title="Rectangle" aria-label="Rectangle">${T.rect}</button>
|
|
17
|
+
<button class="nf-tool nf-icon-btn" type="button" data-tool="circle" title="Circle" aria-label="Circle">${T.circle}</button>
|
|
18
18
|
</div>
|
|
19
19
|
<div class="nf-canvas"></div>
|
|
20
20
|
</div>
|
|
@@ -25,9 +25,9 @@ var Notefully=(function(L){"use strict";function de(t,e){if(t.match(/^[a-z]+:\/\
|
|
|
25
25
|
<button type="button" data-kind="other">Other</button>
|
|
26
26
|
</div>
|
|
27
27
|
<div class="nf-actions">
|
|
28
|
-
<button class="nf-discard-shot nf-icon-btn" type="button" title="Discard screenshot" aria-label="Discard screenshot">${
|
|
29
|
-
<button class="nf-audio nf-icon-btn" type="button" title="Record audio" aria-label="Record audio">${
|
|
30
|
-
<button class="nf-video nf-icon-btn" type="button" title="Record video" aria-label="Record video">${
|
|
28
|
+
<button class="nf-discard-shot nf-icon-btn" type="button" title="Discard screenshot" aria-label="Discard screenshot">${T.discard}</button>
|
|
29
|
+
<button class="nf-audio nf-icon-btn" type="button" title="Record audio" aria-label="Record audio">${T.audio}</button>
|
|
30
|
+
<button class="nf-video nf-icon-btn" type="button" title="Record video" aria-label="Record video">${T.video}</button>
|
|
31
31
|
<button class="nf-submit" type="button">Submit</button>
|
|
32
32
|
</div>
|
|
33
33
|
<button class="nf-restore" type="button" hidden>Restore screenshot</button>
|
|
@@ -35,12 +35,8 @@ var Notefully=(function(L){"use strict";function de(t,e){if(t.match(/^[a-z]+:\/\
|
|
|
35
35
|
</div>
|
|
36
36
|
</div>
|
|
37
37
|
<button class="nf-stop-video" type="button" hidden>Stop</button>
|
|
38
|
-
`,document.body.appendChild(
|
|
39
|
-
<
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
</defs>
|
|
44
|
-
<line class="nf-arrow-hit" x1="${F}" y1="${H}" x2="${j}" y2="${V}" />
|
|
45
|
-
<line class="nf-arrow-shaft" x1="${F}" y1="${H}" x2="${j}" y2="${V}" marker-end="url(#${_})" />
|
|
46
|
-
`,t.appendChild(U),n&&(Mt(t,"start",{left:F-5,top:H-5}),Mt(t,"end",{left:j-5,top:V-5}))}function Mt(t,e,r){const n=document.createElement("span");n.className="nf-handle",n.dataset.dir=e,r&&(n.style.left=`${r.left}px`,n.style.top=`${r.top}px`),t.appendChild(n)}function oe(t,e,r){t.style.left=`${(e.x-r.x)/r.w*100}%`,t.style.top=`${(e.y-r.y)/r.h*100}%`,t.style.width=`${e.w/r.w*100}%`,t.style.height=`${e.h/r.h*100}%`}function se(t={}){return fn(t),d={...d,endpoint:String(t.endpoint||d.endpoint||"").replace(/\/$/,""),projectKey:t.projectKey==null?d.projectKey:String(t.projectKey),version:t.version==null?d.version:String(t.version),name:t.name==null?d.name:String(t.name||""),targets:t.targets===void 0?d.targets:t.targets,hideLauncher:t.hideLauncher==null?d.hideLauncher:!!t.hideLauncher,theme:te(t.theme??d.theme),video:t.video==null?d.video:!!t.video},gt(),et(),Lt}async function $t(){gt(),et(),c.launcher.hidden=!0,f=Gt(),D={w:0,h:0},P=null,R=null,g=null,w=null,Q="bug",wt("bug"),bt(null),Ct(!1),c.text.value="",S("");try{x=await ln(),q=x,c.stage.hidden=!1,c.restore.hidden=!0,S("")}catch{x="",S("Screenshot failed; you can still send text.")}c.dialog.hidden=!1,K(),c.text.focus()}function X(){u&&(B==null||B.stop(),Ct(!1),ie(),g=null,w=null,vt(!1),c.dialog.hidden=!0,c.stop.hidden=!0,nt())}function ce(t={}){pt={...pt,...dn(t)}}async function Rt(){if(gt(),yt)return null;const t=c.text.value.trim();if(!t&&!x&&!P)return S("Add a note, screenshot, or video first."),null;if(!d.endpoint||!d.projectKey)return S("Notefully is missing endpoint or projectKey."),null;yt=!0,le(!0),S("Submitting…",!0);try{const e=new FormData;if(e.append("message",t),e.append("kind",Q),e.append("version",d.version||"0.0.0"),d.name&&e.append("name",d.name),e.append("context",JSON.stringify({...un(pt),console:Qt.snapshot()})),e.append("annotations",JSON.stringify(f.list())),Array.isArray(d.targets)&&e.append("targets",JSON.stringify(d.targets)),x){const i=await Sn(x,f.crop(),f.list(),{mark:ee("--nf-mark","#fdd341"),markText:ee("--nf-mark-text","#2a2140")});e.append("screenshot",i,"screenshot.png")}P&&e.append("recording",P,"recording.webm");const r=await fetch(`${d.endpoint}/v1/reports`,{method:"POST",headers:{"X-Notefully-Key":d.projectKey},body:e});let n=null;try{n=await r.json()}catch{n=null}if(!r.ok)throw S((n==null?void 0:n.error)||"Submit failed."),new Error((n==null?void 0:n.error)||`Submit failed (${r.status})`);return S("Sent. Thank you."),X(),n}finally{yt=!1,le(!1)}}function le(t){c.submit&&(c.submit.disabled=!!t,c.submit.setAttribute("aria-busy",t?"true":"false"))}function ue(){X(),u==null||u.remove(),u=null,c={}}const Lt={init:se,open:$t,close:X,identify:ce,submit:Rt,destroy:ue};return typeof window<"u"&&(window.Notefully=Lt),L.close=X,L.default=Lt,L.destroy=ue,L.identify=ce,L.init=se,L.open=$t,L.submit=Rt,Object.defineProperties(L,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),L})({});
|
|
38
|
+
`,document.body.appendChild(f),c={launcher:S(".nf-launcher"),dialog:S(".nf-dialog"),stage:S(".nf-stage"),canvas:S(".nf-canvas"),text:S(".nf-text"),restore:S(".nf-restore"),status:S(".nf-status"),audio:S(".nf-audio"),video:S(".nf-video"),discard:S(".nf-discard-shot"),stop:S(".nf-stop-video"),resetCrop:S(".nf-reset-crop"),submit:S(".nf-submit"),shot:null},Tn(),et()),f}function et(){var t;f&&(f.dataset.theme=re(h.theme),h.hideLauncher?f.setAttribute("data-nf-hidden-launcher",""):f.removeAttribute("data-nf-hidden-launcher"),c.video&&(c.video.hidden=!h.video),(t=c.dialog)!=null&&t.hidden&&nt())}function nt(){c.launcher&&(c.launcher.hidden=!!h.hideLauncher)}function Tn(){c.launcher.addEventListener("click",()=>$t()),S(".nf-dialog").addEventListener("click",t=>{t.target===c.dialog&&X()}),f.querySelectorAll(".nf-tool").forEach(t=>{t.addEventListener("click",()=>bt(t.dataset.tool))}),c.resetCrop.addEventListener("click",Un),c.canvas.addEventListener("pointerdown",Hn),c.canvas.addEventListener("dragstart",t=>t.preventDefault()),f.querySelectorAll("[data-kind]").forEach(t=>{t.addEventListener("click",()=>wt(t.dataset.kind))}),c.discard.addEventListener("click",Bn),c.restore.addEventListener("click",Vn),c.audio.addEventListener("click",_n),c.video.addEventListener("click",Nn),c.stop.addEventListener("click",()=>W==null?void 0:W.stop()),S(".nf-submit").addEventListener("click",()=>{Rt().catch(t=>b(t.message||"Submit failed."))}),wt("bug"),bt(null)}function wt(t){Z=Pn.includes(t)?t:"bug",f.querySelectorAll("[data-kind]").forEach(e=>{e.dataset.active=String(e.dataset.kind===Z)})}function bt(t){I=An.has(t)?t:null,$=null,f.querySelectorAll(".nf-tool").forEach(e=>{e.dataset.active=String(e.dataset.tool===I)}),c.canvas&&(c.canvas.dataset.draw=I?"true":"false"),v&&C()}function ie(t){return Math.min(1,Math.max(0,t))}function q(){return c.shot||c.canvas}function rt(t){const e=q().getBoundingClientRect();return{x:ie((t.clientX-e.left)/Math.max(e.width,1)),y:ie((t.clientY-e.top)/Math.max(e.height,1))}}function In(t){const e=q().getBoundingClientRect();return t.clientX>=e.left&&t.clientX<=e.right&&t.clientY>=e.top&&t.clientY<=e.bottom}function oe(t){const e=rt(t),n=p.crop();return{x:n.x+e.x*n.w,y:n.y+e.y*n.h}}function at(t,e){const n=Math.min(t.x,e.x),r=Math.min(t.y,e.y);return{x:n,y:r,w:Math.max(pt,Math.abs(e.x-t.x)),h:Math.max(pt,Math.abs(e.y-t.y))}}function vt(t){f&&(t?f.dataset.grabbing="true":delete f.dataset.grabbing)}function St(t){try{c.canvas.setPointerCapture(t.pointerId)}catch{}}function xt(){window.addEventListener("pointermove",ce),window.addEventListener("pointerup",it),window.addEventListener("pointercancel",it)}function se(){window.removeEventListener("pointermove",ce),window.removeEventListener("pointerup",it),window.removeEventListener("pointercancel",it)}function Hn(t){if(t.button!==0||!v)return;if(!t.target.closest(".nf-sticker")&&!In(t)){$=null,C();return}const e=t.target.closest(".nf-handle"),n=t.target.closest(".nf-sticker");if(n&&n.dataset.preview!=="true"){t.preventDefault(),t.stopPropagation(),$=n.dataset.id,St(t),Dn({kind:"sticker",id:$,dir:(e==null?void 0:e.dataset.dir)||"move"},t),C();return}if($=null,I==="crop"){t.preventDefault(),St(t),g={kind:"crop",start:rt(t),current:rt(t)},xt(),C();return}if(I==="arrow"||I==="rect"||I==="circle"){t.preventDefault(),St(t);const r=oe(t);g={kind:"sticker",type:I,start:r,current:r},xt(),C();return}C()}function Dn(t,e){e.preventDefault(),e.stopPropagation();const n=q().getBoundingClientRect(),r=p.list().find(i=>i.id===t.id);w={...t,startX:e.clientX,startY:e.clientY,crop:p.crop(),sticker:r?{...r}:null,rect:n},vt(t.dir==="move"||t.dir==="start"||t.dir==="end"),xt()}function ce(t){if(g){g.current=g.kind==="crop"?rt(t):oe(t),C();return}if(!w)return;const e=(t.clientX-w.startX)/w.rect.width*w.crop.w,n=(t.clientY-w.startY)/w.rect.height*w.crop.h,r=w.sticker;if(r){if(w.dir==="end")p.update(r.id,{x2:r.x2+e,y2:r.y2+n});else if(w.dir==="start")p.update(r.id,{x:r.x+e,y:r.y+n});else if(w.dir==="move")p.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};On(i,w.dir,e,n),p.update(r.id,i)}C()}}function On(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 it(t){if(se(),vt(!1),g){Fn();return}if(w){if(w.kind==="sticker"){const e=c.canvas.getBoundingClientRect();(t.clientX<e.left-24||t.clientX>e.right+24||t.clientY<e.top-24||t.clientY>e.bottom+24)&&(p.remove(w.id),$=null)}w=null,C()}}function Fn(){const t=g;if(g=null,!t)return;if(t.kind==="crop"){const n=at(t.start,t.current);if(Math.abs(t.current.x-t.start.x)<ee||Math.abs(t.current.y-t.start.y)<ee){C();return}const i=p.crop();p.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}),z();return}const e=jn(t);e&&($=e.id),C()}function jn(t){if(t.type==="arrow"){const e=t.current.x-t.start.x,n=t.current.y-t.start.y;return Math.hypot(e,n)<pt?p.add("arrow",{x:t.start.x,y:t.start.y,x2:t.start.x+.12,y2:t.start.y,w:.12,h:.02}):p.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 p.add(t.type,at(t.start,t.current))}function Un(){p.resetCrop(),$=null,z()}function Et(){c.resetCrop&&(c.resetCrop.hidden=!p.isCropped())}function Ct(t){if(!c.audio)return;const e=t?"Stop audio":"Record audio";c.audio.title=e,c.audio.setAttribute("aria-label",e),c.audio.dataset.active=String(!!t)}function Bn(){v&&(N=v),v="",c.stage.hidden=!0,c.restore.hidden=!N}function Vn(){N&&(v=N,c.stage.hidden=!1,c.restore.hidden=!0,z())}function _n(){try{if(F||(F=wn(e=>{const n=c.text.value.trim();c.text.value=n?`${n} ${e}`:e})),!F.isSupported()){b("Audio-to-text is not supported in this browser.");return}const t=F.start();Ct(t),b(t?"Listening…":"")}catch(t){b(t.message)}}async function Nn(){if(!h.video){b("Video is disabled on this host.");return}c.dialog.hidden=!0,c.stop.hidden=!1,et(),c.launcher.hidden=!0,W=vn({onStart(){},onStop(t){L=t,c.stop.hidden=!0,nt(),c.dialog.hidden=!1,z(),b(t?"Video attached.":"Recording cancelled.")},onError(t){b(t.message)}});try{await W.start()}catch(t){c.stop.hidden=!0,nt(),c.dialog.hidden=!1,b(t.message)}}function z(){if(c.shot=null,!v){c.canvas.style.removeProperty("--nf-shot-aspect"),c.canvas.style.removeProperty("aspect-ratio"),c.canvas.innerHTML=L?`<video class="nf-recording-preview" controls src="${URL.createObjectURL(L)}"></video>`:"",Et();return}c.canvas.innerHTML=`<div class="nf-shot"><img alt="Screenshot" src="${v}" draggable="false"></div>`,c.shot=c.canvas.querySelector(".nf-shot");const t=c.shot.querySelector("img");t.draggable=!1,t.addEventListener("dragstart",n=>n.preventDefault());const e=()=>{Wn(t),C()};t.addEventListener("load",e),t.complete&&t.naturalWidth&&e()}function Wn(t){const e=t.naturalWidth||H.w,n=t.naturalHeight||H.h;if(e&&n&&(H={w:e,h:n},c.canvas.style.setProperty("--nf-shot-aspect",String(e/n)),c.canvas.style.aspectRatio=`${e} / ${n}`),!c.shot||!H.w||!H.h)return;const r=p.crop(),i=H.w/H.h,a=r.w/r.h*i,o=Math.min(1,a/i),s=Math.min(1,i/a);c.shot.style.left=`${(1-o)/2*100}%`,c.shot.style.top=`${(1-s)/2*100}%`,c.shot.style.width=`${o*100}%`,c.shot.style.height=`${s*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 qn(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:"",...at(t.start,t.current)}}function C(){if((c.shot||c.canvas).querySelectorAll(".nf-sticker, .nf-crop").forEach(a=>a.remove()),!v||!c.shot){Et();return}const e=p.crop(),n=q(),r=dt(n.clientWidth||400);if(c.shot.style.setProperty("--nf-anno-stroke",`${r.stroke}px`),c.shot.style.setProperty("--nf-anno-badge",`${r.badgeRadius*2}px`),c.shot.style.setProperty("--nf-anno-badge-font",`${r.fontSize}px`),c.shot.style.setProperty("--nf-anno-handle",`${Math.max(8,r.stroke*2.5)}px`),(g==null?void 0:g.kind)==="crop"){const a=document.createElement("div");a.className="nf-crop",le(a,at(g.start,g.current),{x:0,y:0,w:1,h:1}),c.shot.appendChild(a)}const i=p.list().slice();if((g==null?void 0:g.kind)==="sticker"&&i.push(qn(g)),i.forEach(a=>{const o=a.id==="preview",s=!o&&a.id===$,l=document.createElement("div");if(l.className=`nf-sticker nf-${a.type}`,l.dataset.id=a.id,s&&(l.dataset.selected="true"),o&&(l.dataset.preview="true"),a.type==="arrow"?zn(l,a,e,s,r):(le(l,a,e),s&&["nw","ne","sw","se"].forEach(u=>Mt(l,u))),!o&&a.number){const u=document.createElement("span");u.className="nf-badge",u.textContent=String(a.number),l.appendChild(u)}c.shot.appendChild(l)}),c.canvas.querySelectorAll(":scope > .nf-recording-preview").forEach(a=>a.remove()),L){const a=document.createElement("video");a.className="nf-recording-preview",a.controls=!0,a.src=URL.createObjectURL(L),a.style.position="absolute",a.style.right="8px",a.style.bottom="8px",a.style.width="160px",c.canvas.appendChild(a)}Et()}function zn(t,e,n,r,i=dt(400)){const a=q(),o=a.clientWidth,s=a.clientHeight,l=(e.x-n.x)/n.w*o,u=(e.y-n.y)/n.h*s,d=((e.x2??e.x+e.w)-n.x)/n.w*o,m=((e.y2??e.y)-n.y)/n.h*s,y=Math.max(18,i.arrowHead+i.stroke*2),M=Math.min(l,d)-y,R=Math.min(u,m)-y,D=Math.max(2,Math.abs(d-l))+y*2,K=Math.max(2,Math.abs(m-u))+y*2,B=l-M,V=u-R,Lt=d-M,At=m-R,O=Zt(B,V,Lt,At,i),_=document.createElementNS("http://www.w3.org/2000/svg","svg");t.style.left=`${M}px`,t.style.top=`${R}px`,t.style.width=`${D}px`,t.style.height=`${K}px`,_.setAttribute("class","nf-arrow-svg"),_.setAttribute("viewBox",`0 0 ${D} ${K}`),_.setAttribute("width",String(D)),_.setAttribute("height",String(K)),_.innerHTML=`
|
|
39
|
+
<line class="nf-arrow-hit" x1="${B}" y1="${V}" x2="${Lt}" y2="${At}" />
|
|
40
|
+
<line class="nf-arrow-shaft" x1="${B}" y1="${V}" x2="${O.shaftEnd.x}" y2="${O.shaftEnd.y}" />
|
|
41
|
+
<polygon class="nf-arrow-head" points="${O.tipX},${O.tipY} ${O.left.x},${O.left.y} ${O.right.x},${O.right.y}" />
|
|
42
|
+
`,t.appendChild(_),r&&(Mt(t,"start",{left:B-5,top:V-5}),Mt(t,"end",{left:Lt-5,top:At-5}))}function Mt(t,e,n){const r=document.createElement("span");r.className="nf-handle",r.dataset.dir=e,n&&(r.style.left=`${n.left}px`,r.style.top=`${n.top}px`),t.appendChild(r)}function le(t,e,n){t.style.left=`${(e.x-n.x)/n.w*100}%`,t.style.top=`${(e.y-n.y)/n.h*100}%`,t.style.width=`${e.w/n.w*100}%`,t.style.height=`${e.h/n.h*100}%`}function ue(t={}){return mn(t),h={...h,endpoint:String(t.endpoint||h.endpoint||"").replace(/\/$/,""),projectKey:t.projectKey==null?h.projectKey:String(t.projectKey),version:t.version==null?h.version:String(t.version),name:t.name==null?h.name:String(t.name||""),targets:t.targets===void 0?h.targets:t.targets,hideLauncher:t.hideLauncher==null?h.hideLauncher:!!t.hideLauncher,theme:re(t.theme??h.theme),video:t.video==null?h.video:!!t.video},gt(),et(),Pt}async function $t(){gt(),et(),c.launcher.hidden=!0,p=Qt(),H={w:0,h:0},L=null,$=null,g=null,w=null,Z="bug",wt("bug"),bt(null),Ct(!1),c.text.value="",b("");try{v=await fn(),N=v,c.stage.hidden=!1,c.restore.hidden=!0,b("")}catch{v="",b("Screenshot failed; you can still send text.")}c.dialog.hidden=!1,z(),c.text.focus()}function X(){f&&(F==null||F.stop(),Ct(!1),se(),g=null,w=null,vt(!1),c.dialog.hidden=!0,c.stop.hidden=!0,nt())}function de(t={}){mt={...mt,...pn(t)}}async function Rt(){if(gt(),yt)return null;const t=c.text.value.trim();if(!t&&!v&&!L)return b("Add a note, screenshot, or video first."),null;if(!h.endpoint||!h.projectKey)return b("Notefully is missing endpoint or projectKey."),null;yt=!0,fe(!0),b("Submitting…",!0);try{const e=new FormData;if(e.append("message",t),e.append("kind",Z),e.append("version",h.version||"0.0.0"),h.name&&e.append("name",h.name),e.append("context",JSON.stringify({...hn(mt),console:ne.snapshot()})),e.append("annotations",JSON.stringify(p.list())),Array.isArray(h.targets)&&e.append("targets",JSON.stringify(h.targets)),v){const i=await Rn(v,p.crop(),p.list(),{mark:ae("--nf-mark","#fdd341"),markText:ae("--nf-mark-text","#2a2140")});e.append("screenshot",i,"screenshot.png")}L&&e.append("recording",L,"recording.webm");const n=await fetch(`${h.endpoint}/v1/reports`,{method:"POST",headers:{"X-Notefully-Key":h.projectKey},body:e});let r=null;try{r=await n.json()}catch{r=null}if(!n.ok)throw b((r==null?void 0:r.error)||"Submit failed."),new Error((r==null?void 0:r.error)||`Submit failed (${n.status})`);return b("Sent. Thank you."),X(),r}finally{yt=!1,fe(!1)}}function fe(t){c.submit&&(c.submit.disabled=!!t,c.submit.setAttribute("aria-busy",t?"true":"false"))}function he(){X(),f==null||f.remove(),f=null,c={}}const Pt={init:ue,open:$t,close:X,identify:de,submit:Rt,destroy:he};return typeof window<"u"&&(window.Notefully=Pt),P.close=X,P.default=Pt,P.destroy=he,P.identify=de,P.init=ue,P.open=$t,P.submit=Rt,Object.defineProperties(P,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),P})({});
|