@siteping/widget 0.11.0 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{chunk-CX5YE4V3.js → chunk-26577FDQ.js} +3 -3
- package/dist/chunk-26577FDQ.js.map +1 -0
- package/dist/{chunk-CVWZCWBQ.js → chunk-3EHIWTJH.js} +3 -3
- package/dist/chunk-3EHIWTJH.js.map +1 -0
- package/dist/{chunk-QW2L5ARZ.cjs → chunk-6MCFOKVG.cjs} +3 -3
- package/dist/chunk-6MCFOKVG.cjs.map +1 -0
- package/dist/{chunk-KCOX2NRI.cjs → chunk-Q34GDCKE.cjs} +3 -3
- package/dist/chunk-Q34GDCKE.cjs.map +1 -0
- package/dist/index.cjs +3 -3
- package/dist/index.global.js +2 -2
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/ko-U2CS6XQ4.js +2 -0
- package/dist/ko-U2CS6XQ4.js.map +1 -0
- package/dist/ko-ZUL567LW.cjs +2 -0
- package/dist/ko-ZUL567LW.cjs.map +1 -0
- package/dist/{panel-HGYK7HVK.cjs → panel-3BEMZFIR.cjs} +2 -2
- package/dist/{panel-HGYK7HVK.cjs.map → panel-3BEMZFIR.cjs.map} +1 -1
- package/dist/{panel-RE2IHZ4S.js → panel-HPDIAYLQ.js} +2 -2
- package/dist/{panel-RE2IHZ4S.js.map → panel-HPDIAYLQ.js.map} +1 -1
- package/dist/{panel-RHSIY6KS.cjs → panel-MIWFGD7X.cjs} +2 -2
- package/dist/{panel-RHSIY6KS.cjs.map → panel-MIWFGD7X.cjs.map} +1 -1
- package/dist/{panel-XVIF2WMU.js → panel-XTNU6XHV.js} +2 -2
- package/dist/{panel-XVIF2WMU.js.map → panel-XTNU6XHV.js.map} +1 -1
- package/dist/react.cjs +3 -3
- package/dist/react.js +2 -2
- package/dist/types.d.cts +2 -2
- package/dist/types.d.ts +2 -2
- package/package.json +3 -3
- package/dist/chunk-CVWZCWBQ.js.map +0 -1
- package/dist/chunk-CX5YE4V3.js.map +0 -1
- package/dist/chunk-KCOX2NRI.cjs.map +0 -1
- package/dist/chunk-QW2L5ARZ.cjs.map +0 -1
package/dist/react.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var chunkKCOX2NRI_cjs=require('./chunk-KCOX2NRI.cjs'),react=require('react');var Ai=new Set(["role","name","aria-label","rel","href"]);function Pi(t,e){let n=Ai.has(t);n||=t.startsWith("data-")&&ce(t);let i=ce(e)&&e.length<100;return i||=e.startsWith("#")&&ce(e.slice(1)),n&&i}function Mi(t){return ce(t)}function Ii(t){return ce(t)}function Li(t){return true}function at(t,e){if(t.nodeType!==Node.ELEMENT_NODE)throw new Error("Can't generate CSS selector for non-element node type.");if(t.tagName.toLowerCase()==="html")return "html";let n={root:document.body,idName:Mi,className:Ii,tagName:Li,attr:Pi,timeoutMs:1e3,seedMinLength:3,optimizedMinLength:2,maxNumberOfPathChecks:1/0},i=new Date,o={...n,...e},r=Hi(o.root,n),s,a=0;for(let c of _i(t,o,r)){if(new Date().getTime()-i.getTime()>o.timeoutMs||a>=o.maxNumberOfPathChecks){let h=Fi(t,r);if(!h)throw new Error(`Timeout: Can't find a unique selector after ${o.timeoutMs}ms`);return pe(h)}if(a++,lt(c,r)){s=c;break}}if(!s)throw new Error("Selector was not found.");let l=[...Sn(s,t,o,r,i)];return l.sort(st),l.length>0?pe(l[0]):pe(s)}function*_i(t,e,n){let i=[],o=[],r=t,s=0;for(;r&&r!==n;){let a=Ni(r,e);for(let l of a)l.level=s;if(i.push(a),r=r.parentElement,s++,o.push(...kn(i)),s>=e.seedMinLength){o.sort(st);for(let l of o)yield l;o=[];}}o.sort(st);for(let a of o)yield a;}function ce(t){if(/^[a-z\-]{3,}$/i.test(t)){let e=t.split(/-|[A-Z]/);for(let n of e)if(n.length<=2||/[^aeiou]{4,}/i.test(n))return false;return true}return false}function Ni(t,e){let n=[],i=t.getAttribute("id");i&&e.idName(i)&&n.push({name:"#"+CSS.escape(i),penalty:0});for(let s=0;s<t.classList.length;s++){let a=t.classList[s];e.className(a)&&n.push({name:"."+CSS.escape(a),penalty:1});}for(let s=0;s<t.attributes.length;s++){let a=t.attributes[s];e.attr(a.name,a.value)&&n.push({name:`[${CSS.escape(a.name)}="${CSS.escape(a.value)}"]`,penalty:2});}let o=t.tagName.toLowerCase();if(e.tagName(o)){n.push({name:o,penalty:5});let s=rt(t,o);s!==void 0&&n.push({name:En(o,s),penalty:10});}let r=rt(t);return r!==void 0&&n.push({name:Oi(o,r),penalty:50}),n}function pe(t){let e=t[0],n=e.name;for(let i=1;i<t.length;i++){let o=t[i].level||0;e.level===o-1?n=`${t[i].name} > ${n}`:n=`${t[i].name} ${n}`,e=t[i];}return n}function wn(t){return t.map(e=>e.penalty).reduce((e,n)=>e+n,0)}function st(t,e){return wn(t)-wn(e)}function rt(t,e){let n=t.parentNode;if(!n)return;let i=n.firstChild;if(!i)return;let o=0;for(;i&&(i.nodeType===Node.ELEMENT_NODE&&(e===void 0||i.tagName.toLowerCase()===e)&&o++,i!==t);)i=i.nextSibling;return o}function Fi(t,e){let n=0,i=t,o=[];for(;i&&i!==e;){let r=i.tagName.toLowerCase(),s=rt(i,r);if(s===void 0)return;o.push({name:En(r,s),penalty:NaN,level:n}),i=i.parentElement,n++;}if(lt(o,e))return o}function Oi(t,e){return t==="html"?"html":`${t}:nth-child(${e})`}function En(t,e){return t==="html"?"html":`${t}:nth-of-type(${e})`}function*kn(t,e=[]){if(t.length>0)for(let n of t[0])yield*kn(t.slice(1,t.length),e.concat(n));else yield e;}function Hi(t,e){return t.nodeType===Node.DOCUMENT_NODE?t:t===e.root?t.ownerDocument:t}function lt(t,e){let n=pe(t);switch(e.querySelectorAll(n).length){case 0:throw new Error(`Can't select any node with this selector: ${n}`);case 1:return true;default:return false}}function*Sn(t,e,n,i,o){if(t.length>2&&t.length>n.optimizedMinLength)for(let r=1;r<t.length-1;r++){if(new Date().getTime()-o.getTime()>n.timeoutMs)return;let a=[...t];a.splice(r,1),lt(a,i)&&i.querySelector(pe(a))===e&&(yield a,yield*Sn(a,e,n,i,o));}}var Di=["role","aria-label","type","name","href","src","data-testid","data-id"];function $i(t){let e=5381;for(let n=0;n<t.length;n++)e=(e<<5)+e+t.charCodeAt(n)|0;return (e>>>0).toString(36)}function ct(t){let e=t.children.length,n=0,i=t.parentElement;if(i)for(let o of i.children){if(o===t)break;o.tagName===t.tagName&&n++;}return `${e}:${n}:${pt(t)}`}function pt(t){let e=[];for(let n of Di){let i=t.getAttribute(n);i&&e.push(`${n}=${i}`);}return e.length>0?$i(e.join(",")):"0"}function Tn(t,e){let n=e.split(":");if(n.length!==3)return 0;let[i,o,r]=n,s=Number(i),a=Number(o);if(Number.isNaN(s)||Number.isNaN(a))return 0;let l=ct(t),[c,p,h]=l.split(":"),d=0,f=Math.abs(Number(c)-s);f===0?d+=.2:f<=2?d+=.1:f<=5&&(d+=.03);let m=Math.abs(Number(p)-a);return m===0?d+=.4:m===1?d+=.2:m<=3&&(d+=.08),h===r&&(d+=.4),d}function Z(t){return t.tagName==="SITEPING-WIDGET"||t.closest("siteping-widget")!==null||t.closest('[data-siteping-ignore="true"]')!==null||t.closest("#siteping-markers")!==null||t.closest("#sp-tooltip")!==null}var Cn=4;function dt(t){let e=t,n=t.shadowRoot?.activeElement;for(;n instanceof HTMLElement;){let i=n.getBoundingClientRect();i.width>=Cn&&i.height>=Cn&&(e=n),n=n.shadowRoot?.activeElement;}return e}function Rn(t){let e=null,n=i=>{let o=i.target;o instanceof HTMLElement&&(o===document.body||o===document.documentElement||o===t||Z(o)||(e=dt(o)));};return document.addEventListener("focusin",n),{getLastPageFocus(){return e&&!e.isConnected&&(e=null),e},destroy(){document.removeEventListener("focusin",n),e=null;}}}var Me=256;function Ie(t,e){let n=t;for(;n&&Z(n);)n=n[e];return n}function An(t){return t.nodeType===1&&t.getAttribute("data-siteping-ignore")==="true"}function Bi(t){return t.nodeType===3?NodeFilter.FILTER_ACCEPT:An(t)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_SKIP}function te(t,e){let n=e==="before"?"previousElementSibling":"nextElementSibling",i=Ie(t[n],n),o=3;for(;i&&o>0;){let r=e==="before"?zi(i,Me,true).trim():ee(i,Me,true).trim();if(r)return e==="before"?r.slice(-32):r.slice(0,32);i=Ie(i[n],n),o--;}return ""}function Le(t){let e=Ie(t.previousElementSibling,"previousElementSibling"),n=Ie(t.nextElementSibling,"nextElementSibling"),i=e?ee(e,Me,true).trim().slice(0,40):"",o=n?ee(n,Me,true).trim().slice(0,40):"";return [i,o].filter(Boolean).join(" | ")}function ee(t,e,n=false){let i="";if(t.firstElementChild===null){for(let r of t.childNodes)if(r.nodeType===3&&(i+=r.data,i.length>=e))break;return i.length>e?i.slice(0,e):i}let o=n?t.ownerDocument.createTreeWalker(t,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,Bi):t.ownerDocument.createTreeWalker(t,NodeFilter.SHOW_TEXT);for(;i.length<e;){let r=o.nextNode();if(!r)break;i+=r.data;}return i.length>e?i.slice(0,e):i}function zi(t,e,n=false){let i="",o=r=>{for(let s=r.lastChild;s;s=s.previousSibling)if(s.nodeType===3){if(i=s.data+i,i.length>=e)return true}else if(s.nodeType===1&&!(n&&An(s))&&o(s))return true;return false};return o(t),i.length>e?i.slice(-e):i}function Pn(t){if(t.getRootNode()instanceof ShadowRoot)return Xi(t);if(t.id)return `//${t.localName}[@id=${ut(t.id)}]`;let e=[],n=t;for(;n&&n!==document.body&&e.length<6;){let i=n.localName,o=n.parentElement;if(n.id)return e.unshift(`/${i}[@id=${ut(n.id)}]`),"/"+e.join("");let r=1;if(o)for(let s of o.children){if(s===n)break;s.localName===i&&r++;}e.unshift(`/${i}[${r}]`),n=o;}return n!==document.body?"/"+e.join(""):"/html/body"+e.join("")}function Xi(t){let e="";for(let n=t;n;n=n.parentElement){let i=n.localName;if(n.id){e=`/${i}[@id=${ut(n.id)}]${e}`;continue}let o=1;for(let r=n.previousElementSibling;r;r=r.previousElementSibling)r.localName===i&&o++;e=`/${i}[${o}]${e}`;}return `.${e}`}function ut(t){return t.includes("'")?`concat('${t.replace(/'/g,`',"'",'`)}')`:`'${t}'`}var de="data-feedback-anchor",ht=" >>> ",Mn={className:t=>!/^(css|sc|emotion|styled)-/.test(t)&&!/^[a-z]{1,3}[A-Za-z0-9]{4,8}$/.test(t),attr:t=>["data-testid","data-id","role","aria-label"].includes(t),idName:t=>!t.startsWith("radix-")&&!/^:r[0-9]+:$/.test(t),seedMinLength:3,optimizedMinLength:2};function Ki(t,e){let n=t;for(;n;){let i=n.closest(e);if(i)return i;let o=n.getRootNode();n=o instanceof ShadowRoot?o.host:null;}return null}function In(t){if(t.parentElement)return t.parentElement;let e=t.getRootNode();return e instanceof ShadowRoot?e.host:null}function ft(t){let e=[],n=t;for(;n;){let f=n.getRootNode();f instanceof ShadowRoot?(e.unshift(at(n,{...Mn,root:f})),n=f.host):(e.unshift(at(n,Mn)),n=null);}let i=e.join(ht),o=Pn(t),s=(t.textContent?.trim()??"").slice(0,120),a=te(t,"before"),l=te(t,"after"),c=ct(t),p=Le(t),d=Ki(t,`[${de}]`)?.getAttribute(de)??null;return {cssSelector:i,xpath:o,textSnippet:s,textPrefix:a,textSuffix:l,fingerprint:c,neighborText:p,elementTag:t.tagName.slice(0,chunkKCOX2NRI_cjs.m),elementId:t.id&&t.id.length<=chunkKCOX2NRI_cjs.n?t.id:void 0,anchorKey:d}}function Ln(t,e){let n=t.getBoundingClientRect();return n.left<=e.x&&n.top<=e.y&&n.right>=e.x+e.width&&n.bottom>=e.y+e.height}function _n(t,e=document.documentElement){let n=mt(t.x+t.width/2,t.y+t.height/2);if(!n||n===e)return document.body;let i=n;for(;i&&i!==document.body;){if(i.hasAttribute(de)&&Ln(i,t))return i;i=In(i);}for(i=n;i&&i!==document.body;){if(Ln(i,t))return i;i=In(i);}return document.body}function mt(t,e){let n=document.elementFromPoint(t,e),i=n?.shadowRoot;for(;i&&typeof i.elementFromPoint=="function";){let o=i.elementFromPoint(t,e);if(!o||o.getRootNode()!==i)break;n=o,i=o.shadowRoot;}return n}function Nn(t,e){return e.width<=0||e.height<=0?{xPct:0,yPct:0,wPct:1,hPct:1}:{xPct:(t.x-e.x)/e.width,yPct:(t.y-e.y)/e.height,wPct:t.width/e.width,hPct:t.height/e.height}}var Fn={width:334,height:280},ne={top:0,bottom:0};function On(t,e,n,i=ne){let o=i.top+8,r=n.height-i.bottom-8,s=Math.max(0,r-o),a=t.bottom+8,l=t.top-8-e.height,c=f=>f>=o&&f+e.height<=r,p,h=null;c(a)?p=a:c(l)?p=l:e.height<=s?p=Math.min(Math.max(a,o),r-e.height):(p=o,h=s);let d=t.left;return d+e.width>n.width-8&&(d=t.right-e.width),d=Math.max(8,Math.min(d,n.width-8-e.width)),{top:p,left:d,maxHeight:h}}var Wi={question:"type.question",change:"type.change",bug:"type.bug",other:"type.other"},Dn=`opacity ${250}ms cubic-bezier(0.16, 1, 0.3, 1),transform ${250}ms cubic-bezier(0.16, 1, 0.3, 1)`;function bt(){return typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}var _e=class{constructor(e,n){this.colors=e;this.t=n;this.root=chunkKCOX2NRI_cjs.y("div",{style:`position:fixed;z-index:${2147483647};pointer-events:auto;width:300px;padding:16px;border-radius:16px;background:${this.colors.glassBg};backdrop-filter:blur(24px);-webkit-backdrop-filter:blur(24px);border:1px solid ${this.colors.glassBorder};box-shadow:0 8px 32px ${this.colors.shadow},0 2px 8px ${this.colors.shadow};font-family:"Inter",system-ui,-apple-system,sans-serif;opacity:0;transform:translateY(8px) scale(0.98);transition:${Dn};display:none;-webkit-font-smoothing:antialiased;`}),this.root.setAttribute("role","dialog"),this.root.setAttribute("aria-modal","true"),this.root.setAttribute("data-siteping-ignore","true");let i=[{type:"question",icon:chunkKCOX2NRI_cjs.P},{type:"change",icon:chunkKCOX2NRI_cjs.Q},{type:"bug",icon:chunkKCOX2NRI_cjs.R},{type:"other",icon:chunkKCOX2NRI_cjs.S}];this.typeRow=chunkKCOX2NRI_cjs.y("div",{style:"display:grid;grid-template-columns:1fr 1fr;gap:6px;margin-bottom:12px;"});for(let r of i){let s=document.createElement("button");s.style.cssText=`height:44px;border-radius:9999px;border:1px solid ${this.colors.border};background:${this.colors.glassBg};cursor:pointer;display:flex;align-items:center;justify-content:center;gap:5px;font-family:"Inter",system-ui,-apple-system,sans-serif;font-size:13px;font-weight:500;color:${this.colors.textTertiary};transition:all 0.2s ease;padding:0 12px;`;let a=chunkKCOX2NRI_cjs.x(r.icon);a.setAttribute("style","width:13px;height:13px;flex-shrink:0;"),s.appendChild(a),s.appendChild(document.createElement("span")),s.dataset.type=r.type,s.setAttribute("aria-pressed","false"),s.addEventListener("click",()=>{this.submittingState||this.selectType(r.type,this.typeRow);}),s.addEventListener("mouseenter",()=>{if(!this.submittingState&&s.dataset.type!==this.selectedType){let l=chunkKCOX2NRI_cjs.da(s.dataset.type??"",this.colors);s.style.background=l,s.style.borderColor=chunkKCOX2NRI_cjs.aa(s.dataset.type??"",this.colors)+"40";}}),s.addEventListener("mouseleave",()=>{this.submittingState||s.dataset.type!==this.selectedType&&(s.style.background=this.colors.glassBg,s.style.borderColor=this.colors.border);}),this.typeRow.appendChild(s);}this.textarea=document.createElement("textarea"),this.textarea.style.cssText=`width:100%;min-height:72px;max-height:152px;padding:10px 12px;border-radius:12px;border:1px solid ${this.colors.border};background:${this.colors.glassBgHeavy};color:${this.colors.text};font-family:"Inter",system-ui,-apple-system,sans-serif;font-size:13px;line-height:1.5;resize:vertical;outline:none;transition:all 0.2s ease;box-sizing:border-box;`,this.textarea.maxLength=5e3,this.hint=chunkKCOX2NRI_cjs.y("div",{style:`font-size:11px;color:${this.colors.textTertiary};text-align:right;margin-top:4px;font-family:"Inter",system-ui,-apple-system,sans-serif;letter-spacing:0.01em;`}),this.textarea.addEventListener("focus",()=>{this.submittingState||(this.textarea.style.borderColor=this.colors.accent,this.textarea.style.boxShadow=`0 0 0 3px ${this.colors.accent}14`,this.textarea.style.background=this.colors.bg);}),this.textarea.addEventListener("blur",()=>{this.submittingState||(this.textarea.style.borderColor=this.colors.border,this.textarea.style.boxShadow="none",this.textarea.style.background=this.colors.glassBgHeavy);}),this.textarea.addEventListener("input",()=>{this.updateSubmitState();}),this.textarea.addEventListener("keydown",r=>{this.submittingState||r.key==="Enter"&&(r.ctrlKey||r.metaKey)&&(r.preventDefault(),this.submit());});let o=chunkKCOX2NRI_cjs.y("div",{style:"display:flex;justify-content:flex-end;gap:8px;margin-top:12px;"});this.cancelBtn=document.createElement("button"),this.cancelBtn.style.cssText=`height:34px;padding:0 16px;border-radius:9999px;border:1px solid ${this.colors.border};background:${this.colors.glassBg};color:${this.colors.textTertiary};font-family:"Inter",system-ui,-apple-system,sans-serif;font-size:13px;font-weight:500;cursor:pointer;transition:all 0.2s ease;`,this.cancelBtn.addEventListener("click",()=>this.dismiss()),this.cancelBtn.addEventListener("mouseenter",()=>{this.submittingState||(this.cancelBtn.style.borderColor=this.colors.accent,this.cancelBtn.style.color=this.colors.accent);}),this.cancelBtn.addEventListener("mouseleave",()=>{this.submittingState||(this.cancelBtn.style.borderColor=this.colors.border,this.cancelBtn.style.color=this.colors.textTertiary);}),this.submitBtn=document.createElement("button"),this.submitBtn.style.cssText=`height:34px;padding:0 18px;border-radius:9999px;border:none;background:${this.colors.accentGradient};color:#fff;font-family:"Inter",system-ui,-apple-system,sans-serif;font-size:13px;font-weight:600;cursor:pointer;opacity:0.35;pointer-events:none;transition:all 0.2s ease;box-shadow:0 2px 8px ${this.colors.accentGlow};display:inline-flex;align-items:center;justify-content:center;min-width:64px;`,this.submitLabel=document.createElement("span"),this.submitBtn.appendChild(this.submitLabel),this.submitBtn.addEventListener("click",()=>this.submit()),o.appendChild(this.cancelBtn),o.appendChild(this.submitBtn),this.root.appendChild(this.typeRow),this.root.appendChild(this.textarea),this.root.appendChild(this.hint),this.root.appendChild(o),chunkKCOX2NRI_cjs.F(this.root),document.body.appendChild(this.root),this.applyLabels();}colors;t;root;selectedType=null;textarea;submitBtn;cancelBtn;typeRow;submitLabel;hint;resolve=null;previouslyFocused=null;onKeydownTrap=null;onSubmit=null;submittingState=false;showFrame=null;hideTimeoutId=null;spinnerAnimation=null;sheet=false;stopKeyboardTracking=null;get isOpen(){return this.resolve!==null}get sheetTop(){return this.sheet&&this.isOpen?window.innerHeight-this.root.offsetHeight:null}refreshLabels(){this.applyLabels();}applyLabels(){this.root.setAttribute("aria-label",this.t("popup.ariaLabel"));let e=this.root.querySelectorAll("button[data-type]");for(let n of e){let i=n.dataset.type;if(!i)continue;let o=Wi[i];if(!o)continue;let r=n.querySelector("span");r&&chunkKCOX2NRI_cjs.z(r,this.t(o));}this.textarea.placeholder=this.t("popup.placeholder"),this.textarea.setAttribute("aria-label",this.t("popup.textareaAria")),chunkKCOX2NRI_cjs.z(this.hint,chunkKCOX2NRI_cjs.D()?this.t("popup.submitHintMac"):this.t("popup.submitHintOther")),chunkKCOX2NRI_cjs.z(this.cancelBtn,this.t("popup.cancel")),chunkKCOX2NRI_cjs.z(this.submitLabel,this.t("popup.submit"));}show(e,n,i=ne){return new Promise(o=>{this.cancelPendingTransition(),this.resolve=o,this.onSubmit=n??null,this.selectedType=null,this.textarea.value="",this.submittingState=false,this.updateSubmitState(),this.resetTypeButtons(),this.previouslyFocused=document.activeElement;let r=chunkKCOX2NRI_cjs.ga();this.sheet=chunkKCOX2NRI_cjs.fa();let s=this.sheet?"48px":r?"44px":"34px";this.cancelBtn.style.height=s,this.submitBtn.style.height=s,this.cancelBtn.style.flex=this.sheet?"1":"",this.submitBtn.style.flex=this.sheet?"2":"",this.textarea.style.fontSize=r?"16px":"13px",this.textarea.style.minHeight=this.sheet?"96px":"72px",this.hint.style.display=r?"none":"",this.root.style.transform=this.hiddenTransform(),chunkKCOX2NRI_cjs.G(this.root,false),this.root.style.display="block",this.layout(e,i),this.onKeydownTrap=a=>{if(a.key==="Escape"&&this.dismiss(),a.key==="Tab"){let l=Array.from(this.root.querySelectorAll('button:not([disabled]), textarea:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])'));if(l.length===0)return;let c=l[0],p=l[l.length-1];if(!c||!p)return;a.shiftKey?(document.activeElement===c||!this.root.contains(document.activeElement))&&(a.preventDefault(),p.focus()):(document.activeElement===p||!this.root.contains(document.activeElement))&&(a.preventDefault(),c.focus());}},this.root.addEventListener("keydown",this.onKeydownTrap),this.root.style.transition=bt()?"none":Dn,this.showFrame=requestAnimationFrame(()=>{this.showFrame=null,this.root.style.opacity="1",this.root.style.transform="translateY(0) scale(1)",(r?this.typeRow.querySelector("button"):this.textarea)?.focus();});})}layout(e,n){let i=this.root.style;if(i.width=this.sheet?"auto":"300px",i.borderRadius=this.sheet?"20px 20px 0 0":"16px",i.background=this.sheet?this.colors.bg:this.colors.glassBg,i.boxShadow=this.sheet?`0 -8px 32px ${this.colors.shadow}`:`0 8px 32px ${this.colors.shadow}, 0 2px 8px ${this.colors.shadow}`,i.overscrollBehavior=this.sheet?"contain":"",this.stopKeyboardTracking?.(),this.stopKeyboardTracking=null,this.sheet){i.top="auto",i.left="0",i.right="0",i.overflowY="auto";let a=(l,c=window.innerHeight)=>{i.bottom=`${l}px`,i.maxHeight=`${c-8}px`,i.padding=`16px 16px ${l>0?"16px":"calc(16px + env(safe-area-inset-bottom, 0px))"}`;};a(0),this.stopKeyboardTracking=chunkKCOX2NRI_cjs.ha(a);return}i.right="",i.bottom="",i.padding="16px",i.maxHeight="",i.overflowY="";let{top:o,left:r,maxHeight:s}=On(e,this.measure(),{width:window.innerWidth,height:window.innerHeight},n);i.top=`${o}px`,i.left=`${r}px`,s!==null&&(i.maxHeight=`${Math.max(0,s-this.verticalChromeHeight())}px`,i.overflowY="auto",this.root.scrollTop=0);}hiddenTransform(){return this.sheet?"translateY(100%)":"translateY(8px) scale(0.98)"}measure(){let e=this.root.offsetWidth,n=this.root.offsetHeight;return e>0&&n>0?{width:e,height:n}:Fn}verticalChromeHeight(){let e=window.getComputedStyle(this.root);return e.boxSizing==="border-box"?0:[e.paddingTop,e.paddingBottom,e.borderTopWidth,e.borderBottomWidth].reduce((n,i)=>n+(Number.parseFloat(i)||0),0)}selectType(e,n){this.selectedType=e;let i=n.querySelectorAll("button");for(let o of i){let r=o.dataset.type===e,s=chunkKCOX2NRI_cjs.aa(o.dataset.type??"",this.colors),a=chunkKCOX2NRI_cjs.da(o.dataset.type??"",this.colors);o.style.background=r?a:this.colors.glassBg,o.style.borderColor=r?s+"60":this.colors.border,o.style.color=r?s:this.colors.textTertiary,o.style.fontWeight=r?"600":"500",o.setAttribute("aria-pressed",String(r));}this.updateSubmitState();}resetTypeButtons(){let e=this.root.querySelectorAll("button[data-type]");for(let n of e)n.setAttribute("aria-pressed","false"),n.disabled=false,n.style.background=this.colors.glassBg,n.style.borderColor=this.colors.border,n.style.color=this.colors.textTertiary,n.style.fontWeight="500",n.style.cursor="pointer";}updateSubmitState(){if(this.submittingState)return;let e=this.selectedType!==null&&this.textarea.value.trim().length>0;this.submitBtn.disabled=!e,this.submitBtn.style.opacity=e?"1":"0.35",this.submitBtn.style.pointerEvents=e?"auto":"none";}submit(){if(this.submittingState||!this.selectedType||!this.textarea.value.trim())return;let e={type:this.selectedType,message:this.textarea.value.trim()};if(!this.onSubmit){this.resolve?.(e),this.resolve=null,this.hideElement();return}this.enterSubmittingState();let n=this.onSubmit;n(e).then(()=>{this.resolve?.(e),this.resolve=null,this.hideElement();}).catch(()=>{this.exitSubmittingState();});}dismiss(){this.submittingState||!this.isOpen||(this.resolve?.(null),this.resolve=null,this.hideElement());}enterSubmittingState(){this.submittingState=true,this.submitLabel.style.display="none",this.submitBtn.disabled=true,this.submitBtn.style.cursor="wait",this.submitBtn.style.opacity="0.85",this.submitBtn.setAttribute("aria-busy","true"),this.submitBtn.appendChild(this.buildSpinner()),this.cancelBtn.disabled=true,this.cancelBtn.style.opacity="0.5",this.cancelBtn.style.cursor="not-allowed",this.cancelBtn.style.pointerEvents="none",this.textarea.disabled=true,this.textarea.style.opacity="0.6";let e=this.typeRow.querySelectorAll("button");for(let n of e)n.disabled=true,n.style.cursor="not-allowed",n.style.opacity="0.6";}exitSubmittingState(){this.submittingState=false,this.spinnerAnimation?.cancel(),this.spinnerAnimation=null,this.submitBtn.querySelector('[data-role="sp-popup-spinner"]')?.remove(),this.submitLabel.style.display="",this.submitBtn.removeAttribute("aria-busy"),this.submitBtn.style.cursor="pointer",this.cancelBtn.disabled=false,this.cancelBtn.style.opacity="1",this.cancelBtn.style.cursor="pointer",this.cancelBtn.style.pointerEvents="auto",this.textarea.disabled=false,this.textarea.style.opacity="1";let n=this.typeRow.querySelectorAll("button");for(let i of n)i.disabled=false,i.style.cursor="pointer",i.style.opacity="1";this.updateSubmitState();}buildSpinner(){let e=document.createElement("div");return e.dataset.role="sp-popup-spinner",e.style.cssText="width:14px;height:14px;border:2px solid rgba(255,255,255,0.35);border-top-color:#fff;border-radius:50%;box-sizing:border-box;",!bt()&&typeof e.animate=="function"&&(this.spinnerAnimation=e.animate([{transform:"rotate(0deg)"},{transform:"rotate(360deg)"}],{duration:600,iterations:1/0,easing:"linear"})),e}hideElement(){if(this.cancelPendingTransition(),this.onKeydownTrap&&(this.root.removeEventListener("keydown",this.onKeydownTrap),this.onKeydownTrap=null),this.submittingState&&this.exitSubmittingState(),this.onSubmit=null,this.stopKeyboardTracking?.(),this.stopKeyboardTracking=null,this.root.style.opacity="0",this.root.style.transform=this.hiddenTransform(),this.previouslyFocused?.focus(),this.previouslyFocused=null,chunkKCOX2NRI_cjs.G(this.root,true),bt()){this.root.style.display="none";return}this.hideTimeoutId=setTimeout(()=>{this.hideTimeoutId=null,this.root.style.display="none";},250);}cancelPendingTransition(){this.showFrame!==null&&cancelAnimationFrame(this.showFrame),this.hideTimeoutId!==null&&clearTimeout(this.hideTimeoutId),this.showFrame=null,this.hideTimeoutId=null;}destroy(){this.submittingState&&this.exitSubmittingState(),this.cancelPendingTransition(),this.resolve?.(null),this.resolve=null,this.onSubmit=null,this.onKeydownTrap&&(this.root.removeEventListener("keydown",this.onKeydownTrap),this.onKeydownTrap=null),this.stopKeyboardTracking?.(),this.stopKeyboardTracking=null,this.root.remove();}};var ue,$n=false;async function ji(){if(ue!==void 0)return ue;try{let t=await import('html2canvas-pro');return ue=t.default??t,ue}catch(t){return ue=null,$n||($n=true,console.warn("[siteping] html2canvas-pro import failed unexpectedly. Capture is disabled for this session \u2014 feedbacks are still submitted, just without screenshots. Underlying error:",t)),null}}function gt(t,e,n){return Math.min(n,Math.max(t,e))}function Ne(t){return gt(0,Math.round(t*1e4)/1e4,1)}async function Bn(t,e){let n=await ji();if(!n)return null;let i=.85,o=1200,r=gt(48,t.width*.6,280),s=gt(48,t.height*.6,220),a=window.scrollX+t.x,l=window.scrollY+t.y,c=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth),p=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),h=Math.max(0,a-r),d=Math.max(0,l-s),f=Math.min(c,a+t.width+r)-h,m=Math.min(p,l+t.height+s)-d;if(f<=0||m<=0)return null;let v={xPct:Ne((a-h)/f),yPct:Ne((l-d)/m),wPct:Ne(t.width/f),hPct:Ne(t.height/m)};try{let T=await n(document.body,{x:h,y:d,width:f,height:m,scale:window.devicePixelRatio,useCORS:!0,allowTaint:!0,logging:!1,ignoreElements:H=>H.tagName==="SITEPING-WIDGET"||H.closest?.("siteping-widget")!==null||H.getAttribute?.("data-siteping-ignore")==="true"});if(T.width<=o)return {dataUrl:T.toDataURL("image/jpeg",i),region:v};let A=o/T.width,C=o,E=Math.round(T.height*A),_=document.createElement("canvas");_.width=C,_.height=E;let X=_.getContext("2d");return X?(X.drawImage(T,0,0,C,E),{dataUrl:_.toDataURL("image/jpeg",i),region:v}):null}catch(T){return console.warn("[siteping] Screenshot capture failed:",T),null}}var Fe=10;function zn(t){let e=Math.max(0,t.left),n=Math.max(0,t.top);return new DOMRect(e,n,Math.max(0,Math.min(t.right,window.innerWidth)-e),Math.max(0,Math.min(t.bottom,window.innerHeight)-n))}function Yi(){return {clientId:chunkKCOX2NRI_cjs.p()}}var Oe=class{constructor(e,n,i,o=false,r){this.colors=e;this.bus=n;this.t=i;this.enableScreenshot=o;this.getFallbackTarget=r;this.popup=new _e(e,i),this.bus.on("annotation:start",()=>this.activate());}colors;bus;t;enableScreenshot;getFallbackTarget;overlay=null;toolbar=null;drawingRect=null;startX=0;startY=0;isDrawing=false;isActive=false;instantMode=false;popup;savedOverflow="";preActiveFocusElement=null;keyboardTarget=null;rafId=null;pendingMoveEvent=null;rejectPendingSubmission=null;unregisterEscapeLayer=chunkKCOX2NRI_cjs.H(document,()=>this.isActive);get isBusy(){return this.isActive}refreshLabels(){this.popup.refreshLabels();}async maybeCapture(e){return this.enableScreenshot?Bn(e):null}activate(){if(this.isActive)return;this.isActive=true;let e=!this.instantMode,n=chunkKCOX2NRI_cjs.fa(),i=chunkKCOX2NRI_cjs.ga(),o=this.t("annotator.instruction");this.preActiveFocusElement=document.activeElement;let r=document.activeElement;if(this.keyboardTarget=r instanceof HTMLElement&&r!==document.body&&r!==document.documentElement&&!Z(r)?dt(r):this.getFallbackTarget?.()??null,this.savedOverflow=document.body.style.overflow,document.body.style.overflow="hidden",this.overlay=chunkKCOX2NRI_cjs.y("div",{style:`position:fixed;inset:0;z-index:${2147483646};pointer-events:auto;background:rgba(15,23,42,0.04);cursor:${e?"crosshair":"default"};touch-action:none;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;`}),this.overlay.setAttribute("role","application"),this.overlay.setAttribute("aria-label",e?o:this.t("annotator.instantInstruction")),this.overlay.setAttribute("data-siteping-ignore","true"),e){this.toolbar=chunkKCOX2NRI_cjs.y("div",{style:`position:fixed;top:0;left:0;right:0;z-index:${2147483647};pointer-events:auto;min-height:52px;box-sizing:border-box;padding:calc(env(safe-area-inset-top,0px) + 8px) ${n?"12px 8px 16px":"16px 8px"};background:${n?this.colors.bg:this.colors.glassBg};backdrop-filter:blur(24px);-webkit-backdrop-filter:blur(24px);border-bottom:1px solid ${this.colors.glassBorder};display:flex;align-items:center;justify-content:center;gap:${n?12:16}px;font-family:"Inter",system-ui,-apple-system,sans-serif;font-size:14px;line-height:1.35;color:${this.colors.text};box-shadow:0 4px 16px ${this.colors.shadow};-webkit-font-smoothing:antialiased;`}),this.toolbar.setAttribute("data-siteping-ignore","true");let s=chunkKCOX2NRI_cjs.y("span",{style:`width:8px;height:8px;border-radius:50%;flex-shrink:0;background:${this.colors.accent};box-shadow:0 0 8px ${this.colors.accentGlow};animation:pulse 1.5s ease-in-out infinite;`}),a=document.createElement("style");a.textContent=["@keyframes pulse{0%,100%{opacity:1}50%{opacity:0.4}}","@media(prefers-reduced-motion:reduce){@keyframes pulse{from,to{opacity:1}}}"].join(""),this.toolbar.appendChild(a);let l=chunkKCOX2NRI_cjs.y("span",{style:"font-weight:500;letter-spacing:-0.01em;min-width:0;"});chunkKCOX2NRI_cjs.z(l,i?this.t("annotator.touchInstruction"):o);let c=document.createElement("button");c.style.cssText=`height:${i?40:34}px;padding:0 18px;border-radius:9999px;flex-shrink:0;border:1px solid ${this.colors.border};background:${this.colors.glassBg};color:${this.colors.textTertiary};font-family:"Inter",system-ui,-apple-system,sans-serif;font-size:13px;font-weight:500;cursor:pointer;transition:all 0.2s ease;`,chunkKCOX2NRI_cjs.z(c,this.t("annotator.cancel")),c.addEventListener("click",()=>this.cancelSession()),c.addEventListener("mouseenter",()=>{c.style.borderColor=this.colors.typeBug,c.style.color=this.colors.typeBug,c.style.background=this.colors.typeBugBg;}),c.addEventListener("mouseleave",()=>{c.style.borderColor=this.colors.border,c.style.color=this.colors.textTertiary,c.style.background=this.colors.glassBg;}),this.toolbar.appendChild(s),this.toolbar.appendChild(l),this.toolbar.appendChild(c);}e&&(this.overlay.addEventListener("mousedown",this.onMouseDown),this.overlay.addEventListener("mousemove",this.onMouseMove),this.overlay.addEventListener("mouseup",this.onMouseUp),this.overlay.addEventListener("touchstart",this.onTouchStart,{passive:false}),this.overlay.addEventListener("touchmove",this.onTouchMove,{passive:false}),this.overlay.addEventListener("touchend",this.onTouchEnd),this.overlay.addEventListener("keydown",this.onOverlayKeyDown)),this.overlay.setAttribute("tabindex","0"),document.addEventListener("keydown",this.onKeyDown),chunkKCOX2NRI_cjs.F(this.overlay),this.toolbar&&chunkKCOX2NRI_cjs.F(this.toolbar),document.body.appendChild(this.overlay),this.toolbar&&document.body.appendChild(this.toolbar),this.overlay.focus({preventScroll:true});}toolbarInsets(){if(!this.toolbar)return ne;let e=this.toolbar.getBoundingClientRect();if(e.height===0)return ne;let n=window.innerHeight;return e.top+e.height/2<n/2?{top:Math.max(0,e.bottom),bottom:0}:{top:0,bottom:Math.max(0,n-e.top)}}cancelSession(){this.isActive&&(this.popup.dismiss(),!this.popup.isOpen&&this.deactivate());}deactivate(){if(!this.isActive)return;this.isActive=false,this.isDrawing=false,this.instantMode=false;let e=this.preActiveFocusElement;this.preActiveFocusElement=null,this.keyboardTarget=null,this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.pendingMoveEvent=null,document.body.style.overflow=this.savedOverflow,document.removeEventListener("keydown",this.onKeyDown),this.overlay?.remove(),this.toolbar?.remove(),this.drawingRect?.remove(),this.overlay=null,this.toolbar=null,this.drawingRect=null,e instanceof HTMLElement&&e.isConnected&&e.focus({preventScroll:true}),this.bus.emit("annotation:end");}onKeyDown=e=>{e.key==="Escape"&&this.cancelSession();};onOverlayKeyDown=async e=>{if(e.key!=="Enter"||(e.preventDefault(),this.popup.isOpen)||this.isDrawing)return;let n=this.keyboardTarget;!n||!(n instanceof HTMLElement)||await this.annotateElement(n);};async annotateElement(e,n=false){let i=e.getBoundingClientRect();if(i.width<=0||i.height<=0)return;let o=new DOMRect(i.x,i.y,i.width,i.height);this.drawingRect?.remove();let r=this.createDrawingRect();r.style.left=`${i.x}px`,r.style.top=`${i.y}px`,r.style.width=`${i.width}px`,r.style.height=`${i.height}px`,this.drawingRect=r,this.overlay?.appendChild(r);let a={anchor:ft(e),rect:{xPct:0,yPct:0,wPct:1,hPct:1},scrollX:window.scrollX,scrollY:window.scrollY,viewportW:window.innerWidth,viewportH:window.innerHeight,devicePixelRatio:window.devicePixelRatio},l=await this.openForm(a,o,n?zn(o):o);this.drawingRect?.remove(),this.drawingRect=null,l&&this.deactivate();}onMouseDown=e=>{this.startDrawing(e.clientX,e.clientY);};onTouchStart=e=>{e.preventDefault();let n=e.touches[0];n&&this.startDrawing(n.clientX,n.clientY);};startDrawing(e,n){this.popup.isOpen||(this.isDrawing=true,this.startX=e,this.startY=n,this.drawingRect?.remove(),this.drawingRect=this.createDrawingRect(),this.overlay?.appendChild(this.drawingRect));}createDrawingRect(){let e=chunkKCOX2NRI_cjs.y("div",{style:`position:fixed;border:2px solid ${this.colors.accent};background:${this.colors.accent}12;pointer-events:none;border-radius:8px;box-shadow:0 0 16px ${this.colors.accentGlow};transition:box-shadow 0.15s ease;`});return e.setAttribute("data-siteping-ignore","true"),e}onMouseMove=e=>{this.scheduleRectUpdate(e);};onTouchMove=e=>{e.preventDefault(),e.touches[0]&&this.scheduleRectUpdate(e.touches[0]);};scheduleRectUpdate(e){!this.isDrawing||!this.drawingRect||(this.pendingMoveEvent=e,this.rafId===null&&(this.rafId=requestAnimationFrame(()=>{this.rafId=null;let n=this.pendingMoveEvent;if(!n||!this.drawingRect)return;let i=Math.min(n.clientX,this.startX),o=Math.min(n.clientY,this.startY),r=Math.abs(n.clientX-this.startX),s=Math.abs(n.clientY-this.startY);this.drawingRect.style.left=`${i}px`,this.drawingRect.style.top=`${o}px`,this.drawingRect.style.width=`${r}px`,this.drawingRect.style.height=`${s}px`;})));}onTouchEnd=async e=>{let n=e.changedTouches[0];if(n){if(this.isDrawing&&(Math.abs(n.clientX-this.startX)<Fe||Math.abs(n.clientY-this.startY)<Fe)){this.isDrawing=false,this.drawingRect?.remove(),this.drawingRect=null;let i=this.elementAt(n.clientX,n.clientY);i&&await this.annotateElement(i,true);return}await this.finishDrawing(n.clientX,n.clientY);}};elementAt(e,n){this.overlay&&(this.overlay.style.pointerEvents="none");let i=mt(e,n);this.overlay&&(this.overlay.style.pointerEvents="auto");let o=i instanceof SVGElement?(i.ownerSVGElement??i).parentElement:i;return o instanceof HTMLElement&&o!==document.body&&o!==document.documentElement&&!Z(o)?o:null}onMouseUp=async e=>{await this.finishDrawing(e.clientX,e.clientY);};finishDrawing=async(e,n)=>{if(!this.isDrawing||!this.drawingRect)return;this.isDrawing=false;let i=Math.min(e,this.startX),o=Math.min(n,this.startY),r=Math.abs(e-this.startX),s=Math.abs(n-this.startY);if(r<Fe||s<Fe){this.drawingRect.remove(),this.drawingRect=null;return}let a=new DOMRect(i,o,r,s),{annotation:l}=this.buildAnnotation(a),c=await this.openForm(l,a);this.drawingRect?.remove(),this.drawingRect=null,c&&this.deactivate();};async startInstantAnnotation(e,n){if(this.isActive)return;this.instantMode=true,this.bus.emit("annotation:start");let i=Math.max(0,Math.min(e-20/2,window.innerWidth-20)),o=Math.max(0,Math.min(n-20/2,window.innerHeight-20)),r=new DOMRect(i,o,20,20),{annotation:s,anchorBounds:a}=this.buildAnnotation(r),l=zn(a);this.drawingRect?.remove(),this.drawingRect=chunkKCOX2NRI_cjs.y("div",{style:`position:fixed;left:${i}px;top:${o}px;width:${20}px;height:${20}px;border:2px solid ${this.colors.accent};background:${this.colors.accent}12;pointer-events:none;border-radius:8px;box-shadow:0 0 16px ${this.colors.accentGlow};`}),this.drawingRect.setAttribute("data-siteping-ignore","true"),this.overlay?.appendChild(this.drawingRect),await this.openForm(s,r,l),this.drawingRect?.remove(),this.drawingRect=null,this.deactivate();}openForm(e,n,i=n){let o=Yi(),r=this.popup.show(n,s=>this.runSubmission(e,s,i,o),this.toolbarInsets());return this.revealSelection(n),r}revealSelection(e){let n=this.popup.sheetTop;if(n===null||!this.drawingRect)return;let i=Math.min(e.bottom+16-n,e.top-72);if(i<=0)return;let o=window.scrollY;window.scrollBy({top:i,behavior:"instant"}),this.drawingRect.style.top=`${e.top-(window.scrollY-o)}px`;}async runSubmission(e,n,i,o){o.screenshot===void 0&&(o.screenshot=await this.maybeCapture(new DOMRect(i.x+e.scrollX-window.scrollX,i.y+e.scrollY-window.scrollY,i.width,i.height)));let r=o.screenshot;await new Promise((s,a)=>{let l=()=>{c(),p(),h(),this.rejectPendingSubmission=null;},c=this.bus.on("feedback:sent",()=>{l(),s();}),p=this.bus.on("feedback:error",d=>{l(),a(d);}),h=this.bus.on("submission:cancelled",()=>{l(),a(new Error("Feedback submission cancelled"));});this.rejectPendingSubmission=d=>{l(),a(d);},this.bus.emit("annotation:complete",{annotation:e,type:n.type,message:n.message,clientId:o.clientId,screenshotDataUrl:r?.dataUrl??null,screenshotRegion:r?.region??null});});}buildAnnotation(e){this.overlay&&(this.overlay.style.pointerEvents="none");let n=_n(e);this.overlay&&(this.overlay.style.pointerEvents="auto");let i=ft(n),o=n.getBoundingClientRect(),r=Nn(e,o);return {annotation:{anchor:i,rect:r,scrollX:window.scrollX,scrollY:window.scrollY,viewportW:window.innerWidth,viewportH:window.innerHeight,devicePixelRatio:window.devicePixelRatio},anchorBounds:o}}destroy(){this.deactivate(),this.unregisterEscapeLayer(),this.rejectPendingSubmission?.(new Error("Annotator destroyed during submission")),this.popup.destroy();}};function He(t,e){let n=`siteping_own_feedback:${JSON.stringify([t,e??null])}`,i=()=>{try{let r=JSON.parse(localStorage.getItem(n)??"[]");return new Set(Array.isArray(r)?r.filter(s=>typeof s=="string"):[])}catch{return new Set}},o=r=>{try{r.size>0?localStorage.setItem(n,JSON.stringify([...r].slice(-500))):localStorage.removeItem(n);}catch{}};return {ids:i,add(r){let s=i();s.delete(r),o(s.add(r));},remove(...r){let s=i(),a=s.size;for(let l of r)s.delete(l);s.size<a&&o(s);},clear:()=>o(new Set)}}var Xn=3,he=1e4,Y="siteping_retry_queue",Ui=20;function vt(t,e,n){let i,o=new Promise((r,s)=>{i=setTimeout(()=>s(n()),e);});return Promise.race([t,o]).finally(()=>clearTimeout(i))}async function qn(t,e){let n={};e&&(n["Content-Type"]="application/json"),t.apiKey&&(n.Authorization=`Bearer ${t.apiKey}`);let i=typeof t.headers=="function"?await vt(Promise.resolve(t.headers()),he,()=>new Error(`headers factory did not settle within ${he/1e3} s`)):t.headers;return chunkKCOX2NRI_cjs.r(n,i)}async function ie(t,e,n,i,{boundBody:o=false}={}){for(let r=0;;r++){let s=new AbortController,a=setTimeout(()=>s.abort(),he);try{let p=await fetch(t,{...e,signal:s.signal}).catch(h=>{if(r===Xn)throw chunkKCOX2NRI_cjs.v(h,n);return null});if(p&&(p.ok||p.status>=400&&p.status<500||r===Xn)){if(clearTimeout(a),o&&(a=setTimeout(()=>s.abort(),he)),!p.ok)throw await chunkKCOX2NRI_cjs.t(p,n);return await i(p).catch(h=>{throw chunkKCOX2NRI_cjs.v(h,n)})}}finally{clearTimeout(a);}let l=1e3*2**r,c=Math.random()*1e3-500;await new Promise(p=>setTimeout(p,l+c));}}function qi(t){return t instanceof chunkKCOX2NRI_cjs.c||t instanceof chunkKCOX2NRI_cjs.b&&t.code==="SERVER"}function Vi(t){return t>=500}var Gi="siteping_retry_queue";async function xt(t){return typeof navigator<"u"&&navigator.locks?navigator.locks.request(Gi,()=>t()):t()}function Qi(t){if(!chunkKCOX2NRI_cjs.d(t,"endpoint")||typeof t.endpoint!="string"||!chunkKCOX2NRI_cjs.d(t,"payload"))return false;let{payload:e}=t;return chunkKCOX2NRI_cjs.d(e,"authorName")&&typeof e.authorName=="string"&&chunkKCOX2NRI_cjs.d(e,"authorEmail")&&typeof e.authorEmail=="string"}function wt(){let t=localStorage.getItem(Y);if(!t)return [];let e;try{e=JSON.parse(t);}catch{return localStorage.removeItem(Y),console.warn(`[siteping] discarded an unreadable retry queue from localStorage (${t.length} chars)`),[]}return Array.isArray(e)?e.filter(Qi):[]}function Ji(t,e){xt(()=>{try{let n=wt().filter(r=>r.payload.clientId!==e.clientId);if(n.length>=Ui&&n.shift(),n.push({endpoint:t,payload:e}),yt(n))return;let i=n.slice(),o=0;for(let[r,s]of i.entries())if(Kn(s)&&(i[r]=eo(s),o+=1,yt(i))){console.warn(`[siteping] retry queue exceeded the localStorage quota \u2014 dropped the screenshot of ${o} of ${n.length} queued feedback(s)`);return}for(;i.length>1;)if(i.shift(),yt(i)){let r=n.length-i.length,s=n.slice(r).filter(Kn).length;console.warn(`[siteping] retry queue exceeded the localStorage quota \u2014 dropped the ${r} oldest of ${n.length} queued feedback(s)${s>0?`, and the screenshot of ${s} of the rest`:""}`);return}console.warn("[siteping] feedback could not be queued for retry \u2014 localStorage is full or unavailable");}catch{}});}function Zi(t){xt(()=>{try{let e=wt(),n=e.filter(i=>i.payload.clientId!==t);if(n.length===e.length)return;n.length>0?localStorage.setItem(Y,JSON.stringify(n)):localStorage.removeItem(Y);}catch{}});}function yt(t){try{return localStorage.setItem(Y,JSON.stringify(t)),!0}catch{return false}}function Kn(t){return t.payload.screenshotDataUrl!=null}function eo(t){let{screenshotDataUrl:e,screenshotRegion:n,...i}=t.payload;return {endpoint:t.endpoint,payload:i}}function Wn(t){return t.trim()}function jn(t){return t.trim().toLowerCase()}async function Vn(t,e,n={}){await xt(async()=>{try{let i=wt();if(i.length===0)return;let o=[],r=[],s=0;for(let p of i){if(p.endpoint!==t){r.push(p);continue}!e||Wn(p.payload.authorName)===Wn(e.name)&&jn(p.payload.authorEmail)===jn(e.email)?o.push(p):s+=1;}if(o.length===0&&s===0)return;s>0;let a=[],l=0;if(o.length>0){let p=await qn(n,!0);for(let h of o){let d=new AbortController,f=setTimeout(()=>d.abort(),he);try{let m=await fetch(t,{method:"POST",headers:p,body:JSON.stringify(h.payload),signal:d.signal});if(m.ok){let v=await m.json().catch(()=>null);chunkKCOX2NRI_cjs.d(v,"id")&&typeof v.id=="string"&&He(h.payload.projectName,t).add(v.id);continue}Vi(m.status)?a.push(h):l+=1;}catch{a.push(h);}finally{clearTimeout(f);}}}l>0&&console.warn(`[siteping] flushRetryQueue: dropped ${l} queued feedback(s) the server rejected (4xx) \u2014 they would fail identically on every replay`);let c=r.concat(a);c.length>0?localStorage.setItem(Y,JSON.stringify(c)):localStorage.removeItem(Y);}catch{}});}function Yn(t,e){let n=Math.min(1,Math.max(0,t)),i=e-(n-t);return [n,Math.max(0,n+i<=1?i:1-n)]}function to(t){let[e,n]=Yn(t.rect.xPct,t.rect.wPct),[i,o]=Yn(t.rect.yPct,t.rect.hPct);return {...t,rect:{xPct:e,yPct:i,wPct:n,hPct:o}}}async function De(t){return await t.json()}async function Un(){}var $e=class{constructor(e,n,i={}){this.endpoint=e;this.projectName=n;this.auth=i;}endpoint;projectName;auth;async headers(e,n){try{return await qn(this.auth,e)}catch(i){throw chunkKCOX2NRI_cjs.v(i,n)}}async sendFeedback(e){let n="Failed to send feedback",{screenshotRegion:i,...o}=e,r={...o,annotations:o.annotations.map(to)},s=i?{...r,screenshotRegion:i}:r;try{let a=await ie(this.endpoint,{method:"POST",headers:await this.headers(!0,n),body:JSON.stringify(s)},n,De,{boundBody:!0});return Zi(s.clientId),a}catch(a){throw qi(a)&&Ji(this.endpoint,s),a}}async getFeedbacks(e,n){let i="Failed to fetch feedbacks",o=chunkKCOX2NRI_cjs.q({projectName:e,...n}),r=await this.headers(false,i);return ie(chunkKCOX2NRI_cjs.s(this.endpoint,o),{method:"GET",cache:"no-store",...Object.keys(r).length>0?{headers:r}:{}},i,De)}async addComment(e,n){let i="Failed to post comment";return ie(this.endpoint,{method:"POST",headers:await this.headers(true,i),body:JSON.stringify({...n,projectName:this.projectName,feedbackId:e})},i,De,{boundBody:true})}async resolveFeedback(e,n){let i="Failed to update feedback";return ie(this.endpoint,{method:"PATCH",headers:await this.headers(true,i),body:JSON.stringify({id:e,projectName:this.projectName,status:n?"resolved":"open"})},i,De)}async deleteFeedback(e){let n="Failed to delete feedback";await ie(this.endpoint,{method:"DELETE",headers:await this.headers(true,n),body:JSON.stringify({id:e,projectName:this.projectName})},n,Un);}async deleteAllFeedbacks(e){let n="Failed to delete all feedbacks";await ie(this.endpoint,{method:"DELETE",headers:await this.headers(true,n),body:JSON.stringify({projectName:e,deleteAll:true})},n,Un);}};function Be(t,e){if(t.length<=e)return t;let n=e-1,i=t.charCodeAt(n-1);return i>=55296&&i<=56319&&(n-=1),`${t.slice(0,n)}\u2026`}var Et=50,kt=500,no=["log","info","warn","error"];function io(t){if(t===null)return "null";if(t===void 0)return "undefined";if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean"||typeof t=="bigint")return String(t);if(t instanceof Error)return `${t.name}: ${t.message}${t.stack?`
|
|
2
|
-
${t.stack}`:""}`;try{let e=[],n=kt;return JSON.stringify(t,function(i,o){if(!(--n<0)){if(typeof o=="function")return "[Function]";if(typeof o=="symbol")return o.toString();if(typeof o!="object"||o===null)return o;for(;e.length>0&&e[e.length-1]!==this;)e.pop();return e.includes(o)?"[Circular]":(e.push(o),o)}})}catch{try{return String(t)}catch{return "[Unserializable]"}}}function oo(t){let e="";for(let n=0;n<t.length&&(n>0&&(e+=" "),e+=io(t[n]),!(e.length>=kt));n++);return Be(e,kt)}var ze=class{maxEntries;entries=[];originals=new Map;wrappers=new Map;disposed=false;constructor(e=Et){if(this.maxEntries=Number.isFinite(e)&&e>=0?Math.min(Math.floor(e),Et):Et,!(typeof console>"u"))for(let n of no){let i=console[n];if(typeof i!="function")continue;this.originals.set(n,i);let o=this,r=function(...s){try{o.push(n,s);}catch{}i.apply(this??console,s);};try{Object.defineProperty(r,"name",{value:n});}catch{}this.wrappers.set(n,r),console[n]=r;}}push(e,n){this.maxEntries!==0&&(this.entries.length>=this.maxEntries&&this.entries.shift(),this.entries.push({level:e,timestamp:new Date().toISOString(),message:oo(n)}));}getEntries(){return this.entries.slice()}dispose(){if(this.disposed||(this.disposed=true,typeof console>"u"))return;let e=console;for(let[n,i]of this.originals)if(e[n]===this.wrappers.get(n))try{e[n]=i;}catch{}this.originals.clear(),this.wrappers.clear();}};var St=20,so=2e3,ro=20,ao=6e5,lo=599;function Gn(t){let e=co(po(t)),n=e.search(/[?#]/);return Be(n===-1?e:e.slice(0,n),so)}function co(t){try{let e=new URL(t,typeof location>"u"?void 0:location.href);return !e.username&&!e.password?t:(e.username="",e.password="",e.href)}catch{return t}}function po(t){if(typeof t=="string")return t;if(t instanceof URL)return t.href;if(typeof t=="object"&&t!==null&&"url"in t){let e=t.url;if(typeof e=="string")return e}try{return String(t)}catch{return "(unknown)"}}var Xe=class{maxEntries;entries=[];originalFetch=null;originalXhrOpen=null;originalXhrSend=null;wrappedFetch=null;wrappedXhrOpen=null;wrappedXhrSend=null;disposed=false;constructor(e=St){this.maxEntries=Number.isFinite(e)&&e>=0?Math.min(Math.floor(e),St):St,this.installFetch(),this.installXhr();}push(e){this.maxEntries!==0&&(this.entries.length>=this.maxEntries&&this.entries.shift(),this.entries.push({...e,method:e.method.slice(0,ro),status:e.status<=lo?e.status:0,durationMs:Math.min(Math.max(e.durationMs,0),ao)}));}installFetch(){if(typeof globalThis.fetch!="function")return;let e=globalThis.fetch;this.originalFetch=e;let n=async(i,o)=>{let r=new Date,s=typeof performance<"u"?performance.now():Date.now(),a=Gn(i),l=(o?.method??(i instanceof Request?i.method:"GET")).toUpperCase();try{let c=await e(i,o);if(!c.ok){let p=typeof performance<"u"?performance.now():Date.now();this.push({url:a,method:l,status:c.status,durationMs:Math.round(p-s),timestamp:r.toISOString()});}return c}catch(c){let p=typeof performance<"u"?performance.now():Date.now();throw this.push({url:a,method:l,status:0,durationMs:Math.round(p-s),timestamp:r.toISOString()}),c}};this.wrappedFetch=n,globalThis.fetch=n;}installXhr(){if(typeof XMLHttpRequest>"u")return;let e=XMLHttpRequest.prototype,n=e.open,i=e.send;this.originalXhrOpen=n,this.originalXhrSend=i;let o=this,r=new WeakMap,s=function(l,c,...p){try{r.set(this,{method:l.toUpperCase(),url:Gn(c),startedAt:new Date,t0:typeof performance<"u"?performance.now():Date.now()});}catch{}return n.call(this,l,c,...p)},a=function(l){let c=r.get(this);if(c){let p=()=>{try{let h=typeof performance<"u"?performance.now():Date.now(),d=this.status;(d===0||d>=400)&&o.push({url:c.url,method:c.method,status:d,durationMs:Math.round(h-c.t0),timestamp:c.startedAt.toISOString()});}catch{}};try{this.addEventListener("loadend",p,{once:!0});}catch{try{this.addEventListener("loadend",p);}catch{}}}return i.call(this,l??null)};this.wrappedXhrOpen=s,this.wrappedXhrSend=a,e.open=s,e.send=a;}getEntries(){return this.entries.slice()}dispose(){if(!this.disposed){if(this.disposed=true,this.originalFetch&&globalThis.fetch===this.wrappedFetch)try{globalThis.fetch=this.originalFetch;}catch{}if(typeof XMLHttpRequest<"u")try{let e=XMLHttpRequest.prototype;this.originalXhrOpen&&e.open===this.wrappedXhrOpen&&(e.open=this.originalXhrOpen),this.originalXhrSend&&e.send===this.wrappedXhrSend&&(e.send=this.originalXhrSend);}catch{}}}};var fe=class{listeners=new Map;on(e,n){let i=this.listeners.get(e);return i||(i=new Set,this.listeners.set(e,i)),i.add(n),()=>{i?.delete(n);}}off(e,n){this.listeners.get(e)?.delete(n);}emit(e,...n){let i=this.listeners.get(e);if(i)for(let o of i)try{o(...n);}catch(r){console.error(`[siteping] Error in event listener for "${String(e)}":`,r);}}removeAll(){this.listeners.clear();}};var uo=54,ho=60,fo={chat:"fab.messages",annotate:"fab.annotate","toggle-annotations":"fab.annotations"},Ke=class{constructor(e,n,i,o){this.bus=i;this.t=o;let r=n.position??"bottom-right";this.items=[{id:"chat",icon:chunkKCOX2NRI_cjs.Z},{id:"annotate",icon:chunkKCOX2NRI_cjs._}],n.showAnnotationsToggle!==false&&this.items.push({id:"toggle-annotations",icon:chunkKCOX2NRI_cjs.K,iconAlt:chunkKCOX2NRI_cjs.L}),this.fab=document.createElement("button"),this.fab.className=`sp-fab sp-fab--${r} sp-anim-fab-in`,this.fab.style.position="fixed",this.fab.appendChild(chunkKCOX2NRI_cjs.x(chunkKCOX2NRI_cjs.J)),this.fab.setAttribute("aria-expanded","false"),this.fab.addEventListener("click",()=>this.toggle()),this.radialContainer=document.createElement("div"),this.radialContainer.className=`sp-radial sp-radial--${r}`,this.radialContainer.setAttribute("role","menu");for(let l=0;l<this.items.length;l++){let c=this.items[l];if(!c)continue;let p=document.createElement("button");p.className="sp-radial-item",p.style.setProperty("--sp-i",String(l)),p.appendChild(chunkKCOX2NRI_cjs.x(c.icon)),p.setAttribute("role","menuitem"),p.dataset.itemId=c.id,p.addEventListener("click",d=>{d.stopPropagation(),this.handleItemClick(c.id);});let h=document.createElement("span");h.className="sp-radial-label",p.appendChild(h),this.radialContainer.appendChild(p);}this.scrim=document.createElement("div"),this.scrim.className="sp-scrim",this.scrim.addEventListener("click",()=>this.close()),this.root=document.createElement("div"),this.root.appendChild(this.scrim),this.root.appendChild(this.radialContainer),this.root.appendChild(this.fab),e.appendChild(this.root),this.applyLabels();let s=e.host;this.onDocumentClick=l=>{this.isOpen&&!l.composedPath().includes(s)&&this.close();},document.addEventListener("click",this.onDocumentClick,true);let a=l=>{l.key==="Escape"&&this.isOpen&&(l.stopPropagation(),this.close());};this.fab.addEventListener("keydown",a),this.radialContainer.addEventListener("keydown",a),chunkKCOX2NRI_cjs.H(this.root,()=>this.isOpen),this.radialContainer.addEventListener("keydown",l=>{let c=Array.from(this.radialContainer.querySelectorAll(".sp-radial-item"));if(c.length===0||!this.isOpen)return;let p=e.activeElement??document.activeElement,h=c.indexOf(p);switch(l.key){case "ArrowUp":{l.preventDefault();let d=h<=0?c.length-1:h-1;c[d]?.focus();break}case "ArrowDown":{l.preventDefault();let d=h>=c.length-1?0:h+1;c[d]?.focus();break}case "Home":{l.preventDefault(),c[0]?.focus();break}case "End":{l.preventDefault(),c[c.length-1]?.focus();break}}});}bus;t;root;scrim;fab;radialContainer;badgeEl=null;isOpen=false;annotationsVisible=true;items;onDocumentClick;refreshLabels(){this.applyLabels();}applyLabels(){this.fab.setAttribute("aria-label",this.t("fab.aria"));let e=this.radialContainer.querySelectorAll(".sp-radial-item");for(let n of e){let i=n.dataset.itemId;if(!i)continue;let o=fo[i];if(!o)continue;let r=this.t(o);n.setAttribute("aria-label",r);let s=n.querySelector(".sp-radial-label");s&&chunkKCOX2NRI_cjs.z(s,r);}}updateBadge(e){if(e<=0){this.badgeEl?.remove(),this.badgeEl=null;return}this.badgeEl||(this.badgeEl=document.createElement("span"),this.badgeEl.className="sp-fab-badge",this.badgeEl.setAttribute("role","status"),this.badgeEl.setAttribute("aria-live","polite"),this.fab.appendChild(this.badgeEl));let n=e>99?"99+":String(e);chunkKCOX2NRI_cjs.z(this.badgeEl,n),this.badgeEl.setAttribute("aria-label",chunkKCOX2NRI_cjs.ka(this.t,"fab.badge",{count:e}));}toggle(){this.isOpen?this.close():this.open();}open(){this.isOpen=true,this.setFabIcon(chunkKCOX2NRI_cjs.M),this.fab.setAttribute("aria-expanded","true"),this.scrim.classList.add("sp-scrim--open");let e=chunkKCOX2NRI_cjs.ga()?ho:uo;this.radialContainer.querySelectorAll(".sp-radial-item").forEach((i,o)=>{let r=-(16+e*(o+1));i.style.transform=`translate(0px, ${r}px) scale(1)`,i.classList.add("sp-radial-item--open");}),requestAnimationFrame(()=>{this.radialContainer.querySelector(".sp-radial-item")?.focus();});}close(){this.isOpen=false,this.setFabIcon(chunkKCOX2NRI_cjs.J),this.fab.setAttribute("aria-expanded","false"),this.scrim.classList.remove("sp-scrim--open"),this.radialContainer.querySelectorAll(".sp-radial-item").forEach(n=>{n.style.transform="translate(0, 0) scale(0.8)",n.classList.remove("sp-radial-item--open");}),this.fab.focus();}setFabIcon(e){let n=this.badgeEl;this.fab.replaceChildren(chunkKCOX2NRI_cjs.x(e)),n&&this.fab.appendChild(n);}handleItemClick(e){switch(this.close(),e){case "chat":this.bus.emit("panel:toggle",true);break;case "annotate":{let n=this.bus.on("annotation:end",()=>{n(),this.fab.focus();});this.bus.emit("annotation:start");break}case "toggle-annotations":{this.annotationsVisible=!this.annotationsVisible,this.bus.emit("annotations:toggle",this.annotationsVisible);let i=this.radialContainer.querySelector('[data-item-id="toggle-annotations"]')?.querySelector("svg");if(i){let o=chunkKCOX2NRI_cjs.x(this.annotationsVisible?chunkKCOX2NRI_cjs.K:chunkKCOX2NRI_cjs.L);i.replaceWith(o);}break}}}destroy(){document.removeEventListener("click",this.onDocumentClick,true),this.root.remove();}};var Qn="siteping_identity";function mo(t){if(!chunkKCOX2NRI_cjs.d(t,"name")||!chunkKCOX2NRI_cjs.d(t,"email"))return false;let{name:e,email:n}=t;return typeof e=="string"&&typeof n=="string"&&e.length>0&&e.length<=chunkKCOX2NRI_cjs.e&&n.length<=chunkKCOX2NRI_cjs.e&&chunkKCOX2NRI_cjs.a(n)}function Tt(){try{let t=localStorage.getItem(Qn);if(!t)return null;let e=JSON.parse(t);return mo(e)?e:null}catch{return null}}function Jn(t){try{localStorage.setItem(Qn,JSON.stringify(t));}catch{}}function oe(t){return t.normalize("NFC").replace(/\s+/g," ").trim()}function Zn(t){return t.replace(/\s+/g," ").trim()}function bo(t,e){if(t===e)return 0;if(t.length===0)return e.length;if(e.length===0)return t.length;if(t.length>e.length){let s=t;t=e,e=s;}let n=t.length,i=e.length,o=new Array(n+1);for(let s=0;s<=n;s++)o[s]=s;let r=new Array(n+1);for(let s=1;s<=i;s++){r[0]=s;for(let l=1;l<=n;l++){let c=o[l-1];r[l]=t[l-1]===e[s-1]?c:1+Math.min(c,o[l],r[l-1]);}let a=o;o=r,r=a;}return o[n]}function me(t,e){if(t===e)return 1;let n=Math.max(t.length,e.length);return n===0?1:1-bo(t,e)/n}function go(t,e){let n=e.length,i=new Int32Array(n+1),o=new Int32Array(n+1);for(let s=0;s<=n;s++)i[s]=s;let r=n;for(let s=1;s<=t.length;s++){o[0]=0;let a=t.charCodeAt(s-1);for(let p=1;p<=n;p++){let h=i[p-1]+(e.charCodeAt(p-1)===a?0:1),d=i[p]+1,f=o[p-1]+1;o[p]=Math.min(h,d,f);}let l=o[n];l<r&&(r=l);let c=i;i=o,o=c;}return r}function ei(t,e,n=.6){if(!e||!t)return 0;if(t.includes(e))return 1;let i=t.length>500?t.slice(0,500):t;if(e.length>i.length){let r=me(i,e);return r>=n?r:0}if(e.length<8&&i.length>64)return 0;let o=1-go(i,e)/e.length;return o>=n?o:0}function ti(t){let e=new Map;for(let n=0;n<t.length-1;n++){let i=t.charCodeAt(n)<<16|t.charCodeAt(n+1);e.set(i,(e.get(i)??0)+1);}return e}function ni(t,e,n){let i=n.length-1;if(e<=0||i<=0)return 0;let o=0,r=new Map;for(let s=0;s<n.length-1;s++){let a=n.charCodeAt(s)<<16|n.charCodeAt(s+1),l=t.get(a);if(l===void 0)continue;let c=r.get(a)??0;c<l&&(r.set(a,c+1),o++);}return 2*o/(e+i)}function ii(t){let e=new Map,n=t.split(" ");for(let i=0;i<n.length-1;i++){let o=`${n[i]} ${n[i+1]}`;e.set(o,(e.get(o)??0)+1);}return e}function oi(t,e,n){if(e<=0)return 0;let i=n.split(" "),o=i.length-1;if(o<=0)return 0;let r=0,s=new Map;for(let a=0;a<i.length-1;a++){let l=`${i[a]} ${i[a+1]}`,c=t.get(l);if(c===void 0)continue;let p=s.get(l)??0;p<c&&(s.set(l,p+1),r++);}return 2*r/(e+o)}var yo={checkOpacity:true,opacityProperty:true,checkVisibilityCSS:true,visibilityProperty:true};function be(t){if(!t.isConnected)return "hidden";if(typeof t.checkVisibility=="function")return t.checkVisibility(yo)?"visible":t.checkVisibility()?"soft-hidden":"hidden";if(t.getClientRects().length>0)try{return getComputedStyle(t).visibility==="visible"?"visible":"soft-hidden"}catch{return "visible"}let e=t.firstElementChild;return e&&e.getClientRects().length>0?"visible":t.ownerDocument.documentElement.getClientRects().length===0?"unknown":"hidden"}function si(t){switch(t){case "hidden":return .3;case "soft-hidden":return .6;default:return 1}}var se={anchorKey:1,id:1,css:.95,xpath:.9,scan:.85},At=16,vo=24,ri=1e4,Mt=500,xo=.5,Ct=.6,wo=.4,Eo=2e3,Pt=.8,Rt=.6,ko=.05;function We(t,e){return oe((t??"").slice(0,Eo)).slice(0,e)}function So(t){let e=We(t.textSnippet,Mt),n=ii(e),i=0;for(let o of n.values())i+=o;return {snippet:e,snippetBigrams:ti(e),snippetBigramTotal:Math.max(0,e.length-1),snippetWordPairs:n,snippetWordPairTotal:i,prefix:We(t.textPrefix,128),suffix:We(t.textSuffix,128),neighbor:We(t.neighborText,128),fingerprint:(t.fingerprint??"").slice(0,64),tag:typeof t.elementTag=="string"?t.elementTag:""}}function To(t,e){let n=So(t),{pool:i,treeRoots:o}=Ro(t),r=[];for(let[d,f]of i){let m=ai(d,f,n);m&&r.push(m);}let s=0,a=false;for(let d of r)d.final>s&&(s=d.final),(d.strategy==="id"||d.strategy==="anchorKey")&&d.visibility===1&&(d.signals?.text??0)>=Pt&&(d.signals?.fingerprint===void 0||d.signals.fingerprint>=Pt)&&(a=true);let l=!!(n.snippet||n.fingerprint||n.prefix||n.suffix||n.neighbor),c=e?.scanBudget;if(l&&o.length>0&&s<se.scan&&!a)if(c&&c.remaining<=0)c.starved=true;else {c&&c.remaining--;for(let d of Ao(n,i,o)){let f=ai(d,"scan",n);f&&r.push(f);}}let p=r.filter(Po);if(p.length===0)return null;p.sort((d,f)=>f.final-d.final);let h=Io(p);return {element:h.element,confidence:Lo(h),strategy:h.strategy}}function je(t,e){let n=[];for(let i of t){let o=i.querySelectorAll(e);for(let r=0;r<o.length&&n.length<At;r++){let s=o[r];s&&n.push(s);}if(n.length===At)break}return n}function Co(t){let e=[],n=[document];for(let i of t){let o;try{o=je(n,i);}catch{return []}let r=[];for(let s of o)s.shadowRoot&&r.push(s.shadowRoot);if(r.length===0)return [];e.push(r),n=r;}return e}function Ro(t){let e=new Map,n=(l,c,p)=>{!l||e.has(l)||p&&l.tagName!==t.elementTag||e.set(l,c);},i=typeof t.cssSelector=="string"?t.cssSelector.split(ht):[],o=i[i.length-1]??t.cssSelector,r=i.length>1?Co(i.slice(0,-1)):null,s=r?r[r.length-1]??[]:[document],a=r?[document,...r.flat()]:s;if(t.anchorKey){let l=t.anchorKey.replace(/\\/g,"\\\\").replace(/"/g,'\\"');try{for(let c of je(a,`[${de}="${l}"]`))n(c,"anchorKey",!1);}catch{}}if(t.elementId){let l=t.elementId.replace(/\\/g,"\\\\").replace(/"/g,'\\"');try{for(let c of je(s,`[id="${l}"]`))n(c,"id",!0);}catch{for(let c of s)n(c.getElementById(t.elementId),"id",true);}}try{for(let l of je(s,o))n(l,"css",!0);}catch{}if(r)return {pool:e,treeRoots:s};try{let l=document.evaluate(t.xpath,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null),c=Math.min(l.snapshotLength,At);for(let p=0;p<c;p++){let h=l.snapshotItem(p);h instanceof Element&&n(h,"xpath",!0);}}catch{}return {pool:e,treeRoots:s}}function Ao(t,e,n){let i=t.tag.toLowerCase();if(!i)return [];let o=[];try{for(let c of n){let p=c.querySelectorAll(i);for(let h=0;h<p.length&&o.length<ri;h++){let d=p[h];d&&o.push(d);}if(o.length===ri)break}}catch{return []}let r=t.fingerprint.split(":"),s=r.length===3?Number(r[0]):Number.NaN,a=r.length===3?r[2]??"":"",l=[];for(let c of o){if(e.has(c))continue;let p=0;if(t.snippetBigramTotal>0){let h=Zn(ee(c,Mt)),d=ni(t.snippetBigrams,t.snippetBigramTotal,h);if(t.snippetWordPairTotal>0){let f=d>0?oi(t.snippetWordPairs,t.snippetWordPairTotal,h):0;p+=.6*(.5*d+.5*f);}else p+=.6*d;}if(a&&pt(c)===a&&(p+=.25),!Number.isNaN(s)){let h=Math.abs(c.children.length-s);h===0?p+=.15:h<=2&&(p+=.07);}l.push({element:c,cheap:p});}return l.sort((c,p)=>p.cheap-c.cheap),l.slice(0,vo).map(c=>c.element)}function ai(t,e,n){let i=Mo(t,n),o=si(be(t));return i===null?e==="scan"?null:{element:t,strategy:e,verification:Rt,strongest:Rt,visibility:o,final:se[e]*Rt*o,unverified:true}:{element:t,strategy:e,verification:i.blend,strongest:i.strongest,signals:i,visibility:o,final:se[e]*i.blend*o}}function Po(t){if(t.strategy==="scan")return t.verification>=wo;if(t.unverified||!t.signals)return true;let e=t.signals;return e.text===void 0||e.text>=xo?true:(e.fingerprint??0)>=Ct||(e.context??0)>=Ct||(e.neighbor??0)>=Ct}function Mo(t,e){let n=0,i=0,o={blend:0,strongest:0};if(e.snippet){i+=40;let r=oe(ee(t,Mt));o.text=ei(r,e.snippet,.5),n+=o.text*40;}if(e.fingerprint&&(i+=20,o.fingerprint=Tn(t,e.fingerprint),n+=o.fingerprint*20),e.prefix||e.suffix){i+=20;let r=0,s=0;if(e.prefix){let a=oe(te(t,"before"));r+=a?me(a,e.prefix):0,s++;}if(e.suffix){let a=oe(te(t,"after"));r+=a?me(a,e.suffix):0,s++;}s>0&&(o.context=r/s,n+=o.context*20);}if(e.neighbor){i+=20;let r=oe(Le(t));o.neighbor=r?me(r,e.neighbor):0,n+=o.neighbor*20;}return i===0?null:(o.blend=n/i,o.strongest=Math.max(o.text??0,o.fingerprint??0,o.context??0,o.neighbor??0),o)}function Io(t){let e=t[0],n=t.filter(o=>e.final-o.final<=ko&&(o===e||e.element.contains(o.element))),i=e;for(let o of n)o!==i&&i.element.contains(o.element)&&(i=o);return i}function Lo(t){return t.strategy==="scan"?Math.min(t.verification,se.scan):t.unverified?se[t.strategy]:se[t.strategy]*Math.min(1,t.strongest/Pt)}function Ye(t,e,n){let i=To(t,n);if(!i)return null;let o=i.element.getBoundingClientRect(),r=new DOMRect(o.x+e.xPct*o.width,o.y+e.yPct*o.height,e.wPct*o.width,e.hPct*o.height);return {element:i.element,rect:r,confidence:i.confidence,strategy:i.strategy}}function It(t){return {cssSelector:t.cssSelector,xpath:t.xpath,textSnippet:t.textSnippet,elementTag:t.elementTag,elementId:t.elementId??void 0,textPrefix:t.textPrefix,textSuffix:t.textSuffix,fingerprint:t.fingerprint,neighborText:t.neighborText,anchorKey:t.anchorKey??null}}function Ue(t){return {xPct:t.xPct,yPct:t.yPct,wPct:t.wPct,hPct:t.hPct}}var li=13;function ci(t){return {top:t.top+window.scrollY-li,left:t.right+window.scrollX-li}}function ge(t,e){let n=t.entries[e],i=t.elementIndices[e];if(!(!n||i===void 0))return n.elements[i]}function pi(t){let e=t.elementIndices[0];return e===void 0?void 0:t.entries[0]?.positions[e]}var di=300,ui=200,_o=3e3,No=.7,Fo=28,hi=32,qe=class{constructor(e,n,i,o,r=null){this.colors=e;this.tooltip=n;this.bus=i;this.t=o;this.liveRegion=r;this.container=chunkKCOX2NRI_cjs.y("div",{style:`position:absolute;top:0;left:0;pointer-events:none;z-index:${2147483646};`}),this.container.id="siteping-markers",chunkKCOX2NRI_cjs.F(this.container),document.body.appendChild(this.container),this.bus.on("annotations:toggle",s=>{this.container.style.display=s?"block":"none";}),this.resizeHandler=()=>this.scheduleReposition("resize"),window.addEventListener("resize",this.resizeHandler,{passive:true}),this.scrollHandler=()=>this.scheduleReposition("scroll"),window.addEventListener("scroll",this.scrollHandler,{passive:true,capture:true}),this.mutationObserver=new MutationObserver(s=>{let a=false;for(let l of s)if(!(this.container.contains(l.target)||this.tooltip.contains(l.target))){a=true;break}a&&this.scheduleReposition("mutation");}),this.mutationObserver.observe(document.body,{childList:true,subtree:true,attributes:false,characterData:false}),this.onDocumentClickForClusters=s=>{this.container.contains(s.target)||this.collapseAllClusters();},document.addEventListener("click",this.onDocumentClickForClusters,true);}colors;tooltip;bus;t;liveRegion;container;entries=[];highlightElements=[];pinnedFeedback=null;onDocumentClick=null;repositionTimer=null;mutationObserver=null;scrollHandler=null;resizeHandler=null;anchorCache=new Map;pendingLayoutChange=false;pendingResize=false;hiddenRecheckAt=new Map;clusters=[];onDocumentClickForClusters=null;lastOpenCount=-1;get count(){return this.entries.length}get openCount(){let e=0;for(let n of this.entries)chunkKCOX2NRI_cjs.h(n.feedback.status)||e++;return e}scheduleReposition(e="mutation"){e!=="scroll"&&(this.pendingLayoutChange=true),e==="resize"&&(this.pendingResize=true),!this.repositionTimer&&("requestIdleCallback"in window?this.repositionTimer=window.requestIdleCallback(()=>{this.repositionTimer=null,this.repositionAll();},{timeout:ui+100}):this.repositionTimer=+setTimeout(()=>{this.repositionTimer=null,this.repositionAll();},ui));}repositionAll(){let e=this.pendingLayoutChange,n=this.pendingResize;this.pendingLayoutChange=false,this.pendingResize=false,n&&this.hiddenRecheckAt.clear();let i=Date.now(),o={remaining:2,starved:false},r=new Set,s=false;for(let a of this.entries)for(let l=0;l<a.feedback.annotations.length;l++){let c=a.elements[l];if(!c)continue;let p=a.feedback.annotations[l];if(!p)continue;let h=`${a.feedback.id}:${l}`;r.add(h);let f=this.anchorCache.get(h)?.deref(),m,v=(this.hiddenRecheckAt.get(h)??0)>i,T=f?.isConnected&&(v||!(e&&be(f)==="hidden"));if(f&&T){let C=f.getBoundingClientRect(),E=Ue(p);m={element:f,rect:new DOMRect(C.left+E.xPct*C.width,C.top+E.yPct*C.height,E.wPct*C.width,E.hPct*C.height),confidence:1,strategy:"css"};}else v?m=null:(o.starved=false,m=Ye(It(p),Ue(p),{scanBudget:o}),o.starved||(m?.element&&this.anchorCache.set(h,new WeakRef(m.element)),!m||be(m.element)==="hidden"?this.hiddenRecheckAt.set(h,i+_o):this.hiddenRecheckAt.delete(h)));let A=c.style.display!=="none";if(!m){A&&(s=true),c.style.display="none";continue}A||(s=true),a.positions[l]=ci(m.rect),c.style.display="flex",this.applyConfidenceStyle(c,m.confidence,a.feedback);}for(let a of this.anchorCache.keys())r.has(a)||this.anchorCache.delete(a);for(let a of this.hiddenRecheckAt.keys())r.has(a)||this.hiddenRecheckAt.delete(a);s&&this.buildClusters(),this.applyClusterPositions(),this.pinnedFeedback&&this.showHighlight(this.pinnedFeedback);}applyClusterPositions(){for(let e of this.clusters)e.expanded?this.applyFanPositions(e):this.applyStackPositions(e);}emitMarkersChanged(){let e=this.openCount;e!==this.lastOpenCount&&(this.lastOpenCount=e,this.bus.emit("markers:changed",e));}render(e){this.clear(),e.forEach((n,i)=>{let o=this.buildEntry(n,i+1);this.entries.push(o);}),this.buildClusters(),this.liveRegion&&this.entries.length>0&&(this.liveRegion.textContent=chunkKCOX2NRI_cjs.ka(this.t,"marker.count",{count:this.entries.length})),this.emitMarkersChanged();}addFeedback(e,n){let i=this.buildEntry(e,n);for(let o of i.elements)o.style.animation="sp-marker-in 0.35s cubic-bezier(0.34,1.56,0.64,1) both";this.entries.push(i),this.buildClusters(),this.emitMarkersChanged();}buildEntry(e,n){let i={feedback:e,elements:[],positions:[]};for(let o of e.annotations){let r=Ye(It(o),Ue(o)),s=r?ci(r.rect):{top:0,left:0},a=this.createMarker(n,e,s);r?this.applyConfidenceStyle(a,r.confidence,e):a.style.display="none",this.container.appendChild(a),i.elements.push(a),i.positions.push(s);}return i}buildClusters(){for(let i of this.container.querySelectorAll(".sp-cluster-badge"))i.remove();let e=[];for(let i of this.entries)for(let o=0;o<i.elements.length;o++){let r=i.positions[o];!r||i.elements[o]?.style.display==="none"||e.push({entry:i,elIdx:o,pos:r});}let n=new Set;this.clusters=[];for(let i=0;i<e.length;i++){if(n.has(i))continue;let o=e[i];if(!o)continue;let r={entries:[o.entry],elementIndices:[o.elIdx],expanded:false};n.add(i);for(let s=i+1;s<e.length;s++){if(n.has(s))continue;let a=o.pos,l=e[s];if(!l)continue;let c=l.pos;Math.sqrt((a.left-c.left)**2+(a.top-c.top)**2)<Fo&&(r.entries.push(l.entry),r.elementIndices.push(l.elIdx),n.add(s));}this.clusters.push(r);}for(let i of this.clusters)i.entries.length<=1||(this.applyStackPositions(i),this.addClusterBadge(i));}applyStackPositions(e){let n=pi(e);if(!n)return;let{top:i,left:o}=n,r=e.entries.length<=1;for(let s=0;s<e.entries.length;s++){let a=ge(e,s);a&&(a.style.top=`${i+(r?0:s*3)}px`,a.style.left=`${o+(r?0:s*3)}px`,a.style.zIndex=String(s+1));}}applyFanPositions(e){let n=pi(e);if(!n)return;let{top:i,left:o}=n,r=e.entries.length,s=(r-1)*hi,a=o-s/2;for(let l=0;l<r;l++){let c=ge(e,l);c&&(c.style.top=`${i}px`,c.style.left=`${a+l*hi}px`,c.style.zIndex=String(10+l));}}addClusterBadge(e){let n=ge(e,e.entries.length-1);if(!n)return;let i=chunkKCOX2NRI_cjs.y("div",{class:"sp-cluster-badge",style:`position:absolute;top:-6px;right:-6px;min-width:16px;height:16px;padding:0 4px;border-radius:9999px;background:${this.colors.accent};color:#fff;font-size:10px;font-weight:700;display:flex;align-items:center;justify-content:center;border:1.5px solid #fff;pointer-events:none;font-family:"Inter",system-ui,-apple-system,sans-serif;line-height:1;`});chunkKCOX2NRI_cjs.z(i,String(e.entries.length)),n.appendChild(i);}setBadgesVisible(e,n){for(let i=0;i<e.entries.length;i++){let o=ge(e,i)?.querySelector(".sp-cluster-badge");o&&(o.style.display=n?"flex":"none");}}findCluster(e){for(let n of this.clusters)if(!(n.entries.length<=1)){for(let i=0;i<n.entries.length;i++)if(ge(n,i)===e)return n}return null}handleClusterClick(e,n){let i=this.findCluster(e);return i?i.expanded?false:(n.stopPropagation(),this.collapseAllClusters(),i.expanded=true,this.applyFanPositions(i),this.setBadgesVisible(i,false),true):false}collapseCluster(e){e.expanded&&(e.expanded=false,this.applyStackPositions(e),this.setBadgesVisible(e,true));}collapseAllClusters(){for(let e of this.clusters)this.collapseCluster(e);}applyConfidenceStyle(e,n,i){let o=chunkKCOX2NRI_cjs.h(i.status);n<No&&!o?(e.style.borderStyle="dashed",e.style.opacity="0.7",e.title=chunkKCOX2NRI_cjs.ka(this.t,"marker.approximate",{confidence:Math.round(n*100)})):(e.style.borderStyle="solid",e.style.opacity="1",e.title="");}createMarker(e,n,i){let o=chunkKCOX2NRI_cjs.aa(n.type,this.colors),r=chunkKCOX2NRI_cjs.h(n.status),s=chunkKCOX2NRI_cjs.y("div",{style:`position:absolute;top:${i.top}px;left:${i.left}px;width:26px;height:26px;border-radius:50%;background:${r?"rgba(241,245,249,0.9)":"rgba(255,255,255,0.92)"};border:2px solid ${r?"#cbd5e1":o};display:flex;align-items:center;justify-content:center;font-family:"Inter",system-ui,-apple-system,sans-serif;font-size:11px;font-weight:700;color:${r?"#94a3b8":o};cursor:pointer;pointer-events:auto;box-shadow:${r?"0 2px 8px rgba(0,0,0,0.06)":`0 2px 12px ${o}25, 0 2px 6px rgba(0,0,0,0.06)`};transition:top 0.25s cubic-bezier(0.34,1.56,0.64,1),left 0.25s cubic-bezier(0.34,1.56,0.64,1),transform 0.15s ease,box-shadow 0.15s ease;user-select:none;-webkit-font-smoothing:antialiased;`});s.dataset.feedbackId=n.id,s.setAttribute("tabindex","0"),s.setAttribute("role","button");let a=n.message.length>60?`${n.message.slice(0,60)}...`:n.message,l=chunkKCOX2NRI_cjs.ka(this.t,"marker.aria",{number:e,type:chunkKCOX2NRI_cjs.la(n.type,this.t),message:a});s.setAttribute("aria-label",l),s.setAttribute("aria-describedby",this.tooltip.tooltipId),chunkKCOX2NRI_cjs.z(s,r?"\u2713":String(e)),chunkKCOX2NRI_cjs.ga()&&s.appendChild(chunkKCOX2NRI_cjs.y("span",{style:"position:absolute;inset:-9px;border-radius:50%;"})),s.addEventListener("mouseenter",()=>{s.style.transform="scale(1.2)",s.style.boxShadow=r?"0 4px 16px rgba(0,0,0,0.1)":`0 4px 20px ${o}35, 0 4px 12px rgba(0,0,0,0.08)`,this.tooltip.show(n,s.getBoundingClientRect()),this.pinnedFeedback||this.showHighlight(n);}),s.addEventListener("mouseleave",()=>{s.style.transform="scale(1)",s.style.boxShadow=r?"0 2px 8px rgba(0,0,0,0.06)":`0 2px 12px ${o}25, 0 2px 6px rgba(0,0,0,0.06)`,this.tooltip.scheduleHide(),this.pinnedFeedback||this.clearHighlight();}),s.addEventListener("focus",()=>{this.tooltip.show(n,s.getBoundingClientRect()),this.pinnedFeedback||this.showHighlight(n);}),s.addEventListener("blur",()=>{this.tooltip.scheduleHide(),this.pinnedFeedback||this.clearHighlight();});let c=p=>{p instanceof MouseEvent&&this.handleClusterClick(s,p)||(chunkKCOX2NRI_cjs.fa()&&this.tooltip.hide(),this.pinHighlight(n),this.bus.emit("panel:toggle",true),s.dispatchEvent(new CustomEvent("sp-marker-click",{detail:{feedbackId:n.id},bubbles:true})));};return s.addEventListener("click",p=>c(p)),s.addEventListener("keydown",p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),c(p));}),s}focusFeedback(e){let n=this.entries.find(o=>o.feedback.id===e);if(!n)return false;let i=n.elements.find(o=>o.style.display!=="none");return i&&i.scrollIntoView({behavior:"smooth",block:"center"}),this.pinHighlight(n.feedback),this.highlight(e),true}revealPin(e){return this.container.style.display!=="none"&&this.entries.some(n=>n.feedback.id===e&&n.elements.some(i=>i.style.display!=="none"))&&this.focusFeedback(e)}highlight(e){for(let n of this.entries)if(n.feedback.id===e)for(let i of n.elements)i.style.animation="sp-pulse-ring 0.7s ease-out",i.addEventListener("animationend",()=>{i.style.animation="";},{once:true});}showHighlight(e){this.removeHighlightElements();for(let n of e.annotations){let i=Ye(It(n),Ue(n));if(!i)continue;let o=chunkKCOX2NRI_cjs.aa(e.type,this.colors),r=i.rect,s=chunkKCOX2NRI_cjs.y("div",{style:`position:absolute;top:${r.top+window.scrollY}px;left:${r.left+window.scrollX}px;width:${r.width}px;height:${r.height}px;border:2px solid ${o};background:${o}0c;border-radius:8px;pointer-events:none;z-index:-1;opacity:0;box-shadow:0 0 16px ${o}20;transition:opacity ${di}ms ease;`});this.container.appendChild(s),this.highlightElements.push(s),s.offsetHeight,s.style.opacity="1";}}pinHighlight(e){this.unpinHighlight(),this.showHighlight(e),this.pinnedFeedback=e,this.onDocumentClick=n=>{this.container.contains(n.target)||this.unpinHighlight();},document.addEventListener("click",this.onDocumentClick,{capture:true});}unpinHighlight(){this.onDocumentClick&&(document.removeEventListener("click",this.onDocumentClick,{capture:true}),this.onDocumentClick=null),this.pinnedFeedback=null,this.clearHighlight();}clearHighlight(){for(let e of this.highlightElements)e.style.opacity="0",setTimeout(()=>e.remove(),di);this.highlightElements=[];}removeHighlightElements(){for(let e of this.highlightElements)e.remove();this.highlightElements=[];}clear(){this.unpinHighlight(),this.container.replaceChildren(),this.entries=[],this.clusters=[],this.anchorCache.clear();}destroy(){this.unpinHighlight(),this.repositionTimer&&("cancelIdleCallback"in window&&window.cancelIdleCallback(this.repositionTimer),clearTimeout(this.repositionTimer)),this.resizeHandler&&window.removeEventListener("resize",this.resizeHandler),this.scrollHandler&&window.removeEventListener("scroll",this.scrollHandler,{capture:true}),this.onDocumentClickForClusters&&document.removeEventListener("click",this.onDocumentClickForClusters,true),this.mutationObserver?.disconnect(),this.container.remove();}};var fi=3e4,Ve=class{constructor(e,n){this.store=e;this.projectName=n;}store;projectName;async sendFeedback(e){return Lt(await mi(this.write(e),"Failed to send feedback"))}async write(e){try{return await this.store.createFeedback({projectName:e.projectName,type:e.type,message:e.message,status:"open",url:e.url,urlPattern:e.urlPattern??null,viewport:e.viewport,userAgent:e.userAgent,authorName:e.authorName,authorEmail:e.authorEmail,clientId:e.clientId,annotations:e.annotations.map(chunkKCOX2NRI_cjs.l),screenshotDataUrl:e.screenshotDataUrl??null,screenshotRegion:e.screenshotRegion??null,diagnostics:e.diagnostics??null})}catch(n){if(!chunkKCOX2NRI_cjs.k(n))throw n;let i=await this.store.findByClientId(e.clientId);if(!i||i.projectName!==e.projectName)throw n;return i}}async getFeedbacks(e,n){let{feedbacks:i,total:o}=await this.store.getFeedbacks({projectName:e,page:n?.page,limit:n?.limit,type:n?.type,status:n?.status,statuses:n?.statuses,search:n?.search,url:n?.url,urlPattern:n?.urlPattern});return {feedbacks:i.map(Lt),total:o,capabilities:{comments:!!this.store.addComment}}}async resolveFeedback(e,n){let i=await this.store.updateFeedback(e,chunkKCOX2NRI_cjs.i(n?"resolved":"open"));return Lt(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 chunkKCOX2NRI_cjs.b(`${i}: this store keeps no comments`,"SERVER",false);return bi(await mi(this.store.addComment(e,n),i))}};function mi(t,e){return vt(t,fi,()=>new chunkKCOX2NRI_cjs.b(`${e}: the store did not answer within ${fi/1e3} s`,"TIMEOUT",true))}function Lt(t){return {id:t.id,projectName:t.projectName,type:t.type,message:t.message,status:t.status,url:t.url,urlPattern:t.urlPattern??null,viewport:t.viewport,userAgent:t.userAgent,authorName:t.authorName,authorEmail:t.authorEmail,resolvedAt:t.resolvedAt?.toISOString()??null,createdAt:t.createdAt.toISOString(),updatedAt:t.updatedAt.toISOString(),annotations:t.annotations.map(Oo),comments:t.comments?.map(bi),screenshotUrl:t.screenshotUrl??null,screenshotRegion:t.screenshotRegion??null,diagnostics:t.diagnostics??null}}function bi({clientId:t,createdAt:e,...n}){return {...n,createdAt:e.toISOString()}}function Oo(t){return {id:t.id,feedbackId:t.feedbackId,cssSelector:t.cssSelector,xpath:t.xpath,textSnippet:t.textSnippet,elementTag:t.elementTag,elementId:t.elementId,textPrefix:t.textPrefix,textSuffix:t.textSuffix,fingerprint:t.fingerprint,neighborText:t.neighborText,anchorKey:t.anchorKey??null,xPct:t.xPct,yPct:t.yPct,wPct:t.wPct,hPct:t.hPct,scrollX:t.scrollX,scrollY:t.scrollY,viewportW:t.viewportW,viewportH:t.viewportH,devicePixelRatio:t.devicePixelRatio,createdAt:t.createdAt.toISOString()}}var Ho="linear(0, 0.006, 0.025, 0.06, 0.11, 0.17, 0.25, 0.34, 0.45, 0.56, 0.67, 0.78, 0.88, 0.95, 1.01, 1.04, 1.05, 1.04, 1.02, 1, 0.99, 1)",_t="cubic-bezier(0.16, 1, 0.3, 1)",Nt="cubic-bezier(0.34, 1.56, 0.64, 1)",Do="cubic-bezier(0.25, 1, 0.5, 1)",gi=`@keyframes sp-fab-in{from{transform:scale(0) rotate(-180deg);opacity:0;}to{transform:scale(1) rotate(0deg);opacity:1;}}@keyframes sp-fab-glow{0%,100%{box-shadow:0 4px 20px var(--sp-accent-glow),0 2px 8px rgba(0,0,0,0.08);}50%{box-shadow:0 4px 28px var(--sp-accent-glow),0 2px 12px rgba(0,0,0,0.1);}}@keyframes sp-marker-in{0%{transform:scale(0);opacity:0;}60%{transform:scale(1.2);opacity:1;}100%{transform:scale(1);}}@keyframes sp-pulse-ring{0%{box-shadow:0 0 0 0 var(--sp-accent-glow);}70%{box-shadow:0 0 0 8px transparent;}100%{box-shadow:0 0 0 0 transparent;}}@keyframes sp-flash-bg{0%{background-color:var(--sp-accent-light);}100%{background-color:transparent;}}@keyframes sp-slide-up{from{transform:translateY(8px);opacity:0;}to{transform:translateY(0);opacity:1;}}@keyframes sp-fade-in{from{opacity:0;}to{opacity:1;}}@keyframes sp-shimmer{0%{background-position:-200% 0;}100%{background-position:200% 0;}}.sp-anim-fab-in{animation:sp-fab-in 0.5s ${Ho} both;}.sp-anim-marker-in{animation:sp-marker-in 0.35s ${Nt} both;}.sp-anim-pulse{animation:sp-pulse-ring 0.7s ease-out;}.sp-anim-flash{animation:sp-flash-bg 0.5s ${Do};}.sp-anim-slide-up{animation:sp-slide-up 0.3s ${_t} both;}.sp-anim-fade-in{animation:sp-fade-in 0.2s ease-out both;}.sp-panel{transform:translateX(110%);transition:transform 0.4s ${_t};}.sp-panel.sp-panel--open{transform:translateX(0);}.sp-radial-item{opacity:0;pointer-events:none;transform:translate(0,0) scale(0.8);transition:transform 0.35s ${Nt},opacity 0.2s ease,background 0.2s ease,border-color 0.2s ease,box-shadow 0.2s ease;}.sp-radial-item.sp-radial-item--open{opacity:1;pointer-events:auto;}.sp-radial-item{transition-delay:calc(var(--sp-i, 0) * 50ms);}@keyframes sp-card-in{from{transform:translateY(12px);opacity:0;}to{transform:translateY(0);opacity:1;}}.sp-card{animation:sp-card-in 0.35s ${_t} both;animation-delay:calc(var(--sp-card-i, 0) * 40ms);}@keyframes sp-spin{to{transform:rotate(360deg);}}.sp-spinner{width:20px;height:20px;border:2px solid var(--sp-border);border-top-color:var(--sp-accent);border-radius:50%;animation:sp-spin 0.6s linear infinite;}@keyframes sp-badge-in{0%{transform:scale(0);}60%{transform:scale(1.3);}100%{transform:scale(1);}}.sp-fab-badge{animation:sp-badge-in 0.4s ${Nt} both;}@media (prefers-reduced-motion: reduce){*,*::before,*::after{animation-duration:0.01ms !important;animation-iteration-count:1 !important;transition-duration:0.01ms !important;}}`;var yi=`:host{-webkit-tap-highlight-color:transparent;}.sp-list,.sp-detail-content{overscroll-behavior:contain;}.sp-scrim{display:none;}@media (hover: none){.sp-fab:hover:not(:active),.sp-card:hover:not(:active),.sp-btn-primary:hover:not(:active),.sp-btn-danger:hover:not(:active){transform:none;}.sp-card:hover:not(:active){box-shadow:var(--sp-shadow-xs);}.sp-radial-item--open .sp-radial-label{opacity:1;transform:translate(0,-50%);}.sp-bulk-checkbox{opacity:1;}.sp-bulk-checkbox::after{content:"";position:absolute;inset:-12px;}.sp-bulk-select-all{display:none;}.sp-list--has-selection .sp-bulk-select-all{display:flex;}.sp-shortcuts-hint{display:none;}}@media (pointer: coarse){.sp-radial-item{width:48px;height:48px;left:2px;bottom:2px;}.sp-radial-item svg{width:20px;height:20px;}.sp-radial-label{font-size:13px;font-weight:600;padding:8px 12px;}.sp-search,.sp-input{font-size:16px;}.sp-filter-dropdown-btn{height:36px;}.sp-segmented__btn{height:32px;}.sp-sort-btn,.sp-group-toggle,.sp-mine-toggle{min-height:36px;}.sp-btn-resolve,.sp-btn-delete{min-height:40px;}.sp-detail-back{width:44px;height:44px;}.sp-detail-actions button,.sp-detail-actions a{height:44px;}}@media ${chunkKCOX2NRI_cjs.w}{.sp-fab--bottom-right,.sp-radial--bottom-right{right:calc(16px + env(safe-area-inset-right,0px));bottom:calc(16px + env(safe-area-inset-bottom,0px));}.sp-fab--bottom-left,.sp-radial--bottom-left{left:calc(16px + env(safe-area-inset-left,0px));bottom:calc(16px + env(safe-area-inset-bottom,0px));}.sp-scrim{display:block;position:fixed;inset:0;background:var(--sp-scrim);opacity:0;pointer-events:none;touch-action:none;transition:opacity 0.3s ease;}.sp-scrim--open{opacity:1;pointer-events:auto;}.sp-panel{top:auto;left:0;right:0;bottom:0;width:auto;max-width:none;height:calc(100vh - 48px);height:calc(100dvh - 40px - env(safe-area-inset-top,0px));border-left:none;border-top:1px solid var(--sp-glass-border);border-radius:var(--sp-radius-xl) var(--sp-radius-xl) 0 0;background:var(--sp-bg);-webkit-backdrop-filter:none;backdrop-filter:none;transform:translateY(105%);}.sp-panel.sp-panel--open{transform:translateY(0);}.sp-panel-header,.sp-detail-header{position:relative;padding-top:22px;background:var(--sp-bg);-webkit-backdrop-filter:none;backdrop-filter:none;touch-action:none;}.sp-panel-header{padding:22px 12px 12px 20px;}.sp-panel-header::before,.sp-detail-header::before{content:"";position:absolute;top:8px;left:50%;width:36px;height:5px;margin-left:-18px;border-radius:3px;background:var(--sp-border);}.sp-export-btn,.sp-btn-delete-all{width:40px;height:40px;padding:0;justify-content:center;border-radius:var(--sp-radius);}.sp-export-btn svg,.sp-btn-delete-all svg{width:17px;height:17px;}.sp-export-btn span,.sp-btn-delete-all span{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;}.sp-stats-bar{padding:10px 20px;}.sp-filters{padding:12px 16px 10px;background:var(--sp-bg);-webkit-backdrop-filter:none;backdrop-filter:none;}.sp-stats-bar,.sp-filters{touch-action:pan-x;}.sp-search{height:44px;}.sp-filter-bar{flex-wrap:nowrap;overflow-x:auto;margin:0 -16px 8px;padding:0 16px 2px;scrollbar-width:none;}.sp-filter-bar::-webkit-scrollbar{display:none;}.sp-filter-dropdown{flex:0 0 auto;}.sp-filter-dropdown-btn{width:auto;}.sp-filter-dropdown-menu,.sp-sort-menu{position:fixed;top:auto;left:12px;right:12px;bottom:calc(12px + env(safe-area-inset-bottom,0px));min-width:0;padding:6px;border-radius:var(--sp-radius-lg);background:var(--sp-bg);-webkit-backdrop-filter:none;backdrop-filter:none;box-shadow:var(--sp-shadow-xl);z-index:30;}.sp-filter-dropdown-option,.sp-sort-option{min-height:44px;font-size:14px;}.sp-list{padding:10px 12px calc(12px + env(safe-area-inset-bottom,0px));}.sp-bulk-bar{bottom:calc(16px + env(safe-area-inset-bottom,0px));}.sp-detail{background:var(--sp-bg);-webkit-backdrop-filter:none;backdrop-filter:none;}.sp-detail-section{padding:18px 20px;}.sp-detail-content{padding-bottom:env(safe-area-inset-bottom,0px);}.sp-identity-backdrop{align-items:flex-end;}.sp-identity-modal{width:100%;max-width:none;margin-bottom:var(--sp-kb, 0px);padding:24px 20px calc(20px + env(safe-area-inset-bottom,0px));border-radius:var(--sp-radius-xl) var(--sp-radius-xl) 0 0;background:var(--sp-bg);transform:translateY(100%);}.sp-identity-actions button{flex:1;height:48px;}.sp-identity-actions .sp-btn-primary{flex:2;}}`;function Ft(t){return `:host{all:initial;position:fixed;z-index:${2147483647};font-family:var(--sp-font);font-size:14px;line-height:1.5;color:var(--sp-text);color-scheme:${t.bg==="#ffffff"?"light":"dark"};-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;${chunkKCOX2NRI_cjs.ea(t)} --sp-identity-bg: ${t.glassBgHeavy};--sp-identity-overlay: ${t.bg==="#ffffff"?"rgba(15, 23, 42, 0.2)":"rgba(0, 0, 0, 0.4)"};--sp-scrim: ${t.bg==="#ffffff"?"rgba(15, 23, 42, 0.32)":"rgba(0, 0, 0, 0.5)"};}*,*::before,*::after{box-sizing:border-box;margin:0;padding:0;}:focus-visible{outline:2px solid var(--sp-accent);outline-offset:2px;box-shadow:0 0 0 4px var(--sp-bg);}.sp-fab{position:fixed;width:52px;height:52px;border-radius:var(--sp-radius-full);background:var(--sp-accent-gradient);color:#fff;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:0 4px 20px var(--sp-accent-glow),0 2px 8px rgba(0,0,0,0.08);transition:transform 0.25s cubic-bezier(0.34,1.56,0.64,1),box-shadow 0.3s ease;outline:none;}.sp-fab:focus-visible{outline:2px solid #fff;outline-offset:3px;}.sp-fab:hover{transform:translateY(-2px) scale(1.05);box-shadow:0 8px 28px var(--sp-accent-glow),0 4px 12px rgba(0,0,0,0.1);}.sp-fab:active{transform:translateY(0) scale(0.95);transition-duration:0.1s;}.sp-fab--bottom-right{bottom:24px;right:24px;}.sp-fab--bottom-left{bottom:24px;left:24px;}.sp-fab svg{width:22px;height:22px;fill:currentColor;transition:transform 0.3s cubic-bezier(0.34,1.56,0.64,1);}.sp-fab-badge{position:absolute;top:-4px;right:-4px;min-width:20px;height:20px;padding:0 6px;border-radius:var(--sp-radius-full);background:#ef4444;color:#fff;font-size:11px;font-weight:700;display:flex;align-items:center;justify-content:center;border:2px solid #fff;pointer-events:none;font-family:var(--sp-font);line-height:1;}.sp-radial{position:fixed;pointer-events:none;width:52px;height:52px;}.sp-radial--bottom-right{bottom:24px;right:24px;}.sp-radial--bottom-left{bottom:24px;left:24px;}.sp-radial-item{position:absolute;left:4px;bottom:4px;width:44px;height:44px;border-radius:var(--sp-radius-full);background:var(--sp-glass-bg-heavy);backdrop-filter:blur(var(--sp-blur));-webkit-backdrop-filter:blur(var(--sp-blur));color:var(--sp-text);border:1px solid var(--sp-glass-border);cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:var(--sp-shadow-md);font-size:12px;font-weight:600;}.sp-radial-item:hover,.sp-radial-item:focus-visible{background:rgba(255,255,255,0.95);border-color:var(--sp-accent);color:var(--sp-accent);box-shadow:var(--sp-shadow-md),0 0 0 3px var(--sp-accent-light);outline:none;}.sp-radial-item svg{width:18px;height:18px;flex-shrink:0;stroke:currentColor;fill:none;}.sp-radial-label{position:absolute;top:50%;white-space:nowrap;font-size:12px;font-weight:500;color:var(--sp-text);pointer-events:none;opacity:0;padding:4px 12px;border-radius:var(--sp-radius);background:var(--sp-glass-bg-heavy);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);border:1px solid var(--sp-glass-border);box-shadow:var(--sp-shadow-sm);transform:translate(4px,-50%);transition:opacity 0.2s ease,transform 0.2s ease;}.sp-radial--bottom-right .sp-radial-label{right:calc(100% + 12px);}.sp-radial--bottom-left .sp-radial-label{left:calc(100% + 12px);transform:translate(-4px,-50%);}.sp-radial-item:hover .sp-radial-label,.sp-radial-item:focus-visible .sp-radial-label{opacity:1;transform:translate(0,-50%);}.sp-panel{position:fixed;top:0;right:0;width:400px;max-width:100vw;height:100vh;height:100dvh;background:var(--sp-glass-bg);backdrop-filter:blur(var(--sp-blur-heavy));-webkit-backdrop-filter:blur(var(--sp-blur-heavy));border-left:1px solid var(--sp-glass-border);box-shadow:var(--sp-shadow-xl);display:flex;flex-direction:column;overflow:hidden;}.sp-panel-header{display:flex;align-items:center;justify-content:space-between;padding:20px 24px;border-bottom:1px solid var(--sp-border);background:var(--sp-glass-bg-heavy);backdrop-filter:blur(var(--sp-blur));-webkit-backdrop-filter:blur(var(--sp-blur));position:relative;z-index:2;}.sp-panel-title{font-size:17px;font-weight:700;color:var(--sp-text);letter-spacing:-0.02em;}.sp-panel-close{width:44px;height:44px;border-radius:var(--sp-radius);border:none;background:transparent;cursor:pointer;display:flex;align-items:center;justify-content:center;color:var(--sp-text-tertiary);transition:all 0.2s ease;}.sp-panel-close:hover{background:var(--sp-bg-hover);color:var(--sp-text);}.sp-panel-close svg{width:16px;height:16px;}.sp-filters{padding:16px 24px;border-bottom:1px solid var(--sp-border);background:var(--sp-glass-bg-heavy);backdrop-filter:blur(var(--sp-blur));-webkit-backdrop-filter:blur(var(--sp-blur));position:sticky;top:0;z-index:1;}.sp-search-wrap{position:relative;margin-bottom:12px;}.sp-search{width:100%;height:40px;padding:0 12px 0 38px;border-radius:var(--sp-radius);border:1px solid var(--sp-border);background:var(--sp-glass-bg-heavy);color:var(--sp-text);font-family:var(--sp-font);font-size:13px;outline:none;transition:all 0.2s ease;}.sp-search::placeholder{color:var(--sp-text-tertiary);}.sp-search:focus{border-color:var(--sp-accent);box-shadow:0 0 0 3px var(--sp-accent-light);background:var(--sp-bg);}.sp-search-icon{position:absolute;left:12px;top:50%;transform:translateY(-50%);color:var(--sp-text-tertiary);width:16px;height:16px;transition:color 0.2s ease;}.sp-search:focus ~ .sp-search-icon,.sp-search-wrap:focus-within .sp-search-icon{color:var(--sp-accent);}.sp-filter-bar{display:flex;align-items:center;gap:8px;margin-bottom:8px;flex-wrap:wrap;}.sp-filter-dropdown{position:relative;flex:1 1 auto;min-width:0;}.sp-filter-dropdown-btn{--sp-chip-color: var(--sp-text-secondary);--sp-chip-bg: var(--sp-glass-bg-heavy);display:inline-flex;align-items:center;gap:8px;width:100%;height:32px;padding:0 8px 0 10px;border-radius:var(--sp-radius-full);border:1px solid var(--sp-border);background:var(--sp-glass-bg-heavy);color:var(--sp-text);font-family:var(--sp-font);font-size:12px;font-weight:500;cursor:pointer;white-space:nowrap;transition:background 0.18s ease,border-color 0.18s ease,box-shadow 0.18s ease;}.sp-filter-dropdown-btn:hover{border-color:var(--sp-chip-color);background:var(--sp-chip-bg);}.sp-filter-dropdown-btn[aria-expanded="true"]{border-color:var(--sp-chip-color);background:var(--sp-chip-bg);box-shadow:0 0 0 3px color-mix(in srgb,var(--sp-chip-color) 14%,transparent);}.sp-filter-dropdown-btn--filtered{border-color:var(--sp-chip-color);background:var(--sp-chip-bg);}.sp-filter-dropdown-btn__icon{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;flex-shrink:0;color:var(--sp-chip-color);}.sp-filter-dropdown-btn__icon svg{width:14px;height:14px;}.sp-filter-dropdown-btn__label{display:inline-flex;align-items:baseline;gap:6px;flex:1;min-width:0;overflow:hidden;}.sp-filter-dropdown-btn__prefix{color:var(--sp-text-tertiary);font-weight:500;font-size:11px;text-transform:uppercase;letter-spacing:0.06em;}.sp-filter-dropdown-btn__value{color:var(--sp-chip-color);font-weight:600;overflow:hidden;text-overflow:ellipsis;}.sp-filter-dropdown-btn__chevron{display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex-shrink:0;color:var(--sp-text-tertiary);transition:transform 0.18s ease,color 0.18s ease;}.sp-filter-dropdown-btn__chevron svg{width:12px;height:12px;}.sp-filter-dropdown-btn[aria-expanded="true"] .sp-filter-dropdown-btn__chevron{transform:rotate(180deg);color:var(--sp-chip-color);}.sp-filter-dropdown-menu{position:absolute;top:calc(100% + 6px);left:0;right:0;min-width:180px;padding:4px;border-radius:var(--sp-radius);background:var(--sp-glass-bg-heavy);backdrop-filter:blur(var(--sp-blur-heavy));-webkit-backdrop-filter:blur(var(--sp-blur-heavy));border:1px solid var(--sp-glass-border);box-shadow:var(--sp-shadow-md);z-index:10;animation:sp-filter-menu-in 0.15s ease-out both;}@keyframes sp-filter-menu-in{from{opacity:0;transform:translateY(-4px) scale(0.98);}to{opacity:1;transform:translateY(0) scale(1);}}.sp-filter-dropdown-option{--sp-chip-color: var(--sp-text-secondary);--sp-chip-bg: transparent;display:flex;align-items:center;gap:10px;width:100%;padding:8px 10px;border:none;border-radius:8px;background:transparent;color:var(--sp-text);font-family:var(--sp-font);font-size:12px;font-weight:500;cursor:pointer;text-align:left;transition:background 0.12s ease,color 0.12s ease;}.sp-filter-dropdown-option__icon{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;flex-shrink:0;border-radius:6px;background:var(--sp-chip-bg);color:var(--sp-chip-color);}.sp-filter-dropdown-option__icon svg{width:13px;height:13px;}.sp-filter-dropdown-option__label{flex:1;min-width:0;}.sp-filter-dropdown-option__check{display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex-shrink:0;color:var(--sp-chip-color);}.sp-filter-dropdown-option__check svg{width:13px;height:13px;}.sp-filter-dropdown-option:hover{background:var(--sp-bg-hover);}.sp-filter-dropdown-option--active{color:var(--sp-chip-color);font-weight:600;}.sp-filter-dropdown-option--active:hover{background:var(--sp-chip-bg);}.sp-segmented{display:inline-flex;align-items:stretch;padding:2px;border-radius:var(--sp-radius-full);border:1px solid var(--sp-border);background:var(--sp-glass-bg-heavy);flex-shrink:0;}.sp-segmented__btn{--sp-chip-color: var(--sp-text-tertiary);--sp-chip-bg: transparent;display:inline-flex;align-items:center;gap:5px;height:26px;padding:0 10px;border:none;border-radius:var(--sp-radius-full);background:transparent;color:var(--sp-text-secondary);font-family:var(--sp-font);font-size:12px;font-weight:500;cursor:pointer;white-space:nowrap;transition:background 0.18s ease,color 0.18s ease,box-shadow 0.18s ease;}.sp-segmented__icon{display:inline-flex;align-items:center;justify-content:center;width:13px;height:13px;flex-shrink:0;color:var(--sp-chip-color);transition:color 0.18s ease,transform 0.18s ease;}.sp-segmented__icon svg{width:13px;height:13px;}.sp-segmented__btn:hover{color:var(--sp-chip-color);}.sp-segmented__btn:hover .sp-segmented__icon{color:var(--sp-chip-color);}.sp-segmented__btn--active{background:var(--sp-chip-bg);color:var(--sp-chip-color);font-weight:600;box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--sp-chip-color) 35%,transparent),0 1px 2px rgba(0,0,0,0.04);}.sp-segmented__btn--active .sp-segmented__icon{color:var(--sp-chip-color);}.sp-segmented__btn--open.sp-segmented__btn--active .sp-segmented__icon{animation:sp-segmented-pulse 2.4s ease-in-out infinite;}@keyframes sp-segmented-pulse{0%,100%{transform:scale(1);}50%{transform:scale(0.85);}}@media (prefers-reduced-motion: reduce){.sp-filter-dropdown-btn,.sp-filter-dropdown-btn__chevron,.sp-filter-dropdown-option,.sp-segmented__btn,.sp-segmented__icon{transition:none;}.sp-filter-dropdown-menu{animation:none;}.sp-segmented__btn--open.sp-segmented__btn--active .sp-segmented__icon{animation:none;}}.sp-list{flex:1;overflow-y:auto;padding:8px 12px;}.sp-list::-webkit-scrollbar{width:6px;}.sp-list::-webkit-scrollbar-track{background:transparent;}.sp-list::-webkit-scrollbar-thumb{background:var(--sp-border);border-radius:var(--sp-radius-full);}.sp-list::-webkit-scrollbar-thumb:hover{background:var(--sp-text-tertiary);}.sp-card{display:flex;padding:14px 16px;margin-bottom:6px;cursor:pointer;border-radius:var(--sp-radius);background:var(--sp-glass-bg-heavy);border:1px solid var(--sp-glass-border);box-shadow:var(--sp-shadow-xs);transition:all 0.2s cubic-bezier(0.34,1.56,0.64,1);}.sp-card:hover{background:var(--sp-bg);border-color:var(--sp-border);box-shadow:var(--sp-shadow-md);transform:translateY(-2px);}.sp-card:active{transform:translateY(0) scale(0.99);transition-duration:0.1s;}.sp-card-bar{width:3px;border-radius:var(--sp-radius-full);margin-right:14px;flex-shrink:0;}.sp-card-body{flex:1;min-width:0;}.sp-card-header{display:flex;align-items:center;gap:8px;margin-bottom:6px;}.sp-card-number{font-size:12px;font-weight:700;color:var(--sp-text-tertiary);font-variant-numeric:tabular-nums;}.sp-badge{padding:2px 10px;border-radius:var(--sp-radius-full);font-size:11px;font-weight:600;letter-spacing:0.02em;}.sp-card-date{font-size:11px;color:var(--sp-text-tertiary);margin-left:auto;}.sp-card-message{font-size:13px;line-height:1.5;color:var(--sp-text);display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;}.sp-card-message--expanded{-webkit-line-clamp:unset;}.sp-card-expand{font-size:12px;font-weight:500;color:var(--sp-accent);cursor:pointer;background:none;border:none;padding:4px 0;font-family:var(--sp-font);transition:opacity 0.15s ease;}.sp-card-expand:hover{opacity:0.8;}.sp-card-footer{display:flex;align-items:center;justify-content:flex-end;gap:6px;margin-top:10px;}.sp-btn-resolve,.sp-btn-delete{padding:8px 14px;border-radius:var(--sp-radius-full);border:1px solid var(--sp-border);background:transparent;color:var(--sp-text-secondary);font-family:var(--sp-font);font-size:12px;font-weight:500;cursor:pointer;display:flex;align-items:center;gap:4px;transition:all 0.2s ease;}.sp-btn-resolve svg,.sp-btn-delete svg{width:14px;height:14px;}.sp-btn-resolve:hover{border-color:#22c55e;color:#22c55e;background:rgba(34,197,94,0.06);}.sp-btn-delete:hover{border-color:#ef4444;color:#ef4444;background:rgba(239,68,68,0.06);}.sp-btn-resolve:disabled,.sp-btn-delete:disabled{opacity:0.5;cursor:not-allowed;pointer-events:none;}.sp-spinner--sm{width:14px;height:14px;}.sp-panel-header-right{display:flex;align-items:center;gap:8px;}.sp-btn-delete-all{padding:5px 12px;border-radius:var(--sp-radius-full);border:1px solid var(--sp-border);background:transparent;color:var(--sp-text-tertiary);font-family:var(--sp-font);font-size:11px;font-weight:500;cursor:pointer;display:flex;align-items:center;gap:4px;transition:all 0.2s ease;}.sp-btn-delete-all svg{width:13px;height:13px;}.sp-btn-delete-all:hover{border-color:#ef4444;color:#ef4444;background:rgba(239,68,68,0.06);}.sp-btn-delete-all:disabled{opacity:0.5;cursor:not-allowed;pointer-events:none;}.sp-confirm-backdrop{position:fixed;inset:0;background:var(--sp-backdrop, rgba(15, 23, 42, 0.2));backdrop-filter:blur(var(--sp-blur));-webkit-backdrop-filter:blur(var(--sp-blur));display:flex;align-items:center;justify-content:center;z-index:${2147483647};opacity:0;transition:opacity 0.2s ease;}.sp-confirm-dialog{width:min(340px,calc(100vw - 32px));padding:28px;border-radius:20px;background:var(--sp-glass-bg-heavy);backdrop-filter:blur(var(--sp-blur-heavy));-webkit-backdrop-filter:blur(var(--sp-blur-heavy));border:1px solid var(--sp-glass-border);box-shadow:var(--sp-shadow-xl);font-family:var(--sp-font);transform:translateY(8px) scale(0.97);transition:transform 0.25s cubic-bezier(0.16,1,0.3,1);}.sp-confirm-title{font-size:17px;font-weight:700;color:var(--sp-text);letter-spacing:-0.02em;margin-bottom:8px;}.sp-confirm-message{font-size:14px;color:var(--sp-text-secondary);line-height:1.5;margin-bottom:20px;}.sp-confirm-actions{display:flex;gap:8px;justify-content:flex-end;}.sp-btn-danger{height:40px;padding:0 22px;border-radius:var(--sp-radius);border:none;background:#ef4444;color:#fff;font-family:var(--sp-font);font-size:14px;font-weight:600;cursor:pointer;transition:all 0.2s ease;box-shadow:0 2px 8px rgba(239,68,68,0.25);}.sp-btn-danger:hover{background:#dc2626;box-shadow:0 4px 16px rgba(239,68,68,0.3);transform:translateY(-1px);}.sp-btn-danger:active{transform:translateY(0) scale(0.98);transition-duration:0.1s;}.sp-card--resolved{opacity:0.5;}.sp-card--resolved .sp-card-message{text-decoration:line-through;text-decoration-color:var(--sp-text-tertiary);}.sp-loading{display:flex;align-items:center;justify-content:center;padding:48px 24px;}.sp-identity-backdrop{position:fixed;inset:0;background:var(--sp-identity-overlay);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);display:flex;align-items:center;justify-content:center;z-index:${2147483647};opacity:0;transition:opacity 0.25s ease;}.sp-identity-modal{width:340px;max-width:calc(100vw - 32px);padding:28px;border-radius:var(--sp-radius-xl);background:var(--sp-identity-bg);backdrop-filter:blur(var(--sp-blur-heavy));-webkit-backdrop-filter:blur(var(--sp-blur-heavy));border:1px solid var(--sp-glass-border);box-shadow:0 16px 48px var(--sp-shadow),0 8px 16px var(--sp-shadow);font-family:var(--sp-font);color:var(--sp-text);transform:translateY(12px) scale(0.97);transition:transform 0.3s cubic-bezier(0.16,1,0.3,1);}.sp-identity--open{opacity:1;}.sp-identity--open .sp-identity-modal{transform:none;}.sp-identity-actions{display:flex;gap:8px;justify-content:flex-end;margin-top:20px;}.sp-identity-title{font-size:17px;font-weight:700;color:var(--sp-text);letter-spacing:-0.02em;}.sp-input{width:100%;height:42px;padding:0 14px;border-radius:var(--sp-radius);border:1px solid var(--sp-border);background:var(--sp-glass-bg-heavy);color:var(--sp-text);font-family:var(--sp-font);font-size:14px;outline:none;transition:all 0.2s ease;}.sp-input::placeholder{color:var(--sp-text-tertiary);}.sp-input:focus{border-color:var(--sp-accent);box-shadow:0 0 0 3px var(--sp-accent-light);background:var(--sp-bg);}.sp-input-label{font-size:13px;font-weight:500;color:var(--sp-text-secondary);margin-bottom:6px;display:block;}.sp-btn-primary{height:40px;padding:0 22px;border-radius:var(--sp-radius);border:none;background:var(--sp-accent-gradient);color:#fff;font-family:var(--sp-font);font-size:14px;font-weight:600;cursor:pointer;transition:all 0.2s ease;box-shadow:0 2px 8px var(--sp-accent-glow);}.sp-btn-primary:hover{box-shadow:0 4px 16px var(--sp-accent-glow);transform:translateY(-1px);}.sp-btn-primary:active{transform:translateY(0) scale(0.98);transition-duration:0.1s;}.sp-btn-primary:disabled{opacity:0.4;cursor:not-allowed;transform:none;box-shadow:none;}.sp-btn-ghost{height:40px;padding:0 22px;border-radius:var(--sp-radius);border:1px solid var(--sp-border);background:var(--sp-glass-bg-heavy);color:var(--sp-text-secondary);font-family:var(--sp-font);font-size:14px;font-weight:500;cursor:pointer;transition:all 0.2s ease;}.sp-btn-ghost:hover{border-color:var(--sp-accent);color:var(--sp-accent);background:var(--sp-accent-light);}.sp-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:56px 24px;color:var(--sp-text-tertiary);text-align:center;gap:8px;animation:sp-fade-in 0.3s ease-out both;}.sp-empty-text{font-size:14px;font-weight:500;}.sp-load-more-wrap{display:flex;justify-content:center;padding:12px 0 4px;}.sp-btn-load-more{width:100%;}@media (forced-colors: active){.sp-fab,.sp-radial-item,.sp-filter-dropdown-btn,.sp-segmented,.sp-segmented__btn,.sp-card,.sp-panel-close,.sp-search,.sp-btn-resolve,.sp-btn-delete,.sp-btn-delete-all,.sp-btn-primary,.sp-btn-ghost,.sp-btn-danger,.sp-card-expand,.sp-input,.sp-confirm-dialog{border:2px solid ButtonText !important;background:Canvas !important;color:ButtonText !important;}.sp-segmented__btn--active{background:Highlight !important;color:HighlightText !important;}.sp-filter-dropdown-menu{border:2px solid ButtonText !important;background:Canvas !important;}.sp-filter-dropdown-option--active{background:Highlight !important;color:HighlightText !important;}.sp-fab:focus-visible,.sp-radial-item:focus-visible,.sp-filter-dropdown-btn:focus-visible,.sp-segmented__btn:focus-visible,.sp-filter-dropdown-option:focus-visible,.sp-panel-close:focus-visible,.sp-btn-resolve:focus-visible,.sp-btn-delete:focus-visible,.sp-btn-delete-all:focus-visible,.sp-btn-primary:focus-visible,.sp-btn-ghost:focus-visible,.sp-btn-danger:focus-visible,.sp-card-expand:focus-visible,.sp-input:focus-visible,.sp-search:focus-visible{outline:3px solid Highlight !important;}.sp-panel{border:2px solid ButtonText !important;}.sp-fab-badge{border:2px solid ButtonText !important;background:Canvas !important;color:ButtonText !important;}.sp-card-bar{background:ButtonText !important;}}${gi} ${chunkKCOX2NRI_cjs.za} ${chunkKCOX2NRI_cjs.ya} ${chunkKCOX2NRI_cjs.pa} ${chunkKCOX2NRI_cjs.na} ${chunkKCOX2NRI_cjs.Da} ${chunkKCOX2NRI_cjs.sa} ${yi}`}var $o=120,Bo=80,vi="opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1)",Ge=class{constructor(e,n="en"){this.colors=e;this.locale=n;this.root=chunkKCOX2NRI_cjs.y("div",{style:`position:fixed;z-index:${2147483647};max-width:280px;padding:12px 14px;border-radius:14px;background:${this.colors.glassBgHeavy};backdrop-filter:blur(24px);-webkit-backdrop-filter:blur(24px);border:1px solid ${this.colors.glassBorder};box-shadow:0 8px 32px ${this.colors.shadow},0 2px 8px ${this.colors.shadow};font-family:"Inter",system-ui,-apple-system,sans-serif;pointer-events:auto;opacity:0;transform:translateY(6px) scale(0.97);transition:${vi};visibility:hidden;-webkit-font-smoothing:antialiased;`}),this.root.setAttribute("role","tooltip"),this.root.id=this.tooltipId,this.arrow=chunkKCOX2NRI_cjs.y("div",{style:`position:absolute;width:12px;height:12px;background:${this.colors.glassBgHeavy};border:1px solid ${this.colors.glassBorder};transform:rotate(45deg);pointer-events:none;`}),this.root.appendChild(this.arrow),this.root.addEventListener("mouseenter",()=>this.cancelHide()),this.root.addEventListener("mouseleave",()=>this.scheduleHide()),chunkKCOX2NRI_cjs.F(this.root),document.body.appendChild(this.root);}colors;locale;root;arrow;showTimer=null;hideTimer=null;currentFeedbackId=null;tooltipId="sp-tooltip";show(e,n){this.cancelHide(),this.currentFeedbackId!==e.id&&(this.cancelShow(),this.showTimer=setTimeout(()=>{this.currentFeedbackId=e.id,this.render(e),this.position(n);let i=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;this.root.style.transition=i?"none":vi,this.root.style.visibility="visible",this.root.style.opacity="1",this.root.style.transform="translateY(0) scale(1)";},$o));}scheduleHide(){this.cancelHide(),this.hideTimer=setTimeout(()=>this.hide(),Bo);}hide(){this.cancelShow(),this.currentFeedbackId=null,this.root.style.opacity="0",this.root.style.transform="translateY(6px) scale(0.97)",setTimeout(()=>{this.currentFeedbackId||(this.root.style.visibility="hidden");},200);}cancelShow(){this.showTimer&&(clearTimeout(this.showTimer),this.showTimer=null);}cancelHide(){this.hideTimer&&(clearTimeout(this.hideTimer),this.hideTimer=null);}render(e){let n=Array.from(this.root.children);for(let h of n)h!==this.arrow&&h.remove();let i=chunkKCOX2NRI_cjs.aa(e.type,this.colors),o=chunkKCOX2NRI_cjs.da(e.type,this.colors),r=chunkKCOX2NRI_cjs.ja(this.locale),s=chunkKCOX2NRI_cjs.la(e.type,r),a=chunkKCOX2NRI_cjs.y("div",{style:"display:flex;align-items:center;gap:8px;margin-bottom:8px;"}),l=chunkKCOX2NRI_cjs.y("span",{style:`padding:3px 10px;border-radius:9999px;font-size:11px;font-weight:600;color:${i};background:${o};letter-spacing:0.02em;`});chunkKCOX2NRI_cjs.z(l,s);let c=chunkKCOX2NRI_cjs.y("span",{style:`font-size:11px;color:${this.colors.textSecondary};margin-left:auto;`});chunkKCOX2NRI_cjs.z(c,chunkKCOX2NRI_cjs.E(e.createdAt,this.locale)),a.appendChild(l),a.appendChild(c);let p=chunkKCOX2NRI_cjs.y("div",{style:`font-size:13px;line-height:1.55;color:${this.colors.text};display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;`});chunkKCOX2NRI_cjs.z(p,e.message),this.root.insertBefore(a,this.arrow),this.root.insertBefore(p,this.arrow);}position(e){let n=this.root.getBoundingClientRect(),i=10,o=e.top-n.height-i,r=e.left+e.width/2-n.width/2,s=true;o<8&&(o=e.bottom+i,s=false),r=Math.max(8,Math.min(r,window.innerWidth-n.width-8)),this.root.style.top=`${o}px`,this.root.style.left=`${r}px`;let a=Math.max(16,Math.min(e.left+e.width/2-r-6,n.width-22));s?this.arrow.style.cssText=`position:absolute;width:12px;height:12px;background:${this.colors.glassBgHeavy};border-right:1px solid ${this.colors.glassBorder};border-bottom:1px solid ${this.colors.glassBorder};transform:rotate(45deg);pointer-events:none;bottom:-6px;left:${a}px;`:this.arrow.style.cssText=`position:absolute;width:12px;height:12px;background:${this.colors.glassBgHeavy};border-left:1px solid ${this.colors.glassBorder};border-top:1px solid ${this.colors.glassBorder};transform:rotate(45deg);pointer-events:none;top:-6px;left:${a}px;`;}contains(e){return this.root.contains(e)}destroy(){this.cancelShow(),this.cancelHide(),this.root.remove();}};var ye=null;function zo(t){return t===void 0||t===false?{console:false,network:false,maxConsoleEntries:50,maxNetworkEntries:20}:t===true?{console:true,network:true,maxConsoleEntries:50,maxNetworkEntries:20}:{console:t.console!==false,network:t.network!==false,maxConsoleEntries:typeof t.maxConsoleEntries=="number"?t.maxConsoleEntries:50,maxNetworkEntries:typeof t.maxNetworkEntries=="number"?t.maxNetworkEntries:20}}function ve(){let t=()=>{};return {destroy:t,open:t,close:t,refresh:t,focusFeedback:()=>false,on:()=>t,off:t}}function xi(){try{return process.env.NODE_ENV}catch{return}}function Xo(t){return t===void 0||t===false?{enabled:false,param:"siteping"}:t===true?{enabled:true,param:"siteping"}:{enabled:true,param:t.param??"siteping"}}function wi(t){if(typeof window>"u"||typeof document>"u")return t.onSkip?.("ssr"),ve();let e=t.debug?(...u)=>console.debug("[siteping]",...u):()=>{};if(ye)return e("initSiteping() called more than once \u2014 returning existing instance"),ye;if(!t.forceShow&&xi()==="production")return t.onSkip?.("production"),ve();let n=typeof t.minViewportWidth=="number"&&Number.isFinite(t.minViewportWidth)?t.minViewportWidth:0;if(!t.forceShow&&window.innerWidth<n){let u="mobile";return t.onSkip?.(u),ve()}if(!t.store&&(!t.endpoint||typeof t.endpoint!="string"))return console.error("[siteping] Missing 'endpoint' or 'store' in config. Provide an endpoint like '/api/siteping' or a SitepingStore instance."),ve();if(!t.projectName||typeof t.projectName!="string")return console.error("[siteping] Missing or invalid 'projectName' in config. Expected a non-empty string."),ve();let i=chunkKCOX2NRI_cjs.o(t.locale??"en"),o=i==="en"?Promise.resolve():chunkKCOX2NRI_cjs.ia(i).catch(()=>{}),r=chunkKCOX2NRI_cjs.ja(i),s=t.scopeAnnotationsByUrl??true,a=()=>{try{let u=t.getPageScope?.();if(u)return u}catch(u){e("getPageScope() threw, falling back to pathname:",u);}return {url:window.location.pathname,urlPattern:null}};e("Initializing widget",{projectName:t.projectName,theme:t.theme??"light",locale:i,scopeAnnotationsByUrl:s});let l=zo(t.captureDiagnostics),c=l.console?new ze(l.maxConsoleEntries):null,p=l.network?new Xe(l.maxNetworkEntries):null,h=chunkKCOX2NRI_cjs.$(t.accentColor,t.theme),d=new fe,f=new fe,m=(()=>{if(t.store)return new Ve(t.store,t.projectName);let u=t.endpoint;if(typeof u!="string"||u.length===0)throw new Error("[siteping] internal invariant: endpoint must be a non-empty string in HTTP mode");return new $e(u,t.projectName,{apiKey:t.apiKey,headers:t.headers})})();t.onOpen&&d.on("open",t.onOpen),t.onClose&&d.on("close",t.onClose),t.onFeedbackSent&&d.on("feedback:sent",t.onFeedbackSent),t.onCommentAdded&&d.on("comment:added",t.onCommentAdded),t.onError&&d.on("feedback:error",t.onError),t.onError&&d.on("panel:action-error",t.onError),d.on("panel:action-error",u=>console.error("[siteping] Panel action failed:",u)),t.onAnnotationStart&&d.on("annotation:start",t.onAnnotationStart),t.onAnnotationEnd&&d.on("annotation:end",t.onAnnotationEnd);let v=He(t.projectName,t.endpoint);d.on("feedback:sent",u=>v.add(u.id)),d.on("feedback:deleted",u=>v.remove(u)),d.on("feedback:all-deleted",()=>v.clear());let T={"feedback:sent":()=>d.on("feedback:sent",u=>f.emit("feedback:sent",u)),"feedback:deleted":()=>d.on("feedback:deleted",u=>f.emit("feedback:deleted",u)),"comment:added":()=>d.on("comment:added",u=>f.emit("comment:added",u)),"feedback:error":()=>d.on("feedback:error",u=>f.emit("feedback:error",u)),"panel:open":()=>d.on("open",()=>f.emit("panel:open")),"panel:close":()=>d.on("close",()=>f.emit("panel:close")),"annotation:start":()=>d.on("annotation:start",()=>f.emit("annotation:start")),"annotation:end":()=>d.on("annotation:end",()=>f.emit("annotation:end"))};for(let u of Object.values(T))u();d.on("open",()=>e("Panel opened")),d.on("close",()=>e("Panel closed")),d.on("feedback:sent",u=>e("Feedback sent",u.id)),d.on("feedback:error",u=>e("Feedback failed",u.message)),d.on("annotation:start",()=>e("Annotation started")),d.on("annotation:end",()=>e("Annotation ended"));let A=document.createElement("siteping-widget");A.style.cssText=`position:fixed;z-index:${2147483647};pointer-events:auto;`;let C=xi()==="test"?"open":"closed",E=A.attachShadow({mode:C});if("adoptedStyleSheets"in ShadowRoot.prototype){let u=new CSSStyleSheet;u.replaceSync(Ft(h)),E.adoptedStyleSheets=[u];}else {let u=document.createElement("style");u.textContent=Ft(h),E.appendChild(u);}chunkKCOX2NRI_cjs.F(A,E);let X=chunkKCOX2NRI_cjs.I();document.body.appendChild(A);let H=Rn(A),P=document.createElement("div");P.setAttribute("role","status"),P.setAttribute("aria-live","polite"),P.setAttribute("aria-atomic","true"),P.setAttribute("data-siteping-ignore","true"),P.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;",chunkKCOX2NRI_cjs.F(P),document.body.appendChild(P);let xe=new Ge(h,i),y=new qe(h,xe,d,r,P),k=new Ke(E,t,d,r);d.on("markers:changed",u=>k.updateBadge(u));let w=null,N=null,I=false,F=0;async function Ht(u=false){let b=t.identity??Tt();if(b)return b;let x=await Ko(E,r,u);return x&&Jn(x),x}async function Dt(){return I?null:w||(N||(N=import('./panel-HGYK7HVK.cjs').then(u=>I?null:(w=new u.Panel(E,h,d,m,t.projectName,y,r,i,{getScope:a,scopeAnnotationsByUrl:s,panelActions:t.panelActions,ownFeedback:v,resolveIdentity:Ht,readOnly:t.readOnly}),w))),N)}if(typeof window<"u"){let u=()=>{I||Dt();},b=window.requestIdleCallback;typeof b=="function"?b(u):setTimeout(u,200);}let U=false,ki=d.on("panel:toggle",u=>{w||(u?(U=true,Dt().then(b=>{b&&U&&b.open(),U=false;}).catch(b=>e("Failed to lazy-load panel:",b))):U=false);}),we=new Oe(h,d,r,t.enableScreenshot??false,()=>H.getLastPageFocus()),Ee=null;t.enableRightClickComment&&(Ee=u=>{if(u.defaultPrevented)return;let b=u.pointerType;b===""||b===void 0&&u.button!==2||u.shiftKey||u.ctrlKey||u.altKey||u.metaKey||u.composedPath().some(R=>R===A||R instanceof Element&&(R.hasAttribute("data-siteping-ignore")||R.id==="siteping-markers"))||we.isBusy||(u.preventDefault(),we.startInstantAnnotation(u.clientX,u.clientY).catch(R=>e("right-click annotation failed",R)));},document.addEventListener("contextmenu",Ee)),i!=="en"&&o.then(()=>{I||(k.refreshLabels(),we.refreshLabels());});let Qe=false,Si=d.on("annotation:complete",async u=>{if(Qe){d.emit("submission:cancelled");return}Qe=true;try{let{annotation:b,type:x,message:R,clientId:q,screenshotDataUrl:V,screenshotRegion:ke}=u,M=await Ht(!0);if(!M){d.emit("submission:cancelled");return}let re=a(),zt=null;(c||p)&&(zt={console:c?.getEntries()??[],network:p?.getEntries()??[]});let Ri={projectName:t.projectName,type:x,message:R,url:re.url,urlPattern:re.urlPattern,viewport:`${window.innerWidth}x${window.innerHeight}`,userAgent:navigator.userAgent,authorName:M.name,authorEmail:M.email,annotations:[b],clientId:q,screenshotDataUrl:V??null,screenshotRegion:ke??null,diagnostics:zt};try{let K=await m.sendFeedback(Ri);d.emit("feedback:sent",K),(!s||K.url===re.url)&&y.addFeedback(K,y.count+1),P.textContent=r("feedback.sent.confirmation"),w&&await w.refresh();}catch(K){d.emit("feedback:error",K instanceof Error?K:new Error(String(K))),P.textContent=r("feedback.error.message");}}finally{Qe=false;}}),Je=a(),Ti=s?{limit:20,url:Je.url}:{limit:20},Ze=Xo(t.deepLink),Ci=++F;Promise.all([m.getFeedbacks(t.projectName,Ti),o]).then(([{feedbacks:u}])=>{if(I||F!==Ci)return;let b=s?u.filter(x=>x.url===Je.url):u;if(y.render(b),Ze.enabled)try{let x=new URLSearchParams(window.location.search).get(Ze.param);if(x){let R=y.focusFeedback(x);e(`deepLink ?${Ze.param}=${x} ${R?"focused":"did not match a visible feedback"}`);}}catch(x){e("deepLink parsing failed:",x);}}).catch(u=>{e("Failed to load initial markers:",u);}),t.endpoint&&Vn(t.endpoint,t.identity??Tt(),{apiKey:t.apiKey,headers:t.headers}).then(()=>e("Retry queue flushed")).catch(()=>{});let $t=()=>{let u=++F;if(w?.isCurrentlyOpen)return w.refresh();let b=a(),x=s?{limit:20,url:b.url}:{limit:20};return m.getFeedbacks(t.projectName,x).then(({feedbacks:R})=>{if(I||u!==F||w?.isCurrentlyOpen)return;let q=s?R.filter(V=>V.url===b.url):R;y.render(q);})},Bt=null;if(t.watchNavigation!==false&&typeof window<"u"&&typeof history<"u"){let u=M=>`${M.url}
|
|
3
|
-
${M.urlPattern??""}`,b=u(Je),x=()=>{if(I)return;let M=u(a());if(M===b)return;let re=b;b=M,e("SPA navigation detected \u2014 refreshing feedbacks for new scope"),$t().catch(()=>{b===M&&(b=re);});},R=history.pushState,q=history.replaceState,V=function(...M){R.apply(this,M),x();},ke=function(...M){q.apply(this,M),x();};history.pushState=V,history.replaceState=ke,window.addEventListener("popstate",x),window.addEventListener("hashchange",x),Bt=()=>{window.removeEventListener("popstate",x),window.removeEventListener("hashchange",x),history.pushState===V&&(history.pushState=R),history.replaceState===ke&&(history.replaceState=q);};}let et={destroy:()=>{I||(e("Destroying widget"),Ee&&document.removeEventListener("contextmenu",Ee),I=true,U=false,Bt?.(),H.destroy(),Si(),ki(),k.destroy(),w?.destroy(),we.destroy(),y.destroy(),xe.destroy(),c?.dispose(),p?.dispose(),d.removeAll(),f.removeAll(),P.remove(),A.remove(),X(),ye===et&&(ye=null));},open:()=>{d.emit("panel:toggle",true);},close:()=>{w?w.close():U=false;},focusFeedback:u=>y.focusFeedback(u),refresh:()=>{$t().catch(()=>{});},on:(u,b)=>f.on(u,b),off:(u,b)=>{f.off(u,b);}};return ye=et,et}function Ko(t,e,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()}`,h=`sp-identity-email-${Date.now()}`,d=document.createElement("label");d.className="sp-input-label",d.textContent=e("identity.nameLabel"),d.setAttribute("for",p);let f=document.createElement("input");f.className="sp-input",f.id=p,f.type="text",f.maxLength=
|
|
1
|
+
'use strict';var chunkQ34GDCKE_cjs=require('./chunk-Q34GDCKE.cjs'),react=require('react');var Ai=new Set(["role","name","aria-label","rel","href"]);function Pi(t,e){let n=Ai.has(t);n||=t.startsWith("data-")&&ce(t);let i=ce(e)&&e.length<100;return i||=e.startsWith("#")&&ce(e.slice(1)),n&&i}function Mi(t){return ce(t)}function Ii(t){return ce(t)}function Li(t){return true}function at(t,e){if(t.nodeType!==Node.ELEMENT_NODE)throw new Error("Can't generate CSS selector for non-element node type.");if(t.tagName.toLowerCase()==="html")return "html";let n={root:document.body,idName:Mi,className:Ii,tagName:Li,attr:Pi,timeoutMs:1e3,seedMinLength:3,optimizedMinLength:2,maxNumberOfPathChecks:1/0},i=new Date,o={...n,...e},r=Hi(o.root,n),s,a=0;for(let c of _i(t,o,r)){if(new Date().getTime()-i.getTime()>o.timeoutMs||a>=o.maxNumberOfPathChecks){let h=Fi(t,r);if(!h)throw new Error(`Timeout: Can't find a unique selector after ${o.timeoutMs}ms`);return pe(h)}if(a++,lt(c,r)){s=c;break}}if(!s)throw new Error("Selector was not found.");let l=[...Sn(s,t,o,r,i)];return l.sort(st),l.length>0?pe(l[0]):pe(s)}function*_i(t,e,n){let i=[],o=[],r=t,s=0;for(;r&&r!==n;){let a=Ni(r,e);for(let l of a)l.level=s;if(i.push(a),r=r.parentElement,s++,o.push(...kn(i)),s>=e.seedMinLength){o.sort(st);for(let l of o)yield l;o=[];}}o.sort(st);for(let a of o)yield a;}function ce(t){if(/^[a-z\-]{3,}$/i.test(t)){let e=t.split(/-|[A-Z]/);for(let n of e)if(n.length<=2||/[^aeiou]{4,}/i.test(n))return false;return true}return false}function Ni(t,e){let n=[],i=t.getAttribute("id");i&&e.idName(i)&&n.push({name:"#"+CSS.escape(i),penalty:0});for(let s=0;s<t.classList.length;s++){let a=t.classList[s];e.className(a)&&n.push({name:"."+CSS.escape(a),penalty:1});}for(let s=0;s<t.attributes.length;s++){let a=t.attributes[s];e.attr(a.name,a.value)&&n.push({name:`[${CSS.escape(a.name)}="${CSS.escape(a.value)}"]`,penalty:2});}let o=t.tagName.toLowerCase();if(e.tagName(o)){n.push({name:o,penalty:5});let s=rt(t,o);s!==void 0&&n.push({name:En(o,s),penalty:10});}let r=rt(t);return r!==void 0&&n.push({name:Oi(o,r),penalty:50}),n}function pe(t){let e=t[0],n=e.name;for(let i=1;i<t.length;i++){let o=t[i].level||0;e.level===o-1?n=`${t[i].name} > ${n}`:n=`${t[i].name} ${n}`,e=t[i];}return n}function wn(t){return t.map(e=>e.penalty).reduce((e,n)=>e+n,0)}function st(t,e){return wn(t)-wn(e)}function rt(t,e){let n=t.parentNode;if(!n)return;let i=n.firstChild;if(!i)return;let o=0;for(;i&&(i.nodeType===Node.ELEMENT_NODE&&(e===void 0||i.tagName.toLowerCase()===e)&&o++,i!==t);)i=i.nextSibling;return o}function Fi(t,e){let n=0,i=t,o=[];for(;i&&i!==e;){let r=i.tagName.toLowerCase(),s=rt(i,r);if(s===void 0)return;o.push({name:En(r,s),penalty:NaN,level:n}),i=i.parentElement,n++;}if(lt(o,e))return o}function Oi(t,e){return t==="html"?"html":`${t}:nth-child(${e})`}function En(t,e){return t==="html"?"html":`${t}:nth-of-type(${e})`}function*kn(t,e=[]){if(t.length>0)for(let n of t[0])yield*kn(t.slice(1,t.length),e.concat(n));else yield e;}function Hi(t,e){return t.nodeType===Node.DOCUMENT_NODE?t:t===e.root?t.ownerDocument:t}function lt(t,e){let n=pe(t);switch(e.querySelectorAll(n).length){case 0:throw new Error(`Can't select any node with this selector: ${n}`);case 1:return true;default:return false}}function*Sn(t,e,n,i,o){if(t.length>2&&t.length>n.optimizedMinLength)for(let r=1;r<t.length-1;r++){if(new Date().getTime()-o.getTime()>n.timeoutMs)return;let a=[...t];a.splice(r,1),lt(a,i)&&i.querySelector(pe(a))===e&&(yield a,yield*Sn(a,e,n,i,o));}}var Di=["role","aria-label","type","name","href","src","data-testid","data-id"];function $i(t){let e=5381;for(let n=0;n<t.length;n++)e=(e<<5)+e+t.charCodeAt(n)|0;return (e>>>0).toString(36)}function ct(t){let e=t.children.length,n=0,i=t.parentElement;if(i)for(let o of i.children){if(o===t)break;o.tagName===t.tagName&&n++;}return `${e}:${n}:${pt(t)}`}function pt(t){let e=[];for(let n of Di){let i=t.getAttribute(n);i&&e.push(`${n}=${i}`);}return e.length>0?$i(e.join(",")):"0"}function Tn(t,e){let n=e.split(":");if(n.length!==3)return 0;let[i,o,r]=n,s=Number(i),a=Number(o);if(Number.isNaN(s)||Number.isNaN(a))return 0;let l=ct(t),[c,p,h]=l.split(":"),d=0,f=Math.abs(Number(c)-s);f===0?d+=.2:f<=2?d+=.1:f<=5&&(d+=.03);let m=Math.abs(Number(p)-a);return m===0?d+=.4:m===1?d+=.2:m<=3&&(d+=.08),h===r&&(d+=.4),d}function Z(t){return t.tagName==="SITEPING-WIDGET"||t.closest("siteping-widget")!==null||t.closest('[data-siteping-ignore="true"]')!==null||t.closest("#siteping-markers")!==null||t.closest("#sp-tooltip")!==null}var Cn=4;function dt(t){let e=t,n=t.shadowRoot?.activeElement;for(;n instanceof HTMLElement;){let i=n.getBoundingClientRect();i.width>=Cn&&i.height>=Cn&&(e=n),n=n.shadowRoot?.activeElement;}return e}function Rn(t){let e=null,n=i=>{let o=i.target;o instanceof HTMLElement&&(o===document.body||o===document.documentElement||o===t||Z(o)||(e=dt(o)));};return document.addEventListener("focusin",n),{getLastPageFocus(){return e&&!e.isConnected&&(e=null),e},destroy(){document.removeEventListener("focusin",n),e=null;}}}var Me=256;function Ie(t,e){let n=t;for(;n&&Z(n);)n=n[e];return n}function An(t){return t.nodeType===1&&t.getAttribute("data-siteping-ignore")==="true"}function Bi(t){return t.nodeType===3?NodeFilter.FILTER_ACCEPT:An(t)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_SKIP}function te(t,e){let n=e==="before"?"previousElementSibling":"nextElementSibling",i=Ie(t[n],n),o=3;for(;i&&o>0;){let r=e==="before"?zi(i,Me,true).trim():ee(i,Me,true).trim();if(r)return e==="before"?r.slice(-32):r.slice(0,32);i=Ie(i[n],n),o--;}return ""}function Le(t){let e=Ie(t.previousElementSibling,"previousElementSibling"),n=Ie(t.nextElementSibling,"nextElementSibling"),i=e?ee(e,Me,true).trim().slice(0,40):"",o=n?ee(n,Me,true).trim().slice(0,40):"";return [i,o].filter(Boolean).join(" | ")}function ee(t,e,n=false){let i="";if(t.firstElementChild===null){for(let r of t.childNodes)if(r.nodeType===3&&(i+=r.data,i.length>=e))break;return i.length>e?i.slice(0,e):i}let o=n?t.ownerDocument.createTreeWalker(t,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,Bi):t.ownerDocument.createTreeWalker(t,NodeFilter.SHOW_TEXT);for(;i.length<e;){let r=o.nextNode();if(!r)break;i+=r.data;}return i.length>e?i.slice(0,e):i}function zi(t,e,n=false){let i="",o=r=>{for(let s=r.lastChild;s;s=s.previousSibling)if(s.nodeType===3){if(i=s.data+i,i.length>=e)return true}else if(s.nodeType===1&&!(n&&An(s))&&o(s))return true;return false};return o(t),i.length>e?i.slice(-e):i}function Pn(t){if(t.getRootNode()instanceof ShadowRoot)return Xi(t);if(t.id)return `//${t.localName}[@id=${ut(t.id)}]`;let e=[],n=t;for(;n&&n!==document.body&&e.length<6;){let i=n.localName,o=n.parentElement;if(n.id)return e.unshift(`/${i}[@id=${ut(n.id)}]`),"/"+e.join("");let r=1;if(o)for(let s of o.children){if(s===n)break;s.localName===i&&r++;}e.unshift(`/${i}[${r}]`),n=o;}return n!==document.body?"/"+e.join(""):"/html/body"+e.join("")}function Xi(t){let e="";for(let n=t;n;n=n.parentElement){let i=n.localName;if(n.id){e=`/${i}[@id=${ut(n.id)}]${e}`;continue}let o=1;for(let r=n.previousElementSibling;r;r=r.previousElementSibling)r.localName===i&&o++;e=`/${i}[${o}]${e}`;}return `.${e}`}function ut(t){return t.includes("'")?`concat('${t.replace(/'/g,`',"'",'`)}')`:`'${t}'`}var de="data-feedback-anchor",ht=" >>> ",Mn={className:t=>!/^(css|sc|emotion|styled)-/.test(t)&&!/^[a-z]{1,3}[A-Za-z0-9]{4,8}$/.test(t),attr:t=>["data-testid","data-id","role","aria-label"].includes(t),idName:t=>!t.startsWith("radix-")&&!/^:r[0-9]+:$/.test(t),seedMinLength:3,optimizedMinLength:2};function Ki(t,e){let n=t;for(;n;){let i=n.closest(e);if(i)return i;let o=n.getRootNode();n=o instanceof ShadowRoot?o.host:null;}return null}function In(t){if(t.parentElement)return t.parentElement;let e=t.getRootNode();return e instanceof ShadowRoot?e.host:null}function ft(t){let e=[],n=t;for(;n;){let f=n.getRootNode();f instanceof ShadowRoot?(e.unshift(at(n,{...Mn,root:f})),n=f.host):(e.unshift(at(n,Mn)),n=null);}let i=e.join(ht),o=Pn(t),s=(t.textContent?.trim()??"").slice(0,120),a=te(t,"before"),l=te(t,"after"),c=ct(t),p=Le(t),d=Ki(t,`[${de}]`)?.getAttribute(de)??null;return {cssSelector:i,xpath:o,textSnippet:s,textPrefix:a,textSuffix:l,fingerprint:c,neighborText:p,elementTag:t.tagName.slice(0,chunkQ34GDCKE_cjs.m),elementId:t.id&&t.id.length<=chunkQ34GDCKE_cjs.n?t.id:void 0,anchorKey:d}}function Ln(t,e){let n=t.getBoundingClientRect();return n.left<=e.x&&n.top<=e.y&&n.right>=e.x+e.width&&n.bottom>=e.y+e.height}function _n(t,e=document.documentElement){let n=mt(t.x+t.width/2,t.y+t.height/2);if(!n||n===e)return document.body;let i=n;for(;i&&i!==document.body;){if(i.hasAttribute(de)&&Ln(i,t))return i;i=In(i);}for(i=n;i&&i!==document.body;){if(Ln(i,t))return i;i=In(i);}return document.body}function mt(t,e){let n=document.elementFromPoint(t,e),i=n?.shadowRoot;for(;i&&typeof i.elementFromPoint=="function";){let o=i.elementFromPoint(t,e);if(!o||o.getRootNode()!==i)break;n=o,i=o.shadowRoot;}return n}function Nn(t,e){return e.width<=0||e.height<=0?{xPct:0,yPct:0,wPct:1,hPct:1}:{xPct:(t.x-e.x)/e.width,yPct:(t.y-e.y)/e.height,wPct:t.width/e.width,hPct:t.height/e.height}}var Fn={width:334,height:280},ne={top:0,bottom:0};function On(t,e,n,i=ne){let o=i.top+8,r=n.height-i.bottom-8,s=Math.max(0,r-o),a=t.bottom+8,l=t.top-8-e.height,c=f=>f>=o&&f+e.height<=r,p,h=null;c(a)?p=a:c(l)?p=l:e.height<=s?p=Math.min(Math.max(a,o),r-e.height):(p=o,h=s);let d=t.left;return d+e.width>n.width-8&&(d=t.right-e.width),d=Math.max(8,Math.min(d,n.width-8-e.width)),{top:p,left:d,maxHeight:h}}var Wi={question:"type.question",change:"type.change",bug:"type.bug",other:"type.other"},Dn=`opacity ${250}ms cubic-bezier(0.16, 1, 0.3, 1),transform ${250}ms cubic-bezier(0.16, 1, 0.3, 1)`;function bt(){return typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}var _e=class{constructor(e,n){this.colors=e;this.t=n;this.root=chunkQ34GDCKE_cjs.y("div",{style:`position:fixed;z-index:${2147483647};pointer-events:auto;width:300px;padding:16px;border-radius:16px;background:${this.colors.glassBg};backdrop-filter:blur(24px);-webkit-backdrop-filter:blur(24px);border:1px solid ${this.colors.glassBorder};box-shadow:0 8px 32px ${this.colors.shadow},0 2px 8px ${this.colors.shadow};font-family:"Inter",system-ui,-apple-system,sans-serif;opacity:0;transform:translateY(8px) scale(0.98);transition:${Dn};display:none;-webkit-font-smoothing:antialiased;`}),this.root.setAttribute("role","dialog"),this.root.setAttribute("aria-modal","true"),this.root.setAttribute("data-siteping-ignore","true");let i=[{type:"question",icon:chunkQ34GDCKE_cjs.P},{type:"change",icon:chunkQ34GDCKE_cjs.Q},{type:"bug",icon:chunkQ34GDCKE_cjs.R},{type:"other",icon:chunkQ34GDCKE_cjs.S}];this.typeRow=chunkQ34GDCKE_cjs.y("div",{style:"display:grid;grid-template-columns:1fr 1fr;gap:6px;margin-bottom:12px;"});for(let r of i){let s=document.createElement("button");s.style.cssText=`height:44px;border-radius:9999px;border:1px solid ${this.colors.border};background:${this.colors.glassBg};cursor:pointer;display:flex;align-items:center;justify-content:center;gap:5px;font-family:"Inter",system-ui,-apple-system,sans-serif;font-size:13px;font-weight:500;color:${this.colors.textTertiary};transition:all 0.2s ease;padding:0 12px;`;let a=chunkQ34GDCKE_cjs.x(r.icon);a.setAttribute("style","width:13px;height:13px;flex-shrink:0;"),s.appendChild(a),s.appendChild(document.createElement("span")),s.dataset.type=r.type,s.setAttribute("aria-pressed","false"),s.addEventListener("click",()=>{this.submittingState||this.selectType(r.type,this.typeRow);}),s.addEventListener("mouseenter",()=>{if(!this.submittingState&&s.dataset.type!==this.selectedType){let l=chunkQ34GDCKE_cjs.da(s.dataset.type??"",this.colors);s.style.background=l,s.style.borderColor=chunkQ34GDCKE_cjs.aa(s.dataset.type??"",this.colors)+"40";}}),s.addEventListener("mouseleave",()=>{this.submittingState||s.dataset.type!==this.selectedType&&(s.style.background=this.colors.glassBg,s.style.borderColor=this.colors.border);}),this.typeRow.appendChild(s);}this.textarea=document.createElement("textarea"),this.textarea.style.cssText=`width:100%;min-height:72px;max-height:152px;padding:10px 12px;border-radius:12px;border:1px solid ${this.colors.border};background:${this.colors.glassBgHeavy};color:${this.colors.text};font-family:"Inter",system-ui,-apple-system,sans-serif;font-size:13px;line-height:1.5;resize:vertical;outline:none;transition:all 0.2s ease;box-sizing:border-box;`,this.textarea.maxLength=5e3,this.hint=chunkQ34GDCKE_cjs.y("div",{style:`font-size:11px;color:${this.colors.textTertiary};text-align:right;margin-top:4px;font-family:"Inter",system-ui,-apple-system,sans-serif;letter-spacing:0.01em;`}),this.textarea.addEventListener("focus",()=>{this.submittingState||(this.textarea.style.borderColor=this.colors.accent,this.textarea.style.boxShadow=`0 0 0 3px ${this.colors.accent}14`,this.textarea.style.background=this.colors.bg);}),this.textarea.addEventListener("blur",()=>{this.submittingState||(this.textarea.style.borderColor=this.colors.border,this.textarea.style.boxShadow="none",this.textarea.style.background=this.colors.glassBgHeavy);}),this.textarea.addEventListener("input",()=>{this.updateSubmitState();}),this.textarea.addEventListener("keydown",r=>{this.submittingState||r.key==="Enter"&&(r.ctrlKey||r.metaKey)&&(r.preventDefault(),this.submit());});let o=chunkQ34GDCKE_cjs.y("div",{style:"display:flex;justify-content:flex-end;gap:8px;margin-top:12px;"});this.cancelBtn=document.createElement("button"),this.cancelBtn.style.cssText=`height:34px;padding:0 16px;border-radius:9999px;border:1px solid ${this.colors.border};background:${this.colors.glassBg};color:${this.colors.textTertiary};font-family:"Inter",system-ui,-apple-system,sans-serif;font-size:13px;font-weight:500;cursor:pointer;transition:all 0.2s ease;`,this.cancelBtn.addEventListener("click",()=>this.dismiss()),this.cancelBtn.addEventListener("mouseenter",()=>{this.submittingState||(this.cancelBtn.style.borderColor=this.colors.accent,this.cancelBtn.style.color=this.colors.accent);}),this.cancelBtn.addEventListener("mouseleave",()=>{this.submittingState||(this.cancelBtn.style.borderColor=this.colors.border,this.cancelBtn.style.color=this.colors.textTertiary);}),this.submitBtn=document.createElement("button"),this.submitBtn.style.cssText=`height:34px;padding:0 18px;border-radius:9999px;border:none;background:${this.colors.accentGradient};color:#fff;font-family:"Inter",system-ui,-apple-system,sans-serif;font-size:13px;font-weight:600;cursor:pointer;opacity:0.35;pointer-events:none;transition:all 0.2s ease;box-shadow:0 2px 8px ${this.colors.accentGlow};display:inline-flex;align-items:center;justify-content:center;min-width:64px;`,this.submitLabel=document.createElement("span"),this.submitBtn.appendChild(this.submitLabel),this.submitBtn.addEventListener("click",()=>this.submit()),o.appendChild(this.cancelBtn),o.appendChild(this.submitBtn),this.root.appendChild(this.typeRow),this.root.appendChild(this.textarea),this.root.appendChild(this.hint),this.root.appendChild(o),chunkQ34GDCKE_cjs.F(this.root),document.body.appendChild(this.root),this.applyLabels();}colors;t;root;selectedType=null;textarea;submitBtn;cancelBtn;typeRow;submitLabel;hint;resolve=null;previouslyFocused=null;onKeydownTrap=null;onSubmit=null;submittingState=false;showFrame=null;hideTimeoutId=null;spinnerAnimation=null;sheet=false;stopKeyboardTracking=null;get isOpen(){return this.resolve!==null}get sheetTop(){return this.sheet&&this.isOpen?window.innerHeight-this.root.offsetHeight:null}refreshLabels(){this.applyLabels();}applyLabels(){this.root.setAttribute("aria-label",this.t("popup.ariaLabel"));let e=this.root.querySelectorAll("button[data-type]");for(let n of e){let i=n.dataset.type;if(!i)continue;let o=Wi[i];if(!o)continue;let r=n.querySelector("span");r&&chunkQ34GDCKE_cjs.z(r,this.t(o));}this.textarea.placeholder=this.t("popup.placeholder"),this.textarea.setAttribute("aria-label",this.t("popup.textareaAria")),chunkQ34GDCKE_cjs.z(this.hint,chunkQ34GDCKE_cjs.D()?this.t("popup.submitHintMac"):this.t("popup.submitHintOther")),chunkQ34GDCKE_cjs.z(this.cancelBtn,this.t("popup.cancel")),chunkQ34GDCKE_cjs.z(this.submitLabel,this.t("popup.submit"));}show(e,n,i=ne){return new Promise(o=>{this.cancelPendingTransition(),this.resolve=o,this.onSubmit=n??null,this.selectedType=null,this.textarea.value="",this.submittingState=false,this.updateSubmitState(),this.resetTypeButtons(),this.previouslyFocused=document.activeElement;let r=chunkQ34GDCKE_cjs.ga();this.sheet=chunkQ34GDCKE_cjs.fa();let s=this.sheet?"48px":r?"44px":"34px";this.cancelBtn.style.height=s,this.submitBtn.style.height=s,this.cancelBtn.style.flex=this.sheet?"1":"",this.submitBtn.style.flex=this.sheet?"2":"",this.textarea.style.fontSize=r?"16px":"13px",this.textarea.style.minHeight=this.sheet?"96px":"72px",this.hint.style.display=r?"none":"",this.root.style.transform=this.hiddenTransform(),chunkQ34GDCKE_cjs.G(this.root,false),this.root.style.display="block",this.layout(e,i),this.onKeydownTrap=a=>{if(a.key==="Escape"&&this.dismiss(),a.key==="Tab"){let l=Array.from(this.root.querySelectorAll('button:not([disabled]), textarea:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])'));if(l.length===0)return;let c=l[0],p=l[l.length-1];if(!c||!p)return;a.shiftKey?(document.activeElement===c||!this.root.contains(document.activeElement))&&(a.preventDefault(),p.focus()):(document.activeElement===p||!this.root.contains(document.activeElement))&&(a.preventDefault(),c.focus());}},this.root.addEventListener("keydown",this.onKeydownTrap),this.root.style.transition=bt()?"none":Dn,this.showFrame=requestAnimationFrame(()=>{this.showFrame=null,this.root.style.opacity="1",this.root.style.transform="translateY(0) scale(1)",(r?this.typeRow.querySelector("button"):this.textarea)?.focus();});})}layout(e,n){let i=this.root.style;if(i.width=this.sheet?"auto":"300px",i.borderRadius=this.sheet?"20px 20px 0 0":"16px",i.background=this.sheet?this.colors.bg:this.colors.glassBg,i.boxShadow=this.sheet?`0 -8px 32px ${this.colors.shadow}`:`0 8px 32px ${this.colors.shadow}, 0 2px 8px ${this.colors.shadow}`,i.overscrollBehavior=this.sheet?"contain":"",this.stopKeyboardTracking?.(),this.stopKeyboardTracking=null,this.sheet){i.top="auto",i.left="0",i.right="0",i.overflowY="auto";let a=(l,c=window.innerHeight)=>{i.bottom=`${l}px`,i.maxHeight=`${c-8}px`,i.padding=`16px 16px ${l>0?"16px":"calc(16px + env(safe-area-inset-bottom, 0px))"}`;};a(0),this.stopKeyboardTracking=chunkQ34GDCKE_cjs.ha(a);return}i.right="",i.bottom="",i.padding="16px",i.maxHeight="",i.overflowY="";let{top:o,left:r,maxHeight:s}=On(e,this.measure(),{width:window.innerWidth,height:window.innerHeight},n);i.top=`${o}px`,i.left=`${r}px`,s!==null&&(i.maxHeight=`${Math.max(0,s-this.verticalChromeHeight())}px`,i.overflowY="auto",this.root.scrollTop=0);}hiddenTransform(){return this.sheet?"translateY(100%)":"translateY(8px) scale(0.98)"}measure(){let e=this.root.offsetWidth,n=this.root.offsetHeight;return e>0&&n>0?{width:e,height:n}:Fn}verticalChromeHeight(){let e=window.getComputedStyle(this.root);return e.boxSizing==="border-box"?0:[e.paddingTop,e.paddingBottom,e.borderTopWidth,e.borderBottomWidth].reduce((n,i)=>n+(Number.parseFloat(i)||0),0)}selectType(e,n){this.selectedType=e;let i=n.querySelectorAll("button");for(let o of i){let r=o.dataset.type===e,s=chunkQ34GDCKE_cjs.aa(o.dataset.type??"",this.colors),a=chunkQ34GDCKE_cjs.da(o.dataset.type??"",this.colors);o.style.background=r?a:this.colors.glassBg,o.style.borderColor=r?s+"60":this.colors.border,o.style.color=r?s:this.colors.textTertiary,o.style.fontWeight=r?"600":"500",o.setAttribute("aria-pressed",String(r));}this.updateSubmitState();}resetTypeButtons(){let e=this.root.querySelectorAll("button[data-type]");for(let n of e)n.setAttribute("aria-pressed","false"),n.disabled=false,n.style.background=this.colors.glassBg,n.style.borderColor=this.colors.border,n.style.color=this.colors.textTertiary,n.style.fontWeight="500",n.style.cursor="pointer";}updateSubmitState(){if(this.submittingState)return;let e=this.selectedType!==null&&this.textarea.value.trim().length>0;this.submitBtn.disabled=!e,this.submitBtn.style.opacity=e?"1":"0.35",this.submitBtn.style.pointerEvents=e?"auto":"none";}submit(){if(this.submittingState||!this.selectedType||!this.textarea.value.trim())return;let e={type:this.selectedType,message:this.textarea.value.trim()};if(!this.onSubmit){this.resolve?.(e),this.resolve=null,this.hideElement();return}this.enterSubmittingState();let n=this.onSubmit;n(e).then(()=>{this.resolve?.(e),this.resolve=null,this.hideElement();}).catch(()=>{this.exitSubmittingState();});}dismiss(){this.submittingState||!this.isOpen||(this.resolve?.(null),this.resolve=null,this.hideElement());}enterSubmittingState(){this.submittingState=true,this.submitLabel.style.display="none",this.submitBtn.disabled=true,this.submitBtn.style.cursor="wait",this.submitBtn.style.opacity="0.85",this.submitBtn.setAttribute("aria-busy","true"),this.submitBtn.appendChild(this.buildSpinner()),this.cancelBtn.disabled=true,this.cancelBtn.style.opacity="0.5",this.cancelBtn.style.cursor="not-allowed",this.cancelBtn.style.pointerEvents="none",this.textarea.disabled=true,this.textarea.style.opacity="0.6";let e=this.typeRow.querySelectorAll("button");for(let n of e)n.disabled=true,n.style.cursor="not-allowed",n.style.opacity="0.6";}exitSubmittingState(){this.submittingState=false,this.spinnerAnimation?.cancel(),this.spinnerAnimation=null,this.submitBtn.querySelector('[data-role="sp-popup-spinner"]')?.remove(),this.submitLabel.style.display="",this.submitBtn.removeAttribute("aria-busy"),this.submitBtn.style.cursor="pointer",this.cancelBtn.disabled=false,this.cancelBtn.style.opacity="1",this.cancelBtn.style.cursor="pointer",this.cancelBtn.style.pointerEvents="auto",this.textarea.disabled=false,this.textarea.style.opacity="1";let n=this.typeRow.querySelectorAll("button");for(let i of n)i.disabled=false,i.style.cursor="pointer",i.style.opacity="1";this.updateSubmitState();}buildSpinner(){let e=document.createElement("div");return e.dataset.role="sp-popup-spinner",e.style.cssText="width:14px;height:14px;border:2px solid rgba(255,255,255,0.35);border-top-color:#fff;border-radius:50%;box-sizing:border-box;",!bt()&&typeof e.animate=="function"&&(this.spinnerAnimation=e.animate([{transform:"rotate(0deg)"},{transform:"rotate(360deg)"}],{duration:600,iterations:1/0,easing:"linear"})),e}hideElement(){if(this.cancelPendingTransition(),this.onKeydownTrap&&(this.root.removeEventListener("keydown",this.onKeydownTrap),this.onKeydownTrap=null),this.submittingState&&this.exitSubmittingState(),this.onSubmit=null,this.stopKeyboardTracking?.(),this.stopKeyboardTracking=null,this.root.style.opacity="0",this.root.style.transform=this.hiddenTransform(),this.previouslyFocused?.focus(),this.previouslyFocused=null,chunkQ34GDCKE_cjs.G(this.root,true),bt()){this.root.style.display="none";return}this.hideTimeoutId=setTimeout(()=>{this.hideTimeoutId=null,this.root.style.display="none";},250);}cancelPendingTransition(){this.showFrame!==null&&cancelAnimationFrame(this.showFrame),this.hideTimeoutId!==null&&clearTimeout(this.hideTimeoutId),this.showFrame=null,this.hideTimeoutId=null;}destroy(){this.submittingState&&this.exitSubmittingState(),this.cancelPendingTransition(),this.resolve?.(null),this.resolve=null,this.onSubmit=null,this.onKeydownTrap&&(this.root.removeEventListener("keydown",this.onKeydownTrap),this.onKeydownTrap=null),this.stopKeyboardTracking?.(),this.stopKeyboardTracking=null,this.root.remove();}};var ue,$n=false;async function ji(){if(ue!==void 0)return ue;try{let t=await import('html2canvas-pro');return ue=t.default??t,ue}catch(t){return ue=null,$n||($n=true,console.warn("[siteping] html2canvas-pro import failed unexpectedly. Capture is disabled for this session \u2014 feedbacks are still submitted, just without screenshots. Underlying error:",t)),null}}function gt(t,e,n){return Math.min(n,Math.max(t,e))}function Ne(t){return gt(0,Math.round(t*1e4)/1e4,1)}async function Bn(t,e){let n=await ji();if(!n)return null;let i=.85,o=1200,r=gt(48,t.width*.6,280),s=gt(48,t.height*.6,220),a=window.scrollX+t.x,l=window.scrollY+t.y,c=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth),p=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),h=Math.max(0,a-r),d=Math.max(0,l-s),f=Math.min(c,a+t.width+r)-h,m=Math.min(p,l+t.height+s)-d;if(f<=0||m<=0)return null;let v={xPct:Ne((a-h)/f),yPct:Ne((l-d)/m),wPct:Ne(t.width/f),hPct:Ne(t.height/m)};try{let T=await n(document.body,{x:h,y:d,width:f,height:m,scale:window.devicePixelRatio,useCORS:!0,allowTaint:!0,logging:!1,ignoreElements:H=>H.tagName==="SITEPING-WIDGET"||H.closest?.("siteping-widget")!==null||H.getAttribute?.("data-siteping-ignore")==="true"});if(T.width<=o)return {dataUrl:T.toDataURL("image/jpeg",i),region:v};let A=o/T.width,C=o,E=Math.round(T.height*A),_=document.createElement("canvas");_.width=C,_.height=E;let X=_.getContext("2d");return X?(X.drawImage(T,0,0,C,E),{dataUrl:_.toDataURL("image/jpeg",i),region:v}):null}catch(T){return console.warn("[siteping] Screenshot capture failed:",T),null}}var Fe=10;function zn(t){let e=Math.max(0,t.left),n=Math.max(0,t.top);return new DOMRect(e,n,Math.max(0,Math.min(t.right,window.innerWidth)-e),Math.max(0,Math.min(t.bottom,window.innerHeight)-n))}function Yi(){return {clientId:chunkQ34GDCKE_cjs.p()}}var Oe=class{constructor(e,n,i,o=false,r){this.colors=e;this.bus=n;this.t=i;this.enableScreenshot=o;this.getFallbackTarget=r;this.popup=new _e(e,i),this.bus.on("annotation:start",()=>this.activate());}colors;bus;t;enableScreenshot;getFallbackTarget;overlay=null;toolbar=null;drawingRect=null;startX=0;startY=0;isDrawing=false;isActive=false;instantMode=false;popup;savedOverflow="";preActiveFocusElement=null;keyboardTarget=null;rafId=null;pendingMoveEvent=null;rejectPendingSubmission=null;unregisterEscapeLayer=chunkQ34GDCKE_cjs.H(document,()=>this.isActive);get isBusy(){return this.isActive}refreshLabels(){this.popup.refreshLabels();}async maybeCapture(e){return this.enableScreenshot?Bn(e):null}activate(){if(this.isActive)return;this.isActive=true;let e=!this.instantMode,n=chunkQ34GDCKE_cjs.fa(),i=chunkQ34GDCKE_cjs.ga(),o=this.t("annotator.instruction");this.preActiveFocusElement=document.activeElement;let r=document.activeElement;if(this.keyboardTarget=r instanceof HTMLElement&&r!==document.body&&r!==document.documentElement&&!Z(r)?dt(r):this.getFallbackTarget?.()??null,this.savedOverflow=document.body.style.overflow,document.body.style.overflow="hidden",this.overlay=chunkQ34GDCKE_cjs.y("div",{style:`position:fixed;inset:0;z-index:${2147483646};pointer-events:auto;background:rgba(15,23,42,0.04);cursor:${e?"crosshair":"default"};touch-action:none;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;`}),this.overlay.setAttribute("role","application"),this.overlay.setAttribute("aria-label",e?o:this.t("annotator.instantInstruction")),this.overlay.setAttribute("data-siteping-ignore","true"),e){this.toolbar=chunkQ34GDCKE_cjs.y("div",{style:`position:fixed;top:0;left:0;right:0;z-index:${2147483647};pointer-events:auto;min-height:52px;box-sizing:border-box;padding:calc(env(safe-area-inset-top,0px) + 8px) ${n?"12px 8px 16px":"16px 8px"};background:${n?this.colors.bg:this.colors.glassBg};backdrop-filter:blur(24px);-webkit-backdrop-filter:blur(24px);border-bottom:1px solid ${this.colors.glassBorder};display:flex;align-items:center;justify-content:center;gap:${n?12:16}px;font-family:"Inter",system-ui,-apple-system,sans-serif;font-size:14px;line-height:1.35;color:${this.colors.text};box-shadow:0 4px 16px ${this.colors.shadow};-webkit-font-smoothing:antialiased;`}),this.toolbar.setAttribute("data-siteping-ignore","true");let s=chunkQ34GDCKE_cjs.y("span",{style:`width:8px;height:8px;border-radius:50%;flex-shrink:0;background:${this.colors.accent};box-shadow:0 0 8px ${this.colors.accentGlow};animation:pulse 1.5s ease-in-out infinite;`}),a=document.createElement("style");a.textContent=["@keyframes pulse{0%,100%{opacity:1}50%{opacity:0.4}}","@media(prefers-reduced-motion:reduce){@keyframes pulse{from,to{opacity:1}}}"].join(""),this.toolbar.appendChild(a);let l=chunkQ34GDCKE_cjs.y("span",{style:"font-weight:500;letter-spacing:-0.01em;min-width:0;"});chunkQ34GDCKE_cjs.z(l,i?this.t("annotator.touchInstruction"):o);let c=document.createElement("button");c.style.cssText=`height:${i?40:34}px;padding:0 18px;border-radius:9999px;flex-shrink:0;border:1px solid ${this.colors.border};background:${this.colors.glassBg};color:${this.colors.textTertiary};font-family:"Inter",system-ui,-apple-system,sans-serif;font-size:13px;font-weight:500;cursor:pointer;transition:all 0.2s ease;`,chunkQ34GDCKE_cjs.z(c,this.t("annotator.cancel")),c.addEventListener("click",()=>this.cancelSession()),c.addEventListener("mouseenter",()=>{c.style.borderColor=this.colors.typeBug,c.style.color=this.colors.typeBug,c.style.background=this.colors.typeBugBg;}),c.addEventListener("mouseleave",()=>{c.style.borderColor=this.colors.border,c.style.color=this.colors.textTertiary,c.style.background=this.colors.glassBg;}),this.toolbar.appendChild(s),this.toolbar.appendChild(l),this.toolbar.appendChild(c);}e&&(this.overlay.addEventListener("mousedown",this.onMouseDown),this.overlay.addEventListener("mousemove",this.onMouseMove),this.overlay.addEventListener("mouseup",this.onMouseUp),this.overlay.addEventListener("touchstart",this.onTouchStart,{passive:false}),this.overlay.addEventListener("touchmove",this.onTouchMove,{passive:false}),this.overlay.addEventListener("touchend",this.onTouchEnd),this.overlay.addEventListener("keydown",this.onOverlayKeyDown)),this.overlay.setAttribute("tabindex","0"),document.addEventListener("keydown",this.onKeyDown),chunkQ34GDCKE_cjs.F(this.overlay),this.toolbar&&chunkQ34GDCKE_cjs.F(this.toolbar),document.body.appendChild(this.overlay),this.toolbar&&document.body.appendChild(this.toolbar),this.overlay.focus({preventScroll:true});}toolbarInsets(){if(!this.toolbar)return ne;let e=this.toolbar.getBoundingClientRect();if(e.height===0)return ne;let n=window.innerHeight;return e.top+e.height/2<n/2?{top:Math.max(0,e.bottom),bottom:0}:{top:0,bottom:Math.max(0,n-e.top)}}cancelSession(){this.isActive&&(this.popup.dismiss(),!this.popup.isOpen&&this.deactivate());}deactivate(){if(!this.isActive)return;this.isActive=false,this.isDrawing=false,this.instantMode=false;let e=this.preActiveFocusElement;this.preActiveFocusElement=null,this.keyboardTarget=null,this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.pendingMoveEvent=null,document.body.style.overflow=this.savedOverflow,document.removeEventListener("keydown",this.onKeyDown),this.overlay?.remove(),this.toolbar?.remove(),this.drawingRect?.remove(),this.overlay=null,this.toolbar=null,this.drawingRect=null,e instanceof HTMLElement&&e.isConnected&&e.focus({preventScroll:true}),this.bus.emit("annotation:end");}onKeyDown=e=>{e.key==="Escape"&&this.cancelSession();};onOverlayKeyDown=async e=>{if(e.key!=="Enter"||(e.preventDefault(),this.popup.isOpen)||this.isDrawing)return;let n=this.keyboardTarget;!n||!(n instanceof HTMLElement)||await this.annotateElement(n);};async annotateElement(e,n=false){let i=e.getBoundingClientRect();if(i.width<=0||i.height<=0)return;let o=new DOMRect(i.x,i.y,i.width,i.height);this.drawingRect?.remove();let r=this.createDrawingRect();r.style.left=`${i.x}px`,r.style.top=`${i.y}px`,r.style.width=`${i.width}px`,r.style.height=`${i.height}px`,this.drawingRect=r,this.overlay?.appendChild(r);let a={anchor:ft(e),rect:{xPct:0,yPct:0,wPct:1,hPct:1},scrollX:window.scrollX,scrollY:window.scrollY,viewportW:window.innerWidth,viewportH:window.innerHeight,devicePixelRatio:window.devicePixelRatio},l=await this.openForm(a,o,n?zn(o):o);this.drawingRect?.remove(),this.drawingRect=null,l&&this.deactivate();}onMouseDown=e=>{this.startDrawing(e.clientX,e.clientY);};onTouchStart=e=>{e.preventDefault();let n=e.touches[0];n&&this.startDrawing(n.clientX,n.clientY);};startDrawing(e,n){this.popup.isOpen||(this.isDrawing=true,this.startX=e,this.startY=n,this.drawingRect?.remove(),this.drawingRect=this.createDrawingRect(),this.overlay?.appendChild(this.drawingRect));}createDrawingRect(){let e=chunkQ34GDCKE_cjs.y("div",{style:`position:fixed;border:2px solid ${this.colors.accent};background:${this.colors.accent}12;pointer-events:none;border-radius:8px;box-shadow:0 0 16px ${this.colors.accentGlow};transition:box-shadow 0.15s ease;`});return e.setAttribute("data-siteping-ignore","true"),e}onMouseMove=e=>{this.scheduleRectUpdate(e);};onTouchMove=e=>{e.preventDefault(),e.touches[0]&&this.scheduleRectUpdate(e.touches[0]);};scheduleRectUpdate(e){!this.isDrawing||!this.drawingRect||(this.pendingMoveEvent=e,this.rafId===null&&(this.rafId=requestAnimationFrame(()=>{this.rafId=null;let n=this.pendingMoveEvent;if(!n||!this.drawingRect)return;let i=Math.min(n.clientX,this.startX),o=Math.min(n.clientY,this.startY),r=Math.abs(n.clientX-this.startX),s=Math.abs(n.clientY-this.startY);this.drawingRect.style.left=`${i}px`,this.drawingRect.style.top=`${o}px`,this.drawingRect.style.width=`${r}px`,this.drawingRect.style.height=`${s}px`;})));}onTouchEnd=async e=>{let n=e.changedTouches[0];if(n){if(this.isDrawing&&(Math.abs(n.clientX-this.startX)<Fe||Math.abs(n.clientY-this.startY)<Fe)){this.isDrawing=false,this.drawingRect?.remove(),this.drawingRect=null;let i=this.elementAt(n.clientX,n.clientY);i&&await this.annotateElement(i,true);return}await this.finishDrawing(n.clientX,n.clientY);}};elementAt(e,n){this.overlay&&(this.overlay.style.pointerEvents="none");let i=mt(e,n);this.overlay&&(this.overlay.style.pointerEvents="auto");let o=i instanceof SVGElement?(i.ownerSVGElement??i).parentElement:i;return o instanceof HTMLElement&&o!==document.body&&o!==document.documentElement&&!Z(o)?o:null}onMouseUp=async e=>{await this.finishDrawing(e.clientX,e.clientY);};finishDrawing=async(e,n)=>{if(!this.isDrawing||!this.drawingRect)return;this.isDrawing=false;let i=Math.min(e,this.startX),o=Math.min(n,this.startY),r=Math.abs(e-this.startX),s=Math.abs(n-this.startY);if(r<Fe||s<Fe){this.drawingRect.remove(),this.drawingRect=null;return}let a=new DOMRect(i,o,r,s),{annotation:l}=this.buildAnnotation(a),c=await this.openForm(l,a);this.drawingRect?.remove(),this.drawingRect=null,c&&this.deactivate();};async startInstantAnnotation(e,n){if(this.isActive)return;this.instantMode=true,this.bus.emit("annotation:start");let i=Math.max(0,Math.min(e-20/2,window.innerWidth-20)),o=Math.max(0,Math.min(n-20/2,window.innerHeight-20)),r=new DOMRect(i,o,20,20),{annotation:s,anchorBounds:a}=this.buildAnnotation(r),l=zn(a);this.drawingRect?.remove(),this.drawingRect=chunkQ34GDCKE_cjs.y("div",{style:`position:fixed;left:${i}px;top:${o}px;width:${20}px;height:${20}px;border:2px solid ${this.colors.accent};background:${this.colors.accent}12;pointer-events:none;border-radius:8px;box-shadow:0 0 16px ${this.colors.accentGlow};`}),this.drawingRect.setAttribute("data-siteping-ignore","true"),this.overlay?.appendChild(this.drawingRect),await this.openForm(s,r,l),this.drawingRect?.remove(),this.drawingRect=null,this.deactivate();}openForm(e,n,i=n){let o=Yi(),r=this.popup.show(n,s=>this.runSubmission(e,s,i,o),this.toolbarInsets());return this.revealSelection(n),r}revealSelection(e){let n=this.popup.sheetTop;if(n===null||!this.drawingRect)return;let i=Math.min(e.bottom+16-n,e.top-72);if(i<=0)return;let o=window.scrollY;window.scrollBy({top:i,behavior:"instant"}),this.drawingRect.style.top=`${e.top-(window.scrollY-o)}px`;}async runSubmission(e,n,i,o){o.screenshot===void 0&&(o.screenshot=await this.maybeCapture(new DOMRect(i.x+e.scrollX-window.scrollX,i.y+e.scrollY-window.scrollY,i.width,i.height)));let r=o.screenshot;await new Promise((s,a)=>{let l=()=>{c(),p(),h(),this.rejectPendingSubmission=null;},c=this.bus.on("feedback:sent",()=>{l(),s();}),p=this.bus.on("feedback:error",d=>{l(),a(d);}),h=this.bus.on("submission:cancelled",()=>{l(),a(new Error("Feedback submission cancelled"));});this.rejectPendingSubmission=d=>{l(),a(d);},this.bus.emit("annotation:complete",{annotation:e,type:n.type,message:n.message,clientId:o.clientId,screenshotDataUrl:r?.dataUrl??null,screenshotRegion:r?.region??null});});}buildAnnotation(e){this.overlay&&(this.overlay.style.pointerEvents="none");let n=_n(e);this.overlay&&(this.overlay.style.pointerEvents="auto");let i=ft(n),o=n.getBoundingClientRect(),r=Nn(e,o);return {annotation:{anchor:i,rect:r,scrollX:window.scrollX,scrollY:window.scrollY,viewportW:window.innerWidth,viewportH:window.innerHeight,devicePixelRatio:window.devicePixelRatio},anchorBounds:o}}destroy(){this.deactivate(),this.unregisterEscapeLayer(),this.rejectPendingSubmission?.(new Error("Annotator destroyed during submission")),this.popup.destroy();}};function He(t,e){let n=`siteping_own_feedback:${JSON.stringify([t,e??null])}`,i=()=>{try{let r=JSON.parse(localStorage.getItem(n)??"[]");return new Set(Array.isArray(r)?r.filter(s=>typeof s=="string"):[])}catch{return new Set}},o=r=>{try{r.size>0?localStorage.setItem(n,JSON.stringify([...r].slice(-500))):localStorage.removeItem(n);}catch{}};return {ids:i,add(r){let s=i();s.delete(r),o(s.add(r));},remove(...r){let s=i(),a=s.size;for(let l of r)s.delete(l);s.size<a&&o(s);},clear:()=>o(new Set)}}var Xn=3,he=1e4,Y="siteping_retry_queue",Ui=20;function vt(t,e,n){let i,o=new Promise((r,s)=>{i=setTimeout(()=>s(n()),e);});return Promise.race([t,o]).finally(()=>clearTimeout(i))}async function qn(t,e){let n={};e&&(n["Content-Type"]="application/json"),t.apiKey&&(n.Authorization=`Bearer ${t.apiKey}`);let i=typeof t.headers=="function"?await vt(Promise.resolve(t.headers()),he,()=>new Error(`headers factory did not settle within ${he/1e3} s`)):t.headers;return chunkQ34GDCKE_cjs.r(n,i)}async function ie(t,e,n,i,{boundBody:o=false}={}){for(let r=0;;r++){let s=new AbortController,a=setTimeout(()=>s.abort(),he);try{let p=await fetch(t,{...e,signal:s.signal}).catch(h=>{if(r===Xn)throw chunkQ34GDCKE_cjs.v(h,n);return null});if(p&&(p.ok||p.status>=400&&p.status<500||r===Xn)){if(clearTimeout(a),o&&(a=setTimeout(()=>s.abort(),he)),!p.ok)throw await chunkQ34GDCKE_cjs.t(p,n);return await i(p).catch(h=>{throw chunkQ34GDCKE_cjs.v(h,n)})}}finally{clearTimeout(a);}let l=1e3*2**r,c=Math.random()*1e3-500;await new Promise(p=>setTimeout(p,l+c));}}function qi(t){return t instanceof chunkQ34GDCKE_cjs.c||t instanceof chunkQ34GDCKE_cjs.b&&t.code==="SERVER"}function Vi(t){return t>=500}var Gi="siteping_retry_queue";async function xt(t){return typeof navigator<"u"&&navigator.locks?navigator.locks.request(Gi,()=>t()):t()}function Qi(t){if(!chunkQ34GDCKE_cjs.d(t,"endpoint")||typeof t.endpoint!="string"||!chunkQ34GDCKE_cjs.d(t,"payload"))return false;let{payload:e}=t;return chunkQ34GDCKE_cjs.d(e,"authorName")&&typeof e.authorName=="string"&&chunkQ34GDCKE_cjs.d(e,"authorEmail")&&typeof e.authorEmail=="string"}function wt(){let t=localStorage.getItem(Y);if(!t)return [];let e;try{e=JSON.parse(t);}catch{return localStorage.removeItem(Y),console.warn(`[siteping] discarded an unreadable retry queue from localStorage (${t.length} chars)`),[]}return Array.isArray(e)?e.filter(Qi):[]}function Ji(t,e){xt(()=>{try{let n=wt().filter(r=>r.payload.clientId!==e.clientId);if(n.length>=Ui&&n.shift(),n.push({endpoint:t,payload:e}),yt(n))return;let i=n.slice(),o=0;for(let[r,s]of i.entries())if(Kn(s)&&(i[r]=eo(s),o+=1,yt(i))){console.warn(`[siteping] retry queue exceeded the localStorage quota \u2014 dropped the screenshot of ${o} of ${n.length} queued feedback(s)`);return}for(;i.length>1;)if(i.shift(),yt(i)){let r=n.length-i.length,s=n.slice(r).filter(Kn).length;console.warn(`[siteping] retry queue exceeded the localStorage quota \u2014 dropped the ${r} oldest of ${n.length} queued feedback(s)${s>0?`, and the screenshot of ${s} of the rest`:""}`);return}console.warn("[siteping] feedback could not be queued for retry \u2014 localStorage is full or unavailable");}catch{}});}function Zi(t){xt(()=>{try{let e=wt(),n=e.filter(i=>i.payload.clientId!==t);if(n.length===e.length)return;n.length>0?localStorage.setItem(Y,JSON.stringify(n)):localStorage.removeItem(Y);}catch{}});}function yt(t){try{return localStorage.setItem(Y,JSON.stringify(t)),!0}catch{return false}}function Kn(t){return t.payload.screenshotDataUrl!=null}function eo(t){let{screenshotDataUrl:e,screenshotRegion:n,...i}=t.payload;return {endpoint:t.endpoint,payload:i}}function Wn(t){return t.trim()}function jn(t){return t.trim().toLowerCase()}async function Vn(t,e,n={}){await xt(async()=>{try{let i=wt();if(i.length===0)return;let o=[],r=[],s=0;for(let p of i){if(p.endpoint!==t){r.push(p);continue}!e||Wn(p.payload.authorName)===Wn(e.name)&&jn(p.payload.authorEmail)===jn(e.email)?o.push(p):s+=1;}if(o.length===0&&s===0)return;s>0;let a=[],l=0;if(o.length>0){let p=await qn(n,!0);for(let h of o){let d=new AbortController,f=setTimeout(()=>d.abort(),he);try{let m=await fetch(t,{method:"POST",headers:p,body:JSON.stringify(h.payload),signal:d.signal});if(m.ok){let v=await m.json().catch(()=>null);chunkQ34GDCKE_cjs.d(v,"id")&&typeof v.id=="string"&&He(h.payload.projectName,t).add(v.id);continue}Vi(m.status)?a.push(h):l+=1;}catch{a.push(h);}finally{clearTimeout(f);}}}l>0&&console.warn(`[siteping] flushRetryQueue: dropped ${l} queued feedback(s) the server rejected (4xx) \u2014 they would fail identically on every replay`);let c=r.concat(a);c.length>0?localStorage.setItem(Y,JSON.stringify(c)):localStorage.removeItem(Y);}catch{}});}function Yn(t,e){let n=Math.min(1,Math.max(0,t)),i=e-(n-t);return [n,Math.max(0,n+i<=1?i:1-n)]}function to(t){let[e,n]=Yn(t.rect.xPct,t.rect.wPct),[i,o]=Yn(t.rect.yPct,t.rect.hPct);return {...t,rect:{xPct:e,yPct:i,wPct:n,hPct:o}}}async function De(t){return await t.json()}async function Un(){}var $e=class{constructor(e,n,i={}){this.endpoint=e;this.projectName=n;this.auth=i;}endpoint;projectName;auth;async headers(e,n){try{return await qn(this.auth,e)}catch(i){throw chunkQ34GDCKE_cjs.v(i,n)}}async sendFeedback(e){let n="Failed to send feedback",{screenshotRegion:i,...o}=e,r={...o,annotations:o.annotations.map(to)},s=i?{...r,screenshotRegion:i}:r;try{let a=await ie(this.endpoint,{method:"POST",headers:await this.headers(!0,n),body:JSON.stringify(s)},n,De,{boundBody:!0});return Zi(s.clientId),a}catch(a){throw qi(a)&&Ji(this.endpoint,s),a}}async getFeedbacks(e,n){let i="Failed to fetch feedbacks",o=chunkQ34GDCKE_cjs.q({projectName:e,...n}),r=await this.headers(false,i);return ie(chunkQ34GDCKE_cjs.s(this.endpoint,o),{method:"GET",cache:"no-store",...Object.keys(r).length>0?{headers:r}:{}},i,De)}async addComment(e,n){let i="Failed to post comment";return ie(this.endpoint,{method:"POST",headers:await this.headers(true,i),body:JSON.stringify({...n,projectName:this.projectName,feedbackId:e})},i,De,{boundBody:true})}async resolveFeedback(e,n){let i="Failed to update feedback";return ie(this.endpoint,{method:"PATCH",headers:await this.headers(true,i),body:JSON.stringify({id:e,projectName:this.projectName,status:n?"resolved":"open"})},i,De)}async deleteFeedback(e){let n="Failed to delete feedback";await ie(this.endpoint,{method:"DELETE",headers:await this.headers(true,n),body:JSON.stringify({id:e,projectName:this.projectName})},n,Un);}async deleteAllFeedbacks(e){let n="Failed to delete all feedbacks";await ie(this.endpoint,{method:"DELETE",headers:await this.headers(true,n),body:JSON.stringify({projectName:e,deleteAll:true})},n,Un);}};function Be(t,e){if(t.length<=e)return t;let n=e-1,i=t.charCodeAt(n-1);return i>=55296&&i<=56319&&(n-=1),`${t.slice(0,n)}\u2026`}var Et=50,kt=500,no=["log","info","warn","error"];function io(t){if(t===null)return "null";if(t===void 0)return "undefined";if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean"||typeof t=="bigint")return String(t);if(t instanceof Error)return `${t.name}: ${t.message}${t.stack?`
|
|
2
|
+
${t.stack}`:""}`;try{let e=[],n=kt;return JSON.stringify(t,function(i,o){if(!(--n<0)){if(typeof o=="function")return "[Function]";if(typeof o=="symbol")return o.toString();if(typeof o!="object"||o===null)return o;for(;e.length>0&&e[e.length-1]!==this;)e.pop();return e.includes(o)?"[Circular]":(e.push(o),o)}})}catch{try{return String(t)}catch{return "[Unserializable]"}}}function oo(t){let e="";for(let n=0;n<t.length&&(n>0&&(e+=" "),e+=io(t[n]),!(e.length>=kt));n++);return Be(e,kt)}var ze=class{maxEntries;entries=[];originals=new Map;wrappers=new Map;disposed=false;constructor(e=Et){if(this.maxEntries=Number.isFinite(e)&&e>=0?Math.min(Math.floor(e),Et):Et,!(typeof console>"u"))for(let n of no){let i=console[n];if(typeof i!="function")continue;this.originals.set(n,i);let o=this,r=function(...s){try{o.push(n,s);}catch{}i.apply(this??console,s);};try{Object.defineProperty(r,"name",{value:n});}catch{}this.wrappers.set(n,r),console[n]=r;}}push(e,n){this.maxEntries!==0&&(this.entries.length>=this.maxEntries&&this.entries.shift(),this.entries.push({level:e,timestamp:new Date().toISOString(),message:oo(n)}));}getEntries(){return this.entries.slice()}dispose(){if(this.disposed||(this.disposed=true,typeof console>"u"))return;let e=console;for(let[n,i]of this.originals)if(e[n]===this.wrappers.get(n))try{e[n]=i;}catch{}this.originals.clear(),this.wrappers.clear();}};var St=20,so=2e3,ro=20,ao=6e5,lo=599;function Gn(t){let e=co(po(t)),n=e.search(/[?#]/);return Be(n===-1?e:e.slice(0,n),so)}function co(t){try{let e=new URL(t,typeof location>"u"?void 0:location.href);return !e.username&&!e.password?t:(e.username="",e.password="",e.href)}catch{return t}}function po(t){if(typeof t=="string")return t;if(t instanceof URL)return t.href;if(typeof t=="object"&&t!==null&&"url"in t){let e=t.url;if(typeof e=="string")return e}try{return String(t)}catch{return "(unknown)"}}var Xe=class{maxEntries;entries=[];originalFetch=null;originalXhrOpen=null;originalXhrSend=null;wrappedFetch=null;wrappedXhrOpen=null;wrappedXhrSend=null;disposed=false;constructor(e=St){this.maxEntries=Number.isFinite(e)&&e>=0?Math.min(Math.floor(e),St):St,this.installFetch(),this.installXhr();}push(e){this.maxEntries!==0&&(this.entries.length>=this.maxEntries&&this.entries.shift(),this.entries.push({...e,method:e.method.slice(0,ro),status:e.status<=lo?e.status:0,durationMs:Math.min(Math.max(e.durationMs,0),ao)}));}installFetch(){if(typeof globalThis.fetch!="function")return;let e=globalThis.fetch;this.originalFetch=e;let n=async(i,o)=>{let r=new Date,s=typeof performance<"u"?performance.now():Date.now(),a=Gn(i),l=(o?.method??(i instanceof Request?i.method:"GET")).toUpperCase();try{let c=await e(i,o);if(!c.ok){let p=typeof performance<"u"?performance.now():Date.now();this.push({url:a,method:l,status:c.status,durationMs:Math.round(p-s),timestamp:r.toISOString()});}return c}catch(c){let p=typeof performance<"u"?performance.now():Date.now();throw this.push({url:a,method:l,status:0,durationMs:Math.round(p-s),timestamp:r.toISOString()}),c}};this.wrappedFetch=n,globalThis.fetch=n;}installXhr(){if(typeof XMLHttpRequest>"u")return;let e=XMLHttpRequest.prototype,n=e.open,i=e.send;this.originalXhrOpen=n,this.originalXhrSend=i;let o=this,r=new WeakMap,s=function(l,c,...p){try{r.set(this,{method:l.toUpperCase(),url:Gn(c),startedAt:new Date,t0:typeof performance<"u"?performance.now():Date.now()});}catch{}return n.call(this,l,c,...p)},a=function(l){let c=r.get(this);if(c){let p=()=>{try{let h=typeof performance<"u"?performance.now():Date.now(),d=this.status;(d===0||d>=400)&&o.push({url:c.url,method:c.method,status:d,durationMs:Math.round(h-c.t0),timestamp:c.startedAt.toISOString()});}catch{}};try{this.addEventListener("loadend",p,{once:!0});}catch{try{this.addEventListener("loadend",p);}catch{}}}return i.call(this,l??null)};this.wrappedXhrOpen=s,this.wrappedXhrSend=a,e.open=s,e.send=a;}getEntries(){return this.entries.slice()}dispose(){if(!this.disposed){if(this.disposed=true,this.originalFetch&&globalThis.fetch===this.wrappedFetch)try{globalThis.fetch=this.originalFetch;}catch{}if(typeof XMLHttpRequest<"u")try{let e=XMLHttpRequest.prototype;this.originalXhrOpen&&e.open===this.wrappedXhrOpen&&(e.open=this.originalXhrOpen),this.originalXhrSend&&e.send===this.wrappedXhrSend&&(e.send=this.originalXhrSend);}catch{}}}};var fe=class{listeners=new Map;on(e,n){let i=this.listeners.get(e);return i||(i=new Set,this.listeners.set(e,i)),i.add(n),()=>{i?.delete(n);}}off(e,n){this.listeners.get(e)?.delete(n);}emit(e,...n){let i=this.listeners.get(e);if(i)for(let o of i)try{o(...n);}catch(r){console.error(`[siteping] Error in event listener for "${String(e)}":`,r);}}removeAll(){this.listeners.clear();}};var uo=54,ho=60,fo={chat:"fab.messages",annotate:"fab.annotate","toggle-annotations":"fab.annotations"},Ke=class{constructor(e,n,i,o){this.bus=i;this.t=o;let r=n.position??"bottom-right";this.items=[{id:"chat",icon:chunkQ34GDCKE_cjs.Z},{id:"annotate",icon:chunkQ34GDCKE_cjs._}],n.showAnnotationsToggle!==false&&this.items.push({id:"toggle-annotations",icon:chunkQ34GDCKE_cjs.K,iconAlt:chunkQ34GDCKE_cjs.L}),this.fab=document.createElement("button"),this.fab.className=`sp-fab sp-fab--${r} sp-anim-fab-in`,this.fab.style.position="fixed",this.fab.appendChild(chunkQ34GDCKE_cjs.x(chunkQ34GDCKE_cjs.J)),this.fab.setAttribute("aria-expanded","false"),this.fab.addEventListener("click",()=>this.toggle()),this.radialContainer=document.createElement("div"),this.radialContainer.className=`sp-radial sp-radial--${r}`,this.radialContainer.setAttribute("role","menu");for(let l=0;l<this.items.length;l++){let c=this.items[l];if(!c)continue;let p=document.createElement("button");p.className="sp-radial-item",p.style.setProperty("--sp-i",String(l)),p.appendChild(chunkQ34GDCKE_cjs.x(c.icon)),p.setAttribute("role","menuitem"),p.dataset.itemId=c.id,p.addEventListener("click",d=>{d.stopPropagation(),this.handleItemClick(c.id);});let h=document.createElement("span");h.className="sp-radial-label",p.appendChild(h),this.radialContainer.appendChild(p);}this.scrim=document.createElement("div"),this.scrim.className="sp-scrim",this.scrim.addEventListener("click",()=>this.close()),this.root=document.createElement("div"),this.root.appendChild(this.scrim),this.root.appendChild(this.radialContainer),this.root.appendChild(this.fab),e.appendChild(this.root),this.applyLabels();let s=e.host;this.onDocumentClick=l=>{this.isOpen&&!l.composedPath().includes(s)&&this.close();},document.addEventListener("click",this.onDocumentClick,true);let a=l=>{l.key==="Escape"&&this.isOpen&&(l.stopPropagation(),this.close());};this.fab.addEventListener("keydown",a),this.radialContainer.addEventListener("keydown",a),chunkQ34GDCKE_cjs.H(this.root,()=>this.isOpen),this.radialContainer.addEventListener("keydown",l=>{let c=Array.from(this.radialContainer.querySelectorAll(".sp-radial-item"));if(c.length===0||!this.isOpen)return;let p=e.activeElement??document.activeElement,h=c.indexOf(p);switch(l.key){case "ArrowUp":{l.preventDefault();let d=h<=0?c.length-1:h-1;c[d]?.focus();break}case "ArrowDown":{l.preventDefault();let d=h>=c.length-1?0:h+1;c[d]?.focus();break}case "Home":{l.preventDefault(),c[0]?.focus();break}case "End":{l.preventDefault(),c[c.length-1]?.focus();break}}});}bus;t;root;scrim;fab;radialContainer;badgeEl=null;isOpen=false;annotationsVisible=true;items;onDocumentClick;refreshLabels(){this.applyLabels();}applyLabels(){this.fab.setAttribute("aria-label",this.t("fab.aria"));let e=this.radialContainer.querySelectorAll(".sp-radial-item");for(let n of e){let i=n.dataset.itemId;if(!i)continue;let o=fo[i];if(!o)continue;let r=this.t(o);n.setAttribute("aria-label",r);let s=n.querySelector(".sp-radial-label");s&&chunkQ34GDCKE_cjs.z(s,r);}}updateBadge(e){if(e<=0){this.badgeEl?.remove(),this.badgeEl=null;return}this.badgeEl||(this.badgeEl=document.createElement("span"),this.badgeEl.className="sp-fab-badge",this.badgeEl.setAttribute("role","status"),this.badgeEl.setAttribute("aria-live","polite"),this.fab.appendChild(this.badgeEl));let n=e>99?"99+":String(e);chunkQ34GDCKE_cjs.z(this.badgeEl,n),this.badgeEl.setAttribute("aria-label",chunkQ34GDCKE_cjs.ka(this.t,"fab.badge",{count:e}));}toggle(){this.isOpen?this.close():this.open();}open(){this.isOpen=true,this.setFabIcon(chunkQ34GDCKE_cjs.M),this.fab.setAttribute("aria-expanded","true"),this.scrim.classList.add("sp-scrim--open");let e=chunkQ34GDCKE_cjs.ga()?ho:uo;this.radialContainer.querySelectorAll(".sp-radial-item").forEach((i,o)=>{let r=-(16+e*(o+1));i.style.transform=`translate(0px, ${r}px) scale(1)`,i.classList.add("sp-radial-item--open");}),requestAnimationFrame(()=>{this.radialContainer.querySelector(".sp-radial-item")?.focus();});}close(){this.isOpen=false,this.setFabIcon(chunkQ34GDCKE_cjs.J),this.fab.setAttribute("aria-expanded","false"),this.scrim.classList.remove("sp-scrim--open"),this.radialContainer.querySelectorAll(".sp-radial-item").forEach(n=>{n.style.transform="translate(0, 0) scale(0.8)",n.classList.remove("sp-radial-item--open");}),this.fab.focus();}setFabIcon(e){let n=this.badgeEl;this.fab.replaceChildren(chunkQ34GDCKE_cjs.x(e)),n&&this.fab.appendChild(n);}handleItemClick(e){switch(this.close(),e){case "chat":this.bus.emit("panel:toggle",true);break;case "annotate":{let n=this.bus.on("annotation:end",()=>{n(),this.fab.focus();});this.bus.emit("annotation:start");break}case "toggle-annotations":{this.annotationsVisible=!this.annotationsVisible,this.bus.emit("annotations:toggle",this.annotationsVisible);let i=this.radialContainer.querySelector('[data-item-id="toggle-annotations"]')?.querySelector("svg");if(i){let o=chunkQ34GDCKE_cjs.x(this.annotationsVisible?chunkQ34GDCKE_cjs.K:chunkQ34GDCKE_cjs.L);i.replaceWith(o);}break}}}destroy(){document.removeEventListener("click",this.onDocumentClick,true),this.root.remove();}};var Qn="siteping_identity";function mo(t){if(!chunkQ34GDCKE_cjs.d(t,"name")||!chunkQ34GDCKE_cjs.d(t,"email"))return false;let{name:e,email:n}=t;return typeof e=="string"&&typeof n=="string"&&e.length>0&&e.length<=chunkQ34GDCKE_cjs.e&&n.length<=chunkQ34GDCKE_cjs.e&&chunkQ34GDCKE_cjs.a(n)}function Tt(){try{let t=localStorage.getItem(Qn);if(!t)return null;let e=JSON.parse(t);return mo(e)?e:null}catch{return null}}function Jn(t){try{localStorage.setItem(Qn,JSON.stringify(t));}catch{}}function oe(t){return t.normalize("NFC").replace(/\s+/g," ").trim()}function Zn(t){return t.replace(/\s+/g," ").trim()}function bo(t,e){if(t===e)return 0;if(t.length===0)return e.length;if(e.length===0)return t.length;if(t.length>e.length){let s=t;t=e,e=s;}let n=t.length,i=e.length,o=new Array(n+1);for(let s=0;s<=n;s++)o[s]=s;let r=new Array(n+1);for(let s=1;s<=i;s++){r[0]=s;for(let l=1;l<=n;l++){let c=o[l-1];r[l]=t[l-1]===e[s-1]?c:1+Math.min(c,o[l],r[l-1]);}let a=o;o=r,r=a;}return o[n]}function me(t,e){if(t===e)return 1;let n=Math.max(t.length,e.length);return n===0?1:1-bo(t,e)/n}function go(t,e){let n=e.length,i=new Int32Array(n+1),o=new Int32Array(n+1);for(let s=0;s<=n;s++)i[s]=s;let r=n;for(let s=1;s<=t.length;s++){o[0]=0;let a=t.charCodeAt(s-1);for(let p=1;p<=n;p++){let h=i[p-1]+(e.charCodeAt(p-1)===a?0:1),d=i[p]+1,f=o[p-1]+1;o[p]=Math.min(h,d,f);}let l=o[n];l<r&&(r=l);let c=i;i=o,o=c;}return r}function ei(t,e,n=.6){if(!e||!t)return 0;if(t.includes(e))return 1;let i=t.length>500?t.slice(0,500):t;if(e.length>i.length){let r=me(i,e);return r>=n?r:0}if(e.length<8&&i.length>64)return 0;let o=1-go(i,e)/e.length;return o>=n?o:0}function ti(t){let e=new Map;for(let n=0;n<t.length-1;n++){let i=t.charCodeAt(n)<<16|t.charCodeAt(n+1);e.set(i,(e.get(i)??0)+1);}return e}function ni(t,e,n){let i=n.length-1;if(e<=0||i<=0)return 0;let o=0,r=new Map;for(let s=0;s<n.length-1;s++){let a=n.charCodeAt(s)<<16|n.charCodeAt(s+1),l=t.get(a);if(l===void 0)continue;let c=r.get(a)??0;c<l&&(r.set(a,c+1),o++);}return 2*o/(e+i)}function ii(t){let e=new Map,n=t.split(" ");for(let i=0;i<n.length-1;i++){let o=`${n[i]} ${n[i+1]}`;e.set(o,(e.get(o)??0)+1);}return e}function oi(t,e,n){if(e<=0)return 0;let i=n.split(" "),o=i.length-1;if(o<=0)return 0;let r=0,s=new Map;for(let a=0;a<i.length-1;a++){let l=`${i[a]} ${i[a+1]}`,c=t.get(l);if(c===void 0)continue;let p=s.get(l)??0;p<c&&(s.set(l,p+1),r++);}return 2*r/(e+o)}var yo={checkOpacity:true,opacityProperty:true,checkVisibilityCSS:true,visibilityProperty:true};function be(t){if(!t.isConnected)return "hidden";if(typeof t.checkVisibility=="function")return t.checkVisibility(yo)?"visible":t.checkVisibility()?"soft-hidden":"hidden";if(t.getClientRects().length>0)try{return getComputedStyle(t).visibility==="visible"?"visible":"soft-hidden"}catch{return "visible"}let e=t.firstElementChild;return e&&e.getClientRects().length>0?"visible":t.ownerDocument.documentElement.getClientRects().length===0?"unknown":"hidden"}function si(t){switch(t){case "hidden":return .3;case "soft-hidden":return .6;default:return 1}}var se={anchorKey:1,id:1,css:.95,xpath:.9,scan:.85},At=16,vo=24,ri=1e4,Mt=500,xo=.5,Ct=.6,wo=.4,Eo=2e3,Pt=.8,Rt=.6,ko=.05;function We(t,e){return oe((t??"").slice(0,Eo)).slice(0,e)}function So(t){let e=We(t.textSnippet,Mt),n=ii(e),i=0;for(let o of n.values())i+=o;return {snippet:e,snippetBigrams:ti(e),snippetBigramTotal:Math.max(0,e.length-1),snippetWordPairs:n,snippetWordPairTotal:i,prefix:We(t.textPrefix,128),suffix:We(t.textSuffix,128),neighbor:We(t.neighborText,128),fingerprint:(t.fingerprint??"").slice(0,64),tag:typeof t.elementTag=="string"?t.elementTag:""}}function To(t,e){let n=So(t),{pool:i,treeRoots:o}=Ro(t),r=[];for(let[d,f]of i){let m=ai(d,f,n);m&&r.push(m);}let s=0,a=false;for(let d of r)d.final>s&&(s=d.final),(d.strategy==="id"||d.strategy==="anchorKey")&&d.visibility===1&&(d.signals?.text??0)>=Pt&&(d.signals?.fingerprint===void 0||d.signals.fingerprint>=Pt)&&(a=true);let l=!!(n.snippet||n.fingerprint||n.prefix||n.suffix||n.neighbor),c=e?.scanBudget;if(l&&o.length>0&&s<se.scan&&!a)if(c&&c.remaining<=0)c.starved=true;else {c&&c.remaining--;for(let d of Ao(n,i,o)){let f=ai(d,"scan",n);f&&r.push(f);}}let p=r.filter(Po);if(p.length===0)return null;p.sort((d,f)=>f.final-d.final);let h=Io(p);return {element:h.element,confidence:Lo(h),strategy:h.strategy}}function je(t,e){let n=[];for(let i of t){let o=i.querySelectorAll(e);for(let r=0;r<o.length&&n.length<At;r++){let s=o[r];s&&n.push(s);}if(n.length===At)break}return n}function Co(t){let e=[],n=[document];for(let i of t){let o;try{o=je(n,i);}catch{return []}let r=[];for(let s of o)s.shadowRoot&&r.push(s.shadowRoot);if(r.length===0)return [];e.push(r),n=r;}return e}function Ro(t){let e=new Map,n=(l,c,p)=>{!l||e.has(l)||p&&l.tagName!==t.elementTag||e.set(l,c);},i=typeof t.cssSelector=="string"?t.cssSelector.split(ht):[],o=i[i.length-1]??t.cssSelector,r=i.length>1?Co(i.slice(0,-1)):null,s=r?r[r.length-1]??[]:[document],a=r?[document,...r.flat()]:s;if(t.anchorKey){let l=t.anchorKey.replace(/\\/g,"\\\\").replace(/"/g,'\\"');try{for(let c of je(a,`[${de}="${l}"]`))n(c,"anchorKey",!1);}catch{}}if(t.elementId){let l=t.elementId.replace(/\\/g,"\\\\").replace(/"/g,'\\"');try{for(let c of je(s,`[id="${l}"]`))n(c,"id",!0);}catch{for(let c of s)n(c.getElementById(t.elementId),"id",true);}}try{for(let l of je(s,o))n(l,"css",!0);}catch{}if(r)return {pool:e,treeRoots:s};try{let l=document.evaluate(t.xpath,document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null),c=Math.min(l.snapshotLength,At);for(let p=0;p<c;p++){let h=l.snapshotItem(p);h instanceof Element&&n(h,"xpath",!0);}}catch{}return {pool:e,treeRoots:s}}function Ao(t,e,n){let i=t.tag.toLowerCase();if(!i)return [];let o=[];try{for(let c of n){let p=c.querySelectorAll(i);for(let h=0;h<p.length&&o.length<ri;h++){let d=p[h];d&&o.push(d);}if(o.length===ri)break}}catch{return []}let r=t.fingerprint.split(":"),s=r.length===3?Number(r[0]):Number.NaN,a=r.length===3?r[2]??"":"",l=[];for(let c of o){if(e.has(c))continue;let p=0;if(t.snippetBigramTotal>0){let h=Zn(ee(c,Mt)),d=ni(t.snippetBigrams,t.snippetBigramTotal,h);if(t.snippetWordPairTotal>0){let f=d>0?oi(t.snippetWordPairs,t.snippetWordPairTotal,h):0;p+=.6*(.5*d+.5*f);}else p+=.6*d;}if(a&&pt(c)===a&&(p+=.25),!Number.isNaN(s)){let h=Math.abs(c.children.length-s);h===0?p+=.15:h<=2&&(p+=.07);}l.push({element:c,cheap:p});}return l.sort((c,p)=>p.cheap-c.cheap),l.slice(0,vo).map(c=>c.element)}function ai(t,e,n){let i=Mo(t,n),o=si(be(t));return i===null?e==="scan"?null:{element:t,strategy:e,verification:Rt,strongest:Rt,visibility:o,final:se[e]*Rt*o,unverified:true}:{element:t,strategy:e,verification:i.blend,strongest:i.strongest,signals:i,visibility:o,final:se[e]*i.blend*o}}function Po(t){if(t.strategy==="scan")return t.verification>=wo;if(t.unverified||!t.signals)return true;let e=t.signals;return e.text===void 0||e.text>=xo?true:(e.fingerprint??0)>=Ct||(e.context??0)>=Ct||(e.neighbor??0)>=Ct}function Mo(t,e){let n=0,i=0,o={blend:0,strongest:0};if(e.snippet){i+=40;let r=oe(ee(t,Mt));o.text=ei(r,e.snippet,.5),n+=o.text*40;}if(e.fingerprint&&(i+=20,o.fingerprint=Tn(t,e.fingerprint),n+=o.fingerprint*20),e.prefix||e.suffix){i+=20;let r=0,s=0;if(e.prefix){let a=oe(te(t,"before"));r+=a?me(a,e.prefix):0,s++;}if(e.suffix){let a=oe(te(t,"after"));r+=a?me(a,e.suffix):0,s++;}s>0&&(o.context=r/s,n+=o.context*20);}if(e.neighbor){i+=20;let r=oe(Le(t));o.neighbor=r?me(r,e.neighbor):0,n+=o.neighbor*20;}return i===0?null:(o.blend=n/i,o.strongest=Math.max(o.text??0,o.fingerprint??0,o.context??0,o.neighbor??0),o)}function Io(t){let e=t[0],n=t.filter(o=>e.final-o.final<=ko&&(o===e||e.element.contains(o.element))),i=e;for(let o of n)o!==i&&i.element.contains(o.element)&&(i=o);return i}function Lo(t){return t.strategy==="scan"?Math.min(t.verification,se.scan):t.unverified?se[t.strategy]:se[t.strategy]*Math.min(1,t.strongest/Pt)}function Ye(t,e,n){let i=To(t,n);if(!i)return null;let o=i.element.getBoundingClientRect(),r=new DOMRect(o.x+e.xPct*o.width,o.y+e.yPct*o.height,e.wPct*o.width,e.hPct*o.height);return {element:i.element,rect:r,confidence:i.confidence,strategy:i.strategy}}function It(t){return {cssSelector:t.cssSelector,xpath:t.xpath,textSnippet:t.textSnippet,elementTag:t.elementTag,elementId:t.elementId??void 0,textPrefix:t.textPrefix,textSuffix:t.textSuffix,fingerprint:t.fingerprint,neighborText:t.neighborText,anchorKey:t.anchorKey??null}}function Ue(t){return {xPct:t.xPct,yPct:t.yPct,wPct:t.wPct,hPct:t.hPct}}var li=13;function ci(t){return {top:t.top+window.scrollY-li,left:t.right+window.scrollX-li}}function ge(t,e){let n=t.entries[e],i=t.elementIndices[e];if(!(!n||i===void 0))return n.elements[i]}function pi(t){let e=t.elementIndices[0];return e===void 0?void 0:t.entries[0]?.positions[e]}var di=300,ui=200,_o=3e3,No=.7,Fo=28,hi=32,qe=class{constructor(e,n,i,o,r=null){this.colors=e;this.tooltip=n;this.bus=i;this.t=o;this.liveRegion=r;this.container=chunkQ34GDCKE_cjs.y("div",{style:`position:absolute;top:0;left:0;pointer-events:none;z-index:${2147483646};`}),this.container.id="siteping-markers",chunkQ34GDCKE_cjs.F(this.container),document.body.appendChild(this.container),this.bus.on("annotations:toggle",s=>{this.container.style.display=s?"block":"none";}),this.resizeHandler=()=>this.scheduleReposition("resize"),window.addEventListener("resize",this.resizeHandler,{passive:true}),this.scrollHandler=()=>this.scheduleReposition("scroll"),window.addEventListener("scroll",this.scrollHandler,{passive:true,capture:true}),this.mutationObserver=new MutationObserver(s=>{let a=false;for(let l of s)if(!(this.container.contains(l.target)||this.tooltip.contains(l.target))){a=true;break}a&&this.scheduleReposition("mutation");}),this.mutationObserver.observe(document.body,{childList:true,subtree:true,attributes:false,characterData:false}),this.onDocumentClickForClusters=s=>{this.container.contains(s.target)||this.collapseAllClusters();},document.addEventListener("click",this.onDocumentClickForClusters,true);}colors;tooltip;bus;t;liveRegion;container;entries=[];highlightElements=[];pinnedFeedback=null;onDocumentClick=null;repositionTimer=null;mutationObserver=null;scrollHandler=null;resizeHandler=null;anchorCache=new Map;pendingLayoutChange=false;pendingResize=false;hiddenRecheckAt=new Map;clusters=[];onDocumentClickForClusters=null;lastOpenCount=-1;get count(){return this.entries.length}get openCount(){let e=0;for(let n of this.entries)chunkQ34GDCKE_cjs.h(n.feedback.status)||e++;return e}scheduleReposition(e="mutation"){e!=="scroll"&&(this.pendingLayoutChange=true),e==="resize"&&(this.pendingResize=true),!this.repositionTimer&&("requestIdleCallback"in window?this.repositionTimer=window.requestIdleCallback(()=>{this.repositionTimer=null,this.repositionAll();},{timeout:ui+100}):this.repositionTimer=+setTimeout(()=>{this.repositionTimer=null,this.repositionAll();},ui));}repositionAll(){let e=this.pendingLayoutChange,n=this.pendingResize;this.pendingLayoutChange=false,this.pendingResize=false,n&&this.hiddenRecheckAt.clear();let i=Date.now(),o={remaining:2,starved:false},r=new Set,s=false;for(let a of this.entries)for(let l=0;l<a.feedback.annotations.length;l++){let c=a.elements[l];if(!c)continue;let p=a.feedback.annotations[l];if(!p)continue;let h=`${a.feedback.id}:${l}`;r.add(h);let f=this.anchorCache.get(h)?.deref(),m,v=(this.hiddenRecheckAt.get(h)??0)>i,T=f?.isConnected&&(v||!(e&&be(f)==="hidden"));if(f&&T){let C=f.getBoundingClientRect(),E=Ue(p);m={element:f,rect:new DOMRect(C.left+E.xPct*C.width,C.top+E.yPct*C.height,E.wPct*C.width,E.hPct*C.height),confidence:1,strategy:"css"};}else v?m=null:(o.starved=false,m=Ye(It(p),Ue(p),{scanBudget:o}),o.starved||(m?.element&&this.anchorCache.set(h,new WeakRef(m.element)),!m||be(m.element)==="hidden"?this.hiddenRecheckAt.set(h,i+_o):this.hiddenRecheckAt.delete(h)));let A=c.style.display!=="none";if(!m){A&&(s=true),c.style.display="none";continue}A||(s=true),a.positions[l]=ci(m.rect),c.style.display="flex",this.applyConfidenceStyle(c,m.confidence,a.feedback);}for(let a of this.anchorCache.keys())r.has(a)||this.anchorCache.delete(a);for(let a of this.hiddenRecheckAt.keys())r.has(a)||this.hiddenRecheckAt.delete(a);s&&this.buildClusters(),this.applyClusterPositions(),this.pinnedFeedback&&this.showHighlight(this.pinnedFeedback);}applyClusterPositions(){for(let e of this.clusters)e.expanded?this.applyFanPositions(e):this.applyStackPositions(e);}emitMarkersChanged(){let e=this.openCount;e!==this.lastOpenCount&&(this.lastOpenCount=e,this.bus.emit("markers:changed",e));}render(e){this.clear(),e.forEach((n,i)=>{let o=this.buildEntry(n,i+1);this.entries.push(o);}),this.buildClusters(),this.liveRegion&&this.entries.length>0&&(this.liveRegion.textContent=chunkQ34GDCKE_cjs.ka(this.t,"marker.count",{count:this.entries.length})),this.emitMarkersChanged();}addFeedback(e,n){let i=this.buildEntry(e,n);for(let o of i.elements)o.style.animation="sp-marker-in 0.35s cubic-bezier(0.34,1.56,0.64,1) both";this.entries.push(i),this.buildClusters(),this.emitMarkersChanged();}buildEntry(e,n){let i={feedback:e,elements:[],positions:[]};for(let o of e.annotations){let r=Ye(It(o),Ue(o)),s=r?ci(r.rect):{top:0,left:0},a=this.createMarker(n,e,s);r?this.applyConfidenceStyle(a,r.confidence,e):a.style.display="none",this.container.appendChild(a),i.elements.push(a),i.positions.push(s);}return i}buildClusters(){for(let i of this.container.querySelectorAll(".sp-cluster-badge"))i.remove();let e=[];for(let i of this.entries)for(let o=0;o<i.elements.length;o++){let r=i.positions[o];!r||i.elements[o]?.style.display==="none"||e.push({entry:i,elIdx:o,pos:r});}let n=new Set;this.clusters=[];for(let i=0;i<e.length;i++){if(n.has(i))continue;let o=e[i];if(!o)continue;let r={entries:[o.entry],elementIndices:[o.elIdx],expanded:false};n.add(i);for(let s=i+1;s<e.length;s++){if(n.has(s))continue;let a=o.pos,l=e[s];if(!l)continue;let c=l.pos;Math.sqrt((a.left-c.left)**2+(a.top-c.top)**2)<Fo&&(r.entries.push(l.entry),r.elementIndices.push(l.elIdx),n.add(s));}this.clusters.push(r);}for(let i of this.clusters)i.entries.length<=1||(this.applyStackPositions(i),this.addClusterBadge(i));}applyStackPositions(e){let n=pi(e);if(!n)return;let{top:i,left:o}=n,r=e.entries.length<=1;for(let s=0;s<e.entries.length;s++){let a=ge(e,s);a&&(a.style.top=`${i+(r?0:s*3)}px`,a.style.left=`${o+(r?0:s*3)}px`,a.style.zIndex=String(s+1));}}applyFanPositions(e){let n=pi(e);if(!n)return;let{top:i,left:o}=n,r=e.entries.length,s=(r-1)*hi,a=o-s/2;for(let l=0;l<r;l++){let c=ge(e,l);c&&(c.style.top=`${i}px`,c.style.left=`${a+l*hi}px`,c.style.zIndex=String(10+l));}}addClusterBadge(e){let n=ge(e,e.entries.length-1);if(!n)return;let i=chunkQ34GDCKE_cjs.y("div",{class:"sp-cluster-badge",style:`position:absolute;top:-6px;right:-6px;min-width:16px;height:16px;padding:0 4px;border-radius:9999px;background:${this.colors.accent};color:#fff;font-size:10px;font-weight:700;display:flex;align-items:center;justify-content:center;border:1.5px solid #fff;pointer-events:none;font-family:"Inter",system-ui,-apple-system,sans-serif;line-height:1;`});chunkQ34GDCKE_cjs.z(i,String(e.entries.length)),n.appendChild(i);}setBadgesVisible(e,n){for(let i=0;i<e.entries.length;i++){let o=ge(e,i)?.querySelector(".sp-cluster-badge");o&&(o.style.display=n?"flex":"none");}}findCluster(e){for(let n of this.clusters)if(!(n.entries.length<=1)){for(let i=0;i<n.entries.length;i++)if(ge(n,i)===e)return n}return null}handleClusterClick(e,n){let i=this.findCluster(e);return i?i.expanded?false:(n.stopPropagation(),this.collapseAllClusters(),i.expanded=true,this.applyFanPositions(i),this.setBadgesVisible(i,false),true):false}collapseCluster(e){e.expanded&&(e.expanded=false,this.applyStackPositions(e),this.setBadgesVisible(e,true));}collapseAllClusters(){for(let e of this.clusters)this.collapseCluster(e);}applyConfidenceStyle(e,n,i){let o=chunkQ34GDCKE_cjs.h(i.status);n<No&&!o?(e.style.borderStyle="dashed",e.style.opacity="0.7",e.title=chunkQ34GDCKE_cjs.ka(this.t,"marker.approximate",{confidence:Math.round(n*100)})):(e.style.borderStyle="solid",e.style.opacity="1",e.title="");}createMarker(e,n,i){let o=chunkQ34GDCKE_cjs.aa(n.type,this.colors),r=chunkQ34GDCKE_cjs.h(n.status),s=chunkQ34GDCKE_cjs.y("div",{style:`position:absolute;top:${i.top}px;left:${i.left}px;width:26px;height:26px;border-radius:50%;background:${r?"rgba(241,245,249,0.9)":"rgba(255,255,255,0.92)"};border:2px solid ${r?"#cbd5e1":o};display:flex;align-items:center;justify-content:center;font-family:"Inter",system-ui,-apple-system,sans-serif;font-size:11px;font-weight:700;color:${r?"#94a3b8":o};cursor:pointer;pointer-events:auto;box-shadow:${r?"0 2px 8px rgba(0,0,0,0.06)":`0 2px 12px ${o}25, 0 2px 6px rgba(0,0,0,0.06)`};transition:top 0.25s cubic-bezier(0.34,1.56,0.64,1),left 0.25s cubic-bezier(0.34,1.56,0.64,1),transform 0.15s ease,box-shadow 0.15s ease;user-select:none;-webkit-font-smoothing:antialiased;`});s.dataset.feedbackId=n.id,s.setAttribute("tabindex","0"),s.setAttribute("role","button");let a=n.message.length>60?`${n.message.slice(0,60)}...`:n.message,l=chunkQ34GDCKE_cjs.ka(this.t,"marker.aria",{number:e,type:chunkQ34GDCKE_cjs.la(n.type,this.t),message:a});s.setAttribute("aria-label",l),s.setAttribute("aria-describedby",this.tooltip.tooltipId),chunkQ34GDCKE_cjs.z(s,r?"\u2713":String(e)),chunkQ34GDCKE_cjs.ga()&&s.appendChild(chunkQ34GDCKE_cjs.y("span",{style:"position:absolute;inset:-9px;border-radius:50%;"})),s.addEventListener("mouseenter",()=>{s.style.transform="scale(1.2)",s.style.boxShadow=r?"0 4px 16px rgba(0,0,0,0.1)":`0 4px 20px ${o}35, 0 4px 12px rgba(0,0,0,0.08)`,this.tooltip.show(n,s.getBoundingClientRect()),this.pinnedFeedback||this.showHighlight(n);}),s.addEventListener("mouseleave",()=>{s.style.transform="scale(1)",s.style.boxShadow=r?"0 2px 8px rgba(0,0,0,0.06)":`0 2px 12px ${o}25, 0 2px 6px rgba(0,0,0,0.06)`,this.tooltip.scheduleHide(),this.pinnedFeedback||this.clearHighlight();}),s.addEventListener("focus",()=>{this.tooltip.show(n,s.getBoundingClientRect()),this.pinnedFeedback||this.showHighlight(n);}),s.addEventListener("blur",()=>{this.tooltip.scheduleHide(),this.pinnedFeedback||this.clearHighlight();});let c=p=>{p instanceof MouseEvent&&this.handleClusterClick(s,p)||(chunkQ34GDCKE_cjs.fa()&&this.tooltip.hide(),this.pinHighlight(n),this.bus.emit("panel:toggle",true),s.dispatchEvent(new CustomEvent("sp-marker-click",{detail:{feedbackId:n.id},bubbles:true})));};return s.addEventListener("click",p=>c(p)),s.addEventListener("keydown",p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),c(p));}),s}focusFeedback(e){let n=this.entries.find(o=>o.feedback.id===e);if(!n)return false;let i=n.elements.find(o=>o.style.display!=="none");return i&&i.scrollIntoView({behavior:"smooth",block:"center"}),this.pinHighlight(n.feedback),this.highlight(e),true}revealPin(e){return this.container.style.display!=="none"&&this.entries.some(n=>n.feedback.id===e&&n.elements.some(i=>i.style.display!=="none"))&&this.focusFeedback(e)}highlight(e){for(let n of this.entries)if(n.feedback.id===e)for(let i of n.elements)i.style.animation="sp-pulse-ring 0.7s ease-out",i.addEventListener("animationend",()=>{i.style.animation="";},{once:true});}showHighlight(e){this.removeHighlightElements();for(let n of e.annotations){let i=Ye(It(n),Ue(n));if(!i)continue;let o=chunkQ34GDCKE_cjs.aa(e.type,this.colors),r=i.rect,s=chunkQ34GDCKE_cjs.y("div",{style:`position:absolute;top:${r.top+window.scrollY}px;left:${r.left+window.scrollX}px;width:${r.width}px;height:${r.height}px;border:2px solid ${o};background:${o}0c;border-radius:8px;pointer-events:none;z-index:-1;opacity:0;box-shadow:0 0 16px ${o}20;transition:opacity ${di}ms ease;`});this.container.appendChild(s),this.highlightElements.push(s),s.offsetHeight,s.style.opacity="1";}}pinHighlight(e){this.unpinHighlight(),this.showHighlight(e),this.pinnedFeedback=e,this.onDocumentClick=n=>{this.container.contains(n.target)||this.unpinHighlight();},document.addEventListener("click",this.onDocumentClick,{capture:true});}unpinHighlight(){this.onDocumentClick&&(document.removeEventListener("click",this.onDocumentClick,{capture:true}),this.onDocumentClick=null),this.pinnedFeedback=null,this.clearHighlight();}clearHighlight(){for(let e of this.highlightElements)e.style.opacity="0",setTimeout(()=>e.remove(),di);this.highlightElements=[];}removeHighlightElements(){for(let e of this.highlightElements)e.remove();this.highlightElements=[];}clear(){this.unpinHighlight(),this.container.replaceChildren(),this.entries=[],this.clusters=[],this.anchorCache.clear();}destroy(){this.unpinHighlight(),this.repositionTimer&&("cancelIdleCallback"in window&&window.cancelIdleCallback(this.repositionTimer),clearTimeout(this.repositionTimer)),this.resizeHandler&&window.removeEventListener("resize",this.resizeHandler),this.scrollHandler&&window.removeEventListener("scroll",this.scrollHandler,{capture:true}),this.onDocumentClickForClusters&&document.removeEventListener("click",this.onDocumentClickForClusters,true),this.mutationObserver?.disconnect(),this.container.remove();}};var fi=3e4,Ve=class{constructor(e,n){this.store=e;this.projectName=n;}store;projectName;async sendFeedback(e){return Lt(await mi(this.write(e),"Failed to send feedback"))}async write(e){try{return await this.store.createFeedback({projectName:e.projectName,type:e.type,message:e.message,status:"open",url:e.url,urlPattern:e.urlPattern??null,viewport:e.viewport,userAgent:e.userAgent,authorName:e.authorName,authorEmail:e.authorEmail,clientId:e.clientId,annotations:e.annotations.map(chunkQ34GDCKE_cjs.l),screenshotDataUrl:e.screenshotDataUrl??null,screenshotRegion:e.screenshotRegion??null,diagnostics:e.diagnostics??null})}catch(n){if(!chunkQ34GDCKE_cjs.k(n))throw n;let i=await this.store.findByClientId(e.clientId);if(!i||i.projectName!==e.projectName)throw n;return i}}async getFeedbacks(e,n){let{feedbacks:i,total:o}=await this.store.getFeedbacks({projectName:e,page:n?.page,limit:n?.limit,type:n?.type,status:n?.status,statuses:n?.statuses,search:n?.search,url:n?.url,urlPattern:n?.urlPattern});return {feedbacks:i.map(Lt),total:o,capabilities:{comments:!!this.store.addComment}}}async resolveFeedback(e,n){let i=await this.store.updateFeedback(e,chunkQ34GDCKE_cjs.i(n?"resolved":"open"));return Lt(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 chunkQ34GDCKE_cjs.b(`${i}: this store keeps no comments`,"SERVER",false);return bi(await mi(this.store.addComment(e,n),i))}};function mi(t,e){return vt(t,fi,()=>new chunkQ34GDCKE_cjs.b(`${e}: the store did not answer within ${fi/1e3} s`,"TIMEOUT",true))}function Lt(t){return {id:t.id,projectName:t.projectName,type:t.type,message:t.message,status:t.status,url:t.url,urlPattern:t.urlPattern??null,viewport:t.viewport,userAgent:t.userAgent,authorName:t.authorName,authorEmail:t.authorEmail,resolvedAt:t.resolvedAt?.toISOString()??null,createdAt:t.createdAt.toISOString(),updatedAt:t.updatedAt.toISOString(),annotations:t.annotations.map(Oo),comments:t.comments?.map(bi),screenshotUrl:t.screenshotUrl??null,screenshotRegion:t.screenshotRegion??null,diagnostics:t.diagnostics??null}}function bi({clientId:t,createdAt:e,...n}){return {...n,createdAt:e.toISOString()}}function Oo(t){return {id:t.id,feedbackId:t.feedbackId,cssSelector:t.cssSelector,xpath:t.xpath,textSnippet:t.textSnippet,elementTag:t.elementTag,elementId:t.elementId,textPrefix:t.textPrefix,textSuffix:t.textSuffix,fingerprint:t.fingerprint,neighborText:t.neighborText,anchorKey:t.anchorKey??null,xPct:t.xPct,yPct:t.yPct,wPct:t.wPct,hPct:t.hPct,scrollX:t.scrollX,scrollY:t.scrollY,viewportW:t.viewportW,viewportH:t.viewportH,devicePixelRatio:t.devicePixelRatio,createdAt:t.createdAt.toISOString()}}var Ho="linear(0, 0.006, 0.025, 0.06, 0.11, 0.17, 0.25, 0.34, 0.45, 0.56, 0.67, 0.78, 0.88, 0.95, 1.01, 1.04, 1.05, 1.04, 1.02, 1, 0.99, 1)",_t="cubic-bezier(0.16, 1, 0.3, 1)",Nt="cubic-bezier(0.34, 1.56, 0.64, 1)",Do="cubic-bezier(0.25, 1, 0.5, 1)",gi=`@keyframes sp-fab-in{from{transform:scale(0) rotate(-180deg);opacity:0;}to{transform:scale(1) rotate(0deg);opacity:1;}}@keyframes sp-fab-glow{0%,100%{box-shadow:0 4px 20px var(--sp-accent-glow),0 2px 8px rgba(0,0,0,0.08);}50%{box-shadow:0 4px 28px var(--sp-accent-glow),0 2px 12px rgba(0,0,0,0.1);}}@keyframes sp-marker-in{0%{transform:scale(0);opacity:0;}60%{transform:scale(1.2);opacity:1;}100%{transform:scale(1);}}@keyframes sp-pulse-ring{0%{box-shadow:0 0 0 0 var(--sp-accent-glow);}70%{box-shadow:0 0 0 8px transparent;}100%{box-shadow:0 0 0 0 transparent;}}@keyframes sp-flash-bg{0%{background-color:var(--sp-accent-light);}100%{background-color:transparent;}}@keyframes sp-slide-up{from{transform:translateY(8px);opacity:0;}to{transform:translateY(0);opacity:1;}}@keyframes sp-fade-in{from{opacity:0;}to{opacity:1;}}@keyframes sp-shimmer{0%{background-position:-200% 0;}100%{background-position:200% 0;}}.sp-anim-fab-in{animation:sp-fab-in 0.5s ${Ho} both;}.sp-anim-marker-in{animation:sp-marker-in 0.35s ${Nt} both;}.sp-anim-pulse{animation:sp-pulse-ring 0.7s ease-out;}.sp-anim-flash{animation:sp-flash-bg 0.5s ${Do};}.sp-anim-slide-up{animation:sp-slide-up 0.3s ${_t} both;}.sp-anim-fade-in{animation:sp-fade-in 0.2s ease-out both;}.sp-panel{transform:translateX(110%);transition:transform 0.4s ${_t};}.sp-panel.sp-panel--open{transform:translateX(0);}.sp-radial-item{opacity:0;pointer-events:none;transform:translate(0,0) scale(0.8);transition:transform 0.35s ${Nt},opacity 0.2s ease,background 0.2s ease,border-color 0.2s ease,box-shadow 0.2s ease;}.sp-radial-item.sp-radial-item--open{opacity:1;pointer-events:auto;}.sp-radial-item{transition-delay:calc(var(--sp-i, 0) * 50ms);}@keyframes sp-card-in{from{transform:translateY(12px);opacity:0;}to{transform:translateY(0);opacity:1;}}.sp-card{animation:sp-card-in 0.35s ${_t} both;animation-delay:calc(var(--sp-card-i, 0) * 40ms);}@keyframes sp-spin{to{transform:rotate(360deg);}}.sp-spinner{width:20px;height:20px;border:2px solid var(--sp-border);border-top-color:var(--sp-accent);border-radius:50%;animation:sp-spin 0.6s linear infinite;}@keyframes sp-badge-in{0%{transform:scale(0);}60%{transform:scale(1.3);}100%{transform:scale(1);}}.sp-fab-badge{animation:sp-badge-in 0.4s ${Nt} both;}@media (prefers-reduced-motion: reduce){*,*::before,*::after{animation-duration:0.01ms !important;animation-iteration-count:1 !important;transition-duration:0.01ms !important;}}`;var yi=`:host{-webkit-tap-highlight-color:transparent;}.sp-list,.sp-detail-content{overscroll-behavior:contain;}.sp-scrim{display:none;}@media (hover: none){.sp-fab:hover:not(:active),.sp-card:hover:not(:active),.sp-btn-primary:hover:not(:active),.sp-btn-danger:hover:not(:active){transform:none;}.sp-card:hover:not(:active){box-shadow:var(--sp-shadow-xs);}.sp-radial-item--open .sp-radial-label{opacity:1;transform:translate(0,-50%);}.sp-bulk-checkbox{opacity:1;}.sp-bulk-checkbox::after{content:"";position:absolute;inset:-12px;}.sp-bulk-select-all{display:none;}.sp-list--has-selection .sp-bulk-select-all{display:flex;}.sp-shortcuts-hint{display:none;}}@media (pointer: coarse){.sp-radial-item{width:48px;height:48px;left:2px;bottom:2px;}.sp-radial-item svg{width:20px;height:20px;}.sp-radial-label{font-size:13px;font-weight:600;padding:8px 12px;}.sp-search,.sp-input{font-size:16px;}.sp-filter-dropdown-btn{height:36px;}.sp-segmented__btn{height:32px;}.sp-sort-btn,.sp-group-toggle,.sp-mine-toggle{min-height:36px;}.sp-btn-resolve,.sp-btn-delete{min-height:40px;}.sp-detail-back{width:44px;height:44px;}.sp-detail-actions button,.sp-detail-actions a{height:44px;}}@media ${chunkQ34GDCKE_cjs.w}{.sp-fab--bottom-right,.sp-radial--bottom-right{right:calc(16px + env(safe-area-inset-right,0px));bottom:calc(16px + env(safe-area-inset-bottom,0px));}.sp-fab--bottom-left,.sp-radial--bottom-left{left:calc(16px + env(safe-area-inset-left,0px));bottom:calc(16px + env(safe-area-inset-bottom,0px));}.sp-scrim{display:block;position:fixed;inset:0;background:var(--sp-scrim);opacity:0;pointer-events:none;touch-action:none;transition:opacity 0.3s ease;}.sp-scrim--open{opacity:1;pointer-events:auto;}.sp-panel{top:auto;left:0;right:0;bottom:0;width:auto;max-width:none;height:calc(100vh - 48px);height:calc(100dvh - 40px - env(safe-area-inset-top,0px));border-left:none;border-top:1px solid var(--sp-glass-border);border-radius:var(--sp-radius-xl) var(--sp-radius-xl) 0 0;background:var(--sp-bg);-webkit-backdrop-filter:none;backdrop-filter:none;transform:translateY(105%);}.sp-panel.sp-panel--open{transform:translateY(0);}.sp-panel-header,.sp-detail-header{position:relative;padding-top:22px;background:var(--sp-bg);-webkit-backdrop-filter:none;backdrop-filter:none;touch-action:none;}.sp-panel-header{padding:22px 12px 12px 20px;}.sp-panel-header::before,.sp-detail-header::before{content:"";position:absolute;top:8px;left:50%;width:36px;height:5px;margin-left:-18px;border-radius:3px;background:var(--sp-border);}.sp-export-btn,.sp-btn-delete-all{width:40px;height:40px;padding:0;justify-content:center;border-radius:var(--sp-radius);}.sp-export-btn svg,.sp-btn-delete-all svg{width:17px;height:17px;}.sp-export-btn span,.sp-btn-delete-all span{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;}.sp-stats-bar{padding:10px 20px;}.sp-filters{padding:12px 16px 10px;background:var(--sp-bg);-webkit-backdrop-filter:none;backdrop-filter:none;}.sp-stats-bar,.sp-filters{touch-action:pan-x;}.sp-search{height:44px;}.sp-filter-bar{flex-wrap:nowrap;overflow-x:auto;margin:0 -16px 8px;padding:0 16px 2px;scrollbar-width:none;}.sp-filter-bar::-webkit-scrollbar{display:none;}.sp-filter-dropdown{flex:0 0 auto;}.sp-filter-dropdown-btn{width:auto;}.sp-filter-dropdown-menu,.sp-sort-menu{position:fixed;top:auto;left:12px;right:12px;bottom:calc(12px + env(safe-area-inset-bottom,0px));min-width:0;padding:6px;border-radius:var(--sp-radius-lg);background:var(--sp-bg);-webkit-backdrop-filter:none;backdrop-filter:none;box-shadow:var(--sp-shadow-xl);z-index:30;}.sp-filter-dropdown-option,.sp-sort-option{min-height:44px;font-size:14px;}.sp-list{padding:10px 12px calc(12px + env(safe-area-inset-bottom,0px));}.sp-bulk-bar{bottom:calc(16px + env(safe-area-inset-bottom,0px));}.sp-detail{background:var(--sp-bg);-webkit-backdrop-filter:none;backdrop-filter:none;}.sp-detail-section{padding:18px 20px;}.sp-detail-content{padding-bottom:env(safe-area-inset-bottom,0px);}.sp-identity-backdrop{align-items:flex-end;}.sp-identity-modal{width:100%;max-width:none;margin-bottom:var(--sp-kb, 0px);padding:24px 20px calc(20px + env(safe-area-inset-bottom,0px));border-radius:var(--sp-radius-xl) var(--sp-radius-xl) 0 0;background:var(--sp-bg);transform:translateY(100%);}.sp-identity-actions button{flex:1;height:48px;}.sp-identity-actions .sp-btn-primary{flex:2;}}`;function Ft(t){return `:host{all:initial;position:fixed;z-index:${2147483647};font-family:var(--sp-font);font-size:14px;line-height:1.5;color:var(--sp-text);color-scheme:${t.bg==="#ffffff"?"light":"dark"};-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;${chunkQ34GDCKE_cjs.ea(t)} --sp-identity-bg: ${t.glassBgHeavy};--sp-identity-overlay: ${t.bg==="#ffffff"?"rgba(15, 23, 42, 0.2)":"rgba(0, 0, 0, 0.4)"};--sp-scrim: ${t.bg==="#ffffff"?"rgba(15, 23, 42, 0.32)":"rgba(0, 0, 0, 0.5)"};}*,*::before,*::after{box-sizing:border-box;margin:0;padding:0;}:focus-visible{outline:2px solid var(--sp-accent);outline-offset:2px;box-shadow:0 0 0 4px var(--sp-bg);}.sp-fab{position:fixed;width:52px;height:52px;border-radius:var(--sp-radius-full);background:var(--sp-accent-gradient);color:#fff;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:0 4px 20px var(--sp-accent-glow),0 2px 8px rgba(0,0,0,0.08);transition:transform 0.25s cubic-bezier(0.34,1.56,0.64,1),box-shadow 0.3s ease;outline:none;}.sp-fab:focus-visible{outline:2px solid #fff;outline-offset:3px;}.sp-fab:hover{transform:translateY(-2px) scale(1.05);box-shadow:0 8px 28px var(--sp-accent-glow),0 4px 12px rgba(0,0,0,0.1);}.sp-fab:active{transform:translateY(0) scale(0.95);transition-duration:0.1s;}.sp-fab--bottom-right{bottom:24px;right:24px;}.sp-fab--bottom-left{bottom:24px;left:24px;}.sp-fab svg{width:22px;height:22px;fill:currentColor;transition:transform 0.3s cubic-bezier(0.34,1.56,0.64,1);}.sp-fab-badge{position:absolute;top:-4px;right:-4px;min-width:20px;height:20px;padding:0 6px;border-radius:var(--sp-radius-full);background:#ef4444;color:#fff;font-size:11px;font-weight:700;display:flex;align-items:center;justify-content:center;border:2px solid #fff;pointer-events:none;font-family:var(--sp-font);line-height:1;}.sp-radial{position:fixed;pointer-events:none;width:52px;height:52px;}.sp-radial--bottom-right{bottom:24px;right:24px;}.sp-radial--bottom-left{bottom:24px;left:24px;}.sp-radial-item{position:absolute;left:4px;bottom:4px;width:44px;height:44px;border-radius:var(--sp-radius-full);background:var(--sp-glass-bg-heavy);backdrop-filter:blur(var(--sp-blur));-webkit-backdrop-filter:blur(var(--sp-blur));color:var(--sp-text);border:1px solid var(--sp-glass-border);cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:var(--sp-shadow-md);font-size:12px;font-weight:600;}.sp-radial-item:hover,.sp-radial-item:focus-visible{background:rgba(255,255,255,0.95);border-color:var(--sp-accent);color:var(--sp-accent);box-shadow:var(--sp-shadow-md),0 0 0 3px var(--sp-accent-light);outline:none;}.sp-radial-item svg{width:18px;height:18px;flex-shrink:0;stroke:currentColor;fill:none;}.sp-radial-label{position:absolute;top:50%;white-space:nowrap;font-size:12px;font-weight:500;color:var(--sp-text);pointer-events:none;opacity:0;padding:4px 12px;border-radius:var(--sp-radius);background:var(--sp-glass-bg-heavy);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);border:1px solid var(--sp-glass-border);box-shadow:var(--sp-shadow-sm);transform:translate(4px,-50%);transition:opacity 0.2s ease,transform 0.2s ease;}.sp-radial--bottom-right .sp-radial-label{right:calc(100% + 12px);}.sp-radial--bottom-left .sp-radial-label{left:calc(100% + 12px);transform:translate(-4px,-50%);}.sp-radial-item:hover .sp-radial-label,.sp-radial-item:focus-visible .sp-radial-label{opacity:1;transform:translate(0,-50%);}.sp-panel{position:fixed;top:0;right:0;width:400px;max-width:100vw;height:100vh;height:100dvh;background:var(--sp-glass-bg);backdrop-filter:blur(var(--sp-blur-heavy));-webkit-backdrop-filter:blur(var(--sp-blur-heavy));border-left:1px solid var(--sp-glass-border);box-shadow:var(--sp-shadow-xl);display:flex;flex-direction:column;overflow:hidden;}.sp-panel-header{display:flex;align-items:center;justify-content:space-between;padding:20px 24px;border-bottom:1px solid var(--sp-border);background:var(--sp-glass-bg-heavy);backdrop-filter:blur(var(--sp-blur));-webkit-backdrop-filter:blur(var(--sp-blur));position:relative;z-index:2;}.sp-panel-title{font-size:17px;font-weight:700;color:var(--sp-text);letter-spacing:-0.02em;}.sp-panel-close{width:44px;height:44px;border-radius:var(--sp-radius);border:none;background:transparent;cursor:pointer;display:flex;align-items:center;justify-content:center;color:var(--sp-text-tertiary);transition:all 0.2s ease;}.sp-panel-close:hover{background:var(--sp-bg-hover);color:var(--sp-text);}.sp-panel-close svg{width:16px;height:16px;}.sp-filters{padding:16px 24px;border-bottom:1px solid var(--sp-border);background:var(--sp-glass-bg-heavy);backdrop-filter:blur(var(--sp-blur));-webkit-backdrop-filter:blur(var(--sp-blur));position:sticky;top:0;z-index:1;}.sp-search-wrap{position:relative;margin-bottom:12px;}.sp-search{width:100%;height:40px;padding:0 12px 0 38px;border-radius:var(--sp-radius);border:1px solid var(--sp-border);background:var(--sp-glass-bg-heavy);color:var(--sp-text);font-family:var(--sp-font);font-size:13px;outline:none;transition:all 0.2s ease;}.sp-search::placeholder{color:var(--sp-text-tertiary);}.sp-search:focus{border-color:var(--sp-accent);box-shadow:0 0 0 3px var(--sp-accent-light);background:var(--sp-bg);}.sp-search-icon{position:absolute;left:12px;top:50%;transform:translateY(-50%);color:var(--sp-text-tertiary);width:16px;height:16px;transition:color 0.2s ease;}.sp-search:focus ~ .sp-search-icon,.sp-search-wrap:focus-within .sp-search-icon{color:var(--sp-accent);}.sp-filter-bar{display:flex;align-items:center;gap:8px;margin-bottom:8px;flex-wrap:wrap;}.sp-filter-dropdown{position:relative;flex:1 1 auto;min-width:0;}.sp-filter-dropdown-btn{--sp-chip-color: var(--sp-text-secondary);--sp-chip-bg: var(--sp-glass-bg-heavy);display:inline-flex;align-items:center;gap:8px;width:100%;height:32px;padding:0 8px 0 10px;border-radius:var(--sp-radius-full);border:1px solid var(--sp-border);background:var(--sp-glass-bg-heavy);color:var(--sp-text);font-family:var(--sp-font);font-size:12px;font-weight:500;cursor:pointer;white-space:nowrap;transition:background 0.18s ease,border-color 0.18s ease,box-shadow 0.18s ease;}.sp-filter-dropdown-btn:hover{border-color:var(--sp-chip-color);background:var(--sp-chip-bg);}.sp-filter-dropdown-btn[aria-expanded="true"]{border-color:var(--sp-chip-color);background:var(--sp-chip-bg);box-shadow:0 0 0 3px color-mix(in srgb,var(--sp-chip-color) 14%,transparent);}.sp-filter-dropdown-btn--filtered{border-color:var(--sp-chip-color);background:var(--sp-chip-bg);}.sp-filter-dropdown-btn__icon{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;flex-shrink:0;color:var(--sp-chip-color);}.sp-filter-dropdown-btn__icon svg{width:14px;height:14px;}.sp-filter-dropdown-btn__label{display:inline-flex;align-items:baseline;gap:6px;flex:1;min-width:0;overflow:hidden;}.sp-filter-dropdown-btn__prefix{color:var(--sp-text-tertiary);font-weight:500;font-size:11px;text-transform:uppercase;letter-spacing:0.06em;}.sp-filter-dropdown-btn__value{color:var(--sp-chip-color);font-weight:600;overflow:hidden;text-overflow:ellipsis;}.sp-filter-dropdown-btn__chevron{display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex-shrink:0;color:var(--sp-text-tertiary);transition:transform 0.18s ease,color 0.18s ease;}.sp-filter-dropdown-btn__chevron svg{width:12px;height:12px;}.sp-filter-dropdown-btn[aria-expanded="true"] .sp-filter-dropdown-btn__chevron{transform:rotate(180deg);color:var(--sp-chip-color);}.sp-filter-dropdown-menu{position:absolute;top:calc(100% + 6px);left:0;right:0;min-width:180px;padding:4px;border-radius:var(--sp-radius);background:var(--sp-glass-bg-heavy);backdrop-filter:blur(var(--sp-blur-heavy));-webkit-backdrop-filter:blur(var(--sp-blur-heavy));border:1px solid var(--sp-glass-border);box-shadow:var(--sp-shadow-md);z-index:10;animation:sp-filter-menu-in 0.15s ease-out both;}@keyframes sp-filter-menu-in{from{opacity:0;transform:translateY(-4px) scale(0.98);}to{opacity:1;transform:translateY(0) scale(1);}}.sp-filter-dropdown-option{--sp-chip-color: var(--sp-text-secondary);--sp-chip-bg: transparent;display:flex;align-items:center;gap:10px;width:100%;padding:8px 10px;border:none;border-radius:8px;background:transparent;color:var(--sp-text);font-family:var(--sp-font);font-size:12px;font-weight:500;cursor:pointer;text-align:left;transition:background 0.12s ease,color 0.12s ease;}.sp-filter-dropdown-option__icon{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;flex-shrink:0;border-radius:6px;background:var(--sp-chip-bg);color:var(--sp-chip-color);}.sp-filter-dropdown-option__icon svg{width:13px;height:13px;}.sp-filter-dropdown-option__label{flex:1;min-width:0;}.sp-filter-dropdown-option__check{display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex-shrink:0;color:var(--sp-chip-color);}.sp-filter-dropdown-option__check svg{width:13px;height:13px;}.sp-filter-dropdown-option:hover{background:var(--sp-bg-hover);}.sp-filter-dropdown-option--active{color:var(--sp-chip-color);font-weight:600;}.sp-filter-dropdown-option--active:hover{background:var(--sp-chip-bg);}.sp-segmented{display:inline-flex;align-items:stretch;padding:2px;border-radius:var(--sp-radius-full);border:1px solid var(--sp-border);background:var(--sp-glass-bg-heavy);flex-shrink:0;}.sp-segmented__btn{--sp-chip-color: var(--sp-text-tertiary);--sp-chip-bg: transparent;display:inline-flex;align-items:center;gap:5px;height:26px;padding:0 10px;border:none;border-radius:var(--sp-radius-full);background:transparent;color:var(--sp-text-secondary);font-family:var(--sp-font);font-size:12px;font-weight:500;cursor:pointer;white-space:nowrap;transition:background 0.18s ease,color 0.18s ease,box-shadow 0.18s ease;}.sp-segmented__icon{display:inline-flex;align-items:center;justify-content:center;width:13px;height:13px;flex-shrink:0;color:var(--sp-chip-color);transition:color 0.18s ease,transform 0.18s ease;}.sp-segmented__icon svg{width:13px;height:13px;}.sp-segmented__btn:hover{color:var(--sp-chip-color);}.sp-segmented__btn:hover .sp-segmented__icon{color:var(--sp-chip-color);}.sp-segmented__btn--active{background:var(--sp-chip-bg);color:var(--sp-chip-color);font-weight:600;box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--sp-chip-color) 35%,transparent),0 1px 2px rgba(0,0,0,0.04);}.sp-segmented__btn--active .sp-segmented__icon{color:var(--sp-chip-color);}.sp-segmented__btn--open.sp-segmented__btn--active .sp-segmented__icon{animation:sp-segmented-pulse 2.4s ease-in-out infinite;}@keyframes sp-segmented-pulse{0%,100%{transform:scale(1);}50%{transform:scale(0.85);}}@media (prefers-reduced-motion: reduce){.sp-filter-dropdown-btn,.sp-filter-dropdown-btn__chevron,.sp-filter-dropdown-option,.sp-segmented__btn,.sp-segmented__icon{transition:none;}.sp-filter-dropdown-menu{animation:none;}.sp-segmented__btn--open.sp-segmented__btn--active .sp-segmented__icon{animation:none;}}.sp-list{flex:1;overflow-y:auto;padding:8px 12px;}.sp-list::-webkit-scrollbar{width:6px;}.sp-list::-webkit-scrollbar-track{background:transparent;}.sp-list::-webkit-scrollbar-thumb{background:var(--sp-border);border-radius:var(--sp-radius-full);}.sp-list::-webkit-scrollbar-thumb:hover{background:var(--sp-text-tertiary);}.sp-card{display:flex;padding:14px 16px;margin-bottom:6px;cursor:pointer;border-radius:var(--sp-radius);background:var(--sp-glass-bg-heavy);border:1px solid var(--sp-glass-border);box-shadow:var(--sp-shadow-xs);transition:all 0.2s cubic-bezier(0.34,1.56,0.64,1);}.sp-card:hover{background:var(--sp-bg);border-color:var(--sp-border);box-shadow:var(--sp-shadow-md);transform:translateY(-2px);}.sp-card:active{transform:translateY(0) scale(0.99);transition-duration:0.1s;}.sp-card-bar{width:3px;border-radius:var(--sp-radius-full);margin-right:14px;flex-shrink:0;}.sp-card-body{flex:1;min-width:0;}.sp-card-header{display:flex;align-items:center;gap:8px;margin-bottom:6px;}.sp-card-number{font-size:12px;font-weight:700;color:var(--sp-text-tertiary);font-variant-numeric:tabular-nums;}.sp-badge{padding:2px 10px;border-radius:var(--sp-radius-full);font-size:11px;font-weight:600;letter-spacing:0.02em;}.sp-card-date{font-size:11px;color:var(--sp-text-tertiary);margin-left:auto;}.sp-card-message{font-size:13px;line-height:1.5;color:var(--sp-text);display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;}.sp-card-message--expanded{-webkit-line-clamp:unset;}.sp-card-expand{font-size:12px;font-weight:500;color:var(--sp-accent);cursor:pointer;background:none;border:none;padding:4px 0;font-family:var(--sp-font);transition:opacity 0.15s ease;}.sp-card-expand:hover{opacity:0.8;}.sp-card-footer{display:flex;align-items:center;justify-content:flex-end;gap:6px;margin-top:10px;}.sp-btn-resolve,.sp-btn-delete{padding:8px 14px;border-radius:var(--sp-radius-full);border:1px solid var(--sp-border);background:transparent;color:var(--sp-text-secondary);font-family:var(--sp-font);font-size:12px;font-weight:500;cursor:pointer;display:flex;align-items:center;gap:4px;transition:all 0.2s ease;}.sp-btn-resolve svg,.sp-btn-delete svg{width:14px;height:14px;}.sp-btn-resolve:hover{border-color:#22c55e;color:#22c55e;background:rgba(34,197,94,0.06);}.sp-btn-delete:hover{border-color:#ef4444;color:#ef4444;background:rgba(239,68,68,0.06);}.sp-btn-resolve:disabled,.sp-btn-delete:disabled{opacity:0.5;cursor:not-allowed;pointer-events:none;}.sp-spinner--sm{width:14px;height:14px;}.sp-panel-header-right{display:flex;align-items:center;gap:8px;}.sp-btn-delete-all{padding:5px 12px;border-radius:var(--sp-radius-full);border:1px solid var(--sp-border);background:transparent;color:var(--sp-text-tertiary);font-family:var(--sp-font);font-size:11px;font-weight:500;cursor:pointer;display:flex;align-items:center;gap:4px;transition:all 0.2s ease;}.sp-btn-delete-all svg{width:13px;height:13px;}.sp-btn-delete-all:hover{border-color:#ef4444;color:#ef4444;background:rgba(239,68,68,0.06);}.sp-btn-delete-all:disabled{opacity:0.5;cursor:not-allowed;pointer-events:none;}.sp-confirm-backdrop{position:fixed;inset:0;background:var(--sp-backdrop, rgba(15, 23, 42, 0.2));backdrop-filter:blur(var(--sp-blur));-webkit-backdrop-filter:blur(var(--sp-blur));display:flex;align-items:center;justify-content:center;z-index:${2147483647};opacity:0;transition:opacity 0.2s ease;}.sp-confirm-dialog{width:min(340px,calc(100vw - 32px));padding:28px;border-radius:20px;background:var(--sp-glass-bg-heavy);backdrop-filter:blur(var(--sp-blur-heavy));-webkit-backdrop-filter:blur(var(--sp-blur-heavy));border:1px solid var(--sp-glass-border);box-shadow:var(--sp-shadow-xl);font-family:var(--sp-font);transform:translateY(8px) scale(0.97);transition:transform 0.25s cubic-bezier(0.16,1,0.3,1);}.sp-confirm-title{font-size:17px;font-weight:700;color:var(--sp-text);letter-spacing:-0.02em;margin-bottom:8px;}.sp-confirm-message{font-size:14px;color:var(--sp-text-secondary);line-height:1.5;margin-bottom:20px;}.sp-confirm-actions{display:flex;gap:8px;justify-content:flex-end;}.sp-btn-danger{height:40px;padding:0 22px;border-radius:var(--sp-radius);border:none;background:#ef4444;color:#fff;font-family:var(--sp-font);font-size:14px;font-weight:600;cursor:pointer;transition:all 0.2s ease;box-shadow:0 2px 8px rgba(239,68,68,0.25);}.sp-btn-danger:hover{background:#dc2626;box-shadow:0 4px 16px rgba(239,68,68,0.3);transform:translateY(-1px);}.sp-btn-danger:active{transform:translateY(0) scale(0.98);transition-duration:0.1s;}.sp-card--resolved{opacity:0.5;}.sp-card--resolved .sp-card-message{text-decoration:line-through;text-decoration-color:var(--sp-text-tertiary);}.sp-loading{display:flex;align-items:center;justify-content:center;padding:48px 24px;}.sp-identity-backdrop{position:fixed;inset:0;background:var(--sp-identity-overlay);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);display:flex;align-items:center;justify-content:center;z-index:${2147483647};opacity:0;transition:opacity 0.25s ease;}.sp-identity-modal{width:340px;max-width:calc(100vw - 32px);padding:28px;border-radius:var(--sp-radius-xl);background:var(--sp-identity-bg);backdrop-filter:blur(var(--sp-blur-heavy));-webkit-backdrop-filter:blur(var(--sp-blur-heavy));border:1px solid var(--sp-glass-border);box-shadow:0 16px 48px var(--sp-shadow),0 8px 16px var(--sp-shadow);font-family:var(--sp-font);color:var(--sp-text);transform:translateY(12px) scale(0.97);transition:transform 0.3s cubic-bezier(0.16,1,0.3,1);}.sp-identity--open{opacity:1;}.sp-identity--open .sp-identity-modal{transform:none;}.sp-identity-actions{display:flex;gap:8px;justify-content:flex-end;margin-top:20px;}.sp-identity-title{font-size:17px;font-weight:700;color:var(--sp-text);letter-spacing:-0.02em;}.sp-input{width:100%;height:42px;padding:0 14px;border-radius:var(--sp-radius);border:1px solid var(--sp-border);background:var(--sp-glass-bg-heavy);color:var(--sp-text);font-family:var(--sp-font);font-size:14px;outline:none;transition:all 0.2s ease;}.sp-input::placeholder{color:var(--sp-text-tertiary);}.sp-input:focus{border-color:var(--sp-accent);box-shadow:0 0 0 3px var(--sp-accent-light);background:var(--sp-bg);}.sp-input-label{font-size:13px;font-weight:500;color:var(--sp-text-secondary);margin-bottom:6px;display:block;}.sp-btn-primary{height:40px;padding:0 22px;border-radius:var(--sp-radius);border:none;background:var(--sp-accent-gradient);color:#fff;font-family:var(--sp-font);font-size:14px;font-weight:600;cursor:pointer;transition:all 0.2s ease;box-shadow:0 2px 8px var(--sp-accent-glow);}.sp-btn-primary:hover{box-shadow:0 4px 16px var(--sp-accent-glow);transform:translateY(-1px);}.sp-btn-primary:active{transform:translateY(0) scale(0.98);transition-duration:0.1s;}.sp-btn-primary:disabled{opacity:0.4;cursor:not-allowed;transform:none;box-shadow:none;}.sp-btn-ghost{height:40px;padding:0 22px;border-radius:var(--sp-radius);border:1px solid var(--sp-border);background:var(--sp-glass-bg-heavy);color:var(--sp-text-secondary);font-family:var(--sp-font);font-size:14px;font-weight:500;cursor:pointer;transition:all 0.2s ease;}.sp-btn-ghost:hover{border-color:var(--sp-accent);color:var(--sp-accent);background:var(--sp-accent-light);}.sp-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:56px 24px;color:var(--sp-text-tertiary);text-align:center;gap:8px;animation:sp-fade-in 0.3s ease-out both;}.sp-empty-text{font-size:14px;font-weight:500;}.sp-load-more-wrap{display:flex;justify-content:center;padding:12px 0 4px;}.sp-btn-load-more{width:100%;}@media (forced-colors: active){.sp-fab,.sp-radial-item,.sp-filter-dropdown-btn,.sp-segmented,.sp-segmented__btn,.sp-card,.sp-panel-close,.sp-search,.sp-btn-resolve,.sp-btn-delete,.sp-btn-delete-all,.sp-btn-primary,.sp-btn-ghost,.sp-btn-danger,.sp-card-expand,.sp-input,.sp-confirm-dialog{border:2px solid ButtonText !important;background:Canvas !important;color:ButtonText !important;}.sp-segmented__btn--active{background:Highlight !important;color:HighlightText !important;}.sp-filter-dropdown-menu{border:2px solid ButtonText !important;background:Canvas !important;}.sp-filter-dropdown-option--active{background:Highlight !important;color:HighlightText !important;}.sp-fab:focus-visible,.sp-radial-item:focus-visible,.sp-filter-dropdown-btn:focus-visible,.sp-segmented__btn:focus-visible,.sp-filter-dropdown-option:focus-visible,.sp-panel-close:focus-visible,.sp-btn-resolve:focus-visible,.sp-btn-delete:focus-visible,.sp-btn-delete-all:focus-visible,.sp-btn-primary:focus-visible,.sp-btn-ghost:focus-visible,.sp-btn-danger:focus-visible,.sp-card-expand:focus-visible,.sp-input:focus-visible,.sp-search:focus-visible{outline:3px solid Highlight !important;}.sp-panel{border:2px solid ButtonText !important;}.sp-fab-badge{border:2px solid ButtonText !important;background:Canvas !important;color:ButtonText !important;}.sp-card-bar{background:ButtonText !important;}}${gi} ${chunkQ34GDCKE_cjs.za} ${chunkQ34GDCKE_cjs.ya} ${chunkQ34GDCKE_cjs.pa} ${chunkQ34GDCKE_cjs.na} ${chunkQ34GDCKE_cjs.Da} ${chunkQ34GDCKE_cjs.sa} ${yi}`}var $o=120,Bo=80,vi="opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1)",Ge=class{constructor(e,n="en"){this.colors=e;this.locale=n;this.root=chunkQ34GDCKE_cjs.y("div",{style:`position:fixed;z-index:${2147483647};max-width:280px;padding:12px 14px;border-radius:14px;background:${this.colors.glassBgHeavy};backdrop-filter:blur(24px);-webkit-backdrop-filter:blur(24px);border:1px solid ${this.colors.glassBorder};box-shadow:0 8px 32px ${this.colors.shadow},0 2px 8px ${this.colors.shadow};font-family:"Inter",system-ui,-apple-system,sans-serif;pointer-events:auto;opacity:0;transform:translateY(6px) scale(0.97);transition:${vi};visibility:hidden;-webkit-font-smoothing:antialiased;`}),this.root.setAttribute("role","tooltip"),this.root.id=this.tooltipId,this.arrow=chunkQ34GDCKE_cjs.y("div",{style:`position:absolute;width:12px;height:12px;background:${this.colors.glassBgHeavy};border:1px solid ${this.colors.glassBorder};transform:rotate(45deg);pointer-events:none;`}),this.root.appendChild(this.arrow),this.root.addEventListener("mouseenter",()=>this.cancelHide()),this.root.addEventListener("mouseleave",()=>this.scheduleHide()),chunkQ34GDCKE_cjs.F(this.root),document.body.appendChild(this.root);}colors;locale;root;arrow;showTimer=null;hideTimer=null;currentFeedbackId=null;tooltipId="sp-tooltip";show(e,n){this.cancelHide(),this.currentFeedbackId!==e.id&&(this.cancelShow(),this.showTimer=setTimeout(()=>{this.currentFeedbackId=e.id,this.render(e),this.position(n);let i=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;this.root.style.transition=i?"none":vi,this.root.style.visibility="visible",this.root.style.opacity="1",this.root.style.transform="translateY(0) scale(1)";},$o));}scheduleHide(){this.cancelHide(),this.hideTimer=setTimeout(()=>this.hide(),Bo);}hide(){this.cancelShow(),this.currentFeedbackId=null,this.root.style.opacity="0",this.root.style.transform="translateY(6px) scale(0.97)",setTimeout(()=>{this.currentFeedbackId||(this.root.style.visibility="hidden");},200);}cancelShow(){this.showTimer&&(clearTimeout(this.showTimer),this.showTimer=null);}cancelHide(){this.hideTimer&&(clearTimeout(this.hideTimer),this.hideTimer=null);}render(e){let n=Array.from(this.root.children);for(let h of n)h!==this.arrow&&h.remove();let i=chunkQ34GDCKE_cjs.aa(e.type,this.colors),o=chunkQ34GDCKE_cjs.da(e.type,this.colors),r=chunkQ34GDCKE_cjs.ja(this.locale),s=chunkQ34GDCKE_cjs.la(e.type,r),a=chunkQ34GDCKE_cjs.y("div",{style:"display:flex;align-items:center;gap:8px;margin-bottom:8px;"}),l=chunkQ34GDCKE_cjs.y("span",{style:`padding:3px 10px;border-radius:9999px;font-size:11px;font-weight:600;color:${i};background:${o};letter-spacing:0.02em;`});chunkQ34GDCKE_cjs.z(l,s);let c=chunkQ34GDCKE_cjs.y("span",{style:`font-size:11px;color:${this.colors.textSecondary};margin-left:auto;`});chunkQ34GDCKE_cjs.z(c,chunkQ34GDCKE_cjs.E(e.createdAt,this.locale)),a.appendChild(l),a.appendChild(c);let p=chunkQ34GDCKE_cjs.y("div",{style:`font-size:13px;line-height:1.55;color:${this.colors.text};display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;`});chunkQ34GDCKE_cjs.z(p,e.message),this.root.insertBefore(a,this.arrow),this.root.insertBefore(p,this.arrow);}position(e){let n=this.root.getBoundingClientRect(),i=10,o=e.top-n.height-i,r=e.left+e.width/2-n.width/2,s=true;o<8&&(o=e.bottom+i,s=false),r=Math.max(8,Math.min(r,window.innerWidth-n.width-8)),this.root.style.top=`${o}px`,this.root.style.left=`${r}px`;let a=Math.max(16,Math.min(e.left+e.width/2-r-6,n.width-22));s?this.arrow.style.cssText=`position:absolute;width:12px;height:12px;background:${this.colors.glassBgHeavy};border-right:1px solid ${this.colors.glassBorder};border-bottom:1px solid ${this.colors.glassBorder};transform:rotate(45deg);pointer-events:none;bottom:-6px;left:${a}px;`:this.arrow.style.cssText=`position:absolute;width:12px;height:12px;background:${this.colors.glassBgHeavy};border-left:1px solid ${this.colors.glassBorder};border-top:1px solid ${this.colors.glassBorder};transform:rotate(45deg);pointer-events:none;top:-6px;left:${a}px;`;}contains(e){return this.root.contains(e)}destroy(){this.cancelShow(),this.cancelHide(),this.root.remove();}};var ye=null;function zo(t){return t===void 0||t===false?{console:false,network:false,maxConsoleEntries:50,maxNetworkEntries:20}:t===true?{console:true,network:true,maxConsoleEntries:50,maxNetworkEntries:20}:{console:t.console!==false,network:t.network!==false,maxConsoleEntries:typeof t.maxConsoleEntries=="number"?t.maxConsoleEntries:50,maxNetworkEntries:typeof t.maxNetworkEntries=="number"?t.maxNetworkEntries:20}}function ve(){let t=()=>{};return {destroy:t,open:t,close:t,refresh:t,focusFeedback:()=>false,on:()=>t,off:t}}function xi(){try{return process.env.NODE_ENV}catch{return}}function Xo(t){return t===void 0||t===false?{enabled:false,param:"siteping"}:t===true?{enabled:true,param:"siteping"}:{enabled:true,param:t.param??"siteping"}}function wi(t){if(typeof window>"u"||typeof document>"u")return t.onSkip?.("ssr"),ve();let e=t.debug?(...u)=>console.debug("[siteping]",...u):()=>{};if(ye)return e("initSiteping() called more than once \u2014 returning existing instance"),ye;if(!t.forceShow&&xi()==="production")return t.onSkip?.("production"),ve();let n=typeof t.minViewportWidth=="number"&&Number.isFinite(t.minViewportWidth)?t.minViewportWidth:0;if(!t.forceShow&&window.innerWidth<n){let u="mobile";return t.onSkip?.(u),ve()}if(!t.store&&(!t.endpoint||typeof t.endpoint!="string"))return console.error("[siteping] Missing 'endpoint' or 'store' in config. Provide an endpoint like '/api/siteping' or a SitepingStore instance."),ve();if(!t.projectName||typeof t.projectName!="string")return console.error("[siteping] Missing or invalid 'projectName' in config. Expected a non-empty string."),ve();let i=chunkQ34GDCKE_cjs.o(t.locale??"en"),o=i==="en"?Promise.resolve():chunkQ34GDCKE_cjs.ia(i).catch(()=>{}),r=chunkQ34GDCKE_cjs.ja(i),s=t.scopeAnnotationsByUrl??true,a=()=>{try{let u=t.getPageScope?.();if(u)return u}catch(u){e("getPageScope() threw, falling back to pathname:",u);}return {url:window.location.pathname,urlPattern:null}};e("Initializing widget",{projectName:t.projectName,theme:t.theme??"light",locale:i,scopeAnnotationsByUrl:s});let l=zo(t.captureDiagnostics),c=l.console?new ze(l.maxConsoleEntries):null,p=l.network?new Xe(l.maxNetworkEntries):null,h=chunkQ34GDCKE_cjs.$(t.accentColor,t.theme),d=new fe,f=new fe,m=(()=>{if(t.store)return new Ve(t.store,t.projectName);let u=t.endpoint;if(typeof u!="string"||u.length===0)throw new Error("[siteping] internal invariant: endpoint must be a non-empty string in HTTP mode");return new $e(u,t.projectName,{apiKey:t.apiKey,headers:t.headers})})();t.onOpen&&d.on("open",t.onOpen),t.onClose&&d.on("close",t.onClose),t.onFeedbackSent&&d.on("feedback:sent",t.onFeedbackSent),t.onCommentAdded&&d.on("comment:added",t.onCommentAdded),t.onError&&d.on("feedback:error",t.onError),t.onError&&d.on("panel:action-error",t.onError),d.on("panel:action-error",u=>console.error("[siteping] Panel action failed:",u)),t.onAnnotationStart&&d.on("annotation:start",t.onAnnotationStart),t.onAnnotationEnd&&d.on("annotation:end",t.onAnnotationEnd);let v=He(t.projectName,t.endpoint);d.on("feedback:sent",u=>v.add(u.id)),d.on("feedback:deleted",u=>v.remove(u)),d.on("feedback:all-deleted",()=>v.clear());let T={"feedback:sent":()=>d.on("feedback:sent",u=>f.emit("feedback:sent",u)),"feedback:deleted":()=>d.on("feedback:deleted",u=>f.emit("feedback:deleted",u)),"comment:added":()=>d.on("comment:added",u=>f.emit("comment:added",u)),"feedback:error":()=>d.on("feedback:error",u=>f.emit("feedback:error",u)),"panel:open":()=>d.on("open",()=>f.emit("panel:open")),"panel:close":()=>d.on("close",()=>f.emit("panel:close")),"annotation:start":()=>d.on("annotation:start",()=>f.emit("annotation:start")),"annotation:end":()=>d.on("annotation:end",()=>f.emit("annotation:end"))};for(let u of Object.values(T))u();d.on("open",()=>e("Panel opened")),d.on("close",()=>e("Panel closed")),d.on("feedback:sent",u=>e("Feedback sent",u.id)),d.on("feedback:error",u=>e("Feedback failed",u.message)),d.on("annotation:start",()=>e("Annotation started")),d.on("annotation:end",()=>e("Annotation ended"));let A=document.createElement("siteping-widget");A.style.cssText=`position:fixed;z-index:${2147483647};pointer-events:auto;`;let C=xi()==="test"?"open":"closed",E=A.attachShadow({mode:C});if("adoptedStyleSheets"in ShadowRoot.prototype){let u=new CSSStyleSheet;u.replaceSync(Ft(h)),E.adoptedStyleSheets=[u];}else {let u=document.createElement("style");u.textContent=Ft(h),E.appendChild(u);}chunkQ34GDCKE_cjs.F(A,E);let X=chunkQ34GDCKE_cjs.I();document.body.appendChild(A);let H=Rn(A),P=document.createElement("div");P.setAttribute("role","status"),P.setAttribute("aria-live","polite"),P.setAttribute("aria-atomic","true"),P.setAttribute("data-siteping-ignore","true"),P.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;",chunkQ34GDCKE_cjs.F(P),document.body.appendChild(P);let xe=new Ge(h,i),y=new qe(h,xe,d,r,P),k=new Ke(E,t,d,r);d.on("markers:changed",u=>k.updateBadge(u));let w=null,N=null,I=false,F=0;async function Ht(u=false){let b=t.identity??Tt();if(b)return b;let x=await Ko(E,r,u);return x&&Jn(x),x}async function Dt(){return I?null:w||(N||(N=import('./panel-MIWFGD7X.cjs').then(u=>I?null:(w=new u.Panel(E,h,d,m,t.projectName,y,r,i,{getScope:a,scopeAnnotationsByUrl:s,panelActions:t.panelActions,ownFeedback:v,resolveIdentity:Ht,readOnly:t.readOnly}),w))),N)}if(typeof window<"u"){let u=()=>{I||Dt();},b=window.requestIdleCallback;typeof b=="function"?b(u):setTimeout(u,200);}let U=false,ki=d.on("panel:toggle",u=>{w||(u?(U=true,Dt().then(b=>{b&&U&&b.open(),U=false;}).catch(b=>e("Failed to lazy-load panel:",b))):U=false);}),we=new Oe(h,d,r,t.enableScreenshot??false,()=>H.getLastPageFocus()),Ee=null;t.enableRightClickComment&&(Ee=u=>{if(u.defaultPrevented)return;let b=u.pointerType;b===""||b===void 0&&u.button!==2||u.shiftKey||u.ctrlKey||u.altKey||u.metaKey||u.composedPath().some(R=>R===A||R instanceof Element&&(R.hasAttribute("data-siteping-ignore")||R.id==="siteping-markers"))||we.isBusy||(u.preventDefault(),we.startInstantAnnotation(u.clientX,u.clientY).catch(R=>e("right-click annotation failed",R)));},document.addEventListener("contextmenu",Ee)),i!=="en"&&o.then(()=>{I||(k.refreshLabels(),we.refreshLabels());});let Qe=false,Si=d.on("annotation:complete",async u=>{if(Qe){d.emit("submission:cancelled");return}Qe=true;try{let{annotation:b,type:x,message:R,clientId:q,screenshotDataUrl:V,screenshotRegion:ke}=u,M=await Ht(!0);if(!M){d.emit("submission:cancelled");return}let re=a(),zt=null;(c||p)&&(zt={console:c?.getEntries()??[],network:p?.getEntries()??[]});let Ri={projectName:t.projectName,type:x,message:R,url:re.url,urlPattern:re.urlPattern,viewport:`${window.innerWidth}x${window.innerHeight}`,userAgent:navigator.userAgent,authorName:M.name,authorEmail:M.email,annotations:[b],clientId:q,screenshotDataUrl:V??null,screenshotRegion:ke??null,diagnostics:zt};try{let K=await m.sendFeedback(Ri);d.emit("feedback:sent",K),(!s||K.url===re.url)&&y.addFeedback(K,y.count+1),P.textContent=r("feedback.sent.confirmation"),w&&await w.refresh();}catch(K){d.emit("feedback:error",K instanceof Error?K:new Error(String(K))),P.textContent=r("feedback.error.message");}}finally{Qe=false;}}),Je=a(),Ti=s?{limit:20,url:Je.url}:{limit:20},Ze=Xo(t.deepLink),Ci=++F;Promise.all([m.getFeedbacks(t.projectName,Ti),o]).then(([{feedbacks:u}])=>{if(I||F!==Ci)return;let b=s?u.filter(x=>x.url===Je.url):u;if(y.render(b),Ze.enabled)try{let x=new URLSearchParams(window.location.search).get(Ze.param);if(x){let R=y.focusFeedback(x);e(`deepLink ?${Ze.param}=${x} ${R?"focused":"did not match a visible feedback"}`);}}catch(x){e("deepLink parsing failed:",x);}}).catch(u=>{e("Failed to load initial markers:",u);}),t.endpoint&&Vn(t.endpoint,t.identity??Tt(),{apiKey:t.apiKey,headers:t.headers}).then(()=>e("Retry queue flushed")).catch(()=>{});let $t=()=>{let u=++F;if(w?.isCurrentlyOpen)return w.refresh();let b=a(),x=s?{limit:20,url:b.url}:{limit:20};return m.getFeedbacks(t.projectName,x).then(({feedbacks:R})=>{if(I||u!==F||w?.isCurrentlyOpen)return;let q=s?R.filter(V=>V.url===b.url):R;y.render(q);})},Bt=null;if(t.watchNavigation!==false&&typeof window<"u"&&typeof history<"u"){let u=M=>`${M.url}
|
|
3
|
+
${M.urlPattern??""}`,b=u(Je),x=()=>{if(I)return;let M=u(a());if(M===b)return;let re=b;b=M,e("SPA navigation detected \u2014 refreshing feedbacks for new scope"),$t().catch(()=>{b===M&&(b=re);});},R=history.pushState,q=history.replaceState,V=function(...M){R.apply(this,M),x();},ke=function(...M){q.apply(this,M),x();};history.pushState=V,history.replaceState=ke,window.addEventListener("popstate",x),window.addEventListener("hashchange",x),Bt=()=>{window.removeEventListener("popstate",x),window.removeEventListener("hashchange",x),history.pushState===V&&(history.pushState=R),history.replaceState===ke&&(history.replaceState=q);};}let et={destroy:()=>{I||(e("Destroying widget"),Ee&&document.removeEventListener("contextmenu",Ee),I=true,U=false,Bt?.(),H.destroy(),Si(),ki(),k.destroy(),w?.destroy(),we.destroy(),y.destroy(),xe.destroy(),c?.dispose(),p?.dispose(),d.removeAll(),f.removeAll(),P.remove(),A.remove(),X(),ye===et&&(ye=null));},open:()=>{d.emit("panel:toggle",true);},close:()=>{w?w.close():U=false;},focusFeedback:u=>y.focusFeedback(u),refresh:()=>{$t().catch(()=>{});},on:(u,b)=>f.on(u,b),off:(u,b)=>{f.off(u,b);}};return ye=et,et}function Ko(t,e,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()}`,h=`sp-identity-email-${Date.now()}`,d=document.createElement("label");d.className="sp-input-label",d.textContent=e("identity.nameLabel"),d.setAttribute("for",p);let f=document.createElement("input");f.className="sp-input",f.id=p,f.type="text",f.maxLength=chunkQ34GDCKE_cjs.e,f.placeholder=e("identity.namePlaceholder"),f.style.marginBottom="14px";let m=document.createElement("label");m.className="sp-input-label",m.textContent=e("identity.emailLabel"),m.setAttribute("for",h);let v=document.createElement("input");v.className="sp-input",v.id=h,v.type="email",v.maxLength=chunkQ34GDCKE_cjs.e,v.placeholder=e("identity.emailPlaceholder");let T=document.createElement("div");T.className="sp-identity-actions";let A=chunkQ34GDCKE_cjs.ha(y=>a.style.setProperty("--sp-kb",`${y}px`)),C=y=>{s.removeEventListener("keydown",P),xe(),A(),s.classList.remove("sp-identity--open"),setTimeout(()=>{s.remove(),o?.focus(),i(y);},250);},E=document.createElement("button");E.className="sp-btn-ghost",E.textContent=e("identity.cancel"),E.addEventListener("click",()=>C(null));let _=document.createElement("button");_.className="sp-btn-primary",_.textContent=e("identity.submit");let X=(y,k)=>{y.style.borderColor=k?"var(--sp-type-bug, #ef4444)":"",k?y.setAttribute("aria-invalid","true"):y.removeAttribute("aria-invalid");};_.addEventListener("click",()=>{let y=f.value.trim(),k=v.value.trim();if(!y||!k)return;let w=y.length>chunkQ34GDCKE_cjs.e,N=k.length>chunkQ34GDCKE_cjs.e||!chunkQ34GDCKE_cjs.a(k);X(f,w),X(v,N),!(w||N)&&C({name:y,email:k});});let H='input, button, [tabindex]:not([tabindex="-1"])',P=y=>{let k=y;if(k.key==="Escape"){k.stopPropagation(),C(null);return}if(k.key==="Tab"){let w=Array.from(a.querySelectorAll(H));if(w.length===0)return;let N=w[0],I=w[w.length-1];if(!N||!I)return;let F=t.activeElement;k.shiftKey?(F===N||!a.contains(F))&&(k.preventDefault(),I.focus()):(F===I||!a.contains(F))&&(k.preventDefault(),N.focus());}};s.addEventListener("keydown",P);let xe=chunkQ34GDCKE_cjs.H(s,()=>true);s.addEventListener("click",y=>{y.target===s&&C(null);}),T.appendChild(E),T.appendChild(_),a.appendChild(c),a.appendChild(d),a.appendChild(f),a.appendChild(m),a.appendChild(v),a.appendChild(T),s.appendChild(a),t.appendChild(s),requestAnimationFrame(()=>{s.classList.add("sp-identity--open"),f.focus();});})}function Ei(t){return wi(t)}function Uo(t){let e=t.current.panelActions;return Array.isArray(e)?e.map(n=>{if(typeof n!="object"||n===null)return n;let i=()=>t.current.panelActions?.find(a=>a?.id===n.id)??n,o=a=>{let l=i().visible;return l?!!l(a):true},{onAction:r,href:s}=n;return typeof r=="function"&&s===void 0?{...n,visible:o,onAction:(a,l)=>(i().onAction??r)(a,l)}:r!==void 0?n:typeof s=="string"?{...n,visible:o}:typeof s!="function"?n:{...n,visible:o,href:a=>{let l=i().href??s;return typeof l=="function"?l(a):l}}}):e}function Qr(t){let e=react.useRef(t);e.current=t;let[n,i]=react.useState(null);return react.useEffect(()=>{let o=true,r=Ei({...e.current,onSkip:s=>{o&&e.current.onSkip?.(s);},onOpen:()=>{o&&e.current.onOpen?.();},onClose:()=>{o&&e.current.onClose?.();},onFeedbackSent:s=>{o&&e.current.onFeedbackSent?.(s);},onCommentAdded:s=>{o&&e.current.onCommentAdded?.(s);},onError:s=>{o&&e.current.onError?.(s);},onAnnotationStart:()=>{o&&e.current.onAnnotationStart?.();},onAnnotationEnd:()=>{o&&e.current.onAnnotationEnd?.();},panelActions:Uo(e)});if(!o){r.destroy();return}return i(r),()=>{o=false,r.destroy(),i(null);}},[]),n}exports.useSiteping=Qr;//# sourceMappingURL=react.cjs.map
|
|
4
4
|
//# sourceMappingURL=react.cjs.map
|