@qaiddev/thumbs-embed 1.0.10 → 1.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/qaid.umd.cjs CHANGED
@@ -2,18 +2,18 @@
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
3
  </svg>`,S=`<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
4
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>`,G=`<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
5
+ </svg>`,tt=`<svg xmlns="http://www.w3.org/2000/svg" class="qaid-icon" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
6
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>`,Q="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}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}.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:1rem;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}.qaid-targeting-overlay{position:fixed;inset:0;z-index:40;pointer-events:none}.qaid-capture-layer{position:fixed;inset:0;pointer-events:none;z-index:9999}@keyframes qaid-slideDown{0%{transform:translateY(-100%)}to{transform:translateY(0)}}.qaid-vignette{position:fixed;inset:0;pointer-events:none;background:radial-gradient(ellipse at center,transparent 30%,rgba(0,0,0,.3) 70%,rgba(0,0,0,.6) 100%);z-index:41}.qaid-crosshair-h,.qaid-crosshair-v{position:fixed;pointer-events:none;z-index:42}.qaid-crosshair-h{left:0;right:0;height:1px;background:color-mix(in srgb,var(--qaid-negative) 60%,transparent)}.qaid-crosshair-v{top:0;bottom:0;width:1px;background:color-mix(in srgb,var(--qaid-negative) 60%,transparent)}.qaid-type-up .qaid-crosshair-h,.qaid-type-up .qaid-crosshair-v{background:color-mix(in srgb,var(--qaid-positive) 60%,transparent)}.qaid-highlight-box{position:fixed;top:0;left:0;pointer-events:none;z-index:41;display:none;border:3px solid color-mix(in srgb,var(--qaid-negative) 80%,transparent);border-radius:2px;background:color-mix(in srgb,var(--qaid-negative) 8%,transparent);will-change:transform,width,height}.qaid-type-up .qaid-highlight-box{border-color:color-mix(in srgb,var(--qaid-positive) 80%,transparent);background:color-mix(in srgb,var(--qaid-positive) 8%,transparent)}.qaid-scope{position:fixed;width:80px;height:80px;pointer-events:none;z-index:43;transform:translate(-50%,-50%)}.qaid-scope-ring{position:absolute;inset:10px;border:2px solid color-mix(in srgb,var(--qaid-negative) 80%,transparent);border-radius:50%}.qaid-type-up .qaid-scope-ring{border-color:color-mix(in srgb,var(--qaid-positive) 80%,transparent)}.qaid-scope-ring-inner{position:absolute;inset:20px;border:1px solid color-mix(in srgb,var(--qaid-negative) 50%,transparent);border-radius:50%}.qaid-type-up .qaid-scope-ring-inner{border-color:color-mix(in srgb,var(--qaid-positive) 50%,transparent)}.qaid-scope-dot{position:absolute;top:50%;left:50%;width:4px;height:4px;background:var(--qaid-negative);border-radius:50%;transform:translate(-50%,-50%)}.qaid-type-up .qaid-scope-dot{background:var(--qaid-positive)}.qaid-selected-marker{position:fixed;border:3px solid var(--qaid-marker, #6366f1);border-radius:50%;pointer-events:none;z-index:44;animation:qaid-markerPulse 1.5s ease-in-out infinite}@keyframes qaid-markerPulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.7;transform:scale(1.05)}}.qaid-backdrop{position:fixed;inset:0;z-index:45;background:#0000004d}.qaid-modal-container{position:fixed;z-index:50;display:flex;flex-direction:column;align-items:flex-start;max-height:calc(100vh - 32px);font-family:var(--qaid-font-family, system-ui, -apple-system, sans-serif);font-size:var(--qaid-font-size, 16px)}.qaid-modal-container.qaid-above{flex-direction:column-reverse}.qaid-modal-arrow{width:0;height:0;border-left:12px solid transparent;border-right:12px solid transparent;position:relative;align-self:flex-start}.qaid-modal-container.qaid-below .qaid-modal-arrow{border-bottom:12px solid light-dark(#ffffff,#1f2937)}.qaid-modal-container.qaid-above .qaid-modal-arrow{border-top:12px solid light-dark(#ffffff,#1f2937)}.qaid-modal-box{color-scheme:inherit;background:light-dark(#ffffff,#1f2937);border-radius:1rem;padding:1.5rem;box-shadow:0 25px 50px -12px light-dark(rgba(0,0,0,.25),rgba(0,0,0,.5));width:var(--qaid-modal-width, 400px);max-width:calc(100vw - 32px);max-height:calc(100vh - 60px);overflow-y:auto}.qaid-modal-header{display:flex;align-items:flex-start;gap:.75rem;margin-bottom:1rem}button.qaid-type-toggle{border:none;display:flex;align-items:center;justify-content:center;cursor:pointer;transition:all .2s;flex-shrink:0;-webkit-appearance:none;appearance:none}button.qaid-type-toggle:hover{transform:scale(1.1)}button.qaid-type-toggle:not(.qaid-type-toggle-custom){width:2.5rem;height:2.5rem;border-radius:50%}button.qaid-type-toggle:not(.qaid-type-toggle-custom) svg{width:1.25rem;height:1.25rem}button.qaid-type-toggle.qaid-type-up{background:var(--qaid-positive);color:#fff}button.qaid-type-toggle.qaid-type-down{background:var(--qaid-negative);color:#fff}.qaid-modal-header-text{flex:1;min-width:0}.qaid-modal-title{font-size:1.125rem;font-weight:700;margin:0 0 .25rem;color:light-dark(#1f2937,#f9fafb)}.qaid-modal-subtitle{color:light-dark(#6b7280,#9ca3af);margin:0;font-size:.875rem}.qaid-textarea{width:100%;height:6rem;padding:.75rem;border:1px solid light-dark(#d1d5db,#374151);border-radius:.5rem;font-family:inherit;font-size:1rem;resize:vertical;margin-bottom:1rem;box-sizing:border-box;background:light-dark(#ffffff,#111827);color:light-dark(#1f2937,#f9fafb)}.qaid-textarea:focus{outline:none;border-color:var(--qaid-marker);box-shadow:0 0 0 3px color-mix(in srgb,var(--qaid-marker) 20%,transparent)}.qaid-btn-row{display:flex;gap:.5rem;justify-content:flex-end}button.qaid-btn-submit{padding:.5rem 1rem;background:var(--qaid-marker);color:var(--qaid-marker-text, white);border:none;border-radius:.5rem;font-size:.875rem;font-weight:500;cursor:pointer;transition:background-color .2s,filter .2s;-webkit-appearance:none;appearance:none}button.qaid-btn-submit:hover{filter:brightness(.85)}button.qaid-btn-submit:focus{outline:none;box-shadow:0 0 0 3px color-mix(in srgb,var(--qaid-marker) 30%,transparent)}.qaid-bottom-sheet{position:fixed;bottom:0;left:0;right:0;z-index:50;animation:qaid-slideUpSheet .3s ease-out;font-family:var(--qaid-font-family, system-ui, -apple-system, sans-serif);font-size:var(--qaid-font-size, 16px)}.qaid-bottom-sheet-content{background:light-dark(#ffffff,#1f2937);border-radius:1rem 1rem 0 0;padding:1.5rem;padding-bottom:max(1.5rem,env(safe-area-inset-bottom))}.qaid-bottom-sheet-handle{width:36px;height:4px;background:light-dark(rgba(0,0,0,.2),rgba(255,255,255,.2));border-radius:2px;margin:0 auto 1rem}@keyframes qaid-slideUpSheet{0%{transform:translateY(100%)}to{transform:translateY(0)}}button.qaid-btn-record:hover{background:#dc2626;color:#fff}.qaid-recording-indicator{position:fixed;top:12px;left:50%;transform:translate(-50%);display:flex;align-items:center;gap:.5rem;padding:.5rem 1rem;background:light-dark(#1f2937,#374151);color:#fff;border-radius:9999px;font-family:var(--qaid-font-family, system-ui, -apple-system, sans-serif);font-size:.875rem;font-weight:500;box-shadow:0 4px 12px #0000004d;z-index:99999;animation:qaid-slideDown .2s ease-out}.qaid-recording-dot{width:10px;height:10px;background:#dc2626;border-radius:50%;animation:qaid-dotPulse 1.5s ease-in-out infinite}@keyframes qaid-dotPulse{0%,to{opacity:1}50%{opacity:.3}}.qaid-recording-time{font-variant-numeric:tabular-nums;min-width:2.5rem;text-align:center}button.qaid-recording-stop{padding:.25rem .75rem;background:#dc2626;color:#fff;border:none;border-radius:9999px;font-size:.75rem;font-weight:600;cursor:pointer;transition:background-color .2s;-webkit-appearance:none;appearance:none}button.qaid-recording-stop:hover{background:#b91c1c}.qaid-video-preview{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;background:#0009;z-index:99998;animation:qaid-fadeIn .2s ease-out}@keyframes qaid-fadeIn{0%{opacity:0}to{opacity:1}}.qaid-video-preview-box{color-scheme:inherit;background:light-dark(#ffffff,#1f2937);border-radius:1rem;padding:1.5rem;box-shadow:0 25px 50px -12px #00000080;width:560px;max-width:calc(100vw - 32px);max-height:calc(100vh - 32px);overflow-y:auto;font-family:var(--qaid-font-family, system-ui, -apple-system, sans-serif);font-size:var(--qaid-font-size, 16px)}.qaid-video-preview-box h3{font-size:1.125rem;font-weight:700;margin:0 0 1rem;color:light-dark(#1f2937,#f9fafb)}.qaid-video-preview-box video{width:100%;border-radius:.5rem;background:#000;margin-bottom:1rem}.qaid-video-preview-box textarea{width:100%;height:4rem;padding:.75rem;border:1px solid light-dark(#d1d5db,#374151);border-radius:.5rem;font-family:inherit;font-size:.875rem;resize:vertical;margin-bottom:1rem;box-sizing:border-box;background:light-dark(#ffffff,#111827);color:light-dark(#1f2937,#f9fafb)}.qaid-video-preview-box textarea:focus{outline:none;border-color:var(--qaid-marker);box-shadow:0 0 0 3px color-mix(in srgb,var(--qaid-marker) 20%,transparent)}.qaid-video-preview-actions{display:flex;gap:.5rem;justify-content:flex-end}button.qaid-video-btn{padding:.5rem 1rem;border:none;border-radius:.5rem;font-size:.875rem;font-weight:500;cursor:pointer;transition:background-color .2s,filter .2s;-webkit-appearance:none;appearance:none}button.qaid-video-btn-cancel{background:light-dark(#f3f4f6,#374151);color:light-dark(#374151,#d1d5db)}button.qaid-video-btn-cancel:hover{background:light-dark(#e5e7eb,#4b5563)}button.qaid-video-btn-rerecord{background:light-dark(#fef3c7,#78350f);color:light-dark(#92400e,#fde68a)}button.qaid-video-btn-rerecord:hover{filter:brightness(.9)}button.qaid-video-btn-send{background:var(--qaid-marker);color:var(--qaid-marker-text, white)}button.qaid-video-btn-send:hover{filter:brightness(.85)}button.qaid-video-btn-send:disabled{opacity:.5;cursor:not-allowed}.qaid-video-sending{display:flex;align-items:center;gap:.5rem;font-size:.875rem;color:light-dark(#6b7280,#9ca3af)}",Z="body.qaid-targeting,body.qaid-targeting *{cursor:none!important}";let x=0;const tt="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 svg{width:var(--qaid-icon-size);height:var(--qaid-icon-size)}",et={small:36,medium:48,large:64},it={small:18,medium:24,large:32};function ot(e,t,i){const[o,n,s]=[e,t,i].map(r=>(r=r/255,r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4)));return .2126*o+.7152*n+.0722*s}function nt(e){if(e.startsWith("#")){const i=e.slice(1),o=i.length===3?i.split("").map(s=>s+s).join(""):i,n=parseInt(o,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 st(e){const t=nt(e);return t&&ot(t.r,t.g,t.b)>.4?"black":"white"}function at(e={}){const{positiveColor:t="rgb(0, 200, 83)",negativeColor:i="rgb(255, 0, 0)",markerColor:o="#6366f1",buttonSize:n="medium",modalWidth:s=400,backdropOpacity:r=.3,fontFamily:l="system-ui, -apple-system, sans-serif",fontSize:d=16}=e,a=et[n],c=it[n],h=st(o);return{"--qaid-positive":t,"--qaid-negative":i,"--qaid-marker":o,"--qaid-marker-text":h,"--qaid-btn-size":`${a}px`,"--qaid-icon-size":`${c}px`,"--qaid-modal-width":`${s}px`,"--qaid-backdrop-opacity":String(r),"--qaid-font-family":l,"--qaid-font-size":`${d}px`}}function rt(e,t){for(const[i,o]of Object.entries(t))e.style.setProperty(i,o)}function L(){return Q+tt}function dt(){if(x++,x>1)return;const e=document.createElement("style");e.id="qaid-styles",e.textContent=Z,document.head.appendChild(e)}function ct(){if(!(x<=0)&&(x--,x===0)){const e=document.getElementById("qaid-styles");e&&e.remove()}}const lt=["data-comp","data-qa","data-testid","data-id"];function R(e,t=document.body){let i=e;for(;i&&i!==t;){for(const o of lt){const n=i.getAttribute(o);if(n)return`${o}="${n}"`}i=i.parentElement}return null}function ht(e,t=100){const i=e.textContent?.trim().slice(0,t)||"";return i.length===t?i+"...":i}function ut(e){let t=1,i=e.previousElementSibling;for(;i;)t++,i=i.previousElementSibling;return t}function pt(e){const t=[];let i=e;for(;i&&i!==document.body&&i!==document.documentElement;){const o=i.tagName.toLowerCase(),n=ut(i);t.unshift(`${o}:nth-child(${n})`),i=i.parentElement}return t.length>0?`body > ${t.join(" > ")}`:"body"}function mt(e){return e.replace(/([!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g,"\\$1")}function ft(e){const t=R(e);return t?`[${t}]`:e.id?`#${mt(e.id)}`:pt(e)}function bt(e){const t=ht(e),i=R(e);return{selector:ft(e),text:t,dataAttr:i}}const M={width:400,height:280,arrowHeight:12,gap:8,viewportPadding:16};function gt(e,t,i,o,n){const s=e.y,r=t-(e.y+e.height);if(r>=i+o)return{top:e.y+e.height+o,position:"below"};if(s>=i+o)return{top:e.y-i-o,position:"above"};const l=r>s?"below":"above";let d;return l==="below"?d=Math.min(e.y+e.height+o,t-i-n):d=Math.max(n,e.y-i-o),{top:d,position:l}}function vt(e,t,i,o){let s=e.x+e.width/2-i/2;return s=Math.max(o,Math.min(s,t-i-o)),s}function yt(e,t,i,o=24,n=24){const r=e.clickX-t-n/2;return Math.max(o,Math.min(r,i-o-n/2))}function wt(e,t,i,o=M){const n=o.height+o.arrowHeight,s=gt(e,i,n,o.gap,o.viewportPadding),r=vt(e,t,o.width,o.viewportPadding);return{top:s.top,left:r,position:s.position}}function xt(e,t,i,o=M){const n=wt(e,t,i,o),s=yt(e,n.left,o.width);return{modal:n,arrow:{left:s}}}const qt=20;function kt(e){const t=[],i=console.error,o=console.warn,n=console.log,s=(r,l)=>{const d={message:l.map(a=>String(a)).join(" "),timestamp:Date.now(),level:r};t.length>=qt&&t.shift(),t.push(d),e&&e(d)};return console.error=function(...r){s("error",r),i.apply(console,r)},console.warn=function(...r){s("warn",r),o.apply(console,r)},console.log=function(...r){s("log",r),n.apply(console,r)},{errors:t,restore:()=>{console.error=i,console.warn=o,console.log=n}}}const Ct=20,D=4096;function k(e){if(e==null)return;const t=typeof e=="string"?e:JSON.stringify(e);return t.length>D?t.slice(0,D)+"…[truncated]":t}function H(e,t){e.length>=Ct&&e.shift(),e.push(t)}async function St(e){try{const t=await e.clone().text();return k(t)}catch{return}}function B(){const e=[],t=window.fetch;window.fetch=async function(n,s){const r=typeof n=="string"?n:n instanceof URL?n.toString():n.url,l=s?.method??(typeof n=="object"&&"method"in n?n.method:"GET");let d;s?.body&&(d=k(s.body));const a=await t.apply(window,[n,s]);if(a.status>=400){const c=await St(a);H(e,{url:r,method:l.toUpperCase(),status:a.status,statusText:a.statusText,requestBody:d,responseBody:c,timestamp:Date.now()})}return a};const i=XMLHttpRequest.prototype.open,o=XMLHttpRequest.prototype.send;return XMLHttpRequest.prototype.open=function(n,s,...r){return this._qaid_method=n,this._qaid_url=typeof s=="string"?s:s.toString(),i.apply(this,[n,s,...r])},XMLHttpRequest.prototype.send=function(n){const s=this,r=n?k(n):void 0;return s.addEventListener("load",function(){s.status>=400&&H(e,{url:s._qaid_url,method:s._qaid_method.toUpperCase(),status:s.status,statusText:s.statusText,requestBody:r,responseBody:k(s.responseText),timestamp:Date.now()})}),o.apply(this,[n])},{errors:e,restore:()=>{window.fetch=t,XMLHttpRequest.prototype.open=i,XMLHttpRequest.prototype.send=o}}}function z(){return typeof navigator<"u"&&!!navigator.mediaDevices&&typeof navigator.mediaDevices.getDisplayMedia=="function"&&typeof MediaRecorder<"u"}function O(){if(typeof MediaRecorder>"u")return"";const e=["video/webm;codecs=vp9","video/webm;codecs=vp8","video/webm","video/mp4"];for(const t of e)if(MediaRecorder.isTypeSupported(t))return t;return""}function P(e={}){const t=e.maxDuration??15,i=e.videoBitsPerSecond??8e5;let o=null,n=null,s=[],r=null,l=null,d=null,a=0,c=null,h=null,u=!1,p=null;function y(){d!==null&&(clearInterval(d),d=null),p!==null&&(clearTimeout(p),p=null),o&&(o.getTracks().forEach(m=>m.stop()),o=null),n=null,s=[],r=null,l=null,c=null,h=null}function f(){u||(u=!0,n&&n.state!=="inactive"&&n.stop())}return{async start(){u=!1,s=[];const m=O();if(!m)throw new Error("No supported video MIME type found");o=await navigator.mediaDevices.getDisplayMedia({video:{frameRate:15},audio:!1,preferCurrentTab:!0});const w=o.getVideoTracks()[0];w&&w.addEventListener("ended",()=>{f()}),n=new MediaRecorder(o,{mimeType:m,videoBitsPerSecond:i}),n.ondataavailable=g=>{g.data.size>0&&s.push(g.data)},n.onstop=()=>{const g=new Blob(s,{type:m});c&&c(g),l&&l(g),o&&o.getTracks().forEach(C=>C.stop())},n.onerror=()=>{h&&h(new Error("MediaRecorder error"))},n.start(1e3),a=Date.now(),d=setInterval(()=>{const g=Math.floor((Date.now()-a)/1e3);r&&r(g)},1e3),p=setTimeout(()=>{f()},t*1e3)},stop(){return new Promise((m,w)=>{c=m,h=w,f()})},onTick(m){r=m},onStop(m){l=m},destroy(){f(),y()}}}function Et(e=640){return typeof window<"u"&&window.innerWidth<e}function A(e,t,i){const o=i.map(s=>s.style.visibility);i.forEach(s=>s.style.visibility="hidden");const n=document.elementFromPoint(e,t);return i.forEach((s,r)=>s.style.visibility=o[r]),n}function $(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 Tt(e,t=0){const i=e.getBoundingClientRect();return{x:i.left-t,y:i.top-t,width:i.width+t*2,height:i.height+t*2}}async function It(e={}){const{quality:t=1,maxWidth:i=1280,maxHeight:o=800}=e;try{if(!navigator.mediaDevices?.getDisplayMedia)return console.warn("Screen Capture API not available"),null;const n=await navigator.mediaDevices.getDisplayMedia({preferCurrentTab:!0,video:{displaySurface:"browser"}}),s=n.getVideoTracks()[0],r=s.getSettings(),l=document.createElement("video");l.srcObject=n,l.muted=!0,await new Promise(f=>{l.onloadedmetadata=()=>{l.play(),f()}}),await new Promise(f=>{const m=()=>{l.readyState>=2?f():requestAnimationFrame(m)};m()}),await new Promise(f=>setTimeout(f,100));const d=r.width||l.videoWidth,a=r.height||l.videoHeight,c=Math.min(i/d,o/a,1),h=Math.round(d*c),u=Math.round(a*c),p=document.createElement("canvas");p.width=h,p.height=u;const y=p.getContext("2d");return y?(y.drawImage(l,0,0,h,u),s.stop(),p.toDataURL("image/webp",t)):(s.stop(),null)}catch(n){return console.warn("Screenshot capture failed:",n),null}}const N="https://qaid.dev/lib/html2canvas.min.js",Lt=1e4,Rt=50;let q=null;function Mt(){if(typeof document>"u"||typeof window>"u")return!1;const e=document.createElement("canvas");return typeof e.getContext=="function"&&!!e.getContext("2d")}function Dt(){return window.html2canvas?Promise.resolve(!0):q||(q=new Promise(e=>{if(!document.querySelector(`script[src="${N}"]`)){const n=document.createElement("script");n.src=N,n.async=!0,document.head.appendChild(n)}const i=Date.now(),o=()=>{if(window.html2canvas){e(!0);return}if(Date.now()-i>Lt){q=null,e(!1);return}setTimeout(o,Rt)};o()}),q)}async function V(e={}){const{quality:t=.8,maxWidth:i=1280,maxHeight:o=800}=e;try{if(!await Dt()||!window.html2canvas)return console.warn("html2canvas failed to load"),null;const s=await window.html2canvas(document.body,{useCORS:!0,allowTaint:!1,logging:!1,windowWidth:document.documentElement.clientWidth,windowHeight:document.documentElement.clientHeight,width:document.documentElement.clientWidth,height:document.documentElement.clientHeight,x:window.scrollX,y:window.scrollY,ignoreElements:a=>a instanceof HTMLElement?a.classList.contains("qaid-buttons")||a.classList.contains("qaid-targeting-overlay")||a.classList.contains("qaid-modal-container")||a.classList.contains("qaid-bottom-sheet")||a.classList.contains("qaid-backdrop")||a.classList.contains("qaid-selected-marker")||a.classList.contains("qaid-tooltip-text")||a.classList.contains("qaid-recording-indicator")||a.classList.contains("qaid-video-preview")||a.className?.toString().startsWith?.("qaid-"):!1}),r=s.width,l=s.height,d=Math.min(i/r,o/l,1);if(d<1){const a=Math.round(r*d),c=Math.round(l*d),h=document.createElement("canvas");h.width=a,h.height=c;const u=h.getContext("2d");return u?(u.drawImage(s,0,0,a,c),h.toDataURL("image/webp",t)):null}return s.toDataURL("image/webp",t)}catch(n){return console.warn("DOM screenshot capture failed:",n),null}}const F="qaid_visitor_id";function Ht(){try{let e=localStorage.getItem(F);return e||(e=crypto.randomUUID(),localStorage.setItem(F,e)),e}catch{return crypto.randomUUID()}}class U{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};feedbackId=null;mousePos={x:0,y:0};isMobile=!1;visitorId;consoleCapture=null;videoRecorder=null;networkCapture=null;recordedBlob=null;recordingIndicator=null;videoPreview=null;isRecording=!1;isSendingVideo=!1;shadowHost=null;shadowRoot=null;overlayShadowHost=null;overlayShadowRoot=null;buttonsContainer=null;isUserProvidedContainer=!1;overlayContainer=null;captureLayer=null;crosshairH=null;crosshairV=null;scope=null;highlightBox=null;marker=null;modalContainer=null;backdrop=null;cssVars={};boundKeyDown;boundMouseMove;boundClick;boundResize;destroyed=!1;domObserver=null;boundBeforeSwap=null;constructor(t){this.config={endpoint:t.endpoint,apiKey:t.apiKey??"",container:t.container??"",buttonClass:t.buttonClass??"",direction:t.direction??"horizontal",position:t.position??"bottom-right",offset:{x:t.offset?.x??16,y:t.offset?.y??16},zIndex:t.zIndex??50,skipTargeting:t.skipTargeting??!1,colors:{positive:t.colors?.positive??"rgb(0, 200, 83)",negative:t.colors?.negative??"rgb(255, 0, 0)",marker:t.colors?.marker??"#6366f1"},buttonSize:t.buttonSize??"medium",text:{tooltip:t.text?.tooltip??"",modalTitle:t.text?.modalTitle??"Thank you for your feedback!",modalSubtitle:t.text?.modalSubtitle??"Would you like to add a message to help us understand your feedback better?",placeholder:t.text?.placeholder??"Optional: Tell us more about your experience...",submitButton:t.text?.submitButton??"Submit",skipButton:t.text?.skipButton??"Skip"},modalWidth:t.modalWidth??400,backdropOpacity:t.backdropOpacity??.3,fontFamily:t.fontFamily??"system-ui, -apple-system, sans-serif",fontSize:t.fontSize??16,captureScreenshot:t.captureScreenshot??!1,screenshotMethod:t.screenshotMethod??"permission",screenshotOptions:{quality:t.screenshotOptions?.quality??.8,maxWidth:t.screenshotOptions?.maxWidth??1280,maxHeight:t.screenshotOptions?.maxHeight??800},incognito:t.incognito??!1,positiveIcon:t.positiveIcon??"",negativeIcon:t.negativeIcon??"",hideThumbs:t.hideThumbs??!1,css:t.css??"",captureVideo:t.captureVideo??!1,videoOptions:{maxDuration:t.videoOptions?.maxDuration??15},recordIcon:t.recordIcon??""},this.boundKeyDown=this.handleKeyDown.bind(this),this.boundMouseMove=this.handleMouseMove.bind(this),this.boundClick=this.handleClick.bind(this),this.boundResize=this.handleResize.bind(this),this.visitorId=Ht(),this.init()}applyVars(t){rt(t,this.cssVars)}init(){dt(),this.cssVars=at({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.checkMobile(),window.addEventListener("resize",this.boundResize),this.createEmbed(),this.consoleCapture=kt(t=>{this.feedbackData.consoleErrors=this.consoleCapture?.errors??[]}),this.feedbackData.consoleErrors=this.consoleCapture.errors,this.observeDom()}observeDom(){this.boundBeforeSwap=t=>{const i=t.newDocument;!i||this.destroyed||(this.shadowHost&&i.body.appendChild(this.shadowHost),this.overlayShadowHost&&i.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=Et()}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.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 i=document.createElement("style");if(i.textContent=L(),this.shadowRoot.appendChild(i),this.config.css){const a=document.createElement("style");a.textContent=this.config.css,this.shadowRoot.appendChild(a)}const o=this.config.direction==="vertical"?"qaid-vertical":"";if(this.isUserProvidedContainer)this.buttonsContainer=document.createElement("div"),this.buttonsContainer.className=`qaid-buttons qaid-${this.config.position} ${o}`.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} ${o}${this.config.incognito?" qaid-incognito":""}`.trim(),this.buttonsContainer.style.pointerEvents="auto";const{x:a,y:c}=this.config.offset;this.config.position.includes("right")?this.buttonsContainer.style.right=`${a}px`:this.buttonsContainer.style.left=`${a}px`,this.config.position.includes("bottom")?this.buttonsContainer.style.bottom=`${c}px`:this.buttonsContainer.style.top=`${c}px`}this.applyVars(this.buttonsContainer),this.shadowRoot.appendChild(this.buttonsContainer);const n=!!this.config.buttonClass,s=n?`qaid-btn-structural ${this.config.buttonClass}`:"qaid-btn",l=this.config.text.tooltip||"Feedback for us?",d=document.createElement("div");if(d.className="qaid-tooltip-text",d.textContent=l,this.applyVars(d),this.shadowRoot.appendChild(d),this.tooltipElement=d,!this.config.hideThumbs){const a=document.createElement("div");a.className="qaid-tooltip-wrapper";const c=document.createElement("button");c.type="button",c.className=n?`${s} qaid-btn-up`:"qaid-btn qaid-btn-up",c.innerHTML=this.config.positiveIcon||v,c.addEventListener("click",p=>this.handleThumbClick("up",p.currentTarget,p)),c.addEventListener("mouseenter",()=>this.showTooltip(c)),c.addEventListener("mouseleave",()=>this.hideTooltip()),a.appendChild(c);const h=document.createElement("div");h.className="qaid-tooltip-wrapper";const u=document.createElement("button");u.type="button",u.className=n?`${s} qaid-btn-down`:"qaid-btn qaid-btn-down",u.innerHTML=this.config.negativeIcon||S,u.addEventListener("click",p=>this.handleThumbClick("down",p.currentTarget,p)),u.addEventListener("mouseenter",()=>this.showTooltip(u)),u.addEventListener("mouseleave",()=>this.hideTooltip()),h.appendChild(u),this.buttonsContainer.appendChild(a),this.buttonsContainer.appendChild(h)}if(this.config.captureVideo&&z()){const a=document.createElement("div");a.className="qaid-tooltip-wrapper";const c=document.createElement("button");c.type="button",c.className=n?`${s} qaid-btn-record`:"qaid-btn qaid-btn-record",c.innerHTML=this.config.recordIcon||G,c.addEventListener("click",()=>this.startRecording()),c.addEventListener("mouseenter",()=>this.showTooltip(c)),c.addEventListener("mouseleave",()=>this.hideTooltip()),a.appendChild(c),this.buttonsContainer.appendChild(a)}}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");if(t.textContent=L(),this.overlayShadowRoot.appendChild(t),this.config.css){const i=document.createElement("style");i.textContent=this.config.css,this.overlayShadowRoot.appendChild(i)}return this.overlayShadowRoot}tooltipElement=null;showTooltip(t){if(!this.tooltipElement)return;const i=this.tooltipElement,o=8;i.style.visibility="hidden",i.classList.add("qaid-tooltip-visible");const n=t.getBoundingClientRect(),s=i.getBoundingClientRect(),r=window.innerWidth,l=window.innerHeight;let d,a;d=n.bottom+o,d+s.height>l-o&&(d=n.top-s.height-o),a=n.left,a<o?a=o:a+s.width>r-o&&(a=r-s.width-o),d<o?d=o:d+s.height>l-o&&(d=l-s.height-o),i.style.top=`${d}px`,i.style.left=`${a}px`,i.style.visibility="visible"}hideTooltip(){this.tooltipElement&&this.tooltipElement.classList.remove("qaid-tooltip-visible")}handleThumbClick(t,i,o){this.config.skipTargeting?this.submitDirectFeedback(t,i):this.startTargeting(t,o)}submitDirectFeedback(t,i){this.feedbackData.feedbackType=t,this.feedbackData.elementSelector=null,this.feedbackData.elementText=null;const o=i.getBoundingClientRect();this.selectedBounds={x:o.left,y:o.top,width:o.width,height:o.height,clickX:o.left+o.width/2,clickY:o.top+o.height/2,visible:!1},this.submitFeedback()}startTargeting(t,i){this.state="TARGETING",this.feedbackData.feedbackType=t,this.feedbackData.elementSelector=null,this.feedbackData.elementText=null,this.selectedBounds.visible=!1,this.mousePos.x=i.clientX,this.mousePos.y=i.clientY,document.body.classList.add("qaid-targeting"),t==="up"?document.body.classList.add("qaid-type-up"):document.body.classList.remove("qaid-type-up"),document.body.style.setProperty("--qaid-positive",this.cssVars["--qaid-positive"]),document.body.style.setProperty("--qaid-negative",this.cssVars["--qaid-negative"]),this.createTargetingOverlay(),document.addEventListener("keydown",this.boundKeyDown),document.addEventListener("mousemove",this.boundMouseMove),document.addEventListener("click",this.boundClick,!0)}createTargetingOverlay(){const t=this.ensureOverlayHost();this.overlayContainer=document.createElement("div"),this.overlayContainer.className=`qaid-targeting-overlay qaid-type-${this.feedbackData.feedbackType}`,this.captureLayer=document.createElement("div"),this.captureLayer.className="qaid-capture-layer";const i=document.createElement("div");i.className="qaid-vignette",this.crosshairH=document.createElement("div"),this.crosshairH.className="qaid-crosshair-h",this.crosshairV=document.createElement("div"),this.crosshairV.className="qaid-crosshair-v",this.scope=document.createElement("div"),this.scope.className="qaid-scope",this.scope.innerHTML=`
7
+ </svg>`,et="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{position:relative}.qaid-dismiss-btn{position:absolute;width:20px;height:20px;padding:0;border:none;border-radius:50%;background:#0006;color:#fff;display:flex;align-items:center;justify-content: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}.qaid-bottom-right .qaid-dismiss-btn{bottom:100%;right:0;margin-bottom:4px}.qaid-bottom-left .qaid-dismiss-btn{bottom:100%;left:0;margin-bottom:4px}.qaid-top-right .qaid-dismiss-btn{top:100%;right:0;margin-top:4px}.qaid-top-left .qaid-dismiss-btn{top:100%;left:0;margin-top:4px}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}.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:1rem;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}.qaid-targeting-overlay{position:fixed;inset:0;z-index:40;pointer-events:none}.qaid-capture-layer{position:fixed;inset:0;pointer-events:none;z-index:9999}@keyframes qaid-slideDown{0%{transform:translateY(-100%)}to{transform:translateY(0)}}.qaid-vignette{position:fixed;inset:0;pointer-events:none;background:radial-gradient(ellipse at center,transparent 30%,rgba(0,0,0,.3) 70%,rgba(0,0,0,.6) 100%);z-index:41}.qaid-crosshair-h,.qaid-crosshair-v{position:fixed;pointer-events:none;z-index:42}.qaid-crosshair-h{left:0;right:0;height:1px;background:color-mix(in srgb,var(--qaid-negative) 60%,transparent)}.qaid-crosshair-v{top:0;bottom:0;width:1px;background:color-mix(in srgb,var(--qaid-negative) 60%,transparent)}.qaid-type-up .qaid-crosshair-h,.qaid-type-up .qaid-crosshair-v{background:color-mix(in srgb,var(--qaid-positive) 60%,transparent)}.qaid-highlight-box{position:fixed;top:0;left:0;pointer-events:none;z-index:41;display:none;border:3px solid color-mix(in srgb,var(--qaid-negative) 80%,transparent);border-radius:2px;background:color-mix(in srgb,var(--qaid-negative) 8%,transparent);will-change:transform,width,height}.qaid-type-up .qaid-highlight-box{border-color:color-mix(in srgb,var(--qaid-positive) 80%,transparent);background:color-mix(in srgb,var(--qaid-positive) 8%,transparent)}.qaid-scope{position:fixed;width:80px;height:80px;pointer-events:none;z-index:43;transform:translate(-50%,-50%)}.qaid-scope-ring{position:absolute;inset:10px;border:2px solid color-mix(in srgb,var(--qaid-negative) 80%,transparent);border-radius:50%}.qaid-type-up .qaid-scope-ring{border-color:color-mix(in srgb,var(--qaid-positive) 80%,transparent)}.qaid-scope-ring-inner{position:absolute;inset:20px;border:1px solid color-mix(in srgb,var(--qaid-negative) 50%,transparent);border-radius:50%}.qaid-type-up .qaid-scope-ring-inner{border-color:color-mix(in srgb,var(--qaid-positive) 50%,transparent)}.qaid-scope-dot{position:absolute;top:50%;left:50%;width:4px;height:4px;background:var(--qaid-negative);border-radius:50%;transform:translate(-50%,-50%)}.qaid-type-up .qaid-scope-dot{background:var(--qaid-positive)}.qaid-selected-marker{position:fixed;border:3px solid var(--qaid-marker, #6366f1);border-radius:50%;pointer-events:none;z-index:44;animation:qaid-markerPulse 1.5s ease-in-out infinite}@keyframes qaid-markerPulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.7;transform:scale(1.05)}}.qaid-backdrop{position:fixed;inset:0;z-index:45;background:#0000004d}.qaid-modal-container{position:fixed;z-index:50;display:flex;flex-direction:column;align-items:flex-start;max-height:calc(100vh - 32px);font-family:var(--qaid-font-family, system-ui, -apple-system, sans-serif);font-size:var(--qaid-font-size, 16px)}.qaid-modal-container.qaid-above{flex-direction:column-reverse}.qaid-modal-arrow{width:0;height:0;border-left:12px solid transparent;border-right:12px solid transparent;position:relative;align-self:flex-start}.qaid-modal-container.qaid-below .qaid-modal-arrow{border-bottom:12px solid light-dark(#ffffff,#1f2937)}.qaid-modal-container.qaid-above .qaid-modal-arrow{border-top:12px solid light-dark(#ffffff,#1f2937)}.qaid-modal-box{color-scheme:inherit;background:light-dark(#ffffff,#1f2937);border-radius:1rem;padding:1.5rem;box-shadow:0 25px 50px -12px light-dark(rgba(0,0,0,.25),rgba(0,0,0,.5));width:var(--qaid-modal-width, 400px);max-width:calc(100vw - 32px);max-height:calc(100vh - 60px);overflow-y:auto}.qaid-modal-header{display:flex;align-items:flex-start;gap:.75rem;margin-bottom:1rem}button.qaid-type-toggle{border:none;display:flex;align-items:center;justify-content:center;cursor:pointer;transition:all .2s;flex-shrink:0;-webkit-appearance:none;appearance:none}button.qaid-type-toggle:hover{transform:scale(1.1)}button.qaid-type-toggle:not(.qaid-type-toggle-custom){width:2.5rem;height:2.5rem;border-radius:50%}button.qaid-type-toggle:not(.qaid-type-toggle-custom) svg{width:1.25rem;height:1.25rem}button.qaid-type-toggle.qaid-type-up{background:var(--qaid-positive);color:#fff}button.qaid-type-toggle.qaid-type-down{background:var(--qaid-negative);color:#fff}.qaid-modal-header-text{flex:1;min-width:0}.qaid-modal-title{font-size:1.125rem;font-weight:700;margin:0 0 .25rem;color:light-dark(#1f2937,#f9fafb)}.qaid-modal-subtitle{color:light-dark(#6b7280,#9ca3af);margin:0;font-size:.875rem}.qaid-textarea{width:100%;height:6rem;padding:.75rem;border:1px solid light-dark(#d1d5db,#374151);border-radius:.5rem;font-family:inherit;font-size:1rem;resize:vertical;margin-bottom:1rem;box-sizing:border-box;background:light-dark(#ffffff,#111827);color:light-dark(#1f2937,#f9fafb)}.qaid-textarea:focus{outline:none;border-color:var(--qaid-marker);box-shadow:0 0 0 3px color-mix(in srgb,var(--qaid-marker) 20%,transparent)}.qaid-btn-row{display:flex;gap:.5rem;justify-content:flex-end}button.qaid-btn-submit{padding:.5rem 1rem;background:var(--qaid-marker);color:var(--qaid-marker-text, white);border:none;border-radius:.5rem;font-size:.875rem;font-weight:500;cursor:pointer;transition:background-color .2s,filter .2s;-webkit-appearance:none;appearance:none}button.qaid-btn-submit:hover{filter:brightness(.85)}button.qaid-btn-submit:focus{outline:none;box-shadow:0 0 0 3px color-mix(in srgb,var(--qaid-marker) 30%,transparent)}.qaid-bottom-sheet{position:fixed;bottom:0;left:0;right:0;z-index:50;animation:qaid-slideUpSheet .3s ease-out;font-family:var(--qaid-font-family, system-ui, -apple-system, sans-serif);font-size:var(--qaid-font-size, 16px)}.qaid-bottom-sheet-content{background:light-dark(#ffffff,#1f2937);border-radius:1rem 1rem 0 0;padding:1.5rem;padding-bottom:max(1.5rem,env(safe-area-inset-bottom))}.qaid-bottom-sheet-handle{width:36px;height:4px;background:light-dark(rgba(0,0,0,.2),rgba(255,255,255,.2));border-radius:2px;margin:0 auto 1rem}@keyframes qaid-slideUpSheet{0%{transform:translateY(100%)}to{transform:translateY(0)}}button.qaid-btn-record:hover{background:#dc2626;color:#fff}.qaid-recording-indicator{position:fixed;top:12px;left:50%;transform:translate(-50%);display:flex;align-items:center;gap:.5rem;padding:.5rem 1rem;background:light-dark(#1f2937,#374151);color:#fff;border-radius:9999px;font-family:var(--qaid-font-family, system-ui, -apple-system, sans-serif);font-size:.875rem;font-weight:500;box-shadow:0 4px 12px #0000004d;z-index:99999;animation:qaid-slideDown .2s ease-out}.qaid-recording-dot{width:10px;height:10px;background:#dc2626;border-radius:50%;animation:qaid-dotPulse 1.5s ease-in-out infinite}@keyframes qaid-dotPulse{0%,to{opacity:1}50%{opacity:.3}}.qaid-recording-time{font-variant-numeric:tabular-nums;min-width:2.5rem;text-align:center}button.qaid-recording-stop{padding:.25rem .75rem;background:#dc2626;color:#fff;border:none;border-radius:9999px;font-size:.75rem;font-weight:600;cursor:pointer;transition:background-color .2s;-webkit-appearance:none;appearance:none}button.qaid-recording-stop:hover{background:#b91c1c}.qaid-video-preview{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;background:#0009;z-index:99998;animation:qaid-fadeIn .2s ease-out}@keyframes qaid-fadeIn{0%{opacity:0}to{opacity:1}}.qaid-video-preview-box{color-scheme:inherit;background:light-dark(#ffffff,#1f2937);border-radius:1rem;padding:1.5rem;box-shadow:0 25px 50px -12px #00000080;width:560px;max-width:calc(100vw - 32px);max-height:calc(100vh - 32px);overflow-y:auto;font-family:var(--qaid-font-family, system-ui, -apple-system, sans-serif);font-size:var(--qaid-font-size, 16px)}.qaid-video-preview-box h3{font-size:1.125rem;font-weight:700;margin:0 0 1rem;color:light-dark(#1f2937,#f9fafb)}.qaid-video-preview-box video{width:100%;border-radius:.5rem;background:#000;margin-bottom:1rem}.qaid-video-preview-box textarea{width:100%;height:4rem;padding:.75rem;border:1px solid light-dark(#d1d5db,#374151);border-radius:.5rem;font-family:inherit;font-size:.875rem;resize:vertical;margin-bottom:1rem;box-sizing:border-box;background:light-dark(#ffffff,#111827);color:light-dark(#1f2937,#f9fafb)}.qaid-video-preview-box textarea:focus{outline:none;border-color:var(--qaid-marker);box-shadow:0 0 0 3px color-mix(in srgb,var(--qaid-marker) 20%,transparent)}.qaid-video-preview-actions{display:flex;gap:.5rem;justify-content:flex-end}button.qaid-video-btn{padding:.5rem 1rem;border:none;border-radius:.5rem;font-size:.875rem;font-weight:500;cursor:pointer;transition:background-color .2s,filter .2s;-webkit-appearance:none;appearance:none}button.qaid-video-btn-cancel{background:light-dark(#f3f4f6,#374151);color:light-dark(#374151,#d1d5db)}button.qaid-video-btn-cancel:hover{background:light-dark(#e5e7eb,#4b5563)}button.qaid-video-btn-rerecord{background:light-dark(#fef3c7,#78350f);color:light-dark(#92400e,#fde68a)}button.qaid-video-btn-rerecord:hover{filter:brightness(.9)}button.qaid-video-btn-send{background:var(--qaid-marker);color:var(--qaid-marker-text, white)}button.qaid-video-btn-send:hover{filter:brightness(.85)}button.qaid-video-btn-send:disabled{opacity:.5;cursor:not-allowed}.qaid-video-sending{display:flex;align-items:center;gap:.5rem;font-size:.875rem;color:light-dark(#6b7280,#9ca3af)}",it="body.qaid-targeting,body.qaid-targeting *{cursor:none!important}";let q=0;const ot="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 svg{width:var(--qaid-icon-size);height:var(--qaid-icon-size)}",nt={small:36,medium:48,large:64},st={small:18,medium:24,large:32};function at(e,t,i){const[o,n,s]=[e,t,i].map(r=>(r=r/255,r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4)));return .2126*o+.7152*n+.0722*s}function rt(e){if(e.startsWith("#")){const i=e.slice(1),o=i.length===3?i.split("").map(s=>s+s).join(""):i,n=parseInt(o,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 dt(e){const t=rt(e);return t&&at(t.r,t.g,t.b)>.4?"black":"white"}function ct(e={}){const{positiveColor:t="rgb(0, 200, 83)",negativeColor:i="rgb(255, 0, 0)",markerColor:o="#6366f1",buttonSize:n="medium",modalWidth:s=400,backdropOpacity:r=.3,fontFamily:l="system-ui, -apple-system, sans-serif",fontSize:d=16}=e,a=nt[n],c=st[n],h=dt(o);return{"--qaid-positive":t,"--qaid-negative":i,"--qaid-marker":o,"--qaid-marker-text":h,"--qaid-btn-size":`${a}px`,"--qaid-icon-size":`${c}px`,"--qaid-modal-width":`${s}px`,"--qaid-backdrop-opacity":String(r),"--qaid-font-family":l,"--qaid-font-size":`${d}px`}}function lt(e,t){for(const[i,o]of Object.entries(t))e.style.setProperty(i,o)}function H(){return et+ot}function ht(){if(q++,q>1)return;const e=document.createElement("style");e.id="qaid-styles",e.textContent=it,document.head.appendChild(e)}function ut(){if(!(q<=0)&&(q--,q===0)){const e=document.getElementById("qaid-styles");e&&e.remove()}}const pt=["data-comp","data-qa","data-testid","data-id"];function D(e,t=document.body){let i=e;for(;i&&i!==t;){for(const o of pt){const n=i.getAttribute(o);if(n)return`${o}="${n}"`}i=i.parentElement}return null}function mt(e,t=100){const i=e.textContent?.trim().slice(0,t)||"";return i.length===t?i+"...":i}function ft(e){let t=1,i=e.previousElementSibling;for(;i;)t++,i=i.previousElementSibling;return t}function bt(e){const t=[];let i=e;for(;i&&i!==document.body&&i!==document.documentElement;){const o=i.tagName.toLowerCase(),n=ft(i);t.unshift(`${o}:nth-child(${n})`),i=i.parentElement}return t.length>0?`body > ${t.join(" > ")}`:"body"}function gt(e){return e.replace(/([!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g,"\\$1")}function vt(e){const t=D(e);return t?`[${t}]`:e.id?`#${gt(e.id)}`:bt(e)}function yt(e){const t=mt(e),i=D(e);return{selector:vt(e),text:t,dataAttr:i}}const M={width:400,height:280,arrowHeight:12,gap:8,viewportPadding:16};function wt(e,t,i,o,n){const s=e.y,r=t-(e.y+e.height);if(r>=i+o)return{top:e.y+e.height+o,position:"below"};if(s>=i+o)return{top:e.y-i-o,position:"above"};const l=r>s?"below":"above";let d;return l==="below"?d=Math.min(e.y+e.height+o,t-i-n):d=Math.max(n,e.y-i-o),{top:d,position:l}}function qt(e,t,i,o){let s=e.x+e.width/2-i/2;return s=Math.max(o,Math.min(s,t-i-o)),s}function xt(e,t,i,o=24,n=24){const r=e.clickX-t-n/2;return Math.max(o,Math.min(r,i-o-n/2))}function kt(e,t,i,o=M){const n=o.height+o.arrowHeight,s=wt(e,i,n,o.gap,o.viewportPadding),r=qt(e,t,o.width,o.viewportPadding);return{top:s.top,left:r,position:s.position}}function Ct(e,t,i,o=M){const n=kt(e,t,i,o),s=xt(e,n.left,o.width);return{modal:n,arrow:{left:s}}}const St=20;function Et(e){const t=[],i=console.error,o=console.warn,n=console.log,s=(r,l)=>{const d={message:l.map(a=>String(a)).join(" "),timestamp:Date.now(),level:r};t.length>=St&&t.shift(),t.push(d),e&&e(d)};return console.error=function(...r){s("error",r),i.apply(console,r)},console.warn=function(...r){s("warn",r),o.apply(console,r)},console.log=function(...r){s("log",r),n.apply(console,r)},{errors:t,restore:()=>{console.error=i,console.warn=o,console.log=n}}}const Tt=20,R=4096;function k(e){if(e==null)return;const t=typeof e=="string"?e:JSON.stringify(e);return t.length>R?t.slice(0,R)+"…[truncated]":t}function B(e,t){e.length>=Tt&&e.shift(),e.push(t)}async function It(e){try{const t=await e.clone().text();return k(t)}catch{return}}function z(){const e=[],t=window.fetch;window.fetch=async function(n,s){const r=typeof n=="string"?n:n instanceof URL?n.toString():n.url,l=s?.method??(typeof n=="object"&&"method"in n?n.method:"GET");let d;s?.body&&(d=k(s.body));const a=await t.apply(window,[n,s]);if(a.status>=400){const c=await It(a);B(e,{url:r,method:l.toUpperCase(),status:a.status,statusText:a.statusText,requestBody:d,responseBody:c,timestamp:Date.now()})}return a};const i=XMLHttpRequest.prototype.open,o=XMLHttpRequest.prototype.send;return XMLHttpRequest.prototype.open=function(n,s,...r){return this._qaid_method=n,this._qaid_url=typeof s=="string"?s:s.toString(),i.apply(this,[n,s,...r])},XMLHttpRequest.prototype.send=function(n){const s=this,r=n?k(n):void 0;return s.addEventListener("load",function(){s.status>=400&&B(e,{url:s._qaid_url,method:s._qaid_method.toUpperCase(),status:s.status,statusText:s.statusText,requestBody:r,responseBody:k(s.responseText),timestamp:Date.now()})}),o.apply(this,[n])},{errors:e,restore:()=>{window.fetch=t,XMLHttpRequest.prototype.open=i,XMLHttpRequest.prototype.send=o}}}function P(){return typeof navigator<"u"&&!!navigator.mediaDevices&&typeof navigator.mediaDevices.getDisplayMedia=="function"&&typeof MediaRecorder<"u"}function O(){if(typeof MediaRecorder>"u")return"";const e=["video/webm;codecs=vp9","video/webm;codecs=vp8","video/webm","video/mp4"];for(const t of e)if(MediaRecorder.isTypeSupported(t))return t;return""}function A(e={}){const t=e.maxDuration??15,i=e.videoBitsPerSecond??8e5;let o=null,n=null,s=[],r=null,l=null,d=null,a=0,c=null,h=null,u=!1,p=null;function y(){d!==null&&(clearInterval(d),d=null),p!==null&&(clearTimeout(p),p=null),o&&(o.getTracks().forEach(m=>m.stop()),o=null),n=null,s=[],r=null,l=null,c=null,h=null}function f(){u||(u=!0,n&&n.state!=="inactive"&&n.stop())}return{async start(){u=!1,s=[];const m=O();if(!m)throw new Error("No supported video MIME type found");o=await navigator.mediaDevices.getDisplayMedia({video:{frameRate:15},audio:!1,preferCurrentTab:!0});const w=o.getVideoTracks()[0];w&&w.addEventListener("ended",()=>{f()}),n=new MediaRecorder(o,{mimeType:m,videoBitsPerSecond:i}),n.ondataavailable=g=>{g.data.size>0&&s.push(g.data)},n.onstop=()=>{const g=new Blob(s,{type:m});c&&c(g),l&&l(g),o&&o.getTracks().forEach(C=>C.stop())},n.onerror=()=>{h&&h(new Error("MediaRecorder error"))},n.start(1e3),a=Date.now(),d=setInterval(()=>{const g=Math.floor((Date.now()-a)/1e3);r&&r(g)},1e3),p=setTimeout(()=>{f()},t*1e3)},stop(){return new Promise((m,w)=>{c=m,h=w,f()})},onTick(m){r=m},onStop(m){l=m},destroy(){f(),y()}}}function Lt(e=640){return typeof window<"u"&&window.innerWidth<e}function $(e,t,i){const o=i.map(s=>s.style.visibility);i.forEach(s=>s.style.visibility="hidden");const n=document.elementFromPoint(e,t);return i.forEach((s,r)=>s.style.visibility=o[r]),n}function N(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 Ht(e,t=0){const i=e.getBoundingClientRect();return{x:i.left-t,y:i.top-t,width:i.width+t*2,height:i.height+t*2}}async function Dt(e={}){const{quality:t=1,maxWidth:i=1280,maxHeight:o=800}=e;try{if(!navigator.mediaDevices?.getDisplayMedia)return console.warn("Screen Capture API not available"),null;const n=await navigator.mediaDevices.getDisplayMedia({preferCurrentTab:!0,video:{displaySurface:"browser"}}),s=n.getVideoTracks()[0],r=s.getSettings(),l=document.createElement("video");l.srcObject=n,l.muted=!0,await new Promise(f=>{l.onloadedmetadata=()=>{l.play(),f()}}),await new Promise(f=>{const m=()=>{l.readyState>=2?f():requestAnimationFrame(m)};m()}),await new Promise(f=>setTimeout(f,100));const d=r.width||l.videoWidth,a=r.height||l.videoHeight,c=Math.min(i/d,o/a,1),h=Math.round(d*c),u=Math.round(a*c),p=document.createElement("canvas");p.width=h,p.height=u;const y=p.getContext("2d");return y?(y.drawImage(l,0,0,h,u),s.stop(),p.toDataURL("image/webp",t)):(s.stop(),null)}catch(n){return console.warn("Screenshot capture failed:",n),null}}const V="https://qaid.dev/lib/html2canvas.min.js",Mt=1e4,Rt=50;let x=null;function Bt(){if(typeof document>"u"||typeof window>"u")return!1;const e=document.createElement("canvas");return typeof e.getContext=="function"&&!!e.getContext("2d")}function zt(){return window.html2canvas?Promise.resolve(!0):x||(x=new Promise(e=>{if(!document.querySelector(`script[src="${V}"]`)){const n=document.createElement("script");n.src=V,n.async=!0,document.head.appendChild(n)}const i=Date.now(),o=()=>{if(window.html2canvas){e(!0);return}if(Date.now()-i>Mt){x=null,e(!1);return}setTimeout(o,Rt)};o()}),x)}async function _(e={}){const{quality:t=.8,maxWidth:i=1280,maxHeight:o=800}=e;try{if(!await zt()||!window.html2canvas)return console.warn("html2canvas failed to load"),null;const s=await window.html2canvas(document.body,{useCORS:!0,allowTaint:!1,logging:!1,windowWidth:document.documentElement.clientWidth,windowHeight:document.documentElement.clientHeight,width:document.documentElement.clientWidth,height:document.documentElement.clientHeight,x:window.scrollX,y:window.scrollY,ignoreElements:a=>a instanceof HTMLElement?a.classList.contains("qaid-buttons")||a.classList.contains("qaid-targeting-overlay")||a.classList.contains("qaid-modal-container")||a.classList.contains("qaid-bottom-sheet")||a.classList.contains("qaid-backdrop")||a.classList.contains("qaid-selected-marker")||a.classList.contains("qaid-tooltip-text")||a.classList.contains("qaid-recording-indicator")||a.classList.contains("qaid-video-preview")||a.className?.toString().startsWith?.("qaid-"):!1}),r=s.width,l=s.height,d=Math.min(i/r,o/l,1);if(d<1){const a=Math.round(r*d),c=Math.round(l*d),h=document.createElement("canvas");h.width=a,h.height=c;const u=h.getContext("2d");return u?(u.drawImage(s,0,0,a,c),h.toDataURL("image/webp",t)):null}return s.toDataURL("image/webp",t)}catch(n){return console.warn("DOM screenshot capture failed:",n),null}}const F="qaid_visitor_id",U="qaid_hide_feedback";function E(e){return e?`${U}_${e}`:U}function Pt(e){try{return localStorage.getItem(E(e))==="1"}catch{return!1}}function W(e,t=!0){try{t?localStorage.setItem(E(e),"1"):localStorage.removeItem(E(e))}catch{}}function Ot(){try{let e=localStorage.getItem(F);return e||(e=crypto.randomUUID(),localStorage.setItem(F,e)),e}catch{return crypto.randomUUID()}}class X{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};feedbackId=null;mousePos={x:0,y:0};isMobile=!1;visitorId;consoleCapture=null;videoRecorder=null;networkCapture=null;recordedBlob=null;recordingIndicator=null;videoPreview=null;isRecording=!1;isSendingVideo=!1;shadowHost=null;shadowRoot=null;overlayShadowHost=null;overlayShadowRoot=null;buttonsContainer=null;isUserProvidedContainer=!1;overlayContainer=null;captureLayer=null;crosshairH=null;crosshairV=null;scope=null;highlightBox=null;marker=null;modalContainer=null;backdrop=null;dismissBtn=null;cssVars={};boundKeyDown;boundMouseMove;boundClick;boundResize;destroyed=!1;domObserver=null;boundBeforeSwap=null;constructor(t){this.config={endpoint:t.endpoint,apiKey:t.apiKey??"",container:t.container??"",buttonClass:t.buttonClass??"",direction:t.direction??"horizontal",position:t.position??"bottom-right",offset:{x:t.offset?.x??16,y:t.offset?.y??16},zIndex:t.zIndex??50,skipTargeting:t.skipTargeting??!1,colors:{positive:t.colors?.positive??"rgb(0, 200, 83)",negative:t.colors?.negative??"rgb(255, 0, 0)",marker:t.colors?.marker??"#6366f1"},buttonSize:t.buttonSize??"medium",text:{tooltip:t.text?.tooltip??"",modalTitle:t.text?.modalTitle??"Thank you for your feedback!",modalSubtitle:t.text?.modalSubtitle??"Would you like to add a message to help us understand your feedback better?",placeholder:t.text?.placeholder??"Optional: Tell us more about your experience...",submitButton:t.text?.submitButton??"Submit",skipButton:t.text?.skipButton??"Skip"},modalWidth:t.modalWidth??400,backdropOpacity:t.backdropOpacity??.3,fontFamily:t.fontFamily??"system-ui, -apple-system, sans-serif",fontSize:t.fontSize??16,captureScreenshot:t.captureScreenshot??!1,screenshotMethod:t.screenshotMethod??"permission",screenshotOptions:{quality:t.screenshotOptions?.quality??.8,maxWidth:t.screenshotOptions?.maxWidth??1280,maxHeight:t.screenshotOptions?.maxHeight??800},incognito:t.incognito??!1,positiveIcon:t.positiveIcon??"",negativeIcon:t.negativeIcon??"",hideThumbs:t.hideThumbs??!1,css:t.css??"",captureVideo:t.captureVideo??!1,videoOptions:{maxDuration:t.videoOptions?.maxDuration??15},recordIcon:t.recordIcon??""},this.boundKeyDown=this.handleKeyDown.bind(this),this.boundMouseMove=this.handleMouseMove.bind(this),this.boundClick=this.handleClick.bind(this),this.boundResize=this.handleResize.bind(this),this.visitorId=Ot(),this.init()}applyVars(t){lt(t,this.cssVars)}init(){ht(),this.cssVars=ct({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}),Pt(this.config.apiKey)&&(this.config.incognito=!0),this.checkMobile(),window.addEventListener("resize",this.boundResize),this.createEmbed(),this.consoleCapture=Et(t=>{this.feedbackData.consoleErrors=this.consoleCapture?.errors??[]}),this.feedbackData.consoleErrors=this.consoleCapture.errors,this.observeDom()}observeDom(){this.boundBeforeSwap=t=>{const i=t.newDocument;!i||this.destroyed||(this.shadowHost&&i.body.appendChild(this.shadowHost),this.overlayShadowHost&&i.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=Lt()}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.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 i=document.createElement("style");if(i.textContent=H(),this.shadowRoot.appendChild(i),this.config.css){const a=document.createElement("style");a.textContent=this.config.css,this.shadowRoot.appendChild(a)}const o=this.config.direction==="vertical"?"qaid-vertical":"";if(this.isUserProvidedContainer)this.buttonsContainer=document.createElement("div"),this.buttonsContainer.className=`qaid-buttons qaid-${this.config.position} ${o}`.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} ${o}${this.config.incognito?" qaid-incognito":""}`.trim(),this.buttonsContainer.style.pointerEvents="auto";const{x:a,y:c}=this.config.offset;this.config.position.includes("right")?this.buttonsContainer.style.right=`${a}px`:this.buttonsContainer.style.left=`${a}px`,this.config.position.includes("bottom")?this.buttonsContainer.style.bottom=`${c}px`:this.buttonsContainer.style.top=`${c}px`}this.applyVars(this.buttonsContainer),this.shadowRoot.appendChild(this.buttonsContainer);const n=!!this.config.buttonClass,s=n?`qaid-btn-structural ${this.config.buttonClass}`:"qaid-btn",l=this.config.text.tooltip||"Feedback for us?",d=document.createElement("div");if(d.className="qaid-tooltip-text",d.textContent=l,this.applyVars(d),this.shadowRoot.appendChild(d),this.tooltipElement=d,!this.config.hideThumbs){const a=document.createElement("div");a.className="qaid-tooltip-wrapper";const c=document.createElement("button");c.type="button",c.className=n?`${s} qaid-btn-up`:"qaid-btn qaid-btn-up",c.innerHTML=this.config.positiveIcon||v,c.addEventListener("click",p=>this.handleThumbClick("up",p.currentTarget,p)),c.addEventListener("mouseenter",()=>this.showTooltip(c)),c.addEventListener("mouseleave",()=>this.hideTooltip()),a.appendChild(c);const h=document.createElement("div");h.className="qaid-tooltip-wrapper";const u=document.createElement("button");u.type="button",u.className=n?`${s} qaid-btn-down`:"qaid-btn qaid-btn-down",u.innerHTML=this.config.negativeIcon||S,u.addEventListener("click",p=>this.handleThumbClick("down",p.currentTarget,p)),u.addEventListener("mouseenter",()=>this.showTooltip(u)),u.addEventListener("mouseleave",()=>this.hideTooltip()),h.appendChild(u),this.buttonsContainer.appendChild(a),this.buttonsContainer.appendChild(h)}if(this.config.captureVideo&&P()){const a=document.createElement("div");a.className="qaid-tooltip-wrapper";const c=document.createElement("button");c.type="button",c.className=n?`${s} qaid-btn-record`:"qaid-btn qaid-btn-record",c.innerHTML=this.config.recordIcon||tt,c.addEventListener("click",()=>this.startRecording()),c.addEventListener("mouseenter",()=>this.showTooltip(c)),c.addEventListener("mouseleave",()=>this.hideTooltip()),a.appendChild(c),this.buttonsContainer.appendChild(a)}this.dismissBtn=document.createElement("button"),this.dismissBtn.type="button",this.dismissBtn.className="qaid-dismiss-btn",this.dismissBtn.setAttribute("aria-label","Hide Feedback"),this.dismissBtn.title="Hide Feedback",this.dismissBtn.innerHTML='<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>',this.dismissBtn.addEventListener("click",a=>{a.stopPropagation(),this.handleDismiss()}),this.buttonsContainer.appendChild(this.dismissBtn)}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");if(t.textContent=H(),this.overlayShadowRoot.appendChild(t),this.config.css){const i=document.createElement("style");i.textContent=this.config.css,this.overlayShadowRoot.appendChild(i)}return this.overlayShadowRoot}tooltipElement=null;showTooltip(t){if(!this.tooltipElement)return;const i=this.tooltipElement,o=8;i.style.visibility="hidden",i.classList.add("qaid-tooltip-visible");const n=t.getBoundingClientRect(),s=i.getBoundingClientRect(),r=window.innerWidth,l=window.innerHeight;let d,a;d=n.bottom+o,d+s.height>l-o&&(d=n.top-s.height-o),a=n.left,a<o?a=o:a+s.width>r-o&&(a=r-s.width-o),d<o?d=o:d+s.height>l-o&&(d=l-s.height-o),i.style.top=`${d}px`,i.style.left=`${a}px`,i.style.visibility="visible"}hideTooltip(){this.tooltipElement&&this.tooltipElement.classList.remove("qaid-tooltip-visible")}handleDismiss(){this.buttonsContainer&&this.buttonsContainer.classList.add("qaid-incognito"),W(this.config.apiKey,!0)}handleThumbClick(t,i,o){this.buttonsContainer?.classList.contains("qaid-incognito")&&(this.buttonsContainer.classList.remove("qaid-incognito"),W(this.config.apiKey,!1)),this.config.skipTargeting?this.submitDirectFeedback(t,i):this.startTargeting(t,o)}submitDirectFeedback(t,i){this.feedbackData.feedbackType=t,this.feedbackData.elementSelector=null,this.feedbackData.elementText=null;const o=i.getBoundingClientRect();this.selectedBounds={x:o.left,y:o.top,width:o.width,height:o.height,clickX:o.left+o.width/2,clickY:o.top+o.height/2,visible:!1},this.submitFeedback()}startTargeting(t,i){this.state="TARGETING",this.feedbackData.feedbackType=t,this.feedbackData.elementSelector=null,this.feedbackData.elementText=null,this.selectedBounds.visible=!1,this.mousePos.x=i.clientX,this.mousePos.y=i.clientY,document.body.classList.add("qaid-targeting"),t==="up"?document.body.classList.add("qaid-type-up"):document.body.classList.remove("qaid-type-up"),document.body.style.setProperty("--qaid-positive",this.cssVars["--qaid-positive"]),document.body.style.setProperty("--qaid-negative",this.cssVars["--qaid-negative"]),this.createTargetingOverlay(),document.addEventListener("keydown",this.boundKeyDown),document.addEventListener("mousemove",this.boundMouseMove),document.addEventListener("click",this.boundClick,!0)}createTargetingOverlay(){const t=this.ensureOverlayHost();this.overlayContainer=document.createElement("div"),this.overlayContainer.className=`qaid-targeting-overlay qaid-type-${this.feedbackData.feedbackType}`,this.captureLayer=document.createElement("div"),this.captureLayer.className="qaid-capture-layer";const i=document.createElement("div");i.className="qaid-vignette",this.crosshairH=document.createElement("div"),this.crosshairH.className="qaid-crosshair-h",this.crosshairV=document.createElement("div"),this.crosshairV.className="qaid-crosshair-v",this.scope=document.createElement("div"),this.scope.className="qaid-scope",this.scope.innerHTML=`
8
8
  <div class="qaid-scope-ring"></div>
