@daybook/feedback 1.4.2 → 1.5.0
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/LICENSE +21 -21
- package/README.md +463 -403
- package/dist/blur.d.ts +36 -0
- package/dist/blur.js +26 -0
- package/dist/context.d.ts +24 -0
- package/dist/context.js +17 -3
- package/dist/feedback.js +58 -12
- package/dist/index.js +21 -3
- package/dist/redact.d.ts +4 -0
- package/dist/redact.js +8 -3
- package/dist/screenshot.d.ts +37 -7
- package/dist/screenshot.js +137 -11
- package/dist/secrets.d.ts +86 -0
- package/dist/secrets.js +237 -0
- package/dist/snapshot.d.ts +14 -2
- package/dist/snapshot.js +193 -38
- package/dist/types.d.ts +14 -4
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/widget.d.ts +100 -2
- package/dist/widget.js +902 -372
- package/package.json +46 -46
package/dist/blur.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the reporter blurred, in the terms the captures need it. PM-T-0682.
|
|
3
|
+
*
|
|
4
|
+
* data-daybook-private is the developer's decision, made in advance and for every report. A blur is
|
|
5
|
+
* the reporter's, made at the moment of reporting and for this one: the colleague's name in the
|
|
6
|
+
* corner, the balance they would rather not send, the part of a dashboard that belongs to a client.
|
|
7
|
+
* Without it the only choice was between a screenshot of everything and no screenshot at all, and
|
|
8
|
+
* the second one is what people chose.
|
|
9
|
+
*
|
|
10
|
+
* It is the reporter's own decision, so it holds whether or not the host turned redaction off.
|
|
11
|
+
* `redact: false` says the developer trusts what is on their screens; it does not overrule somebody
|
|
12
|
+
* who has just pointed at a thing and said "not this".
|
|
13
|
+
*/
|
|
14
|
+
/** A rectangle in viewport pixels. */
|
|
15
|
+
export interface Box {
|
|
16
|
+
left: number;
|
|
17
|
+
top: number;
|
|
18
|
+
width: number;
|
|
19
|
+
height: number;
|
|
20
|
+
}
|
|
21
|
+
/** Where the reporter's blurs are now. */
|
|
22
|
+
export interface Blurred {
|
|
23
|
+
/** Elements they clicked: covered in the screenshot and withheld whole from the snapshot. */
|
|
24
|
+
elements: Element[];
|
|
25
|
+
/**
|
|
26
|
+
* Areas they dragged across, and elements that could no longer be found by the time of capture.
|
|
27
|
+
* Covered in the screenshot; in the snapshot, whatever is drawn inside them is withheld.
|
|
28
|
+
*/
|
|
29
|
+
regions: Box[];
|
|
30
|
+
}
|
|
31
|
+
/** The snapshot's marker for a subtree the reporter blurred, beside data-daybook-private. */
|
|
32
|
+
export declare const BLURRED_ATTRIBUTE = "data-daybook-blurred";
|
|
33
|
+
/** Whether two boxes share any area at all. Touching edges do not count. */
|
|
34
|
+
export declare function overlaps(a: Box, b: Box): boolean;
|
|
35
|
+
/** Whether `inner` lies inside `outer`, give or take the pixel a fractional layout rounds to. */
|
|
36
|
+
export declare function inside(inner: Box, outer: Box): boolean;
|
package/dist/blur.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the reporter blurred, in the terms the captures need it. PM-T-0682.
|
|
3
|
+
*
|
|
4
|
+
* data-daybook-private is the developer's decision, made in advance and for every report. A blur is
|
|
5
|
+
* the reporter's, made at the moment of reporting and for this one: the colleague's name in the
|
|
6
|
+
* corner, the balance they would rather not send, the part of a dashboard that belongs to a client.
|
|
7
|
+
* Without it the only choice was between a screenshot of everything and no screenshot at all, and
|
|
8
|
+
* the second one is what people chose.
|
|
9
|
+
*
|
|
10
|
+
* It is the reporter's own decision, so it holds whether or not the host turned redaction off.
|
|
11
|
+
* `redact: false` says the developer trusts what is on their screens; it does not overrule somebody
|
|
12
|
+
* who has just pointed at a thing and said "not this".
|
|
13
|
+
*/
|
|
14
|
+
/** The snapshot's marker for a subtree the reporter blurred, beside data-daybook-private. */
|
|
15
|
+
export const BLURRED_ATTRIBUTE = 'data-daybook-blurred';
|
|
16
|
+
/** Whether two boxes share any area at all. Touching edges do not count. */
|
|
17
|
+
export function overlaps(a, b) {
|
|
18
|
+
return a.left < b.left + b.width && b.left < a.left + a.width
|
|
19
|
+
&& a.top < b.top + b.height && b.top < a.top + a.height;
|
|
20
|
+
}
|
|
21
|
+
/** Whether `inner` lies inside `outer`, give or take the pixel a fractional layout rounds to. */
|
|
22
|
+
export function inside(inner, outer) {
|
|
23
|
+
return inner.left >= outer.left - 1 && inner.top >= outer.top - 1
|
|
24
|
+
&& inner.left + inner.width <= outer.left + outer.width + 1
|
|
25
|
+
&& inner.top + inner.height <= outer.top + outer.height + 1;
|
|
26
|
+
}
|
package/dist/context.d.ts
CHANGED
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
import type { Anchor, Breadcrumb } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* What was taken out of a report before it was sent, as counts and never as content. PM-T-0682.
|
|
4
|
+
*
|
|
5
|
+
* Sent as `context.redaction`, in the one part of the wire contract that is open by design, so it
|
|
6
|
+
* needs no server change and a reader that does not know it ignores it. A triager who meets a grey
|
|
7
|
+
* bar in the screenshot or `[masked: GitHub token]` in the snapshot should know it was put there on
|
|
8
|
+
* purpose — and an assistant reading the report should not go looking for the missing key.
|
|
9
|
+
*/
|
|
10
|
+
export interface Withheld {
|
|
11
|
+
/** How many things the reporter blurred. */
|
|
12
|
+
blurredByReporter: number;
|
|
13
|
+
/** How many credentials each capture found and masked. Only the captures that were taken. */
|
|
14
|
+
secretsMasked: {
|
|
15
|
+
screenshot?: number;
|
|
16
|
+
snapshot?: number;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
2
19
|
/**
|
|
3
20
|
* The metadata a triager needs and a reporter should never be asked for.
|
|
4
21
|
*
|
|
@@ -15,4 +32,11 @@ export declare function captureContext(options: {
|
|
|
15
32
|
build?: string;
|
|
16
33
|
environment?: string;
|
|
17
34
|
};
|
|
35
|
+
/**
|
|
36
|
+
* Whether credentials are masked in the page text this carries — the title, the route, and each
|
|
37
|
+
* pin's text and page. A pin's text is eighty characters of whatever the reporter pointed at, and
|
|
38
|
+
* the thing they point at is sometimes the key they are complaining about.
|
|
39
|
+
*/
|
|
40
|
+
redact?: boolean;
|
|
41
|
+
withheld?: Withheld;
|
|
18
42
|
}): Record<string, unknown>;
|
package/dist/context.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { redactUrl } from './redact.js';
|
|
2
|
+
import { maskSecrets } from './secrets.js';
|
|
2
3
|
import { SDK_NAME, SDK_VERSION } from './version.js';
|
|
3
4
|
/**
|
|
4
5
|
* The metadata a triager needs and a reporter should never be asked for.
|
|
@@ -9,12 +10,13 @@ import { SDK_NAME, SDK_VERSION } from './version.js';
|
|
|
9
10
|
* on. All of it is available for free at the moment of capture.
|
|
10
11
|
*/
|
|
11
12
|
export function captureContext(options) {
|
|
13
|
+
const mask = (text) => (options.redact ? maskSecrets(text).text : text);
|
|
12
14
|
const context = {
|
|
13
15
|
platform: 'web',
|
|
14
16
|
// Pathname only. The predecessor stored it this way so a report survives moving between staging
|
|
15
17
|
// and production, and that reasoning still holds.
|
|
16
|
-
route: location.pathname,
|
|
17
|
-
title: document.title.slice(0, 200),
|
|
18
|
+
route: mask(location.pathname),
|
|
19
|
+
title: mask(document.title.slice(0, 200)),
|
|
18
20
|
locale: navigator.language,
|
|
19
21
|
timezone: timezone(),
|
|
20
22
|
viewport: {
|
|
@@ -37,7 +39,13 @@ export function captureContext(options) {
|
|
|
37
39
|
* reading one pin keeps reading one pin (PM-R-0004 #11: the wire only ever grows). `anchors` is
|
|
38
40
|
* all of them, in the order they were numbered, and is only sent when there is a list to send.
|
|
39
41
|
*/
|
|
40
|
-
const anchors = options.anchors ?? []
|
|
42
|
+
const anchors = (options.anchors ?? []).map(anchor => (options.redact
|
|
43
|
+
? {
|
|
44
|
+
...anchor,
|
|
45
|
+
elementText: anchor.elementText === null ? null : mask(anchor.elementText),
|
|
46
|
+
...(anchor.page === undefined ? {} : { page: mask(anchor.page) }),
|
|
47
|
+
}
|
|
48
|
+
: anchor));
|
|
41
49
|
if (anchors[0])
|
|
42
50
|
context.anchor = anchors[0];
|
|
43
51
|
if (anchors.length > 1)
|
|
@@ -45,6 +53,12 @@ export function captureContext(options) {
|
|
|
45
53
|
if (options.breadcrumbs && options.breadcrumbs.length > 0) {
|
|
46
54
|
context.breadcrumbs = options.breadcrumbs;
|
|
47
55
|
}
|
|
56
|
+
// Only when something was withheld: a report with nothing taken out says so by not saying anything.
|
|
57
|
+
const withheld = options.withheld;
|
|
58
|
+
if (withheld && (withheld.blurredByReporter > 0
|
|
59
|
+
|| Object.values(withheld.secretsMasked).some(count => (count ?? 0) > 0))) {
|
|
60
|
+
context.redaction = withheld;
|
|
61
|
+
}
|
|
48
62
|
return context;
|
|
49
63
|
}
|
|
50
64
|
/**
|
package/dist/feedback.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
"use strict";var DaybookFeedback=(()=>{var D=Object.defineProperty;var Ue=Object.getOwnPropertyDescriptor;var ze=Object.getOwnPropertyNames;var De=Object.prototype.hasOwnProperty;var Ke=(n,e)=>{for(var t in e)D(n,t,{get:e[t],enumerable:!0})},Xe=(n,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of ze(e))!De.call(n,r)&&r!==t&&D(n,r,{get:()=>e[r],enumerable:!(o=Ue(e,r))||o.enumerable});return n};var Ve=n=>Xe(D({},"__esModule",{value:!0}),n);var $t={};Ke($t,{DEFAULT_API_URL:()=>qe,DaybookFeedback:()=>j,SDK_VERSION:()=>S,captureAnchor:()=>I,init:()=>_t,previewLauncher:()=>Be,resolveAnchor:()=>Se});var S="1.4.2";function L(n){var e;try{let t=new URL(n,location.href);return t.origin===location.origin?t.pathname:`${t.origin}${t.pathname}`}catch{return(e=n.split("?")[0])!=null?e:n}}var We=/pass|secret|token|auth|cvv|card|ssn|pin|otp|key/i;function ce(n,e){return n.length===0?"":e&&We.test(e)?"[redacted]":`[${n.length} chars]`}function K(n){var o,r,i,s,a,c;let e=n.tagName.toLowerCase();if(!n.getAttribute("aria-label")&&!n.getAttribute("data-testid")&&!((o=n.textContent)!=null?o:"").trim()){let l=n.closest("button, a, [role=button], [data-testid], label");if(l&&l!==n)return K(l)}if(n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement||n instanceof HTMLSelectElement){let l=(i=(r=n.getAttribute("name"))!=null?r:n.id)!=null?i:"",p=n instanceof HTMLInputElement?n.type:e;return`${e}[${p}]${l?` name=${l}`:""}`}let t=(c=(s=n.getAttribute("aria-label"))!=null?s:n.getAttribute("data-testid"))!=null?c:((a=n.textContent)!=null?a:"").replace(/\s+/g," ").trim().slice(0,40);return t?`${e} "${t}"`:e}function le(n){return n.replace(/[\w.+-]+@[\w-]+\.[\w.]+/g,"[email]").replace(/\b[A-Za-z0-9_-]{20,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\b/g,"[jwt]").replace(/\bBearer\s+[\w.-]+/gi,"Bearer [redacted]").replace(/\b\d{12,19}\b/g,"[number]").slice(0,500)}var $="data-daybook-private";var C=class{constructor(e=40,t=!0){this.limit=e;this.redact=t;this.entries=[];this.detach=[]}list(){return[...this.entries]}add(e,t){for(this.entries.push({at:new Date().toISOString(),type:e,message:this.redact?le(t):t.slice(0,500)});this.entries.length>this.limit;)this.entries.shift()}start(){let e=a=>{let c=a.target;c instanceof Element&&(c.closest("[data-daybook-feedback]")||this.add("click",K(c)))};document.addEventListener("click",e,{capture:!0,passive:!0}),this.detach.push(()=>document.removeEventListener("click",e,{capture:!0}));let t=history.pushState,o=history.replaceState,r=()=>this.add("nav",L(location.href));history.pushState=(...a)=>{t.apply(history,a),r()},history.replaceState=(...a)=>{o.apply(history,a),r()},window.addEventListener("popstate",r),this.detach.push(()=>{history.pushState=t,history.replaceState=o,window.removeEventListener("popstate",r)});for(let a of["error","warn"]){let c=console[a];console[a]=(...l)=>{this.add("console",`${a}: ${l.map(X).join(" ")}`),c.apply(console,l)},this.detach.push(()=>{console[a]=c})}let i=a=>this.add("console",`uncaught: ${a.message}`),s=a=>this.add("console",`unhandled rejection: ${X(a.reason)}`);window.addEventListener("error",i),window.addEventListener("unhandledrejection",s),this.detach.push(()=>{window.removeEventListener("error",i),window.removeEventListener("unhandledrejection",s)}),this.watchFetch()}stop(){for(let e of this.detach.splice(0))e()}watchFetch(){if(typeof window.fetch!="function")return;let e=window.fetch;window.fetch=async(...t)=>{let o=performance.now();try{let r=await e.apply(window,t),i=Math.round(performance.now()-o);return(!r.ok||i>3e3)&&this.add("network",`${r.status} ${L(de(t[0]))} ${i}ms`),r}catch(r){throw this.add("network",`failed ${L(de(t[0]))}: ${X(r)}`),r}},this.detach.push(()=>{window.fetch=e})}};function de(n){return typeof n=="string"?n:n instanceof URL?n.href:n.url}function X(n){var e,t;if(typeof n=="string")return n;if(n instanceof Error)return`${n.name}: ${n.message}`;try{return(t=(e=JSON.stringify(n))==null?void 0:e.slice(0,200))!=null?t:String(n)}catch{return String(n)}}var W="pm.feedback.queue";var H=class{constructor(e,t){this.apiUrl=e;this.ingestKey=t;this.session=null;this.identityToken=null}setSession(e){this.session=e}async send(e,t=[],o){var c,l,p;let r={idempotencyKey:(c=e.idempotencyKey)!=null?c:pe(),...e,attachments:[...(l=e.attachments)!=null?l:[],...t.map(h=>({filename:h.filename,contentType:h.contentType,size:h.blob.size}))]},i=await this.post("/ingest/v1",r);if(!i.ok)throw await R(i);let s=await i.json(),a=((p=e.attachments)!=null?p:[]).length;return await Promise.all(t.map(async(h,d)=>{let f=Ye(s,a+d);if(!f){o==null||o(h,new Error("The server would not accept that file."));return}try{await this.upload(f,h)}catch(w){o==null||o(h,w)}})),s}async flush(){let e=ue();if(e.length!==0){me([]);for(let t of e)try{let o=await this.post("/ingest/v1",t);!o.ok&&(o.status===429||o.status>=500)&&V(t)}catch{V(t)}}}queue(e){var t;V({...e,idempotencyKey:(t=e.idempotencyKey)!=null?t:pe(),attachments:void 0})}async signIn(){let e=he(64),t=await Je(e),o=he(16),r=`${this.base()}/ingest/v1/authorize?key=${encodeURIComponent(this.ingestKey)}&origin=${encodeURIComponent(location.origin)}&code_challenge=${encodeURIComponent(t)}&state=${encodeURIComponent(o)}`,i=window.open(r,"daybook-feedback","width=460,height=640");if(!i)throw Object.assign(new Error("Popup blocked"),{code:"popup_blocked"});let s=await new Promise((l,p)=>{let h=setInterval(()=>{i.closed&&(f(),p(Object.assign(new Error("Sign-in cancelled"),{code:"cancelled"})))},400),d=w=>{if(w.origin!==new URL(this.base()).origin)return;let y=w.data;if((y==null?void 0:y.source)==="daybook-feedback"&&y.state===o){if(f(),y.error||!y.code){p(Object.assign(new Error("Sign-in was refused"),{code:y.error||"refused"}));return}l(y.code)}},f=()=>{clearInterval(h),window.removeEventListener("message",d)};window.addEventListener("message",d)}),a=await this.post("/ingest/v1/token",{code:s,codeVerifier:e});if(!a.ok)throw await R(a);let{identityToken:c}=await a.json();return this.identityToken=c,c}base(){return this.apiUrl.replace(/\/$/,"")}resolve(e){try{let t=new URL(this.base()),o=new URL(e,t);return o.hostname===t.hostname?new URL(o.pathname+o.search,t).toString():o.toString()}catch{return e}}async handshake(e){var r,i;let t=await this.post("/ingest/v1/session",{...e,identityToken:(r=this.identityToken)!=null?r:void 0});if(!t.ok)throw await R(t);let o=await t.json();return this.session=(i=o.sessionToken)!=null?i:null,o}post(e,t){let o={"Content-Type":"application/json","X-Ingest-Key":this.ingestKey};return this.session&&(o["X-Feedback-Session"]=this.session),fetch(`${this.base()}${e}`,{method:"POST",headers:o,body:JSON.stringify(t),credentials:"omit"})}async upload(e,t){let o=await fetch(this.resolve(e.uploadUrl),{method:e.method,headers:{"Content-Type":e.contentType,"X-Ingest-Key":this.ingestKey},body:t.blob,credentials:"omit"});if(!o.ok)throw await R(o);await this.post(`/ingest/v1/attachments/${e.id}/confirm`,{})}};function Ye(n,e){let t=n.attachments.find(o=>o.index===e);return t!=null?t:n.attachments.some(o=>typeof o.index=="number")?void 0:n.attachments[e]}function V(n){let e=ue();e.push(n),me(e.slice(-20))}function ue(){try{let n=localStorage.getItem(W);return n?JSON.parse(n):[]}catch{return[]}}function me(n){try{n.length===0?localStorage.removeItem(W):localStorage.setItem(W,JSON.stringify(n))}catch{}}async function R(n){let e=`http_${n.status}`;try{let t=await n.json();if(t.code&&(e=t.code),t.message)return Object.assign(new Error(t.message),{code:e})}catch{}return Object.assign(new Error(`Ingest failed (${n.status})`),{code:e})}function pe(){return typeof crypto!="undefined"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function he(n){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",t=new Uint8Array(n);return crypto.getRandomValues(t),Array.from(t,o=>e[o%e.length]).join("")}async function Je(n){let e=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(n));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function J(n){var o,r;let e={platform:"web",route:location.pathname,title:document.title.slice(0,200),locale:navigator.language,timezone:Ge(),viewport:{width:window.innerWidth,height:window.innerHeight,dpr:(o=window.devicePixelRatio)!=null?o:1},device:Qe(),sdk:{name:"js",version:S}};document.referrer&&(e.referrer=L(document.referrer)),n.app&&(e.app=n.app);let t=(r=n.anchors)!=null?r:[];return t[0]&&(e.anchor=t[0]),t.length>1&&(e.anchors=t),n.breadcrumbs&&n.breadcrumbs.length>0&&(e.breadcrumbs=n.breadcrumbs),e}function Qe(){var r;let n=navigator.userAgent,e=/Edg\//.test(n)?"Edge":/OPR\//.test(n)?"Opera":/Firefox\//.test(n)?"Firefox":/Chrome\//.test(n)?"Chrome":/Safari\//.test(n)?"Safari":"Unknown",t=/Windows NT/.test(n)?"Windows":/iPhone|iPad|iPod/.test(n)?"iOS":/Mac OS X/.test(n)?"macOS":/Android/.test(n)?"Android":/Linux/.test(n)?"Linux":"Unknown",o=(r=n.match(/(?:Edg|OPR|Firefox|Chrome|Version)\/(\d+)/))==null?void 0:r[1];return{browser:o?`${e} ${o}`:e,os:t,touch:navigator.maxTouchPoints>0,userAgent:n.slice(0,300)}}function Ge(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return`UTC${-new Date().getTimezoneOffset()/60}`}}async function be(n,e=()=>()=>{}){var i;if(typeof((i=navigator.mediaDevices)==null?void 0:i.getDisplayMedia)!="function")return null;let t=n?nt():()=>{},o=e(),r=null;try{return r=await navigator.mediaDevices.getDisplayMedia({video:!0,audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude",monitorTypeSurfaces:"exclude"}),r.getVideoTracks()[0]?(await new Promise(a=>setTimeout(a,250)),await et(r)):null}catch{return null}finally{r==null||r.getTracks().forEach(s=>s.stop()),o(),t()}}var fe=1920,Ze=.82;async function et(n){let e=document.createElement("video");e.srcObject=n,e.muted=!0,await e.play().catch(()=>{});let t=e.videoWidth||window.innerWidth,o=e.videoHeight||window.innerHeight,r=t>fe?fe/t:1,i=document.createElement("canvas");i.width=Math.round(t*r),i.height=Math.round(o*r);let s=i.getContext("2d");if(!s)return null;s.imageSmoothingQuality="high",s.drawImage(e,0,0,i.width,i.height),e.pause(),e.srcObject=null;let a=await tt(i);if(!a)return null;let c=a.type||"image/png";return{blob:a,filename:`screenshot.${c==="image/webp"?"webp":c==="image/jpeg"?"jpg":"png"}`,contentType:c}}async function tt(n){for(let e of["image/webp","image/jpeg"]){let t=await ge(n,e,Ze);if((t==null?void 0:t.type)===e)return t}return ge(n,"image/png")}function ge(n,e,t){return new Promise(o=>n.toBlob(r=>o(r),e,t))}function nt(){let n=[...document.querySelectorAll(`[${$}]`),...document.querySelectorAll('input[type="password"]')],e=n.map(t=>t.style.filter);return n.forEach(t=>{t.style.filter="blur(12px)"}),()=>{n.forEach((t,o)=>{var r;t.style.filter=(r=e[o])!=null?r:""})}}var G=4e5,ye=300,we=600,ve=8e3,ot=new Set(["SCRIPT","NOSCRIPT","TEMPLATE"]),rt=["display","position","z-index","opacity","visibility","overflow","width","height","margin","padding","box-sizing","color","background-color","border","border-radius","box-shadow","font-family","font-size","font-weight","line-height","text-align","white-space","flex-direction","justify-content","align-items","gap","grid-template-columns","transform","transition","pointer-events","cursor"],it="The page at the moment this was reported. Field values are described rather than reproduced when redacted is true, and data-daybook-private subtrees are withheld. html is last because only the head of this file is inlined beside the report \u2014 download the attachment for the rest of it.";function Z(n){let e=[],t=n;for(let o=0;t&&o<4&&t.nodeType===1;o+=1){let r=t.localName;if(t.id){e.unshift(`${r}#${t.id}`);break}let i=Array.from(t.classList).slice(0,3).join(".");i&&(r+=`.${i}`),e.unshift(r),t=t.parentElement}return e.join(" > ")}var st=(n,e)=>e.length>ye?`${e.slice(0,ye)}\u2026[${e.length}]`:e,Q=n=>n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""");function at(n,e){let t=n;if(n.localName==="input"&&(t.type==="checkbox"||t.type==="radio"))return t.checked?"checked":"unchecked";let o=t.value;return typeof o!="string"||o===""?null:e?ce(o,t.name||t.id||t.type):o}function ke(n,e,t,o){var p,h;if(t.used>G)return!1;if(n.nodeType===3){let d=((p=n.textContent)!=null?p:"").replace(/\s+/g," ");if(!d.trim())return!0;let f=d.length>we?`${d.slice(0,we)}\u2026`:d;return e.push(Q(f)),t.used+=f.length,!0}if(n.nodeType!==1)return!0;let r=n,i=r.tagName;if(r.hasAttribute("data-daybook-feedback")||ot.has(i))return!0;let s=r.localName;if(o&&r.hasAttribute($))return e.push(`<${s} ${$}>[withheld]</${s}>`),t.used+=32,!0;let a=[];for(let d of Array.from(r.attributes))d.name!=="value"&&a.push(`${d.name}="${Q(st(d.name,d.value))}"`);let c=at(r,o);c!==null&&a.push(`value="${Q(c)}"`);let l=a.length>0?`<${s} ${a.join(" ")}>`:`<${s}>`;if(e.push(l),t.used+=l.length,s==="style"){let d=(h=r.textContent)!=null?h:"",f=d.length>ve?`${d.slice(0,ve)}
|
|
2
|
-
/* \u2026${d.length} chars */`:
|
|
3
|
-
--pm-${r}: ${
|
|
1
|
+
"use strict";var DaybookFeedback=(()=>{var ee=Object.defineProperty;var at=Object.getOwnPropertyDescriptor;var lt=Object.getOwnPropertyNames;var ct=Object.prototype.hasOwnProperty;var dt=(n,e)=>{for(var t in e)ee(n,t,{get:e[t],enumerable:!0})},pt=(n,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of lt(e))!ct.call(n,r)&&r!==t&&ee(n,r,{get:()=>e[r],enumerable:!(o=at(e,r))||o.enumerable});return n};var ht=n=>pt(ee({},"__esModule",{value:!0}),n);var gn={};dt(gn,{DEFAULT_API_URL:()=>st,DaybookFeedback:()=>Q,SDK_VERSION:()=>B,captureAnchor:()=>V,init:()=>mn,previewLauncher:()=>nt,resolveAnchor:()=>Oe});var B="1.5.0";var we="key|token|secret|passw(?:or)?d|pwd|api|auth|credential|signature",ve=new RegExp(we,"i"),ut=[{kind:"Daybook API key",pattern:/\bpmk_[0-9a-f]{16,}/gi},{kind:"Stripe key",pattern:/\b[sr]k_(?:live|test)_[A-Za-z0-9]{16,}/g},{kind:"secret key",pattern:/\bsk-[A-Za-z0-9_-]{20,}/g,accept:bt},{kind:"GitHub token",pattern:/\bgh[pousr]_[A-Za-z0-9]{20,}/g},{kind:"GitHub token",pattern:/\bgithub_pat_[A-Za-z0-9_]{22,}/g},{kind:"Slack token",pattern:/\bxox[baprs]-[A-Za-z0-9-]{10,}/g},{kind:"AWS access key",pattern:/\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/g},{kind:"private key",pattern:/-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?(?:-----END [A-Z ]*PRIVATE KEY-----|$)/g},{kind:"JWT",pattern:/\beyJ[A-Za-z0-9_-]{8,}\.eyJ[A-Za-z0-9_-]{8,}(?:\.[A-Za-z0-9_-]*)?/g},{kind:"token",pattern:/\b(?:Bearer|Basic)\s+([A-Za-z0-9+/_.~-]{16,}=*)/gi,value:1,accept:n=>be(n,16)},{kind:"secret",pattern:new RegExp(`(?:${we})[A-Za-z0-9_.-]*["']?(?:\\s*(?:[:=]>?|\\s(?:is|was)\\s)\\s*|\\s+)["']?([A-Za-z0-9+/_.~-]{20,}=*)`,"gi"),value:1,accept:n=>be(n,20)}],mt=/[A-Za-z0-9_+/=.~-]{15,}/,ft=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,gt=/^[0-9a-f]+$/i;function be(n,e=20){var s;let t=n.replace(/=+$/,"");if(t.length<e||ft.test(t))return!1;if(gt.test(t))return t.length>=24&&/[0-9]/.test(t)&&/[a-f]/i.test(t);let o=t.replace(/[^A-Za-z0-9]/g,"");if(o.length<e-4||!/[a-z]/.test(o)||!/[A-Z]/.test(o)||!/[0-9]/.test(o)||((s=o.match(/[a-z]{3,}/g))!=null?s:[]).reduce((a,l)=>a+l.length,0)/o.length>=.5)return!1;let i=0;for(let a=1;a<o.length;a+=1)ye(o.charCodeAt(a))!==ye(o.charCodeAt(a-1))&&(i+=1);return i/(o.length-1)>=.35}function ye(n){return n>=48&&n<=57?0:n>=65&&n<=90?1:2}function bt(n){var e;return((e=n.match(/[A-Za-z0-9]{16,}/g))!=null?e:[]).some(t=>/[0-9]/.test(t)&&/[A-Za-z]/.test(t))}function z(n,e=""){let t=e+n;if(!mt.test(t))return[];let o=[];ut.forEach((i,s)=>{var a;i.pattern.lastIndex=0;for(let l=i.pattern.exec(t);l;l=i.pattern.exec(t)){let c=i.value&&(a=l[i.value])!=null?a:l[0],d=l.index+l[0].length,p=d-c.length;if(i.accept&&!i.accept(c)){i.pattern.lastIndex=l.index+1;continue}d>e.length&&o.push({start:Math.max(p,e.length)-e.length,end:d-e.length,kind:i.kind,rule:s})}}),o.sort((i,s)=>i.start-s.start||i.rule-s.rule);let r=[];for(let i of o){let s=r[r.length-1];s&&i.start<s.end?(s.end=Math.max(s.end,i.end),i.rule<s.rule&&(s.kind=i.kind,s.rule=i.rule)):r.push({...i})}return r.map(({start:i,end:s,kind:a})=>({start:i,end:s,kind:a}))}function L(n,e=""){let t=z(n,e);if(t.length===0)return{text:n,count:0};let o="",r=0;for(let i of t)o+=`${n.slice(r,i.start)}[masked: ${i.kind}]`,r=i.end;return{text:o+n.slice(r),count:t.length}}function I(n){var e;try{let t=new URL(n,location.href);return t.origin===location.origin?t.pathname:`${t.origin}${t.pathname}`}catch{return(e=n.split("?")[0])!=null?e:n}}var yt=/pass|secret|token|auth|cvv|card|ssn|pin|otp|key/i;function xe(n,e){return n.length===0?"":e&&yt.test(e)?"[redacted]":`[${n.length} chars]`}function te(n){var o,r,i,s,a,l;let e=n.tagName.toLowerCase();if(!n.getAttribute("aria-label")&&!n.getAttribute("data-testid")&&!((o=n.textContent)!=null?o:"").trim()){let c=n.closest("button, a, [role=button], [data-testid], label");if(c&&c!==n)return te(c)}if(n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement||n instanceof HTMLSelectElement){let c=(i=(r=n.getAttribute("name"))!=null?r:n.id)!=null?i:"",d=n instanceof HTMLInputElement?n.type:e;return`${e}[${d}]${c?` name=${c}`:""}`}let t=(l=(s=n.getAttribute("aria-label"))!=null?s:n.getAttribute("data-testid"))!=null?l:((a=n.textContent)!=null?a:"").replace(/\s+/g," ").trim().slice(0,40);return t?`${e} "${t}"`:e}function ke(n){let e=n.replace(/[\w.+-]+@[\w-]+\.[\w.]+/g,"[email]").replace(/\b[A-Za-z0-9_-]{20,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\b/g,"[jwt]").replace(/\bBearer\s+[\w.-]+/gi,"Bearer [redacted]").replace(/\b\d{12,19}\b/g,"[number]");return L(e.slice(0,900)).text.slice(0,500)}var M="data-daybook-private";var j=class{constructor(e=40,t=!0){this.limit=e;this.redact=t;this.entries=[];this.detach=[]}list(){return[...this.entries]}add(e,t){for(this.entries.push({at:new Date().toISOString(),type:e,message:this.redact?ke(t):t.slice(0,500)});this.entries.length>this.limit;)this.entries.shift()}start(){let e=a=>{let l=a.target;l instanceof Element&&(l.closest("[data-daybook-feedback]")||this.add("click",te(l)))};document.addEventListener("click",e,{capture:!0,passive:!0}),this.detach.push(()=>document.removeEventListener("click",e,{capture:!0}));let t=history.pushState,o=history.replaceState,r=()=>this.add("nav",I(location.href));history.pushState=(...a)=>{t.apply(history,a),r()},history.replaceState=(...a)=>{o.apply(history,a),r()},window.addEventListener("popstate",r),this.detach.push(()=>{history.pushState=t,history.replaceState=o,window.removeEventListener("popstate",r)});for(let a of["error","warn"]){let l=console[a];console[a]=(...c)=>{this.add("console",`${a}: ${c.map(ne).join(" ")}`),l.apply(console,c)},this.detach.push(()=>{console[a]=l})}let i=a=>this.add("console",`uncaught: ${a.message}`),s=a=>this.add("console",`unhandled rejection: ${ne(a.reason)}`);window.addEventListener("error",i),window.addEventListener("unhandledrejection",s),this.detach.push(()=>{window.removeEventListener("error",i),window.removeEventListener("unhandledrejection",s)}),this.watchFetch()}stop(){for(let e of this.detach.splice(0))e()}watchFetch(){if(typeof window.fetch!="function")return;let e=window.fetch;window.fetch=async(...t)=>{let o=performance.now();try{let r=await e.apply(window,t),i=Math.round(performance.now()-o);return(!r.ok||i>3e3)&&this.add("network",`${r.status} ${I(Ee(t[0]))} ${i}ms`),r}catch(r){throw this.add("network",`failed ${I(Ee(t[0]))}: ${ne(r)}`),r}},this.detach.push(()=>{window.fetch=e})}};function Ee(n){return typeof n=="string"?n:n instanceof URL?n.href:n.url}function ne(n){var e,t;if(typeof n=="string")return n;if(n instanceof Error)return`${n.name}: ${n.message}`;try{return(t=(e=JSON.stringify(n))==null?void 0:e.slice(0,200))!=null?t:String(n)}catch{return String(n)}}var re="pm.feedback.queue";var q=class{constructor(e,t){this.apiUrl=e;this.ingestKey=t;this.session=null;this.identityToken=null}setSession(e){this.session=e}async send(e,t=[],o){var l,c,d;let r={idempotencyKey:(l=e.idempotencyKey)!=null?l:Te(),...e,attachments:[...(c=e.attachments)!=null?c:[],...t.map(p=>({filename:p.filename,contentType:p.contentType,size:p.blob.size}))]},i=await this.post("/ingest/v1",r);if(!i.ok)throw await U(i);let s=await i.json(),a=((d=e.attachments)!=null?d:[]).length;return await Promise.all(t.map(async(p,m)=>{let h=wt(s,a+m);if(!h){o==null||o(p,new Error("The server would not accept that file."));return}try{await this.upload(h,p)}catch(f){o==null||o(p,f)}})),s}async flush(){let e=Le();if(e.length!==0){Ae([]);for(let t of e)try{let o=await this.post("/ingest/v1",t);!o.ok&&(o.status===429||o.status>=500)&&oe(t)}catch{oe(t)}}}queue(e){var t;oe({...e,idempotencyKey:(t=e.idempotencyKey)!=null?t:Te(),attachments:void 0})}async signIn(){let e=Se(64),t=await vt(e),o=Se(16),r=`${this.base()}/ingest/v1/authorize?key=${encodeURIComponent(this.ingestKey)}&origin=${encodeURIComponent(location.origin)}&code_challenge=${encodeURIComponent(t)}&state=${encodeURIComponent(o)}`,i=window.open(r,"daybook-feedback","width=460,height=640");if(!i)throw Object.assign(new Error("Popup blocked"),{code:"popup_blocked"});let s=await new Promise((c,d)=>{let p=setInterval(()=>{i.closed&&(h(),d(Object.assign(new Error("Sign-in cancelled"),{code:"cancelled"})))},400),m=f=>{if(f.origin!==new URL(this.base()).origin)return;let g=f.data;if((g==null?void 0:g.source)==="daybook-feedback"&&g.state===o){if(h(),g.error||!g.code){d(Object.assign(new Error("Sign-in was refused"),{code:g.error||"refused"}));return}c(g.code)}},h=()=>{clearInterval(p),window.removeEventListener("message",m)};window.addEventListener("message",m)}),a=await this.post("/ingest/v1/token",{code:s,codeVerifier:e});if(!a.ok)throw await U(a);let{identityToken:l}=await a.json();return this.identityToken=l,l}base(){return this.apiUrl.replace(/\/$/,"")}resolve(e){try{let t=new URL(this.base()),o=new URL(e,t);return o.hostname===t.hostname?new URL(o.pathname+o.search,t).toString():o.toString()}catch{return e}}async handshake(e){var r,i;let t=await this.post("/ingest/v1/session",{...e,identityToken:(r=this.identityToken)!=null?r:void 0});if(!t.ok)throw await U(t);let o=await t.json();return this.session=(i=o.sessionToken)!=null?i:null,o}post(e,t){let o={"Content-Type":"application/json","X-Ingest-Key":this.ingestKey};return this.session&&(o["X-Feedback-Session"]=this.session),fetch(`${this.base()}${e}`,{method:"POST",headers:o,body:JSON.stringify(t),credentials:"omit"})}async upload(e,t){let o=await fetch(this.resolve(e.uploadUrl),{method:e.method,headers:{"Content-Type":e.contentType,"X-Ingest-Key":this.ingestKey},body:t.blob,credentials:"omit"});if(!o.ok)throw await U(o);await this.post(`/ingest/v1/attachments/${e.id}/confirm`,{})}};function wt(n,e){let t=n.attachments.find(o=>o.index===e);return t!=null?t:n.attachments.some(o=>typeof o.index=="number")?void 0:n.attachments[e]}function oe(n){let e=Le();e.push(n),Ae(e.slice(-20))}function Le(){try{let n=localStorage.getItem(re);return n?JSON.parse(n):[]}catch{return[]}}function Ae(n){try{n.length===0?localStorage.removeItem(re):localStorage.setItem(re,JSON.stringify(n))}catch{}}async function U(n){let e=`http_${n.status}`;try{let t=await n.json();if(t.code&&(e=t.code),t.message)return Object.assign(new Error(t.message),{code:e})}catch{}return Object.assign(new Error(`Ingest failed (${n.status})`),{code:e})}function Te(){return typeof crypto!="undefined"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function Se(n){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",t=new Uint8Array(n);return crypto.getRandomValues(t),Array.from(t,o=>e[o%e.length]).join("")}async function vt(n){let e=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(n));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function se(n){var i,s;let e=a=>n.redact?L(a).text:a,t={platform:"web",route:e(location.pathname),title:e(document.title.slice(0,200)),locale:navigator.language,timezone:kt(),viewport:{width:window.innerWidth,height:window.innerHeight,dpr:(i=window.devicePixelRatio)!=null?i:1},device:xt(),sdk:{name:"js",version:B}};document.referrer&&(t.referrer=I(document.referrer)),n.app&&(t.app=n.app);let o=((s=n.anchors)!=null?s:[]).map(a=>n.redact?{...a,elementText:a.elementText===null?null:e(a.elementText),...a.page===void 0?{}:{page:e(a.page)}}:a);o[0]&&(t.anchor=o[0]),o.length>1&&(t.anchors=o),n.breadcrumbs&&n.breadcrumbs.length>0&&(t.breadcrumbs=n.breadcrumbs);let r=n.withheld;return r&&(r.blurredByReporter>0||Object.values(r.secretsMasked).some(a=>(a!=null?a:0)>0))&&(t.redaction=r),t}function xt(){var r;let n=navigator.userAgent,e=/Edg\//.test(n)?"Edge":/OPR\//.test(n)?"Opera":/Firefox\//.test(n)?"Firefox":/Chrome\//.test(n)?"Chrome":/Safari\//.test(n)?"Safari":"Unknown",t=/Windows NT/.test(n)?"Windows":/iPhone|iPad|iPod/.test(n)?"iOS":/Mac OS X/.test(n)?"macOS":/Android/.test(n)?"Android":/Linux/.test(n)?"Linux":"Unknown",o=(r=n.match(/(?:Edg|OPR|Firefox|Chrome|Version)\/(\d+)/))==null?void 0:r[1];return{browser:o?`${e} ${o}`:e,os:t,touch:navigator.maxTouchPoints>0,userAgent:n.slice(0,300)}}function kt(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return`UTC${-new Date().getTimezoneOffset()/60}`}}async function Ce(n,e=()=>()=>{},t=[]){var l;if(typeof((l=navigator.mediaDevices)==null?void 0:l.getDisplayMedia)!="function")return null;let o=Lt(n,t),r=()=>n?Bt():{boxes:[],count:0},i=r(),s=e(i.boxes),a=null;try{if(a=await navigator.mediaDevices.getDisplayMedia({video:!0,audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude",monitorTypeSurfaces:"exclude"}),!a.getVideoTracks()[0])return null;i=r(),s(),s=e(i.boxes),await new Promise(p=>setTimeout(p,250));let d=await Tt(a);return d?{...d,secretsMasked:i.count}:null}catch{return null}finally{a==null||a.getTracks().forEach(c=>c.stop()),s(),o()}}var _e=1920,Et=.82;async function Tt(n){let e=document.createElement("video");e.srcObject=n,e.muted=!0,await e.play().catch(()=>{});let t=e.videoWidth||window.innerWidth,o=e.videoHeight||window.innerHeight,r=t>_e?_e/t:1,i=document.createElement("canvas");i.width=Math.round(t*r),i.height=Math.round(o*r);let s=i.getContext("2d");if(!s)return null;s.imageSmoothingQuality="high",s.drawImage(e,0,0,i.width,i.height),e.pause(),e.srcObject=null;let a=await St(i);if(!a)return null;let l=a.type||"image/png";return{blob:a,filename:`screenshot.${l==="image/webp"?"webp":l==="image/jpeg"?"jpg":"png"}`,contentType:l}}async function St(n){for(let e of["image/webp","image/jpeg"]){let t=await Me(n,e,Et);if((t==null?void 0:t.type)===e)return t}return Me(n,"image/png")}function Me(n,e,t){return new Promise(o=>n.toBlob(r=>o(r),e,t))}function Lt(n,e){let t=[...n?document.querySelectorAll(`[${M}]`):[],...n?document.querySelectorAll('input[type="password"]'):[],...e.filter(r=>"style"in r)],o=t.map(r=>r.style.filter);return t.forEach(r=>{r.style.filter="blur(12px)"}),()=>{t.forEach((r,i)=>{var s;r.style.filter=(s=o[i])!=null?s:""})}}var At=new Set(["script","style","noscript","template"]),_t=/^(?:text|search|url|email|tel|number|)$/,Mt=1,$t=4,Ct=1,Rt=2;function Bt(){let n=[],e=0,t=document.body;if(!t)return{boxes:n,count:e};let o=document.createTreeWalker(t,Mt|$t,{acceptNode:s=>s.nodeType===1&&At.has(s.localName)?Rt:Ct}),r="",i=o.nextNode();for(;i;){if(i.nodeType===3){let a=[i];for(i=o.nextNode();i&&i.nodeType===3&&i.previousSibling===a[a.length-1];)a.push(i),i=o.nextNode();let l=a.map(c=>c.data).join("");for(let c of z(l,r)){let d=$e(It(a,c.start,c.end));d.length!==0&&(n.push(...d),e+=1)}l.trim()&&(r=`${l.replace(/\s+/g," ").slice(-48)} `);continue}let s=i;if(s.localName==="textarea"||s.localName==="input"&&_t.test(s.type)){let a=s,l=a.getAttribute("aria-label")||a.name||a.id||"";if(a.value&&z(a.value,`${r}${l} `).length>0){let c=$e([a.getBoundingClientRect()]);c.length>0&&(n.push(...c),e+=1)}}i=o.nextNode()}return{boxes:n,count:e}}function It(n,e,t){let o=document.createRange(),r=0,i=!1;for(let s of n){let a=s.data.length;if(!i&&e<r+a&&(o.setStart(s,e-r),i=!0),i&&t<=r+a){o.setEnd(s,t-r);break}r+=a}return Array.from(o.getClientRects(),s=>({left:s.left,top:s.top,width:s.width,height:s.height}))}function $e(n){return n.filter(e=>e.width>0&&e.height>0&&e.left<window.innerWidth&&e.left+e.width>0&&e.top<window.innerHeight&&e.top+e.height>0)}var Re="data-daybook-blurred";function H(n,e){return n.left<e.left+e.width&&e.left<n.left+n.width&&n.top<e.top+e.height&&e.top<n.top+n.height}function Be(n,e){return n.left>=e.left-1&&n.top>=e.top-1&&n.left+n.width<=e.left+e.width+1&&n.top+n.height<=e.top+e.height+1}var K=4e5,D=300,N=600,X=8e3,W=400,Pt=48,Ht=new Set(["SCRIPT","NOSCRIPT","TEMPLATE"]),Nt=["display","position","z-index","opacity","visibility","overflow","width","height","margin","padding","box-sizing","color","background-color","border","border-radius","box-shadow","font-family","font-size","font-weight","line-height","text-align","white-space","flex-direction","justify-content","align-items","gap","grid-template-columns","transform","transition","pointer-events","cursor"],Ft="The page at the moment this was reported. Field values are described rather than reproduced when redacted is true, data-daybook-private subtrees are withheld, and credentials found on the page read [masked: kind]. data-daybook-blurred marks what the reporter chose to blur. html is last because only the head of this file is inlined beside the report \u2014 download the attachment for the rest of it.";function le(n){let e=[],t=n;for(let o=0;t&&o<4&&t.nodeType===1;o+=1){let r=t.localName;if(t.id){e.unshift(`${r}#${t.id}`);break}let i=Array.from(t.classList).slice(0,3).join(".");i&&(r+=`.${i}`),e.unshift(r),t=t.parentElement}return e.join(" > ")}function Ot(n,e,t,o){var i;let r=o;if(n.redacted){let s=(i=[e.getAttribute("name"),e.getAttribute("id")].find(l=>l&&ve.test(l)))!=null?i:t,a=L(o.slice(0,D+W),`${s}=`);n.secrets+=a.count,r=a.text}return o.length>D||r.length>D?`${r.slice(0,D)}\u2026[${o.length}]`:r}var ae=n=>n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""");function zt(n,e){let t=n;if(n.localName==="input"&&(t.type==="checkbox"||t.type==="radio"))return t.checked?"checked":"unchecked";let o=t.value;return typeof o!="string"||o===""?null:e?xe(o,t.name||t.id||t.type):o}function Ie(n,e){let t=n.map(i=>{var s;return(s=i.textContent)!=null?s:""}).join("").replace(/\s+/g," ");if(!t.trim())return;if(e.regions.length>0&&n.some(i=>jt(i,e.regions))){e.out.push("[withheld]"),e.used+=10,e.before="";return}let o=t.length>N+W?t.slice(0,N+W):t;if(e.redacted){let i=L(o,e.before);e.secrets+=i.count,o=i.text}e.before=`${t.slice(-Pt)} `;let r=t.length>N||o.length>N?`${o.slice(0,N)}\u2026`:o;e.out.push(ae(r)),e.used+=r.length}function jt(n,e){let t=document.createRange();return t.selectNodeContents(n),Array.from(t.getClientRects()).some(o=>e.some(r=>H(o,r)))}function Ut(n,e){let t=n.getBoundingClientRect();if(t.width===0&&t.height===0)return!1;let o=n.childNodes.length===0||qt.has(n.localName);return e.some(r=>Be(t,r)||o&&H(t,r))}var qt=new Set(["input","textarea","select"]);function He(n,e){var l,c;if(e.used>K)return!1;if(n.nodeType===3)return Ie([n],e),!0;if(n.nodeType!==1)return!0;let t=n,o=t.tagName;if(t.hasAttribute("data-daybook-feedback")||Ht.has(o))return!0;let r=t.localName;if(e.redacted&&t.hasAttribute(M))return e.out.push(`<${r} ${M}>[withheld]</${r}>`),e.used+=32,e.before="",!0;if(e.blurred.has(t)||e.regions.length>0&&Ut(t,e.regions))return e.out.push(`<${r} ${Re}>[withheld]</${r}>`),e.used+=32,e.before="",!0;let i=[];for(let d of Array.from(t.attributes)){if(d.name==="value")continue;let p=Ot(e,t,d.name,d.value);i.push(`${d.name}="${ae(p)}"`)}let s=zt(t,e.redacted);s!==null&&i.push(`value="${ae(s)}"`);let a=i.length>0?`<${r} ${i.join(" ")}>`:`<${r}>`;if(e.out.push(a),e.used+=a.length,r==="style"){let d=(l=t.textContent)!=null?l:"",p=d.slice(0,X+W);if(e.redacted){let h=L(p);e.secrets+=h.count,p=h.text}let m=d.length>X||p.length>X?`${p.slice(0,X)}
|
|
2
|
+
/* \u2026${d.length} chars */`:p;e.out.push(m),e.used+=m.length}else{let d=Array.from(t.childNodes);for(let p=0;p<d.length;p+=1){let m=d[p];if(m.nodeType===3){let h=[m];for(;((c=d[p+1])==null?void 0:c.nodeType)===3;)h.push(d[++p]);if(Ie(h,e),e.used>K)break;continue}if(!He(m,e))break}}return e.out.push(`</${r}>`),e.used+=r.length+3,e.used<=K}function Dt(){var e,t;let n=[];for(let o of Array.from((t=(e=document.body)==null?void 0:e.querySelectorAll("*"))!=null?t:[]).slice(0,4e3)){let r=getComputedStyle(o);if(r.position!=="fixed"&&r.position!=="sticky"||r.visibility==="hidden"||r.display==="none"||Number(r.opacity)===0)continue;let i=o.getBoundingClientRect();if(!(i.width<4||i.height<4)&&!o.closest("[data-daybook-feedback]")&&(n.push({selector:le(o),zIndex:r.zIndex,rect:{x:Math.round(i.x),y:Math.round(i.y),w:Math.round(i.width),h:Math.round(i.height)}}),n.length>=20))break}return n}function Pe(n){if(!(n!=null&&n.selector))return;let e=null;try{e=document.querySelector(n.selector)}catch{return}if(!e)return;let t=[];for(let o=e;o&&t.length<5;o=o.parentElement){let r=getComputedStyle(o),i={};for(let s of Nt){let a=r.getPropertyValue(s);a&&(i[s]=a)}t.push({selector:le(o),computed:i})}return{selector:n.selector,path:t}}function Xt(){return Array.from(document.styleSheets).slice(0,40).map(n=>{try{return{href:n.href,rules:n.cssRules.length}}catch{return{href:n.href,rules:"unreadable"}}})}function Ne(n,e,t={elements:[],regions:[]}){var r;let o=n==null?[]:Array.isArray(n)?n:[n];try{let i={out:[],used:0,redacted:e,blurred:new Set(t.elements),regions:t.regions,before:"",secrets:0};He(document.documentElement,i);let s=d=>{if(!e)return d;let p=L(d);return i.secrets+=p.count,p.text},a=s(location.href),l=s(document.title),c=Xt().map(d=>d.href?{...d,href:s(d.href)}:d);return{note:Ft,capturedAtUtc:new Date().toISOString(),url:a,title:l,redacted:e,blurredByReporter:t.elements.length+t.regions.length,secretsMasked:i.secrets,truncated:i.used>K,scroll:{x:Math.round(window.scrollX),y:Math.round(window.scrollY)},focus:document.activeElement&&document.activeElement!==document.body?le(document.activeElement):null,anchor:Pe((r=o[0])!=null?r:null),anchors:o.length>1?o.map(d=>Pe(d)).filter(d=>!!d):void 0,layers:Dt(),stylesheets:c,html:i.out.join("")}}catch{return null}}function V(n,e){let t=document.elementFromPoint(n,e);if(!(t instanceof HTMLElement))return{selector:null,offsetX:Y(n/window.innerWidth),offsetY:Y(e/window.innerHeight),elementText:null,page:Fe()};let o=t.getBoundingClientRect();return{selector:Kt(t),offsetX:o.width>0?Y((n-o.left)/o.width):0,offsetY:o.height>0?Y((e-o.top)/o.height):0,elementText:Vt(t),page:Fe()}}function Oe(n){if(!n.selector)return{x:n.offsetX*window.innerWidth,y:n.offsetY*window.innerHeight};let e=null;try{e=document.querySelector(n.selector)}catch{return null}if(!e)return null;let t=e.getBoundingClientRect();return{x:t.left+n.offsetX*t.width,y:t.top+n.offsetY*t.height}}function Kt(n){if(n===document.body)return"body";for(let r of["data-testid","data-test","data-daybook-id","data-cy"]){let i=n.getAttribute(r);if(i){let s=`[${r}="${F(i)}"]`;if($(s))return s}}if(n.id&&!ce(n.id)){let r=`#${F(n.id)}`;if($(r))return r}let e=[],t=n;for(;t&&t!==document.body&&e.length<8;){let r=t.tagName.toLowerCase(),i=Array.from(t.classList).filter(l=>!ce(l)).slice(0,2);i.length>0&&(r+=i.map(l=>`.${F(l)}`).join(""));let s=t.parentElement;if(s){let l=Array.from(s.children).filter(c=>c.tagName===t.tagName);l.length>1&&(r+=`:nth-of-type(${l.indexOf(t)+1})`)}e.unshift(r);let a=e.join(" > ");if($(a))return a;t=s}let o=e.length>0?`body > ${e.join(" > ")}`:null;return o&&$(o)?o:Wt(n)}function Wt(n){let e=[],t=n;for(;t&&t!==document.body&&t!==document.documentElement;){let r=Yt(t);if(r&&t!==n){e.unshift(r);break}let i=t.parentElement;if(!i)break;e.unshift(`${t.tagName.toLowerCase()}:nth-child(${Array.from(i.children).indexOf(t)+1})`),t=i}t===document.body&&e.unshift("body");let o=e.join(" > ");return o&&$(o)?o:null}function Yt(n){for(let e of["data-testid","data-test","data-daybook-id","data-cy"]){let t=n.getAttribute(e);if(t){let o=`[${e}="${F(t)}"]`;if($(o))return o}}if(n.id&&!ce(n.id)){let e=`#${F(n.id)}`;if($(e))return e}return null}function $(n){try{return document.querySelectorAll(n).length===1}catch{return!1}}function ce(n){return/^[a-z]{1,3}[0-9a-f]{5,}$/i.test(n)||/--[0-9a-f]{5,}$/i.test(n)||/^_[0-9a-z]{5,}/i.test(n)||/^v-[0-9a-f]{6,}$/i.test(n)||/^ng-/.test(n)||/[0-9a-f]{8,}/i.test(n)}function Vt(n){var o,r,i;let t=((r=(o=n.innerText)!=null?o:n.textContent)!=null?r:"").replace(/\s+/g," ").trim();if(!t){let s=(i=n.getAttribute("aria-label"))!=null?i:n.getAttribute("title");return(s==null?void 0:s.trim())||null}return t.length>80?`${t.slice(0,77)}\u2026`:t}function Fe(){return location.pathname+location.search}function Y(n){return Number.isFinite(n)?Math.max(0,Math.min(1,n)):0}function F(n){return typeof CSS!="undefined"&&typeof CSS.escape=="function"?CSS.escape(n):n.replace(/([^\w-])/g,"\\$1")}var Zt=/^(image\/(png|jpeg|gif|webp)|video\/(mp4|quicktime|webm))$/;function ze(n,e){let t=[];for(let o of n){if(e+t.length>=5)break;let r=Zt.test(o.type)?o.size>26214400?`Too large (${(o.size/1048576).toFixed(1)} MB, max 25).`:null:"Only images and short videos.";t.push({blob:o,filename:o.name||`pasted-${t.length+1}.${Jt(o.type)}`,contentType:o.type,preview:r?null:URL.createObjectURL(o),error:r})}return t}function je(n){var o;let e=(o=n.clipboardData)==null?void 0:o.items;if(!e)return[];let t=[];for(let r of e){if(r.kind!=="file")continue;let i=r.getAsFile();i&&t.push(i)}return t}function Z(n){for(let e of n)e.preview&&URL.revokeObjectURL(e.preview)}function Jt(n){var e,t;return(t=(e=n.split("/")[1])==null?void 0:e.replace("quicktime","mov"))!=null?t:"bin"}function Ue(n){var o;let t=(o=(typeof n.composedPath=="function"?n.composedPath():[])[0])!=null?o:n.target;return!t||t.nodeType!==1?!1:/^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName)?!0:typeof t.closest=="function"&&t.closest('[contenteditable=""], [contenteditable="true"]')!==null}function Gt(n,e,t){let o=0;for(let s of e){if(s.right<=n.left||s.left>=n.right)continue;let a=n.v==="bottom"?t.height-s.top:s.bottom;a>o&&(o=a)}if(o===0)return 0;let r=n.v==="bottom"?t.height-n.bottom:n.top,i=Math.round(o+12-r);return i<=0||i>t.height*.35?0:i}function Qt(n,e,t){if(n===e||e.contains(n)||n.contains(e)||n===document.body||n===document.documentElement)return!1;let o=getComputedStyle(n);if(o.position!=="fixed"&&o.position!=="sticky"||o.visibility==="hidden"||o.display==="none"||Number(o.opacity)===0)return!1;let r=n.getBoundingClientRect();return!(r.width<8||r.height<8||r.width*r.height>t.width*t.height*.25)}function en(n,e,t){if(typeof document.elementsFromPoint!="function")return[];let o=new Map,r=[];for(let s=n.left+4;s<n.right;s+=32)r.push(s);r.push(n.right-4);let i=t.height*.35;for(let s=0;s<=i;s+=32){let a=n.v==="bottom"?n.bottom-s:n.top+s;if(a<0||a>t.height)break;for(let l of r)if(!(l<0||l>t.width))for(let c of document.elementsFromPoint(l,a)){if(o.has(c)||!Qt(c,e,t))continue;let d=c.getBoundingClientRect();o.set(c,{top:d.top,bottom:d.bottom,left:d.left,right:d.right})}}return[...o.values()]}function qe(n,e){let t={width:window.innerWidth,height:window.innerHeight};return Gt(n,en(n,e,t),t)}var G=class{constructor(e,t){this.options=e;this.onSubmit=t;this.mode="idle";this.pins=[];this.blurs=[];this.cancelAdding=null;this.unmark=null;this.detach=[];this.buttonStyle="pill";this.clearance=0;this.state="ready";this.policy=null;this.redrawMarks=null;this.dragged=null;this.launcherAt=on();this.swallowClick=!1;this.reference=null;this.uploadsFailed=0;this.host=document.createElement("div"),this.host.setAttribute("data-daybook-feedback",""),this.host.style.cssText="position:fixed;inset:0;z-index:2147483000;pointer-events:none",this.root=this.host.attachShadow({mode:"open"}),this.root.innerHTML=`<style>${it}</style><style id="theme"></style><style id="place"></style><div id="layer"></div>`}setTheme(e){let t=this.root.getElementById("theme");if(t){if(!e){t.textContent="";return}t.textContent=Qe(e),this.buttonStyle=et(e),this.themePlacement=e.position,this.applyPlacement(),this.launcherLabel=typeof e.launcherLabel=="string"&&e.launcherLabel.length>0?e.launcherLabel.slice(0,24):void 0}}get placement(){var e,t;return(t=(e=this.options.placement)!=null?e:this.themePlacement)!=null?t:"bottom-right"}applyPlacement(){let e=this.root.getElementById("place");if(!e)return;let t=this.placement,o=t.startsWith("bottom")?"bottom":"top",r=t.endsWith("right")?"right":"left",i=w+this.clearance;e.textContent=`:host {
|
|
3
|
+
--pm-${r}: ${w}px; --pm-${r==="right"?"left":"right"}: auto;
|
|
4
4
|
--pm-${o}: ${i}px; --pm-${o==="bottom"?"top":"bottom"}: auto;
|
|
5
|
-
}`}homeSlot(){let e=this.placement,t=220,o=48,r=e.endsWith("right")?window.innerWidth-
|
|
5
|
+
}`}homeSlot(){let e=this.placement,t=220,o=48,r=e.endsWith("right")?window.innerWidth-w:w+t,i=e.startsWith("bottom")?window.innerHeight-w:w+o;return{left:r-t,right:r,top:i-o,bottom:i,v:e.startsWith("bottom")?"bottom":"top"}}watchClearance(){if(this.options.avoidOverlap===!1)return;let e=!1,t=()=>{if(e=!1,this.mode==="idle"&&!this.launcherAt)try{let i=qe(this.homeSlot(),this.host);if(Math.abs(i-this.clearance)<4)return;this.clearance=i,this.applyPlacement()}catch{}},o=typeof requestAnimationFrame=="function"?i=>requestAnimationFrame(i):i=>setTimeout(i,16),r=()=>{e||(e=!0,o(t))};if(window.addEventListener("scroll",r,{passive:!0,capture:!0}),window.addEventListener("resize",r),this.detach.push(()=>{window.removeEventListener("scroll",r,{capture:!0}),window.removeEventListener("resize",r)}),typeof MutationObserver=="function"){let i=new MutationObserver(r);i.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class","hidden"]}),this.detach.push(()=>i.disconnect())}r()}setState(e){this.state=e,this.host.isConnected&&this.render()}shield(){let e=o=>{let r=o.composedPath();if(!r.includes(this.host))return;o.stopImmediatePropagation();let[i]=r;if(!(!(i instanceof Node)||i===this.host)){if(o.type==="focusin")i.dispatchEvent(new FocusEvent("focusin",{bubbles:!0,composed:!1}));else if(o.type==="click"&&o instanceof MouseEvent){let s=new MouseEvent("click",{bubbles:!0,cancelable:!0,composed:!1,detail:o.detail,screenX:o.screenX,screenY:o.screenY,clientX:o.clientX,clientY:o.clientY,button:o.button,buttons:o.buttons,ctrlKey:o.ctrlKey,shiftKey:o.shiftKey,altKey:o.altKey,metaKey:o.metaKey});s.preventDefault(),i.dispatchEvent(s)}}};for(let o of De)window.addEventListener(o,e,!0);this.detach.push(()=>{for(let o of De)window.removeEventListener(o,e,!0)});let t=o=>o.stopPropagation();for(let o of["keydown","keyup","keypress"])this.root.addEventListener(o,t)}mount(){var e;if(document.body.appendChild(this.host),this.applyPlacement(),this.render(),this.watchClearance(),this.watchLauncher(),this.options.hotkey!==null){let t=((e=this.options.hotkey)!=null?e:"f").toLowerCase(),o=r=>{if(r.key==="Escape"&&this.cancelAdding){this.cancelAdding();return}if(r.key==="Escape"){this.mode==="picking"&&(this.mode="idle",this.pins=[],this.blurs=[],this.dragged=null,this.render());return}r.metaKey||r.ctrlKey||r.altKey||Ue(r)||this.mode!=="composing"&&r.key.toLowerCase()===t&&(this.mode=this.mode==="picking"?"idle":"picking",this.render())};window.addEventListener("keydown",o),this.detach.push(()=>window.removeEventListener("keydown",o)),this.root.addEventListener("keydown",o)}this.shield()}unmount(){for(let e of this.detach.splice(0))e();this.host.remove()}open(){this.mode="picking",this.render()}setReporter(e){this.reporter=e}setPolicy(e){this.policy=e}capture(){var t,o;let e=(t=this.options.screenshots)!=null?t:!0;return e===!1||((o=this.policy)==null?void 0:o.screenshots)===!1?{offered:!1,checked:!1}:{offered:!0,checked:e!=="optional"}}conceal(e=[]){let t=this.root.getElementById("layer"),o=t.style.visibility;t.style.visibility="hidden";let r=this.origin(),i=[...this.veilBlurs(this.root),...e.map(s=>this.root.appendChild(We(s,r,null,!0))),...this.ringPins()];return()=>{t.style.visibility=o,i.forEach(s=>s.remove())}}blurred(){let e=[],t=[];for(let o of this.blurs){let r=this.pinRect(o);if(!r)continue;let i=this.elementOf(o);i?e.push(i):t.push(r)}return{elements:e,regions:t}}elementOf(e){var t,o;if(((t=e.anchor.page)!=null?t:O())!==O())return null;if((o=e.element)!=null&&o.isConnected)return e.element;if(!e.anchor.selector||e.anchor.selector==="body")return null;try{return document.querySelector(e.anchor.selector)}catch{return null}}veilBlurs(e){let t=this.origin(),o=this.blurs.length>1;return this.blurs.flatMap((r,i)=>{let s=this.pinRect(r);if(!s)return[];let a=o?`Blurred ${i+1}`:"Blurred";return[e.appendChild(We(s,t,a,!1))]})}sendable(e){if(!e.anchor.elementText)return e.anchor;let t=this.elementOf(e),o=this.pinRect(e),r=this.blurs.some(a=>{let l=this.elementOf(a);if(l&&t)return l.contains(t)||t.contains(l);let c=this.pinRect(a);return!!c&&!!o&&H(c,o)}),i=`[${M}]`;return r||this.options.redact!==!1&&!!t&&(!!t.closest(i)||!!t.querySelector(i))?{...e.anchor,elementText:null}:e.anchor}ringPins(){let e=this.pins.length>1;return this.pins.flatMap((t,o)=>{let r=this.pinRect(t);if(!r)return[];let i=this.origin(),s=document.createElement("div");if(s.className="ring",s.style.left=`${r.left-i.left-_}px`,s.style.top=`${r.top-i.top-_}px`,s.style.width=`${r.width+_*2}px`,s.style.height=`${r.height+_*2}px`,e){let a=document.createElement("span");a.className="ring__n",a.textContent=String(o+1),s.appendChild(a)}return this.root.appendChild(s),[s]})}pinRect(e){var o,r;if(((o=e.anchor.page)!=null?o:O())!==O())return null;let t=(r=e.element)!=null&&r.isConnected?e.element:null;if(!t&&e.anchor.selector&&e.anchor.selector!=="body")try{t=document.querySelector(e.anchor.selector)}catch{t=null}if(t){let i=t.getBoundingClientRect();if(i.width>=1&&i.height>=1)return{left:i.left,top:i.top,width:i.width,height:i.height}}return{left:e.box.left-window.scrollX,top:e.box.top-window.scrollY,width:e.box.width,height:e.box.height}}origin(){let e=this.host.getBoundingClientRect();return{left:e.left,top:e.top}}markPins(e){var s;(s=this.unmark)==null||s.call(this);let t=document.createElement("div");e.appendChild(t);let o=0,r=()=>{if(o=0,t.innerHTML="",this.veilBlurs(t),this.pins.length<1)return;let a=this.origin();this.pins.forEach((l,c)=>{let d=this.pinRect(l);if(!d)return;let p=document.createElement("div");p.className="marker",p.style.left=`${d.left-a.left-_}px`,p.style.top=`${d.top-a.top-_}px`,p.style.width=`${d.width+_*2}px`,p.style.height=`${d.height+_*2}px`;let m=document.createElement("span");m.className="marker__n",m.textContent=String(c+1),p.appendChild(m),t.appendChild(p)})},i=()=>{o||(o=requestAnimationFrame(r))};window.addEventListener("scroll",i,{capture:!0,passive:!0}),window.addEventListener("resize",i),r(),this.redrawMarks=r,this.unmark=()=>{o&&cancelAnimationFrame(o),window.removeEventListener("scroll",i,{capture:!0}),window.removeEventListener("resize",i),t.remove(),this.redrawMarks=null,this.unmark=null}}pickAnother(e,t,o=!1){let r=this.root.getElementById("layer"),i=()=>{var a;s.remove(),e.style.visibility="",this.cancelAdding=null,(a=this.redrawMarks)==null||a.call(this)},s=o?this.picker(a=>{this.blurs.push(a),i(),t()},"Click what to blur, or drag across an area",!0):this.picker(a=>{this.pins.push(a),i(),t()},`Click what else is involved (pin ${this.pins.length+1})`);e.style.visibility="hidden",this.cancelAdding=i,r.appendChild(s)}movable(e,t){this.place(e),t.classList.add("drag"),t.title="Drag to move \xB7 double-click to reset",t.addEventListener("dblclick",()=>{this.dragged=null,this.place(e)}),t.addEventListener("pointerdown",o=>{if(o.target.closest("button")||o.button!==0)return;o.preventDefault();let r=e.getBoundingClientRect(),i=o.clientX-r.left,s=o.clientY-r.top;t.setPointerCapture(o.pointerId),e.classList.add("panel--dragging");let a=c=>{let d=P(c.clientX-i,w-r.width+de,window.innerWidth-de),p=P(c.clientY-s,0,window.innerHeight-de);e.style.left=`${d}px`,e.style.top=`${p}px`,e.style.right="auto",e.style.bottom="auto"},l=()=>{t.releasePointerCapture(o.pointerId),t.removeEventListener("pointermove",a),t.removeEventListener("pointerup",l),t.removeEventListener("pointercancel",l),e.classList.remove("panel--dragging"),this.dragged=Ve(e.getBoundingClientRect()),this.place(e)};t.addEventListener("pointermove",a),t.addEventListener("pointerup",l),t.addEventListener("pointercancel",l)})}place(e){let t=this.dragged;if(!t){e.style.left=e.style.right=e.style.top=e.style.bottom="";return}Ke(e,t,e.offsetWidth||380,e.offsetHeight||240)}placeLauncher(e){if(!this.launcherAt){e.style.left=e.style.right=e.style.top=e.style.bottom="";return}Ke(e,this.launcherAt,e.offsetWidth||120,e.offsetHeight||36)}watchLauncher(){let e=()=>{let t=this.root.querySelector(".launcher");t&&this.mode==="idle"&&this.state==="ready"&&this.placeLauncher(t)};window.addEventListener("resize",e),this.detach.push(()=>window.removeEventListener("resize",e))}movableLauncher(e){e.addEventListener("pointerdown",t=>{if(this.swallowClick=!1,t.button!==0)return;let o=e.getBoundingClientRect(),r=t.clientX-o.left,i=t.clientY-o.top,s=!1;e.setPointerCapture(t.pointerId);let a=c=>{if(!s){if(Math.hypot(c.clientX-t.clientX,c.clientY-t.clientY)<Xe)return;s=!0,e.classList.add("launcher--dragging")}e.style.left=`${P(c.clientX-r,0,window.innerWidth-o.width)}px`,e.style.top=`${P(c.clientY-i,0,window.innerHeight-o.height)}px`,e.style.right="auto",e.style.bottom="auto"},l=()=>{e.hasPointerCapture(t.pointerId)&&e.releasePointerCapture(t.pointerId),e.removeEventListener("pointermove",a),e.removeEventListener("pointerup",l),e.removeEventListener("pointercancel",l),s&&(e.classList.remove("launcher--dragging"),this.launcherAt=Ve(e.getBoundingClientRect()),rn(this.launcherAt),this.placeLauncher(e),this.swallowClick=!0)};e.addEventListener("pointermove",a),e.addEventListener("pointerup",l),e.addEventListener("pointercancel",l)})}render(){var o;let e=this.root.getElementById("layer");if((o=this.unmark)==null||o.call(this),this.cancelAdding=null,e.innerHTML="",this.mode==="idle"){if(this.state==="pending"){e.appendChild(this.pending());return}let r=this.launcher();e.appendChild(r),this.placeLauncher(r);return}if(this.mode==="sent"){this.dragged=null,e.appendChild(this.sent());return}if(this.mode==="picking"){e.appendChild(this.picker());return}let t=this.composer();e.appendChild(t),this.place(t),this.markPins(e)}pending(){let e=document.createElement("div");return e.className="launcher launcher--pending",e.setAttribute("role","status"),e.textContent="Feedback access pending approval",e}sent(){var l;let e=document.createElement("div");e.className="panel panel--sent",e.setAttribute("role","status");let t=this.reference,o=this.uploadsFailed;e.innerHTML=`
|
|
6
6
|
<div class="sent__tick" aria-hidden="true">✓</div>
|
|
7
7
|
<div class="sent__body">
|
|
8
8
|
<div class="panel__title">Thank you \u2014 that is on its way.</div>
|
|
9
9
|
${t?`<div class="sent__ref">
|
|
10
|
-
<code class="sent__id">${
|
|
10
|
+
<code class="sent__id">${J(t)}</code>
|
|
11
11
|
<button type="button" class="sent__copy" data-copy>Copy</button>
|
|
12
12
|
</div>
|
|
13
13
|
<div class="panel__anchor">Quote it if you follow it up.</div>`:""}
|
|
14
14
|
${o>0?`<div class="sent__warn">${o===1?"One attachment could not be uploaded.":`${o} attachments could not be uploaded.`} The report was filed without it.</div>`:""}
|
|
15
15
|
</div>
|
|
16
|
-
${t?'<button type="button" class="panel__close" data-dismiss aria-label="Dismiss">×</button>':""}`;let r=()=>{this.mode==="sent"&&(this.mode="idle",this.render())},i=window.setTimeout(r,o>0?2e4:t?12e3:6e3),s=()=>window.clearTimeout(i);if(this.detach.push(()=>window.clearTimeout(i)),this.contain(e),this.place(e),!t)return e;e.addEventListener("pointerenter",s),e.addEventListener("focusin",s),(
|
|
16
|
+
${t?'<button type="button" class="panel__close" data-dismiss aria-label="Dismiss">×</button>':""}`;let r=()=>{this.mode==="sent"&&(this.mode="idle",this.render())},i=window.setTimeout(r,o>0?2e4:t?12e3:6e3),s=()=>window.clearTimeout(i);if(this.detach.push(()=>window.clearTimeout(i)),this.contain(e),this.place(e),!t)return e;e.addEventListener("pointerenter",s),e.addEventListener("focusin",s),(l=e.querySelector("[data-dismiss]"))==null||l.addEventListener("click",r);let a=e.querySelector("[data-copy]");return a&&(a.onclick=async()=>{s();let c=await nn(t);a.textContent=c?"Copied":"Copy failed",a.classList.toggle("sent__copy--done",c)}),e}launcher(){var t,o;let e=tt(this.buttonStyle,(t=this.launcherLabel)!=null?t:"Feedback");return e.title=(this.options.hotkey===null?"Report a problem":`Report a problem (${((o=this.options.hotkey)!=null?o:"f").toUpperCase()})`)+" \xB7 drag to move",e.onclick=()=>{if(this.swallowClick){this.swallowClick=!1;return}this.mode="picking",this.render()},this.movableLauncher(e),e}picker(e,t="Click the thing that is wrong",o=!1){let r=document.createElement("div");r.className=o?"mask mask--blur":"mask",r.innerHTML=`<div class="${o?"hover hover--blur":"hover"}" hidden></div><div class="hint">${J(t)} \xB7 <kbd>Esc</kbd> to cancel</div>`;let i=r.querySelector(".hover"),s=null,a=null,l=!1,c=m=>{let h=this.origin();i.hidden=!1,i.style.left=`${m.left-h.left}px`,i.style.top=`${m.top-h.top}px`,i.style.width=`${m.width}px`,i.style.height=`${m.height}px`};if(o){let m=f=>({left:Math.min(a.x,f.clientX),top:Math.min(a.y,f.clientY),width:Math.abs(f.clientX-a.x),height:Math.abs(f.clientY-a.y)});r.addEventListener("pointerdown",f=>{f.button===0&&(a={x:f.clientX,y:f.clientY},r.setPointerCapture(f.pointerId))}),r.addEventListener("pointermove",f=>{a&&(!s&&Math.hypot(f.clientX-a.x,f.clientY-a.y)<Xe||(s=m(f),c(s)))});let h=f=>{r.hasPointerCapture(f.pointerId)&&r.releasePointerCapture(f.pointerId);let g=s;a=null,s=null,!(!g||f.type==="pointercancel")&&(l=!0,e==null||e(cn(g)))};r.addEventListener("pointerup",h),r.addEventListener("pointercancel",h)}let d=(m,h)=>{r.style.pointerEvents="none";let f=document.elementFromPoint(m,h);return r.style.pointerEvents="",f},p=0;return r.onmousemove=m=>{if(p||s)return;let{clientX:h,clientY:f}=m;p=requestAnimationFrame(()=>{if(p=0,s)return;let g=d(h,f);if(!g||g===document.body||g===document.documentElement){i.hidden=!0;return}let x=g.getBoundingClientRect();c({left:x.left,top:x.top,width:x.width,height:x.height})})},r.onclick=m=>{if(l){l=!1;return}r.style.pointerEvents="none";let h=ln(m.clientX,m.clientY);if(r.style.pointerEvents="",o){if(!h.element)return;e==null||e({...h,anchor:{...h.anchor,elementText:null}});return}if(e){e(h);return}this.pins=[h],this.blurs=[],this.mode="composing",this.render()},r}composer(){var ue,me,fe;let e=document.createElement("div");e.className="panel";let t=Ye(this.pins),o=this.capture();e.innerHTML=`
|
|
17
17
|
<div class="panel__head" id="head">
|
|
18
18
|
<span class="panel__grip" aria-hidden="true">\u283F</span>
|
|
19
19
|
<div class="panel__heading">
|
|
20
|
-
<div class="panel__anchor">${
|
|
20
|
+
<div class="panel__anchor">${J(t)}</div>
|
|
21
21
|
<div class="panel__title">Report a problem</div>
|
|
22
22
|
</div>
|
|
23
23
|
<button id="close" class="panel__close" aria-label="Close">×</button>
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
what somebody came here to do is type.
|
|
35
35
|
-->
|
|
36
36
|
<div class="panel__kinds">
|
|
37
|
-
${["bug","idea","praise","question"].map((u,
|
|
37
|
+
${["bug","idea","praise","question"].map((u,y)=>`<button class="kind${y===0?" kind--on":""}" data-kind="${u}">${u}</button>`).join("")}
|
|
38
38
|
</div>
|
|
39
39
|
|
|
40
40
|
<input id="email" type="email" placeholder="Email (optional, so we can reply)" autocomplete="email" />
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
<span class="panel__note">Sends this page's contents, your browser, and recent errors.</span>
|
|
61
61
|
<button id="cancel" class="ghost">Cancel</button>
|
|
62
62
|
<button id="send" class="primary">Send</button>
|
|
63
|
-
</div>`;let r=[],i=e.querySelector("#files"),s=e.querySelector("#drop"),a=e.querySelector("#file"),
|
|
63
|
+
</div>`;let r=[],i=e.querySelector("#files"),s=e.querySelector("#drop"),a=e.querySelector("#file"),l=()=>{i.innerHTML="",r.forEach((u,y)=>{var S;let b=document.createElement("div");b.className=u.error?"file file--bad":"file",b.innerHTML=u.preview?`<img src="${u.preview}" alt="" />`:'<span class="file__icon">\u25A6</span>';let k=document.createElement("span");k.className="file__name",k.textContent=(S=u.error)!=null?S:u.filename,b.appendChild(k);let v=document.createElement("button");v.className="link",v.textContent="\xD7",v.onclick=()=>{Z([u]),r.splice(y,1),l()},b.appendChild(v),i.appendChild(b)}),s.style.display=r.length>=5?"none":""},c=u=>{r.push(...ze(u,r.length)),l()};a.onchange=()=>{a.files&&c(a.files)},e.querySelector("#browse").onclick=()=>a.click(),e.addEventListener("paste",u=>{let y=je(u);y.length>0&&(u.preventDefault(),c(y))}),s.addEventListener("dragover",u=>{u.preventDefault(),s.classList.add("drop--over")}),s.addEventListener("dragleave",()=>s.classList.remove("drop--over")),s.addEventListener("drop",u=>{var y,b;u.preventDefault(),s.classList.remove("drop--over"),c(Array.from((b=(y=u.dataTransfer)==null?void 0:y.files)!=null?b:[]))});let d="bug";e.querySelectorAll(".kind").forEach(u=>{u.onclick=()=>{var y;d=(y=u.dataset.kind)!=null?y:"bug",e.querySelectorAll(".kind").forEach(b=>b.classList.remove("kind--on")),u.classList.add("kind--on")}});let p=e.querySelector("#pins"),m=e.querySelector(".panel__anchor"),h=()=>{var y;m.textContent=Ye(this.pins),p.innerHTML="",this.pins.length>1&&this.pins.forEach((b,k)=>{var ge;let v=document.createElement("div");v.className="pin";let S=document.createElement("span");S.className="pin__n",S.textContent=String(k+1),v.appendChild(S);let A=document.createElement("span");A.className="pin__label",A.textContent=Ge(b.anchor),A.title=(ge=b.anchor.page)!=null?ge:"",v.appendChild(A);let E=document.createElement("button");E.className="link",E.textContent="\xD7",E.setAttribute("aria-label",`Remove pin ${k+1}`),E.onclick=()=>{this.pins.splice(k,1),h()},v.appendChild(E),p.appendChild(v)}),this.blurs.forEach((b,k)=>{let v=document.createElement("div");v.className="pin";let S=document.createElement("span");S.className="pin__n pin__n--blur",S.textContent=String(k+1),v.appendChild(S);let A=document.createElement("span");A.className="pin__label",A.textContent=dn(b),v.appendChild(A);let E=document.createElement("button");E.className="link",E.textContent="\xD7",E.setAttribute("aria-label",`Remove blur ${k+1}`),E.onclick=()=>{this.blurs.splice(k,1),h()},v.appendChild(E),p.appendChild(v)});let u=document.createElement("div");if(u.className="pins__actions",this.pins.length<sn){let b=document.createElement("button");b.className="link pins__add",b.id="add-pin",b.textContent=this.pins.length>0?"+ Add another pin":"+ Pin something on the page",b.onclick=()=>this.pickAnother(e,h),u.appendChild(b)}if(this.blurs.length<an){let b=document.createElement("button");b.className="link pins__add",b.id="add-blur",b.textContent=this.blurs.length>0?"Blur something else":"Blur something",b.title="Hide part of the page from the screenshot and the page snapshot",b.onclick=()=>this.pickAnother(e,h,!0),u.appendChild(b)}u.childElementCount>0&&p.appendChild(u),(y=this.redrawMarks)==null||y.call(this)};h();let f=e.querySelector("#message"),g=e.querySelector("#email"),x=(fe=(ue=this.reporter)==null?void 0:ue.email)!=null?fe:(me=this.options.reporter)==null?void 0:me.email;x&&!g.value&&(g.value=x);let T=e.querySelector("#shot"),C=e.querySelector("#status"),R=e.querySelector("#send"),pe=()=>{Z(r),this.mode="idle",this.pins=[],this.blurs=[],this.dragged=null,this.render()};e.querySelector("#cancel").onclick=pe,e.querySelector("#close").onclick=pe;let he=async()=>{var u;if(!f.value.trim()){C.textContent="Say what happened first.";return}R.disabled=!0,C.textContent="Sending\u2026";try{let y=await this.onSubmit({message:f.value.trim(),kind:d,email:g.value.trim()||void 0,anchors:this.pins.map(b=>this.sendable(b)),withScreenshot:(u=T==null?void 0:T.checked)!=null?u:!1,files:r.filter(b=>!b.error)});this.reference=y.reference,this.uploadsFailed=y.uploadsFailed,Z(r),this.mode="sent",this.pins=[],this.blurs=[],this.render()}catch(y){R.disabled=!1,C.textContent=y instanceof Error?`${y.message} \u2014 saved, will retry.`:"Failed, saved and will retry."}};return R.onclick=he,f.onkeydown=u=>{(u.metaKey||u.ctrlKey)&&u.key==="Enter"&&he()},setTimeout(()=>f.focus(),0),this.contain(e),this.movable(e,e.querySelector("#head")),e}contain(e){for(let t of["pointerdown","mousedown","click"])e.addEventListener(t,o=>o.stopPropagation())}};async function nn(n){var t;try{if((t=navigator.clipboard)!=null&&t.writeText)return await navigator.clipboard.writeText(n),!0}catch{}let e=document.createElement("textarea");e.value=n,e.setAttribute("readonly",""),e.style.cssText="position:fixed;top:0;left:0;width:1px;height:1px;opacity:0",document.body.appendChild(e);try{return e.select(),document.execCommand("copy")}catch{return!1}finally{e.remove()}}var w=16,_=3,De=["focus","focusin","mousedown","touchstart","click"],Xe=5,Je="daybook-feedback:launcher";function on(){var n;try{let e=JSON.parse((n=localStorage.getItem(Je))!=null?n:"null");if(e&&(e.h==="left"||e.h==="right")&&(e.v==="top"||e.v==="bottom")&&Number.isFinite(e.dx)&&Number.isFinite(e.dy))return{h:e.h,v:e.v,dx:e.dx,dy:e.dy}}catch{}return null}function rn(n){try{localStorage.setItem(Je,JSON.stringify(n))}catch{}}function Ke(n,e,t,o){let r=P(e.dx,w,Math.max(w,window.innerWidth-t-w)),i=P(e.dy,w,Math.max(w,window.innerHeight-o-w));n.style.left=e.h==="left"?`${r}px`:"auto",n.style.right=e.h==="right"?`${r}px`:"auto",n.style.top=e.v==="top"?`${i}px`:"auto",n.style.bottom=e.v==="bottom"?`${i}px`:"auto"}var sn=10,an=10;function O(){return location.pathname+location.search}function ln(n,e){let t=V(n,e),o=document.elementFromPoint(n,e),r=o&&o!==document.body&&o!==document.documentElement?o:null,i=r==null?void 0:r.getBoundingClientRect(),s=i&&i.width>=1&&i.height>=1?{left:i.left+window.scrollX,top:i.top+window.scrollY,width:i.width,height:i.height}:{left:n-12+window.scrollX,top:e-12+window.scrollY,width:24,height:24};return{anchor:t,element:r,box:s}}function cn(n){return{anchor:{selector:null,offsetX:0,offsetY:0,elementText:null,page:O()},element:null,box:{left:n.left+window.scrollX,top:n.top+window.scrollY,width:n.width,height:n.height}}}function dn(n){let e=`${Math.round(n.box.width)} \xD7 ${Math.round(n.box.height)}`;return`${n.element?"Blurred element":"Blurred area"} \xB7 ${e}`}function We(n,e,t,o){let r=o?2:0,i=document.createElement("div");if(i.className=o?"veil veil--secret":"veil",i.style.left=`${n.left-e.left-r}px`,i.style.top=`${n.top-e.top-r}px`,i.style.width=`${n.width+r*2}px`,i.style.height=`${n.height+r*2}px`,t&&n.width>=72&&n.height>=22){let s=document.createElement("span");s.className="veil__tag",s.textContent=t,i.appendChild(s)}return i}function Ge(n){return n.elementText?`\u201C${n.elementText}\u201D`:n.selector&&n.selector!=="body"?n.selector:"a spot on the page"}function Ye(n){if(n.length===0)return"on this page";let[e]=n;if(!e)return"on this page";let t=`on ${Ge(e.anchor)}`;return n.length===1?t:`${t} and ${n.length-1} more`}var de=56;function Ve(n){let e={left:n.left,right:window.innerWidth-n.right,top:n.top,bottom:window.innerHeight-n.bottom},t=Object.keys(e).reduce((i,s)=>e[s]<e[i]?s:i),o=t==="left"||t==="right"?t:e.left<=e.right?"left":"right",r=t==="top"||t==="bottom"?t:e.top<=e.bottom?"top":"bottom";return{h:o,v:r,dx:t===o?w:Math.max(w,Math.round(e[o])),dy:t===r?w:Math.max(w,Math.round(e[r]))}}function P(n,e,t){return Math.min(Math.max(n,e),t)}function J(n){return n.replace(/[&<>"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[e])}function pn(n){return typeof n=="string"&&/^(#[0-9a-f]{3,8}|rgba?\([\d\s.,%/]+\)|hsla?\([\d\s.,%/deg]+\)|[a-z]{3,20})$/i.test(n.trim())}var Ze='<svg class="launcher__icon" viewBox="0 0 16 16" fill="none" aria-hidden="true"><path d="M2 6.2C2 4.4 3.4 3 5.2 3h5.6C12.6 3 14 4.4 14 6.2v2.6c0 1.8-1.4 3.2-3.2 3.2H7l-3 2.4v-2.5A3.2 3.2 0 0 1 2 8.8V6.2Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/></svg>';function Qe(n){var o;let e=[];pn(n.accent)&&e.push(`--pm-accent: ${n.accent}`);let t={none:"0",sm:"6px",md:"12px",lg:"18px"}[(o=n.cornerRadius)!=null?o:"md"];return t&&e.push(`--pm-radius: ${t}`),n.colorScheme==="dark"?e.push(rt):n.colorScheme==="light"&&e.push(ot),e.length>0?`:host { ${e.join("; ")} }`:""}var et=n=>hn.includes(n.buttonStyle)?n.buttonStyle:"pill";function tt(n,e){let t=document.createElement("button");return t.className=`launcher launcher--${n}`,n==="icon"?(t.innerHTML=Ze,t.setAttribute("aria-label",e)):n==="pill-icon"?t.innerHTML=`${Ze}<span>${J(e)}</span>`:t.textContent=e,t}function nt(n,e={}){var i;let t=(i=n.shadowRoot)!=null?i:n.attachShadow({mode:"open"}),o=typeof e.launcherLabel=="string"&&e.launcherLabel.length>0?e.launcherLabel.slice(0,24):"Feedback";t.innerHTML=`<style>${it}</style><style>${Qe(e)}</style>`;let r=tt(et(e),o);r.classList.add("launcher--preview"),r.disabled=!0,t.appendChild(r)}var hn=["pill","pill-icon","icon","text","outline"],ot="--pm-surface: #fff; --pm-ink: #171717; --pm-muted: #525252; --pm-faint: #a3a3a3; --pm-line: #e5e5e5; --pm-line-strong: #d4d4d4; --pm-sunken: #f5f5f5; --pm-kbd: #404040; --pm-warn: #b45309; --pm-good: #047857; --pm-good-bg: #ecfdf5; --pm-good-line: #a7f3d0; --pm-accent: #171717; --pm-on-accent: #fafafa;",rt="--pm-surface: #1c1c1c; --pm-ink: #fafafa; --pm-muted: #a3a3a3; --pm-faint: #737373; --pm-line: #333; --pm-line-strong: #454545; --pm-sunken: #262626; --pm-kbd: #d4d4d4; --pm-warn: #fbbf24; --pm-good: #34d399; --pm-good-bg: #05271f; --pm-good-line: #065f46; --pm-accent: #fafafa; --pm-on-accent: #171717;",it=`
|
|
64
64
|
/*
|
|
65
65
|
Every colour in this file is one of these, and there are two sets of them.
|
|
66
66
|
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
:host {
|
|
83
83
|
all: initial;
|
|
84
84
|
|
|
85
|
-
${
|
|
85
|
+
${ot}
|
|
86
86
|
|
|
87
87
|
--pm-radius: 12px;
|
|
88
88
|
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
@media (prefers-color-scheme: dark) {
|
|
98
|
-
:host { ${
|
|
98
|
+
:host { ${rt} }
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
* { box-sizing: border-box; font-family: system-ui, -apple-system, sans-serif }
|
|
@@ -112,6 +112,9 @@
|
|
|
112
112
|
background: var(--pm-accent); color: var(--pm-on-accent); font-size: 13px; font-weight: 500;
|
|
113
113
|
box-shadow: 0 2px 12px rgba(0,0,0,.3);
|
|
114
114
|
}
|
|
115
|
+
/* Dragged to move (PM-B-0121); touch-action:none or a touch drag is claimed by page scrolling. */
|
|
116
|
+
.launcher { touch-action: none; user-select: none }
|
|
117
|
+
.launcher--dragging { transition: none; cursor: grabbing; box-shadow: 0 8px 24px rgba(0,0,0,.35) }
|
|
115
118
|
.launcher:hover { filter: brightness(1.15) }
|
|
116
119
|
.launcher--pending { cursor: default; opacity: .85 }
|
|
117
120
|
.launcher--pending:hover { filter: none }
|
|
@@ -186,6 +189,47 @@
|
|
|
186
189
|
position: fixed; pointer-events: none; border-radius: 3px;
|
|
187
190
|
border: 2px solid #ef4444; box-shadow: 0 0 0 2px rgba(255,255,255,.85);
|
|
188
191
|
}
|
|
192
|
+
/*
|
|
193
|
+
A blur (PM-T-0682): the reporter's, on the page while they write and in the picture after.
|
|
194
|
+
|
|
195
|
+
A backdrop filter, so it blurs what is painted under it and touches nothing of the host's. The grey
|
|
196
|
+
tint and the hairline make it read as a cover rather than as a page that failed to render. Neutral,
|
|
197
|
+
not red: red on this layer means "this is what the report is about", and a blur means the opposite.
|
|
198
|
+
*/
|
|
199
|
+
.veil {
|
|
200
|
+
position: fixed; pointer-events: none; border-radius: 3px;
|
|
201
|
+
-webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
|
|
202
|
+
background: rgba(115,115,115,.35);
|
|
203
|
+
box-shadow: inset 0 0 0 1px rgba(255,255,255,.55), 0 0 0 1px rgba(23,23,23,.3);
|
|
204
|
+
}
|
|
205
|
+
/*
|
|
206
|
+
Solid where nothing can be blurred behind an element: a cover that shows what it covers is worse
|
|
207
|
+
than a grey box. That is Firefox before 103 and Chrome before 76, which say so.
|
|
208
|
+
|
|
209
|
+
One engine has been seen to claim it and not draw it \u2014 WebKit's Windows port, which no shipping
|
|
210
|
+
browser uses \u2014 and the preview there is a tint over legible text. It has no getDisplayMedia, so it
|
|
211
|
+
never takes a picture; the snapshot does not depend on any of this; and an element blur is also
|
|
212
|
+
blurred on the element itself for the frame (screenshot.ts). Checked drawing in Chromium.
|
|
213
|
+
*/
|
|
214
|
+
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
|
|
215
|
+
.veil { background: #8a8a8a }
|
|
216
|
+
}
|
|
217
|
+
/* Over a credential the capture found: solid, because a blurred key of a known shape can sometimes be
|
|
218
|
+
read back, and nobody needs its shape to understand the report. */
|
|
219
|
+
.veil--secret { background: #737373; box-shadow: none; border-radius: 2px }
|
|
220
|
+
.veil__tag {
|
|
221
|
+
position: absolute; right: 3px; bottom: 3px; padding: 0 5px; border-radius: 4px;
|
|
222
|
+
background: rgba(23,23,23,.72); color: #fff; font: 600 10px/16px system-ui, sans-serif;
|
|
223
|
+
white-space: nowrap;
|
|
224
|
+
}
|
|
225
|
+
/* What a click would blur, blurred already: the reporter sees the result before committing to it. */
|
|
226
|
+
.hover--blur {
|
|
227
|
+
outline-color: #525252;
|
|
228
|
+
-webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
|
|
229
|
+
background: rgba(115,115,115,.25);
|
|
230
|
+
}
|
|
231
|
+
/* A touch drag draws the area rather than scrolling the page underneath it. */
|
|
232
|
+
.mask--blur { touch-action: none }
|
|
189
233
|
/*
|
|
190
234
|
Bottom, not top.
|
|
191
235
|
|
|
@@ -239,6 +283,8 @@ kbd {
|
|
|
239
283
|
font: 600 11px/18px system-ui, sans-serif; text-align: center;
|
|
240
284
|
}
|
|
241
285
|
.pin__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
286
|
+
.pin__n--blur { background: #737373 }
|
|
287
|
+
.pins__actions { display: flex; flex-wrap: wrap; gap: 4px 14px }
|
|
242
288
|
.pins__add { align-self: flex-start; font-size: 12px; }
|
|
243
289
|
.panel__anchor {
|
|
244
290
|
color: var(--pm-muted); font-size: 11px;
|
|
@@ -337,4 +383,4 @@ textarea:focus, input:focus { outline: 2px solid var(--pm-ink); outline-offset:
|
|
|
337
383
|
.file__icon { width: 28px; text-align: center }
|
|
338
384
|
.file__name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
|
|
339
385
|
.link { border: 0; background: transparent; color: var(--pm-muted); cursor: pointer; font-size: 11px; text-decoration: underline }
|
|
340
|
-
`;var
|
|
386
|
+
`;var st="https://api.daybook.team",Q=class{constructor(e){this.options=e;this.widget=null;this.started=!1;this.inFlight=null;this.epoch=0;this.ready=null;this.stopped=!1;var t;if(!e.ingestKey)throw new Error("ingestKey is required");this.client=new q((t=e.apiUrl)!=null?t:st,e.ingestKey),this.trail=e.breadcrumbs===!1?null:new j(40,e.redact!==!1)}start(){var e;return this.stopped=!1,(e=this.trail)==null||e.start(),this.mount(),this.started||(this.started=!0,this.client.flush()),this.handshake(),this}mount(){this.widget||this.stopped||(this.widget=new G(this.options,e=>this.submit(e)),this.widget.setReporter(this.options.reporter),this.widget.mount())}handshake(){var o,r,i;let e=JSON.stringify([(o=this.options.reporter)!=null?o:null,(r=this.options.signature)!=null?r:null,this.epoch]);if(((i=this.inFlight)==null?void 0:i.key)===e)return this.inFlight.promise;let t=this.runHandshake().finally(()=>{var s;((s=this.inFlight)==null?void 0:s.promise)===t&&(this.inFlight=null)});return this.inFlight={key:e,promise:t},t}async runHandshake(){var e,t,o,r,i,s,a;try{let l=await this.client.handshake({identity:this.options.reporter,signature:this.options.signature,locale:typeof navigator!="undefined"?navigator.language:void 0,sdk:{name:"js",version:B}});if(this.ready=l,(t=(e=this.options).onReady)==null||t.call(e,l),l.reporterStatus==="Blocked"){(o=this.widget)==null||o.unmount(),this.widget=null;return}this.mount();let c=this.widget;if(!c)return;c.setTheme(fn(l.theme)),c.setPolicy((r=l.policy)!=null?r:null),c.setState(l.reporterStatus==="Pending"?"pending":"ready")}catch(l){(s=(i=this.options).onError)==null||s.call(i,l),console.warn("[feedback] handshake failed; the widget will not appear",l),(a=this.widget)==null||a.unmount(),this.widget=null}}identify(e){var t;this.options={...this.options,reporter:e?{...this.options.reporter,...e}:void 0},(t=this.widget)==null||t.setReporter(this.options.reporter),this.widget&&this.handshake()}async signIn(){await this.client.signIn(),this.epoch++,await this.handshake()}authenticate(e){this.options={...this.options,signature:e!=null?e:void 0},this.widget&&this.handshake()}stop(){var e,t;this.started=!1,this.stopped=!0,(e=this.trail)==null||e.stop(),(t=this.widget)==null||t.unmount(),this.widget=null}open(){var e;(e=this.widget)==null||e.open()}async report(e,t={}){var o,r,i;return this.client.send({message:e,surface:this.options.surface,...t,context:{...se({breadcrumbs:(o=this.trail)==null?void 0:o.list(),app:this.options.app,redact:this.options.redact!==!1}),...(r=t.context)!=null?r:{}},reporter:(i=t.reporter)!=null?i:this.options.reporter})}async submit(e){var d,p,m,h,f;let t=this.options.redact!==!1,o=()=>{var g,x;return(x=(g=this.widget)==null?void 0:g.blurred())!=null?x:{elements:[],regions:[]}},r=o(),i=e.withScreenshot?await Ce(t,g=>{var x,T;return(T=(x=this.widget)==null?void 0:x.conceal(g))!=null?T:(()=>{})},r.elements):null,s=this.options.dom===!1?null:Ne(e.anchors,t,o()),a=[...e.files,...i?[i]:[],...s?[un(s)]:[]],l={message:e.message,kind:e.kind,app:this.options.app,surface:this.options.surface,reporter:e.email?{...this.options.reporter,email:e.email}:this.options.reporter,context:se({anchors:e.anchors,breadcrumbs:(d=this.trail)==null?void 0:d.list(),app:this.options.app,redact:t,withheld:{blurredByReporter:r.elements.length+r.regions.length,secretsMasked:{...i?{screenshot:i.secretsMasked}:{},...s?{snapshot:s.secretsMasked}:{}}}})},c=[];try{let g=await this.client.send(l,a,(x,T)=>{var C,R;c.push(T),console.warn(`[feedback] "${x.filename}" did not upload`,T),(R=(C=this.options).onError)==null||R.call(C,T)});return g.uploadsFailed=c.length,(m=(p=this.options).onSent)==null||m.call(p,g),{reference:g.reference,uploadsFailed:c.length}}catch(g){throw this.client.queue(l),(f=(h=this.options).onError)==null||f.call(h,g),g}}};function un(n){let e=JSON.stringify(n);return{blob:new Blob([e],{type:"application/json"}),filename:"page-snapshot.json",contentType:"application/json"}}function mn(n){return new Q(n).start()}function fn(n){if(!n)return null;try{let e=JSON.parse(n);return e&&typeof e=="object"?e:null}catch{return null}}return ht(gn);})();
|
package/dist/index.js
CHANGED
|
@@ -248,19 +248,29 @@ export class DaybookFeedback {
|
|
|
248
248
|
surface: this.options.surface,
|
|
249
249
|
...extra,
|
|
250
250
|
context: {
|
|
251
|
-
...captureContext({
|
|
251
|
+
...captureContext({
|
|
252
|
+
breadcrumbs: this.trail?.list(),
|
|
253
|
+
app: this.options.app,
|
|
254
|
+
redact: this.options.redact !== false,
|
|
255
|
+
}),
|
|
252
256
|
...(extra.context ?? {}),
|
|
253
257
|
},
|
|
254
258
|
reporter: extra.reporter ?? this.options.reporter,
|
|
255
259
|
});
|
|
256
260
|
}
|
|
257
261
|
async submit(input) {
|
|
262
|
+
const redact = this.options.redact !== false;
|
|
263
|
+
// What the reporter blurred (PM-T-0682). Applied to both captures whatever `redact` says — it is
|
|
264
|
+
// their decision, made while looking at the page — and asked for again before each, because the
|
|
265
|
+
// screen share's prompt can be up for a while and an element's box with it.
|
|
266
|
+
const blurred = () => this.widget?.blurred() ?? { elements: [], regions: [] };
|
|
267
|
+
const blurs = blurred();
|
|
258
268
|
// The reporter's tick is the answer. It used to be second-guessed here against
|
|
259
269
|
// options.screenshots, so a host that set `screenshots: false` still rendered the checkbox and
|
|
260
270
|
// then quietly ignored it — the widget now simply does not offer the control in that case, and
|
|
261
271
|
// what arrives here is a decision somebody actually made.
|
|
262
272
|
const screenshot = input.withScreenshot
|
|
263
|
-
? await captureScreenshot(
|
|
273
|
+
? await captureScreenshot(redact, cover => this.widget?.conceal(cover) ?? (() => { }), blurs.elements)
|
|
264
274
|
: null;
|
|
265
275
|
/*
|
|
266
276
|
* The page itself, as markup rather than as a picture.
|
|
@@ -276,7 +286,7 @@ export class DaybookFeedback {
|
|
|
276
286
|
*/
|
|
277
287
|
const snapshot = this.options.dom === false
|
|
278
288
|
? null
|
|
279
|
-
: captureSnapshot(input.anchors,
|
|
289
|
+
: captureSnapshot(input.anchors, redact, blurred());
|
|
280
290
|
/*
|
|
281
291
|
* Order matters, because the server takes the first five and drops the rest without saying so.
|
|
282
292
|
*
|
|
@@ -302,6 +312,14 @@ export class DaybookFeedback {
|
|
|
302
312
|
anchors: input.anchors,
|
|
303
313
|
breadcrumbs: this.trail?.list(),
|
|
304
314
|
app: this.options.app,
|
|
315
|
+
redact,
|
|
316
|
+
withheld: {
|
|
317
|
+
blurredByReporter: blurs.elements.length + blurs.regions.length,
|
|
318
|
+
secretsMasked: {
|
|
319
|
+
...(screenshot ? { screenshot: screenshot.secretsMasked } : {}),
|
|
320
|
+
...(snapshot ? { snapshot: snapshot.secretsMasked } : {}),
|
|
321
|
+
},
|
|
322
|
+
},
|
|
305
323
|
}),
|
|
306
324
|
};
|
|
307
325
|
const failures = [];
|