@siteping/widget 0.12.1 → 0.12.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -10
- package/dist/chunk-7LL25BRN.cjs +9 -0
- package/dist/chunk-7LL25BRN.cjs.map +1 -0
- package/dist/chunk-HFZPYBZG.js +9 -0
- package/dist/chunk-HFZPYBZG.js.map +1 -0
- package/dist/de-3ANNNYIA.js +2 -0
- package/dist/{de-U3V6TPCZ.js.map → de-3ANNNYIA.js.map} +1 -1
- package/dist/{de-GCYQ3JCH.cjs → de-4N2W5ASV.cjs} +2 -2
- package/dist/{de-GCYQ3JCH.cjs.map → de-4N2W5ASV.cjs.map} +1 -1
- package/dist/es-6M2N2ZUW.cjs +2 -0
- package/dist/{es-435K3LIV.cjs.map → es-6M2N2ZUW.cjs.map} +1 -1
- package/dist/es-GPIJU4FY.js +2 -0
- package/dist/{es-CSZUS23Z.js.map → es-GPIJU4FY.js.map} +1 -1
- package/dist/fr-6QAB4LJP.js +2 -0
- package/dist/{fr-DVOFE3WF.js.map → fr-6QAB4LJP.js.map} +1 -1
- package/dist/fr-KAHW2UVM.cjs +2 -0
- package/dist/{fr-RKRDGOTP.cjs.map → fr-KAHW2UVM.cjs.map} +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.global.js +2 -2
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/it-4TJ7GPQP.cjs +2 -0
- package/dist/{it-COLRVG26.cjs.map → it-4TJ7GPQP.cjs.map} +1 -1
- package/dist/it-S7QUW7XF.js +2 -0
- package/dist/{it-ZWPEN22A.js.map → it-S7QUW7XF.js.map} +1 -1
- package/dist/panel-E5DL4OG4.cjs +2 -0
- package/dist/panel-E5DL4OG4.cjs.map +1 -0
- package/dist/panel-TDZWSRVV.js +2 -0
- package/dist/panel-TDZWSRVV.js.map +1 -0
- package/dist/pt-2P3TRISG.js +2 -0
- package/dist/{pt-WGEJRQFC.js.map → pt-2P3TRISG.js.map} +1 -1
- package/dist/pt-RAL7HZ3Q.cjs +2 -0
- package/dist/{pt-QQX5CA7D.cjs.map → pt-RAL7HZ3Q.cjs.map} +1 -1
- package/package.json +1 -1
- package/dist/chunk-ISSCC4XP.js +0 -9
- package/dist/chunk-ISSCC4XP.js.map +0 -1
- package/dist/chunk-QDJDQQ6E.cjs +0 -9
- package/dist/chunk-QDJDQQ6E.cjs.map +0 -1
- package/dist/de-U3V6TPCZ.js +0 -2
- package/dist/es-435K3LIV.cjs +0 -2
- package/dist/es-CSZUS23Z.js +0 -2
- package/dist/fr-DVOFE3WF.js +0 -2
- package/dist/fr-RKRDGOTP.cjs +0 -2
- package/dist/it-COLRVG26.cjs +0 -2
- package/dist/it-ZWPEN22A.js +0 -2
- package/dist/panel-4CIN3Y66.js +0 -2
- package/dist/panel-4CIN3Y66.js.map +0 -1
- package/dist/panel-TD4UUEZA.cjs +0 -2
- package/dist/panel-TD4UUEZA.cjs.map +0 -1
- package/dist/pt-QQX5CA7D.cjs +0 -2
- package/dist/pt-WGEJRQFC.js +0 -2
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var chunkQDJDQQ6E_cjs=require('./chunk-QDJDQQ6E.cjs');var Zi=new Set(["role","name","aria-label","rel","href"]);function eo(t,e){let n=Zi.has(t);n||=t.startsWith("data-")&&fe(t);let i=fe(e)&&e.length<100;return i||=e.startsWith("#")&&fe(e.slice(1)),n&&i}function to(t){return fe(t)}function no(t){return fe(t)}function io(t){return true}function Et(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:to,className:no,tagName:io,attr:eo,timeoutMs:1e3,seedMinLength:3,optimizedMinLength:2,maxNumberOfPathChecks:1/0},i=new Date,o={...n,...e},r=lo(o.root,n),s,a=0;for(let c of oo(t,o,r)){if(new Date().getTime()-i.getTime()>o.timeoutMs||a>=o.maxNumberOfPathChecks){let f=ro(t,r);if(!f)throw new Error(`Timeout: Can't find a unique selector after ${o.timeoutMs}ms`);return me(f)}if(a++,kt(c,r)){s=c;break}}if(!s)throw new Error("Selector was not found.");let l=[...Bn(s,t,o,r,i)];return l.sort(xt),l.length>0?me(l[0]):me(s)}function*oo(t,e,n){let i=[],o=[],r=t,s=0;for(;r&&r!==n;){let a=so(r,e);for(let l of a)l.level=s;if(i.push(a),r=r.parentElement,s++,o.push(...$n(i)),s>=e.seedMinLength){o.sort(xt);for(let l of o)yield l;o=[];}}o.sort(xt);for(let a of o)yield a;}function fe(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 so(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=wt(t,o);s!==void 0&&n.push({name:Dn(o,s),penalty:10});}let r=wt(t);return r!==void 0&&n.push({name:ao(o,r),penalty:50}),n}function me(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 Hn(t){return t.map(e=>e.penalty).reduce((e,n)=>e+n,0)}function xt(t,e){return Hn(t)-Hn(e)}function wt(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 ro(t,e){let n=0,i=t,o=[];for(;i&&i!==e;){let r=i.tagName.toLowerCase(),s=wt(i,r);if(s===void 0)return;o.push({name:Dn(r,s),penalty:NaN,level:n}),i=i.parentElement,n++;}if(kt(o,e))return o}function ao(t,e){return t==="html"?"html":`${t}:nth-child(${e})`}function Dn(t,e){return t==="html"?"html":`${t}:nth-of-type(${e})`}function*$n(t,e=[]){if(t.length>0)for(let n of t[0])yield*$n(t.slice(1,t.length),e.concat(n));else yield e;}function lo(t,e){return t.nodeType===Node.DOCUMENT_NODE?t:t===e.root?t.ownerDocument:t}function kt(t,e){let n=me(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*Bn(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),kt(a,i)&&i.querySelector(me(a))===e&&(yield a,yield*Bn(a,e,n,i,o));}}var co=["role","aria-label","type","name","href","src","data-testid","data-id"];function po(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 St(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}:${Tt(t)}`}function Tt(t){let e=[];for(let n of co){let i=t.getAttribute(n);i&&e.push(`${n}=${i}`);}return e.length>0?po(e.join(",")):"0"}function zn(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=St(t),[c,p,f]=l.split(":"),h=0,d=Math.abs(Number(c)-s);d===0?h+=.2:d<=2?h+=.1:d<=5&&(h+=.03);let m=Math.abs(Number(p)-a);return m===0?h+=.4:m===1?h+=.2:m<=3&&(h+=.08),f===r&&(h+=.4),h}function oe(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 Kn=4;function Ct(t){let e=t,n=t.shadowRoot?.activeElement;for(;n instanceof HTMLElement;){let i=n.getBoundingClientRect();i.width>=Kn&&i.height>=Kn&&(e=n),n=n.shadowRoot?.activeElement;}return e}function Xn(t){let e=null,n=i=>{let o=i.target;o instanceof HTMLElement&&(o===document.body||o===document.documentElement||o===t||oe(o)||(e=Ct(o)));};return document.addEventListener("focusin",n),{getLastPageFocus(){return e&&!e.isConnected&&(e=null),e},destroy(){document.removeEventListener("focusin",n),e=null;}}}var $e=256;function Be(t,e){let n=t;for(;n&&oe(n);)n=n[e];return n}function Wn(t){return t.nodeType===1&&t.getAttribute("data-siteping-ignore")==="true"}function uo(t){return t.nodeType===3?NodeFilter.FILTER_ACCEPT:Wn(t)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_SKIP}function se(t,e){let n=e==="before"?"previousElementSibling":"nextElementSibling",i=Be(t[n],n),o=3;for(;i&&o>0;){let r=e==="before"?ho(i,$e,true).trim():B(i,$e,true).trim();if(r)return e==="before"?r.slice(-32):r.slice(0,32);i=Be(i[n],n),o--;}return ""}function ze(t){let e=Be(t.previousElementSibling,"previousElementSibling"),n=Be(t.nextElementSibling,"nextElementSibling"),i=e?B(e,$e,true).trim().slice(0,40):"",o=n?B(n,$e,true).trim().slice(0,40):"";return [i,o].filter(Boolean).join(" | ")}function B(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,uo):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 ho(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&&Wn(s))&&o(s))return true;return false};return o(t),i.length>e?i.slice(-e):i}function jn(t){if(t.getRootNode()instanceof ShadowRoot)return fo(t);let e=Rt(t);if(e)return `//${t.localName}[@id=${Pt(e)}]`;let n=[],i=t;for(;i&&i!==document.body&&n.length<6;){let o=i.localName,r=i.parentElement,s=Rt(i);if(s)return n.unshift(`/${o}[@id=${Pt(s)}]`),"/"+n.join("");let a=1;if(r)for(let l of r.children){if(l===i)break;l.localName===o&&a++;}n.unshift(`/${o}[${a}]`),i=r;}return i!==document.body?"/"+n.join(""):"/html/body"+n.join("")}function fo(t){let e="";for(let n=t;n;n=n.parentElement){let i=n.localName,o=Rt(n);if(o){e=`/${i}[@id=${Pt(o)}]${e}`;continue}let r=1;for(let s=n.previousElementSibling;s;s=s.previousElementSibling)s.localName===i&&r++;e=`/${i}[${r}]${e}`;}return `.${e}`}function Rt(t){return t.id&&t.id.length<=chunkQDJDQQ6E_cjs.q?t.id:void 0}function Pt(t){return t.includes("'")?`concat('${t.replace(/'/g,`',"'",'`)}')`:`'${t}'`}var be="data-feedback-anchor",At=" >>> ",qn={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 Yn(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 Un(t){if(t.parentElement)return t.parentElement;let e=t.getRootNode();return e instanceof ShadowRoot?e.host:null}function Mt(t){let e=[],n=t;for(;n;){let d=n.getRootNode();d instanceof ShadowRoot?(e.unshift(Et(n,{...qn,root:d})),n=d.host):(e.unshift(Et(n,qn)),n=null);}let i=e.join(At),o=jn(t),r=Yn(t,'[data-siteping-ignore="true"]')!==null,s=r?"":B(t,256,true).trim().slice(0,120),a=r?"":se(t,"before"),l=r?"":se(t,"after"),c=St(t),p=r?"":ze(t),h=Yn(t,`[${be}]`)?.getAttribute(be)??null;return {cssSelector:i,xpath:o,textSnippet:s,textPrefix:a,textSuffix:l,fingerprint:c,neighborText:p,elementTag:t.tagName.slice(0,chunkQDJDQQ6E_cjs.p),elementId:t.id&&t.id.length<=chunkQDJDQQ6E_cjs.q?t.id:void 0,anchorKey:h}}function Vn(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 Gn(t,e=document.documentElement){let n=It(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(be)&&Vn(i,t))return i;i=Un(i);}for(i=n;i&&i!==document.body;){if(Vn(i,t))return i;i=Un(i);}return document.body}function It(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 Qn(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 Jn={width:334,height:280},re={top:0,bottom:0};function Zn(t,e,n,i=re){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=d=>d>=o&&d+e.height<=r,p,f=null;c(a)?p=a:c(l)?p=l:e.height<=s?p=Math.min(Math.max(a,o),r-e.height):(p=o,f=s);let h=t.left;return h+e.width>n.width-8&&(h=t.right-e.width),h=Math.max(8,Math.min(h,n.width-8-e.width)),{top:p,left:h,maxHeight:f}}var mo={question:"type.question",change:"type.change",bug:"type.bug",other:"type.other"},ti=`opacity ${250}ms cubic-bezier(0.16, 1, 0.3, 1),transform ${250}ms cubic-bezier(0.16, 1, 0.3, 1)`,ge=class{constructor(e,n){this.colors=e;this.t=n;this.root=chunkQDJDQQ6E_cjs.A("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:${ti};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:chunkQDJDQQ6E_cjs.U},{type:"change",icon:chunkQDJDQQ6E_cjs.V},{type:"bug",icon:chunkQDJDQQ6E_cjs.W},{type:"other",icon:chunkQDJDQQ6E_cjs.X}];this.typeRow=chunkQDJDQQ6E_cjs.A("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=chunkQDJDQQ6E_cjs.z(r.icon);a.style.cssText="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=chunkQDJDQQ6E_cjs.ja(s.dataset.type??"",this.colors);s.style.background=l,s.style.borderColor=chunkQDJDQQ6E_cjs.ga(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=chunkQDJDQQ6E_cjs.A("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=chunkQDJDQQ6E_cjs.A("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.accentText);}),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),chunkQDJDQQ6E_cjs.I(this.root),document.body.appendChild(this.root),this.applyLabels();}colors;t;root;selectedType=null;textarea;submitBtn;cancelBtn;typeRow;submitLabel;hint;resolve=null;previouslyFocused=null;removeKeydownTrap=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=mo[i];if(!o)continue;let r=n.querySelector("span");r&&chunkQDJDQQ6E_cjs.B(r,this.t(o));}this.textarea.placeholder=this.t("popup.placeholder"),this.textarea.setAttribute("aria-label",this.t("popup.textareaAria")),chunkQDJDQQ6E_cjs.B(this.hint,chunkQDJDQQ6E_cjs.G()?this.t("popup.submitHintMac"):this.t("popup.submitHintOther")),chunkQDJDQQ6E_cjs.B(this.cancelBtn,this.t("popup.cancel")),chunkQDJDQQ6E_cjs.B(this.submitLabel,this.t("popup.submit"));}show(e,n,i=re){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=chunkQDJDQQ6E_cjs.ma();this.sheet=chunkQDJDQQ6E_cjs.la();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(),chunkQDJDQQ6E_cjs.J(this.root,false),this.root.style.display="block",this.layout(e,i),this.removeKeydownTrap?.(),this.removeKeydownTrap=chunkQDJDQQ6E_cjs.L(this.root,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.style.transition=chunkQDJDQQ6E_cjs.na()?"none":ti,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=chunkQDJDQQ6E_cjs.oa(a);return}i.right="",i.bottom="",i.padding="16px",i.maxHeight="",i.overflowY="";let{top:o,left:r,maxHeight:s}=Zn(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}:Jn}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=chunkQDJDQQ6E_cjs.ga(o.dataset.type??"",this.colors),a=chunkQDJDQQ6E_cjs.ja(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.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.textarea.value.trim())return;let e={type:this.selectedType??"other",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;",!chunkQDJDQQ6E_cjs.na()&&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.removeKeydownTrap?.(),this.removeKeydownTrap=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,chunkQDJDQQ6E_cjs.J(this.root,true),chunkQDJDQQ6E_cjs.na()){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.removeKeydownTrap?.(),this.removeKeydownTrap=null,this.stopKeyboardTracking?.(),this.stopKeyboardTracking=null,this.root.remove();}};var ye,ni=false;async function bo(){if(ye!==void 0)return ye;try{let t=await import('html2canvas-pro');return ye=t.default??t,ye}catch(t){return ye=null,ni||(ni=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 Lt(t,e,n){return Math.min(n,Math.max(t,e))}function Ke(t){return Lt(0,Math.round(t*1e4)/1e4,1)}async function ii(t,e){let n=await bo();if(!n)return null;let i=.85,o=1200,r=Lt(48,t.width*.6,280),s=Lt(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),f=Math.max(0,a-r),h=Math.max(0,l-s),d=Math.min(c,a+t.width+r)-f,m=Math.min(p,l+t.height+s)-h;if(d<=0||m<=0)return null;let v={xPct:Ke((a-f)/d),yPct:Ke((l-h)/m),wPct:Ke(t.width/d),hPct:Ke(t.height/m)};try{let k=await n(document.body,{x:f,y:h,width:d,height:m,scale:window.devicePixelRatio,useCORS:!0,allowTaint:!0,logging:!1,ignoreElements:F=>F.tagName==="SITEPING-WIDGET"||F.closest?.("siteping-widget")!==null||F.getAttribute?.("data-siteping-ignore")==="true"});if(k.width<=o)return {dataUrl:k.toDataURL("image/jpeg",i),region:v};let _=o/k.width,S=o,w=Math.round(k.height*_),N=document.createElement("canvas");N.width=S,N.height=w;let P=N.getContext("2d");return P?(P.drawImage(k,0,0,S,w),{dataUrl:N.toDataURL("image/jpeg",i),region:v}):null}catch(k){return console.warn("[siteping] Screenshot capture failed:",k),null}}var oi=10;function si(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 go(){return {clientId:chunkQDJDQQ6E_cjs.r()}}var Xe=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 ge(e,i),this.bus.on("annotation:start",()=>this.activate());}colors;bus;t;enableScreenshot;getFallbackTarget;overlay=null;toolbar=null;toolbarCancel=null;cancelFrozen=false;drawingRect=null;startX=0;startY=0;isDrawing=false;isActive=false;instantMode=false;popup;stalePopup=false;savedOverflow="";preActiveFocusElement=null;keyboardTarget=null;rafId=null;pendingMoveEvent=null;rejectPendingSubmission=null;unregisterEscapeLayer=chunkQDJDQQ6E_cjs.K(document,()=>this.isActive);get isBusy(){return this.isActive}refreshLabels(){this.popup.refreshLabels();}restyle(){this.stalePopup=this.isActive||this.popup.isOpen,!this.stalePopup&&(this.popup.destroy(),this.popup=new ge(this.colors,this.t));}async maybeCapture(e){return this.enableScreenshot?ii(e):null}activate(){if(this.isActive)return;this.isActive=true;let e=!this.instantMode,n=chunkQDJDQQ6E_cjs.la(),i=chunkQDJDQQ6E_cjs.ma(),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&&!oe(r)?Ct(r):this.getFallbackTarget?.()??null,this.savedOverflow=document.body.style.overflow,document.body.style.overflow="hidden",this.overlay=chunkQDJDQQ6E_cjs.A("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=chunkQDJDQQ6E_cjs.A("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=chunkQDJDQQ6E_cjs.A("span",{style:`width:8px;height:8px;border-radius:50%;flex-shrink:0;background:${this.colors.accent};box-shadow:0 0 8px ${this.colors.accentGlow};`});!chunkQDJDQQ6E_cjs.na()&&typeof s.animate=="function"&&s.animate([{opacity:1},{opacity:.4},{opacity:1}],{duration:1500,easing:"ease-in-out",iterations:1/0});let a=chunkQDJDQQ6E_cjs.A("span",{style:"font-weight:500;letter-spacing:-0.01em;min-width:0;"});chunkQDJDQQ6E_cjs.B(a,i?this.t("annotator.touchInstruction"):o);let l=document.createElement("button");l.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;`,chunkQDJDQQ6E_cjs.B(l,this.t("annotator.cancel")),l.addEventListener("click",()=>this.cancelSession()),l.addEventListener("mouseenter",()=>{this.cancelFrozen||this.paintCancel(true);}),l.addEventListener("mouseleave",()=>this.paintCancel(false)),this.toolbarCancel=l,this.toolbar.appendChild(s),this.toolbar.appendChild(a),this.toolbar.appendChild(l);}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),chunkQDJDQQ6E_cjs.I(this.overlay),this.toolbar&&chunkQDJDQQ6E_cjs.I(this.toolbar),document.body.appendChild(this.overlay),this.toolbar&&document.body.appendChild(this.toolbar),this.overlay.focus({preventScroll:true});}toolbarInsets(){if(!this.toolbar)return re;let e=this.toolbar.getBoundingClientRect();if(e.height===0)return re;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());}paintCancel(e){let n=this.toolbarCancel;n&&(n.style.borderColor=e?this.colors.typeBug:this.colors.border,n.style.color=e?this.colors.typeBug:this.colors.textTertiary,n.style.background=e?this.colors.typeBugBg:this.colors.glassBg);}freezeCancel(e){this.cancelFrozen=e;let n=this.toolbarCancel;n&&(e&&this.paintCancel(false),n.style.opacity=e?"0.5":"1",n.style.cursor=e?"not-allowed":"pointer",e?n.setAttribute("aria-disabled","true"):n.removeAttribute("aria-disabled"));}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.toolbarCancel=null,this.cancelFrozen=false,this.drawingRect=null,e instanceof HTMLElement&&e.isConnected&&e.focus({preventScroll:true}),this.bus.emit("annotation:end"),this.stalePopup&&this.restyle();}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:Mt(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?si(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=chunkQDJDQQ6E_cjs.A("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];n&&await this.finishDrawing(n.clientX,n.clientY);};elementAt(e,n){this.overlay&&(this.overlay.style.pointerEvents="none");let i=It(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&&!oe(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<oi||s<oi){this.drawingRect.remove(),this.drawingRect=null;let p=this.elementAt(e,n);p&&await this.annotateElement(p,true);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=si(a);this.drawingRect?.remove(),this.drawingRect=chunkQDJDQQ6E_cjs.A("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=go(),r=this.popup.show(n,s=>(this.freezeCancel(true),this.runSubmission(e,s,i,o).finally(()=>this.freezeCancel(false))),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(),f(),h(),this.rejectPendingSubmission=null;},c=this.bus.on("feedback:sent",()=>{l(),s();}),p=this.bus.on("feedback:queued",()=>{l(),s();}),f=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=Gn(e);this.overlay&&(this.overlay.style.pointerEvents="auto");let i=Mt(n),o=n.getBoundingClientRect(),r=Qn(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 We(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 ri=3,ve=1e4,yo=1e4,vo=6e4,J="siteping_retry_queue",xo=20;function Nt(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 ui(t,e){let n={};e&&(n["Content-Type"]="application/json"),t.apiKey&&(n.Authorization=`Bearer ${t.apiKey}`);let i=typeof t.headers=="function"?await Nt(Promise.resolve(t.headers()),ve,()=>new Error(`headers factory did not settle within ${ve/1e3} s`)):t.headers;return chunkQDJDQQ6E_cjs.t(n,i)}async function ae(t,e,n,i,{boundBody:o=false,timeoutMs:r=ve,resendOnTimeout:s=true}={}){for(let a=0;;a++){let l=new AbortController,c=setTimeout(()=>l.abort(),r),p;try{let f=await fetch(t,{...e,signal:l.signal}).catch(h=>{if(a===ri||!s&&l.signal.aborted)throw chunkQDJDQQ6E_cjs.x(h,n);return null});if(p=wo(f,a),f&&(!hi(f.status)||a===ri||p>yo)){if(clearTimeout(c),o&&(c=setTimeout(()=>l.abort(),ve)),!f.ok)throw await chunkQDJDQQ6E_cjs.v(f,n);return await i(f).catch(h=>{throw chunkQDJDQQ6E_cjs.x(h,n)})}}finally{clearTimeout(c);}await new Promise(f=>setTimeout(f,p));}}function wo(t,e){let n=t?.headers.get("Retry-After"),i=n?/^\d+$/.test(n)?Number(n)*1e3:Date.parse(n)-Date.now():Number.NaN;return Number.isNaN(i)?1e3*2**e+Math.random()*1e3-500:Math.max(0,i)}function Eo(t){return t instanceof chunkQDJDQQ6E_cjs.d||t instanceof chunkQDJDQQ6E_cjs.c&&t.code==="SERVER"}function hi(t){return t>=500||t===408||t===429}var ko="siteping_retry_queue";async function Ft(t){return typeof navigator<"u"&&navigator.locks?navigator.locks.request(ko,()=>t()):t()}function So(t){if(!chunkQDJDQQ6E_cjs.b(t,"endpoint")||typeof t.endpoint!="string"||!chunkQDJDQQ6E_cjs.b(t,"payload"))return false;let{payload:e}=t;return chunkQDJDQQ6E_cjs.b(e,"authorName")&&typeof e.authorName=="string"&&chunkQDJDQQ6E_cjs.b(e,"authorEmail")&&typeof e.authorEmail=="string"}function Ot(){let t=localStorage.getItem(J);if(!t)return [];let e;try{e=JSON.parse(t);}catch{return localStorage.removeItem(J),console.warn(`[siteping] discarded an unreadable retry queue from localStorage (${t.length} chars)`),[]}return Array.isArray(e)?e.filter(So):[]}var fi=new WeakMap;function mi(t){return typeof t=="object"&&t!==null?fi.get(t):void 0}function To(t,e){return Ft(()=>{try{let n=Ot().filter(r=>r.payload.clientId!==e.clientId);if(n.length>=xo&&n.shift(),n.push({endpoint:t,payload:e}),_t(n))return !0;let i=n.slice(),o=0;for(let[r,s]of i.entries())if(ai(s)&&(i[r]=Ro(s),o+=1,_t(i)))return console.warn(`[siteping] retry queue exceeded the localStorage quota \u2014 dropped the screenshot of ${o} of ${n.length} queued feedback(s)`),!0;for(;i.length>1;)if(i.shift(),_t(i)){let r=n.length-i.length,s=n.slice(r).filter(ai).length;return 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`:""}`),!0}console.warn("[siteping] feedback could not be queued for retry \u2014 localStorage is full or unavailable");}catch{}return false}).catch(()=>false)}function Co(t){Ft(()=>{try{let e=Ot(),n=e.filter(i=>i.payload.clientId!==t);if(n.length===e.length)return;n.length>0?localStorage.setItem(J,JSON.stringify(n)):localStorage.removeItem(J);}catch{}});}function _t(t){try{return localStorage.setItem(J,JSON.stringify(t)),!0}catch{return false}}function ai(t){return t.payload.screenshotDataUrl!=null}function Ro(t){let{screenshotDataUrl:e,screenshotRegion:n,...i}=t.payload;return {endpoint:t.endpoint,payload:i}}function li(t){return t.trim()}function ci(t){return t.trim().toLowerCase()}async function bi(t,e,n={}){await Ft(async()=>{try{let i=Ot();if(i.length===0)return;let o=[],r=[],s=0;for(let p of i){if(p.endpoint!==t){r.push(p);continue}!e||li(p.payload.authorName)===li(e.name)&&ci(p.payload.authorEmail)===ci(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 ui(n,!0);for(let f of o){let h=new AbortController,d=setTimeout(()=>h.abort(),ve);try{let m=await fetch(t,{method:"POST",headers:p,body:JSON.stringify(f.payload),signal:h.signal});if(m.ok){let v=await m.json().catch(()=>null);chunkQDJDQQ6E_cjs.b(v,"id")&&typeof v.id=="string"&&We(f.payload.projectName,t).add(v.id);continue}hi(m.status)?a.push(f):l+=1;}catch{a.push(f);}finally{clearTimeout(d);}}}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(J,JSON.stringify(c)):localStorage.removeItem(J);}catch{}});}function pi(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 Po(t){let[e,n]=pi(t.rect.xPct,t.rect.wPct),[i,o]=pi(t.rect.yPct,t.rect.hPct);return {...t,rect:{xPct:e,yPct:i,wPct:n,hPct:o}}}async function je(t){return await t.json()}async function di(){}var qe=class{constructor(e,n,i={}){this.endpoint=e;this.projectName=n;this.auth=i;}endpoint;projectName;auth;listRefusalExplained=false;async headers(e,n){try{return await ui(this.auth,e)}catch(i){throw chunkQDJDQQ6E_cjs.x(i,n)}}async sendFeedback(e){let n="Failed to send feedback",{screenshotRegion:i,...o}=e,r={...o,annotations:o.annotations.map(Po)},s=i?{...r,screenshotRegion:i}:r;try{let a=await ae(this.endpoint,{method:"POST",headers:await this.headers(!0,n),body:JSON.stringify(s)},n,je,{boundBody:!0});return Co(s.clientId),a}catch(a){throw Eo(a)&&fi.set(a,await To(this.endpoint,s)),a}}async getFeedbacks(e,n){let i="Failed to fetch feedbacks",o=chunkQDJDQQ6E_cjs.s({projectName:e,...n}),r=await this.headers(false,i);return ae(chunkQDJDQQ6E_cjs.u(this.endpoint,o),{method:"GET",cache:"no-store",...Object.keys(r).length>0?{headers:r}:{}},i,je).catch(s=>{throw s instanceof chunkQDJDQQ6E_cjs.e&&!this.listRefusalExplained&&(this.listRefusalExplained=true,console.warn(`[siteping] Feedback list refused (${s.status}): with an apiKey, GET needs it unless publicEndpoints includes "GET"; pins and panel stay empty. https://siteping.dev/docs/server#the-security-model-honestly`)),s})}async addComment(e,n){let i="Failed to post comment";return ae(this.endpoint,{method:"POST",headers:await this.headers(true,i),body:JSON.stringify({...n,projectName:this.projectName,feedbackId:e})},i,je,{boundBody:true})}async resolveFeedback(e,n){let i="Failed to update feedback";return ae(this.endpoint,{method:"PATCH",headers:await this.headers(true,i),body:JSON.stringify({id:e,projectName:this.projectName,status:n?"resolved":"open"})},i,je)}async deleteFeedback(e){let n="Failed to delete feedback";await ae(this.endpoint,{method:"DELETE",headers:await this.headers(true,n),body:JSON.stringify({id:e,projectName:this.projectName})},n,di);}async deleteAllFeedbacks(e){let n="Failed to delete all feedbacks";await ae(this.endpoint,{method:"DELETE",headers:await this.headers(true,n),body:JSON.stringify({projectName:e,deleteAll:true})},n,di,{timeoutMs:vo,resendOnTimeout:false});}};function Ye(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 Ht=50,Dt=500,Ao=["log","info","warn","error"];function Mo(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=Dt;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 Io(t){let e="";for(let n=0;n<t.length&&(n>0&&(e+=" "),e+=Mo(t[n]),!(e.length>=Dt));n++);return Ye(e,Dt)}var Ue=class{maxEntries;entries=[];originals=new Map;wrappers=new Map;disposed=false;constructor(e=Ht){if(this.maxEntries=Number.isFinite(e)&&e>=0?Math.min(Math.floor(e),Ht):Ht,!(typeof console>"u"))for(let n of Ao){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:Io(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 $t=20,Lo=2e3,_o=20,No=6e5,Fo=599;function gi(t){let e=Oo(Ho(t)),n=e.search(/[?#]/);return Ye(n===-1?e:e.slice(0,n),Lo)}function Oo(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 Ho(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 Ve=class{maxEntries;entries=[];originalFetch=null;originalXhrOpen=null;originalXhrSend=null;wrappedFetch=null;wrappedXhrOpen=null;wrappedXhrSend=null;disposed=false;constructor(e=$t){this.maxEntries=Number.isFinite(e)&&e>=0?Math.min(Math.floor(e),$t):$t,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,_o),status:e.status<=Fo?e.status:0,durationMs:Math.min(Math.max(e.durationMs,0),No)}));}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=gi(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:gi(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 f=typeof performance<"u"?performance.now():Date.now(),h=this.status;(h===0||h>=400)&&o.push({url:c.url,method:c.method,status:h,durationMs:Math.round(f-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 xe=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 Do=54,$o=60,Bo={chat:"fab.messages",annotate:"fab.annotate","toggle-annotations":"fab.annotations"},Ge=class{constructor(e,n,i,o){this.bus=i;this.t=o;let r=n.position??"bottom-right";this.items=[{id:"chat",icon:chunkQDJDQQ6E_cjs.ca},{id:"annotate",icon:chunkQDJDQQ6E_cjs.da}],n.showAnnotationsToggle!==false&&this.items.push({id:"toggle-annotations",icon:chunkQDJDQQ6E_cjs.O,iconAlt:chunkQDJDQQ6E_cjs.P}),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(chunkQDJDQQ6E_cjs.z(chunkQDJDQQ6E_cjs.N)),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"),chunkQDJDQQ6E_cjs.E(this.radialContainer,true);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(chunkQDJDQQ6E_cjs.z(c.icon)),p.setAttribute("role","menuitem"),p.dataset.itemId=c.id,p.addEventListener("click",h=>{h.stopPropagation(),this.handleItemClick(c.id);});let f=document.createElement("span");f.className="sp-radial-label",p.appendChild(f),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),chunkQDJDQQ6E_cjs.K(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,f=c.indexOf(p);switch(l.key){case "ArrowUp":{l.preventDefault();let h=f<=0?c.length-1:f-1;c[h]?.focus();break}case "ArrowDown":{l.preventDefault();let h=f>=c.length-1?0:f+1;c[h]?.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.applyFabLabel();let e=this.radialContainer.querySelectorAll(".sp-radial-item");for(let n of e){let i=n.dataset.itemId;if(!i)continue;let o=Bo[i];if(!o)continue;let r=this.t(o);n.setAttribute("aria-label",r);let s=n.querySelector(".sp-radial-label");s&&chunkQDJDQQ6E_cjs.B(s,r);}}applyFabLabel(){let e=this.t("fab.aria"),n=this.badgeEl?.textContent;this.fab.setAttribute("aria-label",n?`${e}, ${chunkQDJDQQ6E_cjs.sa(this.t,"fab.badge",{count:n})}`:e);}updateBadge(e){if(e<=0){this.badgeEl?.remove(),this.badgeEl=null,this.applyFabLabel();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);chunkQDJDQQ6E_cjs.B(this.badgeEl,n),this.badgeEl.setAttribute("aria-label",chunkQDJDQQ6E_cjs.sa(this.t,"fab.badge",{count:e})),this.applyFabLabel();}toggle(){this.isOpen?this.close():this.open();}open(){this.isOpen=true,this.setFabIcon(chunkQDJDQQ6E_cjs.Q),this.fab.setAttribute("aria-expanded","true"),this.scrim.classList.add("sp-scrim--open"),chunkQDJDQQ6E_cjs.E(this.radialContainer,false);let e=chunkQDJDQQ6E_cjs.ma()?$o:Do;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(chunkQDJDQQ6E_cjs.N),this.fab.setAttribute("aria-expanded","false"),this.scrim.classList.remove("sp-scrim--open"),chunkQDJDQQ6E_cjs.E(this.radialContainer,true),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(chunkQDJDQQ6E_cjs.z(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=chunkQDJDQQ6E_cjs.z(this.annotationsVisible?chunkQDJDQQ6E_cjs.O:chunkQDJDQQ6E_cjs.P);i.replaceWith(o);}break}}}destroy(){document.removeEventListener("click",this.onDocumentClick,true),this.root.remove();}};var yi="siteping_identity";function zo(t){if(!chunkQDJDQQ6E_cjs.b(t,"name")||!chunkQDJDQQ6E_cjs.b(t,"email"))return false;let{name:e,email:n}=t;return typeof e=="string"&&typeof n=="string"&&e.length>0&&e.length<=chunkQDJDQQ6E_cjs.h&&n.length<=chunkQDJDQQ6E_cjs.h&&chunkQDJDQQ6E_cjs.a(n)}function Bt(){try{let t=localStorage.getItem(yi);if(!t)return null;let e=JSON.parse(t);return zo(e)?e:null}catch{return null}}function vi(t){try{localStorage.setItem(yi,JSON.stringify(t));}catch{}}function Z(t){return t.normalize("NFC").replace(/\s+/g," ").trim()}function xi(t){return t.replace(/\s+/g," ").trim()}function Ko(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 we(t,e){if(t===e)return 1;let n=Math.max(t.length,e.length);return n===0?1:1-Ko(t,e)/n}function Xo(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 f=i[p-1]+(e.charCodeAt(p-1)===a?0:1),h=i[p]+1,d=o[p-1]+1;o[p]=Math.min(f,h,d);}let l=o[n];l<r&&(r=l);let c=i;i=o,o=c;}return r}function zt(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=we(i,e);return r>=n?r:0}if(e.length<8&&i.length>64)return 0;let o=1-Xo(i,e)/e.length;return o>=n?o:0}function wi(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 Ei(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 ki(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 Si(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 Wo={checkOpacity:true,opacityProperty:true,checkVisibilityCSS:true,visibilityProperty:true};function Ee(t){if(!t.isConnected)return "hidden";if(typeof t.checkVisibility=="function")return t.checkVisibility(Wo)?"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 Ti(t){switch(t){case "hidden":return .3;case "soft-hidden":return .6;default:return 1}}var le={anchorKey:1,id:1,css:.95,xpath:.9,scan:.85},Wt=16,jo=24,Ci=1e4,Ze=500,qo=.5,Kt=.6,Yo=.4,Uo=2e3,jt=.8,Xt=.6,Vo=.05;function Qe(t,e){return Z((t??"").slice(0,Uo)).slice(0,e)}function Go(t){let e=Qe(t.textSnippet,Ze),n=ki(e),i=0;for(let o of n.values())i+=o;return {snippet:e,snippetBigrams:wi(e),snippetBigramTotal:Math.max(0,e.length-1),snippetWordPairs:n,snippetWordPairTotal:i,prefix:Qe(t.textPrefix,128),suffix:Qe(t.textSuffix,128),neighbor:Qe(t.neighborText,128),fingerprint:(t.fingerprint??"").slice(0,64),tag:typeof t.elementTag=="string"?t.elementTag:""}}function Qo(t,e){let n=Go(t),{pool:i,treeRoots:o}=Zo(t),r=[];for(let[h,d]of i){let m=Ri(h,d,n);m&&r.push(m);}let s=0,a=false;for(let h of r)h.final>s&&(s=h.final),(h.strategy==="id"||h.strategy==="anchorKey")&&h.visibility===1&&(h.signals?.text??0)>=jt&&(h.signals?.fingerprint===void 0||h.signals.fingerprint>=jt)&&(a=true);let l=!!(n.snippet||n.fingerprint||n.prefix||n.suffix||n.neighbor),c=e?.scanBudget;if(l&&o.length>0&&s<le.scan&&!a)if(c&&c.remaining<=0)c.starved=true;else {c&&c.remaining--;for(let h of es(n,i,o)){let d=Ri(h,"scan",n);d&&r.push(d);}}let p=r.filter(ts);if(p.length===0)return null;p.sort((h,d)=>d.final-h.final);let f=is(p);return {element:f.element,confidence:os(f),strategy:f.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<Wt;r++){let s=o[r];s&&n.push(s);}if(n.length===Wt)break}return n}function Jo(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 Zo(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(At):[],o=i[i.length-1]??t.cssSelector,r=i.length>1?Jo(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,`[${be}="${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,Wt);for(let p=0;p<c;p++){let f=l.snapshotItem(p);f instanceof Element&&n(f,"xpath",!0);}}catch{}return {pool:e,treeRoots:s}}function es(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 f=0;f<p.length&&o.length<Ci;f++){let h=p[f];h&&o.push(h);}if(o.length===Ci)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 f=xi(B(c,Ze)),h=Ei(t.snippetBigrams,t.snippetBigramTotal,f);if(t.snippetWordPairTotal>0){let d=h>0?Si(t.snippetWordPairs,t.snippetWordPairTotal,f):0;p+=.6*(.5*h+.5*d);}else p+=.6*h;}if(a&&Tt(c)===a&&(p+=.25),!Number.isNaN(s)){let f=Math.abs(c.children.length-s);f===0?p+=.15:f<=2&&(p+=.07);}l.push({element:c,cheap:p});}return l.sort((c,p)=>p.cheap-c.cheap),l.slice(0,jo).map(c=>c.element)}function Ri(t,e,n){let i=ns(t,n),o=Ti(Ee(t));return i===null?e==="scan"?null:{element:t,strategy:e,verification:Xt,strongest:Xt,visibility:o,final:le[e]*Xt*o,unverified:true}:{element:t,strategy:e,verification:i.blend,strongest:i.strongest,signals:i,visibility:o,final:le[e]*i.blend*o}}function ts(t){if(t.strategy==="scan")return t.verification>=Yo;if(t.unverified||!t.signals)return true;let e=t.signals;return e.text===void 0||e.text>=qo?true:(e.fingerprint??0)>=Kt||(e.context??0)>=Kt||(e.neighbor??0)>=Kt}function ns(t,e){let n=0,i=0,o={blend:0,strongest:0};if(e.snippet){i+=40;let r=B(t,Ze,true);if(o.text=zt(Z(r),e.snippet,.5),o.text<1){let s=B(t,Ze);s!==r&&(o.text=Math.max(o.text,zt(Z(s),e.snippet,.5)));}n+=o.text*40;}if(e.fingerprint&&(i+=20,o.fingerprint=zn(t,e.fingerprint),n+=o.fingerprint*20),e.prefix||e.suffix){i+=20;let r=0,s=0;if(e.prefix){let a=Z(se(t,"before"));r+=a?we(a,e.prefix):0,s++;}if(e.suffix){let a=Z(se(t,"after"));r+=a?we(a,e.suffix):0,s++;}s>0&&(o.context=r/s,n+=o.context*20);}if(e.neighbor){i+=20;let r=Z(ze(t));o.neighbor=r?we(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 is(t){let e=t[0],n=t.filter(o=>e.final-o.final<=Vo&&(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 os(t){return t.strategy==="scan"?Math.min(t.verification,le.scan):t.unverified?le[t.strategy]:le[t.strategy]*Math.min(1,t.strongest/jt)}function et(t,e,n){let i=Qo(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 qt(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 tt(t){return {xPct:t.xPct,yPct:t.yPct,wPct:t.wPct,hPct:t.hPct}}var Pi=13,ss={bg:"rgba(241,245,249,0.9)",ring:"#cbd5e1",color:"#94a3b8",shadow:"0 2px 8px rgba(0,0,0,0.06)",hoverShadow:"0 4px 16px rgba(0,0,0,0.1)"};function rs(t,e){return chunkQDJDQQ6E_cjs.k(t)?ss:{bg:"rgba(255,255,255,0.92)",ring:t==="in_progress"?`${e} ${e} ${e}40 ${e}40`:e,color:e,shadow:`0 2px 12px ${e}25, 0 2px 6px rgba(0,0,0,0.06)`,hoverShadow:`0 4px 20px ${e}35, 0 4px 12px rgba(0,0,0,0.08)`}}function Ai(t){return {top:t.top+window.scrollY-Pi,left:t.right+window.scrollX-Pi}}function ke(t,e){let n=t.entries[e],i=t.elementIndices[e];if(!(!n||i===void 0))return n.elements[i]}function Mi(t){let e=t.elementIndices[0];return e===void 0?void 0:t.entries[0]?.positions[e]}var Ii=t=>t.style.display!=="none";function Li(t,e,n){!chunkQDJDQQ6E_cjs.na()&&typeof t.animate=="function"&&t.animate(e,n);}var _i=300,Ni=200,as=3e3,ls=.7,cs=28,Fi=32,nt=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=chunkQDJDQQ6E_cjs.A("div",{style:`position:absolute;top:0;left:0;pointer-events:none;z-index:${2147483646};`}),this.container.id="siteping-markers",chunkQDJDQQ6E_cjs.I(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)chunkQDJDQQ6E_cjs.k(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:Ni+100}):this.repositionTimer=+setTimeout(()=>{this.repositionTimer=null,this.repositionAll();},Ni));}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 f=`${a.feedback.id}:${l}`;r.add(f);let h=this.anchorCache.get(f),d=h?.ref.deref(),m,v=(this.hiddenRecheckAt.get(f)??0)>i,k=d?.isConnected&&(v||!(e&&Ee(d)==="hidden"));if(h&&d&&k){let S=d.getBoundingClientRect(),w=tt(p);m={element:d,rect:new DOMRect(S.left+w.xPct*S.width,S.top+w.yPct*S.height,w.wPct*S.width,w.hPct*S.height),confidence:h.confidence,strategy:h.strategy};}else if(v)m=null;else if(o.starved=false,m=et(qt(p),tt(p),{scanBudget:o}),!o.starved){if(m?.element){let{confidence:S,strategy:w}=m;this.anchorCache.set(f,{ref:new WeakRef(m.element),confidence:S,strategy:w});}!m||Ee(m.element)==="hidden"?this.hiddenRecheckAt.set(f,i+as):this.hiddenRecheckAt.delete(f);}let _=c.style.display!=="none";if(!m){_&&(s=true),c.style.display="none";continue}_||(s=true),a.positions[l]=Ai(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.bus.emit("markers:placed")),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((i,o)=>{let r=this.buildEntry(i,o+1);this.entries.push(r);}),this.buildClusters();let n=this.entries.filter(i=>i.elements.some(Ii)).length;this.liveRegion&&n>0&&(this.liveRegion.textContent=chunkQDJDQQ6E_cjs.sa(this.t,"marker.count",{count:n})),this.emitMarkersChanged(),this.bus.emit("markers:placed");}addFeedback(e,n){let i=this.buildEntry(e,n);for(let o of i.elements)Li(o,[{scale:0,opacity:0},{scale:1.2,opacity:1,offset:.6},{scale:1}],{duration:350,easing:"cubic-bezier(0.34,1.56,0.64,1)"});this.entries.push(i),this.buildClusters(),this.emitMarkersChanged(),this.bus.emit("markers:placed");}buildEntry(e,n){let i={feedback:e,elements:[],positions:[]};for(let o of e.annotations){let r=et(qt(o),tt(o)),s=r?Ai(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)<cs&&(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=Mi(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=ke(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=Mi(e);if(!n)return;let{top:i,left:o}=n,r=e.entries.length,s=(r-1)*Fi,a=o-s/2;for(let l=0;l<r;l++){let c=ke(e,l);c&&(c.style.top=`${i}px`,c.style.left=`${a+l*Fi}px`,c.style.zIndex=String(10+l));}}addClusterBadge(e){let n=ke(e,e.entries.length-1);if(!n)return;let i=chunkQDJDQQ6E_cjs.A("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;`});chunkQDJDQQ6E_cjs.B(i,String(e.entries.length)),n.appendChild(i);}setBadgesVisible(e,n){for(let i=0;i<e.entries.length;i++){let o=ke(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(ke(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=chunkQDJDQQ6E_cjs.k(i.status);n<ls&&!o?(e.style.borderStyle="dashed",e.style.opacity="0.7",e.title=chunkQDJDQQ6E_cjs.sa(this.t,"marker.approximate",{confidence:Math.round(n*100)})):(e.style.borderStyle="solid",e.style.opacity="1",e.title="");}createMarker(e,n,i){let{status:o}=n,r=rs(o,chunkQDJDQQ6E_cjs.ga(n.type,this.colors)),s=chunkQDJDQQ6E_cjs.A("div",{style:`position:absolute;top:${i.top}px;left:${i.left}px;width:26px;height:26px;border-radius:50%;background:${r.bg};border:2px solid;border-color:${r.ring};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.color};cursor:pointer;pointer-events:auto;box-shadow:${r.shadow};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=chunkQDJDQQ6E_cjs.sa(this.t,"marker.aria",{number:e,type:chunkQDJDQQ6E_cjs.ta(n.type,this.t),status:chunkQDJDQQ6E_cjs.ua(o,this.t),message:a});s.setAttribute("aria-label",l),s.setAttribute("aria-describedby",this.tooltip.tooltipId),o==="wont_fix"?s.appendChild(chunkQDJDQQ6E_cjs.A("span",{style:"width:2px;height:16px;border-radius:1px;background:currentColor;transform:rotate(45deg);"})):chunkQDJDQQ6E_cjs.B(s,o==="resolved"?"\u2713":String(e)),chunkQDJDQQ6E_cjs.ma()&&s.appendChild(chunkQDJDQQ6E_cjs.A("span",{style:"position:absolute;inset:-9px;border-radius:50%;"})),s.addEventListener("mouseenter",()=>{s.style.transform="scale(1.2)",s.style.boxShadow=r.hoverShadow,this.tooltip.show(n,s.getBoundingClientRect()),this.pinnedFeedback||this.showHighlight(n);}),s.addEventListener("mouseleave",()=>{s.style.transform="scale(1)",s.style.boxShadow=r.shadow,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)||(chunkQDJDQQ6E_cjs.la()&&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),i=n?.elements.find(Ii);return !n||!i?false:(i.scrollIntoView({behavior:"smooth",block:"center"}),this.pinHighlight(n.feedback),this.highlight(e),true)}revealPin(e){return this.container.style.display!=="none"&&this.focusFeedback(e)}isLost(e){let n=this.entries.filter(i=>i.feedback.id===e);return n.length>0&&n.every(i=>i.elements.every(o=>o.style.display==="none"))}highlight(e){for(let n of this.entries)if(n.feedback.id===e)for(let i of n.elements)Li(i,[{boxShadow:`0 0 0 0 ${this.colors.accentGlow}`},{boxShadow:"0 0 0 8px transparent",offset:.7},{boxShadow:"0 0 0 0 transparent"}],{duration:700,easing:"ease-out"});}showHighlight(e){this.removeHighlightElements();for(let n of e.annotations){let i=et(qt(n),tt(n));if(!i)continue;let o=chunkQDJDQQ6E_cjs.ga(e.type,this.colors),r=i.rect,s=chunkQDJDQQ6E_cjs.A("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 ${_i}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(),_i);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 Oi=3e4,it=class{constructor(e,n){this.store=e;this.projectName=n;}store;projectName;async sendFeedback(e){return Yt(await Hi(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(chunkQDJDQQ6E_cjs.o),screenshotDataUrl:e.screenshotDataUrl??null,screenshotRegion:e.screenshotRegion??null,diagnostics:e.diagnostics??null})}catch(n){if(!chunkQDJDQQ6E_cjs.n(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(Yt),total:o,capabilities:{comments:!!this.store.addComment}}}async resolveFeedback(e,n){let i=await this.store.updateFeedback(e,chunkQDJDQQ6E_cjs.l(n?"resolved":"open"));return Yt(i)}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 chunkQDJDQQ6E_cjs.c(`${i}: this store keeps no comments`,"SERVER",false);return Di(await Hi(this.store.addComment(e,n),i))}};function Hi(t,e){return Nt(t,Oi,()=>new chunkQDJDQQ6E_cjs.c(`${e}: the store did not answer within ${Oi/1e3} s`,"TIMEOUT",true))}function Yt(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(ps),comments:t.comments?.map(Di),screenshotUrl:t.screenshotUrl??null,screenshotRegion:t.screenshotRegion??null,diagnostics:t.diagnostics??null}}function Di({clientId:t,createdAt:e,...n}){return {...n,createdAt:e.toISOString()}}function ps(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 ds="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)",Ut="cubic-bezier(0.16, 1, 0.3, 1)",$i="cubic-bezier(0.34, 1.56, 0.64, 1)",us="cubic-bezier(0.25, 1, 0.5, 1)",Bi=`@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-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 ${ds} both;}.sp-anim-flash{animation:sp-flash-bg 0.5s ${us};}.sp-anim-slide-up{animation:sp-slide-up 0.3s ${Ut} both;}.sp-anim-fade-in{animation:sp-fade-in 0.2s ease-out both;}.sp-panel{transform:translateX(110%);transition:transform 0.4s ${Ut};}.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 ${$i},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 ${Ut} 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 ${$i} both;}@media (prefers-reduced-motion: reduce){*,*::before,*::after{animation-duration:0.01ms !important;animation-delay:0s !important;animation-iteration-count:1 !important;transition-duration:0.01ms !important;}}`;var zi=`: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 ${chunkQDJDQQ6E_cjs.y}{.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 Vt(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;${chunkQDJDQQ6E_cjs.ka(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-toast{position:fixed;left:50%;bottom:92px;transform:translateX(-50%);max-width:min(360px,calc(100vw - 32px));padding:10px 14px;border-radius:var(--sp-radius-lg);background:var(--sp-text);color:var(--sp-bg);font:500 13px/1.4 var(--sp-font);box-shadow:var(--sp-shadow-lg);cursor:pointer;animation:sp-toast-in 0.2s ease-out;}.sp-toast[hidden]{display:none;}.sp-toast--error{border-left:4px solid var(--sp-type-bug);}@keyframes sp-toast-in{from{opacity:0;transform:translate(-50%,8px);}}@media (prefers-reduced-motion: reduce){.sp-toast{animation:none;}}.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-text);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-text);}.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-lost{font-size:11px;color:var(--sp-text-tertiary);margin-top:4px;}.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-text);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:var(--sp-status-open);color:var(--sp-status-open);background:rgba(34,197,94,0.06);}.sp-btn-delete:hover{border-color:var(--sp-type-bug);color:var(--sp-type-bug);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-text);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;}}${Bi} ${chunkQDJDQQ6E_cjs.Ha} ${chunkQDJDQQ6E_cjs.Ga} ${chunkQDJDQQ6E_cjs.xa} ${chunkQDJDQQ6E_cjs.va} ${chunkQDJDQQ6E_cjs.La} ${chunkQDJDQQ6E_cjs.Aa} ${zi}`}var hs=120,fs=80,Ki="opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1)",ot=class{constructor(e,n="en"){this.colors=e;this.locale=n;this.root=chunkQDJDQQ6E_cjs.A("div",{style:`position:fixed;z-index:${2147483647};max-width:280px;padding:12px 14px;border-radius:14px;backdrop-filter:blur(24px);-webkit-backdrop-filter:blur(24px);font-family:"Inter",system-ui,-apple-system,sans-serif;pointer-events:auto;opacity:0;transform:translateY(6px) scale(0.97);transition:${Ki};visibility:hidden;-webkit-font-smoothing:antialiased;`}),this.root.setAttribute("role","tooltip"),this.root.id=this.tooltipId,this.arrow=chunkQDJDQQ6E_cjs.A("div",{style:"position:absolute;width:12px;height:12px;transform:rotate(45deg);pointer-events:none;"}),this.root.appendChild(this.arrow),this.restyle(),this.root.addEventListener("mouseenter",()=>this.cancelHide()),this.root.addEventListener("mouseleave",()=>this.scheduleHide()),chunkQDJDQQ6E_cjs.I(this.root),document.body.appendChild(this.root);}colors;locale;root;arrow;showTimer=null;hideTimer=null;currentFeedbackId=null;tooltipId="sp-tooltip";restyle(){let{glassBgHeavy:e,glassBorder:n,shadow:i}=this.colors,{style:o}=this.root;o.background=e,o.border=`1px solid ${n}`,o.boxShadow=`0 8px 32px ${i}, 0 2px 8px ${i}`;}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":Ki,this.root.style.visibility="visible",this.root.style.opacity="1",this.root.style.transform="translateY(0) scale(1)";},hs));}scheduleHide(){this.cancelHide(),this.hideTimer=setTimeout(()=>this.hide(),fs);}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 f of n)f!==this.arrow&&f.remove();let i=chunkQDJDQQ6E_cjs.ga(e.type,this.colors),o=chunkQDJDQQ6E_cjs.ja(e.type,this.colors),r=chunkQDJDQQ6E_cjs.ra(this.locale),s=chunkQDJDQQ6E_cjs.ta(e.type,r),a=chunkQDJDQQ6E_cjs.A("div",{style:"display:flex;flex-wrap:wrap;align-items:center;gap:6px 8px;margin-bottom:8px;"}),l=(f,h,d)=>{let m=chunkQDJDQQ6E_cjs.A("span",{style:`padding:3px 10px;border-radius:9999px;font-size:11px;font-weight:600;white-space:nowrap;color:${h};background:${d};letter-spacing:0.02em;`});return chunkQDJDQQ6E_cjs.B(m,f),m},c=chunkQDJDQQ6E_cjs.A("span",{style:`font-size:11px;color:${this.colors.textSecondary};margin-left:auto;`});chunkQDJDQQ6E_cjs.B(c,chunkQDJDQQ6E_cjs.H(e.createdAt,this.locale)),a.appendChild(l(s,i,o)),a.appendChild(l(chunkQDJDQQ6E_cjs.ua(e.status,r),chunkQDJDQQ6E_cjs.ha(e.status,this.colors),chunkQDJDQQ6E_cjs.ia(e.status,this.colors))),a.appendChild(c);let p=chunkQDJDQQ6E_cjs.A("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;`});chunkQDJDQQ6E_cjs.B(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 st=null;function ms(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 Se(){let t=()=>{};return {destroy:t,open:t,close:t,refresh:()=>Promise.resolve(),focusFeedback:()=>false,on:()=>t,off:t}}function Xi(){try{return process.env.NODE_ENV}catch{return}}function bs(){let t=location.hostname;return t===""||t==="localhost"||t.endsWith(".localhost")||t==="127.0.0.1"||t==="[::1]"}function gs(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"),Se();let e=t.debug?(...u)=>console.debug("[siteping]",...u):()=>{};if(st)return e("initSiteping() called more than once \u2014 returning existing instance"),st();let n=Xi();if(!t.forceShow&&(n==="production"||n===void 0&&!bs()))return t.onSkip?.("production"),Se();let i=typeof t.minViewportWidth=="number"&&Number.isFinite(t.minViewportWidth)?t.minViewportWidth:0;if(!t.forceShow&&window.innerWidth<i){let u="mobile";return t.onSkip?.(u),Se()}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."),Se();if(!t.projectName||typeof t.projectName!="string")return console.error("[siteping] Missing or invalid 'projectName' in config. Expected a non-empty string."),Se();let o=chunkQDJDQQ6E_cjs.g(t.locale??"en"),r=o==="en"?Promise.resolve():chunkQDJDQQ6E_cjs.qa(o).catch(()=>{}),s=chunkQDJDQQ6E_cjs.ra(o),a=t.scopeAnnotationsByUrl??true,l=()=>{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:o,scopeAnnotationsByUrl:a});let c=ms(t.captureDiagnostics),p=c.console?new Ue(c.maxConsoleEntries):null,f=c.network?new Ve(c.maxNetworkEntries):null,h=chunkQDJDQQ6E_cjs.fa(t.accentColor,t.theme),d=new xe,m=new Set,v=(u,...b)=>{for(let g of m)g.emit(u,...b);},k=(()=>{if(t.store)return new it(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 qe(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 _=We(t.projectName,t.endpoint);d.on("feedback:sent",u=>_.add(u.id)),d.on("feedback:deleted",u=>_.remove(u)),d.on("feedback:all-deleted",()=>_.clear());let S={"feedback:sent":()=>d.on("feedback:sent",u=>v("feedback:sent",u)),"feedback:deleted":()=>d.on("feedback:deleted",u=>v("feedback:deleted",u)),"comment:added":()=>d.on("comment:added",u=>v("comment:added",u)),"feedback:error":()=>d.on("feedback:error",u=>v("feedback:error",u)),"panel:open":()=>d.on("open",()=>v("panel:open")),"panel:close":()=>d.on("close",()=>v("panel:close")),"annotation:start":()=>d.on("annotation:start",()=>v("annotation:start")),"annotation:end":()=>d.on("annotation:end",()=>v("annotation:end"))};for(let u of Object.values(S))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 w=document.createElement("siteping-widget");w.style.cssText=`position:fixed;z-index:${2147483647};pointer-events:auto;`;let N=Xi()==="test"?"open":"closed",P=w.attachShadow({mode:N}),F;if("adoptedStyleSheets"in ShadowRoot.prototype){let u=new CSSStyleSheet;P.adoptedStyleSheets=[u],F=()=>u.replaceSync(Vt(h));}else {let u=document.createElement("style");P.appendChild(u),F=()=>{u.textContent=Vt(h);};}F(),chunkQDJDQQ6E_cjs.I(w,P);let Qt=chunkQDJDQQ6E_cjs.M();document.body.appendChild(w);let Te=Xn(w),M=document.createElement("div");M.setAttribute("role","status"),M.setAttribute("aria-live","polite"),M.setAttribute("aria-atomic","true"),M.setAttribute("data-siteping-ignore","true"),M.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;",chunkQDJDQQ6E_cjs.I(M),document.body.appendChild(M);let y=document.createElement("div");y.className="sp-toast",y.setAttribute("aria-hidden","true"),y.hidden=true;let C,O=()=>{clearTimeout(C),y.hidden=true;};y.addEventListener("click",O),P.appendChild(y);let H=(u,b)=>{M.textContent=u,y.textContent=u,y.classList.toggle("sp-toast--error",b),y.hidden=false,clearTimeout(C),C=setTimeout(O,b?8e3:4e3);},z=new ot(h,o),K=new nt(h,z,d,s,M),rt=new Ge(P,t,d,s);d.on("markers:changed",u=>rt.updateBadge(u));let A=null,at=null,D=false,Ce=0;async function Jt(u=false){let b=t.identity??Bt();if(b)return b;let g=await ys(P,s,u);return g&&vi(g),g}async function lt(){return D?null:A||(at||(at=import('./panel-TD4UUEZA.cjs').then(u=>D?null:(A=new u.Panel(P,h,d,k,t.projectName,K,s,o,{getScope:l,scopeAnnotationsByUrl:a,panelActions:t.panelActions,ownFeedback:_,resolveIdentity:Jt,readOnly:t.readOnly}),A))),at)}if(typeof window<"u"){let u=()=>{D||lt();},b=window.requestIdleCallback;typeof b=="function"?b(u):setTimeout(u,200);}let ee=false,ji=d.on("panel:toggle",u=>{A||(u?(ee=true,lt().then(b=>{b&&ee&&b.open(),ee=false;}).catch(b=>e("Failed to lazy-load panel:",b))):ee=false);}),ce=new Xe(h,d,s,t.enableScreenshot??false,()=>Te.getLastPageFocus()),Re=null;t.enableRightClickComment&&(Re=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(E=>E===w||E instanceof Element&&(E.hasAttribute("data-siteping-ignore")||E.id==="siteping-markers"))||ce.isBusy||(u.preventDefault(),ce.startInstantAnnotation(u.clientX,u.clientY).catch(E=>e("right-click annotation failed",E)));},document.addEventListener("contextmenu",Re)),o!=="en"&&r.then(()=>{D||(rt.refreshLabels(),ce.refreshLabels());});let ct=false,qi=d.on("annotation:complete",async u=>{if(ct){d.emit("submission:cancelled");return}ct=true;try{let{annotation:b,type:g,message:E,clientId:I,screenshotDataUrl:te,screenshotRegion:Pe}=u,R=await Jt(!0);if(!R){d.emit("submission:cancelled");return}let de=l(),nn=null;(p||f)&&(nn={console:p?.getEntries()??[],network:f?.getEntries()??[]});let Gi={projectName:t.projectName,type:g,message:E,url:de.url,urlPattern:de.urlPattern,viewport:`${window.innerWidth}x${window.innerHeight}`,userAgent:navigator.userAgent,authorName:R.name,authorEmail:R.email,annotations:[b],clientId:I,screenshotDataUrl:te??null,screenshotRegion:Pe??null,diagnostics:nn};try{let X=await k.sendFeedback(Gi);d.emit("feedback:sent",X),(!a||X.url===de.url)&&K.addFeedback(X,K.count+1),H(s("feedback.sent.confirmation"),!1),A&&await A.refresh();}catch(X){let ht=mi(X);ht&&d.emit("feedback:queued"),d.emit("feedback:error",X instanceof Error?X:new Error(String(X))),H(s(ht?"feedback.queued":"feedback.error.message"),!ht);}}finally{ct=false;}}),pt=l(),Yi=a?{limit:20,url:pt.url}:{limit:20},dt=gs(t.deepLink),Ui=++Ce;Promise.all([k.getFeedbacks(t.projectName,Yi),r]).then(([{feedbacks:u}])=>{if(D||Ce!==Ui)return;let b=a?u.filter(g=>g.url===pt.url):u;if(K.render(b),dt.enabled)try{let g=new URLSearchParams(window.location.search).get(dt.param);if(g){let E=K.focusFeedback(g);e(`deepLink ?${dt.param}=${g} ${E?"focused":"did not match a visible feedback"}`),E&<().then(async I=>{!I||D||(await I.open(),I.showFeedback(g));}).catch(I=>e("deepLink could not open the feedback:",I));}}catch(g){e("deepLink parsing failed:",g);}}).catch(u=>{e("Failed to load initial markers:",u);}),t.endpoint&&bi(t.endpoint,t.identity??Bt(),{apiKey:t.apiKey,headers:t.headers}).then(()=>e("Retry queue flushed")).catch(()=>{});let ut=()=>{let u=++Ce;if(A?.isCurrentlyOpen)return A.refresh();let b=l(),g=a?{limit:20,url:b.url}:{limit:20};return k.getFeedbacks(t.projectName,g).then(({feedbacks:E})=>{if(D||u!==Ce||A?.isCurrentlyOpen)return;let I=a?E.filter(te=>te.url===b.url):E;K.render(I);})},Vi=t.theme==="auto"?chunkQDJDQQ6E_cjs.ea(()=>{Object.assign(h,chunkQDJDQQ6E_cjs.fa(t.accentColor,"auto")),F(),z.restyle(),ce.restyle(),ut().catch(()=>{});}):void 0,Zt=null;if(t.watchNavigation!==false&&typeof window<"u"&&typeof history<"u"){let u=R=>`${R.url}
|
|
3
|
-
${
|
|
1
|
+
'use strict';var chunk7LL25BRN_cjs=require('./chunk-7LL25BRN.cjs');var uo=new Set(["role","name","aria-label","rel","href"]);function ho(t,e){let n=uo.has(t);n||=t.startsWith("data-")&&ve(t);let i=ve(e)&&e.length<100;return i||=e.startsWith("#")&&ve(e.slice(1)),n&&i}function fo(t){return ve(t)}function mo(t){return ve(t)}function go(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:fo,className:mo,tagName:go,attr:ho,timeoutMs:1e3,seedMinLength:3,optimizedMinLength:2,maxNumberOfPathChecks:1/0},i=new Date,o={...n,...e},r=wo(o.root,n),s,a=0;for(let c of bo(t,o,r)){if(new Date().getTime()-i.getTime()>o.timeoutMs||a>=o.maxNumberOfPathChecks){let f=vo(t,r);if(!f)throw new Error(`Timeout: Can't find a unique selector after ${o.timeoutMs}ms`);return xe(f)}if(a++,Pt(c,r)){s=c;break}}if(!s)throw new Error("Selector was not found.");let l=[...Gn(s,t,o,r,i)];return l.sort(Ct),l.length>0?xe(l[0]):xe(s)}function*bo(t,e,n){let i=[],o=[],r=t,s=0;for(;r&&r!==n;){let a=yo(r,e);for(let l of a)l.level=s;if(i.push(a),r=r.parentElement,s++,o.push(...Vn(i)),s>=e.seedMinLength){o.sort(Ct);for(let l of o)yield l;o=[];}}o.sort(Ct);for(let a of o)yield a;}function ve(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 yo(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:Yn(o,s),penalty:10});}let r=Rt(t);return r!==void 0&&n.push({name:xo(o,r),penalty:50}),n}function xe(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 Un(t){return t.map(e=>e.penalty).reduce((e,n)=>e+n,0)}function Ct(t,e){return Un(t)-Un(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 vo(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:Yn(r,s),penalty:NaN,level:n}),i=i.parentElement,n++;}if(Pt(o,e))return o}function xo(t,e){return t==="html"?"html":`${t}:nth-child(${e})`}function Yn(t,e){return t==="html"?"html":`${t}:nth-of-type(${e})`}function*Vn(t,e=[]){if(t.length>0)for(let n of t[0])yield*Vn(t.slice(1,t.length),e.concat(n));else yield e;}function wo(t,e){return t.nodeType===Node.DOCUMENT_NODE?t:t===e.root?t.ownerDocument:t}function Pt(t,e){let n=xe(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*Gn(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),Pt(a,i)&&i.querySelector(xe(a))===e&&(yield a,yield*Gn(a,e,n,i,o));}}var Eo=["role","aria-label","type","name","href","src","data-testid","data-id"];function ko(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 Mt(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}:${It(t)}`}function It(t){let e=[];for(let n of Eo){let i=t.getAttribute(n);i&&e.push(`${n}=${i}`);}return e.length>0?ko(e.join(",")):"0"}function Qn(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=Mt(t),[c,p,f]=l.split(":"),h=0,d=Math.abs(Number(c)-s);d===0?h+=.2:d<=2?h+=.1:d<=5&&(h+=.03);let g=Math.abs(Number(p)-a);return g===0?h+=.4:g===1?h+=.2:g<=3&&(h+=.08),f===r&&(h+=.4),h}var Xe=256;function je(t,e){let n=t;for(;n&&chunk7LL25BRN_cjs.A(n);)n=n[e];return n}function Jn(t){return t.nodeType===1&&t.getAttribute("data-siteping-ignore")==="true"}function So(t){return t.nodeType===3?NodeFilter.FILTER_ACCEPT:Jn(t)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_SKIP}function ce(t,e){let n=e==="before"?"previousElementSibling":"nextElementSibling",i=je(t[n],n),o=3;for(;i&&o>0;){let r=e==="before"?To(i,Xe,true).trim():j(i,Xe,true).trim();if(r)return e==="before"?r.slice(-32):r.slice(0,32);i=je(i[n],n),o--;}return ""}function qe(t){let e=je(t.previousElementSibling,"previousElementSibling"),n=je(t.nextElementSibling,"nextElementSibling"),i=e?j(e,Xe,true).trim().slice(0,40):"",o=n?j(n,Xe,true).trim().slice(0,40):"";return [i,o].filter(Boolean).join(" | ")}function j(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,So):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 To(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&&Jn(s))&&o(s))return true;return false};return o(t),i.length>e?i.slice(-e):i}function Zn(t){if(t.getRootNode()instanceof ShadowRoot)return Co(t);let e=Lt(t);if(e)return `//${t.localName}[@id=${_t(e)}]`;let n=[],i=t;for(;i&&i!==document.body&&n.length<6;){let o=i.localName,r=i.parentElement,s=Lt(i);if(s)return n.unshift(`/${o}[@id=${_t(s)}]`),"/"+n.join("");let a=1;if(r)for(let l of r.children){if(l===i)break;l.localName===o&&a++;}n.unshift(`/${o}[${a}]`),i=r;}return i!==document.body?"/"+n.join(""):"/html/body"+n.join("")}function Co(t){let e="";for(let n=t;n;n=n.parentElement){let i=n.localName,o=Lt(n);if(o){e=`/${i}[@id=${_t(o)}]${e}`;continue}let r=1;for(let s=n.previousElementSibling;s;s=s.previousElementSibling)s.localName===i&&r++;e=`/${i}[${r}]${e}`;}return `.${e}`}function Lt(t){return t.id&&t.id.length<=chunk7LL25BRN_cjs.q?t.id:void 0}function _t(t){return t.includes("'")?`concat('${t.replace(/'/g,`',"'",'`)}')`:`'${t}'`}var we="data-feedback-anchor",Nt=" >>> ",ei={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 ti(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 ni(t){if(t.parentElement)return t.parentElement;let e=t.getRootNode();return e instanceof ShadowRoot?e.host:null}function Ft(t){let e=[],n=t;for(;n;){let d=n.getRootNode();d instanceof ShadowRoot?(e.unshift(At(n,{...ei,root:d})),n=d.host):(e.unshift(At(n,ei)),n=null);}let i=e.join(Nt),o=Zn(t),r=ti(t,'[data-siteping-ignore="true"]')!==null,s=r?"":j(t,256,true).trim().slice(0,120),a=r?"":ce(t,"before"),l=r?"":ce(t,"after"),c=Mt(t),p=r?"":qe(t),h=ti(t,`[${we}]`)?.getAttribute(we)??null;return {cssSelector:i,xpath:o,textSnippet:s,textPrefix:a,textSuffix:l,fingerprint:c,neighborText:p,elementTag:t.tagName.slice(0,chunk7LL25BRN_cjs.p),elementId:t.id&&t.id.length<=chunk7LL25BRN_cjs.q?t.id:void 0,anchorKey:h}}function ii(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 oi(t,e=document.documentElement){let n=Ot(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(we)&&ii(i,t))return i;i=ni(i);}for(i=n;i&&i!==document.body;){if(ii(i,t))return i;i=ni(i);}return document.body}function Ot(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 si(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 ri={width:334,height:280},pe={top:0,bottom:0};function ai(t,e,n,i=pe){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=d=>d>=o&&d+e.height<=r,p,f=null;c(a)?p=a:c(l)?p=l:e.height<=s?p=Math.min(Math.max(a,o),r-e.height):(p=o,f=s);let h=t.left;return h+e.width>n.width-8&&(h=t.right-e.width),h=Math.max(8,Math.min(h,n.width-8-e.width)),{top:p,left:h,maxHeight:f}}var Ro={question:"type.question",change:"type.change",bug:"type.bug",other:"type.other"},Ht=`opacity ${200}ms ease,transform ${200}ms ${chunk7LL25BRN_cjs.z}`,Ao="opacity 300ms ease,transform 300ms cubic-bezier(0.32, 0.72, 0, 1)",Ue=`background-color 0.15s ease,border-color 0.15s ease,color 0.15s ease,box-shadow 0.15s ease,opacity 0.15s ease,scale 0.16s ${chunk7LL25BRN_cjs.z}`,li="blur(30px) saturate(180%)",Ee=class{constructor(e,n){this.colors=e;this.t=n;this.root=chunk7LL25BRN_cjs.E("div",{style:`position:fixed;z-index:${2147483647};pointer-events:auto;width:300px;padding:16px;border:none;border-radius:18px;color:${this.colors.text};font-family:${chunk7LL25BRN_cjs.qa};opacity:0;transform:scale(0.96);transition:${Ht};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:chunk7LL25BRN_cjs._},{type:"change",icon:chunk7LL25BRN_cjs.$},{type:"bug",icon:chunk7LL25BRN_cjs.aa},{type:"other",icon:chunk7LL25BRN_cjs.ba}];this.typeRow=chunk7LL25BRN_cjs.E("div",{style:"display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:12px;"});for(let r of i){let s=document.createElement("button");s.style.cssText=`height:50px;padding:0 12px;border:none;border-radius:12px;cursor:pointer;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;font-family:${chunk7LL25BRN_cjs.qa};font-size:13px;font-weight:500;letter-spacing:-0.005em;transition:${Ue};`;let a=chunk7LL25BRN_cjs.D(r.icon);a.style.cssText=`width:17px;height:17px;flex-shrink:0;color:${chunk7LL25BRN_cjs.ma(r.type,this.colors)};`,s.appendChild(a),s.appendChild(document.createElement("span")),s.dataset.type=r.type,s.setAttribute("aria-pressed","false"),this.paintType(s),s.addEventListener("click",()=>{this.submittingState||this.selectType(r.type,this.typeRow);}),s.addEventListener("mouseenter",()=>{this.submittingState||!chunk7LL25BRN_cjs.ua()||this.paintType(s,true);}),s.addEventListener("mouseleave",()=>{this.submittingState||this.paintType(s);}),chunk7LL25BRN_cjs.M(s),chunk7LL25BRN_cjs.N(s,this.colors.accent),this.typeRow.appendChild(s);}this.textarea=document.createElement("textarea"),this.textarea.style.cssText=`width:100%;min-height:80px;max-height:152px;padding:9px 12px;border:none;border-radius:12px;color:${this.colors.text};font-family:${chunk7LL25BRN_cjs.qa};font-size:15px;line-height:1.35;letter-spacing:-0.01em;resize:vertical;outline:none;box-shadow:none;transition:${Ue};box-sizing:border-box;`,this.textarea.maxLength=5e3,this.paintField(false),this.hint=chunk7LL25BRN_cjs.E("div",{style:`font-size:11px;color:${this.colors.textSecondary};text-align:right;margin-top:6px;font-family:${chunk7LL25BRN_cjs.qa};letter-spacing:0.01em;`}),this.textarea.addEventListener("focus",()=>{this.submittingState||this.paintField(true);}),this.textarea.addEventListener("blur",()=>{this.submittingState||this.paintField(false);}),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=chunk7LL25BRN_cjs.E("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 18px;border:none;border-radius:9999px;color:${this.colors.text};font-family:${chunk7LL25BRN_cjs.qa};font-size:15px;font-weight:500;letter-spacing:-0.01em;cursor:pointer;transition:${Ue};`,this.paintCancel(false),this.cancelBtn.addEventListener("click",()=>this.dismiss()),this.cancelBtn.addEventListener("mouseenter",()=>{this.submittingState||!chunk7LL25BRN_cjs.ua()||this.paintCancel(true);}),this.cancelBtn.addEventListener("mouseleave",()=>{this.submittingState||this.paintCancel(false);}),this.submitBtn=document.createElement("button"),this.submitBtn.style.cssText=`position:relative;height:34px;padding:0 20px;border:none;border-radius:9999px;background:${this.colors.accent};color:#fff;font-family:${chunk7LL25BRN_cjs.qa};font-size:15px;font-weight:600;letter-spacing:-0.01em;cursor:pointer;opacity:0.35;pointer-events:none;transition:${Ue};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()),this.submitBtn.addEventListener("mouseenter",()=>{this.submittingState||!chunk7LL25BRN_cjs.ua()||(this.submitBtn.style.background=this.colors.accentDark);}),this.submitBtn.addEventListener("mouseleave",()=>{this.submitBtn.style.background=this.colors.accent;}),chunk7LL25BRN_cjs.M(this.cancelBtn),chunk7LL25BRN_cjs.M(this.submitBtn),chunk7LL25BRN_cjs.N(this.cancelBtn,this.colors.accent),chunk7LL25BRN_cjs.N(this.submitBtn,this.colors.accent),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),chunk7LL25BRN_cjs.O(this.root),document.body.appendChild(this.root),this.applyLabels();}colors;t;root;selectedType=null;textarea;submitBtn;cancelBtn;typeRow;submitLabel;hint;resolve=null;previouslyFocused=null;removeKeydownTrap=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=Ro[i];if(!o)continue;let r=n.querySelector("span");r&&chunk7LL25BRN_cjs.F(r,this.t(o));}this.textarea.placeholder=this.t("popup.placeholder"),this.textarea.setAttribute("aria-label",this.t("popup.textareaAria")),chunk7LL25BRN_cjs.F(this.hint,chunk7LL25BRN_cjs.K()?this.t("popup.submitHintMac"):this.t("popup.submitHintOther")),chunk7LL25BRN_cjs.F(this.cancelBtn,this.t("popup.cancel")),chunk7LL25BRN_cjs.F(this.submitLabel,this.t("popup.submit"));}show(e,n,i=pe){return new Promise(o=>{this.cancelPendingTransition(),this.resolve=o,this.onSubmit=n??null,this.selectedType=null,this.textarea.value="",this.submittingState=false;let r=chunk7LL25BRN_cjs.ta();this.sheet=chunk7LL25BRN_cjs.sa(),this.updateSubmitState(),this.resetTypeButtons(),this.previouslyFocused=document.activeElement;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":"15px",this.textarea.style.minHeight=this.sheet?"104px":"80px",this.paintField(false),this.paintCancel(false),this.submitBtn.style.background=this.colors.accent,this.hint.style.display=r?"none":"",this.root.style.transform=this.hiddenTransform(),chunk7LL25BRN_cjs.P(this.root,false),this.root.style.display="block",this.layout(e,i),this.removeKeydownTrap?.(),this.removeKeydownTrap=chunk7LL25BRN_cjs.R(this.root,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.style.transition=chunk7LL25BRN_cjs.va()?"none":this.sheet?Ao:Ht,this.showFrame=requestAnimationFrame(()=>{this.showFrame=null,this.root.style.opacity="1",this.root.style.transform="none",(r?this.typeRow.querySelector("button"):this.textarea)?.focus();});})}layout(e,n){let i=this.root.style,{surface:o}=this.colors;if(i.width=this.sheet?"auto":"300px",i.borderRadius=this.sheet?"16px 16px 0 0":"18px",i.background=this.sheet?o.grouped:o.material,i.backdropFilter=this.sheet?"none":li,i.setProperty("-webkit-backdrop-filter",this.sheet?"none":li),i.boxShadow=this.sheet?`0 -0.5px 0 ${o.hairline}, 0 -10px 40px rgba(0, 0, 0, 0.16)`:`inset 0 0.5px 0 ${o.edge}, ${o.shadowCard}`,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 f=(h,d=window.innerHeight)=>{i.bottom=`${h}px`,i.maxHeight=`${d-8}px`,i.padding=`16px 16px ${h>0?"16px":"calc(16px + env(safe-area-inset-bottom, 0px))"}`;};f(0),this.stopKeyboardTracking=chunk7LL25BRN_cjs.wa(f);return}i.right="",i.bottom="",i.padding="16px",i.maxHeight="",i.overflowY="";let{top:r,left:s,maxHeight:a}=ai(e,this.measure(),{width:window.innerWidth,height:window.innerHeight},n);i.top=`${r}px`,i.left=`${s}px`;let{width:l,height:c}=this.measure(),p=Math.min(Math.max(e.left+e.width/2-s,0),l);i.transformOrigin=`${Math.round(p)}px ${r>=e.top+e.height/2?0:c}px`,a!==null&&(i.maxHeight=`${Math.max(0,a-this.verticalChromeHeight())}px`,i.overflowY="auto",this.root.scrollTop=0);}hiddenTransform(){return this.sheet?"translateY(100%)":"scale(0.96)"}measure(){let e=this.root.offsetWidth,n=this.root.offsetHeight;return e>0&&n>0?{width:e,height:n}:ri}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)o.setAttribute("aria-pressed",String(o.dataset.type===e)),this.paintType(o);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.cursor="pointer",this.paintType(n);}paintType(e,n=false){let{surface:i}=this.colors,o=e.style;if(e.getAttribute("aria-pressed")==="true"){let r=chunk7LL25BRN_cjs.ma(e.dataset.type??"",this.colors);o.background=`color-mix(in srgb, ${r} 15%, ${i.row})`,o.color=`color-mix(in srgb, ${r} 78%, ${i.inkMix})`,o.fontWeight="600",o.boxShadow=`inset 0 0 0 1.5px ${r}`;return}o.background=n?i.fillStrong:this.sheet?i.row:i.fill,o.color=this.colors.text,o.fontWeight="500",o.boxShadow="none";}paintField(e){let{surface:n}=this.colors;this.textarea.style.background=e||this.sheet?n.row:n.fill,this.textarea.style.boxShadow=e?`0 0 0 3px color-mix(in srgb, ${this.colors.accent} 30%, transparent)`:"none";}paintCancel(e){let{surface:n}=this.colors;this.cancelBtn.style.background=e||this.sheet?n.fillStrong:n.fill;}updateSubmitState(){if(this.submittingState)return;let e=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.textarea.value.trim())return;let e={type:this.selectedType??"other",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.opacity="0",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.opacity="",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="position:absolute;inset:0;margin:auto;width:14px;height:14px;border:2px solid rgba(255,255,255,0.35);border-top-color:#fff;border-radius:50%;box-sizing:border-box;",!chunk7LL25BRN_cjs.va()&&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.removeKeydownTrap?.(),this.removeKeydownTrap=null,this.submittingState&&this.exitSubmittingState(),this.onSubmit=null,this.stopKeyboardTracking?.(),this.stopKeyboardTracking=null,chunk7LL25BRN_cjs.va()||(this.root.style.transition=Ht),this.root.style.opacity="0",this.root.style.transform=this.hiddenTransform(),this.previouslyFocused?.focus(),this.previouslyFocused=null,chunk7LL25BRN_cjs.P(this.root,true),chunk7LL25BRN_cjs.va()){this.root.style.display="none";return}this.hideTimeoutId=setTimeout(()=>{this.hideTimeoutId=null,this.root.style.display="none";},200);}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.removeKeydownTrap?.(),this.removeKeydownTrap=null,this.stopKeyboardTracking?.(),this.stopKeyboardTracking=null,this.root.remove();}};var ke,ci=false;async function Po(){if(ke!==void 0)return ke;try{let t=await import('html2canvas-pro');return ke=t.default??t,ke}catch(t){return ke=null,ci||(ci=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 Mo(t){for(let e of [t.documentElement,t.body])e&&e.style.setProperty("scroll-behavior","auto","important");}function $t(t,e,n){return Math.min(n,Math.max(t,e))}function Ye(t){return $t(0,Math.round(t*1e4)/1e4,1)}async function pi(t,e){let n=await Po();if(!n)return null;let i=.85,o=1200,r=$t(48,t.width*.6,280),s=$t(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),f=Math.max(0,a-r),h=Math.max(0,l-s),d=Math.min(c,a+t.width+r)-f,g=Math.min(p,l+t.height+s)-h;if(d<=0||g<=0)return null;let v={xPct:Ye((a-f)/d),yPct:Ye((l-h)/g),wPct:Ye(t.width/d),hPct:Ye(t.height/g)};try{let k=await n(document.body,{x:f,y:h,width:d,height:g,scale:window.devicePixelRatio,useCORS:!0,allowTaint:!0,logging:!1,onclone:Mo,ignoreElements:$=>$.tagName==="SITEPING-WIDGET"||$.closest?.("siteping-widget")!==null||$.getAttribute?.("data-siteping-ignore")==="true"});if(k.width<=o)return {dataUrl:k.toDataURL("image/jpeg",i),region:v};let H=o/k.width,S=o,w=Math.round(k.height*H),D=document.createElement("canvas");D.width=S,D.height=w;let P=D.getContext("2d");return P?(P.drawImage(k,0,0,S,w),{dataUrl:D.toDataURL("image/jpeg",i),region:v}):null}catch(k){return console.warn("[siteping] Screenshot capture failed:",k),null}}var di=10;function Io(){return typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-transparency: reduce), (prefers-contrast: more)").matches}var ne={bg:"rgba(0, 0, 0, 0.86)",bgSolid:"#000000",text:"#f5f5f7",instruction:"rgba(255, 255, 255, 0.94)",cancelBg:"rgba(255, 255, 255, 0.16)",cancelHoverBg:"rgba(255, 69, 58, 0.26)",cancelHoverText:"#ff8a80"};function ui(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 Lo(){return {clientId:chunk7LL25BRN_cjs.r()}}var Ve=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 Ee(e,i),this.bus.on("annotation:start",()=>this.activate());}colors;bus;t;enableScreenshot;getFallbackTarget;overlay=null;toolbar=null;toolbarCancel=null;cancelFrozen=false;drawingRect=null;startX=0;startY=0;isDrawing=false;isActive=false;instantMode=false;popup;stalePopup=false;savedOverflow="";preActiveFocusElement=null;keyboardTarget=null;rafId=null;pendingMoveEvent=null;rejectPendingSubmission=null;unregisterEscapeLayer=chunk7LL25BRN_cjs.Q(document,()=>this.isActive);get isBusy(){return this.isActive}refreshLabels(){this.popup.refreshLabels();}restyle(){this.stalePopup=this.isActive||this.popup.isOpen,!this.stalePopup&&(this.popup.destroy(),this.popup=new Ee(this.colors,this.t));}async maybeCapture(e){return this.enableScreenshot?pi(e):null}activate(){if(this.isActive)return;this.isActive=true;let e=!this.instantMode,n=chunk7LL25BRN_cjs.ta(),i=this.t("annotator.instruction");this.preActiveFocusElement=document.activeElement;let o=document.activeElement;if(this.keyboardTarget=o instanceof HTMLElement&&o!==document.body&&o!==document.documentElement&&!chunk7LL25BRN_cjs.A(o)?chunk7LL25BRN_cjs.B(o):this.getFallbackTarget?.()??null,this.savedOverflow=document.body.style.overflow,document.body.style.overflow="hidden",this.overlay=chunk7LL25BRN_cjs.E("div",{style:`position:fixed;inset:0;z-index:${2147483646};pointer-events:auto;background:${this.colors.surface.overlayTint};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?i:this.t("annotator.instantInstruction")),this.overlay.setAttribute("data-siteping-ignore","true"),e){let r=Io()?`background:${ne.bgSolid};`:`background:${ne.bg};backdrop-filter:blur(24px) saturate(180%);-webkit-backdrop-filter:blur(24px) saturate(180%);`;this.toolbar=chunk7LL25BRN_cjs.E("div",{style:`position:fixed;top:calc(env(safe-area-inset-top,0px) + 10px);left:0;right:0;width:max-content;max-width:calc(100vw - 24px);margin:0 auto;z-index:${2147483647};pointer-events:auto;min-height:44px;box-sizing:border-box;padding:5px 5px 5px 16px;border:none;border-radius:22px;${r} box-shadow:inset 0 0 0 0.5px rgba(255,255,255,0.14),0 12px 32px rgba(0,0,0,0.28);display:flex;align-items:center;justify-content:center;gap:12px;font-family:${chunk7LL25BRN_cjs.qa};font-size:13px;line-height:1.35;color:${ne.text};-webkit-font-smoothing:antialiased;`}),this.toolbar.setAttribute("data-siteping-ignore","true");let s=`color-mix(in srgb, ${this.colors.accent} 50%, #ffffff)`,a=chunk7LL25BRN_cjs.E("span",{style:`width:8px;height:8px;border-radius:50%;flex-shrink:0;background:${s};box-shadow:0 0 10px color-mix(in srgb,${this.colors.accent} 60%,#ffffff);`});!chunk7LL25BRN_cjs.va()&&typeof a.animate=="function"&&a.animate([{opacity:1},{opacity:.4},{opacity:1}],{duration:1500,easing:"ease-in-out",iterations:1/0});let l=chunk7LL25BRN_cjs.E("span",{style:`font-weight:500;letter-spacing:-0.005em;min-width:0;color:${ne.instruction};`});chunk7LL25BRN_cjs.F(l,n?this.t("annotator.touchInstruction"):i);let c=document.createElement("button");c.style.cssText=`height:${n?40:34}px;padding:0 14px;border:none;border-radius:9999px;flex-shrink:0;color:#ffffff;font-family:${chunk7LL25BRN_cjs.qa};font-size:13px;font-weight:600;cursor:pointer;touch-action:manipulation;transition:background-color 0.15s ease,color 0.15s ease,opacity 0.15s ease,scale 0.16s ${chunk7LL25BRN_cjs.z};`,chunk7LL25BRN_cjs.F(c,this.t("annotator.cancel")),c.addEventListener("click",()=>this.cancelSession()),chunk7LL25BRN_cjs.M(c),chunk7LL25BRN_cjs.N(c,s),c.addEventListener("mouseenter",()=>{!this.cancelFrozen&&chunk7LL25BRN_cjs.ua()&&this.paintCancel(true);}),c.addEventListener("mouseleave",()=>this.paintCancel(false)),this.toolbarCancel=c,this.paintCancel(false),this.toolbar.appendChild(a),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),chunk7LL25BRN_cjs.O(this.overlay),this.toolbar&&chunk7LL25BRN_cjs.O(this.toolbar),document.body.appendChild(this.overlay),this.toolbar&&(document.body.appendChild(this.toolbar),!chunk7LL25BRN_cjs.va()&&typeof this.toolbar.animate=="function"&&this.toolbar.animate([{transform:"translateY(-100%)"},{transform:"none"}],{duration:250,easing:chunk7LL25BRN_cjs.z})),this.overlay.focus({preventScroll:true});}toolbarInsets(){if(!this.toolbar)return pe;if(typeof this.toolbar.getAnimations=="function")for(let o of this.toolbar.getAnimations())o.finish();let e=this.toolbar.getBoundingClientRect();if(e.height===0)return pe;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());}paintCancel(e){let n=this.toolbarCancel;n&&(n.style.color=e?ne.cancelHoverText:"#ffffff",n.style.background=e?ne.cancelHoverBg:ne.cancelBg);}freezeCancel(e){this.cancelFrozen=e;let n=this.toolbarCancel;n&&(e&&this.paintCancel(false),n.style.opacity=e?"0.5":"1",n.style.cursor=e?"not-allowed":"pointer",e?n.setAttribute("aria-disabled","true"):n.removeAttribute("aria-disabled"));}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.toolbarCancel=null,this.cancelFrozen=false,this.drawingRect=null,e instanceof HTMLElement&&e.isConnected&&e.focus({preventScroll:true}),this.bus.emit("annotation:end"),this.stalePopup&&this.restyle();}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?ui(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{accent:e}=this.colors,n=chunk7LL25BRN_cjs.E("div",{style:`position:fixed;border:2px solid ${e};background:color-mix(in srgb,${e} 10%,transparent);pointer-events:none;border-radius:12px;box-shadow:0 0 0 4px color-mix(in srgb,${e} 16%,transparent),0 8px 24px rgba(0,0,0,0.08);transition:box-shadow 0.15s ease;`});return n.setAttribute("data-siteping-ignore","true"),n}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);};elementAt(e,n){this.overlay&&(this.overlay.style.pointerEvents="none");let i=Ot(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&&!chunk7LL25BRN_cjs.A(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<di||s<di){this.drawingRect.remove(),this.drawingRect=null;let p=this.elementAt(e,n);p&&await this.annotateElement(p,true);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=ui(a);this.drawingRect?.remove(),this.drawingRect=this.createDrawingRect(),Object.assign(this.drawingRect.style,{left:`${i}px`,top:`${o}px`,width:`${20}px`,height:`${20}px`}),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=Lo(),r=this.popup.show(n,s=>(this.freezeCancel(true),this.runSubmission(e,s,i,o).finally(()=>this.freezeCancel(false))),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(),f(),h(),this.rejectPendingSubmission=null;},c=this.bus.on("feedback:sent",()=>{l(),s();}),p=this.bus.on("feedback:queued",()=>{l(),s();}),f=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=oi(e);this.overlay&&(this.overlay.style.pointerEvents="auto");let i=Ft(n),o=n.getBoundingClientRect(),r=si(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 Ge(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 hi=3,Se=1e4,_o=1e4,No=6e4,ie="siteping_retry_queue",Fo=20;function zt(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 vi(t,e){let n={};e&&(n["Content-Type"]="application/json"),t.apiKey&&(n.Authorization=`Bearer ${t.apiKey}`);let i=typeof t.headers=="function"?await zt(Promise.resolve(t.headers()),Se,()=>new Error(`headers factory did not settle within ${Se/1e3} s`)):t.headers;return chunk7LL25BRN_cjs.t(n,i)}async function de(t,e,n,i,{boundBody:o=false,timeoutMs:r=Se,resendOnTimeout:s=true}={}){for(let a=0;;a++){let l=new AbortController,c=setTimeout(()=>l.abort(),r),p;try{let f=await fetch(t,{...e,signal:l.signal}).catch(h=>{if(a===hi||!s&&l.signal.aborted)throw chunk7LL25BRN_cjs.x(h,n);return null});if(p=Oo(f,a),f&&(!xi(f.status)||a===hi||p>_o)){if(clearTimeout(c),o&&(c=setTimeout(()=>l.abort(),Se)),!f.ok)throw await chunk7LL25BRN_cjs.v(f,n);return await i(f).catch(h=>{throw chunk7LL25BRN_cjs.x(h,n)})}}finally{clearTimeout(c);}await new Promise(f=>setTimeout(f,p));}}function Oo(t,e){let n=t?.headers.get("Retry-After"),i=n?/^\d+$/.test(n)?Number(n)*1e3:Date.parse(n)-Date.now():Number.NaN;return Number.isNaN(i)?1e3*2**e+Math.random()*1e3-500:Math.max(0,i)}function Ho(t){return t instanceof chunk7LL25BRN_cjs.d||t instanceof chunk7LL25BRN_cjs.c&&t.code==="SERVER"}function xi(t){return t>=500||t===408||t===429}var Do="siteping_retry_queue";async function Kt(t){return typeof navigator<"u"&&navigator.locks?navigator.locks.request(Do,()=>t()):t()}function $o(t){if(!chunk7LL25BRN_cjs.b(t,"endpoint")||typeof t.endpoint!="string"||!chunk7LL25BRN_cjs.b(t,"payload"))return false;let{payload:e}=t;return chunk7LL25BRN_cjs.b(e,"authorName")&&typeof e.authorName=="string"&&chunk7LL25BRN_cjs.b(e,"authorEmail")&&typeof e.authorEmail=="string"}function Wt(){let t=localStorage.getItem(ie);if(!t)return [];let e;try{e=JSON.parse(t);}catch{return localStorage.removeItem(ie),console.warn(`[siteping] discarded an unreadable retry queue from localStorage (${t.length} chars)`),[]}return Array.isArray(e)?e.filter($o):[]}var wi=new WeakMap;function Ei(t){return typeof t=="object"&&t!==null?wi.get(t):void 0}function Bo(t,e){return Kt(()=>{try{let n=Wt().filter(r=>r.payload.clientId!==e.clientId);if(n.length>=Fo&&n.shift(),n.push({endpoint:t,payload:e}),Bt(n))return !0;let i=n.slice(),o=0;for(let[r,s]of i.entries())if(fi(s)&&(i[r]=Ko(s),o+=1,Bt(i)))return console.warn(`[siteping] retry queue exceeded the localStorage quota \u2014 dropped the screenshot of ${o} of ${n.length} queued feedback(s)`),!0;for(;i.length>1;)if(i.shift(),Bt(i)){let r=n.length-i.length,s=n.slice(r).filter(fi).length;return 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`:""}`),!0}console.warn("[siteping] feedback could not be queued for retry \u2014 localStorage is full or unavailable");}catch{}return false}).catch(()=>false)}function zo(t){Kt(()=>{try{let e=Wt(),n=e.filter(i=>i.payload.clientId!==t);if(n.length===e.length)return;n.length>0?localStorage.setItem(ie,JSON.stringify(n)):localStorage.removeItem(ie);}catch{}});}function Bt(t){try{return localStorage.setItem(ie,JSON.stringify(t)),!0}catch{return false}}function fi(t){return t.payload.screenshotDataUrl!=null}function Ko(t){let{screenshotDataUrl:e,screenshotRegion:n,...i}=t.payload;return {endpoint:t.endpoint,payload:i}}function mi(t){return t.trim()}function gi(t){return t.trim().toLowerCase()}async function ki(t,e,n={}){await Kt(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||mi(p.payload.authorName)===mi(e.name)&&gi(p.payload.authorEmail)===gi(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 vi(n,!0);for(let f of o){let h=new AbortController,d=setTimeout(()=>h.abort(),Se);try{let g=await fetch(t,{method:"POST",headers:p,body:JSON.stringify(f.payload),signal:h.signal});if(g.ok){let v=await g.json().catch(()=>null);chunk7LL25BRN_cjs.b(v,"id")&&typeof v.id=="string"&&Ge(f.payload.projectName,t).add(v.id);continue}xi(g.status)?a.push(f):l+=1;}catch{a.push(f);}finally{clearTimeout(d);}}}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(ie,JSON.stringify(c)):localStorage.removeItem(ie);}catch{}});}function bi(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 Wo(t){let[e,n]=bi(t.rect.xPct,t.rect.wPct),[i,o]=bi(t.rect.yPct,t.rect.hPct);return {...t,rect:{xPct:e,yPct:i,wPct:n,hPct:o}}}async function Qe(t){return await t.json()}async function yi(){}var Je=class{constructor(e,n,i={}){this.endpoint=e;this.projectName=n;this.auth=i;}endpoint;projectName;auth;listRefusalExplained=false;async headers(e,n){try{return await vi(this.auth,e)}catch(i){throw chunk7LL25BRN_cjs.x(i,n)}}async sendFeedback(e){let n="Failed to send feedback",{screenshotRegion:i,...o}=e,r={...o,annotations:o.annotations.map(Wo)},s=i?{...r,screenshotRegion:i}:r;try{let a=await de(this.endpoint,{method:"POST",headers:await this.headers(!0,n),body:JSON.stringify(s)},n,Qe,{boundBody:!0});return zo(s.clientId),a}catch(a){throw Ho(a)&&wi.set(a,await Bo(this.endpoint,s)),a}}async getFeedbacks(e,n){let i="Failed to fetch feedbacks",o=chunk7LL25BRN_cjs.s({projectName:e,...n}),r=await this.headers(false,i);return de(chunk7LL25BRN_cjs.u(this.endpoint,o),{method:"GET",cache:"no-store",...Object.keys(r).length>0?{headers:r}:{}},i,Qe).catch(s=>{throw s instanceof chunk7LL25BRN_cjs.e&&!this.listRefusalExplained&&(this.listRefusalExplained=true,console.warn(`[siteping] Feedback list refused (${s.status}): with an apiKey, GET needs it unless publicEndpoints includes "GET"; pins and panel stay empty. https://siteping.dev/docs/server#the-security-model-honestly`)),s})}async addComment(e,n){let i="Failed to post comment";return de(this.endpoint,{method:"POST",headers:await this.headers(true,i),body:JSON.stringify({...n,projectName:this.projectName,feedbackId:e})},i,Qe,{boundBody:true})}async resolveFeedback(e,n){let i="Failed to update feedback";return de(this.endpoint,{method:"PATCH",headers:await this.headers(true,i),body:JSON.stringify({id:e,projectName:this.projectName,status:n?"resolved":"open"})},i,Qe)}async deleteFeedback(e){let n="Failed to delete feedback";await de(this.endpoint,{method:"DELETE",headers:await this.headers(true,n),body:JSON.stringify({id:e,projectName:this.projectName})},n,yi);}async deleteAllFeedbacks(e){let n="Failed to delete all feedbacks";await de(this.endpoint,{method:"DELETE",headers:await this.headers(true,n),body:JSON.stringify({projectName:e,deleteAll:true})},n,yi,{timeoutMs:No,resendOnTimeout:false});}};function Ze(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 Xt=50,jt=500,Xo=["log","info","warn","error"];function jo(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=jt;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 qo(t){let e="";for(let n=0;n<t.length&&(n>0&&(e+=" "),e+=jo(t[n]),!(e.length>=jt));n++);return Ze(e,jt)}var et=class{maxEntries;entries=[];originals=new Map;wrappers=new Map;disposed=false;constructor(e=Xt){if(this.maxEntries=Number.isFinite(e)&&e>=0?Math.min(Math.floor(e),Xt):Xt,!(typeof console>"u"))for(let n of Xo){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:qo(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 qt=20,Uo=2e3,Yo=20,Vo=6e5,Go=599;function Si(t){let e=Qo(Jo(t)),n=e.search(/[?#]/);return Ze(n===-1?e:e.slice(0,n),Uo)}function Qo(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 Jo(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 tt=class{maxEntries;entries=[];originalFetch=null;originalXhrOpen=null;originalXhrSend=null;wrappedFetch=null;wrappedXhrOpen=null;wrappedXhrSend=null;disposed=false;constructor(e=qt){this.maxEntries=Number.isFinite(e)&&e>=0?Math.min(Math.floor(e),qt):qt,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,Yo),status:e.status<=Go?e.status:0,durationMs:Math.min(Math.max(e.durationMs,0),Vo)}));}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=Si(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:Si(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 f=typeof performance<"u"?performance.now():Date.now(),h=this.status;(h===0||h>=400)&&o.push({url:c.url,method:c.method,status:h,durationMs:Math.round(f-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 Te=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 Zo=54,es=60,ts={chat:"fab.messages",annotate:"fab.annotate","toggle-annotations":"fab.annotations"},nt=class{constructor(e,n,i,o){this.bus=i;this.t=o;let r=n.position??"bottom-right";this.items=[{id:"chat",icon:chunk7LL25BRN_cjs.ia},{id:"annotate",icon:chunk7LL25BRN_cjs.ja}],n.showAnnotationsToggle!==false&&this.items.push({id:"toggle-annotations",icon:chunk7LL25BRN_cjs.U,iconAlt:chunk7LL25BRN_cjs.V}),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(chunk7LL25BRN_cjs.D(chunk7LL25BRN_cjs.T)),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"),chunk7LL25BRN_cjs.I(this.radialContainer,true);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(chunk7LL25BRN_cjs.D(c.icon)),p.setAttribute("role","menuitem"),p.dataset.itemId=c.id,p.addEventListener("click",h=>{h.stopPropagation(),this.handleItemClick(c.id);});let f=document.createElement("span");f.className="sp-radial-label",p.appendChild(f),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),chunk7LL25BRN_cjs.Q(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,f=c.indexOf(p);switch(l.key){case "ArrowUp":{l.preventDefault();let h=f<=0?c.length-1:f-1;c[h]?.focus();break}case "ArrowDown":{l.preventDefault();let h=f>=c.length-1?0:f+1;c[h]?.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.applyFabLabel();let e=this.radialContainer.querySelectorAll(".sp-radial-item");for(let n of e){let i=n.dataset.itemId;if(!i)continue;let o=ts[i];if(!o)continue;let r=this.t(o);n.setAttribute("aria-label",r);let s=n.querySelector(".sp-radial-label");s&&chunk7LL25BRN_cjs.F(s,r);}}applyFabLabel(){let e=this.t("fab.aria"),n=this.badgeEl?.textContent;this.fab.setAttribute("aria-label",n?`${e}, ${chunk7LL25BRN_cjs.Aa(this.t,"fab.badge",{count:n})}`:e);}updateBadge(e){if(e<=0){this.badgeEl?.remove(),this.badgeEl=null,this.applyFabLabel();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);chunk7LL25BRN_cjs.F(this.badgeEl,n),this.badgeEl.setAttribute("aria-label",chunk7LL25BRN_cjs.Aa(this.t,"fab.badge",{count:e})),this.applyFabLabel();}toggle(){this.isOpen?this.close():this.open();}open(){this.isOpen=true,this.setFabIcon(chunk7LL25BRN_cjs.W),this.fab.setAttribute("aria-expanded","true"),this.scrim.classList.add("sp-scrim--open"),chunk7LL25BRN_cjs.I(this.radialContainer,false);let e=chunk7LL25BRN_cjs.ta()?es:Zo;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(chunk7LL25BRN_cjs.T),this.fab.setAttribute("aria-expanded","false"),this.scrim.classList.remove("sp-scrim--open"),chunk7LL25BRN_cjs.I(this.radialContainer,true),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){this.fab.querySelector("svg")?.replaceWith(chunk7LL25BRN_cjs.D(e));}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=chunk7LL25BRN_cjs.D(this.annotationsVisible?chunk7LL25BRN_cjs.U:chunk7LL25BRN_cjs.V);i.replaceWith(o);}break}}}destroy(){document.removeEventListener("click",this.onDocumentClick,true),this.root.remove();}};var Ti="siteping_identity";function ns(t){if(!chunk7LL25BRN_cjs.b(t,"name")||!chunk7LL25BRN_cjs.b(t,"email"))return false;let{name:e,email:n}=t;return typeof e=="string"&&typeof n=="string"&&e.length>0&&e.length<=chunk7LL25BRN_cjs.h&&n.length<=chunk7LL25BRN_cjs.h&&chunk7LL25BRN_cjs.a(n)}function Ut(){try{let t=localStorage.getItem(Ti);if(!t)return null;let e=JSON.parse(t);return ns(e)?e:null}catch{return null}}function Ci(t){try{localStorage.setItem(Ti,JSON.stringify(t));}catch{}}function oe(t){return t.normalize("NFC").replace(/\s+/g," ").trim()}function Ri(t){return t.replace(/\s+/g," ").trim()}function is(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 Ce(t,e){if(t===e)return 1;let n=Math.max(t.length,e.length);return n===0?1:1-is(t,e)/n}function os(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 f=i[p-1]+(e.charCodeAt(p-1)===a?0:1),h=i[p]+1,d=o[p-1]+1;o[p]=Math.min(f,h,d);}let l=o[n];l<r&&(r=l);let c=i;i=o,o=c;}return r}function Yt(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=Ce(i,e);return r>=n?r:0}if(e.length<8&&i.length>64)return 0;let o=1-os(i,e)/e.length;return o>=n?o:0}function Ai(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 Pi(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 Mi(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 Ii(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 ss={checkOpacity:true,opacityProperty:true,checkVisibilityCSS:true,visibilityProperty:true};function Re(t){if(!t.isConnected)return "hidden";if(typeof t.checkVisibility=="function")return t.checkVisibility(ss)?"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 Li(t){switch(t){case "hidden":return .3;case "soft-hidden":return .6;default:return 1}}var ue={anchorKey:1,id:1,css:.95,xpath:.9,scan:.85},Qt=16,rs=24,_i=1e4,st=500,as=.5,Vt=.6,ls=.4,cs=2e3,Jt=.8,Gt=.6,ps=.05;function it(t,e){return oe((t??"").slice(0,cs)).slice(0,e)}function ds(t){let e=it(t.textSnippet,st),n=Mi(e),i=0;for(let o of n.values())i+=o;return {snippet:e,snippetBigrams:Ai(e),snippetBigramTotal:Math.max(0,e.length-1),snippetWordPairs:n,snippetWordPairTotal:i,prefix:it(t.textPrefix,128),suffix:it(t.textSuffix,128),neighbor:it(t.neighborText,128),fingerprint:(t.fingerprint??"").slice(0,64),tag:typeof t.elementTag=="string"?t.elementTag:""}}function us(t,e){let n=ds(t),{pool:i,treeRoots:o}=fs(t),r=[];for(let[h,d]of i){let g=Ni(h,d,n);g&&r.push(g);}let s=0,a=false;for(let h of r)h.final>s&&(s=h.final),(h.strategy==="id"||h.strategy==="anchorKey")&&h.visibility===1&&(h.signals?.text??0)>=Jt&&(h.signals?.fingerprint===void 0||h.signals.fingerprint>=Jt)&&(a=true);let l=!!(n.snippet||n.fingerprint||n.prefix||n.suffix||n.neighbor),c=e?.scanBudget;if(l&&o.length>0&&s<ue.scan&&!a)if(c&&c.remaining<=0)c.starved=true;else {c&&c.remaining--;for(let h of ms(n,i,o)){let d=Ni(h,"scan",n);d&&r.push(d);}}let p=r.filter(gs);if(p.length===0)return null;p.sort((h,d)=>d.final-h.final);let f=ys(p);return {element:f.element,confidence:vs(f),strategy:f.strategy}}function ot(t,e){let n=[];for(let i of t){let o=i.querySelectorAll(e);for(let r=0;r<o.length&&n.length<Qt;r++){let s=o[r];s&&n.push(s);}if(n.length===Qt)break}return n}function hs(t){let e=[],n=[document];for(let i of t){let o;try{o=ot(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 fs(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(Nt):[],o=i[i.length-1]??t.cssSelector,r=i.length>1?hs(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 ot(a,`[${we}="${l}"]`))n(c,"anchorKey",!1);}catch{}}if(t.elementId){let l=t.elementId.replace(/\\/g,"\\\\").replace(/"/g,'\\"');try{for(let c of ot(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 ot(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,Qt);for(let p=0;p<c;p++){let f=l.snapshotItem(p);f instanceof Element&&n(f,"xpath",!0);}}catch{}return {pool:e,treeRoots:s}}function ms(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 f=0;f<p.length&&o.length<_i;f++){let h=p[f];h&&o.push(h);}if(o.length===_i)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 f=Ri(j(c,st)),h=Pi(t.snippetBigrams,t.snippetBigramTotal,f);if(t.snippetWordPairTotal>0){let d=h>0?Ii(t.snippetWordPairs,t.snippetWordPairTotal,f):0;p+=.6*(.5*h+.5*d);}else p+=.6*h;}if(a&&It(c)===a&&(p+=.25),!Number.isNaN(s)){let f=Math.abs(c.children.length-s);f===0?p+=.15:f<=2&&(p+=.07);}l.push({element:c,cheap:p});}return l.sort((c,p)=>p.cheap-c.cheap),l.slice(0,rs).map(c=>c.element)}function Ni(t,e,n){let i=bs(t,n),o=Li(Re(t));return i===null?e==="scan"?null:{element:t,strategy:e,verification:Gt,strongest:Gt,visibility:o,final:ue[e]*Gt*o,unverified:true}:{element:t,strategy:e,verification:i.blend,strongest:i.strongest,signals:i,visibility:o,final:ue[e]*i.blend*o}}function gs(t){if(t.strategy==="scan")return t.verification>=ls;if(t.unverified||!t.signals)return true;let e=t.signals;return e.text===void 0||e.text>=as?true:(e.fingerprint??0)>=Vt||(e.context??0)>=Vt||(e.neighbor??0)>=Vt}function bs(t,e){let n=0,i=0,o={blend:0,strongest:0};if(e.snippet){i+=40;let r=j(t,st,true);if(o.text=Yt(oe(r),e.snippet,.5),o.text<1){let s=j(t,st);s!==r&&(o.text=Math.max(o.text,Yt(oe(s),e.snippet,.5)));}n+=o.text*40;}if(e.fingerprint&&(i+=20,o.fingerprint=Qn(t,e.fingerprint),n+=o.fingerprint*20),e.prefix||e.suffix){i+=20;let r=0,s=0;if(e.prefix){let a=oe(ce(t,"before"));r+=a?Ce(a,e.prefix):0,s++;}if(e.suffix){let a=oe(ce(t,"after"));r+=a?Ce(a,e.suffix):0,s++;}s>0&&(o.context=r/s,n+=o.context*20);}if(e.neighbor){i+=20;let r=oe(qe(t));o.neighbor=r?Ce(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 ys(t){let e=t[0],n=t.filter(o=>e.final-o.final<=ps&&(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 vs(t){return t.strategy==="scan"?Math.min(t.verification,ue.scan):t.unverified?ue[t.strategy]:ue[t.strategy]*Math.min(1,t.strongest/Jt)}function rt(t,e,n){let i=us(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 Zt(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 at(t){return {xPct:t.xPct,yPct:t.yPct,wPct:t.wPct,hPct:t.hPct}}var Fi=13,xs=26,ji=9,Oi="0 0 0 0.5px rgba(0, 0, 0, 0.12), 0 3px 8px rgba(0, 0, 0, 0.22)",Hi="0 0 0 0.5px rgba(0, 0, 0, 0.12), 0 6px 16px rgba(0, 0, 0, 0.28)",Di={question:"#2563eb",change:"#b45309",bug:"#d01f1f",other:"#5b6778"},ws={light:{bg:"rgba(255, 255, 255, 0.94)",ring:"#ffffff",check:"#636366",slash:"#8e8e93"},dark:{bg:"rgba(44, 44, 46, 0.94)",ring:"#48484a",check:"#c7c7cc",slash:"#aeaeb2"}},Es="0 0 0 0.5px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.14)",ks="0 0 0 0.5px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.18)";function Ss(t,e,n){let i=n.scheme==="dark";if(chunk7LL25BRN_cjs.k(t)){let r=ws[n.scheme];return {bg:r.bg,ring:r.ring,color:t==="wont_fix"?r.slash:r.check,shadow:Es,hoverShadow:ks}}let o=chunk7LL25BRN_cjs.ma(e,n);if(t==="in_progress"){let{row:r}=n.surface,s=`color-mix(in srgb, ${o} 35%, ${r})`;return {bg:`color-mix(in srgb, ${o} ${i?18:14}%, ${r})`,ring:`${o} ${o} ${s} ${s}`,color:i?o:`color-mix(in srgb, ${o} 80%, #000000)`,shadow:Oi,hoverShadow:Hi}}return {bg:i?Di[e]??Di.other??o:o,ring:"#ffffff",color:"#ffffff",shadow:Oi,hoverShadow:Hi}}function $i(t){let e=document.documentElement.clientWidth,n=xs+(chunk7LL25BRN_cjs.ta()?ji:0),i=t.right-Fi;return t.right<=e&&(i=Math.min(i,e-n)),{top:Math.max(0,t.top+window.scrollY-Fi),left:Math.max(0,i)+window.scrollX}}var en=t=>t.width>0||t.height>0;function he(t,e){let n=t.entries[e],i=t.elementIndices[e];if(!(!n||i===void 0))return n.elements[i]}function Bi(t){let e=t.elementIndices[0];return e===void 0?void 0:t.entries[0]?.positions[e]}var zi=t=>t.style.display!=="none";function tn(t,e,n){!chunk7LL25BRN_cjs.va()&&typeof t.animate=="function"&&t.animate(e,n);}var Ki=200,Wi=200,Ts=3e3,Cs=.7,Rs=28,Xi=32,lt=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=chunk7LL25BRN_cjs.E("div",{style:`position:absolute;top:0;left:0;pointer-events:none;z-index:${2147483646};`}),this.container.id="siteping-markers",chunk7LL25BRN_cjs.O(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)chunk7LL25BRN_cjs.k(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:Wi+100}):this.repositionTimer=+setTimeout(()=>{this.repositionTimer=null,this.repositionAll();},Wi));}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 f=`${a.feedback.id}:${l}`;r.add(f);let h=this.anchorCache.get(f),d=h?.ref.deref(),g,v=(this.hiddenRecheckAt.get(f)??0)>i,k=d?.isConnected&&(v||!(e&&Re(d)==="hidden"));if(h&&d&&k){let S=d.getBoundingClientRect(),w=at(p);g={element:d,rect:new DOMRect(S.left+w.xPct*S.width,S.top+w.yPct*S.height,w.wPct*S.width,w.hPct*S.height),confidence:h.confidence,strategy:h.strategy};}else if(v)g=null;else if(o.starved=false,g=rt(Zt(p),at(p),{scanBudget:o}),!o.starved){if(g?.element){let{confidence:S,strategy:w}=g;this.anchorCache.set(f,{ref:new WeakRef(g.element),confidence:S,strategy:w});}!g||Re(g.element)==="hidden"?this.hiddenRecheckAt.set(f,i+Ts):this.hiddenRecheckAt.delete(f);}let H=c.style.display!=="none";if(!g||!en(g.rect)){H&&(s=true),c.style.display="none";continue}H||(s=true),a.positions[l]=$i(g.rect),c.style.display="flex",this.applyConfidenceStyle(c,g.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.bus.emit("markers:placed")),this.applyClusterPositions(),this.pinnedFeedback&&this.showHighlight(this.pinnedFeedback,false);}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((i,o)=>{let r=this.buildEntry(i,o+1);this.entries.push(r);}),this.buildClusters();let n=this.entries.filter(i=>i.elements.some(zi)).length;this.liveRegion&&n>0&&(this.liveRegion.textContent=chunk7LL25BRN_cjs.Aa(this.t,"marker.count",{count:n})),this.emitMarkersChanged(),this.bus.emit("markers:placed");}addFeedback(e,n){let i=this.buildEntry(e,n);for(let o of i.elements)tn(o,[{scale:.9,opacity:0},{scale:1,opacity:1}],{duration:250,easing:chunk7LL25BRN_cjs.z});this.entries.push(i),this.buildClusters(),this.emitMarkersChanged(),this.bus.emit("markers:placed");}buildEntry(e,n){let i={feedback:e,elements:[],positions:[]};for(let o of e.annotations){let r=rt(Zt(o),at(o)),s=r&&en(r.rect)?r:null,a=s?$i(s.rect):{top:0,left:0},l=this.createMarker(n,e,a);s?this.applyConfidenceStyle(l,s.confidence,e):l.style.display="none",this.container.appendChild(l),i.elements.push(l),i.positions.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++){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)<Rs&&(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=Bi(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=he(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=Bi(e);if(!n)return;let{top:i,left:o}=n,r=e.entries.length,s=(r-1)*Xi,a=o-s/2;for(let l=0;l<r;l++){let c=he(e,l);c&&(c.style.top=`${i}px`,c.style.left=`${a+l*Xi}px`,c.style.zIndex=String(10+l));}}addClusterBadge(e){let n=he(e,e.entries.length-1);if(!n)return;let i=chunk7LL25BRN_cjs.E("div",{class:"sp-cluster-badge",style:`position:absolute;top:-6px;right:-6px;min-width:16px;height:16px;padding:0 4px;border-radius:9999px;background:#1d1d1f;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:${chunk7LL25BRN_cjs.qa};line-height:1;`});chunk7LL25BRN_cjs.F(i,String(e.entries.length)),n.appendChild(i);}setBadgesVisible(e,n){for(let i=0;i<e.entries.length;i++){let o=he(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(he(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.glide(i,()=>this.applyFanPositions(i)),this.setBadgesVisible(i,false),true):false}collapseCluster(e){e.expanded&&(e.expanded=false,this.glide(e,()=>this.applyStackPositions(e)),this.setBadgesVisible(e,true));}glide(e,n){let i=e.entries.map((r,s)=>he(e,s)),o=i.map(r=>r&&{top:parseFloat(r.style.top),left:parseFloat(r.style.left)});n(),i.forEach((r,s)=>{let a=o[s];if(!r||!a)return;let l=a.left-parseFloat(r.style.left),c=a.top-parseFloat(r.style.top);(l||c)&&tn(r,[{translate:`${l}px ${c}px`},{translate:"0 0"}],{duration:200,easing:chunk7LL25BRN_cjs.z});});}collapseAllClusters(){for(let e of this.clusters)this.collapseCluster(e);}applyConfidenceStyle(e,n,i){let o=chunk7LL25BRN_cjs.k(i.status);n<Cs&&!o?(e.style.borderStyle="dashed",e.style.opacity="0.7",e.title=chunk7LL25BRN_cjs.Aa(this.t,"marker.approximate",{confidence:Math.round(n*100)})):(e.style.borderStyle="solid",e.style.opacity="1",e.title="");}createMarker(e,n,i){let{status:o}=n,r=Ss(o,n.type,this.colors),s=chunk7LL25BRN_cjs.E("div",{style:`position:absolute;top:${i.top}px;left:${i.left}px;width:26px;height:26px;border-radius:50%;background:${r.bg};border:2px solid;border-color:${r.ring};display:flex;align-items:center;justify-content:center;font-family:${chunk7LL25BRN_cjs.qa};font-size:12px;font-weight:700;letter-spacing:-0.01em;color:${r.color};cursor:pointer;pointer-events:auto;box-shadow:${r.shadow};transition:${chunk7LL25BRN_cjs.va()?"box-shadow 0.15s ease":`transform 0.15s ${chunk7LL25BRN_cjs.z}, box-shadow 0.15s ease`};touch-action:manipulation;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=chunk7LL25BRN_cjs.Aa(this.t,"marker.aria",{number:e,type:chunk7LL25BRN_cjs.Ba(n.type,this.t),status:chunk7LL25BRN_cjs.Ca(o,this.t),message:a});s.setAttribute("aria-label",l),s.setAttribute("aria-describedby",this.tooltip.tooltipId),chunk7LL25BRN_cjs.N(s,this.colors.accent),o==="wont_fix"?s.appendChild(chunk7LL25BRN_cjs.E("span",{style:"width:2px;height:16px;border-radius:1px;background:currentColor;transform:rotate(45deg);"})):chunk7LL25BRN_cjs.F(s,o==="resolved"?"\u2713":String(e)),chunk7LL25BRN_cjs.ta()&&s.appendChild(chunk7LL25BRN_cjs.E("span",{style:`position:absolute;inset:-${ji}px;border-radius:50%;`})),s.addEventListener("mouseenter",()=>{chunk7LL25BRN_cjs.ua()&&(s.style.transform="scale(1.2)",s.style.boxShadow=r.hoverShadow),this.tooltip.show(n,s.getBoundingClientRect()),this.pinnedFeedback||this.showHighlight(n);}),s.addEventListener("mouseleave",()=>{s.style.transform="scale(1)",s.style.boxShadow=r.shadow,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)||(chunk7LL25BRN_cjs.sa()&&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),i=n?.elements.find(zi);return !n||!i?false:(i.scrollIntoView({behavior:chunk7LL25BRN_cjs.va()?"auto":"smooth",block:"center"}),this.pinHighlight(n.feedback),this.highlight(e),true)}revealPin(e){return this.container.style.display!=="none"&&this.focusFeedback(e)}isLost(e){let n=this.entries.filter(i=>i.feedback.id===e);return n.length>0&&n.every(i=>i.elements.every(o=>o.style.display==="none"))}highlight(e){for(let n of this.entries)if(n.feedback.id===e)for(let i of n.elements)tn(i,[{boxShadow:`0 0 0 0 ${this.colors.accentGlow}`},{boxShadow:"0 0 0 8px transparent",offset:.7},{boxShadow:"0 0 0 0 transparent"}],{duration:700,easing:"ease-out"});}showHighlight(e,n=true){this.removeHighlightElements();for(let i of e.annotations){let o=rt(Zt(i),at(i));if(!o||!en(o.rect))continue;let r=chunk7LL25BRN_cjs.ma(e.type,this.colors),s=o.rect,a=chunk7LL25BRN_cjs.E("div",{style:`position:absolute;top:${s.top+window.scrollY}px;left:${s.left+window.scrollX}px;width:${s.width}px;height:${s.height}px;border:2px solid ${r};background:${r}0c;border-radius:12px;pointer-events:none;z-index:-1;opacity:${n?0:1};box-shadow:0 0 16px ${r}20;transition:opacity ${Ki}ms ease;`});this.container.appendChild(a),this.highlightElements.push(a),n&&(a.offsetHeight,a.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(),Ki);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 qi=3e4,ct=class{constructor(e,n){this.store=e;this.projectName=n;}store;projectName;async sendFeedback(e){return nn(await Ui(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(chunk7LL25BRN_cjs.o),screenshotDataUrl:e.screenshotDataUrl??null,screenshotRegion:e.screenshotRegion??null,diagnostics:e.diagnostics??null})}catch(n){if(!chunk7LL25BRN_cjs.n(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(nn),total:o,capabilities:{comments:!!this.store.addComment}}}async resolveFeedback(e,n){let i=await this.store.updateFeedback(e,chunk7LL25BRN_cjs.l(n?"resolved":"open"));return nn(i)}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 chunk7LL25BRN_cjs.c(`${i}: this store keeps no comments`,"SERVER",false);return Yi(await Ui(this.store.addComment(e,n),i))}};function Ui(t,e){return zt(t,qi,()=>new chunk7LL25BRN_cjs.c(`${e}: the store did not answer within ${qi/1e3} s`,"TIMEOUT",true))}function nn(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(As),comments:t.comments?.map(Yi),screenshotUrl:t.screenshotUrl??null,screenshotRegion:t.screenshotRegion??null,diagnostics:t.diagnostics??null}}function Yi({clientId:t,createdAt:e,...n}){return {...n,createdAt:e.toISOString()}}function As(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 Vi="@keyframes sp-fab-in{from{opacity:0;transform:scale(0.9);}}.sp-anim-fab-in{animation:sp-fab-in 0.2s var(--sp-ease-out) backwards;}@keyframes sp-flash-bg{from{background-color:var(--sp-accent-light);}}.sp-anim-flash{animation:sp-flash-bg 0.6s var(--sp-ease-out);}.sp-panel{transform:translateX(110%);transition:transform 0.2s var(--sp-ease-out);}.sp-panel.sp-panel--open{transform:translateX(0);transition:transform 0.3s var(--sp-ease-drawer);}.sp-radial-item{opacity:0;pointer-events:none;transform:translate(0,0) scale(0.9);transition:transform 0.2s var(--sp-ease-out),opacity 0.15s ease,background-color 0.15s ease,border-color 0.15s ease,box-shadow 0.15s ease,color 0.15s ease,scale 0.16s var(--sp-ease-out);}.sp-radial-item:active{scale:0.97;}.sp-radial-item.sp-radial-item--open{opacity:1;pointer-events:auto;transition-delay:calc(var(--sp-i, 0) * 30ms),calc(var(--sp-i, 0) * 30ms),0s,0s,0s,0s,0s;}@keyframes sp-spin{to{transform:rotate(360deg);}}.sp-spinner{width:20px;height:20px;border:2px solid var(--sp-fill-strong);border-top-color:var(--sp-text-secondary);border-radius:50%;animation:sp-spin 0.6s linear infinite;}@media (prefers-reduced-motion: reduce){*,*::before,*::after{animation-duration:0.01ms !important;animation-delay:0s !important;animation-iteration-count:1 !important;transition-property:opacity,color,background-color,border-color,box-shadow,outline-color !important;transition-delay:0s !important;}.sp-spinner{animation-duration:1.2s !important;animation-iteration-count:infinite !important;}}";var Gi=`:host{-webkit-tap-highlight-color:transparent;}.sp-list,.sp-detail-content{overscroll-behavior:contain;}.sp-scrim{display:none;}@media not all and (hover: hover) and (pointer: fine){.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:3px;bottom:3px;}.sp-radial-item svg{width:20px;height:20px;}.sp-radial-label{font-size:14px;padding:8px 14px;}.sp-search,.sp-input{font-size:16px;}.sp-search,.sp-filter-dropdown-btn,.sp-sort-btn,.sp-group-toggle,.sp-mine-toggle,.sp-segmented__btn,.sp-btn-resolve,.sp-btn-delete,.sp-bulk-btn-resolve,.sp-bulk-btn-delete,.sp-thread-foot .sp-btn-primary{height:40px;min-height:40px;}.sp-bulk-btn-deselect{width:40px;height:40px;}.sp-detail-back{width:44px;height:44px;}.sp-detail-actions button,.sp-detail-actions a,.sp-btn-primary,.sp-btn-ghost,.sp-btn-danger{height:44px;}.sp-export-option,.sp-filter-dropdown-option,.sp-sort-option,.sp-group-header{min-height:44px;}.sp-export-btn,.sp-btn-delete-all,.sp-bulk-select-all{min-height:40px;}.sp-panel-close::before{inset:5px;}.sp-card-expand{position:relative;}.sp-card-expand::after{content:"";position:absolute;inset:-8px -10px;}}@media (max-height: 600px){.sp-stats-bar{display:none;}}@media ${chunk7LL25BRN_cjs.y}{.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.2s 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-radius:16px 16px 0 0;background:var(--sp-grouped);-webkit-backdrop-filter:none;backdrop-filter:none;box-shadow:var(--sp-shadow-sheet-up);transform:translateY(105%);}.sp-panel.sp-panel--open{transform:translateY(0);}.sp-panel-header,.sp-detail-header{position:relative;touch-action:none;}.sp-panel-header{padding:24px 8px 6px 20px;}.sp-detail-header{padding:22px 12px 4px 6px;}.sp-panel-header::before,.sp-detail-header::before{content:"";position:absolute;top:6px;left:50%;width:36px;height:5px;margin-left:-18px;border-radius:3px;background:var(--sp-grabber);}.sp-export-btn,.sp-btn-delete-all{width:40px;height:40px;padding:0;justify-content:center;border-radius:50%;background:transparent;}.sp-export-btn svg,.sp-btn-delete-all svg{width:19px;height:19px;}.sp-stats-bar{padding:2px 20px 10px;}.sp-filters{padding:2px 16px 8px;}.sp-stats-bar,.sp-filters{touch-action:pan-x;}.sp-search{height:40px;}.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:8px;right:8px;bottom:calc(8px + env(safe-area-inset-bottom,0px));min-width:0;padding:6px;border-radius:16px;background:var(--sp-row);-webkit-backdrop-filter:none;backdrop-filter:none;box-shadow:var(--sp-shadow-popover);z-index:30;transform-origin:bottom center;}.sp-filter-dropdown-option,.sp-sort-option{min-height:44px;font-size:16px;}.sp-list{padding:8px 16px calc(16px + env(safe-area-inset-bottom,0px));}.sp-bulk-bar{bottom:calc(12px + env(safe-area-inset-bottom,0px));}.sp-detail-section{padding:0 16px;}.sp-detail-content{padding-bottom:calc(20px + 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:22px 20px calc(20px + env(safe-area-inset-bottom,0px));border-radius:16px 16px 0 0;background:var(--sp-grouped);-webkit-backdrop-filter:none;backdrop-filter:none;transform:translateY(100%);}.sp-identity-modal .sp-input{background:var(--sp-row);}.sp-identity-actions button{height:50px;}.sp-identity-actions .sp-btn-primary{flex:2;}}@media (prefers-reduced-transparency: reduce){*{-webkit-backdrop-filter:none !important;backdrop-filter:none !important;}}@media (prefers-contrast: more){.sp-card,.sp-detail-message,.sp-detail-meta,.sp-detail-annotation-info,.sp-detail-diag-toggle{box-shadow:inset 0 0 0 1px var(--sp-separator);}}`;function on(t){let e=t.scheme==="dark";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.scheme};-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;${chunk7LL25BRN_cjs.ra(t)} --sp-ease-out: cubic-bezier(0.23, 1, 0.32, 1);--sp-ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);--sp-ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);--sp-tr: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease, transform 0.16s var(--sp-ease-out);--sp-backdrop: ${e?"rgba(0, 0, 0, 0.45)":"rgba(0, 0, 0, 0.2)"};--sp-identity-overlay: ${e?"rgba(0, 0, 0, 0.5)":"rgba(0, 0, 0, 0.2)"};--sp-scrim: ${e?"rgba(0, 0, 0, 0.55)":"rgba(0, 0, 0, 0.24)"};}*,*::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);}button,[role="button"],[role="tab"],[role="menuitem"],[role="option"]{touch-action:manipulation;-webkit-user-select:none;user-select:none;}:where(.sp-panel-close,.sp-filter-dropdown-btn,.sp-segmented__btn,.sp-btn-resolve,.sp-btn-delete,.sp-btn-delete-all,.sp-btn-danger,.sp-btn-primary,.sp-btn-ghost,.sp-sort-btn,.sp-group-toggle,.sp-mine-toggle,.sp-export-btn,.sp-bulk-btn-resolve,.sp-bulk-btn-delete,.sp-bulk-btn-deselect,.sp-detail-back,.sp-detail-btn-resolve,.sp-detail-btn-reopen,.sp-detail-btn-delete,.sp-detail-btn-custom,.sp-detail-btn-goto,.sp-shortcuts-close):not(:disabled):active{transform:scale(0.97);}.sp-fab{position:fixed;width:54px;height:54px;border-radius:var(--sp-radius-full);background:var(--sp-accent);color:#fff;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:inset 0 1px 0 rgba(255,255,255,0.22),0 8px 24px color-mix(in srgb,var(--sp-accent) 36%,transparent),0 2px 6px rgba(0,0,0,0.12);transition:transform 0.16s var(--sp-ease-out),opacity 0.2s ease,box-shadow 0.2s ease;outline:none;touch-action:manipulation;-webkit-user-select:none;user-select:none;}.sp-fab:focus-visible{outline:2px solid var(--sp-accent);outline-offset:3px;}@media (hover: hover) and (pointer: fine){.sp-fab:hover{box-shadow:inset 0 1px 0 rgba(255,255,255,0.22),0 12px 32px color-mix(in srgb,var(--sp-accent) 46%,transparent),0 3px 8px rgba(0,0,0,0.14);}}.sp-fab:active{transform:scale(0.97);}div:has(> .sp-fab):has(~ .sp-panel.sp-panel--open) > .sp-fab{opacity:0;transform:scale(0.9);pointer-events:none;}.sp-fab--bottom-right{bottom:24px;right:24px;}.sp-fab--bottom-left{bottom:24px;left:24px;}.sp-fab svg{width:23px;height:23px;fill:currentColor;}.sp-fab-badge{position:absolute;top:-3px;right:-3px;min-width:20px;height:20px;padding:0 6px;border-radius:var(--sp-radius-full);background:var(--sp-danger);color:#fff;font:600 11px/1 var(--sp-font);display:flex;align-items:center;justify-content:center;border:2px solid var(--sp-bg);pointer-events:none;}.sp-toast{position:fixed;left:50%;bottom:96px;transform:translateX(-50%);max-width:min(360px,calc(100vw - 32px));padding:11px 18px;border-radius:20px;background:var(--sp-material-thick);-webkit-backdrop-filter:var(--sp-material-blur);backdrop-filter:var(--sp-material-blur);color:var(--sp-text);font:500 14px/1.35 var(--sp-font);letter-spacing:-0.01em;box-shadow:inset 0 0.5px 0 var(--sp-edge),var(--sp-shadow-float);cursor:pointer;animation:sp-toast-in 0.2s var(--sp-ease-out);transition:opacity 0.15s ease;}.sp-toast--leaving{opacity:0;}.sp-toast[hidden]{display:none;}.sp-toast--error::before{content:"";display:inline-block;width:8px;height:8px;margin-right:8px;border-radius:50%;background:var(--sp-type-bug);vertical-align:1px;}@keyframes sp-toast-in{from{opacity:0;transform:translate(-50%,8px);}}.sp-radial{position:fixed;pointer-events:none;width:54px;height:54px;}.sp-radial--bottom-right{bottom:24px;right:24px;}.sp-radial--bottom-left{bottom:24px;left:24px;}.sp-radial-item{position:absolute;left:5px;bottom:5px;width:44px;height:44px;border-radius:var(--sp-radius-full);background:var(--sp-material-thick);-webkit-backdrop-filter:var(--sp-material-blur);backdrop-filter:var(--sp-material-blur);color:var(--sp-text);border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:inset 0 0.5px 0 var(--sp-edge),var(--sp-shadow-float);font-size:12px;font-weight:600;}.sp-radial-item:focus-visible{background:var(--sp-row);color:var(--sp-accent-ink);box-shadow:var(--sp-shadow-float),var(--sp-ring);outline:none;}@media (hover: hover) and (pointer: fine){.sp-radial-item:hover{background:var(--sp-row);color:var(--sp-accent-ink);}}.sp-radial-item svg{width:19px;height:19px;flex-shrink:0;stroke:currentColor;fill:none;}.sp-radial-label{position:absolute;top:50%;white-space:nowrap;font-size:13px;font-weight:500;letter-spacing:-0.01em;color:var(--sp-text);pointer-events:none;opacity:0;padding:6px 12px;border-radius:var(--sp-radius-full);background:var(--sp-material-thick);-webkit-backdrop-filter:var(--sp-material-blur);backdrop-filter:var(--sp-material-blur);box-shadow:inset 0 0.5px 0 var(--sp-edge),var(--sp-shadow-float);transform:translate(4px,-50%);transition:opacity 0.18s ease,transform 0.2s var(--sp-ease-out);}.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:focus-visible .sp-radial-label{opacity:1;transform:translate(0,-50%);}@media (hover: hover) and (pointer: fine){.sp-radial-item:hover .sp-radial-label{opacity:1;transform:translate(0,-50%);}}.sp-panel{position:fixed;top:12px;right:12px;bottom:12px;width:380px;max-width:calc(100vw - 24px);border-radius:var(--sp-radius-xl);background:var(--sp-material);-webkit-backdrop-filter:var(--sp-material-blur);backdrop-filter:var(--sp-material-blur);box-shadow:inset 0 0.5px 0 var(--sp-edge),inset 0 0 0 0.5px var(--sp-sheen-soft),var(--sp-shadow-sheet);display:flex;flex-direction:column;overflow:clip;}.sp-panel-header{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:16px 12px 8px 20px;position:relative;z-index:2;}.sp-panel-title{font-family:var(--sp-font-display);font-size:28px;font-weight:700;line-height:1.15;color:var(--sp-text);letter-spacing:-0.022em;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.sp-panel-close{position:relative;width:44px;height:44px;border-radius:50%;border:none;background:transparent;cursor:pointer;display:flex;align-items:center;justify-content:center;color:var(--sp-text-secondary);transition:var(--sp-tr);}.sp-panel-close::before{content:"";position:absolute;inset:7px;border-radius:50%;background:var(--sp-fill);transition:background-color 0.15s ease;}@media (hover: hover) and (pointer: fine){.sp-panel-close:hover{color:var(--sp-text);}.sp-panel-close:hover::before{background:var(--sp-fill-strong);}}.sp-panel-close svg{position:relative;width:13px;height:13px;stroke-width:2.6;}.sp-filters{padding:2px 16px 10px;position:sticky;top:0;z-index:1;}.sp-search-wrap{position:relative;margin-bottom:10px;}.sp-search{width:100%;height:36px;padding:0 12px 0 34px;border-radius:var(--sp-radius);border:none;background:var(--sp-fill);color:var(--sp-text);font-family:var(--sp-font);font-size:15px;letter-spacing:-0.01em;outline:none;transition:var(--sp-tr);}.sp-search::placeholder{color:var(--sp-text-secondary);}.sp-search:focus{box-shadow:var(--sp-ring);}.sp-search-icon{position:absolute;left:10px;top:50%;transform:translateY(-50%);color:var(--sp-text-secondary);width:16px;height:16px;}.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);display:inline-flex;align-items:center;gap:6px;width:100%;height:32px;padding:0 10px;border-radius:var(--sp-radius-full);border:none;background:var(--sp-fill);color:var(--sp-text);font-family:var(--sp-font);font-size:13px;font-weight:500;cursor:pointer;white-space:nowrap;transition:var(--sp-tr);}@media (hover: hover) and (pointer: fine){.sp-filter-dropdown-btn:hover{background:var(--sp-fill-strong);}}.sp-filter-dropdown-btn[aria-expanded="true"]{background:var(--sp-fill-strong);}.sp-filter-dropdown-btn--filtered,.sp-filter-dropdown-btn--filtered[aria-expanded="true"]{background:color-mix(in srgb,var(--sp-chip-color) 14%,transparent);}.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-secondary);font-weight:500;font-size:11px;text-transform:uppercase;letter-spacing:0.04em;}.sp-filter-dropdown-btn__value{color:var(--sp-text);font-weight:600;overflow:hidden;text-overflow:ellipsis;}.sp-filter-dropdown-btn--filtered .sp-filter-dropdown-btn__value{color:color-mix(in srgb,var(--sp-chip-color) var(--sp-ink-pct),var(--sp-ink-mix));}.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-secondary);transition:transform 0.2s var(--sp-ease-out);}.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);}.sp-filter-dropdown-menu{position:absolute;top:calc(100% + 6px);left:0;right:0;min-width:180px;padding:6px;border-radius:var(--sp-radius-lg);background:var(--sp-material-thick);-webkit-backdrop-filter:var(--sp-material-blur);backdrop-filter:var(--sp-material-blur);box-shadow:inset 0 0.5px 0 var(--sp-edge),var(--sp-shadow-float);z-index:10;transform-origin:top left;animation:sp-menu-in 0.15s var(--sp-ease-out) backwards;}@keyframes sp-menu-in{from{opacity:0;transform:scale(0.96);}}.sp-filter-dropdown-option{--sp-chip-color: var(--sp-text-secondary);display:flex;align-items:center;gap:10px;width:100%;min-height:34px;padding:7px 10px;border:none;border-radius:8px;background:transparent;color:var(--sp-text);font-family:var(--sp-font);font-size:13px;font-weight:400;letter-spacing:-0.005em;cursor:pointer;text-align:left;transition:background-color 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:color-mix(in srgb,var(--sp-chip-color) 14%,transparent);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-accent-ink);}.sp-filter-dropdown-option__check svg{width:13px;height:13px;}@media (hover: hover) and (pointer: fine){.sp-filter-dropdown-option:hover{background:var(--sp-fill);}}.sp-filter-dropdown-option--active{font-weight:600;}.sp-segmented{display:inline-flex;align-items:stretch;padding:2px;border-radius:9px;background:var(--sp-fill);flex-shrink:0;}.sp-segmented__btn{--sp-chip-color: var(--sp-text-tertiary);display:inline-flex;align-items:center;gap:5px;height:28px;padding:0 10px;border:none;border-radius:7px;background:transparent;color:var(--sp-text);font-family:var(--sp-font);font-size:13px;font-weight:500;letter-spacing:-0.01em;cursor:pointer;white-space:nowrap;transition:var(--sp-tr);}.sp-segmented__icon{display:inline-flex;align-items:center;justify-content:center;width:13px;height:13px;flex-shrink:0;color:var(--sp-chip-color);}.sp-segmented__icon svg{width:13px;height:13px;}@media (hover: hover) and (pointer: fine){.sp-segmented__btn:not(.sp-segmented__btn--active):hover{background:var(--sp-sheen);}}.sp-segmented__btn--active{background:var(--sp-thumb);font-weight:600;box-shadow:var(--sp-shadow-thumb);}.sp-list{flex:1;overflow-y:auto;padding:8px 16px 16px;-webkit-mask-image:linear-gradient(to bottom,transparent,#000 8px);mask-image:linear-gradient(to bottom,transparent,#000 8px);}.sp-list::-webkit-scrollbar{width:6px;}.sp-list::-webkit-scrollbar-track{background:transparent;}.sp-list::-webkit-scrollbar-thumb{background:var(--sp-fill-strong);border-radius:var(--sp-radius-full);}@media (hover: hover) and (pointer: fine){.sp-list::-webkit-scrollbar-thumb:hover{background:var(--sp-text-tertiary);}}.sp-card{position:relative;display:flex;padding:12px 14px 12px 12px;margin-bottom:8px;cursor:pointer;border-radius:var(--sp-radius-lg);background:var(--sp-row);box-shadow:var(--sp-shadow-row);transition:var(--sp-tr);}@media (hover: hover) and (pointer: fine){.sp-card:hover{background:var(--sp-row-hover);box-shadow:var(--sp-shadow-row-hover);}}.sp-card:active{transform:scale(0.985);}.sp-card-bar{align-self:flex-start;width:8px;height:8px;margin:6px 10px 0 2px;border-radius:50%;flex-shrink:0;transition:opacity 0.15s ease;}.sp-card-body{flex:1;min-width:0;}.sp-card-header{display:flex;flex-wrap:wrap;align-items:center;gap:4px 6px;margin-bottom:4px;}.sp-card-number{font-size:13px;font-weight:600;letter-spacing:-0.01em;color:var(--sp-text);font-variant-numeric:tabular-nums;}.sp-badge{white-space:nowrap;padding:2px 8px;border-radius:var(--sp-radius-full);font-size:11px;font-weight:600;line-height:16px;letter-spacing:0.01em;background:color-mix(in srgb,currentColor 13%,transparent) !important;-webkit-text-fill-color:color-mix(in srgb,currentColor var(--sp-ink-pct-badge),var(--sp-ink-mix));}.sp-card-date{font-size:12px;color:var(--sp-text-tertiary);margin-left:auto;white-space:nowrap;font-variant-numeric:tabular-nums;}.sp-lost{font-size:12px;color:var(--sp-text-tertiary);margin-top:4px;}.sp-card-message{font-size:14px;line-height:1.43;letter-spacing:-0.006em;color:var(--sp-text);overflow-wrap:anywhere;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:13px;font-weight:500;color:var(--sp-accent-ink);cursor:pointer;background:none;border:none;padding:4px 0;font-family:var(--sp-font);transition:opacity 0.15s ease;}@media (hover: hover) and (pointer: fine){.sp-card-expand:hover{opacity:0.8;}}.sp-card-footer{display:flex;align-items:center;justify-content:flex-end;gap:2px;margin-top:6px;margin-right:-6px;}.sp-btn-resolve,.sp-btn-delete{height:30px;padding:0 10px;border-radius:8px;border:none;background:transparent;font-family:var(--sp-font);font-size:13px;font-weight:500;cursor:pointer;display:flex;align-items:center;gap:5px;transition:var(--sp-tr);}.sp-btn-resolve svg,.sp-btn-delete svg{width:14px;height:14px;}.sp-btn-resolve{color:var(--sp-ink-green);}.sp-card--resolved .sp-btn-resolve{color:var(--sp-accent-ink);}.sp-btn-delete{color:var(--sp-ink-red);}@media (hover: hover) and (pointer: fine){.sp-btn-resolve:hover{background:color-mix(in srgb,var(--sp-status-open) 10%,transparent);}.sp-card--resolved .sp-btn-resolve:hover{background:color-mix(in srgb,var(--sp-accent) 10%,transparent);}.sp-btn-delete:hover{background:color-mix(in srgb,var(--sp-type-bug) 10%,transparent);}}.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;flex-shrink:0;align-items:center;gap:2px;}.sp-btn-delete-all{width:32px;height:32px;padding:0;justify-content:center;border-radius:50%;border:none;background:transparent;color:var(--sp-ink-red);font-family:var(--sp-font);font-size:13px;font-weight:500;white-space:nowrap;cursor:pointer;display:flex;align-items:center;transition:var(--sp-tr);}.sp-btn-delete-all svg{width:17px;height:17px;}.sp-btn-delete-all span,.sp-export-btn span{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;}@media (hover: hover) and (pointer: fine){.sp-btn-delete-all:hover{background:color-mix(in srgb,var(--sp-type-bug) 10%,transparent);}}.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);display:flex;align-items:center;justify-content:center;z-index:${2147483647};opacity:0;transition:opacity 0.2s ease;}.sp-confirm-dialog,.sp-identity-modal{border-radius:var(--sp-radius-xl);background:var(--sp-material-thick);-webkit-backdrop-filter:var(--sp-material-blur);backdrop-filter:var(--sp-material-blur);box-shadow:inset 0 0.5px 0 var(--sp-edge),var(--sp-shadow-sheet);}.sp-confirm-dialog{width:min(300px,calc(100vw - 32px));padding:22px 16px 16px;text-align:center;transform:translateY(8px) scale(0.97);transition:transform 0.2s var(--sp-ease-out);}.sp-confirm-title{font-size:17px;font-weight:600;color:var(--sp-text);letter-spacing:-0.022em;margin-bottom:4px;}.sp-confirm-message{font-size:13px;color:var(--sp-text-secondary);line-height:1.4;margin-bottom:18px;}.sp-confirm-actions{display:flex;gap:8px;justify-content:flex-end;}.sp-confirm-actions > button,.sp-identity-actions > button{flex:1 1 0;height:44px;}.sp-card--resolved .sp-card-number,.sp-card--resolved .sp-card-message{color:var(--sp-text-secondary);}.sp-card--resolved .sp-card-message{text-decoration:line-through;text-decoration-color:color-mix(in srgb,var(--sp-text-secondary) 60%,transparent);}.sp-loading{display:flex;align-items:center;justify-content:center;padding:56px 24px;}.sp-identity-backdrop{position:fixed;inset:0;background:var(--sp-identity-overlay);display:flex;align-items:center;justify-content:center;z-index:${2147483647};opacity:0;transition:opacity 0.2s ease;}.sp-identity-modal{width:340px;max-width:calc(100vw - 32px);padding:24px 20px 18px;color:var(--sp-text);transform:translateY(12px) scale(0.97);transition:transform 0.2s var(--sp-ease-out);}.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-family:var(--sp-font-display);font-size:20px;font-weight:700;color:var(--sp-text);letter-spacing:-0.022em;}.sp-input{width:100%;height:40px;padding:0 12px;border-radius:var(--sp-radius);border:none;background:var(--sp-fill);color:var(--sp-text);font-family:var(--sp-font);font-size:15px;letter-spacing:-0.01em;outline:none;transition:var(--sp-tr);}.sp-input::placeholder{color:var(--sp-text-secondary);}.sp-input:focus{background:var(--sp-row);box-shadow:var(--sp-ring);}.sp-input-label{font-size:12px;font-weight:500;letter-spacing:0.02em;color:var(--sp-text-secondary);margin:0 0 6px 4px;display:block;}.sp-btn-primary,.sp-btn-ghost,.sp-btn-danger{height:40px;padding:0 18px;border-radius:12px;border:none;color:#fff;font-family:var(--sp-font);font-size:15px;font-weight:600;letter-spacing:-0.01em;cursor:pointer;transition:var(--sp-tr);}.sp-btn-primary{background:var(--sp-accent);}.sp-btn-ghost{background:var(--sp-fill);color:var(--sp-text);font-weight:500;}.sp-btn-danger{background:var(--sp-danger);}@media (hover: hover) and (pointer: fine){.sp-btn-primary:hover{background:var(--sp-accent-dark);}.sp-btn-ghost:hover{background:var(--sp-fill-strong);}.sp-btn-danger:hover{background:var(--sp-danger-press);}}.sp-btn-primary:disabled{opacity:0.4;cursor:not-allowed;transform:none;}.sp-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:56px 24px;color:var(--sp-text-secondary);text-align:center;gap:8px;}.sp-empty-text{font-size:15px;font-weight:500;letter-spacing:-0.01em;}.sp-load-more-wrap{display:flex;justify-content:center;padding:4px 0 0;}.sp-btn-ghost.sp-btn-load-more{width:100%;height:44px;border-radius:var(--sp-radius-lg);background:var(--sp-row);color:var(--sp-accent-ink);box-shadow:var(--sp-shadow-row);}@media (hover: hover) and (pointer: fine){.sp-btn-ghost.sp-btn-load-more:hover{background:var(--sp-row-hover);}}@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;}}${Vi} ${chunk7LL25BRN_cjs.Pa} ${chunk7LL25BRN_cjs.Oa} ${chunk7LL25BRN_cjs.Fa} ${chunk7LL25BRN_cjs.Da} ${chunk7LL25BRN_cjs.Ta} ${chunk7LL25BRN_cjs.Ia} ${Gi}`}var Ps=120,Ms=80,sn=150,Is=300,Qi=`opacity ${sn}ms ease, transform ${sn}ms ${chunk7LL25BRN_cjs.z}`,Ji="scale(0.97)",Zi=10,eo="blur(30px) saturate(180%)",pt=class{constructor(e,n="en"){this.colors=e;this.locale=n;this.root=chunk7LL25BRN_cjs.E("div",{style:`position:fixed;z-index:${2147483647};max-width:280px;padding:10px 14px 12px;border:none;border-radius:14px;backdrop-filter:${eo};-webkit-backdrop-filter:${eo};font-family:${chunk7LL25BRN_cjs.qa};pointer-events:auto;opacity:0;transform:${Ji};transition:${Qi};visibility:hidden;-webkit-font-smoothing:antialiased;`}),this.root.setAttribute("role","tooltip"),this.root.id=this.tooltipId,this.restyle(),this.root.addEventListener("mouseenter",()=>this.cancelHide()),this.root.addEventListener("mouseleave",()=>this.scheduleHide()),chunk7LL25BRN_cjs.O(this.root),document.body.appendChild(this.root);}colors;locale;root;showTimer=null;hideTimer=null;currentFeedbackId=null;closedAt=0;tooltipId="sp-tooltip";restyle(){let{surface:e}=this.colors,{style:n}=this.root;n.background=e.material,n.boxShadow=`inset 0 0.5px 0 ${e.edge}, ${e.shadowCard}`;}show(e,n){if(this.cancelHide(),this.currentFeedbackId===e.id)return;this.cancelShow();let i=this.root.style.visibility==="visible"||Date.now()-this.closedAt<Is;this.showTimer=setTimeout(()=>{this.currentFeedbackId=e.id,this.render(e),this.position(n);let o=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;this.root.style.transition=o||i?"none":Qi,this.root.style.visibility="visible",this.root.style.opacity="1",this.root.style.transform="none";},i?0:Ps);}scheduleHide(){this.cancelHide(),this.hideTimer=setTimeout(()=>this.hide(),Ms);}hide(){this.cancelShow(),this.currentFeedbackId&&(this.closedAt=Date.now()),this.currentFeedbackId=null,this.root.style.opacity="0",this.root.style.transform=Ji,setTimeout(()=>{this.currentFeedbackId||(this.root.style.visibility="hidden");},sn);}cancelShow(){this.showTimer&&(clearTimeout(this.showTimer),this.showTimer=null);}cancelHide(){this.hideTimer&&(clearTimeout(this.hideTimer),this.hideTimer=null);}render(e){let n=chunk7LL25BRN_cjs.za(this.locale),{inkMix:i}=this.colors.surface,o=chunk7LL25BRN_cjs.E("div",{style:"display:flex;flex-wrap:wrap;align-items:center;gap:6px 8px;margin-bottom:8px;"}),r=(l,c)=>{let p=chunk7LL25BRN_cjs.E("span",{style:`padding:2px 8px;border-radius:9999px;font-size:11px;font-weight:600;white-space:nowrap;color:color-mix(in srgb,${c} 74%,${i});background:color-mix(in srgb,${c} 13%,transparent);letter-spacing:0.01em;`});return chunk7LL25BRN_cjs.F(p,l),p},s=chunk7LL25BRN_cjs.E("span",{style:`font-size:12px;color:${this.colors.textSecondary};margin-left:auto;white-space:nowrap;font-variant-numeric:tabular-nums;`});chunk7LL25BRN_cjs.F(s,chunk7LL25BRN_cjs.L(e.createdAt,this.locale)),o.appendChild(r(chunk7LL25BRN_cjs.Ba(e.type,n),chunk7LL25BRN_cjs.ma(e.type,this.colors))),o.appendChild(r(chunk7LL25BRN_cjs.Ca(e.status,n),chunk7LL25BRN_cjs.na(e.status,this.colors))),o.appendChild(s);let a=chunk7LL25BRN_cjs.E("div",{style:`font-size:14px;line-height:1.43;letter-spacing:-0.006em;color:${this.colors.text};display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere;`});chunk7LL25BRN_cjs.F(a,e.message),this.root.replaceChildren(o,a);}position(e){let n=this.root.getBoundingClientRect(),i=e.top-n.height-Zi,o=e.left+e.width/2-n.width/2,r=true;i<8&&(i=e.bottom+Zi,r=false),o=Math.max(8,Math.min(o,window.innerWidth-n.width-8)),this.root.style.top=`${i}px`,this.root.style.left=`${o}px`;let s=Math.max(22,Math.min(e.left+e.width/2-o,n.width-16));this.root.style.transformOrigin=`${s}px ${r?"100%":"0"}`;}contains(e){return this.root.contains(e)}destroy(){this.cancelShow(),this.cancelHide(),this.root.remove();}};var dt=null;function Ls(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 Ae(){let t=()=>{};return {destroy:t,open:t,close:t,refresh:()=>Promise.resolve(),focusFeedback:()=>false,on:()=>t,off:t}}function to(){try{return process.env.NODE_ENV}catch{return}}function _s(){let t=location.hostname;return t===""||t==="localhost"||t.endsWith(".localhost")||t==="127.0.0.1"||t==="[::1]"}function Ns(t){return t===void 0||t===false?{enabled:false,param:"siteping"}:t===true?{enabled:true,param:"siteping"}:{enabled:true,param:t.param??"siteping"}}function no(t){if(typeof window>"u"||typeof document>"u")return t.onSkip?.("ssr"),Ae();let e=t.debug?(...u)=>console.debug("[siteping]",...u):()=>{};if(dt)return e("initSiteping() called more than once \u2014 returning existing instance"),dt();let n=to();if(!t.forceShow&&(n==="production"||n===void 0&&!_s()))return t.onSkip?.("production"),Ae();let i=typeof t.minViewportWidth=="number"&&Number.isFinite(t.minViewportWidth)?t.minViewportWidth:0;if(!t.forceShow&&window.innerWidth<i){let u="mobile";return t.onSkip?.(u),Ae()}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."),Ae();if(!t.projectName||typeof t.projectName!="string")return console.error("[siteping] Missing or invalid 'projectName' in config. Expected a non-empty string."),Ae();let o=chunk7LL25BRN_cjs.g(t.locale??"en"),r=o==="en"?Promise.resolve():chunk7LL25BRN_cjs.ya(o).catch(()=>{}),s=chunk7LL25BRN_cjs.za(o),a=t.scopeAnnotationsByUrl??true,l=()=>{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:o,scopeAnnotationsByUrl:a});let c=Ls(t.captureDiagnostics),p=c.console?new et(c.maxConsoleEntries):null,f=c.network?new tt(c.maxNetworkEntries):null,h=chunk7LL25BRN_cjs.la(t.accentColor,t.theme),d=new Te,g=new Set,v=(u,...m)=>{for(let y of g)y.emit(u,...m);},k=(()=>{if(t.store)return new ct(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 Je(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 H=Ge(t.projectName,t.endpoint);d.on("feedback:sent",u=>H.add(u.id)),d.on("feedback:deleted",u=>H.remove(u)),d.on("feedback:all-deleted",()=>H.clear());let S={"feedback:sent":()=>d.on("feedback:sent",u=>v("feedback:sent",u)),"feedback:deleted":()=>d.on("feedback:deleted",u=>v("feedback:deleted",u)),"comment:added":()=>d.on("comment:added",u=>v("comment:added",u)),"feedback:error":()=>d.on("feedback:error",u=>v("feedback:error",u)),"panel:open":()=>d.on("open",()=>v("panel:open")),"panel:close":()=>d.on("close",()=>v("panel:close")),"annotation:start":()=>d.on("annotation:start",()=>v("annotation:start")),"annotation:end":()=>d.on("annotation:end",()=>v("annotation:end"))};for(let u of Object.values(S))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 w=document.createElement("siteping-widget");w.style.cssText=`position:fixed;z-index:${2147483647};pointer-events:auto;`;let D=to()==="test"?"open":"closed",P=w.attachShadow({mode:D}),$;if("adoptedStyleSheets"in ShadowRoot.prototype){let u=new CSSStyleSheet;P.adoptedStyleSheets=[u],$=()=>u.replaceSync(on(h));}else {let u=document.createElement("style");P.appendChild(u),$=()=>{u.textContent=on(h);};}$(),chunk7LL25BRN_cjs.O(w,P);let an=chunk7LL25BRN_cjs.S();document.body.appendChild(w);let Pe=chunk7LL25BRN_cjs.C(w),I=document.createElement("div");I.setAttribute("role","status"),I.setAttribute("aria-live","polite"),I.setAttribute("aria-atomic","true"),I.setAttribute("data-siteping-ignore","true"),I.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;",chunk7LL25BRN_cjs.O(I),document.body.appendChild(I);let b=document.createElement("div");b.className="sp-toast",b.setAttribute("aria-hidden","true"),b.hidden=true;let T,B=()=>{clearTimeout(T),!b.hidden&&(b.classList.add("sp-toast--leaving"),T=setTimeout(()=>{b.hidden=true,b.classList.remove("sp-toast--leaving");},150));};b.addEventListener("click",B),P.appendChild(b);let z=(u,m)=>{I.textContent=u,b.textContent=u,b.classList.toggle("sp-toast--error",m),b.classList.remove("sp-toast--leaving"),b.hidden=false,clearTimeout(T),T=setTimeout(B,m?8e3:4e3);},q=new pt(h,o),U=new lt(h,q,d,s,I),ut=new nt(P,t,d,s);d.on("markers:changed",u=>ut.updateBadge(u));let M=null,ht=null,K=false,Me=0;async function ln(u=false){let m=t.identity??Ut();if(m)return m;let y=await Fs(P,s,u);return y&&Ci(y),y}async function ft(){return K?null:M||(ht||(ht=import('./panel-E5DL4OG4.cjs').then(u=>K?null:(M=new u.Panel(P,h,d,k,t.projectName,U,s,o,{getScope:l,scopeAnnotationsByUrl:a,panelActions:t.panelActions,ownFeedback:H,resolveIdentity:ln,readOnly:t.readOnly}),M))),ht)}if(typeof window<"u"){let u=()=>{K||ft();},m=window.requestIdleCallback;typeof m=="function"?m(u):setTimeout(u,200);}let se=false,io=d.on("panel:toggle",u=>{M||(u?(se=true,ft().then(m=>{m&&se&&m.open(),se=false;}).catch(m=>e("Failed to lazy-load panel:",m))):se=false);}),fe=new Ve(h,d,s,t.enableScreenshot??false,()=>Pe.getLastPageFocus()),Ie=null;t.enableRightClickComment&&(Ie=u=>{if(u.defaultPrevented)return;let m=u.pointerType;m===""||m===void 0&&u.button!==2||u.shiftKey||u.ctrlKey||u.altKey||u.metaKey||u.composedPath().some(E=>E===w||E instanceof Element&&(E.hasAttribute("data-siteping-ignore")||E.id==="siteping-markers"))||fe.isBusy||(u.preventDefault(),fe.startInstantAnnotation(u.clientX,u.clientY).catch(E=>e("right-click annotation failed",E)));},document.addEventListener("contextmenu",Ie)),o!=="en"&&r.then(()=>{K||(ut.refreshLabels(),fe.refreshLabels());});let mt=false,oo=d.on("annotation:complete",async u=>{if(mt){d.emit("submission:cancelled");return}mt=true;try{let{annotation:m,type:y,message:E,clientId:L,screenshotDataUrl:re,screenshotRegion:Le}=u,A=await ln(!0);if(!A){d.emit("submission:cancelled");return}let ge=l(),un=null;(p||f)&&(un={console:p?.getEntries()??[],network:f?.getEntries()??[]});let lo={projectName:t.projectName,type:y,message:E,url:ge.url,urlPattern:ge.urlPattern,viewport:`${window.innerWidth}x${window.innerHeight}`,userAgent:navigator.userAgent,authorName:A.name,authorEmail:A.email,annotations:[m],clientId:L,screenshotDataUrl:re??null,screenshotRegion:Le??null,diagnostics:un};try{let Y=await k.sendFeedback(lo);d.emit("feedback:sent",Y),(!a||Y.url===ge.url)&&U.addFeedback(Y,U.count+1),z(s("feedback.sent.confirmation"),!1),M&&await M.refresh();}catch(Y){let vt=Ei(Y);vt&&d.emit("feedback:queued"),d.emit("feedback:error",Y instanceof Error?Y:new Error(String(Y))),z(s(vt?"feedback.queued":"feedback.error.message"),!vt);}}finally{mt=false;}}),gt=l(),so=a?{limit:20,url:gt.url}:{limit:20},bt=Ns(t.deepLink),ro=++Me;Promise.all([k.getFeedbacks(t.projectName,so),r]).then(([{feedbacks:u}])=>{if(K||Me!==ro)return;let m=a?u.filter(y=>y.url===gt.url):u;if(U.render(m),bt.enabled)try{let y=new URLSearchParams(window.location.search).get(bt.param);if(y){let E=U.focusFeedback(y);e(`deepLink ?${bt.param}=${y} ${E?"focused":"did not match a visible feedback"}`),E&&ft().then(async L=>{!L||K||(await L.open(),L.showFeedback(y));}).catch(L=>e("deepLink could not open the feedback:",L));}}catch(y){e("deepLink parsing failed:",y);}}).catch(u=>{e("Failed to load initial markers:",u);}),t.endpoint&&ki(t.endpoint,t.identity??Ut(),{apiKey:t.apiKey,headers:t.headers}).then(()=>e("Retry queue flushed")).catch(()=>{});let yt=()=>{let u=++Me;if(M?.isCurrentlyOpen)return M.refresh();let m=l(),y=a?{limit:20,url:m.url}:{limit:20};return k.getFeedbacks(t.projectName,y).then(({feedbacks:E})=>{if(K||u!==Me||M?.isCurrentlyOpen)return;let L=a?E.filter(re=>re.url===m.url):E;U.render(L);})},ao=t.theme==="auto"?chunk7LL25BRN_cjs.ka(()=>{Object.assign(h,chunk7LL25BRN_cjs.la(t.accentColor,"auto")),$(),q.restyle(),fe.restyle(),yt().catch(()=>{});}):void 0,cn=null;if(t.watchNavigation!==false&&typeof window<"u"&&typeof history<"u"){let u=A=>`${A.url}
|
|
3
|
+
${A.urlPattern??""}`,m=u(gt),y=()=>{if(K)return;let A=u(l());if(A===m)return;let ge=m;m=A,e("SPA navigation detected \u2014 refreshing feedbacks for new scope"),yt().catch(()=>{m===A&&(m=ge);});},E=history.pushState,L=history.replaceState,re=function(...A){E.apply(this,A),y();},Le=function(...A){L.apply(this,A),y();};history.pushState=re,history.replaceState=Le,window.addEventListener("popstate",y),window.addEventListener("hashchange",y),cn=()=>{window.removeEventListener("popstate",y),window.removeEventListener("hashchange",y),history.pushState===re&&(history.pushState=E),history.replaceState===Le&&(history.replaceState=L);};}let me={destroy:()=>{e("Destroying widget"),Ie&&document.removeEventListener("contextmenu",Ie),K=true,se=false,cn?.(),ao?.(),Pe.destroy(),oo(),io(),ut.destroy(),M?.destroy(),fe.destroy(),U.destroy(),q.destroy(),p?.dispose(),f?.dispose(),d.removeAll(),clearTimeout(T),I.remove(),w.remove(),an(),dt=null;},open:()=>{d.emit("panel:toggle",true);},close:()=>{M?M.close():se=false;},focusFeedback:u=>U.focusFeedback(u),refresh:()=>yt().catch(()=>{})},pn=0,dn=()=>{let u=new Te,m=true;return pn++,g.add(u),{destroy:()=>{m&&(m=false,g.delete(u),--pn===0&&me.destroy());},open:()=>{m&&me.open();},close:()=>{m&&me.close();},refresh:()=>m?me.refresh():Promise.resolve(),focusFeedback:y=>m&&me.focusFeedback(y),on:(y,E)=>u.on(y,E),off:(y,E)=>{u.off(y,E);}}};return dt=dn,dn()}function Fs(t,e,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=document.createElement("div");a.className="sp-identity-modal";let l=`sp-identity-title-${Date.now()}`;a.setAttribute("role","dialog"),a.setAttribute("aria-modal","true"),a.setAttribute("aria-labelledby",l);let c=document.createElement("div");c.className="sp-identity-title",c.id=l,c.textContent=e("identity.title"),c.style.marginBottom="20px";let p=`sp-identity-name-${Date.now()}`,f=`sp-identity-email-${Date.now()}`,h=document.createElement("label");h.className="sp-input-label",h.textContent=e("identity.nameLabel"),h.setAttribute("for",p);let d=document.createElement("input");d.className="sp-input",d.id=p,d.type="text",d.maxLength=chunk7LL25BRN_cjs.h,d.placeholder=e("identity.namePlaceholder"),d.style.marginBottom="14px";let g=document.createElement("label");g.className="sp-input-label",g.textContent=e("identity.emailLabel"),g.setAttribute("for",f);let v=document.createElement("input");v.className="sp-input",v.id=f,v.type="email",v.maxLength=chunk7LL25BRN_cjs.h,v.placeholder=e("identity.emailPlaceholder");let k=document.createElement("div");k.className="sp-identity-actions";let H=chunk7LL25BRN_cjs.wa(b=>a.style.setProperty("--sp-kb",`${b}px`)),S=b=>{Pe(),I(),H(),s.classList.remove("sp-identity--open"),setTimeout(()=>{s.remove(),o?.focus(),i(b);},200);},w=document.createElement("button");w.className="sp-btn-ghost",w.textContent=e("identity.cancel"),w.addEventListener("click",()=>S(null));let D=document.createElement("button");D.className="sp-btn-primary",D.textContent=e("identity.submit");let P=(b,T)=>{b.style.borderColor=T?"var(--sp-type-bug, #ef4444)":"",T?b.setAttribute("aria-invalid","true"):b.removeAttribute("aria-invalid");};D.addEventListener("click",()=>{let b=d.value.trim(),T=v.value.trim();if(!b||!T)return;let B=b.length>chunk7LL25BRN_cjs.h,z=T.length>chunk7LL25BRN_cjs.h||!chunk7LL25BRN_cjs.a(T);P(d,B),P(v,z),!(B||z)&&S({name:b,email:T});});let $='input, button, [tabindex]:not([tabindex="-1"])',Pe=chunk7LL25BRN_cjs.R(s,b=>{if(b.key==="Escape"){b.stopPropagation(),S(null);return}if(b.key==="Tab"){let T=Array.from(a.querySelectorAll($));if(T.length===0)return;let B=T[0],z=T[T.length-1];if(!B||!z)return;let q=t.activeElement;b.shiftKey?(q===B||!a.contains(q))&&(b.preventDefault(),z.focus()):(q===z||!a.contains(q))&&(b.preventDefault(),B.focus());}}),I=chunk7LL25BRN_cjs.Q(s,()=>true);s.addEventListener("click",b=>{b.target===s&&S(null);}),k.appendChild(w),k.appendChild(D),a.appendChild(c),a.appendChild(h),a.appendChild(d),a.appendChild(g),a.appendChild(v),a.appendChild(k),s.appendChild(a),t.appendChild(s),s.offsetHeight,s.classList.add("sp-identity--open"),d.focus();})}function za(t){return no(t)}Object.defineProperty(exports,"isSitepingError",{enumerable:true,get:function(){return chunk7LL25BRN_cjs.f}});Object.defineProperty(exports,"loadLocale",{enumerable:true,get:function(){return chunk7LL25BRN_cjs.ya}});Object.defineProperty(exports,"registerLocale",{enumerable:true,get:function(){return chunk7LL25BRN_cjs.xa}});exports.initSiteping=za;//# sourceMappingURL=index.cjs.map
|
|
4
4
|
//# sourceMappingURL=index.cjs.map
|