9
9
  <div class="qaid-scope-ring-inner"></div>
10
10
  <div class="qaid-scope-dot"></div>
11
- `,this.highlightBox=document.createElement("div"),this.highlightBox.className="qaid-highlight-box",this.overlayContainer.appendChild(this.captureLayer),this.overlayContainer.appendChild(i),this.overlayContainer.appendChild(this.highlightBox),this.overlayContainer.appendChild(this.crosshairH),this.overlayContainer.appendChild(this.crosshairV),this.overlayContainer.appendChild(this.scope),this.crosshairH.style.top=`${this.mousePos.y}px`,this.crosshairV.style.left=`${this.mousePos.x}px`,this.scope.style.left=`${this.mousePos.x}px`,this.scope.style.top=`${this.mousePos.y}px`,this.applyVars(this.overlayContainer),t.appendChild(this.overlayContainer)}handleKeyDown(t){t.key==="Escape"&&(this.isRecording?this.stopRecording():this.videoPreview?this.cancelRecordingPreview():this.state==="TARGETING"?this.cancelTargeting():this.state==="MODAL_OPEN"&&this.closeModal())}handleMouseMove(t){if(this.mousePos.x=t.clientX,this.mousePos.y=t.clientY,this.crosshairH&&(this.crosshairH.style.top=`${t.clientY}px`),this.crosshairV&&(this.crosshairV.style.left=`${t.clientX}px`),this.scope&&(this.scope.style.left=`${t.clientX}px`,this.scope.style.top=`${t.clientY}px`),this.captureLayer&&this.shadowHost){const i=[this.shadowHost,this.overlayShadowHost].filter(Boolean),o=A(t.clientX,t.clientY,i);if(o&&!$(o)){if(this.highlightBox){const n=o.getBoundingClientRect();this.highlightBox.style.transform=`translate(${n.left}px, ${n.top}px)`,this.highlightBox.style.width=`${n.width}px`,this.highlightBox.style.height=`${n.height}px`,this.highlightBox.style.display="block"}}else this.highlightBox&&(this.highlightBox.style.display="none")}}handleClick(t){if(this.state!=="TARGETING"||!this.shadowHost)return;t.preventDefault(),t.stopPropagation();const i=[this.shadowHost,this.overlayShadowHost].filter(Boolean),o=A(t.clientX,t.clientY,i);if(!o||$(o))return;const n=Tt(o,8);this.selectedBounds={...n,clickX:t.clientX,clickY:t.clientY,visible:!0};const{selector:s,text:r}=bt(o);this.feedbackData.elementSelector=s,this.feedbackData.elementText=r,this.removeTargetingOverlay(),document.removeEventListener("mousemove",this.boundMouseMove),document.removeEventListener("click",this.boundClick,!0),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.state="SELECTED",this.showSelectedMarker(),this.submitFeedback()}cancelTargeting(){this.removeTargetingOverlay(),document.removeEventListener("mousemove",this.boundMouseMove),document.removeEventListener("click",this.boundClick,!0),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.state="IDLE",this.feedbackData.feedbackType=null,this.feedbackData.elementSelector=null,this.feedbackData.elementText=null,this.selectedBounds.visible=!1}removeTargetingOverlay(){this.overlayContainer&&(this.overlayContainer.remove(),this.overlayContainer=null),this.captureLayer=null,this.crosshairH=null,this.crosshairV=null,this.scope=null}showSelectedMarker(){if(!this.selectedBounds.visible)return;const t=this.ensureOverlayHost();this.marker=document.createElement("div"),this.marker.className="qaid-selected-marker",this.marker.style.left=`${this.selectedBounds.x}px`,this.marker.style.top=`${this.selectedBounds.y}px`,this.marker.style.width=`${this.selectedBounds.width}px`,this.marker.style.height=`${this.selectedBounds.height}px`,this.marker.style.zIndex=String(this.config.zIndex+1),this.applyVars(this.marker),t.appendChild(this.marker)}hideSelectedMarker(){this.marker&&(this.marker.remove(),this.marker=null)}async submitFeedback(){if(!this.feedbackData.feedbackType)return;let t=null;this.config.captureScreenshot&&(this.config.screenshotMethod==="dom"?t=await V(this.config.screenshotOptions):t=await It(this.config.screenshotOptions));const i=this.feedbackData.elementSelector?{x:this.selectedBounds.x,y:this.selectedBounds.y,width:this.selectedBounds.width,height:this.selectedBounds.height}:null,o={feedbackType:this.feedbackData.feedbackType,pageUrl:window.location.href,apiKey:this.config.apiKey||void 0,elementSelector:this.feedbackData.elementSelector,elementText:this.feedbackData.elementText,consoleErrors:[...this.feedbackData.consoleErrors],screenWidth:window.innerWidth,screenHeight:window.innerHeight,clickX:this.selectedBounds.clickX,clickY:this.selectedBounds.clickY,scrollX:window.scrollX,scrollY:window.scrollY,screenshot:t,visitorId:this.visitorId,elementBounds:i,userAgent:navigator.userAgent};try{const n=await fetch(this.config.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(n.ok){const s=await n.json();this.feedbackId=s.id}}catch(n){console.error("Failed to submit feedback:",n)}this.state="MODAL_OPEN",this.showModal(),this.overlayShadowHost&&(this.overlayShadowHost.style.pointerEvents="auto")}showModal(){const t=this.ensureOverlayHost();this.backdrop=document.createElement("div"),this.backdrop.className="qaid-backdrop",this.backdrop.style.zIndex=String(this.config.zIndex+2),this.backdrop.style.background=`rgba(0, 0, 0, ${this.config.backdropOpacity})`,this.backdrop.addEventListener("click",()=>this.closeModal()),this.applyVars(this.backdrop),this.isMobile?this.showBottomSheet():this.showPositionedModal(),t.appendChild(this.backdrop),document.addEventListener("keydown",this.boundKeyDown)}showBottomSheet(){const t=this.ensureOverlayHost(),i=document.createElement("div");i.className="qaid-bottom-sheet",i.style.zIndex=String(this.config.zIndex+3),i.innerHTML=`
11
+ `,this.highlightBox=document.createElement("div"),this.highlightBox.className="qaid-highlight-box",this.overlayContainer.appendChild(this.captureLayer),this.overlayContainer.appendChild(i),this.overlayContainer.appendChild(this.highlightBox),this.overlayContainer.appendChild(this.crosshairH),this.overlayContainer.appendChild(this.crosshairV),this.overlayContainer.appendChild(this.scope),this.crosshairH.style.top=`${this.mousePos.y}px`,this.crosshairV.style.left=`${this.mousePos.x}px`,this.scope.style.left=`${this.mousePos.x}px`,this.scope.style.top=`${this.mousePos.y}px`,this.applyVars(this.overlayContainer),t.appendChild(this.overlayContainer)}handleKeyDown(t){t.key==="Escape"&&(this.isRecording?this.stopRecording():this.videoPreview?this.cancelRecordingPreview():this.state==="TARGETING"?this.cancelTargeting():this.state==="MODAL_OPEN"&&this.closeModal())}handleMouseMove(t){if(this.mousePos.x=t.clientX,this.mousePos.y=t.clientY,this.crosshairH&&(this.crosshairH.style.top=`${t.clientY}px`),this.crosshairV&&(this.crosshairV.style.left=`${t.clientX}px`),this.scope&&(this.scope.style.left=`${t.clientX}px`,this.scope.style.top=`${t.clientY}px`),this.captureLayer&&this.shadowHost){const i=[this.shadowHost,this.overlayShadowHost].filter(Boolean),o=$(t.clientX,t.clientY,i);if(o&&!N(o)){if(this.highlightBox){const n=o.getBoundingClientRect();this.highlightBox.style.transform=`translate(${n.left}px, ${n.top}px)`,this.highlightBox.style.width=`${n.width}px`,this.highlightBox.style.height=`${n.height}px`,this.highlightBox.style.display="block"}}else this.highlightBox&&(this.highlightBox.style.display="none")}}handleClick(t){if(this.state!=="TARGETING"||!this.shadowHost)return;t.preventDefault(),t.stopPropagation();const i=[this.shadowHost,this.overlayShadowHost].filter(Boolean),o=$(t.clientX,t.clientY,i);if(!o||N(o))return;const n=Ht(o,8);this.selectedBounds={...n,clickX:t.clientX,clickY:t.clientY,visible:!0};const{selector:s,text:r}=yt(o);this.feedbackData.elementSelector=s,this.feedbackData.elementText=r,this.removeTargetingOverlay(),document.removeEventListener("mousemove",this.boundMouseMove),document.removeEventListener("click",this.boundClick,!0),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.state="SELECTED",this.showSelectedMarker(),this.submitFeedback()}cancelTargeting(){this.removeTargetingOverlay(),document.removeEventListener("mousemove",this.boundMouseMove),document.removeEventListener("click",this.boundClick,!0),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.state="IDLE",this.feedbackData.feedbackType=null,this.feedbackData.elementSelector=null,this.feedbackData.elementText=null,this.selectedBounds.visible=!1}removeTargetingOverlay(){this.overlayContainer&&(this.overlayContainer.remove(),this.overlayContainer=null),this.captureLayer=null,this.crosshairH=null,this.crosshairV=null,this.scope=null}showSelectedMarker(){if(!this.selectedBounds.visible)return;const t=this.ensureOverlayHost();this.marker=document.createElement("div"),this.marker.className="qaid-selected-marker",this.marker.style.left=`${this.selectedBounds.x}px`,this.marker.style.top=`${this.selectedBounds.y}px`,this.marker.style.width=`${this.selectedBounds.width}px`,this.marker.style.height=`${this.selectedBounds.height}px`,this.marker.style.zIndex=String(this.config.zIndex+1),this.applyVars(this.marker),t.appendChild(this.marker)}hideSelectedMarker(){this.marker&&(this.marker.remove(),this.marker=null)}async submitFeedback(){if(!this.feedbackData.feedbackType)return;let t=null;this.config.captureScreenshot&&(this.config.screenshotMethod==="dom"?t=await _(this.config.screenshotOptions):t=await Dt(this.config.screenshotOptions));const i=this.feedbackData.elementSelector?{x:this.selectedBounds.x,y:this.selectedBounds.y,width:this.selectedBounds.width,height:this.selectedBounds.height}:null,o={feedbackType:this.feedbackData.feedbackType,pageUrl:window.location.href,apiKey:this.config.apiKey||void 0,elementSelector:this.feedbackData.elementSelector,elementText:this.feedbackData.elementText,consoleErrors:[...this.feedbackData.consoleErrors],screenWidth:window.innerWidth,screenHeight:window.innerHeight,clickX:this.selectedBounds.clickX,clickY:this.selectedBounds.clickY,scrollX:window.scrollX,scrollY:window.scrollY,screenshot:t,visitorId:this.visitorId,elementBounds:i,userAgent:navigator.userAgent};try{const n=await fetch(this.config.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(n.ok){const s=await n.json();this.feedbackId=s.id}}catch(n){console.error("Failed to submit feedback:",n)}this.state="MODAL_OPEN",this.showModal(),this.overlayShadowHost&&(this.overlayShadowHost.style.pointerEvents="auto")}showModal(){const t=this.ensureOverlayHost();this.backdrop=document.createElement("div"),this.backdrop.className="qaid-backdrop",this.backdrop.style.zIndex=String(this.config.zIndex+2),this.backdrop.style.background=`rgba(0, 0, 0, ${this.config.backdropOpacity})`,this.backdrop.addEventListener("click",()=>this.closeModal()),this.applyVars(this.backdrop),this.isMobile?this.showBottomSheet():this.showPositionedModal(),t.appendChild(this.backdrop),document.addEventListener("keydown",this.boundKeyDown)}showBottomSheet(){const t=this.ensureOverlayHost(),i=document.createElement("div");i.className="qaid-bottom-sheet",i.style.zIndex=String(this.config.zIndex+3),i.innerHTML=`
12
12
  <div class="qaid-bottom-sheet-content">
