@siteping/widget 0.10.8 → 0.10.10

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.
Files changed (33) hide show
  1. package/dist/{chunk-BJFC7TVL.cjs → chunk-AFLWWD6M.cjs} +2 -2
  2. package/dist/chunk-AFLWWD6M.cjs.map +1 -0
  3. package/dist/{chunk-4CK3N4YE.js → chunk-ATTI2TS4.js} +2 -2
  4. package/dist/chunk-ATTI2TS4.js.map +1 -0
  5. package/dist/{chunk-EYISG4OI.js → chunk-BP5TH2CD.js} +2 -2
  6. package/dist/chunk-BP5TH2CD.js.map +1 -0
  7. package/dist/{chunk-OK2KX3KN.cjs → chunk-OSADAHGS.cjs} +2 -2
  8. package/dist/chunk-OSADAHGS.cjs.map +1 -0
  9. package/dist/index.cjs +30 -30
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.global.js +107 -119
  12. package/dist/index.global.js.map +1 -1
  13. package/dist/index.js +3 -3
  14. package/dist/index.js.map +1 -1
  15. package/dist/{panel-KCYUMYAI.cjs → panel-2FEECS2N.cjs} +2 -2
  16. package/dist/{panel-KCYUMYAI.cjs.map → panel-2FEECS2N.cjs.map} +1 -1
  17. package/dist/{panel-LYS3425X.cjs → panel-CSFFA5FF.cjs} +2 -2
  18. package/dist/{panel-LYS3425X.cjs.map → panel-CSFFA5FF.cjs.map} +1 -1
  19. package/dist/{panel-W2LHYGFS.js → panel-S2UR5BSD.js} +2 -2
  20. package/dist/{panel-W2LHYGFS.js.map → panel-S2UR5BSD.js.map} +1 -1
  21. package/dist/{panel-KV2AQHC2.js → panel-SGSUHR7V.js} +2 -2
  22. package/dist/{panel-KV2AQHC2.js.map → panel-SGSUHR7V.js.map} +1 -1
  23. package/dist/react.cjs +30 -30
  24. package/dist/react.cjs.map +1 -1
  25. package/dist/react.js +3 -3
  26. package/dist/react.js.map +1 -1
  27. package/dist/types.d.cts +2 -2
  28. package/dist/types.d.ts +2 -2
  29. package/package.json +9 -9
  30. package/dist/chunk-4CK3N4YE.js.map +0 -1
  31. package/dist/chunk-BJFC7TVL.cjs.map +0 -1
  32. package/dist/chunk-EYISG4OI.js.map +0 -1
  33. package/dist/chunk-OK2KX3KN.cjs.map +0 -1
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import {P,Q,I,i,h,l,k,j,da,ca,W,U as U$1,ha,Y,N,n,J,M,S,o,q as q$1,g,R,G as G$1,H,t,s,m,r,u,a,c,b,x,y,z,A,d}from'./chunk-EYISG4OI.js';export{P as loadLocale,O as registerLocale}from'./chunk-EYISG4OI.js';var Sn=new Set(["role","name","aria-label","rel","href"]);function Tn(t,e){let n=Sn.has(t);n||=t.startsWith("data-")&&te(t);let i=te(e)&&e.length<100;return i||=e.startsWith("#")&&te(e.slice(1)),n&&i}function Cn(t){return te(t)}function An(t){return te(t)}function Rn(t){return true}function Nt(t,e){if(t.nodeType!==Node.ELEMENT_NODE)throw new Error("Can't generate CSS selector for non-element node type.");if(t.tagName.toLowerCase()==="html")return "html";let n={root:document.body,idName:Cn,className:An,tagName:Rn,attr:Tn,timeoutMs:1e3,seedMinLength:3,optimizedMinLength:2,maxNumberOfPathChecks:1/0},i=new Date,o={...n,...e},s=Fn(o.root,n),r,a=0;for(let c of Mn(t,o,s)){if(new Date().getTime()-i.getTime()>o.timeoutMs||a>=o.maxNumberOfPathChecks){let u=Pn(t,s);if(!u)throw new Error(`Timeout: Can't find a unique selector after ${o.timeoutMs}ms`);return ne(u)}if(a++,Ke(c,s)){r=c;break}}if(!r)throw new Error("Selector was not found.");let l=[...Dt(r,t,o,s,i)];return l.sort(je),l.length>0?ne(l[0]):ne(r)}function*Mn(t,e,n){let i=[],o=[],s=t,r=0;for(;s&&s!==n;){let a=Ln(s,e);for(let l of a)l.level=r;if(i.push(a),s=s.parentElement,r++,o.push(...Ht(i)),r>=e.seedMinLength){o.sort(je);for(let l of o)yield l;o=[];}}o.sort(je);for(let a of o)yield a;}function te(t){if(/^[a-z\-]{3,}$/i.test(t)){let e=t.split(/-|[A-Z]/);for(let n of e)if(n.length<=2||/[^aeiou]{4,}/i.test(n))return false;return true}return false}function Ln(t,e){let n=[],i=t.getAttribute("id");i&&e.idName(i)&&n.push({name:"#"+CSS.escape(i),penalty:0});for(let r=0;r<t.classList.length;r++){let a=t.classList[r];e.className(a)&&n.push({name:"."+CSS.escape(a),penalty:1});}for(let r=0;r<t.attributes.length;r++){let a=t.attributes[r];e.attr(a.name,a.value)&&n.push({name:`[${CSS.escape(a.name)}="${CSS.escape(a.value)}"]`,penalty:2});}let o=t.tagName.toLowerCase();if(e.tagName(o)){n.push({name:o,penalty:5});let r=Xe(t,o);r!==void 0&&n.push({name:_t(o,r),penalty:10});}let s=Xe(t);return s!==void 0&&n.push({name:In(o,s),penalty:50}),n}function ne(t){let e=t[0],n=e.name;for(let i=1;i<t.length;i++){let o=t[i].level||0;e.level===o-1?n=`${t[i].name} > ${n}`:n=`${t[i].name} ${n}`,e=t[i];}return n}function Ft(t){return t.map(e=>e.penalty).reduce((e,n)=>e+n,0)}function je(t,e){return Ft(t)-Ft(e)}function Xe(t,e){let n=t.parentNode;if(!n)return;let i=n.firstChild;if(!i)return;let o=0;for(;i&&(i.nodeType===Node.ELEMENT_NODE&&(e===void 0||i.tagName.toLowerCase()===e)&&o++,i!==t);)i=i.nextSibling;return o}function Pn(t,e){let n=0,i=t,o=[];for(;i&&i!==e;){let s=i.tagName.toLowerCase(),r=Xe(i,s);if(r===void 0)return;o.push({name:_t(s,r),penalty:NaN,level:n}),i=i.parentElement,n++;}if(Ke(o,e))return o}function In(t,e){return t==="html"?"html":`${t}:nth-child(${e})`}function _t(t,e){return t==="html"?"html":`${t}:nth-of-type(${e})`}function*Ht(t,e=[]){if(t.length>0)for(let n of t[0])yield*Ht(t.slice(1,t.length),e.concat(n));else yield e;}function Fn(t,e){return t.nodeType===Node.DOCUMENT_NODE?t:t===e.root?t.ownerDocument:t}function Ke(t,e){let n=ne(t);switch(e.querySelectorAll(n).length){case 0:throw new Error(`Can't select any node with this selector: ${n}`);case 1:return true;default:return false}}function*Dt(t,e,n,i,o){if(t.length>2&&t.length>n.optimizedMinLength)for(let s=1;s<t.length-1;s++){if(new Date().getTime()-o.getTime()>n.timeoutMs)return;let a=[...t];a.splice(s,1),Ke(a,i)&&i.querySelector(ne(a))===e&&(yield a,yield*Dt(a,e,n,i,o));}}var Nn=["role","aria-label","type","name","href","src","data-testid","data-id"];function _n(t){let e=5381;for(let n=0;n<t.length;n++)e=(e<<5)+e+t.charCodeAt(n)|0;return (e>>>0).toString(36)}function Ye(t){let e=t.children.length,n=0,i=t.parentElement;if(i)for(let o of i.children){if(o===t)break;o.tagName===t.tagName&&n++;}return `${e}:${n}:${We(t)}`}function We(t){let e=[];for(let n of Nn){let i=t.getAttribute(n);i&&e.push(`${n}=${i}`);}return e.length>0?_n(e.join(",")):"0"}function Ot(t,e){let n=e.split(":");if(n.length!==3)return 0;let[i,o,s]=n,r=Number(i),a=Number(o);if(Number.isNaN(r)||Number.isNaN(a))return 0;let l=Ye(t),[c,p,u]=l.split(":"),d=0,f=Math.abs(Number(c)-r);f===0?d+=.2:f<=2?d+=.1:f<=5&&(d+=.03);let b=Math.abs(Number(p)-a);return b===0?d+=.4:b===1?d+=.2:b<=3&&(d+=.08),u===s&&(d+=.4),d}function U(t,e){let n=e==="before"?"previousElementSibling":"nextElementSibling",i=t[n],o=3;for(;i&&o>0;){let s=e==="before"?Hn(i,256).trim():q(i,256).trim();if(s)return e==="before"?s.slice(-32):s.slice(0,32);i=i[n],o--;}return ""}function ve(t){let e=t.previousElementSibling,n=t.nextElementSibling,i=e?q(e,256).trim().slice(0,40):"",o=n?q(n,256).trim().slice(0,40):"";return [i,o].filter(Boolean).join(" | ")}function q(t,e){let n="";if(t.firstElementChild===null){for(let o of t.childNodes)if(o.nodeType===3&&(n+=o.data,n.length>=e))break;return n.length>e?n.slice(0,e):n}let i=t.ownerDocument.createTreeWalker(t,NodeFilter.SHOW_TEXT);for(;n.length<e;){let o=i.nextNode();if(!o)break;n+=o.data;}return n.length>e?n.slice(0,e):n}function Hn(t,e){let n="",i=o=>{for(let s=o.lastChild;s;s=s.previousSibling)if(s.nodeType===3){if(n=s.data+n,n.length>=e)return true}else if(s.nodeType===1&&i(s))return true;return false};return i(t),n.length>e?n.slice(-e):n}function $t(t){if(t.id){let i=t.id.includes("'")?`concat('${t.id.replace(/'/g,`',"'",'`)}')`:`'${t.id}'`;return `//${t.localName}[@id=${i}]`}let e=[],n=t;for(;n&&n!==document.body&&e.length<6;){let i=n.localName,o=n.parentElement;if(n.id){let r=n.id.includes("'")?`concat('${n.id.replace(/'/g,`',"'",'`)}')`:`'${n.id}'`;return e.unshift(`/${i}[@id=${r}]`),"/"+e.join("")}let s=1;if(o)for(let r of o.children){if(r===n)break;r.localName===i&&s++;}e.unshift(`/${i}[${s}]`),n=o;}return "/html/body"+e.join("")}var ie="data-feedback-anchor";function qe(t){let e=Nt(t,{className:u=>!/^(css|sc|emotion|styled)-/.test(u)&&!/^[a-z]{1,3}[A-Za-z0-9]{4,8}$/.test(u),attr:u=>["data-testid","data-id","role","aria-label"].includes(u),idName:u=>!u.startsWith("radix-")&&!/^:r[0-9]+:$/.test(u),seedMinLength:3,optimizedMinLength:2}),n=$t(t),o=(t.textContent?.trim()??"").slice(0,120),s=U(t,"before"),r=U(t,"after"),a=Ye(t),l=ve(t),p=t.closest(`[${ie}]`)?.getAttribute(ie)??null;return {cssSelector:e,xpath:n,textSnippet:o,textPrefix:s,textSuffix:r,fingerprint:a,neighborText:l,elementTag:t.tagName,elementId:t.id||void 0,anchorKey:p}}function Bt(t,e){let n=t.getBoundingClientRect();return n.left<=e.x&&n.top<=e.y&&n.right>=e.x+e.width&&n.bottom>=e.y+e.height}function zt(t,e=document.documentElement){let n=t.x+t.width/2,i=t.y+t.height/2,o=document.elementFromPoint(n,i);if(!o||o===e)return document.body;let s=o;for(;s&&s!==document.body;){if(s.hasAttribute(ie)&&Bt(s,t))return s;s=s.parentElement;}for(s=o;s&&s!==document.body;){if(Bt(s,t))return s;s=s.parentElement;}return document.body}function jt(t,e){return e.width<=0||e.height<=0?{xPct:0,yPct:0,wPct:1,hPct:1}:{xPct:(t.x-e.x)/e.width,yPct:(t.y-e.y)/e.height,wPct:t.width/e.width,hPct:t.height/e.height}}function Ue(t){return t.tagName==="SITEPING-WIDGET"||t.closest("siteping-widget")!==null||t.closest('[data-siteping-ignore="true"]')!==null||t.closest("#siteping-markers")!==null||t.closest("#sp-tooltip")!==null}function Xt(t){let e=null,n=i=>{let o=i.target;o instanceof HTMLElement&&(o===document.body||o===document.documentElement||o===t||Ue(o)||(e=o));};return document.addEventListener("focusin",n),{getLastPageFocus(){return e&&!e.isConnected&&(e=null),e},destroy(){document.removeEventListener("focusin",n),e=null;}}}var Dn={question:"type.question",change:"type.change",bug:"type.bug",other:"type.other"};function On(){let t=navigator.userAgentData;return t?t.platform==="macOS":navigator.platform?.includes("Mac")??/Macintosh|Mac OS X/i.test(navigator.userAgent)}var xe=class{constructor(e,n$1){this.colors=e;this.t=n$1;this.root=n("div",{style:`
1
+ import {P,Q,I,i,h,l,k,j,da,ca,W,U as U$1,ha,Y,N,n,J,M,S,o,q as q$1,g,R,G as G$1,H,t,s,m,r,u,a,c,b,x,y,z,A,d}from'./chunk-BP5TH2CD.js';export{P as loadLocale,O as registerLocale}from'./chunk-BP5TH2CD.js';var Sn=new Set(["role","name","aria-label","rel","href"]);function Tn(t,e){let n=Sn.has(t);n||=t.startsWith("data-")&&te(t);let i=te(e)&&e.length<100;return i||=e.startsWith("#")&&te(e.slice(1)),n&&i}function Cn(t){return te(t)}function An(t){return te(t)}function Rn(t){return true}function Nt(t,e){if(t.nodeType!==Node.ELEMENT_NODE)throw new Error("Can't generate CSS selector for non-element node type.");if(t.tagName.toLowerCase()==="html")return "html";let n={root:document.body,idName:Cn,className:An,tagName:Rn,attr:Tn,timeoutMs:1e3,seedMinLength:3,optimizedMinLength:2,maxNumberOfPathChecks:1/0},i=new Date,o={...n,...e},s=Fn(o.root,n),r,a=0;for(let c of Mn(t,o,s)){if(new Date().getTime()-i.getTime()>o.timeoutMs||a>=o.maxNumberOfPathChecks){let u=Pn(t,s);if(!u)throw new Error(`Timeout: Can't find a unique selector after ${o.timeoutMs}ms`);return ne(u)}if(a++,Ke(c,s)){r=c;break}}if(!r)throw new Error("Selector was not found.");let l=[...Dt(r,t,o,s,i)];return l.sort(je),l.length>0?ne(l[0]):ne(r)}function*Mn(t,e,n){let i=[],o=[],s=t,r=0;for(;s&&s!==n;){let a=Ln(s,e);for(let l of a)l.level=r;if(i.push(a),s=s.parentElement,r++,o.push(...Ht(i)),r>=e.seedMinLength){o.sort(je);for(let l of o)yield l;o=[];}}o.sort(je);for(let a of o)yield a;}function te(t){if(/^[a-z\-]{3,}$/i.test(t)){let e=t.split(/-|[A-Z]/);for(let n of e)if(n.length<=2||/[^aeiou]{4,}/i.test(n))return false;return true}return false}function Ln(t,e){let n=[],i=t.getAttribute("id");i&&e.idName(i)&&n.push({name:"#"+CSS.escape(i),penalty:0});for(let r=0;r<t.classList.length;r++){let a=t.classList[r];e.className(a)&&n.push({name:"."+CSS.escape(a),penalty:1});}for(let r=0;r<t.attributes.length;r++){let a=t.attributes[r];e.attr(a.name,a.value)&&n.push({name:`[${CSS.escape(a.name)}="${CSS.escape(a.value)}"]`,penalty:2});}let o=t.tagName.toLowerCase();if(e.tagName(o)){n.push({name:o,penalty:5});let r=Xe(t,o);r!==void 0&&n.push({name:_t(o,r),penalty:10});}let s=Xe(t);return s!==void 0&&n.push({name:In(o,s),penalty:50}),n}function ne(t){let e=t[0],n=e.name;for(let i=1;i<t.length;i++){let o=t[i].level||0;e.level===o-1?n=`${t[i].name} > ${n}`:n=`${t[i].name} ${n}`,e=t[i];}return n}function Ft(t){return t.map(e=>e.penalty).reduce((e,n)=>e+n,0)}function je(t,e){return Ft(t)-Ft(e)}function Xe(t,e){let n=t.parentNode;if(!n)return;let i=n.firstChild;if(!i)return;let o=0;for(;i&&(i.nodeType===Node.ELEMENT_NODE&&(e===void 0||i.tagName.toLowerCase()===e)&&o++,i!==t);)i=i.nextSibling;return o}function Pn(t,e){let n=0,i=t,o=[];for(;i&&i!==e;){let s=i.tagName.toLowerCase(),r=Xe(i,s);if(r===void 0)return;o.push({name:_t(s,r),penalty:NaN,level:n}),i=i.parentElement,n++;}if(Ke(o,e))return o}function In(t,e){return t==="html"?"html":`${t}:nth-child(${e})`}function _t(t,e){return t==="html"?"html":`${t}:nth-of-type(${e})`}function*Ht(t,e=[]){if(t.length>0)for(let n of t[0])yield*Ht(t.slice(1,t.length),e.concat(n));else yield e;}function Fn(t,e){return t.nodeType===Node.DOCUMENT_NODE?t:t===e.root?t.ownerDocument:t}function Ke(t,e){let n=ne(t);switch(e.querySelectorAll(n).length){case 0:throw new Error(`Can't select any node with this selector: ${n}`);case 1:return true;default:return false}}function*Dt(t,e,n,i,o){if(t.length>2&&t.length>n.optimizedMinLength)for(let s=1;s<t.length-1;s++){if(new Date().getTime()-o.getTime()>n.timeoutMs)return;let a=[...t];a.splice(s,1),Ke(a,i)&&i.querySelector(ne(a))===e&&(yield a,yield*Dt(a,e,n,i,o));}}var Nn=["role","aria-label","type","name","href","src","data-testid","data-id"];function _n(t){let e=5381;for(let n=0;n<t.length;n++)e=(e<<5)+e+t.charCodeAt(n)|0;return (e>>>0).toString(36)}function Ye(t){let e=t.children.length,n=0,i=t.parentElement;if(i)for(let o of i.children){if(o===t)break;o.tagName===t.tagName&&n++;}return `${e}:${n}:${We(t)}`}function We(t){let e=[];for(let n of Nn){let i=t.getAttribute(n);i&&e.push(`${n}=${i}`);}return e.length>0?_n(e.join(",")):"0"}function Ot(t,e){let n=e.split(":");if(n.length!==3)return 0;let[i,o,s]=n,r=Number(i),a=Number(o);if(Number.isNaN(r)||Number.isNaN(a))return 0;let l=Ye(t),[c,p,u]=l.split(":"),d=0,f=Math.abs(Number(c)-r);f===0?d+=.2:f<=2?d+=.1:f<=5&&(d+=.03);let b=Math.abs(Number(p)-a);return b===0?d+=.4:b===1?d+=.2:b<=3&&(d+=.08),u===s&&(d+=.4),d}function U(t,e){let n=e==="before"?"previousElementSibling":"nextElementSibling",i=t[n],o=3;for(;i&&o>0;){let s=e==="before"?Hn(i,256).trim():q(i,256).trim();if(s)return e==="before"?s.slice(-32):s.slice(0,32);i=i[n],o--;}return ""}function ve(t){let e=t.previousElementSibling,n=t.nextElementSibling,i=e?q(e,256).trim().slice(0,40):"",o=n?q(n,256).trim().slice(0,40):"";return [i,o].filter(Boolean).join(" | ")}function q(t,e){let n="";if(t.firstElementChild===null){for(let o of t.childNodes)if(o.nodeType===3&&(n+=o.data,n.length>=e))break;return n.length>e?n.slice(0,e):n}let i=t.ownerDocument.createTreeWalker(t,NodeFilter.SHOW_TEXT);for(;n.length<e;){let o=i.nextNode();if(!o)break;n+=o.data;}return n.length>e?n.slice(0,e):n}function Hn(t,e){let n="",i=o=>{for(let s=o.lastChild;s;s=s.previousSibling)if(s.nodeType===3){if(n=s.data+n,n.length>=e)return true}else if(s.nodeType===1&&i(s))return true;return false};return i(t),n.length>e?n.slice(-e):n}function $t(t){if(t.id){let i=t.id.includes("'")?`concat('${t.id.replace(/'/g,`',"'",'`)}')`:`'${t.id}'`;return `//${t.localName}[@id=${i}]`}let e=[],n=t;for(;n&&n!==document.body&&e.length<6;){let i=n.localName,o=n.parentElement;if(n.id){let r=n.id.includes("'")?`concat('${n.id.replace(/'/g,`',"'",'`)}')`:`'${n.id}'`;return e.unshift(`/${i}[@id=${r}]`),"/"+e.join("")}let s=1;if(o)for(let r of o.children){if(r===n)break;r.localName===i&&s++;}e.unshift(`/${i}[${s}]`),n=o;}return "/html/body"+e.join("")}var ie="data-feedback-anchor";function qe(t){let e=Nt(t,{className:u=>!/^(css|sc|emotion|styled)-/.test(u)&&!/^[a-z]{1,3}[A-Za-z0-9]{4,8}$/.test(u),attr:u=>["data-testid","data-id","role","aria-label"].includes(u),idName:u=>!u.startsWith("radix-")&&!/^:r[0-9]+:$/.test(u),seedMinLength:3,optimizedMinLength:2}),n=$t(t),o=(t.textContent?.trim()??"").slice(0,120),s=U(t,"before"),r=U(t,"after"),a=Ye(t),l=ve(t),p=t.closest(`[${ie}]`)?.getAttribute(ie)??null;return {cssSelector:e,xpath:n,textSnippet:o,textPrefix:s,textSuffix:r,fingerprint:a,neighborText:l,elementTag:t.tagName,elementId:t.id||void 0,anchorKey:p}}function Bt(t,e){let n=t.getBoundingClientRect();return n.left<=e.x&&n.top<=e.y&&n.right>=e.x+e.width&&n.bottom>=e.y+e.height}function zt(t,e=document.documentElement){let n=t.x+t.width/2,i=t.y+t.height/2,o=document.elementFromPoint(n,i);if(!o||o===e)return document.body;let s=o;for(;s&&s!==document.body;){if(s.hasAttribute(ie)&&Bt(s,t))return s;s=s.parentElement;}for(s=o;s&&s!==document.body;){if(Bt(s,t))return s;s=s.parentElement;}return document.body}function jt(t,e){return e.width<=0||e.height<=0?{xPct:0,yPct:0,wPct:1,hPct:1}:{xPct:(t.x-e.x)/e.width,yPct:(t.y-e.y)/e.height,wPct:t.width/e.width,hPct:t.height/e.height}}function Ue(t){return t.tagName==="SITEPING-WIDGET"||t.closest("siteping-widget")!==null||t.closest('[data-siteping-ignore="true"]')!==null||t.closest("#siteping-markers")!==null||t.closest("#sp-tooltip")!==null}function Xt(t){let e=null,n=i=>{let o=i.target;o instanceof HTMLElement&&(o===document.body||o===document.documentElement||o===t||Ue(o)||(e=o));};return document.addEventListener("focusin",n),{getLastPageFocus(){return e&&!e.isConnected&&(e=null),e},destroy(){document.removeEventListener("focusin",n),e=null;}}}var Dn={question:"type.question",change:"type.change",bug:"type.bug",other:"type.other"};function On(){let t=navigator.userAgentData;return t?t.platform==="macOS":navigator.platform?.includes("Mac")??/Macintosh|Mac OS X/i.test(navigator.userAgent)}var xe=class{constructor(e,n$1){this.colors=e;this.t=n$1;this.root=n("div",{style:`
2
2
  position:fixed;
3
3
  z-index:${2147483647};
4
4
  width:300px;
@@ -60,7 +60,7 @@ import {P,Q,I,i,h,l,k,j,da,ca,W,U as U$1,ha,Y,N,n,J,M,S,o,q as q$1,g,R,G as G$1,
60
60
  border-top-color:#fff;
61
61
  border-radius:50%;
62
62
  box-sizing:border-box;
63
- `,!(typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)&&typeof e.animate=="function"&&(this.spinnerAnimation=e.animate([{transform:"rotate(0deg)"},{transform:"rotate(360deg)"}],{duration:600,iterations:1/0,easing:"linear"})),e}hideElement(){this.onKeydownTrap&&(this.root.removeEventListener("keydown",this.onKeydownTrap),this.onKeydownTrap=null),this.submittingState&&this.exitSubmittingState(),this.onSubmit=null,this.root.style.opacity="0",this.root.style.transform="translateY(8px) scale(0.98)",this.previouslyFocused?.focus(),this.previouslyFocused=null,setTimeout(()=>{this.root.style.display="none";},250);}destroy(){this.submittingState&&this.exitSubmittingState(),this.resolve?.(null),this.resolve=null,this.onSubmit=null,this.onKeydownTrap&&(this.root.removeEventListener("keydown",this.onKeydownTrap),this.onKeydownTrap=null),this.root.remove();}};var oe,Kt=false;async function $n(){if(oe!==void 0)return oe;try{let t=await import('html2canvas');return oe=t.default??t,oe}catch(t){return oe=null,Kt||(Kt=true,console.warn("[siteping] html2canvas import failed unexpectedly. Capture is disabled for this session \u2014 feedbacks are still submitted, just without screenshots. Underlying error:",t)),null}}function Ge(t,e,n){return Math.min(n,Math.max(t,e))}function we(t){return Ge(0,Math.round(t*1e4)/1e4,1)}async function Yt(t,e){let n=await $n();if(!n)return null;let i=.85,o=1200,s=Ge(48,t.width*.6,280),r=Ge(48,t.height*.6,220),a=window.scrollX+t.x,l=window.scrollY+t.y,c=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth),p=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),u=Math.max(0,a-s),d=Math.max(0,l-r),f=Math.min(c,a+t.width+s)-u,b=Math.min(p,l+t.height+r)-d;if(f<=0||b<=0)return null;let M={xPct:we((a-u)/f),yPct:we((l-d)/b),wPct:we(t.width/f),hPct:we(t.height/b)};try{let y=await n(document.body,{x:u,y:d,width:f,height:b,scale:window.devicePixelRatio,useCORS:!0,allowTaint:!0,logging:!1,ignoreElements:S=>S.tagName==="SITEPING-WIDGET"||S.closest?.("siteping-widget")!==null||S.getAttribute?.("data-siteping-ignore")==="true"});if(y.width<=o)return {dataUrl:y.toDataURL("image/jpeg",i),region:M};let C=o/y.width,w=o,J=Math.round(y.height*C),L=document.createElement("canvas");L.width=w,L.height=J;let v=L.getContext("2d");return v?(v.drawImage(y,0,0,w,J),{dataUrl:L.toDataURL("image/jpeg",i),region:M}):null}catch(y){return console.warn("[siteping] Screenshot capture failed:",y),null}}var Ee=class{constructor(e,n,i,o=false,s){this.colors=e;this.bus=n;this.t=i;this.enableScreenshot=o;this.getFallbackTarget=s;this.popup=new xe(e,i),this.bus.on("annotation:start",()=>this.activate());}colors;bus;t;enableScreenshot;getFallbackTarget;overlay=null;toolbar=null;drawingRect=null;startX=0;startY=0;isDrawing=false;isActive=false;instantMode=false;popup;savedOverflow="";preActiveFocusElement=null;keyboardTarget=null;rafId=null;pendingMoveEvent=null;rejectPendingSubmission=null;get isBusy(){return this.isActive}refreshLabels(){this.popup.refreshLabels();}async maybeCapture(e){return this.enableScreenshot?Yt(e):null}activate(){if(this.isActive)return;this.isActive=true;let e=!this.instantMode;this.preActiveFocusElement=document.activeElement;let n$1=document.activeElement;if(this.keyboardTarget=n$1 instanceof HTMLElement&&n$1!==document.body&&n$1!==document.documentElement&&!Ue(n$1)?n$1:this.getFallbackTarget?.()??null,this.savedOverflow=document.body.style.overflow,document.body.style.overflow="hidden",this.overlay=n("div",{style:`
63
+ `,!(typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)&&typeof e.animate=="function"&&(this.spinnerAnimation=e.animate([{transform:"rotate(0deg)"},{transform:"rotate(360deg)"}],{duration:600,iterations:1/0,easing:"linear"})),e}hideElement(){this.onKeydownTrap&&(this.root.removeEventListener("keydown",this.onKeydownTrap),this.onKeydownTrap=null),this.submittingState&&this.exitSubmittingState(),this.onSubmit=null,this.root.style.opacity="0",this.root.style.transform="translateY(8px) scale(0.98)",this.previouslyFocused?.focus(),this.previouslyFocused=null,setTimeout(()=>{this.root.style.display="none";},250);}destroy(){this.submittingState&&this.exitSubmittingState(),this.resolve?.(null),this.resolve=null,this.onSubmit=null,this.onKeydownTrap&&(this.root.removeEventListener("keydown",this.onKeydownTrap),this.onKeydownTrap=null),this.root.remove();}};var oe,Kt=false;async function $n(){if(oe!==void 0)return oe;try{let t=await import('html2canvas-pro');return oe=t.default??t,oe}catch(t){return oe=null,Kt||(Kt=true,console.warn("[siteping] html2canvas-pro import failed unexpectedly. Capture is disabled for this session \u2014 feedbacks are still submitted, just without screenshots. Underlying error:",t)),null}}function Ge(t,e,n){return Math.min(n,Math.max(t,e))}function we(t){return Ge(0,Math.round(t*1e4)/1e4,1)}async function Yt(t,e){let n=await $n();if(!n)return null;let i=.85,o=1200,s=Ge(48,t.width*.6,280),r=Ge(48,t.height*.6,220),a=window.scrollX+t.x,l=window.scrollY+t.y,c=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth),p=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),u=Math.max(0,a-s),d=Math.max(0,l-r),f=Math.min(c,a+t.width+s)-u,b=Math.min(p,l+t.height+r)-d;if(f<=0||b<=0)return null;let M={xPct:we((a-u)/f),yPct:we((l-d)/b),wPct:we(t.width/f),hPct:we(t.height/b)};try{let y=await n(document.body,{x:u,y:d,width:f,height:b,scale:window.devicePixelRatio,useCORS:!0,allowTaint:!0,logging:!1,ignoreElements:S=>S.tagName==="SITEPING-WIDGET"||S.closest?.("siteping-widget")!==null||S.getAttribute?.("data-siteping-ignore")==="true"});if(y.width<=o)return {dataUrl:y.toDataURL("image/jpeg",i),region:M};let C=o/y.width,w=o,J=Math.round(y.height*C),L=document.createElement("canvas");L.width=w,L.height=J;let v=L.getContext("2d");return v?(v.drawImage(y,0,0,w,J),{dataUrl:L.toDataURL("image/jpeg",i),region:M}):null}catch(y){return console.warn("[siteping] Screenshot capture failed:",y),null}}var Ee=class{constructor(e,n,i,o=false,s){this.colors=e;this.bus=n;this.t=i;this.enableScreenshot=o;this.getFallbackTarget=s;this.popup=new xe(e,i),this.bus.on("annotation:start",()=>this.activate());}colors;bus;t;enableScreenshot;getFallbackTarget;overlay=null;toolbar=null;drawingRect=null;startX=0;startY=0;isDrawing=false;isActive=false;instantMode=false;popup;savedOverflow="";preActiveFocusElement=null;keyboardTarget=null;rafId=null;pendingMoveEvent=null;rejectPendingSubmission=null;get isBusy(){return this.isActive}refreshLabels(){this.popup.refreshLabels();}async maybeCapture(e){return this.enableScreenshot?Yt(e):null}activate(){if(this.isActive)return;this.isActive=true;let e=!this.instantMode;this.preActiveFocusElement=document.activeElement;let n$1=document.activeElement;if(this.keyboardTarget=n$1 instanceof HTMLElement&&n$1!==document.body&&n$1!==document.documentElement&&!Ue(n$1)?n$1:this.getFallbackTarget?.()??null,this.savedOverflow=document.body.style.overflow,document.body.style.overflow="hidden",this.overlay=n("div",{style:`
64
64
  position:fixed;inset:0;
65
65
  z-index:${2147483646};
66
66
  background:rgba(15, 23, 42, 0.04);
@@ -1564,7 +1564,7 @@ ${t.stack}`:""}`;try{let e=new WeakSet;return JSON.stringify(t,(n,i)=>{if(typeof
1564
1564
  pointer-events:none;
1565
1565
  top:-6px;
1566
1566
  left:${a}px;
1567
- `;}contains(e){return this.root.contains(e)}destroy(){this.cancelShow(),this.cancelHide(),this.root.remove();}};var pe=null;function Ti(t){return t===void 0||t===false?{console:false,network:false,maxConsoleEntries:50,maxNetworkEntries:20}:t===true?{console:true,network:true,maxConsoleEntries:50,maxNetworkEntries:20}:{console:t.console!==false,network:t.network!==false,maxConsoleEntries:typeof t.maxConsoleEntries=="number"?t.maxConsoleEntries:50,maxNetworkEntries:typeof t.maxNetworkEntries=="number"?t.maxNetworkEntries:20}}function de(){let t=()=>{};return {destroy:t,open:t,close:t,refresh:t,focusFeedback:()=>false,on:()=>t,off:t}}function bn(){try{return process.env.NODE_ENV}catch{return}}function Ci(t){return t===void 0||t===false?{enabled:false,param:"siteping"}:t===true?{enabled:true,param:"siteping"}:{enabled:true,param:t.param??"siteping"}}function gn(t){if(typeof window>"u"||typeof document>"u")return t.onSkip?.("ssr"),de();let e=t.debug?(...h)=>console.debug("[siteping]",...h):()=>{};if(pe)return e("initSiteping() called more than once \u2014 returning existing instance"),pe;if(!t.forceShow&&bn()==="production")return t.onSkip?.("production"),de();let n=typeof t.minViewportWidth=="number"&&Number.isFinite(t.minViewportWidth)?t.minViewportWidth:768;if(!t.forceShow&&window.innerWidth<n){let h="mobile";return t.onSkip?.(h),de()}if(!t.store&&(!t.endpoint||typeof t.endpoint!="string"))return console.error("[siteping] Missing 'endpoint' or 'store' in config. Provide an endpoint like '/api/siteping' or a SitepingStore instance."),de();if(!t.projectName||typeof t.projectName!="string")return console.error("[siteping] Missing or invalid 'projectName' in config. Expected a non-empty string."),de();let i=t.locale??"en",o=i==="en"?Promise.resolve():P(i).catch(()=>{}),s=Q(i),r=t.scopeAnnotationsByUrl??true,a=()=>{try{let h=t.getPageScope?.();if(h)return h}catch(h){e("getPageScope() threw, falling back to pathname:",h);}return {url:window.location.pathname,urlPattern:null}};e("Initializing widget",{projectName:t.projectName,theme:t.theme??"light",locale:i,scopeAnnotationsByUrl:r});let l=Ti(t.captureDiagnostics),c=l.console?new Te(l.maxConsoleEntries):null,p=l.network?new Ce(l.maxNetworkEntries):null,u=I(t.accentColor,t.theme),d=new re,f=new re,b=(()=>{if(t.store)return new Fe(t.store,t.projectName);let h=t.endpoint;if(typeof h!="string"||h.length===0)throw new Error("[siteping] internal invariant: endpoint must be a non-empty string in HTTP mode");return new Se(h,t.projectName,{apiKey:t.apiKey,headers:t.headers})})();t.onOpen&&d.on("open",t.onOpen),t.onClose&&d.on("close",t.onClose),t.onFeedbackSent&&d.on("feedback:sent",t.onFeedbackSent),t.onError&&d.on("feedback:error",t.onError),t.onAnnotationStart&&d.on("annotation:start",t.onAnnotationStart),t.onAnnotationEnd&&d.on("annotation:end",t.onAnnotationEnd);let M={"feedback:sent":()=>d.on("feedback:sent",h=>f.emit("feedback:sent",h)),"feedback:deleted":()=>d.on("feedback:deleted",h=>f.emit("feedback:deleted",h)),"feedback:error":()=>d.on("feedback:error",h=>f.emit("feedback:error",h)),"panel:open":()=>d.on("open",()=>f.emit("panel:open")),"panel:close":()=>d.on("close",()=>f.emit("panel:close")),"annotation:start":()=>d.on("annotation:start",()=>f.emit("annotation:start")),"annotation:end":()=>d.on("annotation:end",()=>f.emit("annotation:end"))};for(let h of Object.values(M))h();d.on("open",()=>e("Panel opened")),d.on("close",()=>e("Panel closed")),d.on("feedback:sent",h=>e("Feedback sent",h.id)),d.on("feedback:error",h=>e("Feedback failed",h.message)),d.on("annotation:start",()=>e("Annotation started")),d.on("annotation:end",()=>e("Annotation ended"));let y=document.createElement("siteping-widget");y.style.cssText=`position:fixed;z-index:${2147483647};`;let C=bn()==="test"?"open":"closed",w=y.attachShadow({mode:C});if("adoptedStyleSheets"in ShadowRoot.prototype){let h=new CSSStyleSheet;h.replaceSync(rt(u)),w.adoptedStyleSheets=[h];}else {let h=document.createElement("style");h.textContent=rt(u),w.appendChild(h);}document.body.appendChild(y);let L=Xt(y),v=document.createElement("div");v.setAttribute("role","status"),v.setAttribute("aria-live","polite"),v.setAttribute("aria-atomic","true"),v.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;",document.body.appendChild(v);let S=new Ne(u,i),A=new Ie(u,S,d,s,v),H=new Ae(w,t,d,s);d.on("markers:changed",h=>H.updateBadge(h));let k=null,I$1=null,F=false,ue=0;async function lt(){return F?null:k||(I$1||(I$1=import('./panel-KV2AQHC2.js').then(h=>F?null:(k=new h.Panel(w,u,d,b,t.projectName,A,s,i,{getScope:a,scopeAnnotationsByUrl:r}),k))),I$1)}if(typeof window<"u"){let h=()=>{F||lt();},m=window.requestIdleCallback;typeof m=="function"?m(h):setTimeout(h,200);}let B=false,yn=d.on("panel:toggle",h=>{k||(h?(B=true,lt().then(m=>{m&&B&&m.open(),B=false;}).catch(m=>e("Failed to lazy-load panel:",m))):B=false);}),he=new Ee(u,d,s,t.enableScreenshot??false,()=>L.getLastPageFocus()),fe=null;t.enableRightClickComment&&(fe=h=>{if(h.defaultPrevented)return;let m=h.pointerType;m===""||m===void 0&&h.button!==2||h.shiftKey||h.ctrlKey||h.altKey||h.metaKey||h.composedPath().some(T=>T===y||T instanceof Element&&(T.hasAttribute("data-siteping-ignore")||T.id==="siteping-markers"))||he.isBusy||(h.preventDefault(),he.startInstantAnnotation(h.clientX,h.clientY).catch(T=>e("right-click annotation failed",T)));},document.addEventListener("contextmenu",fe)),i!=="en"&&o.then(()=>{F||(H.refreshLabels(),he.refreshLabels());});let _e=false,vn=d.on("annotation:complete",async h=>{if(_e){d.emit("submission:cancelled");return}_e=true;try{let{annotation:m,type:x,message:T,screenshotDataUrl:z,screenshotRegion:j}=h,P=t.identity??Ze();if(!P){if(P=await Ai(w,s),!P){d.emit("submission:cancelled");return}en(P);}let R=(()=>{try{return crypto.randomUUID()}catch{return `${Date.now()}-${Math.random().toString(36).slice(2)}`}})(),Q=a(),dt=null;(c||p)&&(dt={console:c?.getEntries()??[],network:p?.getEntries()??[]});let En={projectName:t.projectName,type:x,message:T,url:Q.url,urlPattern:Q.urlPattern,viewport:`${window.innerWidth}x${window.innerHeight}`,userAgent:navigator.userAgent,authorName:P.name,authorEmail:P.email,annotations:[m],clientId:R,screenshotDataUrl:z??null,screenshotRegion:j??null,diagnostics:dt};try{let D=await b.sendFeedback(En);d.emit("feedback:sent",D),(!r||D.url===Q.url)&&A.addFeedback(D,A.count+1),v.textContent=s("feedback.sent.confirmation"),k&&await k.refresh();}catch(D){d.emit("feedback:error",D instanceof Error?D:new Error(String(D))),v.textContent=s("feedback.error.message");}}finally{_e=false;}}),He=a(),xn=r?{limit:20,url:He.url}:{limit:20},De=Ci(t.deepLink),wn=++ue;Promise.all([b.getFeedbacks(t.projectName,xn),o]).then(([{feedbacks:h}])=>{if(F||ue!==wn)return;let m=r?h.filter(x=>x.url===He.url):h;if(A.render(m),De.enabled)try{let x=new URLSearchParams(window.location.search).get(De.param);if(x){let T=A.focusFeedback(x);e(`deepLink ?${De.param}=${x} ${T?"focused":"did not match a visible feedback"}`);}}catch(x){e("deepLink parsing failed:",x);}}).catch(h=>{e("Failed to load initial markers:",h);}),t.endpoint&&Vt(t.endpoint,t.identity??Ze(),{apiKey:t.apiKey,headers:t.headers}).then(()=>e("Retry queue flushed")).catch(()=>{});let ct=()=>{let h=++ue;if(k?.isCurrentlyOpen)return k.refresh();let m=a(),x=r?{limit:20,url:m.url}:{limit:20};return b.getFeedbacks(t.projectName,x).then(({feedbacks:T})=>{if(F||h!==ue||k?.isCurrentlyOpen)return;let z=r?T.filter(j=>j.url===m.url):T;A.render(z);})},pt=null;if(t.watchNavigation!==false&&typeof window<"u"&&typeof history<"u"){let h=R=>`${R.url}
1567
+ `;}contains(e){return this.root.contains(e)}destroy(){this.cancelShow(),this.cancelHide(),this.root.remove();}};var pe=null;function Ti(t){return t===void 0||t===false?{console:false,network:false,maxConsoleEntries:50,maxNetworkEntries:20}:t===true?{console:true,network:true,maxConsoleEntries:50,maxNetworkEntries:20}:{console:t.console!==false,network:t.network!==false,maxConsoleEntries:typeof t.maxConsoleEntries=="number"?t.maxConsoleEntries:50,maxNetworkEntries:typeof t.maxNetworkEntries=="number"?t.maxNetworkEntries:20}}function de(){let t=()=>{};return {destroy:t,open:t,close:t,refresh:t,focusFeedback:()=>false,on:()=>t,off:t}}function bn(){try{return process.env.NODE_ENV}catch{return}}function Ci(t){return t===void 0||t===false?{enabled:false,param:"siteping"}:t===true?{enabled:true,param:"siteping"}:{enabled:true,param:t.param??"siteping"}}function gn(t){if(typeof window>"u"||typeof document>"u")return t.onSkip?.("ssr"),de();let e=t.debug?(...h)=>console.debug("[siteping]",...h):()=>{};if(pe)return e("initSiteping() called more than once \u2014 returning existing instance"),pe;if(!t.forceShow&&bn()==="production")return t.onSkip?.("production"),de();let n=typeof t.minViewportWidth=="number"&&Number.isFinite(t.minViewportWidth)?t.minViewportWidth:768;if(!t.forceShow&&window.innerWidth<n){let h="mobile";return t.onSkip?.(h),de()}if(!t.store&&(!t.endpoint||typeof t.endpoint!="string"))return console.error("[siteping] Missing 'endpoint' or 'store' in config. Provide an endpoint like '/api/siteping' or a SitepingStore instance."),de();if(!t.projectName||typeof t.projectName!="string")return console.error("[siteping] Missing or invalid 'projectName' in config. Expected a non-empty string."),de();let i=t.locale??"en",o=i==="en"?Promise.resolve():P(i).catch(()=>{}),s=Q(i),r=t.scopeAnnotationsByUrl??true,a=()=>{try{let h=t.getPageScope?.();if(h)return h}catch(h){e("getPageScope() threw, falling back to pathname:",h);}return {url:window.location.pathname,urlPattern:null}};e("Initializing widget",{projectName:t.projectName,theme:t.theme??"light",locale:i,scopeAnnotationsByUrl:r});let l=Ti(t.captureDiagnostics),c=l.console?new Te(l.maxConsoleEntries):null,p=l.network?new Ce(l.maxNetworkEntries):null,u=I(t.accentColor,t.theme),d=new re,f=new re,b=(()=>{if(t.store)return new Fe(t.store,t.projectName);let h=t.endpoint;if(typeof h!="string"||h.length===0)throw new Error("[siteping] internal invariant: endpoint must be a non-empty string in HTTP mode");return new Se(h,t.projectName,{apiKey:t.apiKey,headers:t.headers})})();t.onOpen&&d.on("open",t.onOpen),t.onClose&&d.on("close",t.onClose),t.onFeedbackSent&&d.on("feedback:sent",t.onFeedbackSent),t.onError&&d.on("feedback:error",t.onError),t.onAnnotationStart&&d.on("annotation:start",t.onAnnotationStart),t.onAnnotationEnd&&d.on("annotation:end",t.onAnnotationEnd);let M={"feedback:sent":()=>d.on("feedback:sent",h=>f.emit("feedback:sent",h)),"feedback:deleted":()=>d.on("feedback:deleted",h=>f.emit("feedback:deleted",h)),"feedback:error":()=>d.on("feedback:error",h=>f.emit("feedback:error",h)),"panel:open":()=>d.on("open",()=>f.emit("panel:open")),"panel:close":()=>d.on("close",()=>f.emit("panel:close")),"annotation:start":()=>d.on("annotation:start",()=>f.emit("annotation:start")),"annotation:end":()=>d.on("annotation:end",()=>f.emit("annotation:end"))};for(let h of Object.values(M))h();d.on("open",()=>e("Panel opened")),d.on("close",()=>e("Panel closed")),d.on("feedback:sent",h=>e("Feedback sent",h.id)),d.on("feedback:error",h=>e("Feedback failed",h.message)),d.on("annotation:start",()=>e("Annotation started")),d.on("annotation:end",()=>e("Annotation ended"));let y=document.createElement("siteping-widget");y.style.cssText=`position:fixed;z-index:${2147483647};`;let C=bn()==="test"?"open":"closed",w=y.attachShadow({mode:C});if("adoptedStyleSheets"in ShadowRoot.prototype){let h=new CSSStyleSheet;h.replaceSync(rt(u)),w.adoptedStyleSheets=[h];}else {let h=document.createElement("style");h.textContent=rt(u),w.appendChild(h);}document.body.appendChild(y);let L=Xt(y),v=document.createElement("div");v.setAttribute("role","status"),v.setAttribute("aria-live","polite"),v.setAttribute("aria-atomic","true"),v.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;",document.body.appendChild(v);let S=new Ne(u,i),A=new Ie(u,S,d,s,v),H=new Ae(w,t,d,s);d.on("markers:changed",h=>H.updateBadge(h));let k=null,I$1=null,F=false,ue=0;async function lt(){return F?null:k||(I$1||(I$1=import('./panel-SGSUHR7V.js').then(h=>F?null:(k=new h.Panel(w,u,d,b,t.projectName,A,s,i,{getScope:a,scopeAnnotationsByUrl:r}),k))),I$1)}if(typeof window<"u"){let h=()=>{F||lt();},m=window.requestIdleCallback;typeof m=="function"?m(h):setTimeout(h,200);}let B=false,yn=d.on("panel:toggle",h=>{k||(h?(B=true,lt().then(m=>{m&&B&&m.open(),B=false;}).catch(m=>e("Failed to lazy-load panel:",m))):B=false);}),he=new Ee(u,d,s,t.enableScreenshot??false,()=>L.getLastPageFocus()),fe=null;t.enableRightClickComment&&(fe=h=>{if(h.defaultPrevented)return;let m=h.pointerType;m===""||m===void 0&&h.button!==2||h.shiftKey||h.ctrlKey||h.altKey||h.metaKey||h.composedPath().some(T=>T===y||T instanceof Element&&(T.hasAttribute("data-siteping-ignore")||T.id==="siteping-markers"))||he.isBusy||(h.preventDefault(),he.startInstantAnnotation(h.clientX,h.clientY).catch(T=>e("right-click annotation failed",T)));},document.addEventListener("contextmenu",fe)),i!=="en"&&o.then(()=>{F||(H.refreshLabels(),he.refreshLabels());});let _e=false,vn=d.on("annotation:complete",async h=>{if(_e){d.emit("submission:cancelled");return}_e=true;try{let{annotation:m,type:x,message:T,screenshotDataUrl:z,screenshotRegion:j}=h,P=t.identity??Ze();if(!P){if(P=await Ai(w,s),!P){d.emit("submission:cancelled");return}en(P);}let R=(()=>{try{return crypto.randomUUID()}catch{return `${Date.now()}-${Math.random().toString(36).slice(2)}`}})(),Q=a(),dt=null;(c||p)&&(dt={console:c?.getEntries()??[],network:p?.getEntries()??[]});let En={projectName:t.projectName,type:x,message:T,url:Q.url,urlPattern:Q.urlPattern,viewport:`${window.innerWidth}x${window.innerHeight}`,userAgent:navigator.userAgent,authorName:P.name,authorEmail:P.email,annotations:[m],clientId:R,screenshotDataUrl:z??null,screenshotRegion:j??null,diagnostics:dt};try{let D=await b.sendFeedback(En);d.emit("feedback:sent",D),(!r||D.url===Q.url)&&A.addFeedback(D,A.count+1),v.textContent=s("feedback.sent.confirmation"),k&&await k.refresh();}catch(D){d.emit("feedback:error",D instanceof Error?D:new Error(String(D))),v.textContent=s("feedback.error.message");}}finally{_e=false;}}),He=a(),xn=r?{limit:20,url:He.url}:{limit:20},De=Ci(t.deepLink),wn=++ue;Promise.all([b.getFeedbacks(t.projectName,xn),o]).then(([{feedbacks:h}])=>{if(F||ue!==wn)return;let m=r?h.filter(x=>x.url===He.url):h;if(A.render(m),De.enabled)try{let x=new URLSearchParams(window.location.search).get(De.param);if(x){let T=A.focusFeedback(x);e(`deepLink ?${De.param}=${x} ${T?"focused":"did not match a visible feedback"}`);}}catch(x){e("deepLink parsing failed:",x);}}).catch(h=>{e("Failed to load initial markers:",h);}),t.endpoint&&Vt(t.endpoint,t.identity??Ze(),{apiKey:t.apiKey,headers:t.headers}).then(()=>e("Retry queue flushed")).catch(()=>{});let ct=()=>{let h=++ue;if(k?.isCurrentlyOpen)return k.refresh();let m=a(),x=r?{limit:20,url:m.url}:{limit:20};return b.getFeedbacks(t.projectName,x).then(({feedbacks:T})=>{if(F||h!==ue||k?.isCurrentlyOpen)return;let z=r?T.filter(j=>j.url===m.url):T;A.render(z);})},pt=null;if(t.watchNavigation!==false&&typeof window<"u"&&typeof history<"u"){let h=R=>`${R.url}
1568
1568
  ${R.urlPattern??""}`,m=h(He),x=()=>{if(F)return;let R=h(a());if(R===m)return;let Q=m;m=R,e("SPA navigation detected \u2014 refreshing feedbacks for new scope"),ct().catch(()=>{m===R&&(m=Q);});},T=history.pushState,z=history.replaceState,j=function(...R){T.apply(this,R),x();},P=function(...R){z.apply(this,R),x();};history.pushState=j,history.replaceState=P,window.addEventListener("popstate",x),window.addEventListener("hashchange",x),pt=()=>{window.removeEventListener("popstate",x),window.removeEventListener("hashchange",x),history.pushState===j&&(history.pushState=T),history.replaceState===P&&(history.replaceState=z);};}return pe={destroy:()=>{e("Destroying widget"),fe&&document.removeEventListener("contextmenu",fe),F=true,B=false,pt?.(),L.destroy(),vn(),yn(),H.destroy(),k?.destroy(),he.destroy(),A.destroy(),S.destroy(),c?.dispose(),p?.dispose(),d.removeAll(),f.removeAll(),v.remove(),y.remove(),pe=null;},open:()=>{d.emit("panel:toggle",true);},close:()=>{k?k.close():B=false;},focusFeedback:h=>A.focusFeedback(h),refresh:()=>{ct().catch(()=>{});},on:(h,m)=>f.on(h,m),off:(h,m)=>{f.off(h,m);}},pe}function Ai(t,e){return new Promise(n=>{let i=t.activeElement??document.activeElement,o=t.host;o.parentNode&&o.parentNode.appendChild(o);let s=document.createElement("div");s.style.cssText=`
1569
1569
  position:fixed;inset:0;
1570
1570
  background:var(--sp-identity-overlay);