@siteping/widget 0.10.10 → 0.11.1

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 (126) hide show
  1. package/README.md +5 -4
  2. package/dist/chunk-26577FDQ.js +9 -0
  3. package/dist/chunk-26577FDQ.js.map +1 -0
  4. package/dist/chunk-3EHIWTJH.js +9 -0
  5. package/dist/chunk-3EHIWTJH.js.map +1 -0
  6. package/dist/chunk-6MCFOKVG.cjs +9 -0
  7. package/dist/chunk-6MCFOKVG.cjs.map +1 -0
  8. package/dist/chunk-Q34GDCKE.cjs +9 -0
  9. package/dist/chunk-Q34GDCKE.cjs.map +1 -0
  10. package/dist/concurrency.d.cts +14 -0
  11. package/dist/concurrency.d.ts +14 -0
  12. package/dist/de-73CTH2E4.cjs +2 -0
  13. package/dist/de-73CTH2E4.cjs.map +1 -0
  14. package/dist/de-GUUJUHYP.js +2 -0
  15. package/dist/de-GUUJUHYP.js.map +1 -0
  16. package/dist/deep-link.d.cts +14 -0
  17. package/dist/deep-link.d.ts +14 -0
  18. package/dist/email.d.cts +6 -3
  19. package/dist/email.d.ts +6 -3
  20. package/dist/errors.d.cts +18 -4
  21. package/dist/errors.d.ts +18 -4
  22. package/dist/{es-HEVFJPRI.js → es-3MXMSDUC.js} +2 -2
  23. package/dist/es-3MXMSDUC.js.map +1 -0
  24. package/dist/{es-5XQA3TPT.cjs → es-WJZ3XARH.cjs} +2 -2
  25. package/dist/es-WJZ3XARH.cjs.map +1 -0
  26. package/dist/filters.d.cts +31 -7
  27. package/dist/filters.d.ts +31 -7
  28. package/dist/fr-52F3ZCLQ.js +2 -0
  29. package/dist/fr-52F3ZCLQ.js.map +1 -0
  30. package/dist/fr-ZCRIJWI3.cjs +2 -0
  31. package/dist/fr-ZCRIJWI3.cjs.map +1 -0
  32. package/dist/i18n.d.cts +18 -0
  33. package/dist/i18n.d.ts +18 -0
  34. package/dist/index.cjs +3 -1588
  35. package/dist/index.cjs.map +1 -1
  36. package/dist/index.d.cts +12 -1
  37. package/dist/index.d.ts +12 -1
  38. package/dist/index.global.js +4 -3389
  39. package/dist/index.global.js.map +1 -1
  40. package/dist/index.js +3 -1588
  41. package/dist/index.js.map +1 -1
  42. package/dist/it-MEUT3RCC.js +2 -0
  43. package/dist/it-MEUT3RCC.js.map +1 -0
  44. package/dist/it-TGUTW6MO.cjs +2 -0
  45. package/dist/it-TGUTW6MO.cjs.map +1 -0
  46. package/dist/ja-DOS7AWLW.cjs +2 -0
  47. package/dist/ja-DOS7AWLW.cjs.map +1 -0
  48. package/dist/ja-U7NRNGPQ.js +2 -0
  49. package/dist/ja-U7NRNGPQ.js.map +1 -0
  50. package/dist/ko-U2CS6XQ4.js +2 -0
  51. package/dist/ko-U2CS6XQ4.js.map +1 -0
  52. package/dist/ko-ZUL567LW.cjs +2 -0
  53. package/dist/ko-ZUL567LW.cjs.map +1 -0
  54. package/dist/panel-3BEMZFIR.cjs +2 -0
  55. package/dist/panel-3BEMZFIR.cjs.map +1 -0
  56. package/dist/panel-HPDIAYLQ.js +2 -0
  57. package/dist/panel-HPDIAYLQ.js.map +1 -0
  58. package/dist/panel-MIWFGD7X.cjs +2 -0
  59. package/dist/panel-MIWFGD7X.cjs.map +1 -0
  60. package/dist/panel-XTNU6XHV.js +2 -0
  61. package/dist/panel-XTNU6XHV.js.map +1 -0
  62. package/dist/pt-BZRBHCYN.cjs +2 -0
  63. package/dist/pt-BZRBHCYN.cjs.map +1 -0
  64. package/dist/pt-MOS5DVOG.js +2 -0
  65. package/dist/pt-MOS5DVOG.js.map +1 -0
  66. package/dist/react.cjs +3 -1588
  67. package/dist/react.cjs.map +1 -1
  68. package/dist/react.js +3 -1588
  69. package/dist/react.js.map +1 -1
  70. package/dist/ru-KDNRHHNZ.cjs +2 -0
  71. package/dist/ru-KDNRHHNZ.cjs.map +1 -0
  72. package/dist/ru-VSWB5NKK.js +2 -0
  73. package/dist/ru-VSWB5NKK.js.map +1 -0
  74. package/dist/schema.d.cts +54 -0
  75. package/dist/schema.d.ts +54 -0
  76. package/dist/screenshot-storage.d.cts +61 -19
  77. package/dist/screenshot-storage.d.ts +61 -19
  78. package/dist/siteping-core.d.cts +9 -6
  79. package/dist/siteping-core.d.ts +9 -6
  80. package/dist/store-helpers.d.cts +59 -15
  81. package/dist/store-helpers.d.ts +59 -15
  82. package/dist/type-utils.d.cts +8 -0
  83. package/dist/type-utils.d.ts +8 -0
  84. package/dist/types.d.cts +399 -33
  85. package/dist/types.d.ts +399 -33
  86. package/dist/wire.d.cts +35 -2
  87. package/dist/wire.d.ts +35 -2
  88. package/package.json +5 -3
  89. package/dist/chunk-AFLWWD6M.cjs +0 -1796
  90. package/dist/chunk-AFLWWD6M.cjs.map +0 -1
  91. package/dist/chunk-ATTI2TS4.js +0 -1796
  92. package/dist/chunk-ATTI2TS4.js.map +0 -1
  93. package/dist/chunk-BP5TH2CD.js +0 -1796
  94. package/dist/chunk-BP5TH2CD.js.map +0 -1
  95. package/dist/chunk-OSADAHGS.cjs +0 -1796
  96. package/dist/chunk-OSADAHGS.cjs.map +0 -1
  97. package/dist/de-AZUOIGF2.cjs +0 -2
  98. package/dist/de-AZUOIGF2.cjs.map +0 -1
  99. package/dist/de-MAGIJBFC.js +0 -2
  100. package/dist/de-MAGIJBFC.js.map +0 -1
  101. package/dist/es-5XQA3TPT.cjs.map +0 -1
  102. package/dist/es-HEVFJPRI.js.map +0 -1
  103. package/dist/fr-ERYSAH32.cjs +0 -2
  104. package/dist/fr-ERYSAH32.cjs.map +0 -1
  105. package/dist/fr-OM2PHLDH.js +0 -2
  106. package/dist/fr-OM2PHLDH.js.map +0 -1
  107. package/dist/it-NXAZR4K6.cjs +0 -2
  108. package/dist/it-NXAZR4K6.cjs.map +0 -1
  109. package/dist/it-OQVYHKKV.js +0 -2
  110. package/dist/it-OQVYHKKV.js.map +0 -1
  111. package/dist/panel-2FEECS2N.cjs +0 -2
  112. package/dist/panel-2FEECS2N.cjs.map +0 -1
  113. package/dist/panel-CSFFA5FF.cjs +0 -2
  114. package/dist/panel-CSFFA5FF.cjs.map +0 -1
  115. package/dist/panel-S2UR5BSD.js +0 -2
  116. package/dist/panel-S2UR5BSD.js.map +0 -1
  117. package/dist/panel-SGSUHR7V.js +0 -2
  118. package/dist/panel-SGSUHR7V.js.map +0 -1
  119. package/dist/pt-CODDT6VY.cjs +0 -2
  120. package/dist/pt-CODDT6VY.cjs.map +0 -1
  121. package/dist/pt-VUUNL42H.js +0 -2
  122. package/dist/pt-VUUNL42H.js.map +0 -1
  123. package/dist/ru-72WUEADV.cjs +0 -2
  124. package/dist/ru-72WUEADV.cjs.map +0 -1
  125. package/dist/ru-NDWY7Y36.js +0 -2
  126. package/dist/ru-NDWY7Y36.js.map +0 -1