13
13
  <div class="qaid-bottom-sheet-handle"></div>
14
14
  ${this.getModalContent()}
15
15
  </div>
16
- `,this.applyVars(i),t.appendChild(i),this.modalContainer=i,this.setupModalInteractions()}showPositionedModal(){const t=this.ensureOverlayHost(),{modal:i,arrow:o}=xt(this.selectedBounds,window.innerWidth,window.innerHeight,{width:this.config.modalWidth,height:280,arrowHeight:12,gap:8,viewportPadding:16});this.modalContainer=document.createElement("div"),this.modalContainer.className=`qaid-modal-container qaid-${i.position}`,this.modalContainer.style.top=`${i.top}px`,this.modalContainer.style.left=`${i.left}px`,this.modalContainer.style.zIndex=String(this.config.zIndex+3);const n=document.createElement("div");n.className="qaid-modal-arrow",n.style.left=`${o.left}px`;const s=document.createElement("div");s.className="qaid-modal-box",s.innerHTML=this.getModalContent(),this.modalContainer.appendChild(n),this.modalContainer.appendChild(s),this.applyVars(this.modalContainer),t.appendChild(this.modalContainer),this.setupModalInteractions()}getModalContent(){const t=this.feedbackData.feedbackType==="up",i=this.config.positiveIcon||v,o=this.config.negativeIcon||S;return`
16
+ `,this.applyVars(i),t.appendChild(i),this.modalContainer=i,this.setupModalInteractions()}showPositionedModal(){const t=this.ensureOverlayHost(),{modal:i,arrow:o}=Ct(this.selectedBounds,window.innerWidth,window.innerHeight,{width:this.config.modalWidth,height:280,arrowHeight:12,gap:8,viewportPadding:16});this.modalContainer=document.createElement("div"),this.modalContainer.className=`qaid-modal-container qaid-${i.position}`,this.modalContainer.style.top=`${i.top}px`,this.modalContainer.style.left=`${i.left}px`,this.modalContainer.style.zIndex=String(this.config.zIndex+3);const n=document.createElement("div");n.className="qaid-modal-arrow",n.style.left=`${o.left}px`;const s=document.createElement("div");s.className="qaid-modal-box",s.innerHTML=this.getModalContent(),this.modalContainer.appendChild(n),this.modalContainer.appendChild(s),this.applyVars(this.modalContainer),t.appendChild(this.modalContainer),this.setupModalInteractions()}getModalContent(){const t=this.feedbackData.feedbackType==="up",i=this.config.positiveIcon||v,o=this.config.negativeIcon||S;return`
17
17
  <div class="qaid-modal-header">
