@qaiddev/thumbs-embed 1.15.0 → 1.16.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/README.md +6 -5
- package/dist/chunks/{annotate-967WMR9g.js → annotate-G6jz7v3f.js} +2 -2
- package/dist/chunks/{annotate-967WMR9g.js.map → annotate-G6jz7v3f.js.map} +1 -1
- package/dist/chunks/core-Cl_qkUzb.js +26 -0
- package/dist/chunks/core-Cl_qkUzb.js.map +1 -0
- package/dist/chunks/{modal-cN3Y_wyj.js → modal-CnwTJf_B.js} +2 -2
- package/dist/chunks/{modal-cN3Y_wyj.js.map → modal-CnwTJf_B.js.map} +1 -1
- package/dist/chunks/{recording-Dc1S81yJ.js → recording-D0vRDckg.js} +2 -2
- package/dist/chunks/{recording-Dc1S81yJ.js.map → recording-D0vRDckg.js.map} +1 -1
- package/dist/chunks/{send-Bh4qEAt2.js → send-DqRUNsT8.js} +2 -2
- package/dist/chunks/{send-Bh4qEAt2.js.map → send-DqRUNsT8.js.map} +1 -1
- package/dist/chunks/{targeting-DfTc3n-D.js → targeting-QHJXTusT.js} +2 -2
- package/dist/chunks/{targeting-DfTc3n-D.js.map → targeting-QHJXTusT.js.map} +1 -1
- package/dist/embed.d.ts +8 -0
- package/dist/embed.js +1 -1
- package/dist/error-reporting.d.ts +41 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1852 -1722
- package/dist/index.js.map +1 -1
- package/dist/loader.js +1 -1
- package/dist/qaid.umd.cjs +15 -15
- package/dist/qaid.umd.cjs.map +1 -1
- package/dist/send.d.ts +2 -0
- package/dist/types.d.ts +19 -0
- package/package.json +1 -1
- package/dist/chunks/core-BgLzwZUg.js +0 -26
- package/dist/chunks/core-BgLzwZUg.js.map +0 -1
package/dist/send.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ import type { ResolvedFeedbackConfig, EmbedState, FeedbackData, SelectedBounds,
|
|
|
15
15
|
export interface SendHost {
|
|
16
16
|
readonly config: ResolvedFeedbackConfig;
|
|
17
17
|
readonly visitorId: string;
|
|
18
|
+
/** Per tab; the same id `captureErrors` sends. */
|
|
19
|
+
readonly sessionId: string;
|
|
18
20
|
/** Live references, filled in by the click or the targeting controller. */
|
|
19
21
|
readonly feedbackData: FeedbackData;
|
|
20
22
|
readonly selectedBounds: SelectedBounds;
|
package/dist/types.d.ts
CHANGED
|
@@ -192,6 +192,23 @@ export interface FeedbackConfig {
|
|
|
192
192
|
* what is here. Default: 3000.
|
|
193
193
|
*/
|
|
194
194
|
remoteTimeoutMs?: number;
|
|
195
|
+
/**
|
|
196
|
+
* Report this page's uncaught errors and unhandled promise rejections to
|
|
197
|
+
* qaid's error triage (an Enterprise feature), even when nobody leaves
|
|
198
|
+
* feedback. `true` sends them to `{endpoint origin}/api/errors`. Default: false.
|
|
199
|
+
*/
|
|
200
|
+
captureErrors?: boolean | CaptureErrorsConfig;
|
|
201
|
+
}
|
|
202
|
+
/** Options for `captureErrors`. */
|
|
203
|
+
export interface CaptureErrorsConfig {
|
|
204
|
+
/** Where errors go. Default: `/api/errors` beside `endpoint`. */
|
|
205
|
+
endpoint?: string;
|
|
206
|
+
/** Your build or commit id. */
|
|
207
|
+
release?: string;
|
|
208
|
+
/** e.g. `production` or `staging`. */
|
|
209
|
+
environment?: string;
|
|
210
|
+
/** 0–1: the share of pages that report. Default 1. */
|
|
211
|
+
sampleRate?: number;
|
|
195
212
|
}
|
|
196
213
|
/**
|
|
197
214
|
* A thumbs theme as served by `themeUrl`: the look, nothing that changes
|
|
@@ -321,6 +338,8 @@ export interface FeedbackPayload {
|
|
|
321
338
|
elementBounds?: ElementBounds | null;
|
|
322
339
|
/** User agent string for server-side rendering consistency */
|
|
323
340
|
userAgent?: string;
|
|
341
|
+
/** `sessionId` joins this report to the tab's reported errors. */
|
|
342
|
+
metadata?: Record<string, unknown>;
|
|
324
343
|
}
|
|
325
344
|
/**
|
|
326
345
|
* Response from the feedback API
|
package/package.json
CHANGED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
const tt=`<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
2
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="M14 10h4.764a2 2 0 011.789 2.894l-3.5 7A2 2 0 0115.263 21h-4.017c-.163 0-.326-.02-.485-.06L7 20m7-10V5a2 2 0 00-2-2h-.095c-.5 0-.905.405-.905.905 0 .714-.211 1.412-.608 2.006L7 11v9m7-10h-2M7 20H5a2 2 0 01-2-2v-6a2 2 0 012-2h2.5"/>
|
|
3
|
-
</svg>`,et=`<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
4
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="M10 14H5.236a2 2 0 01-1.789-2.894l3.5-7A2 2 0 018.737 3h4.018a2 2 0 01.485.06l3.76.94m-7 10v5a2 2 0 002 2h.095c.5 0 .905-.405.905-.905 0-.714.211-1.412.608-2.006L17 13V4m-7 10h2m5-10h2a2 2 0 012 2v6a2 2 0 01-2 2h-2.5"/>
|
|
5
|
-
</svg>`,ee=`<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
6
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 10.5l4.72-4.72a.75.75 0 011.28.53v11.38a.75.75 0 01-1.28.53l-4.72-4.72M4.5 18.75h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25h-9A2.25 2.25 0 002.25 7.5v9a2.25 2.25 0 002.25 2.25z"/>
|
|
7
|
-
</svg>`,ot=`<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
8
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="M8 10h8M8 14h5m-9 6l3.5-3.5H18a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v14z"/>
|
|
9
|
-
</svg>`,oe='<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M2 2l8 8M10 2l-8 8" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>',ie=`<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
10
|
-
<rect x="4" y="6" width="16" height="12" rx="1" stroke-linejoin="round"/>
|
|
11
|
-
</svg>`,ne=`<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
12
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="M5 19L19 5m0 0h-8m8 0v8"/>
|
|
13
|
-
</svg>`,se=`<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
14
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="M12 20h9M16.5 3.5a2.121 2.121 0 013 3L7 19l-4 1 1-4L16.5 3.5z"/>
|
|
15
|
-
</svg>`,ae=`<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
16
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="M12 3s6 6.4 6 10a6 6 0 01-12 0c0-3.6 6-10 6-10z"/>
|
|
17
|
-
</svg>`,re=`<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
18
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="M9 14L4 9l5-5M4 9h11a5 5 0 010 10h-4"/>
|
|
19
|
-
</svg>`,de=`<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
20
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="M20 6L9 17l-5-5"/>
|
|
21
|
-
</svg>`,le=`<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
22
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="M12 6v8m0 4h.01"/>
|
|
23
|
-
</svg>`,ce=`<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
24
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="M6 6l12 12M18 6L6 18"/>
|
|
25
|
-
</svg>`,ue="http://www.w3.org/2000/svg",it={};for(const e of["svg","g","path","circle","ellipse","rect","line","polyline","polygon","title","desc","defs","linearGradient","radialGradient","stop","clipPath"])it[e.toLowerCase()]=e;const nt={};for(const e of["viewBox","width","height","preserveAspectRatio","version","fill","fill-rule","fill-opacity","stroke","stroke-width","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-dasharray","stroke-dashoffset","stroke-opacity","clip-rule","clip-path","clipPathUnits","opacity","vector-effect","shape-rendering","d","points","x","y","x1","y1","x2","y2","cx","cy","r","rx","ry","fx","fy","transform","class","id","offset","stop-color","stop-opacity","gradientUnits","gradientTransform","spreadMethod","aria-hidden","aria-label","focusable","role"])nt[e.toLowerCase()]=e;const he=new Set(["title","desc"]),st=5e4,fe=1e3,pe={lt:"<",gt:">",amp:"&",quot:'"',apos:"'",nbsp:"\xA0"};function at(e){return e.replace(/&(#x[0-9a-f]+|#\d+|[a-z]+);/gi,(t,o)=>{if(o[0]==="#"){const i=o[1]==="x"||o[1]==="X"?parseInt(o.slice(2),16):parseInt(o.slice(1),10);return i>0&&i<=1114111?String.fromCodePoint(i):""}return pe[o.toLowerCase()]??t})}const rt=/url\(\s*(['"]?)#[A-Za-z_][\w.:-]*\1\s*\)/gi;function me(e,t){const o=t.replace(/[\u0000- \u007f-\u009f]+/g,"").toLowerCase();if(/(java|vb)script:|data:|expression\(/.test(o))return!1;const i=t.replace(rt,"");return/url\(/.test(i.replace(/[\u0000- \u007f-\u009f]+/g,"").toLowerCase())?!1:e==="clip-path"?/^\s*none\s*$/i.test(t)||new RegExp(`^\\s*${rt.source}\\s*$`,"i").test(t):!0}function dt(e){if(typeof e!="string"||typeof document>"u")return null;const t=e.trim();if(!t||t.length>st)return null;let o=null,i=!1,n=0;const a=[];let s=0;const d=()=>a[a.length-1];for(;s<t.length&&!i;){const f=t.indexOf("<",s),m=f===-1?t.length:f;if(m>s){const u=t.slice(s,m),p=d();if(p?.node&&he.has(p.name))p.node.appendChild(document.createTextNode(at(u)));else if(!p&&u.trim())return null}if(f===-1)break;if(s=f,t.startsWith("<!--",s)){const u=t.indexOf("-->",s+4);if(u===-1)return null;s=u+3;continue}if(t.startsWith("<?",s)){if(o)return null;const u=t.indexOf("?>",s+2);if(u===-1)return null;s=u+2;continue}if(t.startsWith("<!",s))return null;if(t[s+1]==="/"){const u=/^<\/\s*([A-Za-z][\w:.-]*)\s*>/.exec(t.slice(s,s+200));if(!u)return null;s+=u[0].length;const p=u[1].toLowerCase(),b=a.map(g=>g.name).lastIndexOf(p);b!==-1&&(a.length=b,b===0&&(i=!0));continue}const l=/^<([A-Za-z][\w:.-]*)/.exec(t.slice(s,s+200));if(!l)return null;const c=l[1].toLowerCase();s+=l[0].length;const h=[];let v=!1,C=!1;for(;s<t.length;){const u=/^\s*/.exec(t.slice(s,s+1e3))[0];if(s+=u.length,t.startsWith("/>",s)){v=!0,C=!0,s+=2;break}if(t[s]===">"){C=!0,s+=1;break}const p=/^([^\s=/>"'<]+)/.exec(t.slice(s,s+200));if(!p)return null;const b=p[1];s+=b.length;let g="";const E=/^\s*=\s*/.exec(t.slice(s,s+1e3));if(E){s+=E[0].length;const S=t[s];if(S==='"'||S==="'"){const k=t.indexOf(S,s+1);if(k===-1)return null;g=t.slice(s+1,k),s=k+1}else{const k=/^[^\s>]+/.exec(t.slice(s,s+st));if(!k)return null;g=k[0],g.endsWith("/")&&t[s+g.length]===">"&&(g=g.slice(0,-1)),s+=g.length}}h.push([b,at(g)])}if(!C||++n>fe)return null;const w=d();if(w){if(!w.node){v||a.push({name:c,node:null});continue}}else if(o||c!=="svg")return null;const A=it[c];if(!A){v||a.push({name:c,node:null});continue}const q=document.createElementNS(ue,A);for(const[u,p]of h){const b=nt[u.toLowerCase()];b&&me(b,p)&&q.setAttribute(b,p)}w?w.node.appendChild(q):o=q,v?w||(i=!0):a.push({name:c,node:q})}return o}function lt(e,t){return(e?dt(e):null)??dt(t)}function x(e,t,o){e.textContent="",e.appendChild(lt(t,o))}const be="button{cursor:pointer}.qaid-buttons{display:flex;gap:.5rem}.qaid-buttons.qaid-vertical{flex-direction:column}.qaid-buttons.qaid-auto-container{position:fixed;z-index:50}.qaid-buttons.qaid-auto-container.qaid-bottom-right{bottom:1rem;right:1rem}.qaid-buttons.qaid-auto-container.qaid-bottom-left{bottom:1rem;left:1rem}.qaid-buttons.qaid-auto-container.qaid-top-right{top:1rem;right:1rem}.qaid-buttons.qaid-auto-container.qaid-top-left{top:1rem;left:1rem}.qaid-buttons.qaid-incognito{opacity:0;transition:opacity .2s ease-in-out}.qaid-buttons.qaid-incognito:hover{opacity:1}.qaid-buttons.qaid-dismissed{display:none!important}.qaid-dismiss-btn{width:20px;height:20px;padding:0;border:none;border-radius:50%;background:#0006;color:#fff;display:flex;align-items:center;justify-content:center;align-self:center;opacity:0;transition:opacity .15s,background .15s;cursor:pointer;pointer-events:auto;-webkit-appearance:none;appearance:none}.qaid-dismiss-btn:hover{background:#0009}.qaid-buttons:hover .qaid-dismiss-btn{opacity:1}button.qaid-btn-structural{display:inline-flex;align-items:center;justify-content:center;cursor:pointer;-webkit-appearance:none;appearance:none}.qaid-icon{width:24px;height:24px}:where(button.qaid-btn-structural)>svg:where(:not(.qaid-icon):not([width])){width:var(--qaid-icon-size, 24px);height:var(--qaid-icon-size, 24px)}.qaid-btn-structural:not(:has(svg)),.qaid-btn:not(:has(svg)){font-size:var(--qaid-icon-size, 24px);line-height:1}.qaid-emoji-icon{font-size:var(--qaid-icon-size, 24px);line-height:1}.qaid-buttons,.qaid-buttons *,.qaid-modal-container,.qaid-modal-container *{cursor:pointer!important}.qaid-tooltip-wrapper{position:relative}.qaid-tooltip-text{position:fixed;padding:.5rem .75rem;background:#1f2937;color:#fff;font-size:var(--qaid-font-size, 16px);font-weight:600;border-radius:.5rem;white-space:nowrap;opacity:0;pointer-events:none;transition:opacity .15s;z-index:99999}.qaid-tooltip-text.qaid-tooltip-visible{opacity:1}button.qaid-btn-record:hover{background:#dc2626;color:#fff}button:focus-visible,textarea:focus-visible,a:focus-visible,[tabindex]:focus-visible,[role=button]:focus-visible{outline:2px solid var(--qaid-marker, #6365f1);outline-offset:2px}.qaid-buttons.qaid-incognito:focus-within{opacity:1}.qaid-buttons:focus-within .qaid-dismiss-btn,.qaid-dismiss-btn:focus-visible{opacity:1}.qaid-dismiss-btn{min-width:24px;min-height:24px}@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}@media(forced-colors:active){button:focus-visible,textarea:focus-visible,a:focus-visible,[tabindex]:focus-visible,[role=button]:focus-visible{outline:2px solid CanvasText;outline-offset:2px}}",ge="body.qaid-targeting,body.qaid-targeting *{cursor:none!important}";let T=0;const ve="button.qaid-btn{width:var(--qaid-btn-size);height:var(--qaid-btn-size);border-radius:50%;border:none;background:#f3f4f6;color:#374151;display:flex;align-items:center;justify-content:center;cursor:pointer;box-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -1px rgba(0,0,0,.06);transition:background-color .2s,color .2s,transform .2s;-webkit-appearance:none;appearance:none;--qaid-hover-up-bg:var(--qaid-positive);--qaid-hover-up-color:#fff;--qaid-hover-down-bg:var(--qaid-negative);--qaid-hover-down-color:#fff}button.qaid-btn:hover{transform:scale(1.05)}button.qaid-btn-up:hover{background:var(--qaid-hover-up-bg);color:var(--qaid-hover-up-color)}button.qaid-btn-down:hover{background:var(--qaid-hover-down-bg);color:var(--qaid-hover-down-color)}button.qaid-btn-feedback:hover{background:var(--qaid-marker,#6365f1);color:var(--qaid-marker-text,#fff)}button.qaid-btn svg{width:var(--qaid-icon-size);height:var(--qaid-icon-size)}",ye={small:36,medium:48,large:64},we={small:18,medium:24,large:32};function ke(e,t,o){const[i,n,a]=[e,t,o].map(s=>(s=s/255,s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4)));return .2126*i+.7152*n+.0722*a}function Ce(e){if(e.startsWith("#")){const o=e.slice(1),i=o.length===3?o.split("").map(a=>a+a).join(""):o,n=parseInt(i,16);return{r:n>>16&255,g:n>>8&255,b:n&255}}const t=e.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);return t?{r:parseInt(t[1]),g:parseInt(t[2]),b:parseInt(t[3])}:null}function qe(e){const t=Ce(e);return t&&ke(t.r,t.g,t.b)>.4?"black":"white"}function Se(e={}){const{positiveColor:t="rgb(0, 200, 83)",negativeColor:o="rgb(255, 0, 0)",markerColor:i="#6365f1",buttonSize:n="medium",modalWidth:a=400,backdropOpacity:s=.3,fontFamily:d="system-ui, -apple-system, sans-serif",fontSize:f=16}=e,m=ye[n],l=we[n],r=qe(i);return{"--qaid-positive":t,"--qaid-negative":o,"--qaid-marker":i,"--qaid-marker-text":r,"--qaid-btn-size":`${m}px`,"--qaid-icon-size":`${l}px`,"--qaid-modal-width":`${a}px`,"--qaid-backdrop-opacity":String(s),"--qaid-font-family":d,"--qaid-font-size":`${f}px`}}function xe(e,t){for(const[o,i]of Object.entries(t))e.style.setProperty(o,i)}function ct(){return be+ve}function Ae(){if(T++,T>1)return;const e=document.createElement("style");e.id="qaid-styles",e.textContent=ge,document.head.appendChild(e)}function Ee(){T<=0||(T--,T===0&&document.getElementById("qaid-styles")?.remove())}const ut="data-qaid-a11y-live",Te="position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;";function Ie(e){return e.ownerDocument||document}function Le(e,t){const o=t?"assertive":"polite",i=e.querySelector(`[${ut}="${o}"]`);if(i)return i;const a=Ie(e).createElement("div");return a.setAttribute(ut,o),a.setAttribute("role",t?"alert":"status"),a.setAttribute("aria-live",t?"assertive":"polite"),a.setAttribute("aria-atomic","true"),a.style.cssText=Te,e.appendChild(a),a}function De(e,t,o={}){const i=Le(e,!!o.assertive);i.textContent="",i.textContent=t}function Me(e,t,o,i={}){const n=i.gap??8;let a=e.bottom+n;a+t.height>o.height-n&&(a=e.top-t.height-n);let s=e.left;return s<n?s=n:s+t.width>o.width-n&&(s=o.width-t.width-n),a<n?a=n:a+t.height>o.height-n&&(a=o.height-t.height-n),{top:a,left:s}}const y="[redacted]",ht=1e3,H=/login|log-in|signin|sign-in|signup|sign-up|auth|token|password|passwd|session|oauth|2fa|mfa|credential/i,Oe=/token|key|secret|pass(word|wd)?|pwd|code|sess|auth|sig|otp|jwt|credential|ticket|nonce|state/i,ft="(?:password|passwd|pwd|pass|secret|token|access_token|refresh_token|id_token|api[_-]?key|apikey|client_secret|private[_-]?key|session(?:id)?|auth(?:orization)?|cookie|set-cookie|otp|pin|cvv|cvc|ssn)",Re=[[/\b(Bearer|Basic|Token|Digest)\s+[A-Za-z0-9._~+/=-]{8,}/gi,(e,t)=>`${t} ${y}`],[/\beyJ[A-Za-z0-9_-]{5,}\.[A-Za-z0-9_-]{5,}(?:\.[A-Za-z0-9_-]*)?/g,y],[new RegExp(`(["']?${ft}["']?\\s*:\\s*)(["'])(?:\\\\.|(?!\\2).)*\\2`,"gi"),(e,t,o)=>`${t}${o}${y}${o}`],[new RegExp(`(\\b${ft}\\s*[=:]\\s*)(?!["'\\s]|(?:Bearer|Basic|Token|Digest)\\s|\\[redacted\\])[^\\s&;,"'}]+`,"gi"),(e,t)=>`${t}${y}`],[/\b\d(?:[ -]?\d){12,18}\b/g,e=>Be(e.replace(/\D/g,""))?y:e],[/\b[A-Fa-f0-9]{32,}\b/g,y],[/[A-Za-z0-9_+-]{32,}={0,2}/g,e=>/\d/.test(e)&&/[a-z]/.test(e)&&/[A-Z]/.test(e)?y:e]];function Be(e){let t=0;for(let o=0;o<e.length;o++){let i=Number(e[e.length-1-o]);o%2===1&&(i*=2,i>9&&(i-=9)),t+=i}return t%10===0}function _(e){let t=e;for(const[o,i]of Re)t=t.replace(o,i);return t}function He(e,t){return e.length>t?`${e.slice(0,t)}\u2026[truncated]`:e}function _e(e){return He(_(e.slice(0,ht*2)),ht)}function pt(e){let t=!1;for(const o of Array.from(new Set(e.keys())))Oe.test(o)&&(e.set(o,y),t=!0);return t}function ze(e){let t;const o="https://qaid.invalid";try{t=new URL(e,o)}catch{return _(e)}if(t.username="",t.password="",pt(t.searchParams)&&(t.search=t.search.replace(/%5Bredacted%5D/g,y)),t.hash.includes("=")){const a=new URLSearchParams(t.hash.slice(1));pt(a)&&(t.hash=a.toString().replace(/%5Bredacted%5D/g,y))}const i=t.href;return!/^[a-z][a-z0-9+.-]*:/i.test(e)&&!e.startsWith("//")&&i.startsWith(o)?i.slice(o.length):i}function Pe(e){try{const t=new URL(e,"https://qaid.invalid");return H.test(t.hostname)||H.test(t.pathname)}catch{return H.test(e)}}function Ne(e,t,o){if(o!==void 0)return t===401||t===403||Pe(e)?y:_(o)}const Ue=20;function $e(e){const t=[],o=console.error,i=console.warn,n=console.log,a=(s,d)=>{const f={message:_e(d.map(m=>String(m)).join(" ")),timestamp:Date.now(),level:s};t.length>=Ue&&t.shift(),t.push(f),e&&e(f)};return console.error=function(...s){a("error",s),o.apply(console,s)},console.warn=function(...s){a("warn",s),i.apply(console,s)},console.log=function(...s){a("log",s),n.apply(console,s)},{errors:t,restore:()=>{console.error=o,console.warn=i,console.log=n}}}function Fe(e,t,o){const i=document.createElement(e);if(t)for(const[n,a]of Object.entries(t))n==="className"?i.className=a:i.setAttribute(n,a);if(o)for(const n of o)typeof n=="string"?i.appendChild(document.createTextNode(n)):i.appendChild(n);return i}function Ve(e=640){return typeof window<"u"&&window.innerWidth<e}function je(e,t,o){const i=o.map(a=>a.style.visibility);o.forEach(a=>a.style.visibility="hidden");const n=document.elementFromPoint(e,t);return o.forEach((a,s)=>a.style.visibility=i[s]),n}function Ke(e){return e?e.hasAttribute("data-qaid-embed")||e.hasAttribute("data-qaid-embed-overlay")?!0:!!e.closest("[data-qaid-embed], [data-qaid-embed-overlay]"):!1}function We(e,t=0){const o=e.getBoundingClientRect();return{x:o.left-t,y:o.top-t,width:o.width+t*2,height:o.height+t*2}}const Qe="1.12.1",I=`https://unpkg.com/@qaiddev/quests-embed@${Qe}/dist/qaid-quests.js`,Ye="sha384-ulTEyFqoUl1HNdNL8rFOB/mSItoy12PPegqJJIspDm0WtPK4/2jl3bRVrHoEtrm1",Ge=/^https:\/\/unpkg\.com\/@qaiddev\/quests-embed@\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?\//;let mt=!1;function Ze(e){if(!e)return I;if(e===I)return e;try{const t=typeof location<"u"?location.href:void 0,o=new URL(e,t);if(Ge.test(o.href)&&!/%2e|%2f|%5c/i.test(o.pathname)||t&&o.origin===new URL(t).origin&&(o.protocol==="https:"||o.protocol==="http:"))return o.href}catch{}return mt||(mt=!0,console.warn(`[thumbs-embed] Ignoring quests moduleUrl "${e}": use a same-origin URL or https://unpkg.com/@qaiddev/quests-embed@<exact version>/\u2026. Using ${I}.`)),I}const Xe=3e3,Je={buttonClass:"string",direction:["horizontal","vertical"],position:["bottom-right","bottom-left","top-right","top-left"],zIndex:"number",skipTargeting:"boolean",singleButton:"boolean",feedbackMode:["target","annotate"],buttonSize:["small","medium","large"],hideConfirmation:"boolean",modalWidth:"number",backdropOpacity:"number",fontFamily:"string",fontSize:"number",captureScreenshot:"boolean",annotate:"boolean",annotationColor:"string",captureVideo:"boolean",recordIcon:"string",incognito:"boolean",hideDismiss:"boolean",positiveIcon:"string",negativeIcon:"string",feedbackIcon:"string",hideThumbs:"boolean",css:"string",screenshotMethod:["dom","permission"]},bt={offset:{x:"number",y:"number"},colors:{positive:"string",negative:"string",marker:"string"},text:"strings",videoOptions:{maxDuration:"number",redaction:"boolean"},screenshotOptions:{quality:"number",maxWidth:"number",maxHeight:"number"},quests:{base:"string",up:"string",down:"string",video:"string"}},to=new Set(["positiveIcon","negativeIcon","css","buttonClass","colors","buttonSize","text"]),L=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function gt(e,t){return Array.isArray(t)?typeof e=="string"&&t.includes(e):t==="number"?typeof e=="number"&&Number.isFinite(e):typeof e===t}function eo(e,t){if(!L(e))return;const o={};for(const[i,n]of Object.entries(e))(t==="strings"?typeof n=="string":i in t&>(n,t[i]))&&(o[i]=n);return Object.keys(o).length>0?o:void 0}function oo(e,t){try{const o=typeof location<"u"?location.href:void 0;return new URL(e,o).origin===new URL(t,o).origin}catch{return!1}}function vt(e,t){if(!L(e))return{};const o={};for(const[a,s]of Object.entries(Je))gt(e[a],s)&&(o[a]=e[a]);for(const[a,s]of Object.entries(bt)){const d=eo(e[a],s);d&&(o[a]=d)}const i=e.annotationPalette;Array.isArray(i)&&i.length>0&&i.every(a=>typeof a=="string"&&a.trim())&&(o.annotationPalette=i);const n=o.quests;return n?.base&&!oo(n.base,t)&&(console.warn("[thumbs-embed] Ignoring a fetched quest base on another origin than the endpoint."),delete o.quests),o}function io(e,t){const o=vt(e,t);return Object.fromEntries(Object.entries(o).filter(([i])=>to.has(i)))}function no(...e){const t={};for(const o of e)if(o){for(const[i,n]of Object.entries(o))if(n!==void 0)if(i in bt&&L(n)){const s={...L(t[i])?t[i]:{}};for(const[d,f]of Object.entries(n))f!==void 0&&(s[d]=f);t[i]=s}else t[i]=n}return t}function so(e,t){return`${e.replace(/\/+$/,"")}/config?apiKey=${encodeURIComponent(t)}`}async function yt(e,t,o){const i=typeof AbortController<"u"?new AbortController:null;let n;const a=new Promise((s,d)=>{n=setTimeout(()=>{i?.abort(),d(new Error(`timed out after ${t} ms`))},t)});try{const s=await Promise.race([fetch(e,{headers:{Accept:"application/json"},credentials:"omit",signal:i?.signal}),a]);return s.ok?await s.json():(console.warn(`[thumbs-embed] ${o} fetch failed (${s.status}); drawing without it.`),null)}catch(s){return console.warn(`[thumbs-embed] ${o} fetch error; drawing without it.`,s),null}finally{clearTimeout(n)}}function ao(e){return e.remoteConfig===!0||!!e.themeUrl}async function ro(e){const t=e.remoteTimeoutMs??Xe;let o=null;e.remoteConfig&&(e.apiKey?o=so(e.endpoint,e.apiKey):console.warn("[thumbs-embed] remoteConfig needs an apiKey; drawing without it."));const[i,n]=await Promise.all([o?yt(o,t,"Project config"):null,e.themeUrl?yt(e.themeUrl,t,"Theme"):null]);return no(i?vt(i,e.endpoint):null,n?io(n,e.endpoint):null,e)}const wt="qaid_visitor_id",kt="qaid_hide_feedback",lo=["#ef4444","#f59e0b","#22c55e","#3b82f6","#111827","#ffffff"];function co(){return typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches}function z(e){return e?`${kt}_${e}`:kt}function uo(e){try{return localStorage.getItem(z(e))==="1"}catch{return!1}}function Ct(e,t=!0){try{t?localStorage.setItem(z(e),"1"):localStorage.removeItem(z(e))}catch{}}function qt(){const e=typeof crypto<"u"?crypto:void 0;if(e&&typeof e.randomUUID=="function")return e.randomUUID();const t=new Uint8Array(16);if(e&&typeof e.getRandomValues=="function")e.getRandomValues(t);else for(let i=0;i<t.length;i++)t[i]=Math.floor(Math.random()*256);t[6]=t[6]&15|64,t[8]=t[8]&63|128;const o=Array.from(t,i=>i.toString(16).padStart(2,"0")).join("");return`${o.slice(0,8)}-${o.slice(8,12)}-${o.slice(12,16)}-${o.slice(16,20)}-${o.slice(20)}`}function ho(){try{let e=localStorage.getItem(wt);return e||(e=qt(),localStorage.setItem(wt,e)),e}catch{return qt()}}function St(e,t){const o=document.createElement("style");o.setAttribute("data-qaid-feature",""),o.textContent=t;const i=e.querySelectorAll("style[data-qaid-base], style[data-qaid-feature]"),n=i[i.length-1];e.insertBefore(o,n?n.nextSibling:e.firstChild)}function xt(e){return{endpoint:e.endpoint,apiKey:e.apiKey??"",container:e.container??"",buttonClass:e.buttonClass??"",direction:e.direction??"horizontal",position:e.position??"bottom-right",offset:{x:e.offset?.x??16,y:e.offset?.y??16},zIndex:e.zIndex??50,skipTargeting:e.skipTargeting??!1,singleButton:e.singleButton??!1,feedbackMode:e.feedbackMode??"target",colors:{positive:e.colors?.positive??"rgb(0, 200, 83)",negative:e.colors?.negative??"rgb(255, 0, 0)",marker:e.colors?.marker??"#6365f1"},buttonSize:e.buttonSize??"medium",text:{tooltip:e.text?.tooltip??"",modalTitle:e.text?.modalTitle??"Thank you for your feedback!",modalSubtitle:e.text?.modalSubtitle??"Would you like to add a message to help us understand your feedback better?",placeholder:e.text?.placeholder??"Optional: Tell us more about your experience...",submitButton:e.text?.submitButton??"Submit",skipButton:e.text?.skipButton??"Skip",positiveLabel:e.text?.positiveLabel??"Send positive feedback",negativeLabel:e.text?.negativeLabel??"Send negative feedback",recordLabel:e.text?.recordLabel??"Record a screen recording",dismissLabel:e.text?.dismissLabel??"Hide Feedback",feedbackLabel:e.text?.feedbackLabel??"Send feedback",confirmationTitle:e.text?.confirmationTitle??"Thank you!",confirmationMessage:e.text?.confirmationMessage??"Your feedback has been received.",confirmationClose:e.text?.confirmationClose??"Close",errorTitle:e.text?.errorTitle??"Message not sent",errorMessage:e.text?.errorMessage??"Something went wrong, so we did not get your message. Please try again later."},hideConfirmation:e.hideConfirmation??!1,modalWidth:e.modalWidth??400,backdropOpacity:e.backdropOpacity??.3,fontFamily:e.fontFamily??"system-ui, -apple-system, sans-serif",fontSize:e.fontSize??16,captureScreenshot:e.captureScreenshot??!1,annotate:e.annotate??!0,annotationColor:e.annotationColor??e.colors?.marker??"#6365f1",annotationPalette:e.annotationPalette??lo,screenshotMethod:e.screenshotMethod??"permission",screenshotOptions:{quality:e.screenshotOptions?.quality??.8,maxWidth:e.screenshotOptions?.maxWidth??1280,maxHeight:e.screenshotOptions?.maxHeight??800},incognito:e.incognito??!1,hideDismiss:e.hideDismiss??!1,positiveIcon:e.positiveIcon??"",negativeIcon:e.negativeIcon??"",feedbackIcon:e.feedbackIcon??"",hideThumbs:e.hideThumbs??!1,css:e.css??"",captureVideo:e.captureVideo??!1,videoOptions:{maxDuration:e.videoOptions?.maxDuration??15,redaction:e.videoOptions?.redaction??!1},recordIcon:e.recordIcon??"",quests:{base:e.quests?.base??"",up:e.quests?.up??"",down:e.quests?.down??"",video:e.quests?.video??"",apiKey:e.quests?.apiKey??e.apiKey??"",moduleUrl:Ze(e.quests?.moduleUrl)}}}class At{config;state="IDLE";feedbackData={feedbackType:null,elementSelector:null,elementText:null,consoleErrors:[]};selectedBounds={x:0,y:0,width:0,height:0,clickX:0,clickY:0,visible:!1};feedbackRecordPromise=Promise.resolve(null);questsPrewarmed=!1;activeQuest=null;isMobile=!1;visitorId;consoleCapture=null;recording=null;targeting=null;clickPathPrewarmed=!1;prewarmHandle=null;prewarmIsTimeout=!1;videoPrewarmed=!1;screenshotPrewarmed=!1;shadowHost=null;shadowRoot=null;overlayShadowHost=null;overlayShadowRoot=null;buttonsContainer=null;isUserProvidedContainer=!1;modal=null;dismissBtn=null;cssVars={};activeThumbBtn=null;keyboardActivation=!1;dialogModule=null;dialogClose=null;uid=Math.random().toString(36).slice(2,9);boundKeyDown;boundResize;_startDismissed=!1;destroyed=!1;ready=Promise.resolve();initialized=!1;domObserver=null;boundBeforeSwap=null;constructor(t){this.config=xt(t),this.boundKeyDown=this.handleKeyDown.bind(this),this.boundResize=this.handleResize.bind(this),this.visitorId=ho(),ao(t)?this.ready=ro(t).then(o=>{this.destroyed||(this.config=xt(o),this.init())}):this.init()}applyVars(t){xe(t,this.cssVars)}announceMsg(t,o=!1){const i=this.overlayShadowRoot??this.shadowRoot;i&&De(i,t,{assertive:o})}async loadDialogA11y(){this.dialogModule??=await import("./send-Bh4qEAt2.js").then(t=>t.a)}openDialogA11y(t,o){this.closeDialogA11y(),this.dialogClose=this.dialogModule.openDialog(t,o)}closeDialogA11y(){const t=this.dialogClose;this.dialogClose=null,t?.()}clearActiveThumb(){this.activeThumbBtn&&(this.activeThumbBtn.setAttribute("aria-pressed","false"),this.activeThumbBtn=null)}init(){this.initialized=!0,Ae(),this.cssVars=Se({positiveColor:this.config.colors.positive,negativeColor:this.config.colors.negative,markerColor:this.config.colors.marker,buttonSize:this.config.buttonSize,modalWidth:this.config.modalWidth,backdropOpacity:this.config.backdropOpacity,fontFamily:this.config.fontFamily,fontSize:this.config.fontSize}),!this.config.hideDismiss&&uo(this.config.apiKey)&&(this._startDismissed=!0),this.checkMobile(),window.addEventListener("resize",this.boundResize),this.createEmbed(),this.consoleCapture=$e(t=>{this.feedbackData.consoleErrors=this.consoleCapture?.errors??[]}),this.feedbackData.consoleErrors=this.consoleCapture.errors,this.observeDom(),this.schedulePrewarm(()=>{this.prewarmClickPath(),this.config.captureVideo&&this.videoSupported()&&this.prewarmVideo(),this.config.captureScreenshot&&this.prewarmScreenshot(),this.prewarmQuests()})}prewarmClickPath(){this.clickPathPrewarmed||(this.clickPathPrewarmed=!0,import("./send-Bh4qEAt2.js").then(t=>t.s).catch(()=>{}),import("./send-Bh4qEAt2.js").then(t=>t.a).catch(()=>{}),import("./modal-cN3Y_wyj.js").catch(()=>{}),this.skipsTargeting()||import("./targeting-DfTc3n-D.js").catch(()=>{}))}skipsTargeting(){return this.config.skipTargeting||this.config.feedbackMode==="annotate"}prewarmVideo(){this.videoPrewarmed||(this.videoPrewarmed=!0,import("./recording-Dc1S81yJ.js").catch(()=>{}),import("./video-BSP4s2te.js").catch(()=>{}))}prewarmScreenshot(){this.screenshotPrewarmed||(this.screenshotPrewarmed=!0,(this.shouldCaptureViaDom()?import("./screenshot-dom-DO-0UlOz.js"):import("./screenshot-CNe1irEz.js")).catch(()=>{}),this.config.annotate&&import("./annotate-967WMR9g.js").catch(()=>{}))}linkedQuestIds(){const t=this.config.quests;return t.base?[t.up,t.down,t.video].filter(o=>o):[]}prewarmQuests(){if(this.questsPrewarmed)return;const t=this.linkedQuestIds();if(t.length===0)return;this.questsPrewarmed=!0;const{base:o,moduleUrl:i}=this.config.quests;import("./send-Bh4qEAt2.js").then(n=>n.q).then(n=>{n.loadQuestsModule(i).catch(()=>{});for(const a of t)n.prefetchQuestDefinition(n.questDefinitionUrl(o,a))}).catch(()=>{})}schedulePrewarm(t){const o=window,i=()=>{this.destroyed||t()};typeof o.requestIdleCallback=="function"?(this.prewarmIsTimeout=!1,this.prewarmHandle=o.requestIdleCallback(i,{timeout:2e3})):(this.prewarmIsTimeout=!0,this.prewarmHandle=window.setTimeout(i,1200))}observeDom(){this.boundBeforeSwap=t=>{const o=t.newDocument;!o||this.destroyed||(this.shadowHost&&o.body.appendChild(this.shadowHost),this.overlayShadowHost&&o.body.appendChild(this.overlayShadowHost))},document.addEventListener("astro:before-swap",this.boundBeforeSwap),this.domObserver=new MutationObserver(()=>{this.destroyed||(this.shadowHost&&!this.shadowHost.isConnected&&document.body.appendChild(this.shadowHost),this.overlayShadowHost&&!this.overlayShadowHost.isConnected&&document.body.appendChild(this.overlayShadowHost))}),this.domObserver.observe(document.body,{childList:!0})}checkMobile(){this.isMobile=Ve()}handleResize(){this.checkMobile()}createEmbed(){this.shadowHost=document.createElement("div"),this.shadowHost.setAttribute("data-qaid-embed",""),this.shadowHost.style.position="static",this.shadowHost.style.display="contents";let t=null;this.config.container&&(t=document.querySelector(this.config.container)),t?(t.appendChild(this.shadowHost),this.isUserProvidedContainer=!0,this.config.hideDismiss=!0):(this.shadowHost.style.position="fixed",this.shadowHost.style.display="block",this.shadowHost.style.inset="0",this.shadowHost.style.pointerEvents="none",this.shadowHost.style.zIndex=String(this.config.zIndex),document.body.appendChild(this.shadowHost)),this.shadowRoot=this.shadowHost.attachShadow({mode:"open"});const o=document.createElement("style");if(o.setAttribute("data-qaid-base",""),o.textContent=ct(),this.shadowRoot.appendChild(o),this.config.css){const l=document.createElement("style");l.textContent=this.config.css,this.shadowRoot.appendChild(l)}const i=this.config.direction==="vertical"?"qaid-vertical":"";if(this.isUserProvidedContainer)this.buttonsContainer=document.createElement("div"),this.buttonsContainer.className=`qaid-buttons qaid-${this.config.position} ${i}`.trim(),this.config.incognito&&this.buttonsContainer.classList.add("qaid-incognito");else{this.buttonsContainer=document.createElement("div"),this.buttonsContainer.className=`qaid-buttons qaid-auto-container qaid-${this.config.position} ${i}${this.config.incognito?" qaid-incognito":""}`.trim(),this.buttonsContainer.style.pointerEvents="auto";const{x:l,y:r}=this.config.offset;this.config.position.includes("right")?this.buttonsContainer.style.right=`${l}px`:this.buttonsContainer.style.left=`${l}px`,this.config.position.includes("bottom")?this.buttonsContainer.style.bottom=`${r}px`:this.buttonsContainer.style.top=`${r}px`}this.applyVars(this.buttonsContainer),this.shadowRoot.appendChild(this.buttonsContainer),this.buttonsContainer.addEventListener("keydown",l=>{(l.key==="Enter"||l.key===" "||l.key==="Spacebar")&&(this.keyboardActivation=!0)}),this.buttonsContainer.addEventListener("mousedown",()=>{this.keyboardActivation=!1}),this.buttonsContainer.addEventListener("pointerdown",()=>{this.keyboardActivation=!1});const n=()=>this.prewarmClickPath();this.buttonsContainer.addEventListener("pointerenter",n),this.buttonsContainer.addEventListener("focusin",n);const a=!!this.config.buttonClass,s=a?`qaid-btn-structural ${this.config.buttonClass}`:"qaid-btn",f=this.config.text.tooltip||"Feedback for us?",m=document.createElement("div");if(m.className="qaid-tooltip-text",m.textContent=f,this.applyVars(m),this.shadowRoot.appendChild(m),this.tooltipElement=m,this.config.singleButton){const l=document.createElement("div");l.className="qaid-tooltip-wrapper";const r=document.createElement("button");r.type="button",r.className=a?`${s} qaid-btn-feedback`:"qaid-btn qaid-btn-feedback",r.setAttribute("aria-label",this.config.text.feedbackLabel),x(r,this.config.feedbackIcon,ot),r.addEventListener("click",c=>this.handleThumbClick("neutral",c.currentTarget,c)),r.addEventListener("mouseenter",()=>this.showTooltip(r)),r.addEventListener("mouseleave",()=>this.hideTooltip()),l.appendChild(r),this.buttonsContainer.appendChild(l)}else if(!this.config.hideThumbs){const l=document.createElement("div");l.className="qaid-tooltip-wrapper";const r=document.createElement("button");r.type="button",r.className=a?`${s} qaid-btn-up`:"qaid-btn qaid-btn-up",r.setAttribute("aria-label",this.config.text.positiveLabel),x(r,this.config.positiveIcon,tt),r.addEventListener("click",v=>this.handleThumbClick("up",v.currentTarget,v)),r.addEventListener("mouseenter",()=>{this.prewarmQuests(),this.showTooltip(r)}),r.addEventListener("mouseleave",()=>this.hideTooltip()),l.appendChild(r);const c=document.createElement("div");c.className="qaid-tooltip-wrapper";const h=document.createElement("button");h.type="button",h.className=a?`${s} qaid-btn-down`:"qaid-btn qaid-btn-down",h.setAttribute("aria-label",this.config.text.negativeLabel),x(h,this.config.negativeIcon,et),h.addEventListener("click",v=>this.handleThumbClick("down",v.currentTarget,v)),h.addEventListener("mouseenter",()=>{this.prewarmQuests(),this.showTooltip(h)}),h.addEventListener("mouseleave",()=>this.hideTooltip()),c.appendChild(h),this.buttonsContainer.appendChild(l),this.buttonsContainer.appendChild(c)}if(this.config.captureVideo&&this.videoSupported()){const l=document.createElement("div");l.className="qaid-tooltip-wrapper";const r=document.createElement("button");r.type="button",r.className=a?`${s} qaid-btn-record`:"qaid-btn qaid-btn-record",r.setAttribute("aria-label",this.config.text.recordLabel),x(r,this.config.recordIcon,ee),r.addEventListener("click",()=>{this.ensureRecording().then(h=>this.config.videoOptions.redaction?h.startPicking():h.startRecording())});const c=()=>this.prewarmVideo();r.addEventListener("mouseenter",()=>{c(),this.showTooltip(r)}),r.addEventListener("focus",c),r.addEventListener("touchstart",c,{passive:!0}),r.addEventListener("mouseleave",()=>this.hideTooltip()),l.appendChild(r),this.buttonsContainer.appendChild(l)}this.config.hideDismiss||(this.dismissBtn=document.createElement("button"),this.dismissBtn.type="button",this.dismissBtn.className="qaid-dismiss-btn",this.dismissBtn.setAttribute("aria-label",this.config.text.dismissLabel),this.dismissBtn.title=this.config.text.dismissLabel,x(this.dismissBtn,null,oe),this.dismissBtn.addEventListener("click",l=>{l.stopPropagation(),this.handleDismiss()}),this.buttonsContainer.insertBefore(this.dismissBtn,this.buttonsContainer.firstChild),this._startDismissed&&this.buttonsContainer.classList.add("qaid-dismissed"))}ensureOverlayHost(){if(this.overlayShadowRoot)return this.overlayShadowRoot;this.overlayShadowHost=document.createElement("div"),this.overlayShadowHost.setAttribute("data-qaid-embed-overlay",""),this.overlayShadowHost.style.position="fixed",this.overlayShadowHost.style.inset="0",this.overlayShadowHost.style.pointerEvents="none",this.overlayShadowHost.style.zIndex=String(this.config.zIndex),document.body.appendChild(this.overlayShadowHost),this.overlayShadowRoot=this.overlayShadowHost.attachShadow({mode:"open"});const t=document.createElement("style");t.setAttribute("data-qaid-base",""),t.textContent=ct(),this.overlayShadowRoot.appendChild(t);for(const o of this.featureStyles)St(this.overlayShadowRoot,o);if(this.config.css){const o=document.createElement("style");o.textContent=this.config.css,this.overlayShadowRoot.appendChild(o)}return this.overlayShadowRoot}featureStyles=[];addFeatureStyles(t){if(!this.featureStyles.includes(t)){this.featureStyles.push(t);for(const o of[this.shadowRoot,this.overlayShadowRoot])o&&St(o,t)}}tooltipElement=null;showTooltip(t){const o=this.tooltipElement;o.style.visibility="hidden",o.classList.add("qaid-tooltip-visible");const i=t.getBoundingClientRect(),n=o.getBoundingClientRect(),{top:a,left:s}=Me(i,n,{width:window.innerWidth,height:window.innerHeight});o.style.top=`${a}px`,o.style.left=`${s}px`,o.style.visibility="visible"}hideTooltip(){this.tooltipElement.classList.remove("qaid-tooltip-visible")}handleDismiss(){this.buttonsContainer.classList.add("qaid-dismissed"),Ct(this.config.apiKey,!0)}handleThumbClick(t,o,i){if(this.buttonsContainer?.classList.contains("qaid-incognito")&&(this.buttonsContainer.classList.remove("qaid-incognito"),Ct(this.config.apiKey,!1)),this.prewarmClickPath(),this.skipsTargeting())this.submitDirectFeedback(t,o);else{this.activeThumbBtn=o,o.setAttribute("aria-pressed","true");const n=this.keyboardActivation;this.keyboardActivation=!1,this.ensureTargeting().then(a=>{this.destroyed||(n?a.startKeyboard(t):a.startPointer(t,i))})}}submitDirectFeedback(t,o){this.feedbackData.feedbackType=t,this.feedbackData.elementSelector=null,this.feedbackData.elementText=null;const i=o.getBoundingClientRect();this.selectedBounds={x:i.left,y:i.top,width:i.width,height:i.height,clickX:i.left+i.width/2,clickY:i.top+i.height/2,visible:!1},this.submitFeedback()}handleKeyDown(t){if(t.key==="Escape"){if(this.recording?.handleEscape())return;this.state==="TARGETING"?this.targeting?.cancel():this.state==="MODAL_OPEN"&&this.modal?.close()}}shouldCaptureViaDom(){return this.config.screenshotMethod==="dom"||co()}async submitFeedback(){try{const[t]=await Promise.all([import("./send-Bh4qEAt2.js").then(o=>o.s),this.loadDialogA11y()]);await t.submitFeedback(this.makeSendHost())}catch(t){console.error("Failed to send feedback:",t),this.announceMsg("Failed to send feedback",!0),this.resetFeedbackUi()}}async tryLaunchQuest(t,o){try{return await(await import("./send-Bh4qEAt2.js").then(n=>n.s)).tryLaunchQuest(this.makeSendHost(),t,o)}catch(i){return console.error("Failed to launch quest:",i),!1}}makeSendHost(){const t=this;return{get config(){return t.config},get visitorId(){return t.visitorId},get feedbackData(){return t.feedbackData},get selectedBounds(){return t.selectedBounds},get destroyed(){return t.destroyed},get overlayShadowHost(){return t.overlayShadowHost},get activeQuest(){return t.activeQuest},set activeQuest(o){t.activeQuest=o},setState:o=>{t.state=o},setFeedbackRecord:o=>{t.feedbackRecordPromise=o},shouldCaptureViaDom:()=>t.shouldCaptureViaDom(),ensureOverlayHost:()=>t.ensureOverlayHost(),ensureModal:()=>t.ensureModal(),addFeatureStyles:o=>t.addFeatureStyles(o),applyVars:o=>t.applyVars(o),announceMsg:(o,i)=>t.announceMsg(o,i),openDialogA11y:(o,i)=>t.openDialogA11y(o,i),closeDialogA11y:()=>t.closeDialogA11y(),resetFeedbackUi:()=>t.resetFeedbackUi()}}resetFeedbackUi(){this.targeting?.hideMarker(),this.overlayShadowHost&&(this.overlayShadowHost.style.pointerEvents="none"),this.state="IDLE",this.feedbackRecordPromise=Promise.resolve(null),this.feedbackData.feedbackType=null,this.feedbackData.elementSelector=null,this.feedbackData.elementText=null,this.selectedBounds.visible=!1}async ensureModal(){if(!this.modal){const[{ModalController:t,styles:o}]=await Promise.all([import("./modal-cN3Y_wyj.js"),this.loadDialogA11y()]);this.addFeatureStyles(o),this.modal=new t(this.makeModalHost())}return this.modal}makeModalHost(){const t=this;return{get config(){return t.config},get uid(){return t.uid},get isMobile(){return t.isMobile},get state(){return t.state},get boundKeyDown(){return t.boundKeyDown},get feedbackData(){return t.feedbackData},get selectedBounds(){return t.selectedBounds},whenFeedbackRecord:()=>t.feedbackRecordPromise,ensureOverlayHost:()=>t.ensureOverlayHost(),applyVars:o=>t.applyVars(o),announceMsg:(o,i)=>t.announceMsg(o,i),openDialogA11y:(o,i)=>t.openDialogA11y(o,i),closeDialogA11y:()=>t.closeDialogA11y(),resetFeedbackUi:()=>t.resetFeedbackUi()}}async ensureTargeting(){if(!this.targeting){const{TargetingController:t,styles:o}=await import("./targeting-DfTc3n-D.js");this.addFeatureStyles(o),this.targeting=new t(this.makeTargetingHost())}return this.targeting}makeTargetingHost(){const t=this;return{get config(){return t.config},get cssVars(){return t.cssVars},get state(){return t.state},get shadowHost(){return t.shadowHost},get overlayShadowHost(){return t.overlayShadowHost},get boundKeyDown(){return t.boundKeyDown},get feedbackData(){return t.feedbackData},get selectedBounds(){return t.selectedBounds},setState:o=>{t.state=o},ensureOverlayHost:()=>t.ensureOverlayHost(),applyVars:o=>t.applyVars(o),announceMsg:(o,i)=>t.announceMsg(o,i),clearActiveThumb:()=>t.clearActiveThumb(),submitFeedback:()=>t.submitFeedback()}}videoSupported(){return typeof navigator<"u"&&!!navigator.mediaDevices&&typeof navigator.mediaDevices.getDisplayMedia=="function"&&typeof MediaRecorder<"u"}async ensureRecording(){if(!this.recording){const[{RecordingController:t,styles:o}]=await Promise.all([import("./recording-Dc1S81yJ.js"),this.loadDialogA11y()]);this.addFeatureStyles(o),this.recording=new t(this.makeRecordingHost())}return this.recording}makeRecordingHost(){const t=this;return{get config(){return t.config},get visitorId(){return t.visitorId},get uid(){return t.uid},get overlayShadowHost(){return t.overlayShadowHost},get consoleCapture(){return t.consoleCapture},get boundKeyDown(){return t.boundKeyDown},get state(){return t.state},setState:o=>{t.state=o},ensureOverlayHost:()=>t.ensureOverlayHost(),applyVars:o=>t.applyVars(o),announceMsg:(o,i)=>t.announceMsg(o,i),openDialogA11y:(o,i)=>t.openDialogA11y(o,i),closeDialogA11y:()=>t.closeDialogA11y(),setButtonsDisabled:o=>t.setButtonsDisabled(o),tryLaunchQuest:(o,i)=>t.tryLaunchQuest(o,i)}}setButtonsDisabled(t){if(!this.buttonsContainer)return;this.buttonsContainer.querySelectorAll("button.qaid-btn, button.qaid-btn-structural").forEach(i=>{t?i.classList.contains("qaid-btn-record")||(i.disabled=!0,i.style.opacity="0.5"):(i.disabled=!1,i.style.opacity="")})}destroy(){if(this.destroyed=!0,!!this.initialized){if(this.domObserver&&(this.domObserver.disconnect(),this.domObserver=null),this.boundBeforeSwap&&(document.removeEventListener("astro:before-swap",this.boundBeforeSwap),this.boundBeforeSwap=null),this.targeting?.destroy(),this.targeting=null,this.clearActiveThumb(),this.closeDialogA11y(),this.prewarmHandle!==null){const t=window;this.prewarmIsTimeout?clearTimeout(this.prewarmHandle):t.cancelIdleCallback?.(this.prewarmHandle),this.prewarmHandle=null}this.recording?.destroy(),this.recording=null,this.modal?.destroy(),this.modal=null,this.activeQuest?.destroy(),this.activeQuest=null,this.consoleCapture&&(this.consoleCapture.restore(),this.consoleCapture=null),window.removeEventListener("resize",this.boundResize),document.removeEventListener("keydown",this.boundKeyDown),document.body.classList.remove("qaid-targeting","qaid-type-up"),document.body.style.removeProperty("--qaid-positive"),document.body.style.removeProperty("--qaid-negative"),this.shadowHost&&(this.shadowHost.remove(),this.shadowHost=null,this.shadowRoot=null),this.overlayShadowHost&&(this.overlayShadowHost.remove(),this.overlayShadowHost=null,this.overlayShadowRoot=null),this.buttonsContainer=null,this.dismissBtn=null,this.tooltipElement=null,Ee()}}}var fo="__qaidThumbsOrigin";function Et(e){return document.querySelector(e)?.textContent?.trim()??""}const Tt=fo;function It(e){const t=e.split(/[?#]/)[0];return t.substring(t.lastIndexOf("/")+1)}function po(e){const t=document.currentScript;if(t&&t.tagName==="SCRIPT")return t;if(!e)return null;const o=Array.from(document.getElementsByTagName("script")).filter(d=>d.src),i=o.find(d=>d.src===e);if(i)return i;const n=o.filter(d=>d[Tt]);if(n.length===1)return n[0];const a=It(e),s=o.filter(d=>It(d.src)===a);return s.length===1?s[0]:null}function Lt(e){return!!e&&e.tagName==="SCRIPT"&&(e.getAttribute("type")||"").trim().toLowerCase()==="application/json"}function mo(e){const t=e[Tt],o=t&&t.tagName==="SCRIPT"?t:e,i=o.getAttribute("data-config-id")||e.getAttribute("data-config-id");if(i){const n=document.getElementById(i);return Lt(n)?n:null}for(const n of[o.previousElementSibling,o.nextElementSibling])if(Lt(n)&&n.hasAttribute("data-feedback-config"))return n;return null}function bo(e){const t=mo(e);if(!t)return null;const o=t.textContent?.trim();if(!o)return null;try{const i=JSON.parse(o);return i.cssSelector&&!i.css&&(i.css=Et(i.cssSelector),delete i.cssSelector),i}catch{return null}}function Dt(e,t,o){console.warn(`[thumbs-embed] Ignoring ${e}="${t}": expected ${o}.`)}function go(e){const t=[];let o=0,i="";for(const n of e)n==="("&&o++,n===")"&&(o=Math.max(0,o-1)),n===","&&o===0?(t.push(i.trim()),i=""):i+=n;return t.push(i.trim()),t}function vo(e,t){if(t===null)return;const o=t.trim();let i=null;if(o.startsWith("[")||o.startsWith("{"))try{i=JSON.parse(o)}catch{i=null}else i=go(o);if(Array.isArray(i)&&i.length>0&&i.every(n=>typeof n=="string"&&n.trim()!==""))return i.map(n=>n.trim());Dt(e,t,"a JSON array of colours or a comma-separated list")}function D(e,t){if(t!==null){if(t.trim()===""){Dt(e,t,"a non-empty label");return}return t}}function yo(e){const t=e.getAttribute("data-endpoint");if(!t)return null;const o=e.getAttribute("data-position"),i=e.getAttribute("data-zindex"),n=e.getAttribute("data-positive-color"),a=e.getAttribute("data-negative-color"),s=e.getAttribute("data-marker-color"),d=e.getAttribute("data-container"),f=e.getAttribute("data-button-class"),m=e.getAttribute("data-skip-targeting"),l=e.getAttribute("data-hide-confirmation"),r=e.getAttribute("data-single-button"),c=e.getAttribute("data-feedback-mode"),h=e.getAttribute("data-incognito"),v=e.getAttribute("data-button-size"),C=e.getAttribute("data-offset-x"),w=e.getAttribute("data-offset-y"),A=e.getAttribute("data-modal-width"),q=e.getAttribute("data-backdrop-opacity"),u=e.getAttribute("data-font-family"),p=e.getAttribute("data-font-size"),b=e.getAttribute("data-tooltip"),g=e.getAttribute("data-modal-title"),E=e.getAttribute("data-confirmation-title"),S=e.getAttribute("data-confirmation-message"),k=e.getAttribute("data-confirmation-close"),P=e.getAttribute("data-error-title"),N=e.getAttribute("data-error-message"),U=e.getAttribute("data-modal-subtitle"),$=e.getAttribute("data-placeholder"),F=e.getAttribute("data-submit-button"),V=e.getAttribute("data-skip-button"),Ot=e.getAttribute("data-positive-icon"),Rt=e.getAttribute("data-negative-icon"),Bt=e.getAttribute("data-feedback-icon"),j=e.getAttribute("data-feedback-label"),Ht=e.getAttribute("data-api-key"),_t=e.getAttribute("data-capture-screenshot"),zt=e.getAttribute("data-annotate"),Pt=e.getAttribute("data-annotation-color"),M=e.getAttribute("data-screenshot-quality"),O=e.getAttribute("data-screenshot-max-width"),R=e.getAttribute("data-screenshot-max-height"),Nt=e.getAttribute("data-capture-video"),K=e.getAttribute("data-video-redaction"),Ut=e.getAttribute("data-hide-thumbs"),$t=e.getAttribute("data-hide-dismiss"),B=e.getAttribute("data-video-max-duration"),Ft=e.getAttribute("data-screenshot-method"),Vt=e.getAttribute("data-direction"),W=e.getAttribute("data-css-selector"),jt=e.getAttribute("data-css"),Q=D("data-positive-label",e.getAttribute("data-positive-label")),Y=D("data-negative-label",e.getAttribute("data-negative-label")),G=D("data-record-label",e.getAttribute("data-record-label")),Z=D("data-dismiss-label",e.getAttribute("data-dismiss-label")),Kt=vo("data-annotation-palette",e.getAttribute("data-annotation-palette")),Wt=e.getAttribute("data-record-icon"),X=e.getAttribute("data-quest-base"),Qt=e.getAttribute("data-quest-up"),Yt=e.getAttribute("data-quest-down"),Gt=e.getAttribute("data-quest-video"),Zt=e.getAttribute("data-quest-api-key"),Xt=e.getAttribute("data-quest-module-url"),Jt=e.getAttribute("data-remote-config"),te=e.getAttribute("data-theme-url"),J=e.getAttribute("data-remote-timeout");return{endpoint:t,remoteConfig:Jt==="true"?!0:void 0,themeUrl:te||void 0,remoteTimeoutMs:J?parseInt(J,10):void 0,css:jt||(W?Et(W):void 0),apiKey:Ht??void 0,captureScreenshot:_t==="true"?!0:void 0,annotate:zt==="false"?!1:void 0,annotationColor:Pt??void 0,annotationPalette:Kt,screenshotOptions:M||O||R?{quality:M?parseFloat(M):void 0,maxWidth:O?parseInt(O,10):void 0,maxHeight:R?parseInt(R,10):void 0}:void 0,container:d??void 0,buttonClass:f??void 0,direction:Vt??void 0,position:o??void 0,zIndex:i?parseInt(i,10):void 0,skipTargeting:m==="true"?!0:void 0,hideConfirmation:l==="true"?!0:void 0,singleButton:r==="true"?!0:void 0,feedbackMode:c??void 0,incognito:h==="true"?!0:void 0,buttonSize:v??void 0,offset:C||w?{x:C?parseInt(C,10):void 0,y:w?parseInt(w,10):void 0}:void 0,modalWidth:A?parseInt(A,10):void 0,backdropOpacity:q?parseFloat(q):void 0,fontFamily:u??void 0,fontSize:p?parseInt(p,10):void 0,colors:{positive:n??void 0,negative:a??void 0,marker:s??void 0},text:b||g||U||$||F||V||j||E||S||k||P||N||Q||Y||G||Z?{tooltip:b??void 0,modalTitle:g??void 0,modalSubtitle:U??void 0,placeholder:$??void 0,submitButton:F??void 0,skipButton:V??void 0,feedbackLabel:j??void 0,confirmationTitle:E??void 0,confirmationMessage:S??void 0,confirmationClose:k??void 0,errorTitle:P??void 0,errorMessage:N??void 0,positiveLabel:Q,negativeLabel:Y,recordLabel:G,dismissLabel:Z}:void 0,positiveIcon:Ot??void 0,recordIcon:Wt??void 0,negativeIcon:Rt??void 0,feedbackIcon:Bt??void 0,screenshotMethod:Ft??void 0,captureVideo:Nt==="true"?!0:void 0,hideThumbs:Ut==="true"?!0:void 0,hideDismiss:$t==="true"?!0:void 0,videoOptions:B||K?{maxDuration:B?parseInt(B,10):void 0,redaction:K==="true"?!0:void 0}:void 0,quests:X?{base:X,up:Qt??void 0,down:Yt??void 0,video:Gt??void 0,apiKey:Zt??void 0,moduleUrl:Xt??void 0}:void 0}}function wo(e){if(typeof document>"u")return;const t=po(e);if(!t)return;const o=()=>{const i=bo(t)??yo(t);i?.endpoint&&new At(i)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",o):o()}var ko="qaid-embed",Mt="__qaidEmbedTrustedTypes";function Co(){if(typeof window>"u")return null;var e=window,t=e.trustedTypes;if(!t||typeof t.createPolicy!="function")return null;var o=e[Mt];if(o)return o;var i=Object.create(null),n=Object.create(null),a=null;try{a=t.createPolicy(ko,{createScriptURL:function(d){if(i[d]===!0)return d;throw new TypeError("qaid-embed: refused script URL "+d)},createScript:function(d){if(n[d]===!0)return d;throw new TypeError("qaid-embed: refused inline script")}})}catch{a=null}var s={policy:a,allowed:i,allowedScripts:n};try{Object.defineProperty(e,Mt,{value:s,configurable:!0})}catch{}return s}function qo(e){var t=Co();return!t||!t.policy?e:(t.allowed[e]=!0,t.policy.createScriptURL(e))}export{ne as A,ae as B,I as D,le as E,ot as F,se as P,At as Q,ie as R,ce as S,tt as T,re as U,Ye as a,de as b,Fe as c,wo as d,et as e,je as f,We as g,Ke as h,lt as i,ze as j,Ne as r,x as s,qo as t};
|
|
26
|
-
//# sourceMappingURL=core-BgLzwZUg.js.map
|