package/dist/react.js CHANGED
@@ -1,1589 +1,4 @@
1
- import {O,P,I,i,h,l,k,j,ca,ba,V as V$1,T,ga,X,N,n,J,M,R,o,q as q$1,g,Q,G as G$1,H,t,s,m,r,u,a,c,b,x,y,z,A,d}from'./chunk-ATTI2TS4.js';import {useRef,useState,useEffect}from'react';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},r=Fn(o.root,n),s,a=0;for(let c of Mn(t,o,r)){if(new Date().getTime()-i.getTime()>o.timeoutMs||a>=o.maxNumberOfPathChecks){let u=Pn(t,r);if(!u)throw new Error(`Timeout: Can't find a unique selector after ${o.timeoutMs}ms`);return ne(u)}if(a++,Xe(c,r)){s=c;break}}if(!s)throw new Error("Selector was not found.");let l=[...Dt(s,t,o,r,i)];return l.sort(ze),l.length>0?ne(l[0]):ne(s)}function*Mn(t,e,n){let i=[],o=[],r=t,s=0;for(;r&&r!==n;){let a=Ln(r,e);for(let l of a)l.level=s;if(i.push(a),r=r.parentElement,s++,o.push(...Ht(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 Ln(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:_t(o,s),penalty:10});}let r=je(t);return r!==void 0&&n.push({name:In(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 Ft(t){return t.map(e=>e.penalty).reduce((e,n)=>e+n,0)}function ze(t,e){return Ft(t)-Ft(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 Pn(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:_t(r,s),penalty:NaN,level:n}),i=i.parentElement,n++;}if(Xe(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 Xe(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 r=1;r<t.length-1;r++){if(new Date().getTime()-o.getTime()>n.timeoutMs)return;let a=[...t];a.splice(r,1),Xe(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 Ke(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 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,r]=n,s=Number(i),a=Number(o);if(Number.isNaN(s)||Number.isNaN(a))return 0;let l=Ke(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"?Hn(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 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 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 $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 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=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),r=U(t,"before"),s=U(t,"after"),a=Ke(t),l=ve(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 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 r=o;for(;r&&r!==document.body;){if(r.hasAttribute(ie)&&Bt(r,t))return r;r=r.parentElement;}for(r=o;r&&r!==document.body;){if(Bt(r,t))return r;r=r.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 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 Xt(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 Dn={question:"type.question",change:"type.change",bug:"type.bug",other:"type.other"};function On(){let t=navigator.userAgentData;return t?t.platform==="macOS":navigator.platform?.includes("Mac")??/Macintosh|Mac OS X/i.test(navigator.userAgent)}var xe=class{constructor(e,n$1){this.colors=e;this.t=n$1;this.root=n("div",{style:`
2
- position:fixed;
3
- z-index:${2147483647};
4
- width:300px;
5
- padding:16px;
6
- border-radius:16px;
7
- background:${this.colors.glassBg};
8
- backdrop-filter:blur(24px);
9
- -webkit-backdrop-filter:blur(24px);
10
- border:1px solid ${this.colors.glassBorder};
11
- box-shadow:0 8px 32px ${this.colors.shadow}, 0 2px 8px ${this.colors.shadow};
12
- font-family:"Inter",system-ui,-apple-system,sans-serif;
13
- opacity:0;
14
- transform:translateY(8px) scale(0.98);
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
- display:none;
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:x},{type:"change",icon:y},{type:"bug",icon:z},{type:"other",icon:A}];this.typeRow=n("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=`
19
- height:44px;
20
- border-radius:9999px;border:1px solid ${this.colors.border};
21
- background:${this.colors.glassBg};cursor:pointer;
22
- display:flex;align-items:center;justify-content:center;gap:5px;
23
- font-family:"Inter",system-ui,-apple-system,sans-serif;
24
- font-size:13px;font-weight:500;color:${this.colors.textTertiary};
25
- transition:all 0.2s ease;
26
- padding:0 12px;
27
- `;let a=m(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=M(s.dataset.type??"",this.colors);s.style.background=l,s.style.borderColor=J(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=`
28
- width:100%;min-height:72px;max-height:152px;
29
- padding:10px 12px;border-radius:12px;
30
- border:1px solid ${this.colors.border};
31
- background:${this.colors.glassBgHeavy};
32
- color:${this.colors.text};font-family:"Inter",system-ui,-apple-system,sans-serif;
33
- font-size:13px;line-height:1.5;resize:vertical;
34
- outline:none;transition:all 0.2s ease;
35
- box-sizing:border-box;
36
- `,this.textarea.maxLength=5e3,this.hint=n("div",{style:`
37
- font-size:11px;color:${this.colors.textTertiary};
38
- text-align:right;margin-top:4px;
39
- font-family:"Inter",system-ui,-apple-system,sans-serif;
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=n("div",{style:"display:flex;justify-content:flex-end;gap:8px;margin-top:12px;"});this.cancelBtn=document.createElement("button"),this.cancelBtn.style.cssText=`
42
- height:34px;padding:0 16px;border-radius:9999px;
43
- border:1px solid ${this.colors.border};
44
- background:${this.colors.glassBg};
45
- color:${this.colors.textTertiary};font-family:"Inter",system-ui,-apple-system,sans-serif;
46
- font-size:13px;font-weight:500;cursor:pointer;
47
- transition:all 0.2s ease;
48
- `,this.cancelBtn.addEventListener("click",()=>this.cancel()),this.cancelBtn.addEventListener("mouseenter",()=>{this.submittingState||(this.cancelBtn.style.borderColor=this.colors.accent,this.cancelBtn.style.color=this.colors.accent);}),this.cancelBtn.addEventListener("mouseleave",()=>{this.submittingState||(this.cancelBtn.style.borderColor=this.colors.border,this.cancelBtn.style.color=this.colors.textTertiary);}),this.submitBtn=document.createElement("button"),this.submitBtn.style.cssText=`
49
- height:34px;padding:0 18px;border-radius:9999px;
50
- border:none;background:${this.colors.accentGradient};
51
- color:#fff;font-family:"Inter",system-ui,-apple-system,sans-serif;
52
- font-size:13px;font-weight:600;cursor:pointer;
53
- opacity:0.35;pointer-events:none;
54
- transition:all 0.2s ease;
55
- box-shadow:0 2px 8px ${this.colors.accentGlow};
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$1=Dn[i];if(!o$1)continue;let r=n.querySelector("span");r&&o(r,this.t(o$1));}this.textarea.placeholder=this.t("popup.placeholder"),this.textarea.setAttribute("aria-label",this.t("popup.textareaAria")),o(this.hint,On()?this.t("popup.submitHintMac"):this.t("popup.submitHintOther")),o(this.cancelBtn,this.t("popup.cancel")),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,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=J(o.dataset.type??"",this.colors),a=M(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=`
58
- width:14px;height:14px;
59
- border:2px solid rgba(255,255,255,0.35);
60
- border-top-color:#fff;
61
- border-radius:50%;
62
- box-sizing:border-box;
63
- `,!(typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)&&typeof e.animate=="function"&&(this.spinnerAnimation=e.animate([{transform:"rotate(0deg)"},{transform:"rotate(360deg)"}],{duration:600,iterations:1/0,easing:"linear"})),e}hideElement(){this.onKeydownTrap&&(this.root.removeEventListener("keydown",this.onKeydownTrap),this.onKeydownTrap=null),this.submittingState&&this.exitSubmittingState(),this.onSubmit=null,this.root.style.opacity="0",this.root.style.transform="translateY(8px) scale(0.98)",this.previouslyFocused?.focus(),this.previouslyFocused=null,setTimeout(()=>{this.root.style.display="none";},250);}destroy(){this.submittingState&&this.exitSubmittingState(),this.resolve?.(null),this.resolve=null,this.onSubmit=null,this.onKeydownTrap&&(this.root.removeEventListener("keydown",this.onKeydownTrap),this.onKeydownTrap=null),this.root.remove();}};var oe,Kt=false;async function $n(){if(oe!==void 0)return oe;try{let t=await import('html2canvas-pro');return oe=t.default??t,oe}catch(t){return oe=null,Kt||(Kt=true,console.warn("[siteping] html2canvas-pro import failed unexpectedly. Capture is disabled for this session \u2014 feedbacks are still submitted, just without screenshots. Underlying error:",t)),null}}function Ue(t,e,n){return Math.min(n,Math.max(t,e))}function we(t){return Ue(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,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: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,r){this.colors=e;this.bus=n;this.t=i;this.enableScreenshot=o;this.getFallbackTarget=r;this.popup=new xe(e,i),this.bus.on("annotation:start",()=>this.activate());}colors;bus;t;enableScreenshot;getFallbackTarget;overlay=null;toolbar=null;drawingRect=null;startX=0;startY=0;isDrawing=false;isActive=false;instantMode=false;popup;savedOverflow="";preActiveFocusElement=null;keyboardTarget=null;rafId=null;pendingMoveEvent=null;rejectPendingSubmission=null;get isBusy(){return this.isActive}refreshLabels(){this.popup.refreshLabels();}async maybeCapture(e){return this.enableScreenshot?Yt(e):null}activate(){if(this.isActive)return;this.isActive=true;let e=!this.instantMode;this.preActiveFocusElement=document.activeElement;let n$1=document.activeElement;if(this.keyboardTarget=n$1 instanceof HTMLElement&&n$1!==document.body&&n$1!==document.documentElement&&!qe(n$1)?n$1:this.getFallbackTarget?.()??null,this.savedOverflow=document.body.style.overflow,document.body.style.overflow="hidden",this.overlay=n("div",{style:`
64
- position:fixed;inset:0;
65
- z-index:${2147483646};
66
- background:rgba(15, 23, 42, 0.04);
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=n("div",{style:`
69
- position:fixed;top:0;left:0;right:0;
70
- z-index:${2147483647};
71
- height:52px;
72
- background:${this.colors.glassBg};
73
- backdrop-filter:blur(24px);
74
- -webkit-backdrop-filter:blur(24px);
75
- border-bottom:1px solid ${this.colors.glassBorder};
76
- display:flex;align-items:center;justify-content:center;gap:16px;
77
- font-family:"Inter",system-ui,-apple-system,sans-serif;
78
- font-size:14px;color:${this.colors.text};
79
- box-shadow:0 4px 16px ${this.colors.shadow};
80
- -webkit-font-smoothing:antialiased;
81
- `}),this.toolbar.setAttribute("data-siteping-ignore","true");let i=n("span",{style:`
82
- width:8px;height:8px;border-radius:50%;
83
- background:${this.colors.accent};
84
- box-shadow:0 0 8px ${this.colors.accentGlow};
85
- animation:pulse 1.5s ease-in-out infinite;
86
- `}),o$1=document.createElement("style");o$1.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$1);let r=n("span",{style:"font-weight:500;letter-spacing:-0.01em;"});o(r,this.t("annotator.instruction"));let s=document.createElement("button");s.style.cssText=`
87
- height:34px;padding:0 18px;border-radius:9999px;
88
- border:1px solid ${this.colors.border};
89
- background:${this.colors.glassBg};
90
- color:${this.colors.textTertiary};font-family:"Inter",system-ui,-apple-system,sans-serif;
91
- font-size:13px;font-weight:500;cursor:pointer;
92
- transition:all 0.2s ease;
93
- `,o(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=n("div",{style:`
94
- position:fixed;
95
- border:2px solid ${this.colors.accent};
96
- background:${this.colors.accent}12;
97
- pointer-events:none;
98
- border-radius:8px;
99
- box-shadow:0 0 16px ${this.colors.accentGlow};
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$1){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$1-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=n("div",{style:`
102
- position:fixed;
103
- left:${i}px;
104
- top:${o}px;
105
- width:${20}px;
106
- height:${20}px;
107
- border:2px solid ${this.colors.accent};
108
- background:${this.colors.accent}12;
109
- pointer-events:none;
110
- border-radius:8px;
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=zt(e);this.overlay&&(this.overlay.style.pointerEvents="auto");let i=We(n),o=n.getBoundingClientRect(),r=jt(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 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,r=setTimeout(()=>o.abort(),zn);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")}function Xn(t){return t instanceof c||t instanceof 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 d(t,"endpoint")&&typeof t.endpoint=="string"&&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=[],r=[],s=0;for(let p of i){if(p.endpoint!==t){r.push(p);continue}!e||Wt(p.payload.authorName)===Wt(e.name)&&qt(p.payload.authorEmail)===qt(e.email)?o.push(p):s+=1;}if(o.length===0&&s===0)return;s>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=r.concat(a);c.length>0?localStorage.setItem(ke,JSON.stringify(c)):localStorage.removeItem(ke);}catch{}});}async function Ge(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 r;try{r=await se(this.endpoint,{method:"POST",headers:await G(this.auth,!0),body:JSON.stringify(o)});}catch(s){throw l(s,"Failed to send feedback")}if(!r.ok)throw await k(r,"Failed to send feedback");return Ge(r)}catch(r){throw Xn(r)&&qn(this.endpoint,o),r}}async getFeedbacks(e,n){let i=j({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 l(r,"Failed to fetch feedbacks")}if(!o.ok)throw await k(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 l(o,"Failed to update feedback")}if(!i.ok)throw await k(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 l(i,"Failed to delete feedback")}if(!n.ok)throw await 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 l(i,"Failed to delete all feedbacks")}if(!n.ok)throw await 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,r=function(...s){try{o.push(n,s);}catch{}i.apply(this??console,s);};try{Object.defineProperty(r,"name",{value:n});}catch{}this.wrappers.set(n,r),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: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 r=new Date,s=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-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}};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,r=new WeakMap,s=function(l,c,...p){try{r.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=r.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=s,this.wrappedXhrSend=a,e.open=s,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(r){console.error(`[siteping] Error in event listener for "${String(e)}":`,r);}}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 r$1=n.position??"bottom-right",s$1=r$1==="bottom-right";this.items=[{id:"chat",icon:G$1},{id:"annotate",icon:H}],n.showAnnotationsToggle!==false&&this.items.push({id:"toggle-annotations",icon:s,iconAlt:t}),this.fab=document.createElement("button"),this.fab.className=`sp-fab sp-fab--${r$1} sp-anim-fab-in`,this.fab.style.position="fixed",this.fab.appendChild(m(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--${r$1}`,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(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=s$1?"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$1=Jn[i];if(!o$1)continue;let r=this.t(o$1);n.setAttribute("aria-label",r);let s=n.querySelector(".sp-radial-label");s&&o(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);o(this.badgeEl,n),this.badgeEl.setAttribute("aria-label",Q(this.t,"fab.badge",{count:e}));}toggle(){this.isOpen?this.close():this.open();}open(){this.isOpen=true,this.setFabIcon(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(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(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=m(this.annotationsVisible?s:t);i.replaceWith(o);}break}}}destroy(){document.removeEventListener("click",this.onDocumentClick),this.root.remove();}};var Qt="siteping_identity";function Qn(t){if(!d(t,"name")||!d(t,"email"))return false;let{name:e,email:n}=t;return typeof e=="string"&&typeof n=="string"&&e.length>0&&a(n)}function Ve(){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 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-ei(t,e)/n}function ti(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 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 r=ae(i,e);return r>=n?r: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,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 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 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 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,et=500,si=.5,Ze=.6,ri=.4,ai=2e3,Qe=.8,Je=.6,li=.05;function Me(t,e){return V((t??"").slice(0,ai)).slice(0,e)}function ci(t){let e=Me(t.textSnippet,et),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 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 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,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,Re);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,Re);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,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 r=0;r<o;r++){let s=i.snapshotItem(r);s instanceof Element&&n(s,"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(":"),r=o.length===3?Number(o[0]):Number.NaN,s=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,et)),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(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,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: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 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)>=Ze||(e.context??0)>=Ze||(e.neighbor??0)>=Ze}function fi(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=nn(r,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 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(ve(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 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/Qe)}function Le(t,e,n){let i=pi(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 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$1,i,o,r=null){this.colors=e;this.tooltip=n$1;this.bus=i;this.t=o;this.liveRegion=r;this.container=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",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)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},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=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(tt(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);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=Q(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=Le(tt(o),Pe(o));if(!r)continue;let s=dn(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)<vi&&(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)*fn,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*fn}px`,c.style.zIndex=String(10+l));}}addClusterBadge(e){let n$1=ce(e,e.entries.length-1);if(!n$1)return;let i=n("div",{class:"sp-cluster-badge",style:`
114
- position:absolute;top:-6px;right:-6px;
115
- min-width:16px;height:16px;padding:0 4px;
116
- border-radius:9999px;
117
- background:${this.colors.accent};color:#fff;
118
- font-size:10px;font-weight:700;
119
- display:flex;align-items:center;justify-content:center;
120
- border:1.5px solid #fff;
121
- pointer-events:none;
122
- font-family:"Inter",system-ui,-apple-system,sans-serif;
123
- line-height:1;
124
- `});o(i,String(e.entries.length)),n$1.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=g(i.status);n<yi&&!o?(e.style.borderStyle="dashed",e.style.opacity="0.7",e.title=Q(this.t,"marker.approximate",{confidence:Math.round(n*100)})):(e.style.borderStyle="solid",e.style.opacity="1",e.title="");}createMarker(e,n$1,i){let o$1=J(n$1.type,this.colors),r=g(n$1.status),s=n("div",{style:`
125
- position:absolute;
126
- top:${i.top}px;
127
- left:${i.left}px;
128
- width:26px;height:26px;
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$1};
132
- display:flex;align-items:center;justify-content:center;
133
- font-family:"Inter",system-ui,-apple-system,sans-serif;
134
- font-size:11px;font-weight:700;
135
- color:${r?"#94a3b8":o$1};
136
- cursor:pointer;pointer-events:auto;
137
- box-shadow:${r?"0 2px 8px rgba(0,0,0,0.06)":`0 2px 12px ${o$1}25, 0 2px 6px rgba(0,0,0,0.06)`};
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
- user-select:none;
140
- -webkit-font-smoothing:antialiased;
141
- `});s.dataset.feedbackId=n$1.id,s.setAttribute("tabindex","0"),s.setAttribute("role","button");let a=n$1.message.length>60?`${n$1.message.slice(0,60)}...`:n$1.message,l=Q(this.t,"marker.aria",{number:e,type:R(n$1.type,this.t),message:a});s.setAttribute("aria-label",l),s.setAttribute("aria-describedby",this.tooltip.tooltipId),o(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$1}35, 0 4px 12px rgba(0,0,0,0.08)`,this.tooltip.show(n$1,s.getBoundingClientRect()),this.pinnedFeedback||this.showHighlight(n$1);}),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$1}25, 0 2px 6px rgba(0,0,0,0.06)`,this.tooltip.scheduleHide(),this.pinnedFeedback||this.clearHighlight();}),s.addEventListener("focus",()=>{this.tooltip.show(n$1,s.getBoundingClientRect()),this.pinnedFeedback||this.showHighlight(n$1);}),s.addEventListener("blur",()=>{this.tooltip.scheduleHide(),this.pinnedFeedback||this.clearHighlight();});let c=p=>{p instanceof MouseEvent&&this.handleClusterClick(s,p)||(this.pinHighlight(n$1),this.bus.emit("panel:toggle",true),s.dispatchEvent(new CustomEvent("sp-marker-click",{detail:{feedbackId:n$1.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$1 of e.annotations){let i=Le(tt(n$1),Pe(n$1));if(!i)continue;let o=J(e.type,this.colors),r=i.rect,s=n("div",{style:`
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;
146
- border:2px solid ${o};
147
- background:${o}0c;
148
- border-radius:8px;
149
- pointer-events:none;z-index:-1;
150
- opacity:0;
151
- box-shadow:0 0 16px ${o}20;
152
- transition:opacity ${un}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(),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(i),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,h(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(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)",it="cubic-bezier(0.16, 1, 0.3, 1)",ot="cubic-bezier(0.34, 1.56, 0.64, 1)",Ei="cubic-bezier(0.25, 1, 0.5, 1)",mn=`
154
- /* ---- Keyframes ---- */
155
-
156
- @keyframes sp-fab-in {
157
- from {
158
- transform: scale(0) rotate(-180deg);
159
- opacity: 0;
160
- }
161
- to {
162
- transform: scale(1) rotate(0deg);
163
- opacity: 1;
164
- }
165
- }
166
-
167
- @keyframes sp-fab-glow {
168
- 0%, 100% { box-shadow: 0 4px 20px var(--sp-accent-glow), 0 2px 8px rgba(0, 0, 0, 0.08); }
169
- 50% { box-shadow: 0 4px 28px var(--sp-accent-glow), 0 2px 12px rgba(0, 0, 0, 0.1); }
170
- }
171
-
172
- @keyframes sp-marker-in {
173
- 0% {
174
- transform: scale(0);
175
- opacity: 0;
176
- }
177
- 60% {
178
- transform: scale(1.2);
179
- opacity: 1;
180
- }
181
- 100% {
182
- transform: scale(1);
183
- }
184
- }
185
-
186
- @keyframes sp-pulse-ring {
187
- 0% {
188
- box-shadow: 0 0 0 0 var(--sp-accent-glow);
189
- }
190
- 70% {
191
- box-shadow: 0 0 0 8px transparent;
192
- }
193
- 100% {
194
- box-shadow: 0 0 0 0 transparent;
195
- }
196
- }
197
-
198
- @keyframes sp-flash-bg {
199
- 0% { background-color: var(--sp-accent-light); }
200
- 100% { background-color: transparent; }
201
- }
202
-
203
- @keyframes sp-slide-up {
204
- from {
205
- transform: translateY(8px);
206
- opacity: 0;
207
- }
208
- to {
209
- transform: translateY(0);
210
- opacity: 1;
211
- }
212
- }
213
-
214
- @keyframes sp-fade-in {
215
- from { opacity: 0; }
216
- to { opacity: 1; }
217
- }
218
-
219
- @keyframes sp-shimmer {
220
- 0% { background-position: -200% 0; }
221
- 100% { background-position: 200% 0; }
222
- }
223
-
224
- /* ---- Animation classes ---- */
225
-
226
- .sp-anim-fab-in {
227
- animation: sp-fab-in 0.5s ${wi} both;
228
- }
229
-
230
- .sp-anim-marker-in {
231
- animation: sp-marker-in 0.35s ${ot} both;
232
- }
233
-
234
- .sp-anim-pulse {
235
- animation: sp-pulse-ring 0.7s ease-out;
236
- }
237
-
238
- .sp-anim-flash {
239
- animation: sp-flash-bg 0.5s ${Ei};
240
- }
241
-
242
- .sp-anim-slide-up {
243
- animation: sp-slide-up 0.3s ${it} both;
244
- }
245
-
246
- .sp-anim-fade-in {
247
- animation: sp-fade-in 0.2s ease-out both;
248
- }
249
-
250
- /* ---- Transition utilities ---- */
251
-
252
- .sp-panel {
253
- transform: translateX(110%);
254
- transition: transform 0.4s ${it};
255
- }
256
-
257
- .sp-panel.sp-panel--open {
258
- transform: translateX(0);
259
- }
260
-
261
- .sp-radial-item {
262
- opacity: 0;
263
- pointer-events: none;
264
- transform: translate(0, 0) scale(0.8);
265
- transition:
266
- transform 0.35s ${ot},
267
- opacity 0.2s ease,
268
- background 0.2s ease,
269
- border-color 0.2s ease,
270
- box-shadow 0.2s ease;
271
- }
272
-
273
- .sp-radial-item.sp-radial-item--open {
274
- opacity: 1;
275
- pointer-events: auto;
276
- }
277
-
278
- /* Stagger delay via CSS custom property --sp-i */
279
- .sp-radial-item {
280
- transition-delay: calc(var(--sp-i, 0) * 50ms);
281
- }
282
-
283
- /* ---- Card stagger animation ---- */
284
-
285
- @keyframes sp-card-in {
286
- from {
287
- transform: translateY(12px);
288
- opacity: 0;
289
- }
290
- to {
291
- transform: translateY(0);
292
- opacity: 1;
293
- }
294
- }
295
-
296
- .sp-card {
297
- animation: sp-card-in 0.35s ${it} both;
298
- animation-delay: calc(var(--sp-card-i, 0) * 40ms);
299
- }
300
-
301
- /* ---- Loading spinner ---- */
302
-
303
- @keyframes sp-spin {
304
- to { transform: rotate(360deg); }
305
- }
306
-
307
- .sp-spinner {
308
- width: 20px;
309
- height: 20px;
310
- border: 2px solid var(--sp-border);
311
- border-top-color: var(--sp-accent);
312
- border-radius: 50%;
313
- animation: sp-spin 0.6s linear infinite;
314
- }
315
-
316
- /* ---- Badge bounce ---- */
317
-
318
- @keyframes sp-badge-in {
319
- 0% { transform: scale(0); }
320
- 60% { transform: scale(1.3); }
321
- 100% { transform: scale(1); }
322
- }
323
-
324
- .sp-fab-badge {
325
- animation: sp-badge-in 0.4s ${ot} both;
326
- }
327
-
328
- /* ---- Reduced motion ---- */
329
-
330
- @media (prefers-reduced-motion: reduce) {
331
- *, *::before, *::after {
332
- animation-duration: 0.01ms !important;
333
- animation-iteration-count: 1 !important;
334
- transition-duration: 0.01ms !important;
335
- }
336
- }
337
-
338
- `;function st(t){return `
339
- :host {
340
- all: initial;
341
- position: fixed;
342
- z-index: ${2147483647};
343
- font-family: var(--sp-font);
344
- font-size: 14px;
345
- line-height: 1.5;
346
- color: var(--sp-text);
347
- /* Match native sub-controls (autofill, scrollbars, etc.) to the resolved theme */
348
- color-scheme: ${t.bg==="#ffffff"?"light":"dark"};
349
- -webkit-font-smoothing: antialiased;
350
- -moz-osx-font-smoothing: grayscale;
351
- ${N(t)}
352
-
353
- /* Identity modal \u2014 theme-aware backdrop + panel */
354
- --sp-identity-bg: ${t.glassBgHeavy};
355
- --sp-identity-overlay: ${t.bg==="#ffffff"?"rgba(15, 23, 42, 0.2)":"rgba(0, 0, 0, 0.4)"};
356
- }
357
-
358
- *, *::before, *::after {
359
- box-sizing: border-box;
360
- margin: 0;
361
- padding: 0;
362
- }
363
-
364
- /* ============================
365
- Focus visible (accessibility)
366
- ============================ */
367
-
368
- :focus-visible {
369
- outline: 2px solid var(--sp-accent);
370
- outline-offset: 2px;
371
- /* Double-ring against any background colour: the bg-coloured halo
372
- separates the accent ring from busy host-page surfaces. */
373
- box-shadow: 0 0 0 4px var(--sp-bg);
374
- }
375
-
376
- /* ============================
377
- FAB (Floating Action Button)
378
- ============================ */
379
-
380
- .sp-fab {
381
- position: fixed;
382
- width: 52px;
383
- height: 52px;
384
- border-radius: var(--sp-radius-full);
385
- background: var(--sp-accent-gradient);
386
- color: #fff;
387
- border: none;
388
- cursor: pointer;
389
- display: flex;
390
- align-items: center;
391
- justify-content: center;
392
- box-shadow:
393
- 0 4px 20px var(--sp-accent-glow),
394
- 0 2px 8px rgba(0, 0, 0, 0.08);
395
- transition:
396
- transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
397
- box-shadow 0.3s ease;
398
- outline: none;
399
- }
400
-
401
- .sp-fab:focus-visible {
402
- outline: 2px solid #fff;
403
- outline-offset: 3px;
404
- }
405
-
406
- .sp-fab:hover {
407
- transform: translateY(-2px) scale(1.05);
408
- box-shadow:
409
- 0 8px 28px var(--sp-accent-glow),
410
- 0 4px 12px rgba(0, 0, 0, 0.1);
411
- }
412
-
413
- .sp-fab:active {
414
- transform: translateY(0) scale(0.95);
415
- transition-duration: 0.1s;
416
- }
417
-
418
- .sp-fab--bottom-right {
419
- bottom: 24px;
420
- right: 24px;
421
- }
422
-
423
- .sp-fab--bottom-left {
424
- bottom: 24px;
425
- left: 24px;
426
- }
427
-
428
- .sp-fab svg {
429
- width: 22px;
430
- height: 22px;
431
- fill: currentColor;
432
- transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
433
- }
434
-
435
- /* ---- FAB Badge ---- */
436
-
437
- .sp-fab-badge {
438
- position: absolute;
439
- top: -4px;
440
- right: -4px;
441
- min-width: 20px;
442
- height: 20px;
443
- padding: 0 6px;
444
- border-radius: var(--sp-radius-full);
445
- background: #ef4444;
446
- color: #fff;
447
- font-size: 11px;
448
- font-weight: 700;
449
- display: flex;
450
- align-items: center;
451
- justify-content: center;
452
- border: 2px solid #fff;
453
- pointer-events: none;
454
- font-family: var(--sp-font);
455
- line-height: 1;
456
- }
457
-
458
- /* ============================
459
- Radial Menu
460
- ============================ */
461
-
462
- .sp-radial {
463
- position: fixed;
464
- pointer-events: none;
465
- width: 52px;
466
- height: 52px;
467
- }
468
-
469
- .sp-radial--bottom-right {
470
- bottom: 24px;
471
- right: 24px;
472
- }
473
-
474
- .sp-radial--bottom-left {
475
- bottom: 24px;
476
- left: 24px;
477
- }
478
-
479
- .sp-radial-item {
480
- position: absolute;
481
- left: 4px;
482
- bottom: 4px;
483
- width: 44px;
484
- height: 44px;
485
- border-radius: var(--sp-radius-full);
486
- background: var(--sp-glass-bg-heavy);
487
- backdrop-filter: blur(var(--sp-blur));
488
- -webkit-backdrop-filter: blur(var(--sp-blur));
489
- color: var(--sp-text);
490
- border: 1px solid var(--sp-glass-border);
491
- cursor: pointer;
492
- display: flex;
493
- align-items: center;
494
- justify-content: center;
495
- box-shadow: var(--sp-shadow-md);
496
- font-size: 12px;
497
- font-weight: 600;
498
- }
499
-
500
- .sp-radial-item:hover,
501
- .sp-radial-item:focus-visible {
502
- background: rgba(255, 255, 255, 0.95);
503
- border-color: var(--sp-accent);
504
- color: var(--sp-accent);
505
- box-shadow:
506
- var(--sp-shadow-md),
507
- 0 0 0 3px var(--sp-accent-light);
508
- outline: none;
509
- }
510
-
511
- .sp-radial-item svg {
512
- width: 18px;
513
- height: 18px;
514
- flex-shrink: 0;
515
- stroke: currentColor;
516
- fill: none;
517
- }
518
-
519
- .sp-radial-label {
520
- white-space: nowrap;
521
- font-size: 12px;
522
- font-weight: 500;
523
- color: var(--sp-text);
524
- pointer-events: none;
525
- opacity: 0;
526
- padding: 4px 12px;
527
- border-radius: var(--sp-radius);
528
- background: var(--sp-glass-bg-heavy);
529
- backdrop-filter: blur(12px);
530
- -webkit-backdrop-filter: blur(12px);
531
- border: 1px solid var(--sp-glass-border);
532
- box-shadow: var(--sp-shadow-sm);
533
- transform: translateX(4px);
534
- transition: opacity 0.2s ease, transform 0.2s ease;
535
- }
536
-
537
- .sp-radial-item:hover .sp-radial-label,
538
- .sp-radial-item:focus-visible .sp-radial-label {
539
- opacity: 1;
540
- transform: translateX(0);
541
- }
542
-
543
- /* ============================
544
- Panel (Side drawer)
545
- ============================ */
546
-
547
- .sp-panel {
548
- position: fixed;
549
- top: 0;
550
- right: 0;
551
- width: 400px;
552
- max-width: 100vw;
553
- height: 100vh;
554
- height: 100dvh;
555
- background: var(--sp-glass-bg);
556
- backdrop-filter: blur(var(--sp-blur-heavy));
557
- -webkit-backdrop-filter: blur(var(--sp-blur-heavy));
558
- border-left: 1px solid var(--sp-glass-border);
559
- box-shadow: var(--sp-shadow-xl);
560
- display: flex;
561
- flex-direction: column;
562
- overflow: hidden;
563
- }
564
-
565
- @media (max-width: 480px) {
566
- .sp-panel {
567
- width: 100vw;
568
- border-left: none;
569
- }
570
- }
571
-
572
- .sp-panel-header {
573
- display: flex;
574
- align-items: center;
575
- justify-content: space-between;
576
- padding: 20px 24px;
577
- border-bottom: 1px solid var(--sp-border);
578
- background: var(--sp-glass-bg-heavy);
579
- backdrop-filter: blur(var(--sp-blur));
580
- -webkit-backdrop-filter: blur(var(--sp-blur));
581
- position: relative;
582
- z-index: 2;
583
- }
584
-
585
- .sp-panel-title {
586
- font-size: 17px;
587
- font-weight: 700;
588
- color: var(--sp-text);
589
- letter-spacing: -0.02em;
590
- }
591
-
592
- .sp-panel-close {
593
- width: 44px;
594
- height: 44px;
595
- border-radius: var(--sp-radius);
596
- border: none;
597
- background: transparent;
598
- cursor: pointer;
599
- display: flex;
600
- align-items: center;
601
- justify-content: center;
602
- color: var(--sp-text-tertiary);
603
- transition: all 0.2s ease;
604
- }
605
-
606
- .sp-panel-close:hover {
607
- background: var(--sp-bg-hover);
608
- color: var(--sp-text);
609
- }
610
-
611
- .sp-panel-close svg {
612
- width: 16px;
613
- height: 16px;
614
- }
615
-
616
- /* ============================
617
- Filters & Search
618
- ============================ */
619
-
620
- .sp-filters {
621
- padding: 16px 24px;
622
- border-bottom: 1px solid var(--sp-border);
623
- background: var(--sp-glass-bg-heavy);
624
- backdrop-filter: blur(var(--sp-blur));
625
- -webkit-backdrop-filter: blur(var(--sp-blur));
626
- position: sticky;
627
- top: 0;
628
- z-index: 1;
629
- }
630
-
631
- .sp-search-wrap {
632
- position: relative;
633
- margin-bottom: 12px;
634
- }
635
-
636
- .sp-search {
637
- width: 100%;
638
- height: 40px;
639
- padding: 0 12px 0 38px;
640
- border-radius: var(--sp-radius);
641
- border: 1px solid var(--sp-border);
642
- background: var(--sp-glass-bg-heavy);
643
- color: var(--sp-text);
644
- font-family: var(--sp-font);
645
- font-size: 13px;
646
- outline: none;
647
- transition: all 0.2s ease;
648
- }
649
-
650
- .sp-search::placeholder {
651
- color: var(--sp-text-tertiary);
652
- }
653
-
654
- .sp-search:focus {
655
- border-color: var(--sp-accent);
656
- box-shadow: 0 0 0 3px var(--sp-accent-light);
657
- background: var(--sp-bg);
658
- }
659
-
660
- .sp-search-icon {
661
- position: absolute;
662
- left: 12px;
663
- top: 50%;
664
- transform: translateY(-50%);
665
- color: var(--sp-text-tertiary);
666
- width: 16px;
667
- height: 16px;
668
- transition: color 0.2s ease;
669
- }
670
-
671
- .sp-search:focus ~ .sp-search-icon,
672
- .sp-search-wrap:focus-within .sp-search-icon {
673
- color: var(--sp-accent);
674
- }
675
-
676
- /* ============================
677
- Filter bar (type dropdown + status segmented)
678
- ============================ */
679
-
680
- .sp-filter-bar {
681
- display: flex;
682
- align-items: center;
683
- gap: 8px;
684
- margin-bottom: 8px;
685
- flex-wrap: wrap;
686
- }
687
-
688
- /* ============================
689
- Type filter dropdown
690
- ============================ */
691
-
692
- .sp-filter-dropdown {
693
- position: relative;
694
- flex: 1 1 auto;
695
- min-width: 0;
696
- }
697
-
698
- .sp-filter-dropdown-btn {
699
- --sp-chip-color: var(--sp-text-secondary);
700
- --sp-chip-bg: var(--sp-glass-bg-heavy);
701
-
702
- display: inline-flex;
703
- align-items: center;
704
- gap: 8px;
705
- width: 100%;
706
- height: 32px;
707
- padding: 0 8px 0 10px;
708
- border-radius: var(--sp-radius-full);
709
- border: 1px solid var(--sp-border);
710
- background: var(--sp-glass-bg-heavy);
711
- color: var(--sp-text);
712
- font-family: var(--sp-font);
713
- font-size: 12px;
714
- font-weight: 500;
715
- cursor: pointer;
716
- white-space: nowrap;
717
- transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
718
- }
719
-
720
- .sp-filter-dropdown-btn:hover {
721
- border-color: var(--sp-chip-color);
722
- background: var(--sp-chip-bg);
723
- }
724
-
725
- .sp-filter-dropdown-btn[aria-expanded="true"] {
726
- border-color: var(--sp-chip-color);
727
- background: var(--sp-chip-bg);
728
- box-shadow: 0 0 0 3px color-mix(in srgb, var(--sp-chip-color) 14%, transparent);
729
- }
730
-
731
- .sp-filter-dropdown-btn--filtered {
732
- border-color: var(--sp-chip-color);
733
- background: var(--sp-chip-bg);
734
- }
735
-
736
- .sp-filter-dropdown-btn__icon {
737
- display: inline-flex;
738
- align-items: center;
739
- justify-content: center;
740
- width: 18px;
741
- height: 18px;
742
- flex-shrink: 0;
743
- color: var(--sp-chip-color);
744
- }
745
-
746
- .sp-filter-dropdown-btn__icon svg {
747
- width: 14px;
748
- height: 14px;
749
- }
750
-
751
- .sp-filter-dropdown-btn__label {
752
- display: inline-flex;
753
- align-items: baseline;
754
- gap: 6px;
755
- flex: 1;
756
- min-width: 0;
757
- overflow: hidden;
758
- }
759
-
760
- .sp-filter-dropdown-btn__prefix {
761
- color: var(--sp-text-tertiary);
762
- font-weight: 500;
763
- font-size: 11px;
764
- text-transform: uppercase;
765
- letter-spacing: 0.06em;
766
- }
767
-
768
- .sp-filter-dropdown-btn__value {
769
- color: var(--sp-chip-color);
770
- font-weight: 600;
771
- overflow: hidden;
772
- text-overflow: ellipsis;
773
- }
774
-
775
- .sp-filter-dropdown-btn__chevron {
776
- display: inline-flex;
777
- align-items: center;
778
- justify-content: center;
779
- width: 14px;
780
- height: 14px;
781
- flex-shrink: 0;
782
- color: var(--sp-text-tertiary);
783
- transition: transform 0.18s ease, color 0.18s ease;
784
- }
785
-
786
- .sp-filter-dropdown-btn__chevron svg {
787
- width: 12px;
788
- height: 12px;
789
- }
790
-
791
- .sp-filter-dropdown-btn[aria-expanded="true"] .sp-filter-dropdown-btn__chevron {
792
- transform: rotate(180deg);
793
- color: var(--sp-chip-color);
794
- }
795
-
796
- .sp-filter-dropdown-menu {
797
- position: absolute;
798
- top: calc(100% + 6px);
799
- left: 0;
800
- right: 0;
801
- min-width: 180px;
802
- padding: 4px;
803
- border-radius: var(--sp-radius);
804
- background: var(--sp-glass-bg-heavy);
805
- backdrop-filter: blur(var(--sp-blur-heavy));
806
- -webkit-backdrop-filter: blur(var(--sp-blur-heavy));
807
- border: 1px solid var(--sp-glass-border);
808
- box-shadow: var(--sp-shadow-md);
809
- z-index: 10;
810
- animation: sp-filter-menu-in 0.15s ease-out both;
811
- }
812
-
813
- @keyframes sp-filter-menu-in {
814
- from { opacity: 0; transform: translateY(-4px) scale(0.98); }
815
- to { opacity: 1; transform: translateY(0) scale(1); }
816
- }
817
-
818
- .sp-filter-dropdown-option {
819
- --sp-chip-color: var(--sp-text-secondary);
820
- --sp-chip-bg: transparent;
821
-
822
- display: flex;
823
- align-items: center;
824
- gap: 10px;
825
- width: 100%;
826
- padding: 8px 10px;
827
- border: none;
828
- border-radius: 8px;
829
- background: transparent;
830
- color: var(--sp-text);
831
- font-family: var(--sp-font);
832
- font-size: 12px;
833
- font-weight: 500;
834
- cursor: pointer;
835
- text-align: left;
836
- transition: background 0.12s ease, color 0.12s ease;
837
- }
838
-
839
- .sp-filter-dropdown-option__icon {
840
- display: inline-flex;
841
- align-items: center;
842
- justify-content: center;
843
- width: 22px;
844
- height: 22px;
845
- flex-shrink: 0;
846
- border-radius: 6px;
847
- background: var(--sp-chip-bg);
848
- color: var(--sp-chip-color);
849
- }
850
-
851
- .sp-filter-dropdown-option__icon svg {
852
- width: 13px;
853
- height: 13px;
854
- }
855
-
856
- .sp-filter-dropdown-option__label {
857
- flex: 1;
858
- min-width: 0;
859
- }
860
-
861
- .sp-filter-dropdown-option__check {
862
- display: inline-flex;
863
- align-items: center;
864
- justify-content: center;
865
- width: 14px;
866
- height: 14px;
867
- flex-shrink: 0;
868
- color: var(--sp-chip-color);
869
- }
870
-
871
- .sp-filter-dropdown-option__check svg {
872
- width: 13px;
873
- height: 13px;
874
- }
875
-
876
- .sp-filter-dropdown-option:hover {
877
- background: var(--sp-bg-hover);
878
- }
879
-
880
- .sp-filter-dropdown-option--active {
881
- color: var(--sp-chip-color);
882
- font-weight: 600;
883
- }
884
-
885
- .sp-filter-dropdown-option--active:hover {
886
- background: var(--sp-chip-bg);
887
- }
888
-
889
- /* ============================
890
- Status segmented control
891
- ============================ */
892
-
893
- .sp-segmented {
894
- display: inline-flex;
895
- align-items: stretch;
896
- padding: 2px;
897
- border-radius: var(--sp-radius-full);
898
- border: 1px solid var(--sp-border);
899
- background: var(--sp-glass-bg-heavy);
900
- flex-shrink: 0;
901
- }
902
-
903
- .sp-segmented__btn {
904
- --sp-chip-color: var(--sp-text-tertiary);
905
- --sp-chip-bg: transparent;
906
-
907
- display: inline-flex;
908
- align-items: center;
909
- gap: 5px;
910
- height: 26px;
911
- padding: 0 10px;
912
- border: none;
913
- border-radius: var(--sp-radius-full);
914
- background: transparent;
915
- color: var(--sp-text-secondary);
916
- font-family: var(--sp-font);
917
- font-size: 12px;
918
- font-weight: 500;
919
- cursor: pointer;
920
- white-space: nowrap;
921
- transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
922
- }
923
-
924
- .sp-segmented__icon {
925
- display: inline-flex;
926
- align-items: center;
927
- justify-content: center;
928
- width: 13px;
929
- height: 13px;
930
- flex-shrink: 0;
931
- color: var(--sp-chip-color);
932
- transition: color 0.18s ease, transform 0.18s ease;
933
- }
934
-
935
- .sp-segmented__icon svg {
936
- width: 13px;
937
- height: 13px;
938
- }
939
-
940
- .sp-segmented__btn:hover {
941
- color: var(--sp-chip-color);
942
- }
943
-
944
- .sp-segmented__btn:hover .sp-segmented__icon {
945
- color: var(--sp-chip-color);
946
- }
947
-
948
- .sp-segmented__btn--active {
949
- background: var(--sp-chip-bg);
950
- color: var(--sp-chip-color);
951
- font-weight: 600;
952
- box-shadow:
953
- inset 0 0 0 1px color-mix(in srgb, var(--sp-chip-color) 35%, transparent),
954
- 0 1px 2px rgba(0, 0, 0, 0.04);
955
- }
956
-
957
- .sp-segmented__btn--active .sp-segmented__icon {
958
- color: var(--sp-chip-color);
959
- }
960
-
961
- .sp-segmented__btn--open.sp-segmented__btn--active .sp-segmented__icon {
962
- animation: sp-segmented-pulse 2.4s ease-in-out infinite;
963
- }
964
-
965
- @keyframes sp-segmented-pulse {
966
- 0%, 100% { transform: scale(1); }
967
- 50% { transform: scale(0.85); }
968
- }
969
-
970
- @media (prefers-reduced-motion: reduce) {
971
- .sp-filter-dropdown-btn,
972
- .sp-filter-dropdown-btn__chevron,
973
- .sp-filter-dropdown-option,
974
- .sp-segmented__btn,
975
- .sp-segmented__icon {
976
- transition: none;
977
- }
978
- .sp-filter-dropdown-menu {
979
- animation: none;
980
- }
981
- .sp-segmented__btn--open.sp-segmented__btn--active .sp-segmented__icon {
982
- animation: none;
983
- }
984
- }
985
-
986
- /* ============================
987
- Feedback Cards
988
- ============================ */
989
-
990
- .sp-list {
991
- flex: 1;
992
- overflow-y: auto;
993
- padding: 8px 12px;
994
- }
995
-
996
- .sp-list::-webkit-scrollbar {
997
- width: 6px;
998
- }
999
-
1000
- .sp-list::-webkit-scrollbar-track {
1001
- background: transparent;
1002
- }
1003
-
1004
- .sp-list::-webkit-scrollbar-thumb {
1005
- background: var(--sp-border);
1006
- border-radius: var(--sp-radius-full);
1007
- }
1008
-
1009
- .sp-list::-webkit-scrollbar-thumb:hover {
1010
- background: var(--sp-text-tertiary);
1011
- }
1012
-
1013
- .sp-card {
1014
- display: flex;
1015
- padding: 14px 16px;
1016
- margin-bottom: 6px;
1017
- cursor: pointer;
1018
- border-radius: var(--sp-radius);
1019
- background: var(--sp-glass-bg-heavy);
1020
- border: 1px solid var(--sp-glass-border);
1021
- box-shadow: var(--sp-shadow-xs);
1022
- transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
1023
- }
1024
-
1025
- .sp-card:hover {
1026
- background: var(--sp-bg);
1027
- border-color: var(--sp-border);
1028
- box-shadow: var(--sp-shadow-md);
1029
- transform: translateY(-2px);
1030
- }
1031
-
1032
- .sp-card:active {
1033
- transform: translateY(0) scale(0.99);
1034
- transition-duration: 0.1s;
1035
- }
1036
-
1037
- .sp-card-bar {
1038
- width: 3px;
1039
- border-radius: var(--sp-radius-full);
1040
- margin-right: 14px;
1041
- flex-shrink: 0;
1042
- }
1043
-
1044
- .sp-card-body {
1045
- flex: 1;
1046
- min-width: 0;
1047
- }
1048
-
1049
- .sp-card-header {
1050
- display: flex;
1051
- align-items: center;
1052
- gap: 8px;
1053
- margin-bottom: 6px;
1054
- }
1055
-
1056
- .sp-card-number {
1057
- font-size: 12px;
1058
- font-weight: 700;
1059
- color: var(--sp-text-tertiary);
1060
- font-variant-numeric: tabular-nums;
1061
- }
1062
-
1063
- .sp-badge {
1064
- padding: 2px 10px;
1065
- border-radius: var(--sp-radius-full);
1066
- font-size: 11px;
1067
- font-weight: 600;
1068
- letter-spacing: 0.02em;
1069
- }
1070
-
1071
- .sp-card-date {
1072
- font-size: 11px;
1073
- color: var(--sp-text-tertiary);
1074
- margin-left: auto;
1075
- }
1076
-
1077
- .sp-card-message {
1078
- font-size: 13px;
1079
- line-height: 1.5;
1080
- color: var(--sp-text);
1081
- display: -webkit-box;
1082
- -webkit-line-clamp: 3;
1083
- -webkit-box-orient: vertical;
1084
- overflow: hidden;
1085
- }
1086
-
1087
- .sp-card-message--expanded {
1088
- -webkit-line-clamp: unset;
1089
- }
1090
-
1091
- .sp-card-expand {
1092
- font-size: 12px;
1093
- font-weight: 500;
1094
- color: var(--sp-accent);
1095
- cursor: pointer;
1096
- background: none;
1097
- border: none;
1098
- padding: 4px 0;
1099
- font-family: var(--sp-font);
1100
- transition: opacity 0.15s ease;
1101
- }
1102
-
1103
- .sp-card-expand:hover {
1104
- opacity: 0.8;
1105
- }
1106
-
1107
- .sp-card-footer {
1108
- display: flex;
1109
- align-items: center;
1110
- justify-content: flex-end;
1111
- gap: 6px;
1112
- margin-top: 10px;
1113
- }
1114
-
1115
- .sp-btn-resolve,
1116
- .sp-btn-delete {
1117
- padding: 8px 14px;
1118
- border-radius: var(--sp-radius-full);
1119
- border: 1px solid var(--sp-border);
1120
- background: transparent;
1121
- color: var(--sp-text-secondary);
1122
- font-family: var(--sp-font);
1123
- font-size: 12px;
1124
- font-weight: 500;
1125
- cursor: pointer;
1126
- display: flex;
1127
- align-items: center;
1128
- gap: 4px;
1129
- transition: all 0.2s ease;
1130
- }
1131
-
1132
- .sp-btn-resolve svg,
1133
- .sp-btn-delete svg {
1134
- width: 14px;
1135
- height: 14px;
1136
- }
1137
-
1138
- .sp-btn-resolve:hover {
1139
- border-color: #22c55e;
1140
- color: #22c55e;
1141
- background: rgba(34, 197, 94, 0.06);
1142
- }
1143
-
1144
- .sp-btn-delete:hover {
1145
- border-color: #ef4444;
1146
- color: #ef4444;
1147
- background: rgba(239, 68, 68, 0.06);
1148
- }
1149
-
1150
- .sp-btn-resolve:disabled,
1151
- .sp-btn-delete:disabled {
1152
- opacity: 0.5;
1153
- cursor: not-allowed;
1154
- pointer-events: none;
1155
- }
1156
-
1157
- .sp-spinner--sm {
1158
- width: 14px;
1159
- height: 14px;
1160
- }
1161
-
1162
- /* ---- Delete All (header) ---- */
1163
-
1164
- .sp-panel-header-right {
1165
- display: flex;
1166
- align-items: center;
1167
- gap: 8px;
1168
- }
1169
-
1170
- .sp-btn-delete-all {
1171
- padding: 5px 12px;
1172
- border-radius: var(--sp-radius-full);
1173
- border: 1px solid var(--sp-border);
1174
- background: transparent;
1175
- color: var(--sp-text-tertiary);
1176
- font-family: var(--sp-font);
1177
- font-size: 11px;
1178
- font-weight: 500;
1179
- cursor: pointer;
1180
- display: flex;
1181
- align-items: center;
1182
- gap: 4px;
1183
- transition: all 0.2s ease;
1184
- }
1185
-
1186
- .sp-btn-delete-all svg {
1187
- width: 13px;
1188
- height: 13px;
1189
- }
1190
-
1191
- .sp-btn-delete-all:hover {
1192
- border-color: #ef4444;
1193
- color: #ef4444;
1194
- background: rgba(239, 68, 68, 0.06);
1195
- }
1196
-
1197
- .sp-btn-delete-all:disabled {
1198
- opacity: 0.5;
1199
- cursor: not-allowed;
1200
- pointer-events: none;
1201
- }
1202
-
1203
- /* ---- Confirm Dialog ---- */
1204
-
1205
- .sp-confirm-backdrop {
1206
- position: fixed;
1207
- inset: 0;
1208
- background: var(--sp-backdrop, rgba(15, 23, 42, 0.2));
1209
- backdrop-filter: blur(var(--sp-blur));
1210
- -webkit-backdrop-filter: blur(var(--sp-blur));
1211
- display: flex;
1212
- align-items: center;
1213
- justify-content: center;
1214
- z-index: ${2147483647};
1215
- opacity: 0;
1216
- transition: opacity 0.2s ease;
1217
- }
1218
-
1219
- .sp-confirm-dialog {
1220
- width: 340px;
1221
- padding: 28px;
1222
- border-radius: 20px;
1223
- background: var(--sp-glass-bg-heavy);
1224
- backdrop-filter: blur(var(--sp-blur-heavy));
1225
- -webkit-backdrop-filter: blur(var(--sp-blur-heavy));
1226
- border: 1px solid var(--sp-glass-border);
1227
- box-shadow: var(--sp-shadow-xl);
1228
- font-family: var(--sp-font);
1229
- transform: translateY(8px) scale(0.97);
1230
- transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
1231
- }
1232
-
1233
- .sp-confirm-title {
1234
- font-size: 17px;
1235
- font-weight: 700;
1236
- color: var(--sp-text);
1237
- letter-spacing: -0.02em;
1238
- margin-bottom: 8px;
1239
- }
1240
-
1241
- .sp-confirm-message {
1242
- font-size: 14px;
1243
- color: var(--sp-text-secondary);
1244
- line-height: 1.5;
1245
- margin-bottom: 20px;
1246
- }
1247
-
1248
- .sp-confirm-actions {
1249
- display: flex;
1250
- gap: 8px;
1251
- justify-content: flex-end;
1252
- }
1253
-
1254
- .sp-btn-danger {
1255
- height: 40px;
1256
- padding: 0 22px;
1257
- border-radius: var(--sp-radius);
1258
- border: none;
1259
- background: #ef4444;
1260
- color: #fff;
1261
- font-family: var(--sp-font);
1262
- font-size: 14px;
1263
- font-weight: 600;
1264
- cursor: pointer;
1265
- transition: all 0.2s ease;
1266
- box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
1267
- }
1268
-
1269
- .sp-btn-danger:hover {
1270
- background: #dc2626;
1271
- box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
1272
- transform: translateY(-1px);
1273
- }
1274
-
1275
- .sp-btn-danger:active {
1276
- transform: translateY(0) scale(0.98);
1277
- transition-duration: 0.1s;
1278
- }
1279
-
1280
- .sp-card--resolved {
1281
- opacity: 0.5;
1282
- }
1283
-
1284
- .sp-card--resolved .sp-card-message {
1285
- text-decoration: line-through;
1286
- text-decoration-color: var(--sp-text-tertiary);
1287
- }
1288
-
1289
- /* ============================
1290
- Loading State
1291
- ============================ */
1292
-
1293
- .sp-loading {
1294
- display: flex;
1295
- align-items: center;
1296
- justify-content: center;
1297
- padding: 48px 24px;
1298
- }
1299
-
1300
- /* ============================
1301
- Identity Form
1302
- ============================ */
1303
-
1304
- .sp-identity-title {
1305
- font-size: 17px;
1306
- font-weight: 700;
1307
- color: var(--sp-text);
1308
- letter-spacing: -0.02em;
1309
- }
1310
-
1311
- .sp-input {
1312
- width: 100%;
1313
- height: 42px;
1314
- padding: 0 14px;
1315
- border-radius: var(--sp-radius);
1316
- border: 1px solid var(--sp-border);
1317
- background: var(--sp-glass-bg-heavy);
1318
- color: var(--sp-text);
1319
- font-family: var(--sp-font);
1320
- font-size: 14px;
1321
- outline: none;
1322
- transition: all 0.2s ease;
1323
- }
1324
-
1325
- .sp-input::placeholder {
1326
- color: var(--sp-text-tertiary);
1327
- }
1328
-
1329
- .sp-input:focus {
1330
- border-color: var(--sp-accent);
1331
- box-shadow: 0 0 0 3px var(--sp-accent-light);
1332
- background: var(--sp-bg);
1333
- }
1334
-
1335
- .sp-input-label {
1336
- font-size: 13px;
1337
- font-weight: 500;
1338
- color: var(--sp-text-secondary);
1339
- margin-bottom: 6px;
1340
- display: block;
1341
- }
1342
-
1343
- /* ============================
1344
- Buttons
1345
- ============================ */
1346
-
1347
- .sp-btn-primary {
1348
- height: 40px;
1349
- padding: 0 22px;
1350
- border-radius: var(--sp-radius);
1351
- border: none;
1352
- background: var(--sp-accent-gradient);
1353
- color: #fff;
1354
- font-family: var(--sp-font);
1355
- font-size: 14px;
1356
- font-weight: 600;
1357
- cursor: pointer;
1358
- transition: all 0.2s ease;
1359
- box-shadow: 0 2px 8px var(--sp-accent-glow);
1360
- }
1361
-
1362
- .sp-btn-primary:hover {
1363
- box-shadow: 0 4px 16px var(--sp-accent-glow);
1364
- transform: translateY(-1px);
1365
- }
1366
-
1367
- .sp-btn-primary:active {
1368
- transform: translateY(0) scale(0.98);
1369
- transition-duration: 0.1s;
1370
- }
1371
-
1372
- .sp-btn-primary:disabled {
1373
- opacity: 0.4;
1374
- cursor: not-allowed;
1375
- transform: none;
1376
- box-shadow: none;
1377
- }
1378
-
1379
- .sp-btn-ghost {
1380
- height: 40px;
1381
- padding: 0 22px;
1382
- border-radius: var(--sp-radius);
1383
- border: 1px solid var(--sp-border);
1384
- background: var(--sp-glass-bg-heavy);
1385
- color: var(--sp-text-secondary);
1386
- font-family: var(--sp-font);
1387
- font-size: 14px;
1388
- font-weight: 500;
1389
- cursor: pointer;
1390
- transition: all 0.2s ease;
1391
- }
1392
-
1393
- .sp-btn-ghost:hover {
1394
- border-color: var(--sp-accent);
1395
- color: var(--sp-accent);
1396
- background: var(--sp-accent-light);
1397
- }
1398
-
1399
- /* ============================
1400
- Empty State
1401
- ============================ */
1402
-
1403
- .sp-empty {
1404
- display: flex;
1405
- flex-direction: column;
1406
- align-items: center;
1407
- justify-content: center;
1408
- padding: 56px 24px;
1409
- color: var(--sp-text-tertiary);
1410
- text-align: center;
1411
- gap: 8px;
1412
- animation: sp-fade-in 0.3s ease-out both;
1413
- }
1414
-
1415
- .sp-empty-text {
1416
- font-size: 14px;
1417
- font-weight: 500;
1418
- }
1419
-
1420
- /* ============================
1421
- Load More
1422
- ============================ */
1423
-
1424
- .sp-load-more-wrap {
1425
- display: flex;
1426
- justify-content: center;
1427
- padding: 12px 0 4px;
1428
- }
1429
-
1430
- .sp-btn-load-more {
1431
- width: 100%;
1432
- }
1433
-
1434
- /* ============================
1435
- Forced Colors / High Contrast
1436
- ============================ */
1437
-
1438
- @media (forced-colors: active) {
1439
- .sp-fab,
1440
- .sp-radial-item,
1441
- .sp-filter-dropdown-btn,
1442
- .sp-segmented,
1443
- .sp-segmented__btn,
1444
- .sp-card,
1445
- .sp-panel-close,
1446
- .sp-search,
1447
- .sp-btn-resolve,
1448
- .sp-btn-delete,
1449
- .sp-btn-delete-all,
1450
- .sp-btn-primary,
1451
- .sp-btn-ghost,
1452
- .sp-btn-danger,
1453
- .sp-card-expand,
1454
- .sp-input,
1455
- .sp-confirm-dialog {
1456
- border: 2px solid ButtonText !important;
1457
- background: Canvas !important;
1458
- color: ButtonText !important;
1459
- }
1460
-
1461
- .sp-segmented__btn--active {
1462
- background: Highlight !important;
1463
- color: HighlightText !important;
1464
- }
1465
-
1466
- .sp-filter-dropdown-menu {
1467
- border: 2px solid ButtonText !important;
1468
- background: Canvas !important;
1469
- }
1470
-
1471
- .sp-filter-dropdown-option--active {
1472
- background: Highlight !important;
1473
- color: HighlightText !important;
1474
- }
1475
-
1476
- .sp-fab:focus-visible,
1477
- .sp-radial-item:focus-visible,
1478
- .sp-filter-dropdown-btn:focus-visible,
1479
- .sp-segmented__btn:focus-visible,
1480
- .sp-filter-dropdown-option:focus-visible,
1481
- .sp-panel-close:focus-visible,
1482
- .sp-btn-resolve:focus-visible,
1483
- .sp-btn-delete:focus-visible,
1484
- .sp-btn-delete-all:focus-visible,
1485
- .sp-btn-primary:focus-visible,
1486
- .sp-btn-ghost:focus-visible,
1487
- .sp-btn-danger:focus-visible,
1488
- .sp-card-expand:focus-visible,
1489
- .sp-input:focus-visible,
1490
- .sp-search:focus-visible {
1491
- outline: 3px solid Highlight !important;
1492
- }
1493
-
1494
- .sp-panel {
1495
- border: 2px solid ButtonText !important;
1496
- }
1497
-
1498
- .sp-fab-badge {
1499
- border: 2px solid ButtonText !important;
1500
- background: Canvas !important;
1501
- color: ButtonText !important;
1502
- }
1503
-
1504
- .sp-card-bar {
1505
- background: ButtonText !important;
1506
- }
1507
- }
1508
-
1509
- ${mn}
1510
- ${ca}
1511
- ${ba}
1512
- ${V$1}
1513
- ${T}
1514
- ${ga}
1515
- ${X}
1516
- `}var ki=120,Si=80,Ne=class{constructor(e,n$1="en"){this.colors=e;this.locale=n$1;this.root=n("div",{style:`
1517
- position: fixed;
1518
- z-index: ${2147483647};
1519
- max-width: 280px;
1520
- padding: 12px 14px;
1521
- border-radius: 14px;
1522
- background: ${this.colors.glassBgHeavy};
1523
- backdrop-filter: blur(24px);
1524
- -webkit-backdrop-filter: blur(24px);
1525
- border: 1px solid ${this.colors.glassBorder};
1526
- box-shadow: 0 8px 32px ${this.colors.shadow}, 0 2px 8px ${this.colors.shadow};
1527
- font-family: "Inter", system-ui, -apple-system, sans-serif;
1528
- pointer-events: auto;
1529
- opacity: 0;
1530
- transform: translateY(6px) scale(0.97);
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
- visibility: hidden;
1533
- -webkit-font-smoothing: antialiased;
1534
- `}),this.root.setAttribute("role","tooltip"),this.root.id=this.tooltipId,this.arrow=n("div",{style:`
1535
- position: absolute;
1536
- width: 12px;
1537
- height: 12px;
1538
- background: ${this.colors.glassBgHeavy};
1539
- border: 1px solid ${this.colors.glassBorder};
1540
- transform: rotate(45deg);
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)";},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$1=Array.from(this.root.children);for(let u of n$1)u!==this.arrow&&u.remove();let i=J(e.type,this.colors),o$1=M(e.type,this.colors),r=P(this.locale),s=R(e.type,r),a=n("div",{style:"display:flex;align-items:center;gap:8px;margin-bottom:8px;"}),l=n("span",{style:`
1543
- padding:3px 10px;border-radius:9999px;
1544
- font-size:11px;font-weight:600;
1545
- color:${i};background:${o$1};
1546
- letter-spacing:0.02em;
1547
- `});o(l,s);let c=n("span",{style:`font-size:11px;color:${this.colors.textSecondary};margin-left:auto;`});o(c,q$1(e.createdAt,this.locale)),a.appendChild(l),a.appendChild(c);let p=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;`});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,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=`
1548
- position:absolute;
1549
- width:12px;height:12px;
1550
- background:${this.colors.glassBgHeavy};
1551
- border-right:1px solid ${this.colors.glassBorder};
1552
- border-bottom:1px solid ${this.colors.glassBorder};
1553
- transform:rotate(45deg);
1554
- pointer-events:none;
1555
- bottom:-6px;
1556
- left:${a}px;
1557
- `:this.arrow.style.cssText=`
1558
- position:absolute;
1559
- width:12px;height:12px;
1560
- background:${this.colors.glassBgHeavy};
1561
- border-left:1px solid ${this.colors.glassBorder};
1562
- border-top:1px solid ${this.colors.glassBorder};
1563
- transform:rotate(45deg);
1564
- pointer-events:none;
1565
- top:-6px;
1566
- left:${a}px;
1567
- `;}contains(e){return this.root.contains(e)}destroy(){this.cancelShow(),this.cancelHide(),this.root.remove();}};var pe=null;function Ti(t){return t===void 0||t===false?{console:false,network:false,maxConsoleEntries:50,maxNetworkEntries:20}:t===true?{console:true,network:true,maxConsoleEntries:50,maxNetworkEntries:20}:{console:t.console!==false,network:t.network!==false,maxConsoleEntries:typeof t.maxConsoleEntries=="number"?t.maxConsoleEntries:50,maxNetworkEntries:typeof t.maxNetworkEntries=="number"?t.maxNetworkEntries:20}}function de(){let t=()=>{};return {destroy:t,open:t,close:t,refresh:t,focusFeedback:()=>false,on:()=>t,off:t}}function bn(){try{return process.env.NODE_ENV}catch{return}}function Ci(t){return t===void 0||t===false?{enabled:false,param:"siteping"}:t===true?{enabled:true,param:"siteping"}:{enabled:true,param:t.param??"siteping"}}function gn(t){if(typeof window>"u"||typeof document>"u")return t.onSkip?.("ssr"),de();let e=t.debug?(...h)=>console.debug("[siteping]",...h):()=>{};if(pe)return e("initSiteping() called more than once \u2014 returning existing instance"),pe;if(!t.forceShow&&bn()==="production")return t.onSkip?.("production"),de();let n=typeof t.minViewportWidth=="number"&&Number.isFinite(t.minViewportWidth)?t.minViewportWidth:768;if(!t.forceShow&&window.innerWidth<n){let h="mobile";return t.onSkip?.(h),de()}if(!t.store&&(!t.endpoint||typeof t.endpoint!="string"))return console.error("[siteping] Missing 'endpoint' or 'store' in config. Provide an endpoint like '/api/siteping' or a SitepingStore instance."),de();if(!t.projectName||typeof t.projectName!="string")return console.error("[siteping] Missing or invalid 'projectName' in config. Expected a non-empty string."),de();let i=t.locale??"en",o=i==="en"?Promise.resolve():O(i).catch(()=>{}),r=P(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=Ti(t.captureDiagnostics),c=l.console?new Te(l.maxConsoleEntries):null,p=l.network?new Ce(l.maxNetworkEntries):null,u=I(t.accentColor,t.theme),d=new re,f=new re,b=(()=>{if(t.store)return new Fe(t.store,t.projectName);let h=t.endpoint;if(typeof h!="string"||h.length===0)throw new Error("[siteping] internal invariant: endpoint must be a non-empty string in HTTP mode");return new Se(h,t.projectName,{apiKey:t.apiKey,headers:t.headers})})();t.onOpen&&d.on("open",t.onOpen),t.onClose&&d.on("close",t.onClose),t.onFeedbackSent&&d.on("feedback:sent",t.onFeedbackSent),t.onError&&d.on("feedback:error",t.onError),t.onAnnotationStart&&d.on("annotation:start",t.onAnnotationStart),t.onAnnotationEnd&&d.on("annotation:end",t.onAnnotationEnd);let M={"feedback:sent":()=>d.on("feedback:sent",h=>f.emit("feedback:sent",h)),"feedback:deleted":()=>d.on("feedback:deleted",h=>f.emit("feedback:deleted",h)),"feedback:error":()=>d.on("feedback:error",h=>f.emit("feedback:error",h)),"panel:open":()=>d.on("open",()=>f.emit("panel:open")),"panel:close":()=>d.on("close",()=>f.emit("panel:close")),"annotation:start":()=>d.on("annotation:start",()=>f.emit("annotation:start")),"annotation:end":()=>d.on("annotation:end",()=>f.emit("annotation:end"))};for(let h of Object.values(M))h();d.on("open",()=>e("Panel opened")),d.on("close",()=>e("Panel closed")),d.on("feedback:sent",h=>e("Feedback sent",h.id)),d.on("feedback:error",h=>e("Feedback failed",h.message)),d.on("annotation:start",()=>e("Annotation started")),d.on("annotation:end",()=>e("Annotation ended"));let y=document.createElement("siteping-widget");y.style.cssText=`position:fixed;z-index:${2147483647};`;let C=bn()==="test"?"open":"closed",w=y.attachShadow({mode:C});if("adoptedStyleSheets"in ShadowRoot.prototype){let h=new CSSStyleSheet;h.replaceSync(st(u)),w.adoptedStyleSheets=[h];}else {let h=document.createElement("style");h.textContent=st(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,r,v),H=new Ae(w,t,d,r);d.on("markers:changed",h=>H.updateBadge(h));let k=null,I$1=null,F=false,ue=0;async function at(){return F?null:k||(I$1||(I$1=import('./panel-S2UR5BSD.js').then(h=>F?null:(k=new h.Panel(w,u,d,b,t.projectName,A,r,i,{getScope:a,scopeAnnotationsByUrl:s}),k))),I$1)}if(typeof window<"u"){let h=()=>{F||at();},m=window.requestIdleCallback;typeof m=="function"?m(h):setTimeout(h,200);}let B=false,vn=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 Ee(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,xn=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 Ai(w,r),!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(),pt=null;(c||p)&&(pt={console:c?.getEntries()??[],network:p?.getEntries()??[]});let kn={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(kn);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;}}),He=a(),wn=s?{limit:20,url:He.url}:{limit:20},De=Ci(t.deepLink),En=++ue;Promise.all([b.getFeedbacks(t.projectName,wn),o]).then(([{feedbacks:h}])=>{if(F||ue!==En)return;let m=s?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??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(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"),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(),xn(),vn(),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 Ai(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=`
1569
- position:fixed;inset:0;
1570
- background:var(--sp-identity-overlay);
1571
- backdrop-filter:blur(8px);
1572
- -webkit-backdrop-filter:blur(8px);
1573
- display:flex;align-items:center;justify-content:center;
1574
- z-index:${2147483647};
1575
- opacity:0;transition:opacity 0.25s ease;
1576
- `;let s=document.createElement("div");s.style.cssText=`
1577
- width:340px;padding:28px;border-radius:var(--sp-radius-xl);
1578
- background:var(--sp-identity-bg);
1579
- backdrop-filter:blur(var(--sp-blur-heavy));
1580
- -webkit-backdrop-filter:blur(var(--sp-blur-heavy));
1581
- border:1px solid var(--sp-glass-border);
1582
- box-shadow:0 16px 48px var(--sp-shadow), 0 8px 16px var(--sp-shadow);
1583
- font-family:var(--sp-font, "Inter",system-ui,-apple-system,sans-serif);
1584
- color:var(--sp-text);
1585
- transform:translateY(12px) scale(0.97);
1586
- transition:transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
1587
- -webkit-font-smoothing:antialiased;
1588
- `;let a$1=`sp-identity-title-${Date.now()}`;s.setAttribute("role","dialog"),s.setAttribute("aria-modal","true"),s.setAttribute("aria-labelledby",a$1);let l=document.createElement("div");l.className="sp-identity-title",l.id=a$1,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)){if(!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(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 yn(t){return gn(t)}function ls(t){let e=useRef(t);e.current=t;let[n,i]=useState(null);return useEffect(()=>{let o=true,r=yn({...e.current,onSkip:s=>{o&&e.current.onSkip?.(s);},onOpen:()=>{o&&e.current.onOpen?.();},onClose:()=>{o&&e.current.onClose?.();},onFeedbackSent:s=>{o&&e.current.onFeedbackSent?.(s);},onError:s=>{o&&e.current.onError?.(s);},onAnnotationStart:()=>{o&&e.current.onAnnotationStart?.();},onAnnotationEnd:()=>{o&&e.current.onAnnotationEnd?.();}});if(!o){r.destroy();return}return i(r),()=>{o=false,r.destroy(),i(null);}},[]),n}export{ls as useSiteping};//# sourceMappingURL=react.js.map
1
+ import {o,ia,ja,$,F,I,l,k,i,b,v,q,s,za,ya,pa,na,Da,sa,w,ea,y,aa,da,la,z,E,h,ka,ga,Z as Z$1,_,L,K,x,J,H,M,fa,r,t,c,P,Q,R,S,D,G,ha,n,m,p,e,a,d}from'./chunk-3EHIWTJH.js';import {useRef,useState,useEffect}from'react';var Ai=new Set(["role","name","aria-label","rel","href"]);function Pi(t,e){let n=Ai.has(t);n||=t.startsWith("data-")&&ce(t);let i=ce(e)&&e.length<100;return i||=e.startsWith("#")&&ce(e.slice(1)),n&&i}function Mi(t){return ce(t)}function Ii(t){return ce(t)}function Li(t){return true}function at(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:Mi,className:Ii,tagName:Li,attr:Pi,timeoutMs:1e3,seedMinLength:3,optimizedMinLength:2,maxNumberOfPathChecks:1/0},i=new Date,o={...n,...e},r=Hi(o.root,n),s,a=0;for(let c of _i(t,o,r)){if(new Date().getTime()-i.getTime()>o.timeoutMs||a>=o.maxNumberOfPathChecks){let h=Fi(t,r);if(!h)throw new Error(`Timeout: Can't find a unique selector after ${o.timeoutMs}ms`);return pe(h)}if(a++,lt(c,r)){s=c;break}}if(!s)throw new Error("Selector was not found.");let l=[...Sn(s,t,o,r,i)];return l.sort(st),l.length>0?pe(l[0]):pe(s)}function*_i(t,e,n){let i=[],o=[],r=t,s=0;for(;r&&r!==n;){let a=Ni(r,e);for(let l of a)l.level=s;if(i.push(a),r=r.parentElement,s++,o.push(...kn(i)),s>=e.seedMinLength){o.sort(st);for(let l of o)yield l;o=[];}}o.sort(st);for(let a of o)yield a;}function ce(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 Ni(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=rt(t,o);s!==void 0&&n.push({name:En(o,s),penalty:10});}let r=rt(t);return r!==void 0&&n.push({name:Oi(o,r),penalty:50}),n}function pe(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 wn(t){return t.map(e=>e.penalty).reduce((e,n)=>e+n,0)}function st(t,e){return wn(t)-wn(e)}function rt(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 Fi(t,e){let n=0,i=t,o=[];for(;i&&i!==e;){let r=i.tagName.toLowerCase(),s=rt(i,r);if(s===void 0)return;o.push({name:En(r,s),penalty:NaN,level:n}),i=i.parentElement,n++;}if(lt(o,e))return o}function Oi(t,e){return t==="html"?"html":`${t}:nth-child(${e})`}function En(t,e){return t==="html"?"html":`${t}:nth-of-type(${e})`}function*kn(t,e=[]){if(t.length>0)for(let n of t[0])yield*kn(t.slice(1,t.length),e.concat(n));else yield e;}function Hi(t,e){return t.nodeType===Node.DOCUMENT_NODE?t:t===e.root?t.ownerDocument:t}function lt(t,e){let n=pe(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*Sn(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),lt(a,i)&&i.querySelector(pe(a))===e&&(yield a,yield*Sn(a,e,n,i,o));}}var Di=["role","aria-label","type","name","href","src","data-testid","data-id"];function $i(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 ct(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}:${pt(t)}`}function pt(t){let e=[];for(let n of Di){let i=t.getAttribute(n);i&&e.push(`${n}=${i}`);}return e.length>0?$i(e.join(",")):"0"}function Tn(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=ct(t),[c,p,h]=l.split(":"),d=0,f=Math.abs(Number(c)-s);f===0?d+=.2:f<=2?d+=.1:f<=5&&(d+=.03);let m=Math.abs(Number(p)-a);return m===0?d+=.4:m===1?d+=.2:m<=3&&(d+=.08),h===r&&(d+=.4),d}function Z(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}var Cn=4;function dt(t){let e=t,n=t.shadowRoot?.activeElement;for(;n instanceof HTMLElement;){let i=n.getBoundingClientRect();i.width>=Cn&&i.height>=Cn&&(e=n),n=n.shadowRoot?.activeElement;}return e}function Rn(t){let e=null,n=i=>{let o=i.target;o instanceof HTMLElement&&(o===document.body||o===document.documentElement||o===t||Z(o)||(e=dt(o)));};return document.addEventListener("focusin",n),{getLastPageFocus(){return e&&!e.isConnected&&(e=null),e},destroy(){document.removeEventListener("focusin",n),e=null;}}}var Me=256;function Ie(t,e){let n=t;for(;n&&Z(n);)n=n[e];return n}function An(t){return t.nodeType===1&&t.getAttribute("data-siteping-ignore")==="true"}function Bi(t){return t.nodeType===3?NodeFilter.FILTER_ACCEPT:An(t)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_SKIP}function te(t,e){let n=e==="before"?"previousElementSibling":"nextElementSibling",i=Ie(t[n],n),o=3;for(;i&&o>0;){let r=e==="before"?zi(i,Me,true).trim():ee(i,Me,true).trim();if(r)return e==="before"?r.slice(-32):r.slice(0,32);i=Ie(i[n],n),o--;}return ""}function Le(t){let e=Ie(t.previousElementSibling,"previousElementSibling"),n=Ie(t.nextElementSibling,"nextElementSibling"),i=e?ee(e,Me,true).trim().slice(0,40):"",o=n?ee(n,Me,true).trim().slice(0,40):"";return [i,o].filter(Boolean).join(" | ")}function ee(t,e,n=false){let i="";if(t.firstElementChild===null){for(let r of t.childNodes)if(r.nodeType===3&&(i+=r.data,i.length>=e))break;return i.length>e?i.slice(0,e):i}let o=n?t.ownerDocument.createTreeWalker(t,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,Bi):t.ownerDocument.createTreeWalker(t,NodeFilter.SHOW_TEXT);for(;i.length<e;){let r=o.nextNode();if(!r)break;i+=r.data;}return i.length>e?i.slice(0,e):i}function zi(t,e,n=false){let i="",o=r=>{for(let s=r.lastChild;s;s=s.previousSibling)if(s.nodeType===3){if(i=s.data+i,i.length>=e)return true}else if(s.nodeType===1&&!(n&&An(s))&&o(s))return true;return false};return o(t),i.length>e?i.slice(-e):i}function Pn(t){if(t.getRootNode()instanceof ShadowRoot)return Xi(t);if(t.id)return `//${t.localName}[@id=${ut(t.id)}]`;let e=[],n=t;for(;n&&n!==document.body&&e.length<6;){let i=n.localName,o=n.parentElement;if(n.id)return e.unshift(`/${i}[@id=${ut(n.id)}]`),"/"+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 n!==document.body?"/"+e.join(""):"/html/body"+e.join("")}function Xi(t){let e="";for(let n=t;n;n=n.parentElement){let i=n.localName;if(n.id){e=`/${i}[@id=${ut(n.id)}]${e}`;continue}let o=1;for(let r=n.previousElementSibling;r;r=r.previousElementSibling)r.localName===i&&o++;e=`/${i}[${o}]${e}`;}return `.${e}`}function ut(t){return t.includes("'")?`concat('${t.replace(/'/g,`',"'",'`)}')`:`'${t}'`}var de="data-feedback-anchor",ht=" >>> ",Mn={className:t=>!/^(css|sc|emotion|styled)-/.test(t)&&!/^[a-z]{1,3}[A-Za-z0-9]{4,8}$/.test(t),attr:t=>["data-testid","data-id","role","aria-label"].includes(t),idName:t=>!t.startsWith("radix-")&&!/^:r[0-9]+:$/.test(t),seedMinLength:3,optimizedMinLength:2};function Ki(t,e){let n=t;for(;n;){let i=n.closest(e);if(i)return i;let o=n.getRootNode();n=o instanceof ShadowRoot?o.host:null;}return null}function In(t){if(t.parentElement)return t.parentElement;let e=t.getRootNode();return e instanceof ShadowRoot?e.host:null}function ft(t){let e=[],n$1=t;for(;n$1;){let f=n$1.getRootNode();f instanceof ShadowRoot?(e.unshift(at(n$1,{...Mn,root:f})),n$1=f.host):(e.unshift(at(n$1,Mn)),n$1=null);}let i=e.join(ht),o=Pn(t),s=(t.textContent?.trim()??"").slice(0,120),a=te(t,"before"),l=te(t,"after"),c=ct(t),p=Le(t),d=Ki(t,`[${de}]`)?.getAttribute(de)??null;return {cssSelector:i,xpath:o,textSnippet:s,textPrefix:a,textSuffix:l,fingerprint:c,neighborText:p,elementTag:t.tagName.slice(0,m),elementId:t.id&&t.id.length<=n?t.id:void 0,anchorKey:d}}function Ln(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 _n(t,e=document.documentElement){let n=mt(t.x+t.width/2,t.y+t.height/2);if(!n||n===e)return document.body;let i=n;for(;i&&i!==document.body;){if(i.hasAttribute(de)&&Ln(i,t))return i;i=In(i);}for(i=n;i&&i!==document.body;){if(Ln(i,t))return i;i=In(i);}return document.body}function mt(t,e){let n=document.elementFromPoint(t,e),i=n?.shadowRoot;for(;i&&typeof i.elementFromPoint=="function";){let o=i.elementFromPoint(t,e);if(!o||o.getRootNode()!==i)break;n=o,i=o.shadowRoot;}return n}function Nn(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}}var Fn={width:334,height:280},ne={top:0,bottom:0};function On(t,e,n,i=ne){let o=i.top+8,r=n.height-i.bottom-8,s=Math.max(0,r-o),a=t.bottom+8,l=t.top-8-e.height,c=f=>f>=o&&f+e.height<=r,p,h=null;c(a)?p=a:c(l)?p=l:e.height<=s?p=Math.min(Math.max(a,o),r-e.height):(p=o,h=s);let d=t.left;return d+e.width>n.width-8&&(d=t.right-e.width),d=Math.max(8,Math.min(d,n.width-8-e.width)),{top:p,left:d,maxHeight:h}}var Wi={question:"type.question",change:"type.change",bug:"type.bug",other:"type.other"},Dn=`opacity ${250}ms cubic-bezier(0.16, 1, 0.3, 1),transform ${250}ms cubic-bezier(0.16, 1, 0.3, 1)`;function bt(){return typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}var _e=class{constructor(e,n){this.colors=e;this.t=n;this.root=y("div",{style:`position:fixed;z-index:${2147483647};pointer-events:auto;width:300px;padding:16px;border-radius:16px;background:${this.colors.glassBg};backdrop-filter:blur(24px);-webkit-backdrop-filter:blur(24px);border:1px solid ${this.colors.glassBorder};box-shadow:0 8px 32px ${this.colors.shadow},0 2px 8px ${this.colors.shadow};font-family:"Inter",system-ui,-apple-system,sans-serif;opacity:0;transform:translateY(8px) scale(0.98);transition:${Dn};display:none;-webkit-font-smoothing:antialiased;`}),this.root.setAttribute("role","dialog"),this.root.setAttribute("aria-modal","true"),this.root.setAttribute("data-siteping-ignore","true");let i=[{type:"question",icon:P},{type:"change",icon:Q},{type:"bug",icon:R},{type:"other",icon:S}];this.typeRow=y("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=`height:44px;border-radius:9999px;border:1px solid ${this.colors.border};background:${this.colors.glassBg};cursor:pointer;display:flex;align-items:center;justify-content:center;gap:5px;font-family:"Inter",system-ui,-apple-system,sans-serif;font-size:13px;font-weight:500;color:${this.colors.textTertiary};transition:all 0.2s ease;padding:0 12px;`;let a=x(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=da(s.dataset.type??"",this.colors);s.style.background=l,s.style.borderColor=aa(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=`width:100%;min-height:72px;max-height:152px;padding:10px 12px;border-radius:12px;border:1px solid ${this.colors.border};background:${this.colors.glassBgHeavy};color:${this.colors.text};font-family:"Inter",system-ui,-apple-system,sans-serif;font-size:13px;line-height:1.5;resize:vertical;outline:none;transition:all 0.2s ease;box-sizing:border-box;`,this.textarea.maxLength=5e3,this.hint=y("div",{style:`font-size:11px;color:${this.colors.textTertiary};text-align:right;margin-top:4px;font-family:"Inter",system-ui,-apple-system,sans-serif;letter-spacing:0.01em;`}),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());});let o=y("div",{style:"display:flex;justify-content:flex-end;gap:8px;margin-top:12px;"});this.cancelBtn=document.createElement("button"),this.cancelBtn.style.cssText=`height:34px;padding:0 16px;border-radius:9999px;border:1px solid ${this.colors.border};background:${this.colors.glassBg};color:${this.colors.textTertiary};font-family:"Inter",system-ui,-apple-system,sans-serif;font-size:13px;font-weight:500;cursor:pointer;transition:all 0.2s ease;`,this.cancelBtn.addEventListener("click",()=>this.dismiss()),this.cancelBtn.addEventListener("mouseenter",()=>{this.submittingState||(this.cancelBtn.style.borderColor=this.colors.accent,this.cancelBtn.style.color=this.colors.accent);}),this.cancelBtn.addEventListener("mouseleave",()=>{this.submittingState||(this.cancelBtn.style.borderColor=this.colors.border,this.cancelBtn.style.color=this.colors.textTertiary);}),this.submitBtn=document.createElement("button"),this.submitBtn.style.cssText=`height:34px;padding:0 18px;border-radius:9999px;border:none;background:${this.colors.accentGradient};color:#fff;font-family:"Inter",system-ui,-apple-system,sans-serif;font-size:13px;font-weight:600;cursor:pointer;opacity:0.35;pointer-events:none;transition:all 0.2s ease;box-shadow:0 2px 8px ${this.colors.accentGlow};display:inline-flex;align-items:center;justify-content:center;min-width:64px;`,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),F(this.root),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;showFrame=null;hideTimeoutId=null;spinnerAnimation=null;sheet=false;stopKeyboardTracking=null;get isOpen(){return this.resolve!==null}get sheetTop(){return this.sheet&&this.isOpen?window.innerHeight-this.root.offsetHeight: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=Wi[i];if(!o)continue;let r=n.querySelector("span");r&&z(r,this.t(o));}this.textarea.placeholder=this.t("popup.placeholder"),this.textarea.setAttribute("aria-label",this.t("popup.textareaAria")),z(this.hint,D()?this.t("popup.submitHintMac"):this.t("popup.submitHintOther")),z(this.cancelBtn,this.t("popup.cancel")),z(this.submitLabel,this.t("popup.submit"));}show(e,n,i=ne){return new Promise(o=>{this.cancelPendingTransition(),this.resolve=o,this.onSubmit=n??null,this.selectedType=null,this.textarea.value="",this.submittingState=false,this.updateSubmitState(),this.resetTypeButtons(),this.previouslyFocused=document.activeElement;let r=ga();this.sheet=fa();let s=this.sheet?"48px":r?"44px":"34px";this.cancelBtn.style.height=s,this.submitBtn.style.height=s,this.cancelBtn.style.flex=this.sheet?"1":"",this.submitBtn.style.flex=this.sheet?"2":"",this.textarea.style.fontSize=r?"16px":"13px",this.textarea.style.minHeight=this.sheet?"96px":"72px",this.hint.style.display=r?"none":"",this.root.style.transform=this.hiddenTransform(),G(this.root,false),this.root.style.display="block",this.layout(e,i),this.onKeydownTrap=a=>{if(a.key==="Escape"&&this.dismiss(),a.key==="Tab"){let l=Array.from(this.root.querySelectorAll('button:not([disabled]), textarea:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])'));if(l.length===0)return;let c=l[0],p=l[l.length-1];if(!c||!p)return;a.shiftKey?(document.activeElement===c||!this.root.contains(document.activeElement))&&(a.preventDefault(),p.focus()):(document.activeElement===p||!this.root.contains(document.activeElement))&&(a.preventDefault(),c.focus());}},this.root.addEventListener("keydown",this.onKeydownTrap),this.root.style.transition=bt()?"none":Dn,this.showFrame=requestAnimationFrame(()=>{this.showFrame=null,this.root.style.opacity="1",this.root.style.transform="translateY(0) scale(1)",(r?this.typeRow.querySelector("button"):this.textarea)?.focus();});})}layout(e,n){let i=this.root.style;if(i.width=this.sheet?"auto":"300px",i.borderRadius=this.sheet?"20px 20px 0 0":"16px",i.background=this.sheet?this.colors.bg:this.colors.glassBg,i.boxShadow=this.sheet?`0 -8px 32px ${this.colors.shadow}`:`0 8px 32px ${this.colors.shadow}, 0 2px 8px ${this.colors.shadow}`,i.overscrollBehavior=this.sheet?"contain":"",this.stopKeyboardTracking?.(),this.stopKeyboardTracking=null,this.sheet){i.top="auto",i.left="0",i.right="0",i.overflowY="auto";let a=(l,c=window.innerHeight)=>{i.bottom=`${l}px`,i.maxHeight=`${c-8}px`,i.padding=`16px 16px ${l>0?"16px":"calc(16px + env(safe-area-inset-bottom, 0px))"}`;};a(0),this.stopKeyboardTracking=ha(a);return}i.right="",i.bottom="",i.padding="16px",i.maxHeight="",i.overflowY="";let{top:o,left:r,maxHeight:s}=On(e,this.measure(),{width:window.innerWidth,height:window.innerHeight},n);i.top=`${o}px`,i.left=`${r}px`,s!==null&&(i.maxHeight=`${Math.max(0,s-this.verticalChromeHeight())}px`,i.overflowY="auto",this.root.scrollTop=0);}hiddenTransform(){return this.sheet?"translateY(100%)":"translateY(8px) scale(0.98)"}measure(){let e=this.root.offsetWidth,n=this.root.offsetHeight;return e>0&&n>0?{width:e,height:n}:Fn}verticalChromeHeight(){let e=window.getComputedStyle(this.root);return e.boxSizing==="border-box"?0:[e.paddingTop,e.paddingBottom,e.borderTopWidth,e.borderBottomWidth].reduce((n,i)=>n+(Number.parseFloat(i)||0),0)}selectType(e,n){this.selectedType=e;let i=n.querySelectorAll("button");for(let o of i){let r=o.dataset.type===e,s=aa(o.dataset.type??"",this.colors),a=da(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();});}dismiss(){this.submittingState||!this.isOpen||(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="width:14px;height:14px;border:2px solid rgba(255,255,255,0.35);border-top-color:#fff;border-radius:50%;box-sizing:border-box;",!bt()&&typeof e.animate=="function"&&(this.spinnerAnimation=e.animate([{transform:"rotate(0deg)"},{transform:"rotate(360deg)"}],{duration:600,iterations:1/0,easing:"linear"})),e}hideElement(){if(this.cancelPendingTransition(),this.onKeydownTrap&&(this.root.removeEventListener("keydown",this.onKeydownTrap),this.onKeydownTrap=null),this.submittingState&&this.exitSubmittingState(),this.onSubmit=null,this.stopKeyboardTracking?.(),this.stopKeyboardTracking=null,this.root.style.opacity="0",this.root.style.transform=this.hiddenTransform(),this.previouslyFocused?.focus(),this.previouslyFocused=null,G(this.root,true),bt()){this.root.style.display="none";return}this.hideTimeoutId=setTimeout(()=>{this.hideTimeoutId=null,this.root.style.display="none";},250);}cancelPendingTransition(){this.showFrame!==null&&cancelAnimationFrame(this.showFrame),this.hideTimeoutId!==null&&clearTimeout(this.hideTimeoutId),this.showFrame=null,this.hideTimeoutId=null;}destroy(){this.submittingState&&this.exitSubmittingState(),this.cancelPendingTransition(),this.resolve?.(null),this.resolve=null,this.onSubmit=null,this.onKeydownTrap&&(this.root.removeEventListener("keydown",this.onKeydownTrap),this.onKeydownTrap=null),this.stopKeyboardTracking?.(),this.stopKeyboardTracking=null,this.root.remove();}};var ue,$n=false;async function ji(){if(ue!==void 0)return ue;try{let t=await import('html2canvas-pro');return ue=t.default??t,ue}catch(t){return ue=null,$n||($n=true,console.warn("[siteping] html2canvas-pro import failed unexpectedly. Capture is disabled for this session \u2014 feedbacks are still submitted, just without screenshots. Underlying error:",t)),null}}function gt(t,e,n){return Math.min(n,Math.max(t,e))}function Ne(t){return gt(0,Math.round(t*1e4)/1e4,1)}async function Bn(t,e){let n=await ji();if(!n)return null;let i=.85,o=1200,r=gt(48,t.width*.6,280),s=gt(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),h=Math.max(0,a-r),d=Math.max(0,l-s),f=Math.min(c,a+t.width+r)-h,m=Math.min(p,l+t.height+s)-d;if(f<=0||m<=0)return null;let v={xPct:Ne((a-h)/f),yPct:Ne((l-d)/m),wPct:Ne(t.width/f),hPct:Ne(t.height/m)};try{let T=await n(document.body,{x:h,y:d,width:f,height:m,scale:window.devicePixelRatio,useCORS:!0,allowTaint:!0,logging:!1,ignoreElements:H=>H.tagName==="SITEPING-WIDGET"||H.closest?.("siteping-widget")!==null||H.getAttribute?.("data-siteping-ignore")==="true"});if(T.width<=o)return {dataUrl:T.toDataURL("image/jpeg",i),region:v};let A=o/T.width,C=o,E=Math.round(T.height*A),_=document.createElement("canvas");_.width=C,_.height=E;let X=_.getContext("2d");return X?(X.drawImage(T,0,0,C,E),{dataUrl:_.toDataURL("image/jpeg",i),region:v}):null}catch(T){return console.warn("[siteping] Screenshot capture failed:",T),null}}var Fe=10;function zn(t){let e=Math.max(0,t.left),n=Math.max(0,t.top);return new DOMRect(e,n,Math.max(0,Math.min(t.right,window.innerWidth)-e),Math.max(0,Math.min(t.bottom,window.innerHeight)-n))}function Yi(){return {clientId:p()}}var Oe=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 _e(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;unregisterEscapeLayer=H(document,()=>this.isActive);get isBusy(){return this.isActive}refreshLabels(){this.popup.refreshLabels();}async maybeCapture(e){return this.enableScreenshot?Bn(e):null}activate(){if(this.isActive)return;this.isActive=true;let e=!this.instantMode,n=fa(),i=ga(),o=this.t("annotator.instruction");this.preActiveFocusElement=document.activeElement;let r=document.activeElement;if(this.keyboardTarget=r instanceof HTMLElement&&r!==document.body&&r!==document.documentElement&&!Z(r)?dt(r):this.getFallbackTarget?.()??null,this.savedOverflow=document.body.style.overflow,document.body.style.overflow="hidden",this.overlay=y("div",{style:`position:fixed;inset:0;z-index:${2147483646};pointer-events:auto;background:rgba(15,23,42,0.04);cursor:${e?"crosshair":"default"};touch-action:none;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;`}),this.overlay.setAttribute("role","application"),this.overlay.setAttribute("aria-label",e?o:this.t("annotator.instantInstruction")),this.overlay.setAttribute("data-siteping-ignore","true"),e){this.toolbar=y("div",{style:`position:fixed;top:0;left:0;right:0;z-index:${2147483647};pointer-events:auto;min-height:52px;box-sizing:border-box;padding:calc(env(safe-area-inset-top,0px) + 8px) ${n?"12px 8px 16px":"16px 8px"};background:${n?this.colors.bg:this.colors.glassBg};backdrop-filter:blur(24px);-webkit-backdrop-filter:blur(24px);border-bottom:1px solid ${this.colors.glassBorder};display:flex;align-items:center;justify-content:center;gap:${n?12:16}px;font-family:"Inter",system-ui,-apple-system,sans-serif;font-size:14px;line-height:1.35;color:${this.colors.text};box-shadow:0 4px 16px ${this.colors.shadow};-webkit-font-smoothing:antialiased;`}),this.toolbar.setAttribute("data-siteping-ignore","true");let s=y("span",{style:`width:8px;height:8px;border-radius:50%;flex-shrink:0;background:${this.colors.accent};box-shadow:0 0 8px ${this.colors.accentGlow};animation:pulse 1.5s ease-in-out infinite;`}),a=document.createElement("style");a.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(a);let l=y("span",{style:"font-weight:500;letter-spacing:-0.01em;min-width:0;"});z(l,i?this.t("annotator.touchInstruction"):o);let c=document.createElement("button");c.style.cssText=`height:${i?40:34}px;padding:0 18px;border-radius:9999px;flex-shrink:0;border:1px solid ${this.colors.border};background:${this.colors.glassBg};color:${this.colors.textTertiary};font-family:"Inter",system-ui,-apple-system,sans-serif;font-size:13px;font-weight:500;cursor:pointer;transition:all 0.2s ease;`,z(c,this.t("annotator.cancel")),c.addEventListener("click",()=>this.cancelSession()),c.addEventListener("mouseenter",()=>{c.style.borderColor=this.colors.typeBug,c.style.color=this.colors.typeBug,c.style.background=this.colors.typeBugBg;}),c.addEventListener("mouseleave",()=>{c.style.borderColor=this.colors.border,c.style.color=this.colors.textTertiary,c.style.background=this.colors.glassBg;}),this.toolbar.appendChild(s),this.toolbar.appendChild(l),this.toolbar.appendChild(c);}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),F(this.overlay),this.toolbar&&F(this.toolbar),document.body.appendChild(this.overlay),this.toolbar&&document.body.appendChild(this.toolbar),this.overlay.focus({preventScroll:true});}toolbarInsets(){if(!this.toolbar)return ne;let e=this.toolbar.getBoundingClientRect();if(e.height===0)return ne;let n=window.innerHeight;return e.top+e.height/2<n/2?{top:Math.max(0,e.bottom),bottom:0}:{top:0,bottom:Math.max(0,n-e.top)}}cancelSession(){this.isActive&&(this.popup.dismiss(),!this.popup.isOpen&&this.deactivate());}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.cancelSession();};onOverlayKeyDown=async e=>{if(e.key!=="Enter"||(e.preventDefault(),this.popup.isOpen)||this.isDrawing)return;let n=this.keyboardTarget;!n||!(n instanceof HTMLElement)||await this.annotateElement(n);};async annotateElement(e,n=false){let i=e.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:ft(e),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=await this.openForm(a,o,n?zn(o):o);this.drawingRect?.remove(),this.drawingRect=null,l&&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=y("div",{style:`position:fixed;border:2px solid ${this.colors.accent};background:${this.colors.accent}12;pointer-events:none;border-radius:8px;box-shadow:0 0 16px ${this.colors.accentGlow};transition:box-shadow 0.15s ease;`});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];if(n){if(this.isDrawing&&(Math.abs(n.clientX-this.startX)<Fe||Math.abs(n.clientY-this.startY)<Fe)){this.isDrawing=false,this.drawingRect?.remove(),this.drawingRect=null;let i=this.elementAt(n.clientX,n.clientY);i&&await this.annotateElement(i,true);return}await this.finishDrawing(n.clientX,n.clientY);}};elementAt(e,n){this.overlay&&(this.overlay.style.pointerEvents="none");let i=mt(e,n);this.overlay&&(this.overlay.style.pointerEvents="auto");let o=i instanceof SVGElement?(i.ownerSVGElement??i).parentElement:i;return o instanceof HTMLElement&&o!==document.body&&o!==document.documentElement&&!Z(o)?o:null}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<Fe||s<Fe){this.drawingRect.remove(),this.drawingRect=null;return}let a=new DOMRect(i,o,r,s),{annotation:l}=this.buildAnnotation(a),c=await this.openForm(l,a);this.drawingRect?.remove(),this.drawingRect=null,c&&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=zn(a);this.drawingRect?.remove(),this.drawingRect=y("div",{style:`position:fixed;left:${i}px;top:${o}px;width:${20}px;height:${20}px;border:2px solid ${this.colors.accent};background:${this.colors.accent}12;pointer-events:none;border-radius:8px;box-shadow:0 0 16px ${this.colors.accentGlow};`}),this.drawingRect.setAttribute("data-siteping-ignore","true"),this.overlay?.appendChild(this.drawingRect),await this.openForm(s,r,l),this.drawingRect?.remove(),this.drawingRect=null,this.deactivate();}openForm(e,n,i=n){let o=Yi(),r=this.popup.show(n,s=>this.runSubmission(e,s,i,o),this.toolbarInsets());return this.revealSelection(n),r}revealSelection(e){let n=this.popup.sheetTop;if(n===null||!this.drawingRect)return;let i=Math.min(e.bottom+16-n,e.top-72);if(i<=0)return;let o=window.scrollY;window.scrollBy({top:i,behavior:"instant"}),this.drawingRect.style.top=`${e.top-(window.scrollY-o)}px`;}async runSubmission(e,n,i,o){o.screenshot===void 0&&(o.screenshot=await this.maybeCapture(new DOMRect(i.x+e.scrollX-window.scrollX,i.y+e.scrollY-window.scrollY,i.width,i.height)));let r=o.screenshot;await new Promise((s,a)=>{let l=()=>{c(),p(),h(),this.rejectPendingSubmission=null;},c=this.bus.on("feedback:sent",()=>{l(),s();}),p=this.bus.on("feedback:error",d=>{l(),a(d);}),h=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,clientId:o.clientId,screenshotDataUrl:r?.dataUrl??null,screenshotRegion:r?.region??null});});}buildAnnotation(e){this.overlay&&(this.overlay.style.pointerEvents="none");let n=_n(e);this.overlay&&(this.overlay.style.pointerEvents="auto");let i=ft(n),o=n.getBoundingClientRect(),r=Nn(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.unregisterEscapeLayer(),this.rejectPendingSubmission?.(new Error("Annotator destroyed during submission")),this.popup.destroy();}};function He(t,e){let n=`siteping_own_feedback:${JSON.stringify([t,e??null])}`,i=()=>{try{let r=JSON.parse(localStorage.getItem(n)??"[]");return new Set(Array.isArray(r)?r.filter(s=>typeof s=="string"):[])}catch{return new Set}},o=r=>{try{r.size>0?localStorage.setItem(n,JSON.stringify([...r].slice(-500))):localStorage.removeItem(n);}catch{}};return {ids:i,add(r){let s=i();s.delete(r),o(s.add(r));},remove(...r){let s=i(),a=s.size;for(let l of r)s.delete(l);s.size<a&&o(s);},clear:()=>o(new Set)}}var Xn=3,he=1e4,Y="siteping_retry_queue",Ui=20;function vt(t,e,n){let i,o=new Promise((r,s)=>{i=setTimeout(()=>s(n()),e);});return Promise.race([t,o]).finally(()=>clearTimeout(i))}async function qn(t,e){let n={};e&&(n["Content-Type"]="application/json"),t.apiKey&&(n.Authorization=`Bearer ${t.apiKey}`);let i=typeof t.headers=="function"?await vt(Promise.resolve(t.headers()),he,()=>new Error(`headers factory did not settle within ${he/1e3} s`)):t.headers;return r(n,i)}async function ie(t$1,e,n,i,{boundBody:o=false}={}){for(let r=0;;r++){let s=new AbortController,a=setTimeout(()=>s.abort(),he);try{let p=await fetch(t$1,{...e,signal:s.signal}).catch(h=>{if(r===Xn)throw v(h,n);return null});if(p&&(p.ok||p.status>=400&&p.status<500||r===Xn)){if(clearTimeout(a),o&&(a=setTimeout(()=>s.abort(),he)),!p.ok)throw await t(p,n);return await i(p).catch(h=>{throw v(h,n)})}}finally{clearTimeout(a);}let l=1e3*2**r,c=Math.random()*1e3-500;await new Promise(p=>setTimeout(p,l+c));}}function qi(t){return t instanceof c||t instanceof b&&t.code==="SERVER"}function Vi(t){return t>=500}var Gi="siteping_retry_queue";async function xt(t){return typeof navigator<"u"&&navigator.locks?navigator.locks.request(Gi,()=>t()):t()}function Qi(t){if(!d(t,"endpoint")||typeof t.endpoint!="string"||!d(t,"payload"))return false;let{payload:e}=t;return d(e,"authorName")&&typeof e.authorName=="string"&&d(e,"authorEmail")&&typeof e.authorEmail=="string"}function wt(){let t=localStorage.getItem(Y);if(!t)return [];let e;try{e=JSON.parse(t);}catch{return localStorage.removeItem(Y),console.warn(`[siteping] discarded an unreadable retry queue from localStorage (${t.length} chars)`),[]}return Array.isArray(e)?e.filter(Qi):[]}function Ji(t,e){xt(()=>{try{let n=wt().filter(r=>r.payload.clientId!==e.clientId);if(n.length>=Ui&&n.shift(),n.push({endpoint:t,payload:e}),yt(n))return;let i=n.slice(),o=0;for(let[r,s]of i.entries())if(Kn(s)&&(i[r]=eo(s),o+=1,yt(i))){console.warn(`[siteping] retry queue exceeded the localStorage quota \u2014 dropped the screenshot of ${o} of ${n.length} queued feedback(s)`);return}for(;i.length>1;)if(i.shift(),yt(i)){let r=n.length-i.length,s=n.slice(r).filter(Kn).length;console.warn(`[siteping] retry queue exceeded the localStorage quota \u2014 dropped the ${r} oldest of ${n.length} queued feedback(s)${s>0?`, and the screenshot of ${s} of the rest`:""}`);return}console.warn("[siteping] feedback could not be queued for retry \u2014 localStorage is full or unavailable");}catch{}});}function Zi(t){xt(()=>{try{let e=wt(),n=e.filter(i=>i.payload.clientId!==t);if(n.length===e.length)return;n.length>0?localStorage.setItem(Y,JSON.stringify(n)):localStorage.removeItem(Y);}catch{}});}function yt(t){try{return localStorage.setItem(Y,JSON.stringify(t)),!0}catch{return false}}function Kn(t){return t.payload.screenshotDataUrl!=null}function eo(t){let{screenshotDataUrl:e,screenshotRegion:n,...i}=t.payload;return {endpoint:t.endpoint,payload:i}}function Wn(t){return t.trim()}function jn(t){return t.trim().toLowerCase()}async function Vn(t,e,n={}){await xt(async()=>{try{let i=wt();if(i.length===0)return;let o=[],r=[],s=0;for(let p of i){if(p.endpoint!==t){r.push(p);continue}!e||Wn(p.payload.authorName)===Wn(e.name)&&jn(p.payload.authorEmail)===jn(e.email)?o.push(p):s+=1;}if(o.length===0&&s===0)return;s>0;let a=[],l=0;if(o.length>0){let p=await qn(n,!0);for(let h of o){let d$1=new AbortController,f=setTimeout(()=>d$1.abort(),he);try{let m=await fetch(t,{method:"POST",headers:p,body:JSON.stringify(h.payload),signal:d$1.signal});if(m.ok){let v=await m.json().catch(()=>null);d(v,"id")&&typeof v.id=="string"&&He(h.payload.projectName,t).add(v.id);continue}Vi(m.status)?a.push(h):l+=1;}catch{a.push(h);}finally{clearTimeout(f);}}}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=r.concat(a);c.length>0?localStorage.setItem(Y,JSON.stringify(c)):localStorage.removeItem(Y);}catch{}});}function Yn(t,e){let n=Math.min(1,Math.max(0,t)),i=e-(n-t);return [n,Math.max(0,n+i<=1?i:1-n)]}function to(t){let[e,n]=Yn(t.rect.xPct,t.rect.wPct),[i,o]=Yn(t.rect.yPct,t.rect.hPct);return {...t,rect:{xPct:e,yPct:i,wPct:n,hPct:o}}}async function De(t){return await t.json()}async function Un(){}var $e=class{constructor(e,n,i={}){this.endpoint=e;this.projectName=n;this.auth=i;}endpoint;projectName;auth;async headers(e,n){try{return await qn(this.auth,e)}catch(i){throw v(i,n)}}async sendFeedback(e){let n="Failed to send feedback",{screenshotRegion:i,...o}=e,r={...o,annotations:o.annotations.map(to)},s=i?{...r,screenshotRegion:i}:r;try{let a=await ie(this.endpoint,{method:"POST",headers:await this.headers(!0,n),body:JSON.stringify(s)},n,De,{boundBody:!0});return Zi(s.clientId),a}catch(a){throw qi(a)&&Ji(this.endpoint,s),a}}async getFeedbacks(e,n){let i="Failed to fetch feedbacks",o=q({projectName:e,...n}),r=await this.headers(false,i);return ie(s(this.endpoint,o),{method:"GET",cache:"no-store",...Object.keys(r).length>0?{headers:r}:{}},i,De)}async addComment(e,n){let i="Failed to post comment";return ie(this.endpoint,{method:"POST",headers:await this.headers(true,i),body:JSON.stringify({...n,projectName:this.projectName,feedbackId:e})},i,De,{boundBody:true})}async resolveFeedback(e,n){let i="Failed to update feedback";return ie(this.endpoint,{method:"PATCH",headers:await this.headers(true,i),body:JSON.stringify({id:e,projectName:this.projectName,status:n?"resolved":"open"})},i,De)}async deleteFeedback(e){let n="Failed to delete feedback";await ie(this.endpoint,{method:"DELETE",headers:await this.headers(true,n),body:JSON.stringify({id:e,projectName:this.projectName})},n,Un);}async deleteAllFeedbacks(e){let n="Failed to delete all feedbacks";await ie(this.endpoint,{method:"DELETE",headers:await this.headers(true,n),body:JSON.stringify({projectName:e,deleteAll:true})},n,Un);}};function Be(t,e){if(t.length<=e)return t;let n=e-1,i=t.charCodeAt(n-1);return i>=55296&&i<=56319&&(n-=1),`${t.slice(0,n)}\u2026`}var Et=50,kt=500,no=["log","info","warn","error"];function io(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?`
2
+ ${t.stack}`:""}`;try{let e=[],n=kt;return JSON.stringify(t,function(i,o){if(!(--n<0)){if(typeof o=="function")return "[Function]";if(typeof o=="symbol")return o.toString();if(typeof o!="object"||o===null)return o;for(;e.length>0&&e[e.length-1]!==this;)e.pop();return e.includes(o)?"[Circular]":(e.push(o),o)}})}catch{try{return String(t)}catch{return "[Unserializable]"}}}function oo(t){let e="";for(let n=0;n<t.length&&(n>0&&(e+=" "),e+=io(t[n]),!(e.length>=kt));n++);return Be(e,kt)}var ze=class{maxEntries;entries=[];originals=new Map;wrappers=new Map;disposed=false;constructor(e=Et){if(this.maxEntries=Number.isFinite(e)&&e>=0?Math.min(Math.floor(e),Et):Et,!(typeof console>"u"))for(let n of no){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{}this.wrappers.set(n,r),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:oo(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();}};var St=20,so=2e3,ro=20,ao=6e5,lo=599;function Gn(t){let e=co(po(t)),n=e.search(/[?#]/);return Be(n===-1?e:e.slice(0,n),so)}function co(t){try{let e=new URL(t,typeof location>"u"?void 0:location.href);return !e.username&&!e.password?t:(e.username="",e.password="",e.href)}catch{return t}}function po(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 Xe=class{maxEntries;entries=[];originalFetch=null;originalXhrOpen=null;originalXhrSend=null;wrappedFetch=null;wrappedXhrOpen=null;wrappedXhrSend=null;disposed=false;constructor(e=St){this.maxEntries=Number.isFinite(e)&&e>=0?Math.min(Math.floor(e),St):St,this.installFetch(),this.installXhr();}push(e){this.maxEntries!==0&&(this.entries.length>=this.maxEntries&&this.entries.shift(),this.entries.push({...e,method:e.method.slice(0,ro),status:e.status<=lo?e.status:0,durationMs:Math.min(Math.max(e.durationMs,0),ao)}));}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=Gn(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}};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,r=new WeakMap,s=function(l,c,...p){try{r.set(this,{method:l.toUpperCase(),url:Gn(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=r.get(this);if(c){let p=()=>{try{let h=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(h-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=s,this.wrappedXhrSend=a,e.open=s,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 fe=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 uo=54,ho=60,fo={chat:"fab.messages",annotate:"fab.annotate","toggle-annotations":"fab.annotations"},Ke=class{constructor(e,n,i,o){this.bus=i;this.t=o;let r=n.position??"bottom-right";this.items=[{id:"chat",icon:Z$1},{id:"annotate",icon:_}],n.showAnnotationsToggle!==false&&this.items.push({id:"toggle-annotations",icon:K,iconAlt:L}),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(x(J)),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 l=0;l<this.items.length;l++){let c=this.items[l];if(!c)continue;let p=document.createElement("button");p.className="sp-radial-item",p.style.setProperty("--sp-i",String(l)),p.appendChild(x(c.icon)),p.setAttribute("role","menuitem"),p.dataset.itemId=c.id,p.addEventListener("click",d=>{d.stopPropagation(),this.handleItemClick(c.id);});let h=document.createElement("span");h.className="sp-radial-label",p.appendChild(h),this.radialContainer.appendChild(p);}this.scrim=document.createElement("div"),this.scrim.className="sp-scrim",this.scrim.addEventListener("click",()=>this.close()),this.root=document.createElement("div"),this.root.appendChild(this.scrim),this.root.appendChild(this.radialContainer),this.root.appendChild(this.fab),e.appendChild(this.root),this.applyLabels();let s=e.host;this.onDocumentClick=l=>{this.isOpen&&!l.composedPath().includes(s)&&this.close();},document.addEventListener("click",this.onDocumentClick,true);let a=l=>{l.key==="Escape"&&this.isOpen&&(l.stopPropagation(),this.close());};this.fab.addEventListener("keydown",a),this.radialContainer.addEventListener("keydown",a),H(this.root,()=>this.isOpen),this.radialContainer.addEventListener("keydown",l=>{let c=Array.from(this.radialContainer.querySelectorAll(".sp-radial-item"));if(c.length===0||!this.isOpen)return;let p=e.activeElement??document.activeElement,h=c.indexOf(p);switch(l.key){case "ArrowUp":{l.preventDefault();let d=h<=0?c.length-1:h-1;c[d]?.focus();break}case "ArrowDown":{l.preventDefault();let d=h>=c.length-1?0:h+1;c[d]?.focus();break}case "Home":{l.preventDefault(),c[0]?.focus();break}case "End":{l.preventDefault(),c[c.length-1]?.focus();break}}});}bus;t;root;scrim;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=fo[i];if(!o)continue;let r=this.t(o);n.setAttribute("aria-label",r);let s=n.querySelector(".sp-radial-label");s&&z(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);z(this.badgeEl,n),this.badgeEl.setAttribute("aria-label",ka(this.t,"fab.badge",{count:e}));}toggle(){this.isOpen?this.close():this.open();}open(){this.isOpen=true,this.setFabIcon(M),this.fab.setAttribute("aria-expanded","true"),this.scrim.classList.add("sp-scrim--open");let e=ga()?ho:uo;this.radialContainer.querySelectorAll(".sp-radial-item").forEach((i,o)=>{let r=-(16+e*(o+1));i.style.transform=`translate(0px, ${r}px) scale(1)`,i.classList.add("sp-radial-item--open");}),requestAnimationFrame(()=>{this.radialContainer.querySelector(".sp-radial-item")?.focus();});}close(){this.isOpen=false,this.setFabIcon(J),this.fab.setAttribute("aria-expanded","false"),this.scrim.classList.remove("sp-scrim--open"),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(x(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=x(this.annotationsVisible?K:L);i.replaceWith(o);}break}}}destroy(){document.removeEventListener("click",this.onDocumentClick,true),this.root.remove();}};var Qn="siteping_identity";function mo(t){if(!d(t,"name")||!d(t,"email"))return false;let{name:e$1,email:n}=t;return typeof e$1=="string"&&typeof n=="string"&&e$1.length>0&&e$1.length<=e&&n.length<=e&&a(n)}function Tt(){try{let t=localStorage.getItem(Qn);if(!t)return null;let e=JSON.parse(t);return mo(e)?e:null}catch{return null}}function Jn(t){try{localStorage.setItem(Qn,JSON.stringify(t));}catch{}}function oe(t){return t.normalize("NFC").replace(/\s+/g," ").trim()}function Zn(t){return t.replace(/\s+/g," ").trim()}function bo(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 me(t,e){if(t===e)return 1;let n=Math.max(t.length,e.length);return n===0?1:1-bo(t,e)/n}function go(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 h=i[p-1]+(e.charCodeAt(p-1)===a?0:1),d=i[p]+1,f=o[p-1]+1;o[p]=Math.min(h,d,f);}let l=o[n];l<r&&(r=l);let c=i;i=o,o=c;}return r}function ei(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=me(i,e);return r>=n?r:0}if(e.length<8&&i.length>64)return 0;let o=1-go(i,e)/e.length;return o>=n?o:0}function ti(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 ni(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 ii(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 oi(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 yo={checkOpacity:true,opacityProperty:true,checkVisibilityCSS:true,visibilityProperty:true};function be(t){if(!t.isConnected)return "hidden";if(typeof t.checkVisibility=="function")return t.checkVisibility(yo)?"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 si(t){switch(t){case "hidden":return .3;case "soft-hidden":return .6;default:return 1}}var se={anchorKey:1,id:1,css:.95,xpath:.9,scan:.85},At=16,vo=24,ri=1e4,Mt=500,xo=.5,Ct=.6,wo=.4,Eo=2e3,Pt=.8,Rt=.6,ko=.05;function We(t,e){return oe((t??"").slice(0,Eo)).slice(0,e)}function So(t){let e=We(t.textSnippet,Mt),n=ii(e),i=0;for(let o of n.values())i+=o;return {snippet:e,snippetBigrams:ti(e),snippetBigramTotal:Math.max(0,e.length-1),snippetWordPairs:n,snippetWordPairTotal:i,prefix:We(t.textPrefix,128),suffix:We(t.textSuffix,128),neighbor:We(t.neighborText,128),fingerprint:(t.fingerprint??"").slice(0,64),tag:typeof t.elementTag=="string"?t.elementTag:""}}function To(t,e){let n=So(t),{pool:i,treeRoots:o}=Ro(t),r=[];for(let[d,f]of i){let m=ai(d,f,n);m&&r.push(m);}let s=0,a=false;for(let d of r)d.final>s&&(s=d.final),(d.strategy==="id"||d.strategy==="anchorKey")&&d.visibility===1&&(d.signals?.text??0)>=Pt&&(d.signals?.fingerprint===void 0||d.signals.fingerprint>=Pt)&&(a=true);let l=!!(n.snippet||n.fingerprint||n.prefix||n.suffix||n.neighbor),c=e?.scanBudget;if(l&&o.length>0&&s<se.scan&&!a)if(c&&c.remaining<=0)c.starved=true;else {c&&c.remaining--;for(let d of Ao(n,i,o)){let f=ai(d,"scan",n);f&&r.push(f);}}let p=r.filter(Po);if(p.length===0)return null;p.sort((d,f)=>f.final-d.final);let h=Io(p);return {element:h.element,confidence:Lo(h),strategy:h.strategy}}function je(t,e){let n=[];for(let i of t){let o=i.querySelectorAll(e);for(let r=0;r<o.length&&n.length<At;r++){let s=o[r];s&&n.push(s);}if(n.length===At)break}return n}function Co(t){let e=[],n=[document];for(let i of t){let o;try{o=je(n,i);}catch{return []}let r=[];for(let s of o)s.shadowRoot&&r.push(s.shadowRoot);if(r.length===0)return [];e.push(r),n=r;}return e}function Ro(t){let e=new Map,n=(l,c,p)=>{!l||e.has(l)||p&&l.tagName!==t.elementTag||e.set(l,c);},i=typeof t.cssSelector=="string"?t.cssSelector.split(ht):[],o=i[i.length-1]??t.cssSelector,r=i.length>1?Co(i.slice(0,-1)):null,s=r?r[r.length-1]??[]:[document],a=r?[document,...r.flat()]:s;if(t.anchorKey){let l=t.anchorKey.replace(/\\/g,"\\\\").replace(/"/g,'\\"');try{for(let c of je(a,`[${de}="${l}"]`))n(c,"anchorKey",!1);}catch{}}if(t.elementId){let l=t.elementId.replace(/\\/g,"\\\\").replace(/"/g,'\\"');try{for(let c of je(s,`[id="${l}"]`))n(c,"id",!0);}catch{for(let c of s)n(c.getElementById(t.elementId),"id",true);}}try{for(let l of je(s,o))n(l,"css",!0);}catch{}if(r)return {pool:e,treeRoots:s};try{let l=document.evaluate(t.xpath,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null),c=Math.min(l.snapshotLength,At);for(let p=0;p<c;p++){let h=l.snapshotItem(p);h instanceof Element&&n(h,"xpath",!0);}}catch{}return {pool:e,treeRoots:s}}function Ao(t,e,n){let i=t.tag.toLowerCase();if(!i)return [];let o=[];try{for(let c of n){let p=c.querySelectorAll(i);for(let h=0;h<p.length&&o.length<ri;h++){let d=p[h];d&&o.push(d);}if(o.length===ri)break}}catch{return []}let r=t.fingerprint.split(":"),s=r.length===3?Number(r[0]):Number.NaN,a=r.length===3?r[2]??"":"",l=[];for(let c of o){if(e.has(c))continue;let p=0;if(t.snippetBigramTotal>0){let h=Zn(ee(c,Mt)),d=ni(t.snippetBigrams,t.snippetBigramTotal,h);if(t.snippetWordPairTotal>0){let f=d>0?oi(t.snippetWordPairs,t.snippetWordPairTotal,h):0;p+=.6*(.5*d+.5*f);}else p+=.6*d;}if(a&&pt(c)===a&&(p+=.25),!Number.isNaN(s)){let h=Math.abs(c.children.length-s);h===0?p+=.15:h<=2&&(p+=.07);}l.push({element:c,cheap:p});}return l.sort((c,p)=>p.cheap-c.cheap),l.slice(0,vo).map(c=>c.element)}function ai(t,e,n){let i=Mo(t,n),o=si(be(t));return i===null?e==="scan"?null:{element:t,strategy:e,verification:Rt,strongest:Rt,visibility:o,final:se[e]*Rt*o,unverified:true}:{element:t,strategy:e,verification:i.blend,strongest:i.strongest,signals:i,visibility:o,final:se[e]*i.blend*o}}function Po(t){if(t.strategy==="scan")return t.verification>=wo;if(t.unverified||!t.signals)return true;let e=t.signals;return e.text===void 0||e.text>=xo?true:(e.fingerprint??0)>=Ct||(e.context??0)>=Ct||(e.neighbor??0)>=Ct}function Mo(t,e){let n=0,i=0,o={blend:0,strongest:0};if(e.snippet){i+=40;let r=oe(ee(t,Mt));o.text=ei(r,e.snippet,.5),n+=o.text*40;}if(e.fingerprint&&(i+=20,o.fingerprint=Tn(t,e.fingerprint),n+=o.fingerprint*20),e.prefix||e.suffix){i+=20;let r=0,s=0;if(e.prefix){let a=oe(te(t,"before"));r+=a?me(a,e.prefix):0,s++;}if(e.suffix){let a=oe(te(t,"after"));r+=a?me(a,e.suffix):0,s++;}s>0&&(o.context=r/s,n+=o.context*20);}if(e.neighbor){i+=20;let r=oe(Le(t));o.neighbor=r?me(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 Io(t){let e=t[0],n=t.filter(o=>e.final-o.final<=ko&&(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 Lo(t){return t.strategy==="scan"?Math.min(t.verification,se.scan):t.unverified?se[t.strategy]:se[t.strategy]*Math.min(1,t.strongest/Pt)}function Ye(t,e,n){let i=To(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 It(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 Ue(t){return {xPct:t.xPct,yPct:t.yPct,wPct:t.wPct,hPct:t.hPct}}var li=13;function ci(t){return {top:t.top+window.scrollY-li,left:t.right+window.scrollX-li}}function ge(t,e){let n=t.entries[e],i=t.elementIndices[e];if(!(!n||i===void 0))return n.elements[i]}function pi(t){let e=t.elementIndices[0];return e===void 0?void 0:t.entries[0]?.positions[e]}var di=300,ui=200,_o=3e3,No=.7,Fo=28,hi=32,qe=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=y("div",{style:`position:absolute;top:0;left:0;pointer-events:none;z-index:${2147483646};`}),this.container.id="siteping-markers",F(this.container),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,true);}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)h(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:ui+100}):this.repositionTimer=+setTimeout(()=>{this.repositionTimer=null,this.repositionAll();},ui));}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,s=false;for(let a of this.entries)for(let l=0;l<a.feedback.annotations.length;l++){let c=a.elements[l];if(!c)continue;let p=a.feedback.annotations[l];if(!p)continue;let h=`${a.feedback.id}:${l}`;r.add(h);let f=this.anchorCache.get(h)?.deref(),m,v=(this.hiddenRecheckAt.get(h)??0)>i,T=f?.isConnected&&(v||!(e&&be(f)==="hidden"));if(f&&T){let C=f.getBoundingClientRect(),E=Ue(p);m={element:f,rect:new DOMRect(C.left+E.xPct*C.width,C.top+E.yPct*C.height,E.wPct*C.width,E.hPct*C.height),confidence:1,strategy:"css"};}else v?m=null:(o.starved=false,m=Ye(It(p),Ue(p),{scanBudget:o}),o.starved||(m?.element&&this.anchorCache.set(h,new WeakRef(m.element)),!m||be(m.element)==="hidden"?this.hiddenRecheckAt.set(h,i+_o):this.hiddenRecheckAt.delete(h)));let A=c.style.display!=="none";if(!m){A&&(s=true),c.style.display="none";continue}A||(s=true),a.positions[l]=ci(m.rect),c.style.display="flex",this.applyConfidenceStyle(c,m.confidence,a.feedback);}for(let a of this.anchorCache.keys())r.has(a)||this.anchorCache.delete(a);for(let a of this.hiddenRecheckAt.keys())r.has(a)||this.hiddenRecheckAt.delete(a);s&&this.buildClusters(),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=ka(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:[],positions:[]};for(let o of e.annotations){let r=Ye(It(o),Ue(o)),s=r?ci(r.rect):{top:0,left:0},a=this.createMarker(n,e,s);r?this.applyConfidenceStyle(a,r.confidence,e):a.style.display="none",this.container.appendChild(a),i.elements.push(a),i.positions.push(s);}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++){let r=i.positions[o];!r||i.elements[o]?.style.display==="none"||e.push({entry:i,elIdx:o,pos:r});}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.pos,l=e[s];if(!l)continue;let c=l.pos;Math.sqrt((a.left-c.left)**2+(a.top-c.top)**2)<Fo&&(r.entries.push(l.entry),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=pi(e);if(!n)return;let{top:i,left:o}=n,r=e.entries.length<=1;for(let s=0;s<e.entries.length;s++){let a=ge(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=pi(e);if(!n)return;let{top:i,left:o}=n,r=e.entries.length,s=(r-1)*hi,a=o-s/2;for(let l=0;l<r;l++){let c=ge(e,l);c&&(c.style.top=`${i}px`,c.style.left=`${a+l*hi}px`,c.style.zIndex=String(10+l));}}addClusterBadge(e){let n=ge(e,e.entries.length-1);if(!n)return;let i=y("div",{class:"sp-cluster-badge",style:`position:absolute;top:-6px;right:-6px;min-width:16px;height:16px;padding:0 4px;border-radius:9999px;background:${this.colors.accent};color:#fff;font-size:10px;font-weight:700;display:flex;align-items:center;justify-content:center;border:1.5px solid #fff;pointer-events:none;font-family:"Inter",system-ui,-apple-system,sans-serif;line-height:1;`});z(i,String(e.entries.length)),n.appendChild(i);}setBadgesVisible(e,n){for(let i=0;i<e.entries.length;i++){let o=ge(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(ge(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=h(i.status);n<No&&!o?(e.style.borderStyle="dashed",e.style.opacity="0.7",e.title=ka(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=aa(n.type,this.colors),r=h(n.status),s=y("div",{style:`position:absolute;top:${i.top}px;left:${i.left}px;width:26px;height:26px;border-radius:50%;background:${r?"rgba(241,245,249,0.9)":"rgba(255,255,255,0.92)"};border:2px solid ${r?"#cbd5e1":o};display:flex;align-items:center;justify-content:center;font-family:"Inter",system-ui,-apple-system,sans-serif;font-size:11px;font-weight:700;color:${r?"#94a3b8":o};cursor:pointer;pointer-events:auto;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)`};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;user-select:none;-webkit-font-smoothing:antialiased;`});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=ka(this.t,"marker.aria",{number:e,type:la(n.type,this.t),message:a});s.setAttribute("aria-label",l),s.setAttribute("aria-describedby",this.tooltip.tooltipId),z(s,r?"\u2713":String(e)),ga()&&s.appendChild(y("span",{style:"position:absolute;inset:-9px;border-radius:50%;"})),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)||(fa()&&this.tooltip.hide(),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.find(o=>o.style.display!=="none");return i&&i.scrollIntoView({behavior:"smooth",block:"center"}),this.pinHighlight(n.feedback),this.highlight(e),true}revealPin(e){return this.container.style.display!=="none"&&this.entries.some(n=>n.feedback.id===e&&n.elements.some(i=>i.style.display!=="none"))&&this.focusFeedback(e)}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=Ye(It(n),Ue(n));if(!i)continue;let o=aa(e.type,this.colors),r=i.rect,s=y("div",{style:`position:absolute;top:${r.top+window.scrollY}px;left:${r.left+window.scrollX}px;width:${r.width}px;height:${r.height}px;border:2px solid ${o};background:${o}0c;border-radius:8px;pointer-events:none;z-index:-1;opacity:0;box-shadow:0 0 16px ${o}20;transition:opacity ${di}ms ease;`});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(),di);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,true),this.mutationObserver?.disconnect(),this.container.remove();}};var fi=3e4,Ve=class{constructor(e,n){this.store=e;this.projectName=n;}store;projectName;async sendFeedback(e){return Lt(await mi(this.write(e),"Failed to send feedback"))}async write(e){try{return 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(l),screenshotDataUrl:e.screenshotDataUrl??null,screenshotRegion:e.screenshotRegion??null,diagnostics:e.diagnostics??null})}catch(n){if(!k(n))throw n;let i=await this.store.findByClientId(e.clientId);if(!i||i.projectName!==e.projectName)throw n;return i}}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(Lt),total:o,capabilities:{comments:!!this.store.addComment}}}async resolveFeedback(e,n){let i$1=await this.store.updateFeedback(e,i(n?"resolved":"open"));return Lt(i$1)}async deleteFeedback(e){await this.store.deleteFeedback(e);}async deleteAllFeedbacks(e){await this.store.deleteAllFeedbacks(e);}async addComment(e,n){let i="Failed to post comment";if(!this.store.addComment)throw new b(`${i}: this store keeps no comments`,"SERVER",false);return bi(await mi(this.store.addComment(e,n),i))}};function mi(t,e){return vt(t,fi,()=>new b(`${e}: the store did not answer within ${fi/1e3} s`,"TIMEOUT",true))}function Lt(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(Oo),comments:t.comments?.map(bi),screenshotUrl:t.screenshotUrl??null,screenshotRegion:t.screenshotRegion??null,diagnostics:t.diagnostics??null}}function bi({clientId:t,createdAt:e,...n}){return {...n,createdAt:e.toISOString()}}function Oo(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 Ho="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)",_t="cubic-bezier(0.16, 1, 0.3, 1)",Nt="cubic-bezier(0.34, 1.56, 0.64, 1)",Do="cubic-bezier(0.25, 1, 0.5, 1)",gi=`@keyframes sp-fab-in{from{transform:scale(0) rotate(-180deg);opacity:0;}to{transform:scale(1) rotate(0deg);opacity:1;}}@keyframes sp-fab-glow{0%,100%{box-shadow:0 4px 20px var(--sp-accent-glow),0 2px 8px rgba(0,0,0,0.08);}50%{box-shadow:0 4px 28px var(--sp-accent-glow),0 2px 12px rgba(0,0,0,0.1);}}@keyframes sp-marker-in{0%{transform:scale(0);opacity:0;}60%{transform:scale(1.2);opacity:1;}100%{transform:scale(1);}}@keyframes sp-pulse-ring{0%{box-shadow:0 0 0 0 var(--sp-accent-glow);}70%{box-shadow:0 0 0 8px transparent;}100%{box-shadow:0 0 0 0 transparent;}}@keyframes sp-flash-bg{0%{background-color:var(--sp-accent-light);}100%{background-color:transparent;}}@keyframes sp-slide-up{from{transform:translateY(8px);opacity:0;}to{transform:translateY(0);opacity:1;}}@keyframes sp-fade-in{from{opacity:0;}to{opacity:1;}}@keyframes sp-shimmer{0%{background-position:-200% 0;}100%{background-position:200% 0;}}.sp-anim-fab-in{animation:sp-fab-in 0.5s ${Ho} both;}.sp-anim-marker-in{animation:sp-marker-in 0.35s ${Nt} both;}.sp-anim-pulse{animation:sp-pulse-ring 0.7s ease-out;}.sp-anim-flash{animation:sp-flash-bg 0.5s ${Do};}.sp-anim-slide-up{animation:sp-slide-up 0.3s ${_t} both;}.sp-anim-fade-in{animation:sp-fade-in 0.2s ease-out both;}.sp-panel{transform:translateX(110%);transition:transform 0.4s ${_t};}.sp-panel.sp-panel--open{transform:translateX(0);}.sp-radial-item{opacity:0;pointer-events:none;transform:translate(0,0) scale(0.8);transition:transform 0.35s ${Nt},opacity 0.2s ease,background 0.2s ease,border-color 0.2s ease,box-shadow 0.2s ease;}.sp-radial-item.sp-radial-item--open{opacity:1;pointer-events:auto;}.sp-radial-item{transition-delay:calc(var(--sp-i, 0) * 50ms);}@keyframes sp-card-in{from{transform:translateY(12px);opacity:0;}to{transform:translateY(0);opacity:1;}}.sp-card{animation:sp-card-in 0.35s ${_t} both;animation-delay:calc(var(--sp-card-i, 0) * 40ms);}@keyframes sp-spin{to{transform:rotate(360deg);}}.sp-spinner{width:20px;height:20px;border:2px solid var(--sp-border);border-top-color:var(--sp-accent);border-radius:50%;animation:sp-spin 0.6s linear infinite;}@keyframes sp-badge-in{0%{transform:scale(0);}60%{transform:scale(1.3);}100%{transform:scale(1);}}.sp-fab-badge{animation:sp-badge-in 0.4s ${Nt} both;}@media (prefers-reduced-motion: reduce){*,*::before,*::after{animation-duration:0.01ms !important;animation-iteration-count:1 !important;transition-duration:0.01ms !important;}}`;var yi=`:host{-webkit-tap-highlight-color:transparent;}.sp-list,.sp-detail-content{overscroll-behavior:contain;}.sp-scrim{display:none;}@media (hover: none){.sp-fab:hover:not(:active),.sp-card:hover:not(:active),.sp-btn-primary:hover:not(:active),.sp-btn-danger:hover:not(:active){transform:none;}.sp-card:hover:not(:active){box-shadow:var(--sp-shadow-xs);}.sp-radial-item--open .sp-radial-label{opacity:1;transform:translate(0,-50%);}.sp-bulk-checkbox{opacity:1;}.sp-bulk-checkbox::after{content:"";position:absolute;inset:-12px;}.sp-bulk-select-all{display:none;}.sp-list--has-selection .sp-bulk-select-all{display:flex;}.sp-shortcuts-hint{display:none;}}@media (pointer: coarse){.sp-radial-item{width:48px;height:48px;left:2px;bottom:2px;}.sp-radial-item svg{width:20px;height:20px;}.sp-radial-label{font-size:13px;font-weight:600;padding:8px 12px;}.sp-search,.sp-input{font-size:16px;}.sp-filter-dropdown-btn{height:36px;}.sp-segmented__btn{height:32px;}.sp-sort-btn,.sp-group-toggle,.sp-mine-toggle{min-height:36px;}.sp-btn-resolve,.sp-btn-delete{min-height:40px;}.sp-detail-back{width:44px;height:44px;}.sp-detail-actions button,.sp-detail-actions a{height:44px;}}@media ${w}{.sp-fab--bottom-right,.sp-radial--bottom-right{right:calc(16px + env(safe-area-inset-right,0px));bottom:calc(16px + env(safe-area-inset-bottom,0px));}.sp-fab--bottom-left,.sp-radial--bottom-left{left:calc(16px + env(safe-area-inset-left,0px));bottom:calc(16px + env(safe-area-inset-bottom,0px));}.sp-scrim{display:block;position:fixed;inset:0;background:var(--sp-scrim);opacity:0;pointer-events:none;touch-action:none;transition:opacity 0.3s ease;}.sp-scrim--open{opacity:1;pointer-events:auto;}.sp-panel{top:auto;left:0;right:0;bottom:0;width:auto;max-width:none;height:calc(100vh - 48px);height:calc(100dvh - 40px - env(safe-area-inset-top,0px));border-left:none;border-top:1px solid var(--sp-glass-border);border-radius:var(--sp-radius-xl) var(--sp-radius-xl) 0 0;background:var(--sp-bg);-webkit-backdrop-filter:none;backdrop-filter:none;transform:translateY(105%);}.sp-panel.sp-panel--open{transform:translateY(0);}.sp-panel-header,.sp-detail-header{position:relative;padding-top:22px;background:var(--sp-bg);-webkit-backdrop-filter:none;backdrop-filter:none;touch-action:none;}.sp-panel-header{padding:22px 12px 12px 20px;}.sp-panel-header::before,.sp-detail-header::before{content:"";position:absolute;top:8px;left:50%;width:36px;height:5px;margin-left:-18px;border-radius:3px;background:var(--sp-border);}.sp-export-btn,.sp-btn-delete-all{width:40px;height:40px;padding:0;justify-content:center;border-radius:var(--sp-radius);}.sp-export-btn svg,.sp-btn-delete-all svg{width:17px;height:17px;}.sp-export-btn span,.sp-btn-delete-all span{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;}.sp-stats-bar{padding:10px 20px;}.sp-filters{padding:12px 16px 10px;background:var(--sp-bg);-webkit-backdrop-filter:none;backdrop-filter:none;}.sp-stats-bar,.sp-filters{touch-action:pan-x;}.sp-search{height:44px;}.sp-filter-bar{flex-wrap:nowrap;overflow-x:auto;margin:0 -16px 8px;padding:0 16px 2px;scrollbar-width:none;}.sp-filter-bar::-webkit-scrollbar{display:none;}.sp-filter-dropdown{flex:0 0 auto;}.sp-filter-dropdown-btn{width:auto;}.sp-filter-dropdown-menu,.sp-sort-menu{position:fixed;top:auto;left:12px;right:12px;bottom:calc(12px + env(safe-area-inset-bottom,0px));min-width:0;padding:6px;border-radius:var(--sp-radius-lg);background:var(--sp-bg);-webkit-backdrop-filter:none;backdrop-filter:none;box-shadow:var(--sp-shadow-xl);z-index:30;}.sp-filter-dropdown-option,.sp-sort-option{min-height:44px;font-size:14px;}.sp-list{padding:10px 12px calc(12px + env(safe-area-inset-bottom,0px));}.sp-bulk-bar{bottom:calc(16px + env(safe-area-inset-bottom,0px));}.sp-detail{background:var(--sp-bg);-webkit-backdrop-filter:none;backdrop-filter:none;}.sp-detail-section{padding:18px 20px;}.sp-detail-content{padding-bottom:env(safe-area-inset-bottom,0px);}.sp-identity-backdrop{align-items:flex-end;}.sp-identity-modal{width:100%;max-width:none;margin-bottom:var(--sp-kb, 0px);padding:24px 20px calc(20px + env(safe-area-inset-bottom,0px));border-radius:var(--sp-radius-xl) var(--sp-radius-xl) 0 0;background:var(--sp-bg);transform:translateY(100%);}.sp-identity-actions button{flex:1;height:48px;}.sp-identity-actions .sp-btn-primary{flex:2;}}`;function Ft(t){return `:host{all:initial;position:fixed;z-index:${2147483647};font-family:var(--sp-font);font-size:14px;line-height:1.5;color:var(--sp-text);color-scheme:${t.bg==="#ffffff"?"light":"dark"};-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;${ea(t)} --sp-identity-bg: ${t.glassBgHeavy};--sp-identity-overlay: ${t.bg==="#ffffff"?"rgba(15, 23, 42, 0.2)":"rgba(0, 0, 0, 0.4)"};--sp-scrim: ${t.bg==="#ffffff"?"rgba(15, 23, 42, 0.32)":"rgba(0, 0, 0, 0.5)"};}*,*::before,*::after{box-sizing:border-box;margin:0;padding:0;}:focus-visible{outline:2px solid var(--sp-accent);outline-offset:2px;box-shadow:0 0 0 4px var(--sp-bg);}.sp-fab{position:fixed;width:52px;height:52px;border-radius:var(--sp-radius-full);background:var(--sp-accent-gradient);color:#fff;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:0 4px 20px var(--sp-accent-glow),0 2px 8px rgba(0,0,0,0.08);transition:transform 0.25s cubic-bezier(0.34,1.56,0.64,1),box-shadow 0.3s ease;outline:none;}.sp-fab:focus-visible{outline:2px solid #fff;outline-offset:3px;}.sp-fab:hover{transform:translateY(-2px) scale(1.05);box-shadow:0 8px 28px var(--sp-accent-glow),0 4px 12px rgba(0,0,0,0.1);}.sp-fab:active{transform:translateY(0) scale(0.95);transition-duration:0.1s;}.sp-fab--bottom-right{bottom:24px;right:24px;}.sp-fab--bottom-left{bottom:24px;left:24px;}.sp-fab svg{width:22px;height:22px;fill:currentColor;transition:transform 0.3s cubic-bezier(0.34,1.56,0.64,1);}.sp-fab-badge{position:absolute;top:-4px;right:-4px;min-width:20px;height:20px;padding:0 6px;border-radius:var(--sp-radius-full);background:#ef4444;color:#fff;font-size:11px;font-weight:700;display:flex;align-items:center;justify-content:center;border:2px solid #fff;pointer-events:none;font-family:var(--sp-font);line-height:1;}.sp-radial{position:fixed;pointer-events:none;width:52px;height:52px;}.sp-radial--bottom-right{bottom:24px;right:24px;}.sp-radial--bottom-left{bottom:24px;left:24px;}.sp-radial-item{position:absolute;left:4px;bottom:4px;width:44px;height:44px;border-radius:var(--sp-radius-full);background:var(--sp-glass-bg-heavy);backdrop-filter:blur(var(--sp-blur));-webkit-backdrop-filter:blur(var(--sp-blur));color:var(--sp-text);border:1px solid var(--sp-glass-border);cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:var(--sp-shadow-md);font-size:12px;font-weight:600;}.sp-radial-item:hover,.sp-radial-item:focus-visible{background:rgba(255,255,255,0.95);border-color:var(--sp-accent);color:var(--sp-accent);box-shadow:var(--sp-shadow-md),0 0 0 3px var(--sp-accent-light);outline:none;}.sp-radial-item svg{width:18px;height:18px;flex-shrink:0;stroke:currentColor;fill:none;}.sp-radial-label{position:absolute;top:50%;white-space:nowrap;font-size:12px;font-weight:500;color:var(--sp-text);pointer-events:none;opacity:0;padding:4px 12px;border-radius:var(--sp-radius);background:var(--sp-glass-bg-heavy);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);border:1px solid var(--sp-glass-border);box-shadow:var(--sp-shadow-sm);transform:translate(4px,-50%);transition:opacity 0.2s ease,transform 0.2s ease;}.sp-radial--bottom-right .sp-radial-label{right:calc(100% + 12px);}.sp-radial--bottom-left .sp-radial-label{left:calc(100% + 12px);transform:translate(-4px,-50%);}.sp-radial-item:hover .sp-radial-label,.sp-radial-item:focus-visible .sp-radial-label{opacity:1;transform:translate(0,-50%);}.sp-panel{position:fixed;top:0;right:0;width:400px;max-width:100vw;height:100vh;height:100dvh;background:var(--sp-glass-bg);backdrop-filter:blur(var(--sp-blur-heavy));-webkit-backdrop-filter:blur(var(--sp-blur-heavy));border-left:1px solid var(--sp-glass-border);box-shadow:var(--sp-shadow-xl);display:flex;flex-direction:column;overflow:hidden;}.sp-panel-header{display:flex;align-items:center;justify-content:space-between;padding:20px 24px;border-bottom:1px solid var(--sp-border);background:var(--sp-glass-bg-heavy);backdrop-filter:blur(var(--sp-blur));-webkit-backdrop-filter:blur(var(--sp-blur));position:relative;z-index:2;}.sp-panel-title{font-size:17px;font-weight:700;color:var(--sp-text);letter-spacing:-0.02em;}.sp-panel-close{width:44px;height:44px;border-radius:var(--sp-radius);border:none;background:transparent;cursor:pointer;display:flex;align-items:center;justify-content:center;color:var(--sp-text-tertiary);transition:all 0.2s ease;}.sp-panel-close:hover{background:var(--sp-bg-hover);color:var(--sp-text);}.sp-panel-close svg{width:16px;height:16px;}.sp-filters{padding:16px 24px;border-bottom:1px solid var(--sp-border);background:var(--sp-glass-bg-heavy);backdrop-filter:blur(var(--sp-blur));-webkit-backdrop-filter:blur(var(--sp-blur));position:sticky;top:0;z-index:1;}.sp-search-wrap{position:relative;margin-bottom:12px;}.sp-search{width:100%;height:40px;padding:0 12px 0 38px;border-radius:var(--sp-radius);border:1px solid var(--sp-border);background:var(--sp-glass-bg-heavy);color:var(--sp-text);font-family:var(--sp-font);font-size:13px;outline:none;transition:all 0.2s ease;}.sp-search::placeholder{color:var(--sp-text-tertiary);}.sp-search:focus{border-color:var(--sp-accent);box-shadow:0 0 0 3px var(--sp-accent-light);background:var(--sp-bg);}.sp-search-icon{position:absolute;left:12px;top:50%;transform:translateY(-50%);color:var(--sp-text-tertiary);width:16px;height:16px;transition:color 0.2s ease;}.sp-search:focus ~ .sp-search-icon,.sp-search-wrap:focus-within .sp-search-icon{color:var(--sp-accent);}.sp-filter-bar{display:flex;align-items:center;gap:8px;margin-bottom:8px;flex-wrap:wrap;}.sp-filter-dropdown{position:relative;flex:1 1 auto;min-width:0;}.sp-filter-dropdown-btn{--sp-chip-color: var(--sp-text-secondary);--sp-chip-bg: var(--sp-glass-bg-heavy);display:inline-flex;align-items:center;gap:8px;width:100%;height:32px;padding:0 8px 0 10px;border-radius:var(--sp-radius-full);border:1px solid var(--sp-border);background:var(--sp-glass-bg-heavy);color:var(--sp-text);font-family:var(--sp-font);font-size:12px;font-weight:500;cursor:pointer;white-space:nowrap;transition:background 0.18s ease,border-color 0.18s ease,box-shadow 0.18s ease;}.sp-filter-dropdown-btn:hover{border-color:var(--sp-chip-color);background:var(--sp-chip-bg);}.sp-filter-dropdown-btn[aria-expanded="true"]{border-color:var(--sp-chip-color);background:var(--sp-chip-bg);box-shadow:0 0 0 3px color-mix(in srgb,var(--sp-chip-color) 14%,transparent);}.sp-filter-dropdown-btn--filtered{border-color:var(--sp-chip-color);background:var(--sp-chip-bg);}.sp-filter-dropdown-btn__icon{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;flex-shrink:0;color:var(--sp-chip-color);}.sp-filter-dropdown-btn__icon svg{width:14px;height:14px;}.sp-filter-dropdown-btn__label{display:inline-flex;align-items:baseline;gap:6px;flex:1;min-width:0;overflow:hidden;}.sp-filter-dropdown-btn__prefix{color:var(--sp-text-tertiary);font-weight:500;font-size:11px;text-transform:uppercase;letter-spacing:0.06em;}.sp-filter-dropdown-btn__value{color:var(--sp-chip-color);font-weight:600;overflow:hidden;text-overflow:ellipsis;}.sp-filter-dropdown-btn__chevron{display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex-shrink:0;color:var(--sp-text-tertiary);transition:transform 0.18s ease,color 0.18s ease;}.sp-filter-dropdown-btn__chevron svg{width:12px;height:12px;}.sp-filter-dropdown-btn[aria-expanded="true"] .sp-filter-dropdown-btn__chevron{transform:rotate(180deg);color:var(--sp-chip-color);}.sp-filter-dropdown-menu{position:absolute;top:calc(100% + 6px);left:0;right:0;min-width:180px;padding:4px;border-radius:var(--sp-radius);background:var(--sp-glass-bg-heavy);backdrop-filter:blur(var(--sp-blur-heavy));-webkit-backdrop-filter:blur(var(--sp-blur-heavy));border:1px solid var(--sp-glass-border);box-shadow:var(--sp-shadow-md);z-index:10;animation:sp-filter-menu-in 0.15s ease-out both;}@keyframes sp-filter-menu-in{from{opacity:0;transform:translateY(-4px) scale(0.98);}to{opacity:1;transform:translateY(0) scale(1);}}.sp-filter-dropdown-option{--sp-chip-color: var(--sp-text-secondary);--sp-chip-bg: transparent;display:flex;align-items:center;gap:10px;width:100%;padding:8px 10px;border:none;border-radius:8px;background:transparent;color:var(--sp-text);font-family:var(--sp-font);font-size:12px;font-weight:500;cursor:pointer;text-align:left;transition:background 0.12s ease,color 0.12s ease;}.sp-filter-dropdown-option__icon{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;flex-shrink:0;border-radius:6px;background:var(--sp-chip-bg);color:var(--sp-chip-color);}.sp-filter-dropdown-option__icon svg{width:13px;height:13px;}.sp-filter-dropdown-option__label{flex:1;min-width:0;}.sp-filter-dropdown-option__check{display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex-shrink:0;color:var(--sp-chip-color);}.sp-filter-dropdown-option__check svg{width:13px;height:13px;}.sp-filter-dropdown-option:hover{background:var(--sp-bg-hover);}.sp-filter-dropdown-option--active{color:var(--sp-chip-color);font-weight:600;}.sp-filter-dropdown-option--active:hover{background:var(--sp-chip-bg);}.sp-segmented{display:inline-flex;align-items:stretch;padding:2px;border-radius:var(--sp-radius-full);border:1px solid var(--sp-border);background:var(--sp-glass-bg-heavy);flex-shrink:0;}.sp-segmented__btn{--sp-chip-color: var(--sp-text-tertiary);--sp-chip-bg: transparent;display:inline-flex;align-items:center;gap:5px;height:26px;padding:0 10px;border:none;border-radius:var(--sp-radius-full);background:transparent;color:var(--sp-text-secondary);font-family:var(--sp-font);font-size:12px;font-weight:500;cursor:pointer;white-space:nowrap;transition:background 0.18s ease,color 0.18s ease,box-shadow 0.18s ease;}.sp-segmented__icon{display:inline-flex;align-items:center;justify-content:center;width:13px;height:13px;flex-shrink:0;color:var(--sp-chip-color);transition:color 0.18s ease,transform 0.18s ease;}.sp-segmented__icon svg{width:13px;height:13px;}.sp-segmented__btn:hover{color:var(--sp-chip-color);}.sp-segmented__btn:hover .sp-segmented__icon{color:var(--sp-chip-color);}.sp-segmented__btn--active{background:var(--sp-chip-bg);color:var(--sp-chip-color);font-weight:600;box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--sp-chip-color) 35%,transparent),0 1px 2px rgba(0,0,0,0.04);}.sp-segmented__btn--active .sp-segmented__icon{color:var(--sp-chip-color);}.sp-segmented__btn--open.sp-segmented__btn--active .sp-segmented__icon{animation:sp-segmented-pulse 2.4s ease-in-out infinite;}@keyframes sp-segmented-pulse{0%,100%{transform:scale(1);}50%{transform:scale(0.85);}}@media (prefers-reduced-motion: reduce){.sp-filter-dropdown-btn,.sp-filter-dropdown-btn__chevron,.sp-filter-dropdown-option,.sp-segmented__btn,.sp-segmented__icon{transition:none;}.sp-filter-dropdown-menu{animation:none;}.sp-segmented__btn--open.sp-segmented__btn--active .sp-segmented__icon{animation:none;}}.sp-list{flex:1;overflow-y:auto;padding:8px 12px;}.sp-list::-webkit-scrollbar{width:6px;}.sp-list::-webkit-scrollbar-track{background:transparent;}.sp-list::-webkit-scrollbar-thumb{background:var(--sp-border);border-radius:var(--sp-radius-full);}.sp-list::-webkit-scrollbar-thumb:hover{background:var(--sp-text-tertiary);}.sp-card{display:flex;padding:14px 16px;margin-bottom:6px;cursor:pointer;border-radius:var(--sp-radius);background:var(--sp-glass-bg-heavy);border:1px solid var(--sp-glass-border);box-shadow:var(--sp-shadow-xs);transition:all 0.2s cubic-bezier(0.34,1.56,0.64,1);}.sp-card:hover{background:var(--sp-bg);border-color:var(--sp-border);box-shadow:var(--sp-shadow-md);transform:translateY(-2px);}.sp-card:active{transform:translateY(0) scale(0.99);transition-duration:0.1s;}.sp-card-bar{width:3px;border-radius:var(--sp-radius-full);margin-right:14px;flex-shrink:0;}.sp-card-body{flex:1;min-width:0;}.sp-card-header{display:flex;align-items:center;gap:8px;margin-bottom:6px;}.sp-card-number{font-size:12px;font-weight:700;color:var(--sp-text-tertiary);font-variant-numeric:tabular-nums;}.sp-badge{padding:2px 10px;border-radius:var(--sp-radius-full);font-size:11px;font-weight:600;letter-spacing:0.02em;}.sp-card-date{font-size:11px;color:var(--sp-text-tertiary);margin-left:auto;}.sp-card-message{font-size:13px;line-height:1.5;color:var(--sp-text);display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;}.sp-card-message--expanded{-webkit-line-clamp:unset;}.sp-card-expand{font-size:12px;font-weight:500;color:var(--sp-accent);cursor:pointer;background:none;border:none;padding:4px 0;font-family:var(--sp-font);transition:opacity 0.15s ease;}.sp-card-expand:hover{opacity:0.8;}.sp-card-footer{display:flex;align-items:center;justify-content:flex-end;gap:6px;margin-top:10px;}.sp-btn-resolve,.sp-btn-delete{padding:8px 14px;border-radius:var(--sp-radius-full);border:1px solid var(--sp-border);background:transparent;color:var(--sp-text-secondary);font-family:var(--sp-font);font-size:12px;font-weight:500;cursor:pointer;display:flex;align-items:center;gap:4px;transition:all 0.2s ease;}.sp-btn-resolve svg,.sp-btn-delete svg{width:14px;height:14px;}.sp-btn-resolve:hover{border-color:#22c55e;color:#22c55e;background:rgba(34,197,94,0.06);}.sp-btn-delete:hover{border-color:#ef4444;color:#ef4444;background:rgba(239,68,68,0.06);}.sp-btn-resolve:disabled,.sp-btn-delete:disabled{opacity:0.5;cursor:not-allowed;pointer-events:none;}.sp-spinner--sm{width:14px;height:14px;}.sp-panel-header-right{display:flex;align-items:center;gap:8px;}.sp-btn-delete-all{padding:5px 12px;border-radius:var(--sp-radius-full);border:1px solid var(--sp-border);background:transparent;color:var(--sp-text-tertiary);font-family:var(--sp-font);font-size:11px;font-weight:500;cursor:pointer;display:flex;align-items:center;gap:4px;transition:all 0.2s ease;}.sp-btn-delete-all svg{width:13px;height:13px;}.sp-btn-delete-all:hover{border-color:#ef4444;color:#ef4444;background:rgba(239,68,68,0.06);}.sp-btn-delete-all:disabled{opacity:0.5;cursor:not-allowed;pointer-events:none;}.sp-confirm-backdrop{position:fixed;inset:0;background:var(--sp-backdrop, rgba(15, 23, 42, 0.2));backdrop-filter:blur(var(--sp-blur));-webkit-backdrop-filter:blur(var(--sp-blur));display:flex;align-items:center;justify-content:center;z-index:${2147483647};opacity:0;transition:opacity 0.2s ease;}.sp-confirm-dialog{width:min(340px,calc(100vw - 32px));padding:28px;border-radius:20px;background:var(--sp-glass-bg-heavy);backdrop-filter:blur(var(--sp-blur-heavy));-webkit-backdrop-filter:blur(var(--sp-blur-heavy));border:1px solid var(--sp-glass-border);box-shadow:var(--sp-shadow-xl);font-family:var(--sp-font);transform:translateY(8px) scale(0.97);transition:transform 0.25s cubic-bezier(0.16,1,0.3,1);}.sp-confirm-title{font-size:17px;font-weight:700;color:var(--sp-text);letter-spacing:-0.02em;margin-bottom:8px;}.sp-confirm-message{font-size:14px;color:var(--sp-text-secondary);line-height:1.5;margin-bottom:20px;}.sp-confirm-actions{display:flex;gap:8px;justify-content:flex-end;}.sp-btn-danger{height:40px;padding:0 22px;border-radius:var(--sp-radius);border:none;background:#ef4444;color:#fff;font-family:var(--sp-font);font-size:14px;font-weight:600;cursor:pointer;transition:all 0.2s ease;box-shadow:0 2px 8px rgba(239,68,68,0.25);}.sp-btn-danger:hover{background:#dc2626;box-shadow:0 4px 16px rgba(239,68,68,0.3);transform:translateY(-1px);}.sp-btn-danger:active{transform:translateY(0) scale(0.98);transition-duration:0.1s;}.sp-card--resolved{opacity:0.5;}.sp-card--resolved .sp-card-message{text-decoration:line-through;text-decoration-color:var(--sp-text-tertiary);}.sp-loading{display:flex;align-items:center;justify-content:center;padding:48px 24px;}.sp-identity-backdrop{position:fixed;inset:0;background:var(--sp-identity-overlay);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);display:flex;align-items:center;justify-content:center;z-index:${2147483647};opacity:0;transition:opacity 0.25s ease;}.sp-identity-modal{width:340px;max-width:calc(100vw - 32px);padding:28px;border-radius:var(--sp-radius-xl);background:var(--sp-identity-bg);backdrop-filter:blur(var(--sp-blur-heavy));-webkit-backdrop-filter:blur(var(--sp-blur-heavy));border:1px solid var(--sp-glass-border);box-shadow:0 16px 48px var(--sp-shadow),0 8px 16px var(--sp-shadow);font-family:var(--sp-font);color:var(--sp-text);transform:translateY(12px) scale(0.97);transition:transform 0.3s cubic-bezier(0.16,1,0.3,1);}.sp-identity--open{opacity:1;}.sp-identity--open .sp-identity-modal{transform:none;}.sp-identity-actions{display:flex;gap:8px;justify-content:flex-end;margin-top:20px;}.sp-identity-title{font-size:17px;font-weight:700;color:var(--sp-text);letter-spacing:-0.02em;}.sp-input{width:100%;height:42px;padding:0 14px;border-radius:var(--sp-radius);border:1px solid var(--sp-border);background:var(--sp-glass-bg-heavy);color:var(--sp-text);font-family:var(--sp-font);font-size:14px;outline:none;transition:all 0.2s ease;}.sp-input::placeholder{color:var(--sp-text-tertiary);}.sp-input:focus{border-color:var(--sp-accent);box-shadow:0 0 0 3px var(--sp-accent-light);background:var(--sp-bg);}.sp-input-label{font-size:13px;font-weight:500;color:var(--sp-text-secondary);margin-bottom:6px;display:block;}.sp-btn-primary{height:40px;padding:0 22px;border-radius:var(--sp-radius);border:none;background:var(--sp-accent-gradient);color:#fff;font-family:var(--sp-font);font-size:14px;font-weight:600;cursor:pointer;transition:all 0.2s ease;box-shadow:0 2px 8px var(--sp-accent-glow);}.sp-btn-primary:hover{box-shadow:0 4px 16px var(--sp-accent-glow);transform:translateY(-1px);}.sp-btn-primary:active{transform:translateY(0) scale(0.98);transition-duration:0.1s;}.sp-btn-primary:disabled{opacity:0.4;cursor:not-allowed;transform:none;box-shadow:none;}.sp-btn-ghost{height:40px;padding:0 22px;border-radius:var(--sp-radius);border:1px solid var(--sp-border);background:var(--sp-glass-bg-heavy);color:var(--sp-text-secondary);font-family:var(--sp-font);font-size:14px;font-weight:500;cursor:pointer;transition:all 0.2s ease;}.sp-btn-ghost:hover{border-color:var(--sp-accent);color:var(--sp-accent);background:var(--sp-accent-light);}.sp-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:56px 24px;color:var(--sp-text-tertiary);text-align:center;gap:8px;animation:sp-fade-in 0.3s ease-out both;}.sp-empty-text{font-size:14px;font-weight:500;}.sp-load-more-wrap{display:flex;justify-content:center;padding:12px 0 4px;}.sp-btn-load-more{width:100%;}@media (forced-colors: active){.sp-fab,.sp-radial-item,.sp-filter-dropdown-btn,.sp-segmented,.sp-segmented__btn,.sp-card,.sp-panel-close,.sp-search,.sp-btn-resolve,.sp-btn-delete,.sp-btn-delete-all,.sp-btn-primary,.sp-btn-ghost,.sp-btn-danger,.sp-card-expand,.sp-input,.sp-confirm-dialog{border:2px solid ButtonText !important;background:Canvas !important;color:ButtonText !important;}.sp-segmented__btn--active{background:Highlight !important;color:HighlightText !important;}.sp-filter-dropdown-menu{border:2px solid ButtonText !important;background:Canvas !important;}.sp-filter-dropdown-option--active{background:Highlight !important;color:HighlightText !important;}.sp-fab:focus-visible,.sp-radial-item:focus-visible,.sp-filter-dropdown-btn:focus-visible,.sp-segmented__btn:focus-visible,.sp-filter-dropdown-option:focus-visible,.sp-panel-close:focus-visible,.sp-btn-resolve:focus-visible,.sp-btn-delete:focus-visible,.sp-btn-delete-all:focus-visible,.sp-btn-primary:focus-visible,.sp-btn-ghost:focus-visible,.sp-btn-danger:focus-visible,.sp-card-expand:focus-visible,.sp-input:focus-visible,.sp-search:focus-visible{outline:3px solid Highlight !important;}.sp-panel{border:2px solid ButtonText !important;}.sp-fab-badge{border:2px solid ButtonText !important;background:Canvas !important;color:ButtonText !important;}.sp-card-bar{background:ButtonText !important;}}${gi} ${za} ${ya} ${pa} ${na} ${Da} ${sa} ${yi}`}var $o=120,Bo=80,vi="opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1)",Ge=class{constructor(e,n="en"){this.colors=e;this.locale=n;this.root=y("div",{style:`position:fixed;z-index:${2147483647};max-width:280px;padding:12px 14px;border-radius:14px;background:${this.colors.glassBgHeavy};backdrop-filter:blur(24px);-webkit-backdrop-filter:blur(24px);border:1px solid ${this.colors.glassBorder};box-shadow:0 8px 32px ${this.colors.shadow},0 2px 8px ${this.colors.shadow};font-family:"Inter",system-ui,-apple-system,sans-serif;pointer-events:auto;opacity:0;transform:translateY(6px) scale(0.97);transition:${vi};visibility:hidden;-webkit-font-smoothing:antialiased;`}),this.root.setAttribute("role","tooltip"),this.root.id=this.tooltipId,this.arrow=y("div",{style:`position:absolute;width:12px;height:12px;background:${this.colors.glassBgHeavy};border:1px solid ${this.colors.glassBorder};transform:rotate(45deg);pointer-events:none;`}),this.root.appendChild(this.arrow),this.root.addEventListener("mouseenter",()=>this.cancelHide()),this.root.addEventListener("mouseleave",()=>this.scheduleHide()),F(this.root),document.body.appendChild(this.root);}colors;locale;root;arrow;showTimer=null;hideTimer=null;currentFeedbackId=null;tooltipId="sp-tooltip";show(e,n){this.cancelHide(),this.currentFeedbackId!==e.id&&(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":vi,this.root.style.visibility="visible",this.root.style.opacity="1",this.root.style.transform="translateY(0) scale(1)";},$o));}scheduleHide(){this.cancelHide(),this.hideTimer=setTimeout(()=>this.hide(),Bo);}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 h of n)h!==this.arrow&&h.remove();let i=aa(e.type,this.colors),o=da(e.type,this.colors),r=ja(this.locale),s=la(e.type,r),a=y("div",{style:"display:flex;align-items:center;gap:8px;margin-bottom:8px;"}),l=y("span",{style:`padding:3px 10px;border-radius:9999px;font-size:11px;font-weight:600;color:${i};background:${o};letter-spacing:0.02em;`});z(l,s);let c=y("span",{style:`font-size:11px;color:${this.colors.textSecondary};margin-left:auto;`});z(c,E(e.createdAt,this.locale)),a.appendChild(l),a.appendChild(c);let p=y("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;`});z(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=`position:absolute;width:12px;height:12px;background:${this.colors.glassBgHeavy};border-right:1px solid ${this.colors.glassBorder};border-bottom:1px solid ${this.colors.glassBorder};transform:rotate(45deg);pointer-events:none;bottom:-6px;left:${a}px;`:this.arrow.style.cssText=`position:absolute;width:12px;height:12px;background:${this.colors.glassBgHeavy};border-left:1px solid ${this.colors.glassBorder};border-top:1px solid ${this.colors.glassBorder};transform:rotate(45deg);pointer-events:none;top:-6px;left:${a}px;`;}contains(e){return this.root.contains(e)}destroy(){this.cancelShow(),this.cancelHide(),this.root.remove();}};var ye=null;function zo(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 ve(){let t=()=>{};return {destroy:t,open:t,close:t,refresh:t,focusFeedback:()=>false,on:()=>t,off:t}}function xi(){try{return process.env.NODE_ENV}catch{return}}function Xo(t){return t===void 0||t===false?{enabled:false,param:"siteping"}:t===true?{enabled:true,param:"siteping"}:{enabled:true,param:t.param??"siteping"}}function wi(t){if(typeof window>"u"||typeof document>"u")return t.onSkip?.("ssr"),ve();let e=t.debug?(...u)=>console.debug("[siteping]",...u):()=>{};if(ye)return e("initSiteping() called more than once \u2014 returning existing instance"),ye;if(!t.forceShow&&xi()==="production")return t.onSkip?.("production"),ve();let n=typeof t.minViewportWidth=="number"&&Number.isFinite(t.minViewportWidth)?t.minViewportWidth:0;if(!t.forceShow&&window.innerWidth<n){let u="mobile";return t.onSkip?.(u),ve()}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."),ve();if(!t.projectName||typeof t.projectName!="string")return console.error("[siteping] Missing or invalid 'projectName' in config. Expected a non-empty string."),ve();let i=o(t.locale??"en"),o$1=i==="en"?Promise.resolve():ia(i).catch(()=>{}),r=ja(i),s=t.scopeAnnotationsByUrl??true,a=()=>{try{let u=t.getPageScope?.();if(u)return u}catch(u){e("getPageScope() threw, falling back to pathname:",u);}return {url:window.location.pathname,urlPattern:null}};e("Initializing widget",{projectName:t.projectName,theme:t.theme??"light",locale:i,scopeAnnotationsByUrl:s});let l=zo(t.captureDiagnostics),c=l.console?new ze(l.maxConsoleEntries):null,p=l.network?new Xe(l.maxNetworkEntries):null,h=$(t.accentColor,t.theme),d=new fe,f=new fe,m=(()=>{if(t.store)return new Ve(t.store,t.projectName);let u=t.endpoint;if(typeof u!="string"||u.length===0)throw new Error("[siteping] internal invariant: endpoint must be a non-empty string in HTTP mode");return new $e(u,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.onCommentAdded&&d.on("comment:added",t.onCommentAdded),t.onError&&d.on("feedback:error",t.onError),t.onError&&d.on("panel:action-error",t.onError),d.on("panel:action-error",u=>console.error("[siteping] Panel action failed:",u)),t.onAnnotationStart&&d.on("annotation:start",t.onAnnotationStart),t.onAnnotationEnd&&d.on("annotation:end",t.onAnnotationEnd);let v=He(t.projectName,t.endpoint);d.on("feedback:sent",u=>v.add(u.id)),d.on("feedback:deleted",u=>v.remove(u)),d.on("feedback:all-deleted",()=>v.clear());let T={"feedback:sent":()=>d.on("feedback:sent",u=>f.emit("feedback:sent",u)),"feedback:deleted":()=>d.on("feedback:deleted",u=>f.emit("feedback:deleted",u)),"comment:added":()=>d.on("comment:added",u=>f.emit("comment:added",u)),"feedback:error":()=>d.on("feedback:error",u=>f.emit("feedback:error",u)),"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 u of Object.values(T))u();d.on("open",()=>e("Panel opened")),d.on("close",()=>e("Panel closed")),d.on("feedback:sent",u=>e("Feedback sent",u.id)),d.on("feedback:error",u=>e("Feedback failed",u.message)),d.on("annotation:start",()=>e("Annotation started")),d.on("annotation:end",()=>e("Annotation ended"));let A=document.createElement("siteping-widget");A.style.cssText=`position:fixed;z-index:${2147483647};pointer-events:auto;`;let C=xi()==="test"?"open":"closed",E=A.attachShadow({mode:C});if("adoptedStyleSheets"in ShadowRoot.prototype){let u=new CSSStyleSheet;u.replaceSync(Ft(h)),E.adoptedStyleSheets=[u];}else {let u=document.createElement("style");u.textContent=Ft(h),E.appendChild(u);}F(A,E);let X=I();document.body.appendChild(A);let H=Rn(A),P=document.createElement("div");P.setAttribute("role","status"),P.setAttribute("aria-live","polite"),P.setAttribute("aria-atomic","true"),P.setAttribute("data-siteping-ignore","true"),P.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;",F(P),document.body.appendChild(P);let xe=new Ge(h,i),y=new qe(h,xe,d,r,P),k=new Ke(E,t,d,r);d.on("markers:changed",u=>k.updateBadge(u));let w=null,N=null,I$1=false,F$1=0;async function Ht(u=false){let b=t.identity??Tt();if(b)return b;let x=await Ko(E,r,u);return x&&Jn(x),x}async function Dt(){return I$1?null:w||(N||(N=import('./panel-XTNU6XHV.js').then(u=>I$1?null:(w=new u.Panel(E,h,d,m,t.projectName,y,r,i,{getScope:a,scopeAnnotationsByUrl:s,panelActions:t.panelActions,ownFeedback:v,resolveIdentity:Ht,readOnly:t.readOnly}),w))),N)}if(typeof window<"u"){let u=()=>{I$1||Dt();},b=window.requestIdleCallback;typeof b=="function"?b(u):setTimeout(u,200);}let U=false,ki=d.on("panel:toggle",u=>{w||(u?(U=true,Dt().then(b=>{b&&U&&b.open(),U=false;}).catch(b=>e("Failed to lazy-load panel:",b))):U=false);}),we=new Oe(h,d,r,t.enableScreenshot??false,()=>H.getLastPageFocus()),Ee=null;t.enableRightClickComment&&(Ee=u=>{if(u.defaultPrevented)return;let b=u.pointerType;b===""||b===void 0&&u.button!==2||u.shiftKey||u.ctrlKey||u.altKey||u.metaKey||u.composedPath().some(R=>R===A||R instanceof Element&&(R.hasAttribute("data-siteping-ignore")||R.id==="siteping-markers"))||we.isBusy||(u.preventDefault(),we.startInstantAnnotation(u.clientX,u.clientY).catch(R=>e("right-click annotation failed",R)));},document.addEventListener("contextmenu",Ee)),i!=="en"&&o$1.then(()=>{I$1||(k.refreshLabels(),we.refreshLabels());});let Qe=false,Si=d.on("annotation:complete",async u=>{if(Qe){d.emit("submission:cancelled");return}Qe=true;try{let{annotation:b,type:x,message:R,clientId:q,screenshotDataUrl:V,screenshotRegion:ke}=u,M=await Ht(!0);if(!M){d.emit("submission:cancelled");return}let re=a(),zt=null;(c||p)&&(zt={console:c?.getEntries()??[],network:p?.getEntries()??[]});let Ri={projectName:t.projectName,type:x,message:R,url:re.url,urlPattern:re.urlPattern,viewport:`${window.innerWidth}x${window.innerHeight}`,userAgent:navigator.userAgent,authorName:M.name,authorEmail:M.email,annotations:[b],clientId:q,screenshotDataUrl:V??null,screenshotRegion:ke??null,diagnostics:zt};try{let K=await m.sendFeedback(Ri);d.emit("feedback:sent",K),(!s||K.url===re.url)&&y.addFeedback(K,y.count+1),P.textContent=r("feedback.sent.confirmation"),w&&await w.refresh();}catch(K){d.emit("feedback:error",K instanceof Error?K:new Error(String(K))),P.textContent=r("feedback.error.message");}}finally{Qe=false;}}),Je=a(),Ti=s?{limit:20,url:Je.url}:{limit:20},Ze=Xo(t.deepLink),Ci=++F$1;Promise.all([m.getFeedbacks(t.projectName,Ti),o$1]).then(([{feedbacks:u}])=>{if(I$1||F$1!==Ci)return;let b=s?u.filter(x=>x.url===Je.url):u;if(y.render(b),Ze.enabled)try{let x=new URLSearchParams(window.location.search).get(Ze.param);if(x){let R=y.focusFeedback(x);e(`deepLink ?${Ze.param}=${x} ${R?"focused":"did not match a visible feedback"}`);}}catch(x){e("deepLink parsing failed:",x);}}).catch(u=>{e("Failed to load initial markers:",u);}),t.endpoint&&Vn(t.endpoint,t.identity??Tt(),{apiKey:t.apiKey,headers:t.headers}).then(()=>e("Retry queue flushed")).catch(()=>{});let $t=()=>{let u=++F$1;if(w?.isCurrentlyOpen)return w.refresh();let b=a(),x=s?{limit:20,url:b.url}:{limit:20};return m.getFeedbacks(t.projectName,x).then(({feedbacks:R})=>{if(I$1||u!==F$1||w?.isCurrentlyOpen)return;let q=s?R.filter(V=>V.url===b.url):R;y.render(q);})},Bt=null;if(t.watchNavigation!==false&&typeof window<"u"&&typeof history<"u"){let u=M=>`${M.url}
3
+ ${M.urlPattern??""}`,b=u(Je),x=()=>{if(I$1)return;let M=u(a());if(M===b)return;let re=b;b=M,e("SPA navigation detected \u2014 refreshing feedbacks for new scope"),$t().catch(()=>{b===M&&(b=re);});},R=history.pushState,q=history.replaceState,V=function(...M){R.apply(this,M),x();},ke=function(...M){q.apply(this,M),x();};history.pushState=V,history.replaceState=ke,window.addEventListener("popstate",x),window.addEventListener("hashchange",x),Bt=()=>{window.removeEventListener("popstate",x),window.removeEventListener("hashchange",x),history.pushState===V&&(history.pushState=R),history.replaceState===ke&&(history.replaceState=q);};}let et={destroy:()=>{I$1||(e("Destroying widget"),Ee&&document.removeEventListener("contextmenu",Ee),I$1=true,U=false,Bt?.(),H.destroy(),Si(),ki(),k.destroy(),w?.destroy(),we.destroy(),y.destroy(),xe.destroy(),c?.dispose(),p?.dispose(),d.removeAll(),f.removeAll(),P.remove(),A.remove(),X(),ye===et&&(ye=null));},open:()=>{d.emit("panel:toggle",true);},close:()=>{w?w.close():U=false;},focusFeedback:u=>y.focusFeedback(u),refresh:()=>{$t().catch(()=>{});},on:(u,b)=>f.on(u,b),off:(u,b)=>{f.off(u,b);}};return ye=et,et}function Ko(t,e$1,n){return new Promise(i=>{let o=t.activeElement??document.activeElement,r=t.host;n&&r.parentNode&&r.parentNode.appendChild(r);let s=document.createElement("div");s.className="sp-identity-backdrop";let a$1=document.createElement("div");a$1.className="sp-identity-modal";let l=`sp-identity-title-${Date.now()}`;a$1.setAttribute("role","dialog"),a$1.setAttribute("aria-modal","true"),a$1.setAttribute("aria-labelledby",l);let c=document.createElement("div");c.className="sp-identity-title",c.id=l,c.textContent=e$1("identity.title"),c.style.marginBottom="20px";let p=`sp-identity-name-${Date.now()}`,h=`sp-identity-email-${Date.now()}`,d=document.createElement("label");d.className="sp-input-label",d.textContent=e$1("identity.nameLabel"),d.setAttribute("for",p);let f=document.createElement("input");f.className="sp-input",f.id=p,f.type="text",f.maxLength=e,f.placeholder=e$1("identity.namePlaceholder"),f.style.marginBottom="14px";let m=document.createElement("label");m.className="sp-input-label",m.textContent=e$1("identity.emailLabel"),m.setAttribute("for",h);let v=document.createElement("input");v.className="sp-input",v.id=h,v.type="email",v.maxLength=e,v.placeholder=e$1("identity.emailPlaceholder");let T=document.createElement("div");T.className="sp-identity-actions";let A=ha(y=>a$1.style.setProperty("--sp-kb",`${y}px`)),C=y=>{s.removeEventListener("keydown",P),xe(),A(),s.classList.remove("sp-identity--open"),setTimeout(()=>{s.remove(),o?.focus(),i(y);},250);},E=document.createElement("button");E.className="sp-btn-ghost",E.textContent=e$1("identity.cancel"),E.addEventListener("click",()=>C(null));let _=document.createElement("button");_.className="sp-btn-primary",_.textContent=e$1("identity.submit");let X=(y,k)=>{y.style.borderColor=k?"var(--sp-type-bug, #ef4444)":"",k?y.setAttribute("aria-invalid","true"):y.removeAttribute("aria-invalid");};_.addEventListener("click",()=>{let y=f.value.trim(),k=v.value.trim();if(!y||!k)return;let w=y.length>e,N=k.length>e||!a(k);X(f,w),X(v,N),!(w||N)&&C({name:y,email:k});});let H$1='input, button, [tabindex]:not([tabindex="-1"])',P=y=>{let k=y;if(k.key==="Escape"){k.stopPropagation(),C(null);return}if(k.key==="Tab"){let w=Array.from(a$1.querySelectorAll(H$1));if(w.length===0)return;let N=w[0],I=w[w.length-1];if(!N||!I)return;let F=t.activeElement;k.shiftKey?(F===N||!a$1.contains(F))&&(k.preventDefault(),I.focus()):(F===I||!a$1.contains(F))&&(k.preventDefault(),N.focus());}};s.addEventListener("keydown",P);let xe=H(s,()=>true);s.addEventListener("click",y=>{y.target===s&&C(null);}),T.appendChild(E),T.appendChild(_),a$1.appendChild(c),a$1.appendChild(d),a$1.appendChild(f),a$1.appendChild(m),a$1.appendChild(v),a$1.appendChild(T),s.appendChild(a$1),t.appendChild(s),requestAnimationFrame(()=>{s.classList.add("sp-identity--open"),f.focus();});})}function Ei(t){return wi(t)}function Uo(t){let e=t.current.panelActions;return Array.isArray(e)?e.map(n=>{if(typeof n!="object"||n===null)return n;let i=()=>t.current.panelActions?.find(a=>a?.id===n.id)??n,o=a=>{let l=i().visible;return l?!!l(a):true},{onAction:r,href:s}=n;return typeof r=="function"&&s===void 0?{...n,visible:o,onAction:(a,l)=>(i().onAction??r)(a,l)}:r!==void 0?n:typeof s=="string"?{...n,visible:o}:typeof s!="function"?n:{...n,visible:o,href:a=>{let l=i().href??s;return typeof l=="function"?l(a):l}}}):e}function Qr(t){let e=useRef(t);e.current=t;let[n,i]=useState(null);return useEffect(()=>{let o=true,r=Ei({...e.current,onSkip:s=>{o&&e.current.onSkip?.(s);},onOpen:()=>{o&&e.current.onOpen?.();},onClose:()=>{o&&e.current.onClose?.();},onFeedbackSent:s=>{o&&e.current.onFeedbackSent?.(s);},onCommentAdded:s=>{o&&e.current.onCommentAdded?.(s);},onError:s=>{o&&e.current.onError?.(s);},onAnnotationStart:()=>{o&&e.current.onAnnotationStart?.();},onAnnotationEnd:()=>{o&&e.current.onAnnotationEnd?.();},panelActions:Uo(e)});if(!o){r.destroy();return}return i(r),()=>{o=false,r.destroy(),i(null);}},[]),n}export{Qr as useSiteping};//# sourceMappingURL=react.js.map
1589
4
  //# sourceMappingURL=react.js.map