18
18
  <button type="button" class="${this.config.buttonClass?`qaid-type-toggle qaid-type-toggle-custom ${this.config.buttonClass} ${t?"qaid-btn-up":"qaid-btn-down"}`:`qaid-type-toggle ${t?"qaid-type-up":"qaid-type-down"}`}" title="Click to switch">
19
19
  ${t?i:o}
@@ -27,5 +27,5 @@
27
27
  <div class="qaid-btn-row">
28
28
  <button type="button" class="qaid-btn-submit">${this.config.text.skipButton}</button>
29
29
  </div>
30
- `}setupModalInteractions(){if(!this.modalContainer)return;const t=this.modalContainer.querySelector(".qaid-textarea"),i=this.modalContainer.querySelector(".qaid-btn-submit");t&&(setTimeout(()=>t.focus(),100),t.addEventListener("input",()=>{i&&(i.textContent=t.value.trim()?this.config.text.submitButton:this.config.text.skipButton)})),i&&i.addEventListener("click",()=>{const n=t?.value.trim()||null;this.submitMessage(n)});const o=this.modalContainer.querySelector(".qaid-type-toggle");o&&o.addEventListener("click",()=>{const n=this.feedbackData.feedbackType==="up"?"down":"up";this.feedbackData.feedbackType=n,this.config.buttonClass?(o.classList.toggle("qaid-btn-up",n==="up"),o.classList.toggle("qaid-btn-down",n==="down")):(o.classList.toggle("qaid-type-up",n==="up"),o.classList.toggle("qaid-type-down",n==="down"));const s=this.config.positiveIcon||v,r=this.config.negativeIcon||S;o.innerHTML=n==="up"?s:r,this.feedbackId&&fetch(`${this.config.endpoint}/${this.feedbackId}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({feedbackType:n})}).catch(l=>console.error("Failed to update feedback type:",l))})}async submitMessage(t){if(this.feedbackId){try{await fetch(`${this.config.endpoint}/${this.feedbackId}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:t})})}catch(i){console.error("Failed to submit feedback message:",i)}this.feedbackId=null}this.closeModal()}closeModal(){this.state==="MODAL_OPEN"&&this.feedbackId&&fetch(`${this.config.endpoint}/${this.feedbackId}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:null})}).catch(t=>console.error("Failed to finalize feedback:",t)),this.modalContainer&&(this.modalContainer.remove(),this.modalContainer=null),this.backdrop&&(this.backdrop.remove(),this.backdrop=null),document.removeEventListener("keydown",this.boundKeyDown),this.hideSelectedMarker(),this.overlayShadowHost&&(this.overlayShadowHost.style.pointerEvents="none"),this.state="IDLE",this.feedbackId=null,this.feedbackData.feedbackType=null,this.feedbackData.elementSelector=null,this.feedbackData.elementText=null,this.selectedBounds.visible=!1}async startRecording(){if(!(this.isRecording||this.state!=="IDLE"))try{this.networkCapture=B(),this.videoRecorder=P({maxDuration:this.config.videoOptions.maxDuration}),this.videoRecorder.onTick(t=>{this.updateRecordingTimer(t)}),this.videoRecorder.onStop(t=>{this.isRecording&&(this.recordedBlob=t,this.isRecording=!1,this.removeRecordingIndicator(),document.removeEventListener("keydown",this.boundKeyDown),this.setButtonsDisabled(!1),t&&t.size>0?this.showRecordingPreview():this.cleanupRecording())}),await this.videoRecorder.start(),this.isRecording=!0,this.setButtonsDisabled(!0),this.showRecordingIndicator(),document.addEventListener("keydown",this.boundKeyDown)}catch{this.cleanupRecording()}}async stopRecording(){if(!(!this.isRecording||!this.videoRecorder)){try{this.recordedBlob=await this.videoRecorder.stop()}catch{this.recordedBlob=null}this.isRecording=!1,this.removeRecordingIndicator(),document.removeEventListener("keydown",this.boundKeyDown),this.recordedBlob&&this.recordedBlob.size>0?this.showRecordingPreview():this.cleanupRecording()}}showRecordingIndicator(){const t=this.ensureOverlayHost();this.recordingIndicator=document.createElement("div"),this.recordingIndicator.className="qaid-recording-indicator",this.recordingIndicator.style.zIndex=String(this.config.zIndex+100);const i=document.createElement("div");i.className="qaid-recording-dot";const o=document.createElement("span");o.className="qaid-recording-time",o.textContent=this.formatTime(this.config.videoOptions.maxDuration);const n=document.createElement("button");n.type="button",n.className="qaid-recording-stop",n.textContent="Stop",n.addEventListener("click",()=>this.stopRecording()),this.recordingIndicator.appendChild(i),this.recordingIndicator.appendChild(o),this.recordingIndicator.appendChild(n),this.applyVars(this.recordingIndicator),this.overlayShadowHost&&(this.overlayShadowHost.style.pointerEvents="auto"),t.appendChild(this.recordingIndicator)}updateRecordingTimer(t){if(!this.recordingIndicator)return;const i=this.recordingIndicator.querySelector(".qaid-recording-time");if(i){const o=Math.max(0,this.config.videoOptions.maxDuration-t);i.textContent=this.formatTime(o)}}formatTime(t){const i=Math.floor(t/60),o=t%60;return`${i}:${o.toString().padStart(2,"0")}`}removeRecordingIndicator(){this.recordingIndicator&&(this.recordingIndicator.remove(),this.recordingIndicator=null)}showRecordingPreview(){if(!this.recordedBlob)return;const t=this.ensureOverlayHost(),i=URL.createObjectURL(this.recordedBlob);this.videoPreview=document.createElement("div"),this.videoPreview.className="qaid-video-preview",this.videoPreview.style.zIndex=String(this.config.zIndex+100);const o=document.createElement("div");o.className="qaid-video-preview-box";const n=document.createElement("h3");n.textContent="Review your recording";const s=document.createElement("video");s.src=i,s.controls=!0,s.autoplay=!0,s.muted=!0;const r=document.createElement("textarea");r.placeholder="Optional: Describe the issue you recorded...";const l=document.createElement("div");l.className="qaid-video-preview-actions";const d=document.createElement("button");d.type="button",d.className="qaid-video-btn qaid-video-btn-cancel",d.textContent="Cancel",d.addEventListener("click",()=>this.cancelRecordingPreview());const a=document.createElement("button");a.type="button",a.className="qaid-video-btn qaid-video-btn-rerecord",a.textContent="Re-record",a.addEventListener("click",()=>{this.cancelRecordingPreview(),this.startRecording()});const c=document.createElement("button");c.type="button",c.className="qaid-video-btn qaid-video-btn-send",c.textContent="Send",c.addEventListener("click",()=>{const h=r.value.trim()||null;this.submitVideoFeedback(h,c)}),l.appendChild(d),l.appendChild(a),l.appendChild(c),o.appendChild(n),o.appendChild(s),o.appendChild(r),o.appendChild(l),this.videoPreview.appendChild(o),this.applyVars(this.videoPreview),this.overlayShadowHost&&(this.overlayShadowHost.style.pointerEvents="auto"),t.appendChild(this.videoPreview),document.addEventListener("keydown",this.boundKeyDown)}cancelRecordingPreview(){this.removeVideoPreview(),this.cleanupRecording()}removeVideoPreview(){if(this.videoPreview){const t=this.videoPreview.querySelector("video");t?.src&&URL.revokeObjectURL(t.src),this.videoPreview.remove(),this.videoPreview=null}document.removeEventListener("keydown",this.boundKeyDown)}async submitVideoFeedback(t,i){if(!this.recordedBlob||this.isSendingVideo)return;this.isSendingVideo=!0,i.disabled=!0,i.textContent="Sending...";const o=new FormData;o.append("video",this.recordedBlob,`recording.${this.recordedBlob.type.includes("mp4")?"mp4":"webm"}`),o.append("pageUrl",window.location.href),o.append("visitorId",this.visitorId),this.config.apiKey&&o.append("apiKey",this.config.apiKey),t&&o.append("message",t),this.consoleCapture&&o.append("consoleErrors",JSON.stringify(this.consoleCapture.errors)),this.networkCapture&&o.append("networkErrors",JSON.stringify(this.networkCapture.errors));try{const n=await fetch(`${this.config.endpoint}/video`,{method:"POST",body:o});n.ok||console.error("Failed to submit video feedback:",await n.text())}catch(n){console.error("Failed to submit video feedback:",n)}this.isSendingVideo=!1,this.removeVideoPreview(),this.cleanupRecording()}cleanupRecording(){this.isRecording=!1,this.removeRecordingIndicator(),this.videoRecorder&&(this.videoRecorder.destroy(),this.videoRecorder=null),this.networkCapture&&(this.networkCapture.restore(),this.networkCapture=null),this.recordedBlob&&(this.recordedBlob=null),this.setButtonsDisabled(!1),this.overlayShadowHost&&this.state==="IDLE"&&(this.overlayShadowHost.style.pointerEvents="none")}setButtonsDisabled(t){if(!this.buttonsContainer)return;this.buttonsContainer.querySelectorAll("button.qaid-btn, button.qaid-btn-structural").forEach(o=>{t?o.classList.contains("qaid-btn-record")||(o.disabled=!0,o.style.opacity="0.5"):(o.disabled=!1,o.style.opacity="")})}destroy(){this.destroyed=!0,this.domObserver&&(this.domObserver.disconnect(),this.domObserver=null),this.boundBeforeSwap&&(document.removeEventListener("astro:before-swap",this.boundBeforeSwap),this.boundBeforeSwap=null),this.cleanupRecording(),this.removeVideoPreview(),this.consoleCapture&&(this.consoleCapture.restore(),this.consoleCapture=null),window.removeEventListener("resize",this.boundResize),document.removeEventListener("keydown",this.boundKeyDown),document.removeEventListener("mousemove",this.boundMouseMove),document.removeEventListener("click",this.boundClick,!0),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.overlayContainer=null,this.captureLayer=null,this.crosshairH=null,this.crosshairV=null,this.scope=null,this.marker=null,this.modalContainer=null,this.backdrop=null,this.tooltipElement=null,ct()}}function _(e){return document.querySelector(e)?.textContent?.trim()??""}function Bt(){const e=document.querySelector('script[type="application/json"][data-feedback-config]');if(!e)return null;const t=e.textContent?.trim();if(!t)return null;try{const i=JSON.parse(t);return i.cssSelector&&!i.css&&(i.css=_(i.cssSelector),delete i.cssSelector),i}catch{return null}}function zt(e){const t=e.getAttribute("data-endpoint");if(!t)return null;const i=e.getAttribute("data-position"),o=e.getAttribute("data-zindex"),n=e.getAttribute("data-positive-color"),s=e.getAttribute("data-negative-color"),r=e.getAttribute("data-marker-color"),l=e.getAttribute("data-container"),d=e.getAttribute("data-button-class"),a=e.getAttribute("data-skip-targeting"),c=e.getAttribute("data-incognito"),h=e.getAttribute("data-button-size"),u=e.getAttribute("data-offset-x"),p=e.getAttribute("data-offset-y"),y=e.getAttribute("data-modal-width"),f=e.getAttribute("data-backdrop-opacity"),m=e.getAttribute("data-font-family"),w=e.getAttribute("data-font-size"),g=e.getAttribute("data-tooltip"),C=e.getAttribute("data-modal-title"),W=e.getAttribute("data-modal-subtitle"),X=e.getAttribute("data-placeholder"),j=e.getAttribute("data-submit-button"),K=e.getAttribute("data-skip-button"),Ot=e.getAttribute("data-positive-icon"),Pt=e.getAttribute("data-negative-icon"),At=e.getAttribute("data-api-key"),$t=e.getAttribute("data-capture-screenshot"),E=e.getAttribute("data-screenshot-quality"),T=e.getAttribute("data-screenshot-max-width"),I=e.getAttribute("data-screenshot-max-height"),Nt=e.getAttribute("data-capture-video"),Vt=e.getAttribute("data-hide-thumbs"),Y=e.getAttribute("data-video-max-duration"),Ft=e.getAttribute("data-screenshot-method"),Ut=e.getAttribute("data-direction"),J=e.getAttribute("data-css-selector");return{endpoint:t,css:J?_(J):void 0,apiKey:At??void 0,captureScreenshot:$t==="true"?!0:void 0,screenshotOptions:E||T||I?{quality:E?parseFloat(E):void 0,maxWidth:T?parseInt(T,10):void 0,maxHeight:I?parseInt(I,10):void 0}:void 0,container:l??void 0,buttonClass:d??void 0,direction:Ut??void 0,position:i??void 0,zIndex:o?parseInt(o,10):void 0,skipTargeting:a==="true"?!0:void 0,incognito:c==="true"?!0:void 0,buttonSize:h??void 0,offset:u||p?{x:u?parseInt(u,10):void 0,y:p?parseInt(p,10):void 0}:void 0,modalWidth:y?parseInt(y,10):void 0,backdropOpacity:f?parseFloat(f):void 0,fontFamily:m??void 0,fontSize:w?parseInt(w,10):void 0,colors:{positive:n??void 0,negative:s??void 0,marker:r??void 0},text:g||C||W||X||j||K?{tooltip:g??void 0,modalTitle:C??void 0,modalSubtitle:W??void 0,placeholder:X??void 0,submitButton:j??void 0,skipButton:K??void 0}:void 0,positiveIcon:Ot??void 0,negativeIcon:Pt??void 0,screenshotMethod:Ft??void 0,captureVideo:Nt==="true"?!0:void 0,hideThumbs:Vt==="true"?!0:void 0,videoOptions:Y?{maxDuration:parseInt(Y,10)}:void 0}}if(typeof document<"u"){const e=()=>{const t=document.currentScript,i=Bt(),o=t?zt(t):null,n=i??o;n?.endpoint&&new U(n)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e):e()}b.QaidFeedback=U,b.captureDomScreenshot=V,b.captureNetworkErrors=B,b.createVideoRecorder=P,b.getSupportedMimeType=O,b.isDomScreenshotSupported=Mt,b.isVideoRecordingSupported=z,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})}));
30
+ `}setupModalInteractions(){if(!this.modalContainer)return;const t=this.modalContainer.querySelector(".qaid-textarea"),i=this.modalContainer.querySelector(".qaid-btn-submit");t&&(setTimeout(()=>t.focus(),100),t.addEventListener("input",()=>{i&&(i.textContent=t.value.trim()?this.config.text.submitButton:this.config.text.skipButton)})),i&&i.addEventListener("click",()=>{const n=t?.value.trim()||null;this.submitMessage(n)});const o=this.modalContainer.querySelector(".qaid-type-toggle");o&&o.addEventListener("click",()=>{const n=this.feedbackData.feedbackType==="up"?"down":"up";this.feedbackData.feedbackType=n,this.config.buttonClass?(o.classList.toggle("qaid-btn-up",n==="up"),o.classList.toggle("qaid-btn-down",n==="down")):(o.classList.toggle("qaid-type-up",n==="up"),o.classList.toggle("qaid-type-down",n==="down"));const s=this.config.positiveIcon||v,r=this.config.negativeIcon||S;o.innerHTML=n==="up"?s:r,this.feedbackId&&fetch(`${this.config.endpoint}/${this.feedbackId}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({feedbackType:n})}).catch(l=>console.error("Failed to update feedback type:",l))})}async submitMessage(t){if(this.feedbackId){try{await fetch(`${this.config.endpoint}/${this.feedbackId}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:t})})}catch(i){console.error("Failed to submit feedback message:",i)}this.feedbackId=null}this.closeModal()}closeModal(){this.state==="MODAL_OPEN"&&this.feedbackId&&fetch(`${this.config.endpoint}/${this.feedbackId}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:null})}).catch(t=>console.error("Failed to finalize feedback:",t)),this.modalContainer&&(this.modalContainer.remove(),this.modalContainer=null),this.backdrop&&(this.backdrop.remove(),this.backdrop=null),document.removeEventListener("keydown",this.boundKeyDown),this.hideSelectedMarker(),this.overlayShadowHost&&(this.overlayShadowHost.style.pointerEvents="none"),this.state="IDLE",this.feedbackId=null,this.feedbackData.feedbackType=null,this.feedbackData.elementSelector=null,this.feedbackData.elementText=null,this.selectedBounds.visible=!1}async startRecording(){if(!(this.isRecording||this.state!=="IDLE"))try{this.networkCapture=z(),this.videoRecorder=A({maxDuration:this.config.videoOptions.maxDuration}),this.videoRecorder.onTick(t=>{this.updateRecordingTimer(t)}),this.videoRecorder.onStop(t=>{this.isRecording&&(this.recordedBlob=t,this.isRecording=!1,this.removeRecordingIndicator(),document.removeEventListener("keydown",this.boundKeyDown),this.setButtonsDisabled(!1),t&&t.size>0?this.showRecordingPreview():this.cleanupRecording())}),await this.videoRecorder.start(),this.isRecording=!0,this.setButtonsDisabled(!0),this.showRecordingIndicator(),document.addEventListener("keydown",this.boundKeyDown)}catch{this.cleanupRecording()}}async stopRecording(){if(!(!this.isRecording||!this.videoRecorder)){try{this.recordedBlob=await this.videoRecorder.stop()}catch{this.recordedBlob=null}this.isRecording=!1,this.removeRecordingIndicator(),document.removeEventListener("keydown",this.boundKeyDown),this.recordedBlob&&this.recordedBlob.size>0?this.showRecordingPreview():this.cleanupRecording()}}showRecordingIndicator(){const t=this.ensureOverlayHost();this.recordingIndicator=document.createElement("div"),this.recordingIndicator.className="qaid-recording-indicator",this.recordingIndicator.style.zIndex=String(this.config.zIndex+100);const i=document.createElement("div");i.className="qaid-recording-dot";const o=document.createElement("span");o.className="qaid-recording-time",o.textContent=this.formatTime(this.config.videoOptions.maxDuration);const n=document.createElement("button");n.type="button",n.className="qaid-recording-stop",n.textContent="Stop",n.addEventListener("click",()=>this.stopRecording()),this.recordingIndicator.appendChild(i),this.recordingIndicator.appendChild(o),this.recordingIndicator.appendChild(n),this.applyVars(this.recordingIndicator),this.overlayShadowHost&&(this.overlayShadowHost.style.pointerEvents="auto"),t.appendChild(this.recordingIndicator)}updateRecordingTimer(t){if(!this.recordingIndicator)return;const i=this.recordingIndicator.querySelector(".qaid-recording-time");if(i){const o=Math.max(0,this.config.videoOptions.maxDuration-t);i.textContent=this.formatTime(o)}}formatTime(t){const i=Math.floor(t/60),o=t%60;return`${i}:${o.toString().padStart(2,"0")}`}removeRecordingIndicator(){this.recordingIndicator&&(this.recordingIndicator.remove(),this.recordingIndicator=null)}showRecordingPreview(){if(!this.recordedBlob)return;const t=this.ensureOverlayHost(),i=URL.createObjectURL(this.recordedBlob);this.videoPreview=document.createElement("div"),this.videoPreview.className="qaid-video-preview",this.videoPreview.style.zIndex=String(this.config.zIndex+100);const o=document.createElement("div");o.className="qaid-video-preview-box";const n=document.createElement("h3");n.textContent="Review your recording";const s=document.createElement("video");s.src=i,s.controls=!0,s.autoplay=!0,s.muted=!0;const r=document.createElement("textarea");r.placeholder="Optional: Describe the issue you recorded...";const l=document.createElement("div");l.className="qaid-video-preview-actions";const d=document.createElement("button");d.type="button",d.className="qaid-video-btn qaid-video-btn-cancel",d.textContent="Cancel",d.addEventListener("click",()=>this.cancelRecordingPreview());const a=document.createElement("button");a.type="button",a.className="qaid-video-btn qaid-video-btn-rerecord",a.textContent="Re-record",a.addEventListener("click",()=>{this.cancelRecordingPreview(),this.startRecording()});const c=document.createElement("button");c.type="button",c.className="qaid-video-btn qaid-video-btn-send",c.textContent="Send",c.addEventListener("click",()=>{const h=r.value.trim()||null;this.submitVideoFeedback(h,c)}),l.appendChild(d),l.appendChild(a),l.appendChild(c),o.appendChild(n),o.appendChild(s),o.appendChild(r),o.appendChild(l),this.videoPreview.appendChild(o),this.applyVars(this.videoPreview),this.overlayShadowHost&&(this.overlayShadowHost.style.pointerEvents="auto"),t.appendChild(this.videoPreview),document.addEventListener("keydown",this.boundKeyDown)}cancelRecordingPreview(){this.removeVideoPreview(),this.cleanupRecording()}removeVideoPreview(){if(this.videoPreview){const t=this.videoPreview.querySelector("video");t?.src&&URL.revokeObjectURL(t.src),this.videoPreview.remove(),this.videoPreview=null}document.removeEventListener("keydown",this.boundKeyDown)}async submitVideoFeedback(t,i){if(!this.recordedBlob||this.isSendingVideo)return;this.isSendingVideo=!0,i.disabled=!0,i.textContent="Sending...";const o=new FormData;o.append("video",this.recordedBlob,`recording.${this.recordedBlob.type.includes("mp4")?"mp4":"webm"}`),o.append("pageUrl",window.location.href),o.append("visitorId",this.visitorId),this.config.apiKey&&o.append("apiKey",this.config.apiKey),t&&o.append("message",t),this.consoleCapture&&o.append("consoleErrors",JSON.stringify(this.consoleCapture.errors)),this.networkCapture&&o.append("networkErrors",JSON.stringify(this.networkCapture.errors));try{const n=await fetch(`${this.config.endpoint}/video`,{method:"POST",body:o});n.ok||console.error("Failed to submit video feedback:",await n.text())}catch(n){console.error("Failed to submit video feedback:",n)}this.isSendingVideo=!1,this.removeVideoPreview(),this.cleanupRecording()}cleanupRecording(){this.isRecording=!1,this.removeRecordingIndicator(),this.videoRecorder&&(this.videoRecorder.destroy(),this.videoRecorder=null),this.networkCapture&&(this.networkCapture.restore(),this.networkCapture=null),this.recordedBlob&&(this.recordedBlob=null),this.setButtonsDisabled(!1),this.overlayShadowHost&&this.state==="IDLE"&&(this.overlayShadowHost.style.pointerEvents="none")}setButtonsDisabled(t){if(!this.buttonsContainer)return;this.buttonsContainer.querySelectorAll("button.qaid-btn, button.qaid-btn-structural").forEach(o=>{t?o.classList.contains("qaid-btn-record")||(o.disabled=!0,o.style.opacity="0.5"):(o.disabled=!1,o.style.opacity="")})}destroy(){this.destroyed=!0,this.domObserver&&(this.domObserver.disconnect(),this.domObserver=null),this.boundBeforeSwap&&(document.removeEventListener("astro:before-swap",this.boundBeforeSwap),this.boundBeforeSwap=null),this.cleanupRecording(),this.removeVideoPreview(),this.consoleCapture&&(this.consoleCapture.restore(),this.consoleCapture=null),window.removeEventListener("resize",this.boundResize),document.removeEventListener("keydown",this.boundKeyDown),document.removeEventListener("mousemove",this.boundMouseMove),document.removeEventListener("click",this.boundClick,!0),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.overlayContainer=null,this.captureLayer=null,this.crosshairH=null,this.crosshairV=null,this.scope=null,this.marker=null,this.modalContainer=null,this.backdrop=null,this.dismissBtn=null,this.tooltipElement=null,ut()}}function j(e){return document.querySelector(e)?.textContent?.trim()??""}function At(){const e=document.querySelector('script[type="application/json"][data-feedback-config]');if(!e)return null;const t=e.textContent?.trim();if(!t)return null;try{const i=JSON.parse(t);return i.cssSelector&&!i.css&&(i.css=j(i.cssSelector),delete i.cssSelector),i}catch{return null}}function $t(e){const t=e.getAttribute("data-endpoint");if(!t)return null;const i=e.getAttribute("data-position"),o=e.getAttribute("data-zindex"),n=e.getAttribute("data-positive-color"),s=e.getAttribute("data-negative-color"),r=e.getAttribute("data-marker-color"),l=e.getAttribute("data-container"),d=e.getAttribute("data-button-class"),a=e.getAttribute("data-skip-targeting"),c=e.getAttribute("data-incognito"),h=e.getAttribute("data-button-size"),u=e.getAttribute("data-offset-x"),p=e.getAttribute("data-offset-y"),y=e.getAttribute("data-modal-width"),f=e.getAttribute("data-backdrop-opacity"),m=e.getAttribute("data-font-family"),w=e.getAttribute("data-font-size"),g=e.getAttribute("data-tooltip"),C=e.getAttribute("data-modal-title"),K=e.getAttribute("data-modal-subtitle"),Y=e.getAttribute("data-placeholder"),J=e.getAttribute("data-submit-button"),G=e.getAttribute("data-skip-button"),Nt=e.getAttribute("data-positive-icon"),Vt=e.getAttribute("data-negative-icon"),_t=e.getAttribute("data-api-key"),Ft=e.getAttribute("data-capture-screenshot"),T=e.getAttribute("data-screenshot-quality"),I=e.getAttribute("data-screenshot-max-width"),L=e.getAttribute("data-screenshot-max-height"),Ut=e.getAttribute("data-capture-video"),Wt=e.getAttribute("data-hide-thumbs"),Q=e.getAttribute("data-video-max-duration"),Xt=e.getAttribute("data-screenshot-method"),jt=e.getAttribute("data-direction"),Z=e.getAttribute("data-css-selector");return{endpoint:t,css:Z?j(Z):void 0,apiKey:_t??void 0,captureScreenshot:Ft==="true"?!0:void 0,screenshotOptions:T||I||L?{quality:T?parseFloat(T):void 0,maxWidth:I?parseInt(I,10):void 0,maxHeight:L?parseInt(L,10):void 0}:void 0,container:l??void 0,buttonClass:d??void 0,direction:jt??void 0,position:i??void 0,zIndex:o?parseInt(o,10):void 0,skipTargeting:a==="true"?!0:void 0,incognito:c==="true"?!0:void 0,buttonSize:h??void 0,offset:u||p?{x:u?parseInt(u,10):void 0,y:p?parseInt(p,10):void 0}:void 0,modalWidth:y?parseInt(y,10):void 0,backdropOpacity:f?parseFloat(f):void 0,fontFamily:m??void 0,fontSize:w?parseInt(w,10):void 0,colors:{positive:n??void 0,negative:s??void 0,marker:r??void 0},text:g||C||K||Y||J||G?{tooltip:g??void 0,modalTitle:C??void 0,modalSubtitle:K??void 0,placeholder:Y??void 0,submitButton:J??void 0,skipButton:G??void 0}:void 0,positiveIcon:Nt??void 0,negativeIcon:Vt??void 0,screenshotMethod:Xt??void 0,captureVideo:Ut==="true"?!0:void 0,hideThumbs:Wt==="true"?!0:void 0,videoOptions:Q?{maxDuration:parseInt(Q,10)}:void 0}}if(typeof document<"u"){const e=()=>{const t=document.currentScript,i=At(),o=t?$t(t):null,n=i??o;n?.endpoint&&new X(n)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e):e()}b.QaidFeedback=X,b.captureDomScreenshot=_,b.captureNetworkErrors=z,b.createVideoRecorder=A,b.getSupportedMimeType=O,b.isDomScreenshotSupported=Bt,b.isVideoRecordingSupported=P,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})}));
31
31
  //# sourceMappingURL=qaid.umd.cjs.map