@siteping/widget 0.10.7 → 0.10.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/{chunk-7ZBKJ6NW.js → chunk-4CK3N4YE.js} +11 -11
  2. package/dist/chunk-4CK3N4YE.js.map +1 -0
  3. package/dist/{chunk-GKRKCSID.cjs → chunk-BJFC7TVL.cjs} +11 -11
  4. package/dist/chunk-BJFC7TVL.cjs.map +1 -0
  5. package/dist/{chunk-NVNA5AI2.cjs → chunk-EYISG4OI.js} +11 -11
  6. package/dist/chunk-EYISG4OI.js.map +1 -0
  7. package/dist/{chunk-FDQWFGRR.js → chunk-OK2KX3KN.cjs} +11 -11
  8. package/dist/chunk-OK2KX3KN.cjs.map +1 -0
  9. package/dist/email.d.cts +19 -0
  10. package/dist/email.d.ts +19 -0
  11. package/dist/filters.d.cts +29 -4
  12. package/dist/filters.d.ts +29 -4
  13. package/dist/index.cjs +50 -50
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.global.js +46 -46
  16. package/dist/index.global.js.map +1 -1
  17. package/dist/index.js +51 -51
  18. package/dist/index.js.map +1 -1
  19. package/dist/panel-KCYUMYAI.cjs +2 -0
  20. package/dist/{panel-M2QKMFYO.cjs.map → panel-KCYUMYAI.cjs.map} +1 -1
  21. package/dist/panel-KV2AQHC2.js +2 -0
  22. package/dist/{panel-FUPBUN6F.js.map → panel-KV2AQHC2.js.map} +1 -1
  23. package/dist/panel-LYS3425X.cjs +2 -0
  24. package/dist/{panel-XUTDVTAR.cjs.map → panel-LYS3425X.cjs.map} +1 -1
  25. package/dist/panel-W2LHYGFS.js +2 -0
  26. package/dist/{panel-7URHNKQH.js.map → panel-W2LHYGFS.js.map} +1 -1
  27. package/dist/react.cjs +42 -42
  28. package/dist/react.cjs.map +1 -1
  29. package/dist/react.js +46 -46
  30. package/dist/react.js.map +1 -1
  31. package/dist/siteping-core.d.cts +3 -2
  32. package/dist/siteping-core.d.ts +3 -2
  33. package/dist/store-helpers.d.cts +13 -4
  34. package/dist/store-helpers.d.ts +13 -4
  35. package/dist/types.d.cts +2 -2
  36. package/dist/types.d.ts +2 -2
  37. package/package.json +4 -4
  38. package/dist/chunk-7ZBKJ6NW.js.map +0 -1
  39. package/dist/chunk-FDQWFGRR.js.map +0 -1
  40. package/dist/chunk-GKRKCSID.cjs.map +0 -1
  41. package/dist/chunk-NVNA5AI2.cjs.map +0 -1
  42. package/dist/panel-7URHNKQH.js +0 -2
  43. package/dist/panel-FUPBUN6F.js +0 -2
  44. package/dist/panel-M2QKMFYO.cjs +0 -2
  45. package/dist/panel-XUTDVTAR.cjs +0 -2
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- 'use strict';var chunkNVNA5AI2_cjs=require('./chunk-NVNA5AI2.cjs');var wn=new Set(["role","name","aria-label","rel","href"]);function En(t,e){let n=wn.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 kn(t){return te(t)}function Sn(t){return te(t)}function Tn(t){return true}function Pt(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:kn,className:Sn,tagName:Tn,attr:En,timeoutMs:1e3,seedMinLength:3,optimizedMinLength:2,maxNumberOfPathChecks:1/0},i=new Date,o={...n,...e},r=Ln(o.root,n),s,a=0;for(let c of Cn(t,o,r)){if(new Date().getTime()-i.getTime()>o.timeoutMs||a>=o.maxNumberOfPathChecks){let u=Rn(t,r);if(!u)throw new Error(`Timeout: Can't find a unique selector after ${o.timeoutMs}ms`);return ne(u)}if(a++,Ke(c,r)){s=c;break}}if(!s)throw new Error("Selector was not found.");let l=[..._t(s,t,o,r,i)];return l.sort(ze),l.length>0?ne(l[0]):ne(s)}function*Cn(t,e,n){let i=[],o=[],r=t,s=0;for(;r&&r!==n;){let a=An(r,e);for(let l of a)l.level=s;if(i.push(a),r=r.parentElement,s++,o.push(...Ft(i)),s>=e.seedMinLength){o.sort(ze);for(let l of o)yield l;o=[];}}o.sort(ze);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 An(t,e){let n=[],i=t.getAttribute("id");i&&e.idName(i)&&n.push({name:"#"+CSS.escape(i),penalty:0});for(let s=0;s<t.classList.length;s++){let a=t.classList[s];e.className(a)&&n.push({name:"."+CSS.escape(a),penalty:1});}for(let s=0;s<t.attributes.length;s++){let a=t.attributes[s];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 s=je(t,o);s!==void 0&&n.push({name:It(o,s),penalty:10});}let r=je(t);return r!==void 0&&n.push({name:Mn(o,r),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 Lt(t){return t.map(e=>e.penalty).reduce((e,n)=>e+n,0)}function ze(t,e){return Lt(t)-Lt(e)}function je(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 Rn(t,e){let n=0,i=t,o=[];for(;i&&i!==e;){let r=i.tagName.toLowerCase(),s=je(i,r);if(s===void 0)return;o.push({name:It(r,s),penalty:NaN,level:n}),i=i.parentElement,n++;}if(Ke(o,e))return o}function Mn(t,e){return t==="html"?"html":`${t}:nth-child(${e})`}function It(t,e){return t==="html"?"html":`${t}:nth-of-type(${e})`}function*Ft(t,e=[]){if(t.length>0)for(let n of t[0])yield*Ft(t.slice(1,t.length),e.concat(n));else yield e;}function Ln(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*_t(t,e,n,i,o){if(t.length>2&&t.length>n.optimizedMinLength)for(let r=1;r<t.length-1;r++){if(new Date().getTime()-o.getTime()>n.timeoutMs)return;let a=[...t];a.splice(r,1),Ke(a,i)&&i.querySelector(ne(a))===e&&(yield a,yield*_t(a,e,n,i,o));}}var Pn=["role","aria-label","type","name","href","src","data-testid","data-id"];function In(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 Xe(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}:${Ye(t)}`}function Ye(t){let e=[];for(let n of Pn){let i=t.getAttribute(n);i&&e.push(`${n}=${i}`);}return e.length>0?In(e.join(",")):"0"}function Nt(t,e){let n=e.split(":");if(n.length!==3)return 0;let[i,o,r]=n,s=Number(i),a=Number(o);if(Number.isNaN(s)||Number.isNaN(a))return 0;let l=Xe(t),[c,p,u]=l.split(":"),d=0,f=Math.abs(Number(c)-s);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===r&&(d+=.4),d}function U(t,e){let n=e==="before"?"previousElementSibling":"nextElementSibling",i=t[n],o=3;for(;i&&o>0;){let r=e==="before"?Fn(i,256).trim():q(i,256).trim();if(r)return e==="before"?r.slice(-32):r.slice(0,32);i=i[n],o--;}return ""}function ye(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 Fn(t,e){let n="",i=o=>{for(let r=o.lastChild;r;r=r.previousSibling)if(r.nodeType===3){if(n=r.data+n,n.length>=e)return true}else if(r.nodeType===1&&i(r))return true;return false};return i(t),n.length>e?n.slice(-e):n}function Ht(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 s=n.id.includes("'")?`concat('${n.id.replace(/'/g,`',"'",'`)}')`:`'${n.id}'`;return e.unshift(`/${i}[@id=${s}]`),"/"+e.join("")}let r=1;if(o)for(let s of o.children){if(s===n)break;s.localName===i&&r++;}e.unshift(`/${i}[${r}]`),n=o;}return "/html/body"+e.join("")}var ie="data-feedback-anchor";function We(t){let e=Pt(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=Ht(t),o=(t.textContent?.trim()??"").slice(0,120),r=U(t,"before"),s=U(t,"after"),a=Xe(t),l=ye(t),p=t.closest(`[${ie}]`)?.getAttribute(ie)??null;return {cssSelector:e,xpath:n,textSnippet:o,textPrefix:r,textSuffix:s,fingerprint:a,neighborText:l,elementTag:t.tagName,elementId:t.id||void 0,anchorKey:p}}function Dt(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 Ot(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 r=o;for(;r&&r!==document.body;){if(r.hasAttribute(ie)&&Dt(r,t))return r;r=r.parentElement;}for(r=o;r&&r!==document.body;){if(Dt(r,t))return r;r=r.parentElement;}return document.body}function $t(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 qe(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 Bt(t){let e=null,n=i=>{let o=i.target;o instanceof HTMLElement&&(o===document.body||o===document.documentElement||o===t||qe(o)||(e=o));};return document.addEventListener("focusin",n),{getLastPageFocus(){return e&&!e.isConnected&&(e=null),e},destroy(){document.removeEventListener("focusin",n),e=null;}}}var _n={question:"type.question",change:"type.change",bug:"type.bug",other:"type.other"};function Nn(){let t=navigator.userAgentData;return t?t.platform==="macOS":navigator.platform?.includes("Mac")??/Macintosh|Mac OS X/i.test(navigator.userAgent)}var ve=class{constructor(e,n){this.colors=e;this.t=n;this.root=chunkNVNA5AI2_cjs.b("div",{style:`
1
+ 'use strict';var chunkBJFC7TVL_cjs=require('./chunk-BJFC7TVL.cjs');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){this.colors=e;this.t=n;this.root=chunkBJFC7TVL_cjs.n("div",{style:`
2
2
  position:fixed;
3
3
  z-index:${2147483647};
4
4
  width:300px;
@@ -15,7 +15,7 @@
15
15
  transition:opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1),transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
16
16
  display:none;
17
17
  -webkit-font-smoothing:antialiased;
18
- `}),this.root.setAttribute("role","dialog"),this.root.setAttribute("aria-modal","true"),this.root.setAttribute("data-siteping-ignore","true");let i=[{type:"question",icon:chunkNVNA5AI2_cjs.l},{type:"change",icon:chunkNVNA5AI2_cjs.m},{type:"bug",icon:chunkNVNA5AI2_cjs.n},{type:"other",icon:chunkNVNA5AI2_cjs.o}];this.typeRow=chunkNVNA5AI2_cjs.b("div",{style:"display:grid;grid-template-columns:1fr 1fr;gap:6px;margin-bottom:12px;"});for(let r of i){let s=document.createElement("button");s.style.cssText=`
18
+ `}),this.root.setAttribute("role","dialog"),this.root.setAttribute("aria-modal","true"),this.root.setAttribute("data-siteping-ignore","true");let i=[{type:"question",icon:chunkBJFC7TVL_cjs.x},{type:"change",icon:chunkBJFC7TVL_cjs.y},{type:"bug",icon:chunkBJFC7TVL_cjs.z},{type:"other",icon:chunkBJFC7TVL_cjs.A}];this.typeRow=chunkBJFC7TVL_cjs.n("div",{style:"display:grid;grid-template-columns:1fr 1fr;gap:6px;margin-bottom:12px;"});for(let s of i){let r=document.createElement("button");r.style.cssText=`
19
19
  height:44px;
20
20
  border-radius:9999px;border:1px solid ${this.colors.border};
21
21
  background:${this.colors.glassBg};cursor:pointer;
@@ -24,7 +24,7 @@
24
24
  font-size:13px;font-weight:500;color:${this.colors.textTertiary};
25
25
  transition:all 0.2s ease;
26
26
  padding:0 12px;
27
- `;let a=chunkNVNA5AI2_cjs.a(r.icon);a.setAttribute("style","width:13px;height:13px;flex-shrink:0;"),s.appendChild(a),s.appendChild(document.createElement("span")),s.dataset.type=r.type,s.setAttribute("aria-pressed","false"),s.addEventListener("click",()=>{this.submittingState||this.selectType(r.type,this.typeRow);}),s.addEventListener("mouseenter",()=>{if(!this.submittingState&&s.dataset.type!==this.selectedType){let l=chunkNVNA5AI2_cjs.A(s.dataset.type??"",this.colors);s.style.background=l,s.style.borderColor=chunkNVNA5AI2_cjs.x(s.dataset.type??"",this.colors)+"40";}}),s.addEventListener("mouseleave",()=>{this.submittingState||s.dataset.type!==this.selectedType&&(s.style.background=this.colors.glassBg,s.style.borderColor=this.colors.border);}),this.typeRow.appendChild(s);}this.textarea=document.createElement("textarea"),this.textarea.style.cssText=`
27
+ `;let a=chunkBJFC7TVL_cjs.m(s.icon);a.setAttribute("style","width:13px;height:13px;flex-shrink:0;"),r.appendChild(a),r.appendChild(document.createElement("span")),r.dataset.type=s.type,r.setAttribute("aria-pressed","false"),r.addEventListener("click",()=>{this.submittingState||this.selectType(s.type,this.typeRow);}),r.addEventListener("mouseenter",()=>{if(!this.submittingState&&r.dataset.type!==this.selectedType){let l=chunkBJFC7TVL_cjs.M(r.dataset.type??"",this.colors);r.style.background=l,r.style.borderColor=chunkBJFC7TVL_cjs.J(r.dataset.type??"",this.colors)+"40";}}),r.addEventListener("mouseleave",()=>{this.submittingState||r.dataset.type!==this.selectedType&&(r.style.background=this.colors.glassBg,r.style.borderColor=this.colors.border);}),this.typeRow.appendChild(r);}this.textarea=document.createElement("textarea"),this.textarea.style.cssText=`
28
28
  width:100%;min-height:72px;max-height:152px;
29
29
  padding:10px 12px;border-radius:12px;
30
30
  border:1px solid ${this.colors.border};
@@ -33,12 +33,12 @@
33
33
  font-size:13px;line-height:1.5;resize:vertical;
34
34
  outline:none;transition:all 0.2s ease;
35
35
  box-sizing:border-box;
36
- `,this.textarea.maxLength=5e3,this.hint=chunkNVNA5AI2_cjs.b("div",{style:`
36
+ `,this.textarea.maxLength=5e3,this.hint=chunkBJFC7TVL_cjs.n("div",{style:`
37
37
  font-size:11px;color:${this.colors.textTertiary};
38
38
  text-align:right;margin-top:4px;
39
39
  font-family:"Inter",system-ui,-apple-system,sans-serif;
40
40
  letter-spacing:0.01em;
41
- `}),this.textarea.addEventListener("focus",()=>{this.submittingState||(this.textarea.style.borderColor=this.colors.accent,this.textarea.style.boxShadow=`0 0 0 3px ${this.colors.accent}14`,this.textarea.style.background=this.colors.bg);}),this.textarea.addEventListener("blur",()=>{this.submittingState||(this.textarea.style.borderColor=this.colors.border,this.textarea.style.boxShadow="none",this.textarea.style.background=this.colors.glassBgHeavy);}),this.textarea.addEventListener("input",()=>{this.updateSubmitState();}),this.textarea.addEventListener("keydown",r=>{this.submittingState||(r.key==="Enter"&&(r.ctrlKey||r.metaKey)&&(r.preventDefault(),this.submit()),r.key==="Escape"&&this.cancel());});let o=chunkNVNA5AI2_cjs.b("div",{style:"display:flex;justify-content:flex-end;gap:8px;margin-top:12px;"});this.cancelBtn=document.createElement("button"),this.cancelBtn.style.cssText=`
41
+ `}),this.textarea.addEventListener("focus",()=>{this.submittingState||(this.textarea.style.borderColor=this.colors.accent,this.textarea.style.boxShadow=`0 0 0 3px ${this.colors.accent}14`,this.textarea.style.background=this.colors.bg);}),this.textarea.addEventListener("blur",()=>{this.submittingState||(this.textarea.style.borderColor=this.colors.border,this.textarea.style.boxShadow="none",this.textarea.style.background=this.colors.glassBgHeavy);}),this.textarea.addEventListener("input",()=>{this.updateSubmitState();}),this.textarea.addEventListener("keydown",s=>{this.submittingState||(s.key==="Enter"&&(s.ctrlKey||s.metaKey)&&(s.preventDefault(),this.submit()),s.key==="Escape"&&this.cancel());});let o=chunkBJFC7TVL_cjs.n("div",{style:"display:flex;justify-content:flex-end;gap:8px;margin-top:12px;"});this.cancelBtn=document.createElement("button"),this.cancelBtn.style.cssText=`
42
42
  height:34px;padding:0 16px;border-radius:9999px;
43
43
  border:1px solid ${this.colors.border};
44
44
  background:${this.colors.glassBg};
@@ -54,18 +54,18 @@
54
54
  transition:all 0.2s ease;
55
55
  box-shadow:0 2px 8px ${this.colors.accentGlow};
56
56
  display:inline-flex;align-items:center;justify-content:center;min-width:64px;
57
- `,this.submitLabel=document.createElement("span"),this.submitBtn.appendChild(this.submitLabel),this.submitBtn.addEventListener("click",()=>this.submit()),o.appendChild(this.cancelBtn),o.appendChild(this.submitBtn),this.root.appendChild(this.typeRow),this.root.appendChild(this.textarea),this.root.appendChild(this.hint),this.root.appendChild(o),document.body.appendChild(this.root),this.applyLabels();}colors;t;root;selectedType=null;textarea;submitBtn;cancelBtn;typeRow;submitLabel;hint;resolve=null;previouslyFocused=null;onKeydownTrap=null;onSubmit=null;submittingState=false;spinnerAnimation=null;get isOpen(){return this.resolve!==null}refreshLabels(){this.applyLabels();}applyLabels(){this.root.setAttribute("aria-label",this.t("popup.ariaLabel"));let e=this.root.querySelectorAll("button[data-type]");for(let n of e){let i=n.dataset.type;if(!i)continue;let o=_n[i];if(!o)continue;let r=n.querySelector("span");r&&chunkNVNA5AI2_cjs.c(r,this.t(o));}this.textarea.placeholder=this.t("popup.placeholder"),this.textarea.setAttribute("aria-label",this.t("popup.textareaAria")),chunkNVNA5AI2_cjs.c(this.hint,Nn()?this.t("popup.submitHintMac"):this.t("popup.submitHintOther")),chunkNVNA5AI2_cjs.c(this.cancelBtn,this.t("popup.cancel")),chunkNVNA5AI2_cjs.c(this.submitLabel,this.t("popup.submit"));}show(e,n){return new Promise(i=>{this.resolve=i,this.onSubmit=n??null,this.selectedType=null,this.textarea.value="",this.submittingState=false,this.updateSubmitState(),this.resetTypeButtons(),this.previouslyFocused=document.activeElement;let o=220,r=300,s=e.bottom+8,a=e.left;if(s+o>window.innerHeight){let c=e.top-o-8;c>=8?s=c:s=window.innerHeight-o-8;}a+r>window.innerWidth&&(a=e.right-r),a=Math.max(8,a),s=Math.max(8,s),this.root.style.top=`${s}px`,this.root.style.left=`${a}px`,this.root.style.display="block",this.onKeydownTrap=c=>{if(c.key==="Tab"){let p=Array.from(this.root.querySelectorAll('button:not([disabled]), textarea:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])'));if(p.length===0)return;let u=p[0],d=p[p.length-1];if(!u||!d)return;c.shiftKey?(document.activeElement===u||!this.root.contains(document.activeElement))&&(c.preventDefault(),d.focus()):(document.activeElement===d||!this.root.contains(document.activeElement))&&(c.preventDefault(),u.focus());}},this.root.addEventListener("keydown",this.onKeydownTrap);let l=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;this.root.style.transition=l?"none":"",requestAnimationFrame(()=>{this.root.style.opacity="1",this.root.style.transform="translateY(0) scale(1)",this.textarea.focus();});})}selectType(e,n){this.selectedType=e;let i=n.querySelectorAll("button");for(let o of i){let r=o.dataset.type===e,s=chunkNVNA5AI2_cjs.x(o.dataset.type??"",this.colors),a=chunkNVNA5AI2_cjs.A(o.dataset.type??"",this.colors);o.style.background=r?a:this.colors.glassBg,o.style.borderColor=r?s+"60":this.colors.border,o.style.color=r?s:this.colors.textTertiary,o.style.fontWeight=r?"600":"500",o.setAttribute("aria-pressed",String(r));}this.updateSubmitState();}resetTypeButtons(){let e=this.root.querySelectorAll("button[data-type]");for(let n of e)n.setAttribute("aria-pressed","false"),n.disabled=false,n.style.background=this.colors.glassBg,n.style.borderColor=this.colors.border,n.style.color=this.colors.textTertiary,n.style.fontWeight="500",n.style.cursor="pointer";}updateSubmitState(){if(this.submittingState)return;let e=this.selectedType!==null&&this.textarea.value.trim().length>0;this.submitBtn.disabled=!e,this.submitBtn.style.opacity=e?"1":"0.35",this.submitBtn.style.pointerEvents=e?"auto":"none";}submit(){if(this.submittingState||!this.selectedType||!this.textarea.value.trim())return;let e={type:this.selectedType,message:this.textarea.value.trim()};if(!this.onSubmit){this.resolve?.(e),this.resolve=null,this.hideElement();return}this.enterSubmittingState();let n=this.onSubmit;n(e).then(()=>{this.resolve?.(e),this.resolve=null,this.hideElement();}).catch(()=>{this.exitSubmittingState();});}cancel(){this.submittingState||(this.resolve?.(null),this.resolve=null,this.hideElement());}enterSubmittingState(){this.submittingState=true,this.submitLabel.style.display="none",this.submitBtn.disabled=true,this.submitBtn.style.cursor="wait",this.submitBtn.style.opacity="0.85",this.submitBtn.setAttribute("aria-busy","true"),this.submitBtn.appendChild(this.buildSpinner()),this.cancelBtn.disabled=true,this.cancelBtn.style.opacity="0.5",this.cancelBtn.style.cursor="not-allowed",this.cancelBtn.style.pointerEvents="none",this.textarea.disabled=true,this.textarea.style.opacity="0.6";let e=this.typeRow.querySelectorAll("button");for(let n of e)n.disabled=true,n.style.cursor="not-allowed",n.style.opacity="0.6";}exitSubmittingState(){this.submittingState=false,this.spinnerAnimation?.cancel(),this.spinnerAnimation=null,this.submitBtn.querySelector('[data-role="sp-popup-spinner"]')?.remove(),this.submitLabel.style.display="",this.submitBtn.removeAttribute("aria-busy"),this.submitBtn.style.cursor="pointer",this.cancelBtn.disabled=false,this.cancelBtn.style.opacity="1",this.cancelBtn.style.cursor="pointer",this.cancelBtn.style.pointerEvents="auto",this.textarea.disabled=false,this.textarea.style.opacity="1";let n=this.typeRow.querySelectorAll("button");for(let i of n)i.disabled=false,i.style.cursor="pointer",i.style.opacity="1";this.updateSubmitState();}buildSpinner(){let e=document.createElement("div");return e.dataset.role="sp-popup-spinner",e.style.cssText=`
57
+ `,this.submitLabel=document.createElement("span"),this.submitBtn.appendChild(this.submitLabel),this.submitBtn.addEventListener("click",()=>this.submit()),o.appendChild(this.cancelBtn),o.appendChild(this.submitBtn),this.root.appendChild(this.typeRow),this.root.appendChild(this.textarea),this.root.appendChild(this.hint),this.root.appendChild(o),document.body.appendChild(this.root),this.applyLabels();}colors;t;root;selectedType=null;textarea;submitBtn;cancelBtn;typeRow;submitLabel;hint;resolve=null;previouslyFocused=null;onKeydownTrap=null;onSubmit=null;submittingState=false;spinnerAnimation=null;get isOpen(){return this.resolve!==null}refreshLabels(){this.applyLabels();}applyLabels(){this.root.setAttribute("aria-label",this.t("popup.ariaLabel"));let e=this.root.querySelectorAll("button[data-type]");for(let n of e){let i=n.dataset.type;if(!i)continue;let o=Dn[i];if(!o)continue;let s=n.querySelector("span");s&&chunkBJFC7TVL_cjs.o(s,this.t(o));}this.textarea.placeholder=this.t("popup.placeholder"),this.textarea.setAttribute("aria-label",this.t("popup.textareaAria")),chunkBJFC7TVL_cjs.o(this.hint,On()?this.t("popup.submitHintMac"):this.t("popup.submitHintOther")),chunkBJFC7TVL_cjs.o(this.cancelBtn,this.t("popup.cancel")),chunkBJFC7TVL_cjs.o(this.submitLabel,this.t("popup.submit"));}show(e,n){return new Promise(i=>{this.resolve=i,this.onSubmit=n??null,this.selectedType=null,this.textarea.value="",this.submittingState=false,this.updateSubmitState(),this.resetTypeButtons(),this.previouslyFocused=document.activeElement;let o=220,s=300,r=e.bottom+8,a=e.left;if(r+o>window.innerHeight){let c=e.top-o-8;c>=8?r=c:r=window.innerHeight-o-8;}a+s>window.innerWidth&&(a=e.right-s),a=Math.max(8,a),r=Math.max(8,r),this.root.style.top=`${r}px`,this.root.style.left=`${a}px`,this.root.style.display="block",this.onKeydownTrap=c=>{if(c.key==="Tab"){let p=Array.from(this.root.querySelectorAll('button:not([disabled]), textarea:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])'));if(p.length===0)return;let u=p[0],d=p[p.length-1];if(!u||!d)return;c.shiftKey?(document.activeElement===u||!this.root.contains(document.activeElement))&&(c.preventDefault(),d.focus()):(document.activeElement===d||!this.root.contains(document.activeElement))&&(c.preventDefault(),u.focus());}},this.root.addEventListener("keydown",this.onKeydownTrap);let l=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;this.root.style.transition=l?"none":"",requestAnimationFrame(()=>{this.root.style.opacity="1",this.root.style.transform="translateY(0) scale(1)",this.textarea.focus();});})}selectType(e,n){this.selectedType=e;let i=n.querySelectorAll("button");for(let o of i){let s=o.dataset.type===e,r=chunkBJFC7TVL_cjs.J(o.dataset.type??"",this.colors),a=chunkBJFC7TVL_cjs.M(o.dataset.type??"",this.colors);o.style.background=s?a:this.colors.glassBg,o.style.borderColor=s?r+"60":this.colors.border,o.style.color=s?r:this.colors.textTertiary,o.style.fontWeight=s?"600":"500",o.setAttribute("aria-pressed",String(s));}this.updateSubmitState();}resetTypeButtons(){let e=this.root.querySelectorAll("button[data-type]");for(let n of e)n.setAttribute("aria-pressed","false"),n.disabled=false,n.style.background=this.colors.glassBg,n.style.borderColor=this.colors.border,n.style.color=this.colors.textTertiary,n.style.fontWeight="500",n.style.cursor="pointer";}updateSubmitState(){if(this.submittingState)return;let e=this.selectedType!==null&&this.textarea.value.trim().length>0;this.submitBtn.disabled=!e,this.submitBtn.style.opacity=e?"1":"0.35",this.submitBtn.style.pointerEvents=e?"auto":"none";}submit(){if(this.submittingState||!this.selectedType||!this.textarea.value.trim())return;let e={type:this.selectedType,message:this.textarea.value.trim()};if(!this.onSubmit){this.resolve?.(e),this.resolve=null,this.hideElement();return}this.enterSubmittingState();let n=this.onSubmit;n(e).then(()=>{this.resolve?.(e),this.resolve=null,this.hideElement();}).catch(()=>{this.exitSubmittingState();});}cancel(){this.submittingState||(this.resolve?.(null),this.resolve=null,this.hideElement());}enterSubmittingState(){this.submittingState=true,this.submitLabel.style.display="none",this.submitBtn.disabled=true,this.submitBtn.style.cursor="wait",this.submitBtn.style.opacity="0.85",this.submitBtn.setAttribute("aria-busy","true"),this.submitBtn.appendChild(this.buildSpinner()),this.cancelBtn.disabled=true,this.cancelBtn.style.opacity="0.5",this.cancelBtn.style.cursor="not-allowed",this.cancelBtn.style.pointerEvents="none",this.textarea.disabled=true,this.textarea.style.opacity="0.6";let e=this.typeRow.querySelectorAll("button");for(let n of e)n.disabled=true,n.style.cursor="not-allowed",n.style.opacity="0.6";}exitSubmittingState(){this.submittingState=false,this.spinnerAnimation?.cancel(),this.spinnerAnimation=null,this.submitBtn.querySelector('[data-role="sp-popup-spinner"]')?.remove(),this.submitLabel.style.display="",this.submitBtn.removeAttribute("aria-busy"),this.submitBtn.style.cursor="pointer",this.cancelBtn.disabled=false,this.cancelBtn.style.opacity="1",this.cancelBtn.style.cursor="pointer",this.cancelBtn.style.pointerEvents="auto",this.textarea.disabled=false,this.textarea.style.opacity="1";let n=this.typeRow.querySelectorAll("button");for(let i of n)i.disabled=false,i.style.cursor="pointer",i.style.opacity="1";this.updateSubmitState();}buildSpinner(){let e=document.createElement("div");return e.dataset.role="sp-popup-spinner",e.style.cssText=`
58
58
  width:14px;height:14px;
59
59
  border:2px solid rgba(255,255,255,0.35);
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,zt=false;async function Hn(){if(oe!==void 0)return oe;try{let t=await import('html2canvas');return oe=t.default??t,oe}catch(t){return oe=null,zt||(zt=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 Ue(t,e,n){return Math.min(n,Math.max(t,e))}function xe(t){return Ue(0,Math.round(t*1e4)/1e4,1)}async function jt(t,e){let n=await Hn();if(!n)return null;let i=.85,o=1200,r=Ue(48,t.width*.6,280),s=Ue(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-r),d=Math.max(0,l-s),f=Math.min(c,a+t.width+r)-u,b=Math.min(p,l+t.height+s)-d;if(f<=0||b<=0)return null;let M={xPct:xe((a-u)/f),yPct:xe((l-d)/b),wPct:xe(t.width/f),hPct:xe(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 we=class{constructor(e,n,i,o=false,r){this.colors=e;this.bus=n;this.t=i;this.enableScreenshot=o;this.getFallbackTarget=r;this.popup=new ve(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?jt(e):null}activate(){if(this.isActive)return;this.isActive=true;let e=!this.instantMode;this.preActiveFocusElement=document.activeElement;let n=document.activeElement;if(this.keyboardTarget=n instanceof HTMLElement&&n!==document.body&&n!==document.documentElement&&!qe(n)?n:this.getFallbackTarget?.()??null,this.savedOverflow=document.body.style.overflow,document.body.style.overflow="hidden",this.overlay=chunkNVNA5AI2_cjs.b("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');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=document.activeElement;if(this.keyboardTarget=n instanceof HTMLElement&&n!==document.body&&n!==document.documentElement&&!Ue(n)?n:this.getFallbackTarget?.()??null,this.savedOverflow=document.body.style.overflow,document.body.style.overflow="hidden",this.overlay=chunkBJFC7TVL_cjs.n("div",{style:`
64
64
  position:fixed;inset:0;
65
65
  z-index:${2147483646};
66
66
  background:rgba(15, 23, 42, 0.04);
67
67
  cursor:${e?"crosshair":"default"};
68
- `}),this.overlay.setAttribute("role","application"),this.overlay.setAttribute("aria-label",e?this.t("annotator.instruction"):this.t("annotator.instantInstruction")),this.overlay.setAttribute("data-siteping-ignore","true"),e){this.toolbar=chunkNVNA5AI2_cjs.b("div",{style:`
68
+ `}),this.overlay.setAttribute("role","application"),this.overlay.setAttribute("aria-label",e?this.t("annotator.instruction"):this.t("annotator.instantInstruction")),this.overlay.setAttribute("data-siteping-ignore","true"),e){this.toolbar=chunkBJFC7TVL_cjs.n("div",{style:`
69
69
  position:fixed;top:0;left:0;right:0;
70
70
  z-index:${2147483647};
71
71
  height:52px;
@@ -78,19 +78,19 @@
78
78
  font-size:14px;color:${this.colors.text};
79
79
  box-shadow:0 4px 16px ${this.colors.shadow};
80
80
  -webkit-font-smoothing:antialiased;
81
- `}),this.toolbar.setAttribute("data-siteping-ignore","true");let i=chunkNVNA5AI2_cjs.b("span",{style:`
81
+ `}),this.toolbar.setAttribute("data-siteping-ignore","true");let i=chunkBJFC7TVL_cjs.n("span",{style:`
82
82
  width:8px;height:8px;border-radius:50%;
83
83
  background:${this.colors.accent};
84
84
  box-shadow:0 0 8px ${this.colors.accentGlow};
85
85
  animation:pulse 1.5s ease-in-out infinite;
86
- `}),o=document.createElement("style");o.textContent=["@keyframes pulse{0%,100%{opacity:1}50%{opacity:0.4}}","@media(prefers-reduced-motion:reduce){@keyframes pulse{from,to{opacity:1}}}"].join(""),this.toolbar.appendChild(o);let r=chunkNVNA5AI2_cjs.b("span",{style:"font-weight:500;letter-spacing:-0.01em;"});chunkNVNA5AI2_cjs.c(r,this.t("annotator.instruction"));let s=document.createElement("button");s.style.cssText=`
86
+ `}),o=document.createElement("style");o.textContent=["@keyframes pulse{0%,100%{opacity:1}50%{opacity:0.4}}","@media(prefers-reduced-motion:reduce){@keyframes pulse{from,to{opacity:1}}}"].join(""),this.toolbar.appendChild(o);let s=chunkBJFC7TVL_cjs.n("span",{style:"font-weight:500;letter-spacing:-0.01em;"});chunkBJFC7TVL_cjs.o(s,this.t("annotator.instruction"));let r=document.createElement("button");r.style.cssText=`
87
87
  height:34px;padding:0 18px;border-radius:9999px;
88
88
  border:1px solid ${this.colors.border};
89
89
  background:${this.colors.glassBg};
90
90
  color:${this.colors.textTertiary};font-family:"Inter",system-ui,-apple-system,sans-serif;
91
91
  font-size:13px;font-weight:500;cursor:pointer;
92
92
  transition:all 0.2s ease;
93
- `,chunkNVNA5AI2_cjs.c(s,this.t("annotator.cancel")),s.addEventListener("click",()=>this.deactivate()),s.addEventListener("mouseenter",()=>{s.style.borderColor=this.colors.typeBug,s.style.color=this.colors.typeBug,s.style.background=this.colors.typeBugBg;}),s.addEventListener("mouseleave",()=>{s.style.borderColor=this.colors.border,s.style.color=this.colors.textTertiary,s.style.background=this.colors.glassBg;}),this.toolbar.appendChild(i),this.toolbar.appendChild(r),this.toolbar.appendChild(s);}e&&(this.overlay.addEventListener("mousedown",this.onMouseDown),this.overlay.addEventListener("mousemove",this.onMouseMove),this.overlay.addEventListener("mouseup",this.onMouseUp),this.overlay.addEventListener("touchstart",this.onTouchStart,{passive:false}),this.overlay.addEventListener("touchmove",this.onTouchMove,{passive:false}),this.overlay.addEventListener("touchend",this.onTouchEnd),this.overlay.addEventListener("keydown",this.onOverlayKeyDown)),this.overlay.setAttribute("tabindex","0"),document.addEventListener("keydown",this.onKeyDown),document.body.appendChild(this.overlay),this.toolbar&&document.body.appendChild(this.toolbar),this.overlay.focus({preventScroll:true});}deactivate(){if(!this.isActive)return;this.isActive=false,this.isDrawing=false,this.instantMode=false;let e=this.preActiveFocusElement;this.preActiveFocusElement=null,this.keyboardTarget=null,this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.pendingMoveEvent=null,document.body.style.overflow=this.savedOverflow,document.removeEventListener("keydown",this.onKeyDown),this.overlay?.remove(),this.toolbar?.remove(),this.drawingRect?.remove(),this.overlay=null,this.toolbar=null,this.drawingRect=null,e instanceof HTMLElement&&e.isConnected&&e.focus({preventScroll:true}),this.bus.emit("annotation:end");}onKeyDown=e=>{e.key==="Escape"&&this.deactivate();};onOverlayKeyDown=async e=>{if(e.key!=="Enter"||(e.preventDefault(),this.popup.isOpen)||this.isDrawing)return;let n=this.keyboardTarget;if(!n||!(n instanceof HTMLElement))return;let i=n.getBoundingClientRect();if(i.width<=0||i.height<=0)return;let o=new DOMRect(i.x,i.y,i.width,i.height);this.drawingRect?.remove();let r=this.createDrawingRect();r.style.left=`${i.x}px`,r.style.top=`${i.y}px`,r.style.width=`${i.width}px`,r.style.height=`${i.height}px`,this.drawingRect=r,this.overlay?.appendChild(r);let a={anchor:We(n),rect:{xPct:0,yPct:0,wPct:1,hPct:1},scrollX:window.scrollX,scrollY:window.scrollY,viewportW:window.innerWidth,viewportH:window.innerHeight,devicePixelRatio:window.devicePixelRatio},l={},c=await this.popup.show(o,p=>this.runSubmission(a,p,o,l));this.drawingRect?.remove(),this.drawingRect=null,c&&this.deactivate();};onMouseDown=e=>{this.startDrawing(e.clientX,e.clientY);};onTouchStart=e=>{e.preventDefault();let n=e.touches[0];n&&this.startDrawing(n.clientX,n.clientY);};startDrawing(e,n){this.popup.isOpen||(this.isDrawing=true,this.startX=e,this.startY=n,this.drawingRect?.remove(),this.drawingRect=this.createDrawingRect(),this.overlay?.appendChild(this.drawingRect));}createDrawingRect(){let e=chunkNVNA5AI2_cjs.b("div",{style:`
93
+ `,chunkBJFC7TVL_cjs.o(r,this.t("annotator.cancel")),r.addEventListener("click",()=>this.deactivate()),r.addEventListener("mouseenter",()=>{r.style.borderColor=this.colors.typeBug,r.style.color=this.colors.typeBug,r.style.background=this.colors.typeBugBg;}),r.addEventListener("mouseleave",()=>{r.style.borderColor=this.colors.border,r.style.color=this.colors.textTertiary,r.style.background=this.colors.glassBg;}),this.toolbar.appendChild(i),this.toolbar.appendChild(s),this.toolbar.appendChild(r);}e&&(this.overlay.addEventListener("mousedown",this.onMouseDown),this.overlay.addEventListener("mousemove",this.onMouseMove),this.overlay.addEventListener("mouseup",this.onMouseUp),this.overlay.addEventListener("touchstart",this.onTouchStart,{passive:false}),this.overlay.addEventListener("touchmove",this.onTouchMove,{passive:false}),this.overlay.addEventListener("touchend",this.onTouchEnd),this.overlay.addEventListener("keydown",this.onOverlayKeyDown)),this.overlay.setAttribute("tabindex","0"),document.addEventListener("keydown",this.onKeyDown),document.body.appendChild(this.overlay),this.toolbar&&document.body.appendChild(this.toolbar),this.overlay.focus({preventScroll:true});}deactivate(){if(!this.isActive)return;this.isActive=false,this.isDrawing=false,this.instantMode=false;let e=this.preActiveFocusElement;this.preActiveFocusElement=null,this.keyboardTarget=null,this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.pendingMoveEvent=null,document.body.style.overflow=this.savedOverflow,document.removeEventListener("keydown",this.onKeyDown),this.overlay?.remove(),this.toolbar?.remove(),this.drawingRect?.remove(),this.overlay=null,this.toolbar=null,this.drawingRect=null,e instanceof HTMLElement&&e.isConnected&&e.focus({preventScroll:true}),this.bus.emit("annotation:end");}onKeyDown=e=>{e.key==="Escape"&&this.deactivate();};onOverlayKeyDown=async e=>{if(e.key!=="Enter"||(e.preventDefault(),this.popup.isOpen)||this.isDrawing)return;let n=this.keyboardTarget;if(!n||!(n instanceof HTMLElement))return;let i=n.getBoundingClientRect();if(i.width<=0||i.height<=0)return;let o=new DOMRect(i.x,i.y,i.width,i.height);this.drawingRect?.remove();let s=this.createDrawingRect();s.style.left=`${i.x}px`,s.style.top=`${i.y}px`,s.style.width=`${i.width}px`,s.style.height=`${i.height}px`,this.drawingRect=s,this.overlay?.appendChild(s);let a={anchor:qe(n),rect:{xPct:0,yPct:0,wPct:1,hPct:1},scrollX:window.scrollX,scrollY:window.scrollY,viewportW:window.innerWidth,viewportH:window.innerHeight,devicePixelRatio:window.devicePixelRatio},l={},c=await this.popup.show(o,p=>this.runSubmission(a,p,o,l));this.drawingRect?.remove(),this.drawingRect=null,c&&this.deactivate();};onMouseDown=e=>{this.startDrawing(e.clientX,e.clientY);};onTouchStart=e=>{e.preventDefault();let n=e.touches[0];n&&this.startDrawing(n.clientX,n.clientY);};startDrawing(e,n){this.popup.isOpen||(this.isDrawing=true,this.startX=e,this.startY=n,this.drawingRect?.remove(),this.drawingRect=this.createDrawingRect(),this.overlay?.appendChild(this.drawingRect));}createDrawingRect(){let e=chunkBJFC7TVL_cjs.n("div",{style:`
94
94
  position:fixed;
95
95
  border:2px solid ${this.colors.accent};
96
96
  background:${this.colors.accent}12;
@@ -98,7 +98,7 @@
98
98
  border-radius:8px;
99
99
  box-shadow:0 0 16px ${this.colors.accentGlow};
100
100
  transition:box-shadow 0.15s ease;
101
- `});return e.setAttribute("data-siteping-ignore","true"),e}onMouseMove=e=>{this.scheduleRectUpdate(e);};onTouchMove=e=>{e.preventDefault(),e.touches[0]&&this.scheduleRectUpdate(e.touches[0]);};scheduleRectUpdate(e){!this.isDrawing||!this.drawingRect||(this.pendingMoveEvent=e,this.rafId===null&&(this.rafId=requestAnimationFrame(()=>{this.rafId=null;let n=this.pendingMoveEvent;if(!n||!this.drawingRect)return;let i=Math.min(n.clientX,this.startX),o=Math.min(n.clientY,this.startY),r=Math.abs(n.clientX-this.startX),s=Math.abs(n.clientY-this.startY);this.drawingRect.style.left=`${i}px`,this.drawingRect.style.top=`${o}px`,this.drawingRect.style.width=`${r}px`,this.drawingRect.style.height=`${s}px`;})));}onTouchEnd=async e=>{let n=e.changedTouches[0];n&&await this.finishDrawing(n.clientX,n.clientY);};onMouseUp=async e=>{await this.finishDrawing(e.clientX,e.clientY);};finishDrawing=async(e,n)=>{if(!this.isDrawing||!this.drawingRect)return;this.isDrawing=false;let i=Math.min(e,this.startX),o=Math.min(n,this.startY),r=Math.abs(e-this.startX),s=Math.abs(n-this.startY);if(r<10||s<10){this.drawingRect.remove(),this.drawingRect=null;return}let a=new DOMRect(i,o,r,s),{annotation:l}=this.buildAnnotation(a),c={},p=await this.popup.show(a,u=>this.runSubmission(l,u,a,c));this.drawingRect?.remove(),this.drawingRect=null,p&&this.deactivate();};async startInstantAnnotation(e,n){if(this.isActive)return;this.instantMode=true,this.bus.emit("annotation:start");let i=Math.max(0,Math.min(e-20/2,window.innerWidth-20)),o=Math.max(0,Math.min(n-20/2,window.innerHeight-20)),r=new DOMRect(i,o,20,20),{annotation:s,anchorBounds:a}=this.buildAnnotation(r),l=Math.max(0,a.left),c=Math.max(0,a.top),p=new DOMRect(l,c,Math.max(0,Math.min(a.right,window.innerWidth)-l),Math.max(0,Math.min(a.bottom,window.innerHeight)-c));this.drawingRect?.remove(),this.drawingRect=chunkNVNA5AI2_cjs.b("div",{style:`
101
+ `});return e.setAttribute("data-siteping-ignore","true"),e}onMouseMove=e=>{this.scheduleRectUpdate(e);};onTouchMove=e=>{e.preventDefault(),e.touches[0]&&this.scheduleRectUpdate(e.touches[0]);};scheduleRectUpdate(e){!this.isDrawing||!this.drawingRect||(this.pendingMoveEvent=e,this.rafId===null&&(this.rafId=requestAnimationFrame(()=>{this.rafId=null;let n=this.pendingMoveEvent;if(!n||!this.drawingRect)return;let i=Math.min(n.clientX,this.startX),o=Math.min(n.clientY,this.startY),s=Math.abs(n.clientX-this.startX),r=Math.abs(n.clientY-this.startY);this.drawingRect.style.left=`${i}px`,this.drawingRect.style.top=`${o}px`,this.drawingRect.style.width=`${s}px`,this.drawingRect.style.height=`${r}px`;})));}onTouchEnd=async e=>{let n=e.changedTouches[0];n&&await this.finishDrawing(n.clientX,n.clientY);};onMouseUp=async e=>{await this.finishDrawing(e.clientX,e.clientY);};finishDrawing=async(e,n)=>{if(!this.isDrawing||!this.drawingRect)return;this.isDrawing=false;let i=Math.min(e,this.startX),o=Math.min(n,this.startY),s=Math.abs(e-this.startX),r=Math.abs(n-this.startY);if(s<10||r<10){this.drawingRect.remove(),this.drawingRect=null;return}let a=new DOMRect(i,o,s,r),{annotation:l}=this.buildAnnotation(a),c={},p=await this.popup.show(a,u=>this.runSubmission(l,u,a,c));this.drawingRect?.remove(),this.drawingRect=null,p&&this.deactivate();};async startInstantAnnotation(e,n){if(this.isActive)return;this.instantMode=true,this.bus.emit("annotation:start");let i=Math.max(0,Math.min(e-20/2,window.innerWidth-20)),o=Math.max(0,Math.min(n-20/2,window.innerHeight-20)),s=new DOMRect(i,o,20,20),{annotation:r,anchorBounds:a}=this.buildAnnotation(s),l=Math.max(0,a.left),c=Math.max(0,a.top),p=new DOMRect(l,c,Math.max(0,Math.min(a.right,window.innerWidth)-l),Math.max(0,Math.min(a.bottom,window.innerHeight)-c));this.drawingRect?.remove(),this.drawingRect=chunkBJFC7TVL_cjs.n("div",{style:`
102
102
  position:fixed;
103
103
  left:${i}px;
104
104
  top:${o}px;
@@ -109,8 +109,8 @@
109
109
  pointer-events:none;
110
110
  border-radius:8px;
111
111
  box-shadow:0 0 16px ${this.colors.accentGlow};
112
- `}),this.drawingRect.setAttribute("data-siteping-ignore","true"),this.overlay?.appendChild(this.drawingRect);let u={};await this.popup.show(r,d=>this.runSubmission(s,d,p,u)),this.drawingRect?.remove(),this.drawingRect=null,this.deactivate();}async runSubmission(e,n,i,o){o.value===void 0&&(o.value=await this.maybeCapture(i));let r=o.value;await new Promise((s,a)=>{let l=()=>{c(),p(),u(),this.rejectPendingSubmission=null;},c=this.bus.on("feedback:sent",()=>{l(),s();}),p=this.bus.on("feedback:error",d=>{l(),a(d);}),u=this.bus.on("submission:cancelled",()=>{l(),a(new Error("Feedback submission cancelled"));});this.rejectPendingSubmission=d=>{l(),a(d);},this.bus.emit("annotation:complete",{annotation:e,type:n.type,message:n.message,screenshotDataUrl:r?.dataUrl??null,screenshotRegion:r?.region??null});});}buildAnnotation(e){this.overlay&&(this.overlay.style.pointerEvents="none");let n=Ot(e);this.overlay&&(this.overlay.style.pointerEvents="auto");let i=We(n),o=n.getBoundingClientRect(),r=$t(e,o);return {annotation:{anchor:i,rect:r,scrollX:window.scrollX,scrollY:window.scrollY,viewportW:window.innerWidth,viewportH:window.innerHeight,devicePixelRatio:window.devicePixelRatio},anchorBounds:o}}destroy(){this.deactivate(),this.rejectPendingSubmission?.(new Error("Annotator destroyed during submission")),this.popup.destroy();}};async function G(t,e){let n={};e&&(n["Content-Type"]="application/json"),t.apiKey&&(n.Authorization=`Bearer ${t.apiKey}`);let i=typeof t.headers=="function"?await t.headers():t.headers;return i&&Object.assign(n,i),n}var Dn=3,On=1e4,Ee="siteping_retry_queue",$n=20;async function se(t,e,n=Dn){for(let i=0;i<=n;i++){let o=new AbortController,r=setTimeout(()=>o.abort(),On);try{let l=await fetch(t,{...e,signal:o.signal});if(clearTimeout(r),l.ok||l.status>=400&&l.status<500||i===n)return l}catch(l){if(clearTimeout(r),i===n)throw l}let s=1e3*2**i,a=Math.random()*1e3-500;await new Promise(l=>setTimeout(l,s+a));}throw new Error("Max retries exceeded")}var Bn="siteping_retry_queue";async function Yt(t){return typeof navigator<"u"&&navigator.locks?navigator.locks.request(Bn,()=>t()):t()}function zn(t){return chunkNVNA5AI2_cjs.C(t,"endpoint")&&typeof t.endpoint=="string"&&chunkNVNA5AI2_cjs.C(t,"payload")&&typeof t.payload=="object"&&t.payload!==null}function Wt(){let t=localStorage.getItem(Ee);if(!t)return [];let e=JSON.parse(t);return Array.isArray(e)?e.filter(zn):[]}function jn(t,e){Yt(()=>{try{let n=Wt();n.length>=$n&&n.shift(),n.push({endpoint:t,payload:e}),localStorage.setItem(Ee,JSON.stringify(n));}catch{}});}function Kt(t){return t.trim()}function Xt(t){return t.trim().toLowerCase()}async function qt(t,e,n={}){await Yt(async()=>{try{let i=Wt();if(i.length===0)return;let o=[],r=[],s=0;for(let c of i){if(c.endpoint!==t){r.push(c);continue}!e||Kt(c.payload.authorName)===Kt(e.name)&&Xt(c.payload.authorEmail)===Xt(e.email)?o.push(c):s+=1;}if(o.length===0&&s===0)return;s>0;let a=[];if(o.length>0){let c=await G(n,!0);for(let p of o)try{(await fetch(t,{method:"POST",headers:c,body:JSON.stringify(p.payload)})).ok||a.push(p);}catch{a.push(p);}}let l=r.concat(a);l.length>0?localStorage.setItem(Ee,JSON.stringify(l)):localStorage.removeItem(Ee);}catch{}});}async function Ge(t){return await t.json()}var ke=class{constructor(e,n,i={}){this.endpoint=e;this.projectName=n;this.auth=i;}endpoint;projectName;auth;async sendFeedback(e){let{screenshotRegion:n,...i}=e,o=n?{...i,screenshotRegion:n}:i;try{let r;try{r=await se(this.endpoint,{method:"POST",headers:await G(this.auth,!0),body:JSON.stringify(o)});}catch(s){throw chunkNVNA5AI2_cjs.K(s,"Failed to send feedback")}if(!r.ok)throw await chunkNVNA5AI2_cjs.J(r,"Failed to send feedback");return Ge(r)}catch(r){throw jn(this.endpoint,o),r}}async getFeedbacks(e,n){let i=chunkNVNA5AI2_cjs.I({projectName:e,...n}),o;try{let r=await G(this.auth,!1);o=await se(`${this.endpoint}?${i.toString()}`,{method:"GET",cache:"no-store",...Object.keys(r).length>0?{headers:r}:{}});}catch(r){throw chunkNVNA5AI2_cjs.K(r,"Failed to fetch feedbacks")}if(!o.ok)throw await chunkNVNA5AI2_cjs.J(o,"Failed to fetch feedbacks");return Ge(o)}async resolveFeedback(e,n){let i;try{i=await se(this.endpoint,{method:"PATCH",headers:await G(this.auth,!0),body:JSON.stringify({id:e,projectName:this.projectName,status:n?"resolved":"open"})});}catch(o){throw chunkNVNA5AI2_cjs.K(o,"Failed to update feedback")}if(!i.ok)throw await chunkNVNA5AI2_cjs.J(i,"Failed to update feedback");return Ge(i)}async deleteFeedback(e){let n;try{n=await se(this.endpoint,{method:"DELETE",headers:await G(this.auth,!0),body:JSON.stringify({id:e,projectName:this.projectName})});}catch(i){throw chunkNVNA5AI2_cjs.K(i,"Failed to delete feedback")}if(!n.ok)throw await chunkNVNA5AI2_cjs.J(n,"Failed to delete feedback")}async deleteAllFeedbacks(e){let n;try{n=await se(this.endpoint,{method:"DELETE",headers:await G(this.auth,!0),body:JSON.stringify({projectName:e,deleteAll:!0})});}catch(i){throw chunkNVNA5AI2_cjs.K(i,"Failed to delete all feedbacks")}if(!n.ok)throw await chunkNVNA5AI2_cjs.J(n,"Failed to delete all feedbacks")}};var Kn=["log","info","warn","error"];function Xn(t){if(t===null)return "null";if(t===void 0)return "undefined";if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean"||typeof t=="bigint")return String(t);if(t instanceof Error)return `${t.name}: ${t.message}${t.stack?`
113
- ${t.stack}`:""}`;try{let e=new WeakSet;return JSON.stringify(t,(n,i)=>{if(typeof i=="function")return "[Function]";if(typeof i=="symbol")return i.toString();if(typeof i=="object"&&i!==null){if(e.has(i))return "[Circular]";e.add(i);}return i})}catch{try{return String(t)}catch{return "[Unserializable]"}}}function Yn(t){let e="";for(let n=0;n<t.length&&(n>0&&(e+=" "),e+=Xn(t[n]),!(e.length>=500));n++);return e.length>500&&(e=`${e.slice(0,499)}\u2026`),e}var Se=class{maxEntries;entries=[];originals=new Map;disposed=false;constructor(e=50){if(this.maxEntries=Math.min(Math.max(Math.floor(e),0),1e3),!(typeof console>"u"))for(let n of Kn){let i=console[n];if(typeof i!="function")continue;this.originals.set(n,i);let o=this,r=function(...s){try{o.push(n,s);}catch{}i.apply(this??console,s);};try{Object.defineProperty(r,"name",{value:n});}catch{}console[n]=r;}}push(e,n){this.maxEntries!==0&&(this.entries.length>=this.maxEntries&&this.entries.shift(),this.entries.push({level:e,timestamp:new Date().toISOString(),message:Yn(n)}));}getEntries(){return this.entries.slice()}dispose(){if(!this.disposed&&(this.disposed=true,!(typeof console>"u"))){for(let[e,n]of this.originals)try{console[e]=n;}catch{}this.originals.clear();}}};function Ut(t){return t.length<=2e3?t:`${t.slice(0,1999)}\u2026`}function Gt(t){if(typeof t=="string")return t;if(t instanceof URL)return t.href;if(typeof t=="object"&&t!==null&&"url"in t){let e=t.url;if(typeof e=="string")return e}try{return String(t)}catch{return "(unknown)"}}var Te=class{maxEntries;entries=[];originalFetch=null;originalXhrOpen=null;originalXhrSend=null;disposed=false;constructor(e=20){this.maxEntries=Math.min(Math.max(Math.floor(e),0),500),this.installFetch(),this.installXhr();}push(e){this.maxEntries!==0&&(this.entries.length>=this.maxEntries&&this.entries.shift(),this.entries.push(e));}installFetch(){if(typeof globalThis.fetch!="function")return;let e=globalThis.fetch;this.originalFetch=e;let n=async(i,o)=>{let r=new Date,s=typeof performance<"u"?performance.now():Date.now(),a=Ut(Gt(i)),l=(o?.method??(i instanceof Request?i.method:"GET")).toUpperCase();try{let c=await e(i,o);if(!c.ok){let p=typeof performance<"u"?performance.now():Date.now();this.push({url:a,method:l,status:c.status,durationMs:Math.round(p-s),timestamp:r.toISOString()});}return c}catch(c){let p=typeof performance<"u"?performance.now():Date.now();throw this.push({url:a,method:l,status:0,durationMs:Math.round(p-s),timestamp:r.toISOString()}),c}};globalThis.fetch=n;}installXhr(){if(typeof XMLHttpRequest>"u")return;let e=XMLHttpRequest.prototype,n=e.open,i=e.send;this.originalXhrOpen=n,this.originalXhrSend=i;let o=this,r=new WeakMap;e.open=function(s,a,...l){try{r.set(this,{method:s.toUpperCase(),url:Ut(Gt(a)),startedAt:new Date,t0:typeof performance<"u"?performance.now():Date.now()});}catch{}return n.call(this,s,a,...l)},e.send=function(s){let a=r.get(this);if(a){let l=()=>{try{let c=typeof performance<"u"?performance.now():Date.now(),p=this.status;(p===0||p>=400)&&o.push({url:a.url,method:a.method,status:p,durationMs:Math.round(c-a.t0),timestamp:a.startedAt.toISOString()});}catch{}};try{this.addEventListener("loadend",l,{once:!0});}catch{try{this.addEventListener("loadend",l);}catch{}}}return i.call(this,s??null)};}getEntries(){return this.entries.slice()}dispose(){if(!this.disposed){if(this.disposed=true,this.originalFetch&&typeof globalThis.fetch=="function")try{globalThis.fetch=this.originalFetch;}catch{}if(typeof XMLHttpRequest<"u")try{this.originalXhrOpen&&(XMLHttpRequest.prototype.open=this.originalXhrOpen),this.originalXhrSend&&(XMLHttpRequest.prototype.send=this.originalXhrSend);}catch{}}}};var re=class{listeners=new Map;on(e,n){let i=this.listeners.get(e);return i||(i=new Set,this.listeners.set(e,i)),i.add(n),()=>{i?.delete(n);}}off(e,n){this.listeners.get(e)?.delete(n);}emit(e,...n){let i=this.listeners.get(e);if(i)for(let o of i)try{o(...n);}catch(r){console.error(`[siteping] Error in event listener for "${String(e)}":`,r);}}removeAll(){this.listeners.clear();}};var Wn=54,qn={chat:"fab.messages",annotate:"fab.annotate","toggle-annotations":"fab.annotations"},Ce=class{constructor(e,n,i,o){this.bus=i;this.t=o;let r=n.position??"bottom-right",s=r==="bottom-right";this.items=[{id:"chat",icon:chunkNVNA5AI2_cjs.u},{id:"annotate",icon:chunkNVNA5AI2_cjs.v}],n.showAnnotationsToggle!==false&&this.items.push({id:"toggle-annotations",icon:chunkNVNA5AI2_cjs.g,iconAlt:chunkNVNA5AI2_cjs.h}),this.fab=document.createElement("button"),this.fab.className=`sp-fab sp-fab--${r} sp-anim-fab-in`,this.fab.style.position="fixed",this.fab.appendChild(chunkNVNA5AI2_cjs.a(chunkNVNA5AI2_cjs.f)),this.fab.setAttribute("aria-expanded","false"),this.fab.addEventListener("click",()=>this.toggle()),this.radialContainer=document.createElement("div"),this.radialContainer.className=`sp-radial sp-radial--${r}`,this.radialContainer.setAttribute("role","menu");for(let c=0;c<this.items.length;c++){let p=this.items[c];if(!p)continue;let u=document.createElement("button");u.className="sp-radial-item",u.style.setProperty("--sp-i",String(c)),u.appendChild(chunkNVNA5AI2_cjs.a(p.icon)),u.setAttribute("role","menuitem"),u.dataset.itemId=p.id,u.addEventListener("click",f=>{f.stopPropagation(),this.handleItemClick(p.id);});let d=document.createElement("span");d.className="sp-radial-label",d.style.cssText=s?"position:absolute; right:54px; top:50%; transform:translateY(-50%); white-space:nowrap;":"position:absolute; left:54px; top:50%; transform:translateY(-50%); white-space:nowrap;",u.appendChild(d),this.radialContainer.appendChild(u);}this.root=document.createElement("div"),this.root.appendChild(this.radialContainer),this.root.appendChild(this.fab),e.appendChild(this.root),this.applyLabels();let a=e.host;this.onDocumentClick=c=>{this.isOpen&&!c.composedPath().includes(a)&&this.close();},document.addEventListener("click",this.onDocumentClick);let l=c=>{c.key==="Escape"&&this.isOpen&&(c.stopPropagation(),this.close());};this.fab.addEventListener("keydown",l),this.radialContainer.addEventListener("keydown",l),this.radialContainer.addEventListener("keydown",c=>{let p=Array.from(this.radialContainer.querySelectorAll(".sp-radial-item"));if(p.length===0||!this.isOpen)return;let u=e.activeElement??document.activeElement,d=p.indexOf(u);switch(c.key){case "ArrowUp":{c.preventDefault();let f=d<=0?p.length-1:d-1;p[f]?.focus();break}case "ArrowDown":{c.preventDefault();let f=d>=p.length-1?0:d+1;p[f]?.focus();break}case "Home":{c.preventDefault(),p[0]?.focus();break}case "End":{c.preventDefault(),p[p.length-1]?.focus();break}}});}bus;t;root;fab;radialContainer;badgeEl=null;isOpen=false;annotationsVisible=true;items;onDocumentClick;refreshLabels(){this.applyLabels();}applyLabels(){this.fab.setAttribute("aria-label",this.t("fab.aria"));let e=this.radialContainer.querySelectorAll(".sp-radial-item");for(let n of e){let i=n.dataset.itemId;if(!i)continue;let o=qn[i];if(!o)continue;let r=this.t(o);n.setAttribute("aria-label",r);let s=n.querySelector(".sp-radial-label");s&&chunkNVNA5AI2_cjs.c(s,r);}}updateBadge(e){if(e<=0){this.badgeEl?.remove(),this.badgeEl=null;return}this.badgeEl||(this.badgeEl=document.createElement("span"),this.badgeEl.className="sp-fab-badge",this.badgeEl.setAttribute("role","status"),this.badgeEl.setAttribute("aria-live","polite"),this.fab.appendChild(this.badgeEl));let n=e>99?"99+":String(e);chunkNVNA5AI2_cjs.c(this.badgeEl,n),this.badgeEl.setAttribute("aria-label",chunkNVNA5AI2_cjs.O(this.t,"fab.badge",{count:e}));}toggle(){this.isOpen?this.close():this.open();}open(){this.isOpen=true,this.setFabIcon(chunkNVNA5AI2_cjs.i),this.fab.setAttribute("aria-expanded","true"),this.radialContainer.querySelectorAll(".sp-radial-item").forEach((n,i)=>{let o=-(16+Wn*(i+1));n.style.transform=`translate(0px, ${o}px) scale(1)`,n.classList.add("sp-radial-item--open");}),requestAnimationFrame(()=>{this.radialContainer.querySelector(".sp-radial-item")?.focus();});}close(){this.isOpen=false,this.setFabIcon(chunkNVNA5AI2_cjs.f),this.fab.setAttribute("aria-expanded","false"),this.radialContainer.querySelectorAll(".sp-radial-item").forEach(n=>{n.style.transform="translate(0, 0) scale(0.8)",n.classList.remove("sp-radial-item--open");}),this.fab.focus();}setFabIcon(e){let n=this.badgeEl;this.fab.replaceChildren(chunkNVNA5AI2_cjs.a(e)),n&&this.fab.appendChild(n);}handleItemClick(e){switch(this.close(),e){case "chat":this.bus.emit("panel:toggle",true);break;case "annotate":{let n=this.bus.on("annotation:end",()=>{n(),this.fab.focus();});this.bus.emit("annotation:start");break}case "toggle-annotations":{this.annotationsVisible=!this.annotationsVisible,this.bus.emit("annotations:toggle",this.annotationsVisible);let i=this.radialContainer.querySelector('[data-item-id="toggle-annotations"]')?.querySelector("svg");if(i){let o=chunkNVNA5AI2_cjs.a(this.annotationsVisible?chunkNVNA5AI2_cjs.g:chunkNVNA5AI2_cjs.h);i.replaceWith(o);}break}}}destroy(){document.removeEventListener("click",this.onDocumentClick),this.root.remove();}};var Vt="siteping_identity";function Un(t){if(!chunkNVNA5AI2_cjs.C(t,"name")||!chunkNVNA5AI2_cjs.C(t,"email"))return false;let{name:e,email:n}=t;return typeof e=="string"&&typeof n=="string"&&e.length>0&&n.length>0}function Ve(){try{let t=localStorage.getItem(Vt);if(!t)return null;let e=JSON.parse(t);return Un(e)?e:null}catch{return null}}function Zt(t){try{localStorage.setItem(Vt,JSON.stringify(t));}catch{}}function V(t){return t.normalize("NFC").replace(/\s+/g," ").trim()}function Jt(t){return t.replace(/\s+/g," ").trim()}function Gn(t,e){if(t===e)return 0;if(t.length===0)return e.length;if(e.length===0)return t.length;if(t.length>e.length){let s=t;t=e,e=s;}let n=t.length,i=e.length,o=new Array(n+1);for(let s=0;s<=n;s++)o[s]=s;let r=new Array(n+1);for(let s=1;s<=i;s++){r[0]=s;for(let l=1;l<=n;l++){let c=o[l-1];r[l]=t[l-1]===e[s-1]?c:1+Math.min(c,o[l],r[l-1]);}let a=o;o=r,r=a;}return o[n]}function ae(t,e){if(t===e)return 1;let n=Math.max(t.length,e.length);return n===0?1:1-Gn(t,e)/n}function Vn(t,e){let n=e.length,i=new Int32Array(n+1),o=new Int32Array(n+1);for(let s=0;s<=n;s++)i[s]=s;let r=n;for(let s=1;s<=t.length;s++){o[0]=0;let a=t.charCodeAt(s-1);for(let p=1;p<=n;p++){let u=i[p-1]+(e.charCodeAt(p-1)===a?0:1),d=i[p]+1,f=o[p-1]+1;o[p]=Math.min(u,d,f);}let l=o[n];l<r&&(r=l);let c=i;i=o,o=c;}return r}function Qt(t,e,n=.6){if(!e||!t)return 0;if(t.includes(e))return 1;let i=t.length>500?t.slice(0,500):t;if(e.length>i.length){let r=ae(i,e);return r>=n?r:0}if(e.length<8&&i.length>64)return 0;let o=1-Vn(i,e)/e.length;return o>=n?o:0}function en(t){let e=new Map;for(let n=0;n<t.length-1;n++){let i=t.charCodeAt(n)<<16|t.charCodeAt(n+1);e.set(i,(e.get(i)??0)+1);}return e}function tn(t,e,n){let i=n.length-1;if(e<=0||i<=0)return 0;let o=0,r=new Map;for(let s=0;s<n.length-1;s++){let a=n.charCodeAt(s)<<16|n.charCodeAt(s+1),l=t.get(a);if(l===void 0)continue;let c=r.get(a)??0;c<l&&(r.set(a,c+1),o++);}return 2*o/(e+i)}function nn(t){let e=new Map,n=t.split(" ");for(let i=0;i<n.length-1;i++){let o=`${n[i]} ${n[i+1]}`;e.set(o,(e.get(o)??0)+1);}return e}function on(t,e,n){if(e<=0)return 0;let i=n.split(" "),o=i.length-1;if(o<=0)return 0;let r=0,s=new Map;for(let a=0;a<i.length-1;a++){let l=`${i[a]} ${i[a+1]}`,c=t.get(l);if(c===void 0)continue;let p=s.get(l)??0;p<c&&(s.set(l,p+1),r++);}return 2*r/(e+o)}var Zn={checkOpacity:true,opacityProperty:true,checkVisibilityCSS:true,visibilityProperty:true};function le(t){if(!t.isConnected)return "hidden";if(typeof t.checkVisibility=="function")return t.checkVisibility(Zn)?"visible":t.checkVisibility()?"soft-hidden":"hidden";if(t.getClientRects().length>0)try{return getComputedStyle(t).visibility==="visible"?"visible":"soft-hidden"}catch{return "visible"}let e=t.firstElementChild;return e&&e.getClientRects().length>0?"visible":t.ownerDocument.documentElement.getClientRects().length===0?"unknown":"hidden"}function sn(t){switch(t){case "hidden":return .3;case "soft-hidden":return .6;default:return 1}}var Z={anchorKey:1,id:1,css:.95,xpath:.9,scan:.85},Ae=16,Jn=24,Qn=1e4,et=500,ei=.5,Ze=.6,ti=.4,ni=2e3,Qe=.8,Je=.6,ii=.05;function Re(t,e){return V((t??"").slice(0,ni)).slice(0,e)}function oi(t){let e=Re(t.textSnippet,et),n=nn(e),i=0;for(let o of n.values())i+=o;return {snippet:e,snippetBigrams:en(e),snippetBigramTotal:Math.max(0,e.length-1),snippetWordPairs:n,snippetWordPairTotal:i,prefix:Re(t.textPrefix,128),suffix:Re(t.textSuffix,128),neighbor:Re(t.neighborText,128),fingerprint:(t.fingerprint??"").slice(0,64),tag:typeof t.elementTag=="string"?t.elementTag:""}}function si(t,e){let n=oi(t),i=ri(t),o=[];for(let[u,d]of i){let f=rn(u,d,n);f&&o.push(f);}let r=0,s=false;for(let u of o)u.final>r&&(r=u.final),(u.strategy==="id"||u.strategy==="anchorKey")&&u.visibility===1&&(u.signals?.text??0)>=Qe&&(u.signals?.fingerprint===void 0||u.signals.fingerprint>=Qe)&&(s=true);let a=!!(n.snippet||n.fingerprint||n.prefix||n.suffix||n.neighbor),l=e?.scanBudget;if(a&&r<Z.scan&&!s)if(l&&l.remaining<=0)l.starved=true;else {l&&l.remaining--;for(let u of ai(n,i)){let d=rn(u,"scan",n);d&&o.push(d);}}let c=o.filter(li);if(c.length===0)return null;c.sort((u,d)=>d.final-u.final);let p=pi(c);return {element:p.element,confidence:di(p),strategy:p.strategy}}function ri(t){let e=new Map,n=(i,o,r)=>{!i||e.has(i)||r&&i.tagName!==t.elementTag||e.set(i,o);};if(t.anchorKey){let i=t.anchorKey.replace(/\\/g,"\\\\").replace(/"/g,'\\"');try{let o=document.querySelectorAll(`[${ie}="${i}"]`);for(let r=0;r<Math.min(o.length,Ae);r++)n(o[r]??null,"anchorKey",!1);}catch{}}if(t.elementId){let i=t.elementId.replace(/\\/g,"\\\\").replace(/"/g,'\\"');try{let o=document.querySelectorAll(`[id="${i}"]`);for(let r=0;r<Math.min(o.length,Ae);r++)n(o[r]??null,"id",!0);}catch{n(document.getElementById(t.elementId),"id",true);}}try{let i=document.querySelectorAll(t.cssSelector);for(let o=0;o<Math.min(i.length,Ae);o++)n(i[o]??null,"css",!0);}catch{}try{let i=document.evaluate(t.xpath,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null),o=Math.min(i.snapshotLength,Ae);for(let r=0;r<o;r++){let s=i.snapshotItem(r);s instanceof Element&&n(s,"xpath",!0);}}catch{}return e}function ai(t,e){let n=t.tag.toLowerCase();if(!n)return [];let i;try{i=document.querySelectorAll(n);}catch{return []}let o=t.fingerprint.split(":"),r=o.length===3?Number(o[0]):Number.NaN,s=o.length===3?o[2]??"":"",a=Math.min(i.length,Qn),l=[];for(let c=0;c<a;c++){let p=i[c];if(!p||e.has(p))continue;let u=0;if(t.snippetBigramTotal>0){let d=Jt(q(p,et)),f=tn(t.snippetBigrams,t.snippetBigramTotal,d);if(t.snippetWordPairTotal>0){let b=f>0?on(t.snippetWordPairs,t.snippetWordPairTotal,d):0;u+=.6*(.5*f+.5*b);}else u+=.6*f;}if(s&&Ye(p)===s&&(u+=.25),!Number.isNaN(r)){let d=Math.abs(p.children.length-r);d===0?u+=.15:d<=2&&(u+=.07);}l.push({element:p,cheap:u});}return l.sort((c,p)=>p.cheap-c.cheap),l.slice(0,Jn).map(c=>c.element)}function rn(t,e,n){let i=ci(t,n),o=sn(le(t));return i===null?e==="scan"?null:{element:t,strategy:e,verification:Je,strongest:Je,visibility:o,final:Z[e]*Je*o,unverified:true}:{element:t,strategy:e,verification:i.blend,strongest:i.strongest,signals:i,visibility:o,final:Z[e]*i.blend*o}}function li(t){if(t.strategy==="scan")return t.verification>=ti;if(t.unverified||!t.signals)return true;let e=t.signals;return e.text===void 0||e.text>=ei?true:(e.fingerprint??0)>=Ze||(e.context??0)>=Ze||(e.neighbor??0)>=Ze}function ci(t,e){let n=0,i=0,o={blend:0,strongest:0};if(e.snippet){i+=40;let r=V(q(t,et));o.text=Qt(r,e.snippet,.5),n+=o.text*40;}if(e.fingerprint&&(i+=20,o.fingerprint=Nt(t,e.fingerprint),n+=o.fingerprint*20),e.prefix||e.suffix){i+=20;let r=0,s=0;if(e.prefix){let a=V(U(t,"before"));r+=a?ae(a,e.prefix):0,s++;}if(e.suffix){let a=V(U(t,"after"));r+=a?ae(a,e.suffix):0,s++;}s>0&&(o.context=r/s,n+=o.context*20);}if(e.neighbor){i+=20;let r=V(ye(t));o.neighbor=r?ae(r,e.neighbor):0,n+=o.neighbor*20;}return i===0?null:(o.blend=n/i,o.strongest=Math.max(o.text??0,o.fingerprint??0,o.context??0,o.neighbor??0),o)}function pi(t){let e=t[0],n=t.filter(o=>e.final-o.final<=ii&&(o===e||e.element.contains(o.element))),i=e;for(let o of n)o!==i&&i.element.contains(o.element)&&(i=o);return i}function di(t){return t.strategy==="scan"?Math.min(t.verification,Z.scan):t.unverified?Z[t.strategy]:Z[t.strategy]*Math.min(1,t.strongest/Qe)}function Me(t,e,n){let i=si(t,n);if(!i)return null;let o=i.element.getBoundingClientRect(),r=new DOMRect(o.x+e.xPct*o.width,o.y+e.yPct*o.height,e.wPct*o.width,e.hPct*o.height);return {element:i.element,rect:r,confidence:i.confidence,strategy:i.strategy}}function tt(t){return {cssSelector:t.cssSelector,xpath:t.xpath,textSnippet:t.textSnippet,elementTag:t.elementTag,elementId:t.elementId??void 0,textPrefix:t.textPrefix,textSuffix:t.textSuffix,fingerprint:t.fingerprint,neighborText:t.neighborText,anchorKey:t.anchorKey??null}}function Le(t){return {xPct:t.xPct,yPct:t.yPct,wPct:t.wPct,hPct:t.hPct}}var an=13;function ln(t){return {top:t.top+window.scrollY-an,left:t.right+window.scrollX-an}}function ce(t,e){let n=t.entries[e],i=t.elementIndices[e];if(!(!n||i===void 0))return n.elements[i]}var cn=300,pn=200,ui=3e3,hi=.7,fi=28,dn=32,Pe=class{constructor(e,n,i,o,r=null){this.colors=e;this.tooltip=n;this.bus=i;this.t=o;this.liveRegion=r;this.container=chunkNVNA5AI2_cjs.b("div",{style:`position:absolute;top:0;left:0;pointer-events:none;z-index:${2147483646};`}),this.container.id="siteping-markers",document.body.appendChild(this.container),this.bus.on("annotations:toggle",s=>{this.container.style.display=s?"block":"none";}),this.resizeHandler=()=>this.scheduleReposition("resize"),window.addEventListener("resize",this.resizeHandler,{passive:true}),this.scrollHandler=()=>this.scheduleReposition("scroll"),window.addEventListener("scroll",this.scrollHandler,{passive:true,capture:true}),this.mutationObserver=new MutationObserver(s=>{let a=false;for(let l of s)if(!(this.container.contains(l.target)||this.tooltip.contains(l.target))){a=true;break}a&&this.scheduleReposition("mutation");}),this.mutationObserver.observe(document.body,{childList:true,subtree:true,attributes:false,characterData:false}),this.onDocumentClickForClusters=s=>{this.container.contains(s.target)||this.collapseAllClusters();},document.addEventListener("click",this.onDocumentClickForClusters);}colors;tooltip;bus;t;liveRegion;container;entries=[];highlightElements=[];pinnedFeedback=null;onDocumentClick=null;repositionTimer=null;mutationObserver=null;scrollHandler=null;resizeHandler=null;anchorCache=new Map;pendingLayoutChange=false;pendingResize=false;hiddenRecheckAt=new Map;clusters=[];onDocumentClickForClusters=null;lastOpenCount=-1;get count(){return this.entries.length}get openCount(){let e=0;for(let n of this.entries)chunkNVNA5AI2_cjs.F(n.feedback.status)||e++;return e}scheduleReposition(e="mutation"){e!=="scroll"&&(this.pendingLayoutChange=true),e==="resize"&&(this.pendingResize=true),!this.repositionTimer&&("requestIdleCallback"in window?this.repositionTimer=window.requestIdleCallback(()=>{this.repositionTimer=null,this.repositionAll();},{timeout:pn+100}):this.repositionTimer=+setTimeout(()=>{this.repositionTimer=null,this.repositionAll();},pn));}repositionAll(){let e=this.pendingLayoutChange,n=this.pendingResize;this.pendingLayoutChange=false,this.pendingResize=false,n&&this.hiddenRecheckAt.clear();let i=Date.now(),o={remaining:2,starved:false},r=new Set;for(let s of this.entries)for(let a=0;a<s.feedback.annotations.length;a++){let l=s.elements[a];if(!l)continue;let c=s.feedback.annotations[a];if(!c)continue;let p=`${s.feedback.id}:${a}`;r.add(p);let d=this.anchorCache.get(p)?.deref(),f,b=(this.hiddenRecheckAt.get(p)??0)>i,M=d?.isConnected&&(b||!(e&&le(d)==="hidden"));if(d&&M){let C=d.getBoundingClientRect(),w=Le(c);f={element:d,rect:new DOMRect(C.left+w.xPct*C.width,C.top+w.yPct*C.height,w.wPct*C.width,w.hPct*C.height),confidence:1,strategy:"css"};}else b?f=null:(o.starved=false,f=Me(tt(c),Le(c),{scanBudget:o}),o.starved||(f?.element&&this.anchorCache.set(p,new WeakRef(f.element)),!f||le(f.element)==="hidden"?this.hiddenRecheckAt.set(p,i+ui):this.hiddenRecheckAt.delete(p)));if(!f){l.style.display="none";continue}let y=ln(f.rect);s.baseTop=y.top,s.baseLeft=y.left,l.style.display="flex",this.applyConfidenceStyle(l,f.confidence,s.feedback);}for(let s of this.anchorCache.keys())r.has(s)||this.anchorCache.delete(s);for(let s of this.hiddenRecheckAt.keys())r.has(s)||this.hiddenRecheckAt.delete(s);this.applyClusterPositions(),this.pinnedFeedback&&this.showHighlight(this.pinnedFeedback);}applyClusterPositions(){for(let e of this.clusters)e.expanded?this.applyFanPositions(e):this.applyStackPositions(e);}emitMarkersChanged(){let e=this.openCount;e!==this.lastOpenCount&&(this.lastOpenCount=e,this.bus.emit("markers:changed",e));}render(e){this.clear(),e.forEach((n,i)=>{let o=this.buildEntry(n,i+1);this.entries.push(o);}),this.buildClusters(),this.liveRegion&&this.entries.length>0&&(this.liveRegion.textContent=chunkNVNA5AI2_cjs.O(this.t,"marker.count",{count:this.entries.length})),this.emitMarkersChanged();}addFeedback(e,n){let i=this.buildEntry(e,n);for(let o of i.elements)o.style.animation="sp-marker-in 0.35s cubic-bezier(0.34,1.56,0.64,1) both";this.entries.push(i),this.buildClusters(),this.emitMarkersChanged();}buildEntry(e,n){let i={feedback:e,elements:[],baseTop:0,baseLeft:0};for(let o of e.annotations){let r=Me(tt(o),Le(o));if(!r)continue;let s=ln(r.rect);i.baseTop=s.top,i.baseLeft=s.left;let a=this.createMarker(n,e,s);this.applyConfidenceStyle(a,r.confidence,e),this.container.appendChild(a),i.elements.push(a);}return i}buildClusters(){for(let i of this.container.querySelectorAll(".sp-cluster-badge"))i.remove();let e=[];for(let i of this.entries)for(let o=0;o<i.elements.length;o++)e.push({entry:i,elIdx:o});let n=new Set;this.clusters=[];for(let i=0;i<e.length;i++){if(n.has(i))continue;let o=e[i];if(!o)continue;let r={entries:[o.entry],elementIndices:[o.elIdx],expanded:false};n.add(i);for(let s=i+1;s<e.length;s++){if(n.has(s))continue;let a=o.entry,l=e[s];if(!l)continue;let c=l.entry;Math.sqrt((a.baseLeft-c.baseLeft)**2+(a.baseTop-c.baseTop)**2)<fi&&(r.entries.push(c),r.elementIndices.push(l.elIdx),n.add(s));}this.clusters.push(r);}for(let i of this.clusters)i.entries.length<=1||(this.applyStackPositions(i),this.addClusterBadge(i));}applyStackPositions(e){let n=e.entries[0];if(!n)return;let{baseTop:i,baseLeft:o}=n,r=e.entries.length<=1;for(let s=0;s<e.entries.length;s++){let a=ce(e,s);a&&(a.style.top=`${i+(r?0:s*3)}px`,a.style.left=`${o+(r?0:s*3)}px`,a.style.zIndex=String(s+1));}}applyFanPositions(e){let n=e.entries[0];if(!n)return;let{baseTop:i,baseLeft:o}=n,r=e.entries.length,s=(r-1)*dn,a=o-s/2;for(let l=0;l<r;l++){let c=ce(e,l);c&&(c.style.top=`${i}px`,c.style.left=`${a+l*dn}px`,c.style.zIndex=String(10+l));}}addClusterBadge(e){let n=ce(e,e.entries.length-1);if(!n)return;let i=chunkNVNA5AI2_cjs.b("div",{class:"sp-cluster-badge",style:`
112
+ `}),this.drawingRect.setAttribute("data-siteping-ignore","true"),this.overlay?.appendChild(this.drawingRect);let u={};await this.popup.show(s,d=>this.runSubmission(r,d,p,u)),this.drawingRect?.remove(),this.drawingRect=null,this.deactivate();}async runSubmission(e,n,i,o){o.value===void 0&&(o.value=await this.maybeCapture(i));let s=o.value;await new Promise((r,a)=>{let l=()=>{c(),p(),u(),this.rejectPendingSubmission=null;},c=this.bus.on("feedback:sent",()=>{l(),r();}),p=this.bus.on("feedback:error",d=>{l(),a(d);}),u=this.bus.on("submission:cancelled",()=>{l(),a(new Error("Feedback submission cancelled"));});this.rejectPendingSubmission=d=>{l(),a(d);},this.bus.emit("annotation:complete",{annotation:e,type:n.type,message:n.message,screenshotDataUrl:s?.dataUrl??null,screenshotRegion:s?.region??null});});}buildAnnotation(e){this.overlay&&(this.overlay.style.pointerEvents="none");let n=zt(e);this.overlay&&(this.overlay.style.pointerEvents="auto");let i=qe(n),o=n.getBoundingClientRect(),s=jt(e,o);return {annotation:{anchor:i,rect:s,scrollX:window.scrollX,scrollY:window.scrollY,viewportW:window.innerWidth,viewportH:window.innerHeight,devicePixelRatio:window.devicePixelRatio},anchorBounds:o}}destroy(){this.deactivate(),this.rejectPendingSubmission?.(new Error("Annotator destroyed during submission")),this.popup.destroy();}};async function G(t,e){let n={};e&&(n["Content-Type"]="application/json"),t.apiKey&&(n.Authorization=`Bearer ${t.apiKey}`);let i=typeof t.headers=="function"?await t.headers():t.headers;return i&&Object.assign(n,i),n}var Bn=3,zn=1e4,ke="siteping_retry_queue",jn=20;async function se(t,e,n=Bn){for(let i=0;i<=n;i++){let o=new AbortController,s=setTimeout(()=>o.abort(),zn);try{let l=await fetch(t,{...e,signal:o.signal});if(clearTimeout(s),l.ok||l.status>=400&&l.status<500||i===n)return l}catch(l){if(clearTimeout(s),i===n)throw l}let r=1e3*2**i,a=Math.random()*1e3-500;await new Promise(l=>setTimeout(l,r+a));}throw new Error("Max retries exceeded")}function Xn(t){return t instanceof chunkBJFC7TVL_cjs.c||t instanceof chunkBJFC7TVL_cjs.b&&t.code==="SERVER"}function Kn(t){return t>=500}var Yn="siteping_retry_queue";async function Ut(t){return typeof navigator<"u"&&navigator.locks?navigator.locks.request(Yn,()=>t()):t()}function Wn(t){return chunkBJFC7TVL_cjs.d(t,"endpoint")&&typeof t.endpoint=="string"&&chunkBJFC7TVL_cjs.d(t,"payload")&&typeof t.payload=="object"&&t.payload!==null}function Gt(){let t=localStorage.getItem(ke);if(!t)return [];let e=JSON.parse(t);return Array.isArray(e)?e.filter(Wn):[]}function qn(t,e){Ut(()=>{try{let n=Gt();n.length>=jn&&n.shift(),n.push({endpoint:t,payload:e}),localStorage.setItem(ke,JSON.stringify(n));}catch{}});}function Wt(t){return t.trim()}function qt(t){return t.trim().toLowerCase()}async function Vt(t,e,n={}){await Ut(async()=>{try{let i=Gt();if(i.length===0)return;let o=[],s=[],r=0;for(let p of i){if(p.endpoint!==t){s.push(p);continue}!e||Wt(p.payload.authorName)===Wt(e.name)&&qt(p.payload.authorEmail)===qt(e.email)?o.push(p):r+=1;}if(o.length===0&&r===0)return;r>0;let a=[],l=0;if(o.length>0){let p=await G(n,!0);for(let u of o)try{let d=await fetch(t,{method:"POST",headers:p,body:JSON.stringify(u.payload)});if(d.ok)continue;Kn(d.status)?a.push(u):l+=1;}catch{a.push(u);}}l>0&&console.warn(`[siteping] flushRetryQueue: dropped ${l} queued feedback(s) the server rejected (4xx) \u2014 they would fail identically on every replay`);let c=s.concat(a);c.length>0?localStorage.setItem(ke,JSON.stringify(c)):localStorage.removeItem(ke);}catch{}});}async function Ve(t){return await t.json()}var Se=class{constructor(e,n,i={}){this.endpoint=e;this.projectName=n;this.auth=i;}endpoint;projectName;auth;async sendFeedback(e){let{screenshotRegion:n,...i}=e,o=n?{...i,screenshotRegion:n}:i;try{let s;try{s=await se(this.endpoint,{method:"POST",headers:await G(this.auth,!0),body:JSON.stringify(o)});}catch(r){throw chunkBJFC7TVL_cjs.l(r,"Failed to send feedback")}if(!s.ok)throw await chunkBJFC7TVL_cjs.k(s,"Failed to send feedback");return Ve(s)}catch(s){throw Xn(s)&&qn(this.endpoint,o),s}}async getFeedbacks(e,n){let i=chunkBJFC7TVL_cjs.j({projectName:e,...n}),o;try{let s=await G(this.auth,!1);o=await se(`${this.endpoint}?${i.toString()}`,{method:"GET",cache:"no-store",...Object.keys(s).length>0?{headers:s}:{}});}catch(s){throw chunkBJFC7TVL_cjs.l(s,"Failed to fetch feedbacks")}if(!o.ok)throw await chunkBJFC7TVL_cjs.k(o,"Failed to fetch feedbacks");return Ve(o)}async resolveFeedback(e,n){let i;try{i=await se(this.endpoint,{method:"PATCH",headers:await G(this.auth,!0),body:JSON.stringify({id:e,projectName:this.projectName,status:n?"resolved":"open"})});}catch(o){throw chunkBJFC7TVL_cjs.l(o,"Failed to update feedback")}if(!i.ok)throw await chunkBJFC7TVL_cjs.k(i,"Failed to update feedback");return Ve(i)}async deleteFeedback(e){let n;try{n=await se(this.endpoint,{method:"DELETE",headers:await G(this.auth,!0),body:JSON.stringify({id:e,projectName:this.projectName})});}catch(i){throw chunkBJFC7TVL_cjs.l(i,"Failed to delete feedback")}if(!n.ok)throw await chunkBJFC7TVL_cjs.k(n,"Failed to delete feedback")}async deleteAllFeedbacks(e){let n;try{n=await se(this.endpoint,{method:"DELETE",headers:await G(this.auth,!0),body:JSON.stringify({projectName:e,deleteAll:!0})});}catch(i){throw chunkBJFC7TVL_cjs.l(i,"Failed to delete all feedbacks")}if(!n.ok)throw await chunkBJFC7TVL_cjs.k(n,"Failed to delete all feedbacks")}};var Un=["log","info","warn","error"];function Gn(t){if(t===null)return "null";if(t===void 0)return "undefined";if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean"||typeof t=="bigint")return String(t);if(t instanceof Error)return `${t.name}: ${t.message}${t.stack?`
113
+ ${t.stack}`:""}`;try{let e=new WeakSet;return JSON.stringify(t,(n,i)=>{if(typeof i=="function")return "[Function]";if(typeof i=="symbol")return i.toString();if(typeof i=="object"&&i!==null){if(e.has(i))return "[Circular]";e.add(i);}return i})}catch{try{return String(t)}catch{return "[Unserializable]"}}}function Vn(t){let e="";for(let n=0;n<t.length&&(n>0&&(e+=" "),e+=Gn(t[n]),!(e.length>=500));n++);return e.length>500&&(e=`${e.slice(0,499)}\u2026`),e}var Te=class{maxEntries;entries=[];originals=new Map;wrappers=new Map;disposed=false;constructor(e=50){if(this.maxEntries=Math.min(Math.max(Math.floor(e),0),1e3),!(typeof console>"u"))for(let n of Un){let i=console[n];if(typeof i!="function")continue;this.originals.set(n,i);let o=this,s=function(...r){try{o.push(n,r);}catch{}i.apply(this??console,r);};try{Object.defineProperty(s,"name",{value:n});}catch{}this.wrappers.set(n,s),console[n]=s;}}push(e,n){this.maxEntries!==0&&(this.entries.length>=this.maxEntries&&this.entries.shift(),this.entries.push({level:e,timestamp:new Date().toISOString(),message:Vn(n)}));}getEntries(){return this.entries.slice()}dispose(){if(this.disposed||(this.disposed=true,typeof console>"u"))return;let e=console;for(let[n,i]of this.originals)if(e[n]===this.wrappers.get(n))try{e[n]=i;}catch{}this.originals.clear(),this.wrappers.clear();}};function Zt(t){return t.length<=2e3?t:`${t.slice(0,1999)}\u2026`}function Jt(t){if(typeof t=="string")return t;if(t instanceof URL)return t.href;if(typeof t=="object"&&t!==null&&"url"in t){let e=t.url;if(typeof e=="string")return e}try{return String(t)}catch{return "(unknown)"}}var Ce=class{maxEntries;entries=[];originalFetch=null;originalXhrOpen=null;originalXhrSend=null;wrappedFetch=null;wrappedXhrOpen=null;wrappedXhrSend=null;disposed=false;constructor(e=20){this.maxEntries=Math.min(Math.max(Math.floor(e),0),500),this.installFetch(),this.installXhr();}push(e){this.maxEntries!==0&&(this.entries.length>=this.maxEntries&&this.entries.shift(),this.entries.push(e));}installFetch(){if(typeof globalThis.fetch!="function")return;let e=globalThis.fetch;this.originalFetch=e;let n=async(i,o)=>{let s=new Date,r=typeof performance<"u"?performance.now():Date.now(),a=Zt(Jt(i)),l=(o?.method??(i instanceof Request?i.method:"GET")).toUpperCase();try{let c=await e(i,o);if(!c.ok){let p=typeof performance<"u"?performance.now():Date.now();this.push({url:a,method:l,status:c.status,durationMs:Math.round(p-r),timestamp:s.toISOString()});}return c}catch(c){let p=typeof performance<"u"?performance.now():Date.now();throw this.push({url:a,method:l,status:0,durationMs:Math.round(p-r),timestamp:s.toISOString()}),c}};this.wrappedFetch=n,globalThis.fetch=n;}installXhr(){if(typeof XMLHttpRequest>"u")return;let e=XMLHttpRequest.prototype,n=e.open,i=e.send;this.originalXhrOpen=n,this.originalXhrSend=i;let o=this,s=new WeakMap,r=function(l,c,...p){try{s.set(this,{method:l.toUpperCase(),url:Zt(Jt(c)),startedAt:new Date,t0:typeof performance<"u"?performance.now():Date.now()});}catch{}return n.call(this,l,c,...p)},a=function(l){let c=s.get(this);if(c){let p=()=>{try{let u=typeof performance<"u"?performance.now():Date.now(),d=this.status;(d===0||d>=400)&&o.push({url:c.url,method:c.method,status:d,durationMs:Math.round(u-c.t0),timestamp:c.startedAt.toISOString()});}catch{}};try{this.addEventListener("loadend",p,{once:!0});}catch{try{this.addEventListener("loadend",p);}catch{}}}return i.call(this,l??null)};this.wrappedXhrOpen=r,this.wrappedXhrSend=a,e.open=r,e.send=a;}getEntries(){return this.entries.slice()}dispose(){if(!this.disposed){if(this.disposed=true,this.originalFetch&&globalThis.fetch===this.wrappedFetch)try{globalThis.fetch=this.originalFetch;}catch{}if(typeof XMLHttpRequest<"u")try{let e=XMLHttpRequest.prototype;this.originalXhrOpen&&e.open===this.wrappedXhrOpen&&(e.open=this.originalXhrOpen),this.originalXhrSend&&e.send===this.wrappedXhrSend&&(e.send=this.originalXhrSend);}catch{}}}};var re=class{listeners=new Map;on(e,n){let i=this.listeners.get(e);return i||(i=new Set,this.listeners.set(e,i)),i.add(n),()=>{i?.delete(n);}}off(e,n){this.listeners.get(e)?.delete(n);}emit(e,...n){let i=this.listeners.get(e);if(i)for(let o of i)try{o(...n);}catch(s){console.error(`[siteping] Error in event listener for "${String(e)}":`,s);}}removeAll(){this.listeners.clear();}};var Zn=54,Jn={chat:"fab.messages",annotate:"fab.annotate","toggle-annotations":"fab.annotations"},Ae=class{constructor(e,n,i,o){this.bus=i;this.t=o;let s=n.position??"bottom-right",r=s==="bottom-right";this.items=[{id:"chat",icon:chunkBJFC7TVL_cjs.G},{id:"annotate",icon:chunkBJFC7TVL_cjs.H}],n.showAnnotationsToggle!==false&&this.items.push({id:"toggle-annotations",icon:chunkBJFC7TVL_cjs.s,iconAlt:chunkBJFC7TVL_cjs.t}),this.fab=document.createElement("button"),this.fab.className=`sp-fab sp-fab--${s} sp-anim-fab-in`,this.fab.style.position="fixed",this.fab.appendChild(chunkBJFC7TVL_cjs.m(chunkBJFC7TVL_cjs.r)),this.fab.setAttribute("aria-expanded","false"),this.fab.addEventListener("click",()=>this.toggle()),this.radialContainer=document.createElement("div"),this.radialContainer.className=`sp-radial sp-radial--${s}`,this.radialContainer.setAttribute("role","menu");for(let c=0;c<this.items.length;c++){let p=this.items[c];if(!p)continue;let u=document.createElement("button");u.className="sp-radial-item",u.style.setProperty("--sp-i",String(c)),u.appendChild(chunkBJFC7TVL_cjs.m(p.icon)),u.setAttribute("role","menuitem"),u.dataset.itemId=p.id,u.addEventListener("click",f=>{f.stopPropagation(),this.handleItemClick(p.id);});let d=document.createElement("span");d.className="sp-radial-label",d.style.cssText=r?"position:absolute; right:54px; top:50%; transform:translateY(-50%); white-space:nowrap;":"position:absolute; left:54px; top:50%; transform:translateY(-50%); white-space:nowrap;",u.appendChild(d),this.radialContainer.appendChild(u);}this.root=document.createElement("div"),this.root.appendChild(this.radialContainer),this.root.appendChild(this.fab),e.appendChild(this.root),this.applyLabels();let a=e.host;this.onDocumentClick=c=>{this.isOpen&&!c.composedPath().includes(a)&&this.close();},document.addEventListener("click",this.onDocumentClick);let l=c=>{c.key==="Escape"&&this.isOpen&&(c.stopPropagation(),this.close());};this.fab.addEventListener("keydown",l),this.radialContainer.addEventListener("keydown",l),this.radialContainer.addEventListener("keydown",c=>{let p=Array.from(this.radialContainer.querySelectorAll(".sp-radial-item"));if(p.length===0||!this.isOpen)return;let u=e.activeElement??document.activeElement,d=p.indexOf(u);switch(c.key){case "ArrowUp":{c.preventDefault();let f=d<=0?p.length-1:d-1;p[f]?.focus();break}case "ArrowDown":{c.preventDefault();let f=d>=p.length-1?0:d+1;p[f]?.focus();break}case "Home":{c.preventDefault(),p[0]?.focus();break}case "End":{c.preventDefault(),p[p.length-1]?.focus();break}}});}bus;t;root;fab;radialContainer;badgeEl=null;isOpen=false;annotationsVisible=true;items;onDocumentClick;refreshLabels(){this.applyLabels();}applyLabels(){this.fab.setAttribute("aria-label",this.t("fab.aria"));let e=this.radialContainer.querySelectorAll(".sp-radial-item");for(let n of e){let i=n.dataset.itemId;if(!i)continue;let o=Jn[i];if(!o)continue;let s=this.t(o);n.setAttribute("aria-label",s);let r=n.querySelector(".sp-radial-label");r&&chunkBJFC7TVL_cjs.o(r,s);}}updateBadge(e){if(e<=0){this.badgeEl?.remove(),this.badgeEl=null;return}this.badgeEl||(this.badgeEl=document.createElement("span"),this.badgeEl.className="sp-fab-badge",this.badgeEl.setAttribute("role","status"),this.badgeEl.setAttribute("aria-live","polite"),this.fab.appendChild(this.badgeEl));let n=e>99?"99+":String(e);chunkBJFC7TVL_cjs.o(this.badgeEl,n),this.badgeEl.setAttribute("aria-label",chunkBJFC7TVL_cjs.R(this.t,"fab.badge",{count:e}));}toggle(){this.isOpen?this.close():this.open();}open(){this.isOpen=true,this.setFabIcon(chunkBJFC7TVL_cjs.u),this.fab.setAttribute("aria-expanded","true"),this.radialContainer.querySelectorAll(".sp-radial-item").forEach((n,i)=>{let o=-(16+Zn*(i+1));n.style.transform=`translate(0px, ${o}px) scale(1)`,n.classList.add("sp-radial-item--open");}),requestAnimationFrame(()=>{this.radialContainer.querySelector(".sp-radial-item")?.focus();});}close(){this.isOpen=false,this.setFabIcon(chunkBJFC7TVL_cjs.r),this.fab.setAttribute("aria-expanded","false"),this.radialContainer.querySelectorAll(".sp-radial-item").forEach(n=>{n.style.transform="translate(0, 0) scale(0.8)",n.classList.remove("sp-radial-item--open");}),this.fab.focus();}setFabIcon(e){let n=this.badgeEl;this.fab.replaceChildren(chunkBJFC7TVL_cjs.m(e)),n&&this.fab.appendChild(n);}handleItemClick(e){switch(this.close(),e){case "chat":this.bus.emit("panel:toggle",true);break;case "annotate":{let n=this.bus.on("annotation:end",()=>{n(),this.fab.focus();});this.bus.emit("annotation:start");break}case "toggle-annotations":{this.annotationsVisible=!this.annotationsVisible,this.bus.emit("annotations:toggle",this.annotationsVisible);let i=this.radialContainer.querySelector('[data-item-id="toggle-annotations"]')?.querySelector("svg");if(i){let o=chunkBJFC7TVL_cjs.m(this.annotationsVisible?chunkBJFC7TVL_cjs.s:chunkBJFC7TVL_cjs.t);i.replaceWith(o);}break}}}destroy(){document.removeEventListener("click",this.onDocumentClick),this.root.remove();}};var Qt="siteping_identity";function Qn(t){if(!chunkBJFC7TVL_cjs.d(t,"name")||!chunkBJFC7TVL_cjs.d(t,"email"))return false;let{name:e,email:n}=t;return typeof e=="string"&&typeof n=="string"&&e.length>0&&chunkBJFC7TVL_cjs.a(n)}function Ze(){try{let t=localStorage.getItem(Qt);if(!t)return null;let e=JSON.parse(t);return Qn(e)?e:null}catch{return null}}function en(t){try{localStorage.setItem(Qt,JSON.stringify(t));}catch{}}function V(t){return t.normalize("NFC").replace(/\s+/g," ").trim()}function tn(t){return t.replace(/\s+/g," ").trim()}function ei(t,e){if(t===e)return 0;if(t.length===0)return e.length;if(e.length===0)return t.length;if(t.length>e.length){let r=t;t=e,e=r;}let n=t.length,i=e.length,o=new Array(n+1);for(let r=0;r<=n;r++)o[r]=r;let s=new Array(n+1);for(let r=1;r<=i;r++){s[0]=r;for(let l=1;l<=n;l++){let c=o[l-1];s[l]=t[l-1]===e[r-1]?c:1+Math.min(c,o[l],s[l-1]);}let a=o;o=s,s=a;}return o[n]}function ae(t,e){if(t===e)return 1;let n=Math.max(t.length,e.length);return n===0?1:1-ei(t,e)/n}function ti(t,e){let n=e.length,i=new Int32Array(n+1),o=new Int32Array(n+1);for(let r=0;r<=n;r++)i[r]=r;let s=n;for(let r=1;r<=t.length;r++){o[0]=0;let a=t.charCodeAt(r-1);for(let p=1;p<=n;p++){let u=i[p-1]+(e.charCodeAt(p-1)===a?0:1),d=i[p]+1,f=o[p-1]+1;o[p]=Math.min(u,d,f);}let l=o[n];l<s&&(s=l);let c=i;i=o,o=c;}return s}function nn(t,e,n=.6){if(!e||!t)return 0;if(t.includes(e))return 1;let i=t.length>500?t.slice(0,500):t;if(e.length>i.length){let s=ae(i,e);return s>=n?s:0}if(e.length<8&&i.length>64)return 0;let o=1-ti(i,e)/e.length;return o>=n?o:0}function on(t){let e=new Map;for(let n=0;n<t.length-1;n++){let i=t.charCodeAt(n)<<16|t.charCodeAt(n+1);e.set(i,(e.get(i)??0)+1);}return e}function sn(t,e,n){let i=n.length-1;if(e<=0||i<=0)return 0;let o=0,s=new Map;for(let r=0;r<n.length-1;r++){let a=n.charCodeAt(r)<<16|n.charCodeAt(r+1),l=t.get(a);if(l===void 0)continue;let c=s.get(a)??0;c<l&&(s.set(a,c+1),o++);}return 2*o/(e+i)}function rn(t){let e=new Map,n=t.split(" ");for(let i=0;i<n.length-1;i++){let o=`${n[i]} ${n[i+1]}`;e.set(o,(e.get(o)??0)+1);}return e}function an(t,e,n){if(e<=0)return 0;let i=n.split(" "),o=i.length-1;if(o<=0)return 0;let s=0,r=new Map;for(let a=0;a<i.length-1;a++){let l=`${i[a]} ${i[a+1]}`,c=t.get(l);if(c===void 0)continue;let p=r.get(l)??0;p<c&&(r.set(l,p+1),s++);}return 2*s/(e+o)}var ni={checkOpacity:true,opacityProperty:true,checkVisibilityCSS:true,visibilityProperty:true};function le(t){if(!t.isConnected)return "hidden";if(typeof t.checkVisibility=="function")return t.checkVisibility(ni)?"visible":t.checkVisibility()?"soft-hidden":"hidden";if(t.getClientRects().length>0)try{return getComputedStyle(t).visibility==="visible"?"visible":"soft-hidden"}catch{return "visible"}let e=t.firstElementChild;return e&&e.getClientRects().length>0?"visible":t.ownerDocument.documentElement.getClientRects().length===0?"unknown":"hidden"}function ln(t){switch(t){case "hidden":return .3;case "soft-hidden":return .6;default:return 1}}var Z={anchorKey:1,id:1,css:.95,xpath:.9,scan:.85},Re=16,ii=24,oi=1e4,tt=500,si=.5,Je=.6,ri=.4,ai=2e3,et=.8,Qe=.6,li=.05;function Me(t,e){return V((t??"").slice(0,ai)).slice(0,e)}function ci(t){let e=Me(t.textSnippet,tt),n=rn(e),i=0;for(let o of n.values())i+=o;return {snippet:e,snippetBigrams:on(e),snippetBigramTotal:Math.max(0,e.length-1),snippetWordPairs:n,snippetWordPairTotal:i,prefix:Me(t.textPrefix,128),suffix:Me(t.textSuffix,128),neighbor:Me(t.neighborText,128),fingerprint:(t.fingerprint??"").slice(0,64),tag:typeof t.elementTag=="string"?t.elementTag:""}}function pi(t,e){let n=ci(t),i=di(t),o=[];for(let[u,d]of i){let f=cn(u,d,n);f&&o.push(f);}let s=0,r=false;for(let u of o)u.final>s&&(s=u.final),(u.strategy==="id"||u.strategy==="anchorKey")&&u.visibility===1&&(u.signals?.text??0)>=et&&(u.signals?.fingerprint===void 0||u.signals.fingerprint>=et)&&(r=true);let a=!!(n.snippet||n.fingerprint||n.prefix||n.suffix||n.neighbor),l=e?.scanBudget;if(a&&s<Z.scan&&!r)if(l&&l.remaining<=0)l.starved=true;else {l&&l.remaining--;for(let u of ui(n,i)){let d=cn(u,"scan",n);d&&o.push(d);}}let c=o.filter(hi);if(c.length===0)return null;c.sort((u,d)=>d.final-u.final);let p=mi(c);return {element:p.element,confidence:bi(p),strategy:p.strategy}}function di(t){let e=new Map,n=(i,o,s)=>{!i||e.has(i)||s&&i.tagName!==t.elementTag||e.set(i,o);};if(t.anchorKey){let i=t.anchorKey.replace(/\\/g,"\\\\").replace(/"/g,'\\"');try{let o=document.querySelectorAll(`[${ie}="${i}"]`);for(let s=0;s<Math.min(o.length,Re);s++)n(o[s]??null,"anchorKey",!1);}catch{}}if(t.elementId){let i=t.elementId.replace(/\\/g,"\\\\").replace(/"/g,'\\"');try{let o=document.querySelectorAll(`[id="${i}"]`);for(let s=0;s<Math.min(o.length,Re);s++)n(o[s]??null,"id",!0);}catch{n(document.getElementById(t.elementId),"id",true);}}try{let i=document.querySelectorAll(t.cssSelector);for(let o=0;o<Math.min(i.length,Re);o++)n(i[o]??null,"css",!0);}catch{}try{let i=document.evaluate(t.xpath,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null),o=Math.min(i.snapshotLength,Re);for(let s=0;s<o;s++){let r=i.snapshotItem(s);r instanceof Element&&n(r,"xpath",!0);}}catch{}return e}function ui(t,e){let n=t.tag.toLowerCase();if(!n)return [];let i;try{i=document.querySelectorAll(n);}catch{return []}let o=t.fingerprint.split(":"),s=o.length===3?Number(o[0]):Number.NaN,r=o.length===3?o[2]??"":"",a=Math.min(i.length,oi),l=[];for(let c=0;c<a;c++){let p=i[c];if(!p||e.has(p))continue;let u=0;if(t.snippetBigramTotal>0){let d=tn(q(p,tt)),f=sn(t.snippetBigrams,t.snippetBigramTotal,d);if(t.snippetWordPairTotal>0){let b=f>0?an(t.snippetWordPairs,t.snippetWordPairTotal,d):0;u+=.6*(.5*f+.5*b);}else u+=.6*f;}if(r&&We(p)===r&&(u+=.25),!Number.isNaN(s)){let d=Math.abs(p.children.length-s);d===0?u+=.15:d<=2&&(u+=.07);}l.push({element:p,cheap:u});}return l.sort((c,p)=>p.cheap-c.cheap),l.slice(0,ii).map(c=>c.element)}function cn(t,e,n){let i=fi(t,n),o=ln(le(t));return i===null?e==="scan"?null:{element:t,strategy:e,verification:Qe,strongest:Qe,visibility:o,final:Z[e]*Qe*o,unverified:true}:{element:t,strategy:e,verification:i.blend,strongest:i.strongest,signals:i,visibility:o,final:Z[e]*i.blend*o}}function hi(t){if(t.strategy==="scan")return t.verification>=ri;if(t.unverified||!t.signals)return true;let e=t.signals;return e.text===void 0||e.text>=si?true:(e.fingerprint??0)>=Je||(e.context??0)>=Je||(e.neighbor??0)>=Je}function fi(t,e){let n=0,i=0,o={blend:0,strongest:0};if(e.snippet){i+=40;let s=V(q(t,tt));o.text=nn(s,e.snippet,.5),n+=o.text*40;}if(e.fingerprint&&(i+=20,o.fingerprint=Ot(t,e.fingerprint),n+=o.fingerprint*20),e.prefix||e.suffix){i+=20;let s=0,r=0;if(e.prefix){let a=V(U(t,"before"));s+=a?ae(a,e.prefix):0,r++;}if(e.suffix){let a=V(U(t,"after"));s+=a?ae(a,e.suffix):0,r++;}r>0&&(o.context=s/r,n+=o.context*20);}if(e.neighbor){i+=20;let s=V(ve(t));o.neighbor=s?ae(s,e.neighbor):0,n+=o.neighbor*20;}return i===0?null:(o.blend=n/i,o.strongest=Math.max(o.text??0,o.fingerprint??0,o.context??0,o.neighbor??0),o)}function mi(t){let e=t[0],n=t.filter(o=>e.final-o.final<=li&&(o===e||e.element.contains(o.element))),i=e;for(let o of n)o!==i&&i.element.contains(o.element)&&(i=o);return i}function bi(t){return t.strategy==="scan"?Math.min(t.verification,Z.scan):t.unverified?Z[t.strategy]:Z[t.strategy]*Math.min(1,t.strongest/et)}function Le(t,e,n){let i=pi(t,n);if(!i)return null;let o=i.element.getBoundingClientRect(),s=new DOMRect(o.x+e.xPct*o.width,o.y+e.yPct*o.height,e.wPct*o.width,e.hPct*o.height);return {element:i.element,rect:s,confidence:i.confidence,strategy:i.strategy}}function nt(t){return {cssSelector:t.cssSelector,xpath:t.xpath,textSnippet:t.textSnippet,elementTag:t.elementTag,elementId:t.elementId??void 0,textPrefix:t.textPrefix,textSuffix:t.textSuffix,fingerprint:t.fingerprint,neighborText:t.neighborText,anchorKey:t.anchorKey??null}}function Pe(t){return {xPct:t.xPct,yPct:t.yPct,wPct:t.wPct,hPct:t.hPct}}var pn=13;function dn(t){return {top:t.top+window.scrollY-pn,left:t.right+window.scrollX-pn}}function ce(t,e){let n=t.entries[e],i=t.elementIndices[e];if(!(!n||i===void 0))return n.elements[i]}var un=300,hn=200,gi=3e3,yi=.7,vi=28,fn=32,Ie=class{constructor(e,n,i,o,s=null){this.colors=e;this.tooltip=n;this.bus=i;this.t=o;this.liveRegion=s;this.container=chunkBJFC7TVL_cjs.n("div",{style:`position:absolute;top:0;left:0;pointer-events:none;z-index:${2147483646};`}),this.container.id="siteping-markers",document.body.appendChild(this.container),this.bus.on("annotations:toggle",r=>{this.container.style.display=r?"block":"none";}),this.resizeHandler=()=>this.scheduleReposition("resize"),window.addEventListener("resize",this.resizeHandler,{passive:true}),this.scrollHandler=()=>this.scheduleReposition("scroll"),window.addEventListener("scroll",this.scrollHandler,{passive:true,capture:true}),this.mutationObserver=new MutationObserver(r=>{let a=false;for(let l of r)if(!(this.container.contains(l.target)||this.tooltip.contains(l.target))){a=true;break}a&&this.scheduleReposition("mutation");}),this.mutationObserver.observe(document.body,{childList:true,subtree:true,attributes:false,characterData:false}),this.onDocumentClickForClusters=r=>{this.container.contains(r.target)||this.collapseAllClusters();},document.addEventListener("click",this.onDocumentClickForClusters);}colors;tooltip;bus;t;liveRegion;container;entries=[];highlightElements=[];pinnedFeedback=null;onDocumentClick=null;repositionTimer=null;mutationObserver=null;scrollHandler=null;resizeHandler=null;anchorCache=new Map;pendingLayoutChange=false;pendingResize=false;hiddenRecheckAt=new Map;clusters=[];onDocumentClickForClusters=null;lastOpenCount=-1;get count(){return this.entries.length}get openCount(){let e=0;for(let n of this.entries)chunkBJFC7TVL_cjs.g(n.feedback.status)||e++;return e}scheduleReposition(e="mutation"){e!=="scroll"&&(this.pendingLayoutChange=true),e==="resize"&&(this.pendingResize=true),!this.repositionTimer&&("requestIdleCallback"in window?this.repositionTimer=window.requestIdleCallback(()=>{this.repositionTimer=null,this.repositionAll();},{timeout:hn+100}):this.repositionTimer=+setTimeout(()=>{this.repositionTimer=null,this.repositionAll();},hn));}repositionAll(){let e=this.pendingLayoutChange,n=this.pendingResize;this.pendingLayoutChange=false,this.pendingResize=false,n&&this.hiddenRecheckAt.clear();let i=Date.now(),o={remaining:2,starved:false},s=new Set;for(let r of this.entries)for(let a=0;a<r.feedback.annotations.length;a++){let l=r.elements[a];if(!l)continue;let c=r.feedback.annotations[a];if(!c)continue;let p=`${r.feedback.id}:${a}`;s.add(p);let d=this.anchorCache.get(p)?.deref(),f,b=(this.hiddenRecheckAt.get(p)??0)>i,M=d?.isConnected&&(b||!(e&&le(d)==="hidden"));if(d&&M){let C=d.getBoundingClientRect(),w=Pe(c);f={element:d,rect:new DOMRect(C.left+w.xPct*C.width,C.top+w.yPct*C.height,w.wPct*C.width,w.hPct*C.height),confidence:1,strategy:"css"};}else b?f=null:(o.starved=false,f=Le(nt(c),Pe(c),{scanBudget:o}),o.starved||(f?.element&&this.anchorCache.set(p,new WeakRef(f.element)),!f||le(f.element)==="hidden"?this.hiddenRecheckAt.set(p,i+gi):this.hiddenRecheckAt.delete(p)));if(!f){l.style.display="none";continue}let y=dn(f.rect);r.baseTop=y.top,r.baseLeft=y.left,l.style.display="flex",this.applyConfidenceStyle(l,f.confidence,r.feedback);}for(let r of this.anchorCache.keys())s.has(r)||this.anchorCache.delete(r);for(let r of this.hiddenRecheckAt.keys())s.has(r)||this.hiddenRecheckAt.delete(r);this.applyClusterPositions(),this.pinnedFeedback&&this.showHighlight(this.pinnedFeedback);}applyClusterPositions(){for(let e of this.clusters)e.expanded?this.applyFanPositions(e):this.applyStackPositions(e);}emitMarkersChanged(){let e=this.openCount;e!==this.lastOpenCount&&(this.lastOpenCount=e,this.bus.emit("markers:changed",e));}render(e){this.clear(),e.forEach((n,i)=>{let o=this.buildEntry(n,i+1);this.entries.push(o);}),this.buildClusters(),this.liveRegion&&this.entries.length>0&&(this.liveRegion.textContent=chunkBJFC7TVL_cjs.R(this.t,"marker.count",{count:this.entries.length})),this.emitMarkersChanged();}addFeedback(e,n){let i=this.buildEntry(e,n);for(let o of i.elements)o.style.animation="sp-marker-in 0.35s cubic-bezier(0.34,1.56,0.64,1) both";this.entries.push(i),this.buildClusters(),this.emitMarkersChanged();}buildEntry(e,n){let i={feedback:e,elements:[],baseTop:0,baseLeft:0};for(let o of e.annotations){let s=Le(nt(o),Pe(o));if(!s)continue;let r=dn(s.rect);i.baseTop=r.top,i.baseLeft=r.left;let a=this.createMarker(n,e,r);this.applyConfidenceStyle(a,s.confidence,e),this.container.appendChild(a),i.elements.push(a);}return i}buildClusters(){for(let i of this.container.querySelectorAll(".sp-cluster-badge"))i.remove();let e=[];for(let i of this.entries)for(let o=0;o<i.elements.length;o++)e.push({entry:i,elIdx:o});let n=new Set;this.clusters=[];for(let i=0;i<e.length;i++){if(n.has(i))continue;let o=e[i];if(!o)continue;let s={entries:[o.entry],elementIndices:[o.elIdx],expanded:false};n.add(i);for(let r=i+1;r<e.length;r++){if(n.has(r))continue;let a=o.entry,l=e[r];if(!l)continue;let c=l.entry;Math.sqrt((a.baseLeft-c.baseLeft)**2+(a.baseTop-c.baseTop)**2)<vi&&(s.entries.push(c),s.elementIndices.push(l.elIdx),n.add(r));}this.clusters.push(s);}for(let i of this.clusters)i.entries.length<=1||(this.applyStackPositions(i),this.addClusterBadge(i));}applyStackPositions(e){let n=e.entries[0];if(!n)return;let{baseTop:i,baseLeft:o}=n,s=e.entries.length<=1;for(let r=0;r<e.entries.length;r++){let a=ce(e,r);a&&(a.style.top=`${i+(s?0:r*3)}px`,a.style.left=`${o+(s?0:r*3)}px`,a.style.zIndex=String(r+1));}}applyFanPositions(e){let n=e.entries[0];if(!n)return;let{baseTop:i,baseLeft:o}=n,s=e.entries.length,r=(s-1)*fn,a=o-r/2;for(let l=0;l<s;l++){let c=ce(e,l);c&&(c.style.top=`${i}px`,c.style.left=`${a+l*fn}px`,c.style.zIndex=String(10+l));}}addClusterBadge(e){let n=ce(e,e.entries.length-1);if(!n)return;let i=chunkBJFC7TVL_cjs.n("div",{class:"sp-cluster-badge",style:`
114
114
  position:absolute;top:-6px;right:-6px;
115
115
  min-width:16px;height:16px;padding:0 4px;
116
116
  border-radius:9999px;
@@ -121,36 +121,36 @@ ${t.stack}`:""}`;try{let e=new WeakSet;return JSON.stringify(t,(n,i)=>{if(typeof
121
121
  pointer-events:none;
122
122
  font-family:"Inter",system-ui,-apple-system,sans-serif;
123
123
  line-height:1;
124
- `});chunkNVNA5AI2_cjs.c(i,String(e.entries.length)),n.appendChild(i);}setBadgesVisible(e,n){for(let i=0;i<e.entries.length;i++){let o=ce(e,i)?.querySelector(".sp-cluster-badge");o&&(o.style.display=n?"flex":"none");}}findCluster(e){for(let n of this.clusters)if(!(n.entries.length<=1)){for(let i=0;i<n.entries.length;i++)if(ce(n,i)===e)return n}return null}handleClusterClick(e,n){let i=this.findCluster(e);return i?i.expanded?false:(n.stopPropagation(),this.collapseAllClusters(),i.expanded=true,this.applyFanPositions(i),this.setBadgesVisible(i,false),true):false}collapseCluster(e){e.expanded&&(e.expanded=false,this.applyStackPositions(e),this.setBadgesVisible(e,true));}collapseAllClusters(){for(let e of this.clusters)this.collapseCluster(e);}applyConfidenceStyle(e,n,i){let o=chunkNVNA5AI2_cjs.F(i.status);n<hi&&!o?(e.style.borderStyle="dashed",e.style.opacity="0.7",e.title=chunkNVNA5AI2_cjs.O(this.t,"marker.approximate",{confidence:Math.round(n*100)})):(e.style.borderStyle="solid",e.style.opacity="1",e.title="");}createMarker(e,n,i){let o=chunkNVNA5AI2_cjs.x(n.type,this.colors),r=chunkNVNA5AI2_cjs.F(n.status),s=chunkNVNA5AI2_cjs.b("div",{style:`
124
+ `});chunkBJFC7TVL_cjs.o(i,String(e.entries.length)),n.appendChild(i);}setBadgesVisible(e,n){for(let i=0;i<e.entries.length;i++){let o=ce(e,i)?.querySelector(".sp-cluster-badge");o&&(o.style.display=n?"flex":"none");}}findCluster(e){for(let n of this.clusters)if(!(n.entries.length<=1)){for(let i=0;i<n.entries.length;i++)if(ce(n,i)===e)return n}return null}handleClusterClick(e,n){let i=this.findCluster(e);return i?i.expanded?false:(n.stopPropagation(),this.collapseAllClusters(),i.expanded=true,this.applyFanPositions(i),this.setBadgesVisible(i,false),true):false}collapseCluster(e){e.expanded&&(e.expanded=false,this.applyStackPositions(e),this.setBadgesVisible(e,true));}collapseAllClusters(){for(let e of this.clusters)this.collapseCluster(e);}applyConfidenceStyle(e,n,i){let o=chunkBJFC7TVL_cjs.g(i.status);n<yi&&!o?(e.style.borderStyle="dashed",e.style.opacity="0.7",e.title=chunkBJFC7TVL_cjs.R(this.t,"marker.approximate",{confidence:Math.round(n*100)})):(e.style.borderStyle="solid",e.style.opacity="1",e.title="");}createMarker(e,n,i){let o=chunkBJFC7TVL_cjs.J(n.type,this.colors),s=chunkBJFC7TVL_cjs.g(n.status),r=chunkBJFC7TVL_cjs.n("div",{style:`
125
125
  position:absolute;
126
126
  top:${i.top}px;
127
127
  left:${i.left}px;
128
128
  width:26px;height:26px;
129
129
  border-radius:50%;
130
- background:${r?"rgba(241,245,249,0.9)":"rgba(255,255,255,0.92)"};
131
- border:2px solid ${r?"#cbd5e1":o};
130
+ background:${s?"rgba(241,245,249,0.9)":"rgba(255,255,255,0.92)"};
131
+ border:2px solid ${s?"#cbd5e1":o};
132
132
  display:flex;align-items:center;justify-content:center;
133
133
  font-family:"Inter",system-ui,-apple-system,sans-serif;
134
134
  font-size:11px;font-weight:700;
135
- color:${r?"#94a3b8":o};
135
+ color:${s?"#94a3b8":o};
136
136
  cursor:pointer;pointer-events:auto;
137
- box-shadow:${r?"0 2px 8px rgba(0,0,0,0.06)":`0 2px 12px ${o}25, 0 2px 6px rgba(0,0,0,0.06)`};
137
+ box-shadow:${s?"0 2px 8px rgba(0,0,0,0.06)":`0 2px 12px ${o}25, 0 2px 6px rgba(0,0,0,0.06)`};
138
138
  transition:top 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), left 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.15s ease, box-shadow 0.15s ease;
139
139
  user-select:none;
140
140
  -webkit-font-smoothing:antialiased;
141
- `});s.dataset.feedbackId=n.id,s.setAttribute("tabindex","0"),s.setAttribute("role","button");let a=n.message.length>60?`${n.message.slice(0,60)}...`:n.message,l=chunkNVNA5AI2_cjs.O(this.t,"marker.aria",{number:e,type:chunkNVNA5AI2_cjs.P(n.type,this.t),message:a});s.setAttribute("aria-label",l),s.setAttribute("aria-describedby",this.tooltip.tooltipId),chunkNVNA5AI2_cjs.c(s,r?"\u2713":String(e)),s.addEventListener("mouseenter",()=>{s.style.transform="scale(1.2)",s.style.boxShadow=r?"0 4px 16px rgba(0,0,0,0.1)":`0 4px 20px ${o}35, 0 4px 12px rgba(0,0,0,0.08)`,this.tooltip.show(n,s.getBoundingClientRect()),this.pinnedFeedback||this.showHighlight(n);}),s.addEventListener("mouseleave",()=>{s.style.transform="scale(1)",s.style.boxShadow=r?"0 2px 8px rgba(0,0,0,0.06)":`0 2px 12px ${o}25, 0 2px 6px rgba(0,0,0,0.06)`,this.tooltip.scheduleHide(),this.pinnedFeedback||this.clearHighlight();}),s.addEventListener("focus",()=>{this.tooltip.show(n,s.getBoundingClientRect()),this.pinnedFeedback||this.showHighlight(n);}),s.addEventListener("blur",()=>{this.tooltip.scheduleHide(),this.pinnedFeedback||this.clearHighlight();});let c=p=>{p instanceof MouseEvent&&this.handleClusterClick(s,p)||(this.pinHighlight(n),this.bus.emit("panel:toggle",true),s.dispatchEvent(new CustomEvent("sp-marker-click",{detail:{feedbackId:n.id},bubbles:true})));};return s.addEventListener("click",p=>c(p)),s.addEventListener("keydown",p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),c(p));}),s}focusFeedback(e){let n=this.entries.find(o=>o.feedback.id===e);if(!n)return false;let i=n.elements[0];return i&&i.scrollIntoView({behavior:"smooth",block:"center"}),this.pinHighlight(n.feedback),this.highlight(e),true}highlight(e){for(let n of this.entries)if(n.feedback.id===e)for(let i of n.elements)i.style.animation="sp-pulse-ring 0.7s ease-out",i.addEventListener("animationend",()=>{i.style.animation="";},{once:true});}showHighlight(e){this.removeHighlightElements();for(let n of e.annotations){let i=Me(tt(n),Le(n));if(!i)continue;let o=chunkNVNA5AI2_cjs.x(e.type,this.colors),r=i.rect,s=chunkNVNA5AI2_cjs.b("div",{style:`
141
+ `});r.dataset.feedbackId=n.id,r.setAttribute("tabindex","0"),r.setAttribute("role","button");let a=n.message.length>60?`${n.message.slice(0,60)}...`:n.message,l=chunkBJFC7TVL_cjs.R(this.t,"marker.aria",{number:e,type:chunkBJFC7TVL_cjs.S(n.type,this.t),message:a});r.setAttribute("aria-label",l),r.setAttribute("aria-describedby",this.tooltip.tooltipId),chunkBJFC7TVL_cjs.o(r,s?"\u2713":String(e)),r.addEventListener("mouseenter",()=>{r.style.transform="scale(1.2)",r.style.boxShadow=s?"0 4px 16px rgba(0,0,0,0.1)":`0 4px 20px ${o}35, 0 4px 12px rgba(0,0,0,0.08)`,this.tooltip.show(n,r.getBoundingClientRect()),this.pinnedFeedback||this.showHighlight(n);}),r.addEventListener("mouseleave",()=>{r.style.transform="scale(1)",r.style.boxShadow=s?"0 2px 8px rgba(0,0,0,0.06)":`0 2px 12px ${o}25, 0 2px 6px rgba(0,0,0,0.06)`,this.tooltip.scheduleHide(),this.pinnedFeedback||this.clearHighlight();}),r.addEventListener("focus",()=>{this.tooltip.show(n,r.getBoundingClientRect()),this.pinnedFeedback||this.showHighlight(n);}),r.addEventListener("blur",()=>{this.tooltip.scheduleHide(),this.pinnedFeedback||this.clearHighlight();});let c=p=>{p instanceof MouseEvent&&this.handleClusterClick(r,p)||(this.pinHighlight(n),this.bus.emit("panel:toggle",true),r.dispatchEvent(new CustomEvent("sp-marker-click",{detail:{feedbackId:n.id},bubbles:true})));};return r.addEventListener("click",p=>c(p)),r.addEventListener("keydown",p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),c(p));}),r}focusFeedback(e){let n=this.entries.find(o=>o.feedback.id===e);if(!n)return false;let i=n.elements[0];return i&&i.scrollIntoView({behavior:"smooth",block:"center"}),this.pinHighlight(n.feedback),this.highlight(e),true}highlight(e){for(let n of this.entries)if(n.feedback.id===e)for(let i of n.elements)i.style.animation="sp-pulse-ring 0.7s ease-out",i.addEventListener("animationend",()=>{i.style.animation="";},{once:true});}showHighlight(e){this.removeHighlightElements();for(let n of e.annotations){let i=Le(nt(n),Pe(n));if(!i)continue;let o=chunkBJFC7TVL_cjs.J(e.type,this.colors),s=i.rect,r=chunkBJFC7TVL_cjs.n("div",{style:`
142
142
  position:absolute;
143
- top:${r.top+window.scrollY}px;
144
- left:${r.left+window.scrollX}px;
145
- width:${r.width}px;height:${r.height}px;
143
+ top:${s.top+window.scrollY}px;
144
+ left:${s.left+window.scrollX}px;
145
+ width:${s.width}px;height:${s.height}px;
146
146
  border:2px solid ${o};
147
147
  background:${o}0c;
148
148
  border-radius:8px;
149
149
  pointer-events:none;z-index:-1;
150
150
  opacity:0;
151
151
  box-shadow:0 0 16px ${o}20;
152
- transition:opacity ${cn}ms ease;
153
- `});this.container.appendChild(s),this.highlightElements.push(s),s.offsetHeight,s.style.opacity="1";}}pinHighlight(e){this.unpinHighlight(),this.showHighlight(e),this.pinnedFeedback=e,this.onDocumentClick=n=>{this.container.contains(n.target)||this.unpinHighlight();},document.addEventListener("click",this.onDocumentClick,{capture:true});}unpinHighlight(){this.onDocumentClick&&(document.removeEventListener("click",this.onDocumentClick,{capture:true}),this.onDocumentClick=null),this.pinnedFeedback=null,this.clearHighlight();}clearHighlight(){for(let e of this.highlightElements)e.style.opacity="0",setTimeout(()=>e.remove(),cn);this.highlightElements=[];}removeHighlightElements(){for(let e of this.highlightElements)e.remove();this.highlightElements=[];}clear(){this.unpinHighlight(),this.container.replaceChildren(),this.entries=[],this.clusters=[],this.anchorCache.clear();}destroy(){this.unpinHighlight(),this.repositionTimer&&("cancelIdleCallback"in window&&window.cancelIdleCallback(this.repositionTimer),clearTimeout(this.repositionTimer)),this.resizeHandler&&window.removeEventListener("resize",this.resizeHandler),this.scrollHandler&&window.removeEventListener("scroll",this.scrollHandler,{capture:true}),this.onDocumentClickForClusters&&document.removeEventListener("click",this.onDocumentClickForClusters),this.mutationObserver?.disconnect(),this.container.remove();}};var Ie=class{constructor(e,n){this.store=e;this.projectName=n;}store;projectName;async sendFeedback(e){let n=await this.store.createFeedback({projectName:e.projectName,type:e.type,message:e.message,status:"open",url:e.url,urlPattern:e.urlPattern??null,viewport:e.viewport,userAgent:e.userAgent,authorName:e.authorName,authorEmail:e.authorEmail,clientId:e.clientId,annotations:e.annotations.map(chunkNVNA5AI2_cjs.H),screenshotDataUrl:e.screenshotDataUrl??null,screenshotRegion:e.screenshotRegion??null,diagnostics:e.diagnostics??null});return nt(n)}async getFeedbacks(e,n){let{feedbacks:i,total:o}=await this.store.getFeedbacks({projectName:e,page:n?.page,limit:n?.limit,type:n?.type,status:n?.status,statuses:n?.statuses,search:n?.search,url:n?.url,urlPattern:n?.urlPattern});return {feedbacks:i.map(nt),total:o}}async resolveFeedback(e,n){let i=await this.store.updateFeedback(e,chunkNVNA5AI2_cjs.G(n?"resolved":"open"));return nt(i)}async deleteFeedback(e){await this.store.deleteFeedback(e);}async deleteAllFeedbacks(e){await this.store.deleteAllFeedbacks(e);}};function nt(t){return {id:t.id,projectName:t.projectName,type:t.type,message:t.message,status:t.status,url:t.url,urlPattern:t.urlPattern??null,viewport:t.viewport,userAgent:t.userAgent,authorName:t.authorName,authorEmail:t.authorEmail,resolvedAt:t.resolvedAt?.toISOString()??null,createdAt:t.createdAt.toISOString(),updatedAt:t.updatedAt.toISOString(),annotations:t.annotations.map(mi),screenshotUrl:t.screenshotUrl??null,screenshotRegion:t.screenshotRegion??null,diagnostics:t.diagnostics??null}}function mi(t){return {id:t.id,feedbackId:t.feedbackId,cssSelector:t.cssSelector,xpath:t.xpath,textSnippet:t.textSnippet,elementTag:t.elementTag,elementId:t.elementId,textPrefix:t.textPrefix,textSuffix:t.textSuffix,fingerprint:t.fingerprint,neighborText:t.neighborText,anchorKey:t.anchorKey??null,xPct:t.xPct,yPct:t.yPct,wPct:t.wPct,hPct:t.hPct,scrollX:t.scrollX,scrollY:t.scrollY,viewportW:t.viewportW,viewportH:t.viewportH,devicePixelRatio:t.devicePixelRatio,createdAt:t.createdAt.toISOString()}}var bi="linear(0, 0.006, 0.025, 0.06, 0.11, 0.17, 0.25, 0.34, 0.45, 0.56, 0.67, 0.78, 0.88, 0.95, 1.01, 1.04, 1.05, 1.04, 1.02, 1, 0.99, 1)",it="cubic-bezier(0.16, 1, 0.3, 1)",ot="cubic-bezier(0.34, 1.56, 0.64, 1)",gi="cubic-bezier(0.25, 1, 0.5, 1)",un=`
152
+ transition:opacity ${un}ms ease;
153
+ `});this.container.appendChild(r),this.highlightElements.push(r),r.offsetHeight,r.style.opacity="1";}}pinHighlight(e){this.unpinHighlight(),this.showHighlight(e),this.pinnedFeedback=e,this.onDocumentClick=n=>{this.container.contains(n.target)||this.unpinHighlight();},document.addEventListener("click",this.onDocumentClick,{capture:true});}unpinHighlight(){this.onDocumentClick&&(document.removeEventListener("click",this.onDocumentClick,{capture:true}),this.onDocumentClick=null),this.pinnedFeedback=null,this.clearHighlight();}clearHighlight(){for(let e of this.highlightElements)e.style.opacity="0",setTimeout(()=>e.remove(),un);this.highlightElements=[];}removeHighlightElements(){for(let e of this.highlightElements)e.remove();this.highlightElements=[];}clear(){this.unpinHighlight(),this.container.replaceChildren(),this.entries=[],this.clusters=[],this.anchorCache.clear();}destroy(){this.unpinHighlight(),this.repositionTimer&&("cancelIdleCallback"in window&&window.cancelIdleCallback(this.repositionTimer),clearTimeout(this.repositionTimer)),this.resizeHandler&&window.removeEventListener("resize",this.resizeHandler),this.scrollHandler&&window.removeEventListener("scroll",this.scrollHandler,{capture:true}),this.onDocumentClickForClusters&&document.removeEventListener("click",this.onDocumentClickForClusters),this.mutationObserver?.disconnect(),this.container.remove();}};var Fe=class{constructor(e,n){this.store=e;this.projectName=n;}store;projectName;async sendFeedback(e){let n=await this.store.createFeedback({projectName:e.projectName,type:e.type,message:e.message,status:"open",url:e.url,urlPattern:e.urlPattern??null,viewport:e.viewport,userAgent:e.userAgent,authorName:e.authorName,authorEmail:e.authorEmail,clientId:e.clientId,annotations:e.annotations.map(chunkBJFC7TVL_cjs.i),screenshotDataUrl:e.screenshotDataUrl??null,screenshotRegion:e.screenshotRegion??null,diagnostics:e.diagnostics??null});return it(n)}async getFeedbacks(e,n){let{feedbacks:i,total:o}=await this.store.getFeedbacks({projectName:e,page:n?.page,limit:n?.limit,type:n?.type,status:n?.status,statuses:n?.statuses,search:n?.search,url:n?.url,urlPattern:n?.urlPattern});return {feedbacks:i.map(it),total:o}}async resolveFeedback(e,n){let i=await this.store.updateFeedback(e,chunkBJFC7TVL_cjs.h(n?"resolved":"open"));return it(i)}async deleteFeedback(e){await this.store.deleteFeedback(e);}async deleteAllFeedbacks(e){await this.store.deleteAllFeedbacks(e);}};function it(t){return {id:t.id,projectName:t.projectName,type:t.type,message:t.message,status:t.status,url:t.url,urlPattern:t.urlPattern??null,viewport:t.viewport,userAgent:t.userAgent,authorName:t.authorName,authorEmail:t.authorEmail,resolvedAt:t.resolvedAt?.toISOString()??null,createdAt:t.createdAt.toISOString(),updatedAt:t.updatedAt.toISOString(),annotations:t.annotations.map(xi),screenshotUrl:t.screenshotUrl??null,screenshotRegion:t.screenshotRegion??null,diagnostics:t.diagnostics??null}}function xi(t){return {id:t.id,feedbackId:t.feedbackId,cssSelector:t.cssSelector,xpath:t.xpath,textSnippet:t.textSnippet,elementTag:t.elementTag,elementId:t.elementId,textPrefix:t.textPrefix,textSuffix:t.textSuffix,fingerprint:t.fingerprint,neighborText:t.neighborText,anchorKey:t.anchorKey??null,xPct:t.xPct,yPct:t.yPct,wPct:t.wPct,hPct:t.hPct,scrollX:t.scrollX,scrollY:t.scrollY,viewportW:t.viewportW,viewportH:t.viewportH,devicePixelRatio:t.devicePixelRatio,createdAt:t.createdAt.toISOString()}}var wi="linear(0, 0.006, 0.025, 0.06, 0.11, 0.17, 0.25, 0.34, 0.45, 0.56, 0.67, 0.78, 0.88, 0.95, 1.01, 1.04, 1.05, 1.04, 1.02, 1, 0.99, 1)",ot="cubic-bezier(0.16, 1, 0.3, 1)",st="cubic-bezier(0.34, 1.56, 0.64, 1)",Ei="cubic-bezier(0.25, 1, 0.5, 1)",mn=`
154
154
  /* ---- Keyframes ---- */
155
155
 
156
156
  @keyframes sp-fab-in {
@@ -224,11 +224,11 @@ ${t.stack}`:""}`;try{let e=new WeakSet;return JSON.stringify(t,(n,i)=>{if(typeof
224
224
  /* ---- Animation classes ---- */
225
225
 
226
226
  .sp-anim-fab-in {
227
- animation: sp-fab-in 0.5s ${bi} both;
227
+ animation: sp-fab-in 0.5s ${wi} both;
228
228
  }
229
229
 
230
230
  .sp-anim-marker-in {
231
- animation: sp-marker-in 0.35s ${ot} both;
231
+ animation: sp-marker-in 0.35s ${st} both;
232
232
  }
233
233
 
234
234
  .sp-anim-pulse {
@@ -236,11 +236,11 @@ ${t.stack}`:""}`;try{let e=new WeakSet;return JSON.stringify(t,(n,i)=>{if(typeof
236
236
  }
237
237
 
238
238
  .sp-anim-flash {
239
- animation: sp-flash-bg 0.5s ${gi};
239
+ animation: sp-flash-bg 0.5s ${Ei};
240
240
  }
241
241
 
242
242
  .sp-anim-slide-up {
243
- animation: sp-slide-up 0.3s ${it} both;
243
+ animation: sp-slide-up 0.3s ${ot} both;
244
244
  }
245
245
 
246
246
  .sp-anim-fade-in {
@@ -251,7 +251,7 @@ ${t.stack}`:""}`;try{let e=new WeakSet;return JSON.stringify(t,(n,i)=>{if(typeof
251
251
 
252
252
  .sp-panel {
253
253
  transform: translateX(110%);
254
- transition: transform 0.4s ${it};
254
+ transition: transform 0.4s ${ot};
255
255
  }
256
256
 
257
257
  .sp-panel.sp-panel--open {
@@ -263,7 +263,7 @@ ${t.stack}`:""}`;try{let e=new WeakSet;return JSON.stringify(t,(n,i)=>{if(typeof
263
263
  pointer-events: none;
264
264
  transform: translate(0, 0) scale(0.8);
265
265
  transition:
266
- transform 0.35s ${ot},
266
+ transform 0.35s ${st},
267
267
  opacity 0.2s ease,
268
268
  background 0.2s ease,
269
269
  border-color 0.2s ease,
@@ -294,7 +294,7 @@ ${t.stack}`:""}`;try{let e=new WeakSet;return JSON.stringify(t,(n,i)=>{if(typeof
294
294
  }
295
295
 
296
296
  .sp-card {
297
- animation: sp-card-in 0.35s ${it} both;
297
+ animation: sp-card-in 0.35s ${ot} both;
298
298
  animation-delay: calc(var(--sp-card-i, 0) * 40ms);
299
299
  }
300
300
 
@@ -322,7 +322,7 @@ ${t.stack}`:""}`;try{let e=new WeakSet;return JSON.stringify(t,(n,i)=>{if(typeof
322
322
  }
323
323
 
324
324
  .sp-fab-badge {
325
- animation: sp-badge-in 0.4s ${ot} both;
325
+ animation: sp-badge-in 0.4s ${st} both;
326
326
  }
327
327
 
328
328
  /* ---- Reduced motion ---- */
@@ -335,7 +335,7 @@ ${t.stack}`:""}`;try{let e=new WeakSet;return JSON.stringify(t,(n,i)=>{if(typeof
335
335
  }
336
336
  }
337
337
 
338
- `;function st(t){return `
338
+ `;function rt(t){return `
339
339
  :host {
340
340
  all: initial;
341
341
  position: fixed;
@@ -348,7 +348,7 @@ ${t.stack}`:""}`;try{let e=new WeakSet;return JSON.stringify(t,(n,i)=>{if(typeof
348
348
  color-scheme: ${t.bg==="#ffffff"?"light":"dark"};
349
349
  -webkit-font-smoothing: antialiased;
350
350
  -moz-osx-font-smoothing: grayscale;
351
- ${chunkNVNA5AI2_cjs.B(t)}
351
+ ${chunkBJFC7TVL_cjs.N(t)}
352
352
 
353
353
  /* Identity modal \u2014 theme-aware backdrop + panel */
354
354
  --sp-identity-bg: ${t.glassBgHeavy};
@@ -1506,14 +1506,14 @@ ${t.stack}`:""}`;try{let e=new WeakSet;return JSON.stringify(t,(n,i)=>{if(typeof
1506
1506
  }
1507
1507
  }
1508
1508
 
1509
- ${un}
1510
- ${chunkNVNA5AI2_cjs.aa}
1511
- ${chunkNVNA5AI2_cjs.$}
1512
- ${chunkNVNA5AI2_cjs.T}
1513
- ${chunkNVNA5AI2_cjs.R}
1514
- ${chunkNVNA5AI2_cjs.ea}
1515
- ${chunkNVNA5AI2_cjs.V}
1516
- `}var yi=120,vi=80,Fe=class{constructor(e,n="en"){this.colors=e;this.locale=n;this.root=chunkNVNA5AI2_cjs.b("div",{style:`
1509
+ ${mn}
1510
+ ${chunkBJFC7TVL_cjs.da}
1511
+ ${chunkBJFC7TVL_cjs.ca}
1512
+ ${chunkBJFC7TVL_cjs.W}
1513
+ ${chunkBJFC7TVL_cjs.U}
1514
+ ${chunkBJFC7TVL_cjs.ha}
1515
+ ${chunkBJFC7TVL_cjs.Y}
1516
+ `}var ki=120,Si=80,Ne=class{constructor(e,n="en"){this.colors=e;this.locale=n;this.root=chunkBJFC7TVL_cjs.n("div",{style:`
1517
1517
  position: fixed;
1518
1518
  z-index: ${2147483647};
1519
1519
  max-width: 280px;
@@ -1531,7 +1531,7 @@ ${t.stack}`:""}`;try{let e=new WeakSet;return JSON.stringify(t,(n,i)=>{if(typeof
1531
1531
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
1532
1532
  visibility: hidden;
1533
1533
  -webkit-font-smoothing: antialiased;
1534
- `}),this.root.setAttribute("role","tooltip"),this.root.id=this.tooltipId,this.arrow=chunkNVNA5AI2_cjs.b("div",{style:`
1534
+ `}),this.root.setAttribute("role","tooltip"),this.root.id=this.tooltipId,this.arrow=chunkBJFC7TVL_cjs.n("div",{style:`
1535
1535
  position: absolute;
1536
1536
  width: 12px;
1537
1537
  height: 12px;
@@ -1539,12 +1539,12 @@ ${t.stack}`:""}`;try{let e=new WeakSet;return JSON.stringify(t,(n,i)=>{if(typeof
1539
1539
  border: 1px solid ${this.colors.glassBorder};
1540
1540
  transform: rotate(45deg);
1541
1541
  pointer-events: none;
1542
- `}),this.root.appendChild(this.arrow),this.root.addEventListener("mouseenter",()=>this.cancelHide()),this.root.addEventListener("mouseleave",()=>this.scheduleHide()),document.body.appendChild(this.root);}colors;locale;root;arrow;showTimer=null;hideTimer=null;currentFeedbackId=null;tooltipId="sp-tooltip";show(e,n){this.currentFeedbackId!==e.id&&(this.cancelHide(),this.cancelShow(),this.showTimer=setTimeout(()=>{this.currentFeedbackId=e.id,this.render(e),this.position(n);let i=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;this.root.style.transition=i?"none":"",this.root.style.visibility="visible",this.root.style.opacity="1",this.root.style.transform="translateY(0) scale(1)";},yi));}scheduleHide(){this.cancelHide(),this.hideTimer=setTimeout(()=>this.hide(),vi);}hide(){this.cancelShow(),this.currentFeedbackId=null,this.root.style.opacity="0",this.root.style.transform="translateY(6px) scale(0.97)",setTimeout(()=>{this.currentFeedbackId||(this.root.style.visibility="hidden");},200);}cancelShow(){this.showTimer&&(clearTimeout(this.showTimer),this.showTimer=null);}cancelHide(){this.hideTimer&&(clearTimeout(this.hideTimer),this.hideTimer=null);}render(e){let n=Array.from(this.root.children);for(let u of n)u!==this.arrow&&u.remove();let i=chunkNVNA5AI2_cjs.x(e.type,this.colors),o=chunkNVNA5AI2_cjs.A(e.type,this.colors),r=chunkNVNA5AI2_cjs.N(this.locale),s=chunkNVNA5AI2_cjs.P(e.type,r),a=chunkNVNA5AI2_cjs.b("div",{style:"display:flex;align-items:center;gap:8px;margin-bottom:8px;"}),l=chunkNVNA5AI2_cjs.b("span",{style:`
1542
+ `}),this.root.appendChild(this.arrow),this.root.addEventListener("mouseenter",()=>this.cancelHide()),this.root.addEventListener("mouseleave",()=>this.scheduleHide()),document.body.appendChild(this.root);}colors;locale;root;arrow;showTimer=null;hideTimer=null;currentFeedbackId=null;tooltipId="sp-tooltip";show(e,n){this.currentFeedbackId!==e.id&&(this.cancelHide(),this.cancelShow(),this.showTimer=setTimeout(()=>{this.currentFeedbackId=e.id,this.render(e),this.position(n);let i=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;this.root.style.transition=i?"none":"",this.root.style.visibility="visible",this.root.style.opacity="1",this.root.style.transform="translateY(0) scale(1)";},ki));}scheduleHide(){this.cancelHide(),this.hideTimer=setTimeout(()=>this.hide(),Si);}hide(){this.cancelShow(),this.currentFeedbackId=null,this.root.style.opacity="0",this.root.style.transform="translateY(6px) scale(0.97)",setTimeout(()=>{this.currentFeedbackId||(this.root.style.visibility="hidden");},200);}cancelShow(){this.showTimer&&(clearTimeout(this.showTimer),this.showTimer=null);}cancelHide(){this.hideTimer&&(clearTimeout(this.hideTimer),this.hideTimer=null);}render(e){let n=Array.from(this.root.children);for(let u of n)u!==this.arrow&&u.remove();let i=chunkBJFC7TVL_cjs.J(e.type,this.colors),o=chunkBJFC7TVL_cjs.M(e.type,this.colors),s=chunkBJFC7TVL_cjs.Q(this.locale),r=chunkBJFC7TVL_cjs.S(e.type,s),a=chunkBJFC7TVL_cjs.n("div",{style:"display:flex;align-items:center;gap:8px;margin-bottom:8px;"}),l=chunkBJFC7TVL_cjs.n("span",{style:`
1543
1543
  padding:3px 10px;border-radius:9999px;
1544
1544
  font-size:11px;font-weight:600;
1545
1545
  color:${i};background:${o};
1546
1546
  letter-spacing:0.02em;
1547
- `});chunkNVNA5AI2_cjs.c(l,s);let c=chunkNVNA5AI2_cjs.b("span",{style:`font-size:11px;color:${this.colors.textSecondary};margin-left:auto;`});chunkNVNA5AI2_cjs.c(c,chunkNVNA5AI2_cjs.e(e.createdAt,this.locale)),a.appendChild(l),a.appendChild(c);let p=chunkNVNA5AI2_cjs.b("div",{style:`font-size:13px;line-height:1.55;color:${this.colors.text};display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;`});chunkNVNA5AI2_cjs.c(p,e.message),this.root.insertBefore(a,this.arrow),this.root.insertBefore(p,this.arrow);}position(e){let n=this.root.getBoundingClientRect(),i=10,o=e.top-n.height-i,r=e.left+e.width/2-n.width/2,s=true;o<8&&(o=e.bottom+i,s=false),r=Math.max(8,Math.min(r,window.innerWidth-n.width-8)),this.root.style.top=`${o}px`,this.root.style.left=`${r}px`;let a=Math.max(16,Math.min(e.left+e.width/2-r-6,n.width-22));s?this.arrow.style.cssText=`
1547
+ `});chunkBJFC7TVL_cjs.o(l,r);let c=chunkBJFC7TVL_cjs.n("span",{style:`font-size:11px;color:${this.colors.textSecondary};margin-left:auto;`});chunkBJFC7TVL_cjs.o(c,chunkBJFC7TVL_cjs.q(e.createdAt,this.locale)),a.appendChild(l),a.appendChild(c);let p=chunkBJFC7TVL_cjs.n("div",{style:`font-size:13px;line-height:1.55;color:${this.colors.text};display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;`});chunkBJFC7TVL_cjs.o(p,e.message),this.root.insertBefore(a,this.arrow),this.root.insertBefore(p,this.arrow);}position(e){let n=this.root.getBoundingClientRect(),i=10,o=e.top-n.height-i,s=e.left+e.width/2-n.width/2,r=true;o<8&&(o=e.bottom+i,r=false),s=Math.max(8,Math.min(s,window.innerWidth-n.width-8)),this.root.style.top=`${o}px`,this.root.style.left=`${s}px`;let a=Math.max(16,Math.min(e.left+e.width/2-s-6,n.width-22));r?this.arrow.style.cssText=`
1548
1548
  position:absolute;
1549
1549
  width:12px;height:12px;
1550
1550
  background:${this.colors.glassBgHeavy};
@@ -1564,8 +1564,8 @@ ${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 xi(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 hn(){try{return process.env.NODE_ENV}catch{return}}function wi(t){return t===void 0||t===false?{enabled:false,param:"siteping"}:t===true?{enabled:true,param:"siteping"}:{enabled:true,param:t.param??"siteping"}}function fn(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&&hn()==="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():chunkNVNA5AI2_cjs.M(i).catch(()=>{}),r=chunkNVNA5AI2_cjs.N(i),s=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:s});let l=xi(t.captureDiagnostics),c=l.console?new Se(l.maxConsoleEntries):null,p=l.network?new Te(l.maxNetworkEntries):null,u=chunkNVNA5AI2_cjs.w(t.accentColor,t.theme),d=new re,f=new re,b=(()=>{if(t.store)return new Ie(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 ke(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=hn()==="test"?"open":"closed",w=y.attachShadow({mode:C});if("adoptedStyleSheets"in ShadowRoot.prototype){let h=new CSSStyleSheet;h.replaceSync(st(u)),w.adoptedStyleSheets=[h];}else {let h=document.createElement("style");h.textContent=st(u),w.appendChild(h);}document.body.appendChild(y);let L=Bt(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 Fe(u,i),A=new Pe(u,S,d,r,v),H=new Ce(w,t,d,r);d.on("markers:changed",h=>H.updateBadge(h));let k=null,I=null,F=false,ue=0;async function at(){return F?null:k||(I||(I=import('./panel-XUTDVTAR.cjs').then(h=>F?null:(k=new h.Panel(w,u,d,b,t.projectName,A,r,i,{getScope:a,scopeAnnotationsByUrl:s}),k))),I)}if(typeof window<"u"){let h=()=>{F||at();},m=window.requestIdleCallback;typeof m=="function"?m(h):setTimeout(h,200);}let B=false,mn=d.on("panel:toggle",h=>{k||(h?(B=true,at().then(m=>{m&&B&&m.open(),B=false;}).catch(m=>e("Failed to lazy-load panel:",m))):B=false);}),he=new we(u,d,r,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,bn=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??Ve();if(!P){if(P=await Ei(w,r),!P){d.emit("submission:cancelled");return}Zt(P);}let R=(()=>{try{return crypto.randomUUID()}catch{return `${Date.now()}-${Math.random().toString(36).slice(2)}`}})(),Q=a(),pt=null;(c||p)&&(pt={console:c?.getEntries()??[],network:p?.getEntries()??[]});let vn={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:pt};try{let D=await b.sendFeedback(vn);d.emit("feedback:sent",D),(!s||D.url===Q.url)&&A.addFeedback(D,A.count+1),v.textContent=r("feedback.sent.confirmation"),k&&await k.refresh();}catch(D){d.emit("feedback:error",D instanceof Error?D:new Error(String(D))),v.textContent=r("feedback.error.message");}}finally{_e=false;}}),Ne=a(),gn=s?{limit:20,url:Ne.url}:{limit:20},He=wi(t.deepLink),yn=++ue;Promise.all([b.getFeedbacks(t.projectName,gn),o]).then(([{feedbacks:h}])=>{if(F||ue!==yn)return;let m=s?h.filter(x=>x.url===Ne.url):h;if(A.render(m),He.enabled)try{let x=new URLSearchParams(window.location.search).get(He.param);if(x){let T=A.focusFeedback(x);e(`deepLink ?${He.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&&qt(t.endpoint,t.identity??Ve(),{apiKey:t.apiKey,headers:t.headers}).then(()=>e("Retry queue flushed")).catch(()=>{});let lt=()=>{let h=++ue;if(k?.isCurrentlyOpen)return k.refresh();let m=a(),x=s?{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=s?T.filter(j=>j.url===m.url):T;A.render(z);})},ct=null;if(t.watchNavigation!==false&&typeof window<"u"&&typeof history<"u"){let h=R=>`${R.url}
1568
- ${R.urlPattern??""}`,m=h(Ne),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"),lt().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),ct=()=>{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,ct?.(),L.destroy(),bn(),mn(),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:()=>{lt().catch(()=>{});},on:(h,m)=>f.on(h,m),off:(h,m)=>{f.off(h,m);}},pe}function Ei(t,e){return new Promise(n=>{let i=t.activeElement??document.activeElement,o=t.host;o.parentNode&&o.parentNode.appendChild(o);let r=document.createElement("div");r.style.cssText=`
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():chunkBJFC7TVL_cjs.P(i).catch(()=>{}),s=chunkBJFC7TVL_cjs.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=chunkBJFC7TVL_cjs.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=null,F=false,ue=0;async function lt(){return F?null:k||(I||(I=import('./panel-KCYUMYAI.cjs').then(h=>F?null:(k=new h.Panel(w,u,d,b,t.projectName,A,s,i,{getScope:a,scopeAnnotationsByUrl:r}),k))),I)}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
+ ${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);
1571
1571
  backdrop-filter:blur(8px);
@@ -1573,7 +1573,7 @@ ${R.urlPattern??""}`,m=h(Ne),x=()=>{if(F)return;let R=h(a());if(R===m)return;let
1573
1573
  display:flex;align-items:center;justify-content:center;
1574
1574
  z-index:${2147483647};
1575
1575
  opacity:0;transition:opacity 0.25s ease;
1576
- `;let s=document.createElement("div");s.style.cssText=`
1576
+ `;let r=document.createElement("div");r.style.cssText=`
1577
1577
  width:340px;padding:28px;border-radius:var(--sp-radius-xl);
1578
1578
  background:var(--sp-identity-bg);
1579
1579
  backdrop-filter:blur(var(--sp-blur-heavy));
@@ -1585,5 +1585,5 @@ ${R.urlPattern??""}`,m=h(Ne),x=()=>{if(F)return;let R=h(a());if(R===m)return;let
1585
1585
  transform:translateY(12px) scale(0.97);
1586
1586
  transition:transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
1587
1587
  -webkit-font-smoothing:antialiased;
1588
- `;let a=`sp-identity-title-${Date.now()}`;s.setAttribute("role","dialog"),s.setAttribute("aria-modal","true"),s.setAttribute("aria-labelledby",a);let l=document.createElement("div");l.className="sp-identity-title",l.id=a,l.textContent=e("identity.title"),l.style.marginBottom="20px";let c=`sp-identity-name-${Date.now()}`,p=`sp-identity-email-${Date.now()}`,u=document.createElement("label");u.className="sp-input-label",u.textContent=e("identity.nameLabel"),u.setAttribute("for",c);let d=document.createElement("input");d.className="sp-input",d.id=c,d.type="text",d.placeholder=e("identity.namePlaceholder"),d.style.marginBottom="14px";let f=document.createElement("label");f.className="sp-input-label",f.textContent=e("identity.emailLabel"),f.setAttribute("for",p);let b=document.createElement("input");b.className="sp-input",b.id=p,b.type="email",b.placeholder=e("identity.emailPlaceholder");let M=document.createElement("div");M.style.cssText="display:flex;gap:8px;justify-content:flex-end;margin-top:20px;";let y=v=>{r.removeEventListener("keydown",L),r.style.opacity="0",s.style.transform="translateY(12px) scale(0.97)",setTimeout(()=>{r.remove(),i?.focus(),n(v);},250);},C=document.createElement("button");C.className="sp-btn-ghost",C.textContent=e("identity.cancel"),C.addEventListener("click",()=>y(null));let w=document.createElement("button");w.className="sp-btn-primary",w.textContent=e("identity.submit"),w.addEventListener("click",()=>{let v=d.value.trim(),S=b.value.trim();if(!v||!S)return;if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(S)){b.style.borderColor="var(--sp-type-bug, #ef4444)";return}y({name:v,email:S});});let J='input, button, [tabindex]:not([tabindex="-1"])',L=v=>{let S=v;if(S.key==="Escape"){y(null);return}if(S.key==="Tab"){let A=Array.from(s.querySelectorAll(J));if(A.length===0)return;let H=A[0],k=A[A.length-1];if(!H||!k)return;let I=t.activeElement;S.shiftKey?(I===H||!s.contains(I))&&(S.preventDefault(),k.focus()):(I===k||!s.contains(I))&&(S.preventDefault(),H.focus());}};r.addEventListener("keydown",L),r.addEventListener("click",v=>{v.target===r&&y(null);}),M.appendChild(C),M.appendChild(w),s.appendChild(l),s.appendChild(u),s.appendChild(d),s.appendChild(f),s.appendChild(b),s.appendChild(M),r.appendChild(s),t.appendChild(r),requestAnimationFrame(()=>{r.style.opacity="1",s.style.transform="translateY(0) scale(1)",d.focus();});})}function Vo(t){return fn(t)}Object.defineProperty(exports,"loadLocale",{enumerable:true,get:function(){return chunkNVNA5AI2_cjs.M}});Object.defineProperty(exports,"registerLocale",{enumerable:true,get:function(){return chunkNVNA5AI2_cjs.L}});exports.initSiteping=Vo;//# sourceMappingURL=index.cjs.map
1588
+ `;let a=`sp-identity-title-${Date.now()}`;r.setAttribute("role","dialog"),r.setAttribute("aria-modal","true"),r.setAttribute("aria-labelledby",a);let l=document.createElement("div");l.className="sp-identity-title",l.id=a,l.textContent=e("identity.title"),l.style.marginBottom="20px";let c=`sp-identity-name-${Date.now()}`,p=`sp-identity-email-${Date.now()}`,u=document.createElement("label");u.className="sp-input-label",u.textContent=e("identity.nameLabel"),u.setAttribute("for",c);let d=document.createElement("input");d.className="sp-input",d.id=c,d.type="text",d.placeholder=e("identity.namePlaceholder"),d.style.marginBottom="14px";let f=document.createElement("label");f.className="sp-input-label",f.textContent=e("identity.emailLabel"),f.setAttribute("for",p);let b=document.createElement("input");b.className="sp-input",b.id=p,b.type="email",b.placeholder=e("identity.emailPlaceholder");let M=document.createElement("div");M.style.cssText="display:flex;gap:8px;justify-content:flex-end;margin-top:20px;";let y=v=>{s.removeEventListener("keydown",L),s.style.opacity="0",r.style.transform="translateY(12px) scale(0.97)",setTimeout(()=>{s.remove(),i?.focus(),n(v);},250);},C=document.createElement("button");C.className="sp-btn-ghost",C.textContent=e("identity.cancel"),C.addEventListener("click",()=>y(null));let w=document.createElement("button");w.className="sp-btn-primary",w.textContent=e("identity.submit"),w.addEventListener("click",()=>{let v=d.value.trim(),S=b.value.trim();if(!(!v||!S)){if(!chunkBJFC7TVL_cjs.a(S)){b.style.borderColor="var(--sp-type-bug, #ef4444)";return}y({name:v,email:S});}});let J='input, button, [tabindex]:not([tabindex="-1"])',L=v=>{let S=v;if(S.key==="Escape"){y(null);return}if(S.key==="Tab"){let A=Array.from(r.querySelectorAll(J));if(A.length===0)return;let H=A[0],k=A[A.length-1];if(!H||!k)return;let I=t.activeElement;S.shiftKey?(I===H||!r.contains(I))&&(S.preventDefault(),k.focus()):(I===k||!r.contains(I))&&(S.preventDefault(),H.focus());}};s.addEventListener("keydown",L),s.addEventListener("click",v=>{v.target===s&&y(null);}),M.appendChild(C),M.appendChild(w),r.appendChild(l),r.appendChild(u),r.appendChild(d),r.appendChild(f),r.appendChild(b),r.appendChild(M),s.appendChild(r),t.appendChild(s),requestAnimationFrame(()=>{s.style.opacity="1",r.style.transform="translateY(0) scale(1)",d.focus();});})}function ns(t){return gn(t)}Object.defineProperty(exports,"loadLocale",{enumerable:true,get:function(){return chunkBJFC7TVL_cjs.P}});Object.defineProperty(exports,"registerLocale",{enumerable:true,get:function(){return chunkBJFC7TVL_cjs.O}});exports.initSiteping=ns;//# sourceMappingURL=index.cjs.map
1589
1589
  //# sourceMappingURL=index.cjs.map