@siteping/widget 0.9.6 → 0.9.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/react.js ADDED
@@ -0,0 +1,1568 @@
1
+ import {A,B,w as w$1,O as O$1,N,F,D,S,H as H$1,z,b,x,y,C,c,e,g,h,j,i,a,f,k,n,o,p,q as q$1}from'./chunk-OTJZRTBK.js';import {useRef,useState,useEffect}from'react';var w,Pe,at;function lt(t,e){if(at=new Date,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:i=>true,className:i=>true,tagName:i=>true,attr:(i,r)=>false,seedMinLength:1,optimizedMinLength:2,threshold:1e3,maxNumberOfTries:1e4,timeoutMs:void 0};w={...n,...e},Pe=jt(w.root,n);let o=ne(t,"all",()=>ne(t,"two",()=>ne(t,"one",()=>ne(t,"none"))));if(o){let i=dt(ut(o,t));return i.length>0&&(o=i[0]),re(o)}else throw new Error("Selector was not found.")}function jt(t,e){return t.nodeType===Node.DOCUMENT_NODE?t:t===e.root?t.ownerDocument:t}function ne(t,e,n){let o=null,i=[],r=t,s=0;for(;r;){let a=new Date().getTime()-at.getTime();if(w.timeoutMs!==void 0&&a>w.timeoutMs)throw new Error(`Timeout: Can't find a unique selector after ${a}ms`);let l=ie(zt(r))||ie(...Kt(r))||ie(...Xt(r))||ie(Ut(r))||[st()],p=Yt(r);if(e=="all")p&&(l=l.concat(l.filter(Ae).map(c=>oe(c,p))));else if(e=="two")l=l.slice(0,1),p&&(l=l.concat(l.filter(Ae).map(c=>oe(c,p))));else if(e=="one"){let[c]=l=l.slice(0,1);p&&Ae(c)&&(l=[oe(c,p)]);}else e=="none"&&(l=[st()],p&&(l=[oe(l[0],p)]));for(let c of l)c.level=s;if(i.push(l),i.length>=w.seedMinLength&&(o=it(i,n),o))break;r=r.parentElement,s++;}return o||(o=it(i,n)),!o&&n?n():o}function it(t,e){let n=dt(pt(t));if(n.length>w.threshold)return e?e():null;for(let o of n)if(ct(o))return o;return null}function re(t){let e=t[0],n=e.name;for(let o=1;o<t.length;o++){let i=t[o].level||0;e.level===i-1?n=`${t[o].name} > ${n}`:n=`${t[o].name} ${n}`,e=t[o];}return n}function rt(t){return t.map(e=>e.penalty).reduce((e,n)=>e+n,0)}function ct(t){let e=re(t);switch(Pe.querySelectorAll(e).length){case 0:throw new Error(`Can't select any node with this selector: ${e}`);case 1:return true;default:return false}}function zt(t){let e=t.getAttribute("id");return e&&w.idName(e)?{name:"#"+CSS.escape(e),penalty:0}:null}function Kt(t){return Array.from(t.attributes).filter(n=>w.attr(n.name,n.value)).map(n=>({name:`[${CSS.escape(n.name)}="${CSS.escape(n.value)}"]`,penalty:.5}))}function Xt(t){return Array.from(t.classList).filter(w.className).map(n=>({name:"."+CSS.escape(n),penalty:1}))}function Ut(t){let e=t.tagName.toLowerCase();return w.tagName(e)?{name:e,penalty:2}:null}function st(){return {name:"*",penalty:3}}function Yt(t){let e=t.parentNode;if(!e)return null;let n=e.firstChild;if(!n)return null;let o=0;for(;n&&(n.nodeType===Node.ELEMENT_NODE&&o++,n!==t);)n=n.nextSibling;return o}function oe(t,e){return {name:t.name+`:nth-child(${e})`,penalty:t.penalty+1}}function Ae(t){return t.name!=="html"&&!t.name.startsWith("#")}function ie(...t){let e=t.filter(Wt);return e.length>0?e:null}function Wt(t){return t!=null}function*pt(t,e=[]){if(t.length>0)for(let n of t[0])yield*pt(t.slice(1,t.length),e.concat(n));else yield e;}function dt(t){return [...t].sort((e,n)=>rt(e)-rt(n))}function*ut(t,e,n={counter:0,visited:new Map}){if(t.length>2&&t.length>w.optimizedMinLength)for(let o=1;o<t.length-1;o++){if(n.counter>w.maxNumberOfTries)return;n.counter+=1;let i=[...t];i.splice(o,1);let r=re(i);if(n.visited.has(r))return;ct(i)&&qt(i,e)&&(yield i,n.visited.set(r,true),yield*ut(i,e,n));}}function qt(t,e){return Pe.querySelector(re(t))===e}var Gt=["role","aria-label","type","name","href","src","data-testid","data-id"];function Vt(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 Re(t){let e=t.children.length,n=0,o=t.parentElement;if(o)for(let s of o.children){if(s===t)break;s.tagName===t.tagName&&n++;}let i=[];for(let s of Gt){let a=t.getAttribute(s);a&&i.push(`${s}=${a}`);}let r=i.length>0?Vt(i.join(",")):"0";return `${e}:${n}:${r}`}function ht(t,e){let n=e.split(":");if(n.length!==3)return 0;let[o,i,r]=n,s=Number(o),a=Number(i);if(Number.isNaN(s)||Number.isNaN(a))return 0;let l=Re(t),[p,c,d]=l.split(":"),h=0,f=Math.abs(Number(p)-s);f===0?h+=.2:f<=2?h+=.1:f<=5&&(h+=.03);let v=Math.abs(Number(c)-a);return v===0?h+=.4:v===1?h+=.2:v<=3&&(h+=.08),d===r&&(h+=.4),h}function $(t,e){let n=e==="before"?"previousElementSibling":"nextElementSibling",o=t[n],i=3;for(;o&&i>0;){let r=o.textContent?.trim();if(r)return e==="before"?r.slice(-32):r.slice(0,32);o=o[n],i--;}return ""}function se(t){let e=t.previousElementSibling?.textContent?.trim().slice(0,40)??"",n=t.nextElementSibling?.textContent?.trim().slice(0,40)??"";return [e,n].filter(Boolean).join(" | ")}function ft(t){if(t.id){let o=t.id.includes("'")?`concat('${t.id.replace(/'/g,`',"'",'`)}')`:`'${t.id}'`;return `//${t.localName}[@id=${o}]`}let e=[],n=t;for(;n&&n!==document.body&&e.length<6;){let o=n.localName,i=n.parentElement;if(n.id){let s=n.id.includes("'")?`concat('${n.id.replace(/'/g,`',"'",'`)}')`:`'${n.id}'`;return e.unshift(`/${o}[@id=${s}]`),"/"+e.join("")}let r=1;if(i)for(let s of i.children){if(s===n)break;s.localName===o&&r++;}e.unshift(`/${o}[${r}]`),n=i;}return "/html/body"+e.join("")}var K="data-feedback-anchor";function Fe(t){let e=lt(t,{className:d=>!/^(css|sc|emotion|styled)-/.test(d)&&!/^[a-z]{1,3}[A-Za-z0-9]{4,8}$/.test(d),attr:d=>["data-testid","data-id","role","aria-label"].includes(d),idName:d=>!d.startsWith("radix-")&&!/^:r[0-9]+:$/.test(d),seedMinLength:3,optimizedMinLength:2}),n=ft(t),i=(t.textContent?.trim()??"").slice(0,120),r=$(t,"before"),s=$(t,"after"),a=Re(t),l=se(t),c=t.closest(`[${K}]`)?.getAttribute(K)??null;return {cssSelector:e,xpath:n,textSnippet:i,textPrefix:r,textSuffix:s,fingerprint:a,neighborText:l,elementTag:t.tagName,elementId:t.id||void 0,anchorKey:c}}function mt(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 gt(t,e=document.documentElement){let n=t.x+t.width/2,o=t.y+t.height/2,i=document.elementFromPoint(n,o);if(!i||i===e)return document.body;let r=i;for(;r&&r!==document.body;){if(r.hasAttribute(K)&&mt(r,t))return r;r=r.parentElement;}for(r=i;r&&r!==document.body;){if(mt(r,t))return r;r=r.parentElement;}return document.body}function bt(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 ae=class{constructor(e,n$1){this.colors=e;this.t=n$1;this.root=b("div",{style:`
2
+ position:fixed;
3
+ z-index:${2147483647};
4
+ width:300px;
5
+ padding:16px;
6
+ border-radius:16px;
7
+ background:${this.colors.glassBg};
8
+ backdrop-filter:blur(24px);
9
+ -webkit-backdrop-filter:blur(24px);
10
+ border:1px solid ${this.colors.glassBorder};
11
+ box-shadow:0 8px 32px ${this.colors.shadow}, 0 2px 8px ${this.colors.shadow};
12
+ font-family:"Inter",system-ui,-apple-system,sans-serif;
13
+ opacity:0;
14
+ transform:translateY(8px) scale(0.98);
15
+ transition:opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1),transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
16
+ display:none;
17
+ -webkit-font-smoothing:antialiased;
18
+ `}),this.root.setAttribute("role","dialog"),this.root.setAttribute("aria-modal","true"),this.root.setAttribute("aria-label",this.t("popup.ariaLabel"));let o$1=[{type:"question",label:this.t("type.question"),icon:n},{type:"change",label:this.t("type.change"),icon:o},{type:"bug",label:this.t("type.bug"),icon:p},{type:"other",label:this.t("type.other"),icon:q$1}],i=b("div",{style:"display:grid;grid-template-columns:1fr 1fr;gap:6px;margin-bottom:12px;"});for(let c$1 of o$1){let d=document.createElement("button");d.style.cssText=`
19
+ height:44px;
20
+ border-radius:9999px;border:1px solid ${this.colors.border};
21
+ background:${this.colors.glassBg};cursor:pointer;
22
+ display:flex;align-items:center;justify-content:center;gap:5px;
23
+ font-family:"Inter",system-ui,-apple-system,sans-serif;
24
+ font-size:13px;font-weight:500;color:${this.colors.textTertiary};
25
+ transition:all 0.2s ease;
26
+ padding:0 12px;
27
+ `;let h=a(c$1.icon);h.setAttribute("style","width:13px;height:13px;flex-shrink:0;"),d.appendChild(h);let f=document.createElement("span");c(f,c$1.label),d.appendChild(f),d.dataset.type=c$1.type,d.setAttribute("aria-pressed","false"),d.addEventListener("click",()=>{this.selectType(c$1.type,i);}),d.addEventListener("mouseenter",()=>{if(d.dataset.type!==this.selectedType){let v=y(d.dataset.type??"",this.colors);d.style.background=v,d.style.borderColor=x(d.dataset.type??"",this.colors)+"40";}}),d.addEventListener("mouseleave",()=>{d.dataset.type!==this.selectedType&&(d.style.background=this.colors.glassBg,d.style.borderColor=this.colors.border);}),i.appendChild(d);}this.textarea=document.createElement("textarea"),this.textarea.style.cssText=`
28
+ width:100%;min-height:72px;max-height:152px;
29
+ padding:10px 12px;border-radius:12px;
30
+ border:1px solid ${this.colors.border};
31
+ background:${this.colors.glassBgHeavy};
32
+ color:${this.colors.text};font-family:"Inter",system-ui,-apple-system,sans-serif;
33
+ font-size:13px;line-height:1.5;resize:vertical;
34
+ outline:none;transition:all 0.2s ease;
35
+ box-sizing:border-box;
36
+ `,this.textarea.placeholder=this.t("popup.placeholder"),this.textarea.maxLength=5e3,this.textarea.setAttribute("aria-label",this.t("popup.textareaAria"));let r=b("div",{style:`
37
+ font-size:11px;color:${this.colors.textTertiary};
38
+ text-align:right;margin-top:4px;
39
+ font-family:"Inter",system-ui,-apple-system,sans-serif;
40
+ letter-spacing:0.01em;
41
+ `}),s=navigator.userAgentData,a$1=s?s.platform==="macOS":navigator.platform?.includes("Mac")??/Macintosh|Mac OS X/i.test(navigator.userAgent);c(r,a$1?this.t("popup.submitHintMac"):this.t("popup.submitHintOther")),this.textarea.addEventListener("focus",()=>{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.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",c=>{c.key==="Enter"&&(c.ctrlKey||c.metaKey)&&(c.preventDefault(),this.submit()),c.key==="Escape"&&this.cancel();});let l=b("div",{style:"display:flex;justify-content:flex-end;gap:8px;margin-top:12px;"}),p$1=document.createElement("button");p$1.style.cssText=`
42
+ height:34px;padding:0 16px;border-radius:9999px;
43
+ border:1px solid ${this.colors.border};
44
+ background:${this.colors.glassBg};
45
+ color:${this.colors.textTertiary};font-family:"Inter",system-ui,-apple-system,sans-serif;
46
+ font-size:13px;font-weight:500;cursor:pointer;
47
+ transition:all 0.2s ease;
48
+ `,c(p$1,this.t("popup.cancel")),p$1.addEventListener("click",()=>this.cancel()),p$1.addEventListener("mouseenter",()=>{p$1.style.borderColor=this.colors.accent,p$1.style.color=this.colors.accent;}),p$1.addEventListener("mouseleave",()=>{p$1.style.borderColor=this.colors.border,p$1.style.color=this.colors.textTertiary;}),this.submitBtn=document.createElement("button"),this.submitBtn.style.cssText=`
49
+ height:34px;padding:0 18px;border-radius:9999px;
50
+ border:none;background:${this.colors.accentGradient};
51
+ color:#fff;font-family:"Inter",system-ui,-apple-system,sans-serif;
52
+ font-size:13px;font-weight:600;cursor:pointer;
53
+ opacity:0.35;pointer-events:none;
54
+ transition:all 0.2s ease;
55
+ box-shadow:0 2px 8px ${this.colors.accentGlow};
56
+ `,c(this.submitBtn,this.t("popup.submit")),this.submitBtn.addEventListener("click",()=>this.submit()),l.appendChild(p$1),l.appendChild(this.submitBtn),this.root.appendChild(i),this.root.appendChild(this.textarea),this.root.appendChild(r),this.root.appendChild(l),document.body.appendChild(this.root);}colors;t;root;selectedType=null;textarea;submitBtn;resolve=null;previouslyFocused=null;onKeydownTrap=null;show(e){return new Promise(n=>{this.resolve=n,this.selectedType=null,this.textarea.value="",this.updateSubmitState(),this.resetTypeButtons(),this.previouslyFocused=document.activeElement;let o=220,i=300,r=e.bottom+8,s=e.left;if(r+o>window.innerHeight){let l=e.top-o-8;l>=8?r=l:r=window.innerHeight-o-8;}s+i>window.innerWidth&&(s=e.right-i),s=Math.max(8,s),r=Math.max(8,r),this.root.style.top=`${r}px`,this.root.style.left=`${s}px`,this.root.style.display="block",this.onKeydownTrap=l=>{if(l.key==="Tab"){let p=Array.from(this.root.querySelectorAll('button:not([disabled]), textarea, input, [tabindex]:not([tabindex="-1"])'));if(p.length===0)return;let c=p[0],d=p[p.length-1];if(!c||!d)return;l.shiftKey?(document.activeElement===c||!this.root.contains(document.activeElement))&&(l.preventDefault(),d.focus()):(document.activeElement===d||!this.root.contains(document.activeElement))&&(l.preventDefault(),c.focus());}},this.root.addEventListener("keydown",this.onKeydownTrap);let a=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;this.root.style.transition=a?"none":"",requestAnimationFrame(()=>{this.root.style.opacity="1",this.root.style.transform="translateY(0) scale(1)",this.textarea.focus();});})}selectType(e,n){this.selectedType=e;let o=n.querySelectorAll("button");for(let i of o){let r=i.dataset.type===e,s=x(i.dataset.type??"",this.colors),a=y(i.dataset.type??"",this.colors);i.style.background=r?a:this.colors.glassBg,i.style.borderColor=r?s+"60":this.colors.border,i.style.color=r?s:this.colors.textTertiary,i.style.fontWeight=r?"600":"500",i.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.style.background=this.colors.glassBg,n.style.borderColor=this.colors.border,n.style.color=this.colors.textTertiary,n.style.fontWeight="500";}updateSubmitState(){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(){!this.selectedType||!this.textarea.value.trim()||(this.resolve?.({type:this.selectedType,message:this.textarea.value.trim()}),this.resolve=null,this.hideElement());}cancel(){this.resolve?.(null),this.resolve=null,this.hideElement();}hideElement(){this.onKeydownTrap&&(this.root.removeEventListener("keydown",this.onKeydownTrap),this.onKeydownTrap=null),this.root.style.opacity="0",this.root.style.transform="translateY(8px) scale(0.98)",this.previouslyFocused?.focus(),this.previouslyFocused=null,setTimeout(()=>{this.root.style.display="none";},250);}destroy(){this.root.remove();}};var X,yt=false;async function Jt(){if(X!==void 0)return X;try{let t=await import('html2canvas');return X=t.default??t,X}catch(t){return X=null,yt||(yt=true,console.warn("[siteping] html2canvas import failed unexpectedly. Capture is disabled for this session \u2014 feedbacks are still submitted, just without screenshots. Underlying error:",t)),null}}async function xt(t,e){let n=await Jt();if(!n)return null;let o=.85,i=1200;try{let r=await n(document.body,{x:window.scrollX+t.x,y:window.scrollY+t.y,width:t.width,height:t.height,scale:window.devicePixelRatio,useCORS:!0,allowTaint:!0,logging:!1,ignoreElements:d=>d.tagName==="SITEPING-WIDGET"||d.closest?.("siteping-widget")!==null||d.getAttribute?.("data-siteping-ignore")==="true"});if(r.width<=i)return r.toDataURL("image/jpeg",o);let s=i/r.width,a=i,l=Math.round(r.height*s),p=document.createElement("canvas");p.width=a,p.height=l;let c=p.getContext("2d");return c?(c.drawImage(r,0,0,a,l),p.toDataURL("image/jpeg",o)):null}catch(r){return console.warn("[siteping] Screenshot capture failed:",r),null}}var le=class{constructor(e,n,o,i=false){this.colors=e;this.bus=n;this.t=o;this.enableScreenshot=i;this.popup=new ae(e,o),this.bus.on("annotation:start",()=>this.activate());}colors;bus;t;enableScreenshot;overlay=null;toolbar=null;drawingRect=null;startX=0;startY=0;isDrawing=false;isActive=false;popup;savedOverflow="";preActiveFocusElement=null;rafId=null;pendingMoveEvent=null;async maybeCapture(e){return this.enableScreenshot?xt(e):null}activate(){if(this.isActive)return;this.isActive=true,this.preActiveFocusElement=document.activeElement,this.savedOverflow=document.body.style.overflow,document.body.style.overflow="hidden",this.overlay=b("div",{style:`
57
+ position:fixed;inset:0;
58
+ z-index:${2147483646};
59
+ background:rgba(15, 23, 42, 0.04);
60
+ cursor:crosshair;
61
+ `}),this.overlay.setAttribute("aria-hidden","true"),this.toolbar=b("div",{style:`
62
+ position:fixed;top:0;left:0;right:0;
63
+ z-index:${2147483647};
64
+ height:52px;
65
+ background:${this.colors.glassBg};
66
+ backdrop-filter:blur(24px);
67
+ -webkit-backdrop-filter:blur(24px);
68
+ border-bottom:1px solid ${this.colors.glassBorder};
69
+ display:flex;align-items:center;justify-content:center;gap:16px;
70
+ font-family:"Inter",system-ui,-apple-system,sans-serif;
71
+ font-size:14px;color:${this.colors.text};
72
+ box-shadow:0 4px 16px ${this.colors.shadow};
73
+ -webkit-font-smoothing:antialiased;
74
+ `});let e=b("span",{style:`
75
+ width:8px;height:8px;border-radius:50%;
76
+ background:${this.colors.accent};
77
+ box-shadow:0 0 8px ${this.colors.accentGlow};
78
+ animation:pulse 1.5s ease-in-out infinite;
79
+ `}),n=document.createElement("style");n.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(n);let o=b("span",{style:"font-weight:500;letter-spacing:-0.01em;"});c(o,this.t("annotator.instruction"));let i=document.createElement("button");i.style.cssText=`
80
+ height:34px;padding:0 18px;border-radius:9999px;
81
+ border:1px solid ${this.colors.border};
82
+ background:${this.colors.glassBg};
83
+ color:${this.colors.textTertiary};font-family:"Inter",system-ui,-apple-system,sans-serif;
84
+ font-size:13px;font-weight:500;cursor:pointer;
85
+ transition:all 0.2s ease;
86
+ `,c(i,this.t("annotator.cancel")),i.addEventListener("click",()=>this.deactivate()),i.addEventListener("mouseenter",()=>{i.style.borderColor=this.colors.typeBug,i.style.color=this.colors.typeBug,i.style.background=this.colors.typeBugBg;}),i.addEventListener("mouseleave",()=>{i.style.borderColor=this.colors.border,i.style.color=this.colors.textTertiary,i.style.background=this.colors.glassBg;}),this.toolbar.appendChild(e),this.toolbar.appendChild(o),this.toolbar.appendChild(i),this.overlay.addEventListener("mousedown",this.onMouseDown),this.overlay.addEventListener("mousemove",this.onMouseMove),this.overlay.addEventListener("mouseup",this.onMouseUp),this.overlay.addEventListener("touchstart",this.onTouchStart,{passive:false}),this.overlay.addEventListener("touchmove",this.onTouchMove,{passive:false}),this.overlay.addEventListener("touchend",this.onTouchEnd),this.overlay.addEventListener("keydown",this.onOverlayKeyDown),this.overlay.setAttribute("tabindex","0"),document.addEventListener("keydown",this.onKeyDown),document.body.appendChild(this.overlay),document.body.appendChild(this.toolbar);}deactivate(){this.isActive&&(this.isActive=false,this.isDrawing=false,this.preActiveFocusElement=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,this.bus.emit("annotation:end"));}onKeyDown=e=>{e.key==="Escape"&&this.deactivate();};onOverlayKeyDown=async e=>{if(e.key!=="Enter")return;e.preventDefault();let n=this.preActiveFocusElement;if(!n||!(n instanceof HTMLElement))return;let o=n.getBoundingClientRect();if(o.width<=0||o.height<=0)return;let i=new DOMRect(o.x,o.y,o.width,o.height),r=await this.popup.show(i);if(!r)return;let a={anchor:Fe(n),rect:{xPct:0,yPct:0,wPct:1,hPct:1},scrollX:window.scrollX,scrollY:window.scrollY,viewportW:window.innerWidth,viewportH:window.innerHeight,devicePixelRatio:window.devicePixelRatio},l=await this.maybeCapture(i);this.deactivate(),this.bus.emit("annotation:complete",{annotation:a,type:r.type,message:r.message,screenshotDataUrl:l});};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.isDrawing=true,this.startX=e,this.startY=n,this.drawingRect?.remove(),this.drawingRect=b("div",{style:`
87
+ position:fixed;
88
+ border:2px solid ${this.colors.accent};
89
+ background:${this.colors.accent}12;
90
+ pointer-events:none;
91
+ border-radius:8px;
92
+ box-shadow:0 0 16px ${this.colors.accentGlow};
93
+ transition:box-shadow 0.15s ease;
94
+ `}),this.overlay?.appendChild(this.drawingRect);}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 o=Math.min(n.clientX,this.startX),i=Math.min(n.clientY,this.startY),r=Math.abs(n.clientX-this.startX),s=Math.abs(n.clientY-this.startY);this.drawingRect.style.left=`${o}px`,this.drawingRect.style.top=`${i}px`,this.drawingRect.style.width=`${r}px`,this.drawingRect.style.height=`${s}px`;})));}onTouchEnd=async e=>{let n=e.changedTouches[0];n&&await this.finishDrawing(n.clientX,n.clientY);};onMouseUp=async e=>{await this.finishDrawing(e.clientX,e.clientY);};finishDrawing=async(e,n)=>{if(!this.isDrawing||!this.drawingRect)return;this.isDrawing=false;let o=Math.min(e,this.startX),i=Math.min(n,this.startY),r=Math.abs(e-this.startX),s=Math.abs(n-this.startY);if(r<10||s<10){this.drawingRect.remove(),this.drawingRect=null;return}let a=new DOMRect(o,i,r,s),l=await this.popup.show(a);if(!l){this.drawingRect?.remove(),this.drawingRect=null;return}let p=this.buildAnnotation(a);this.drawingRect?.remove(),this.drawingRect=null;let c=await this.maybeCapture(a);this.deactivate(),this.bus.emit("annotation:complete",{annotation:p,type:l.type,message:l.message,screenshotDataUrl:c});};buildAnnotation(e){this.overlay&&(this.overlay.style.pointerEvents="none");let n=gt(e);this.overlay&&(this.overlay.style.pointerEvents="auto");let o=Fe(n),i=n.getBoundingClientRect(),r=bt(e,i);return {anchor:o,rect:r,scrollX:window.scrollX,scrollY:window.scrollY,viewportW:window.innerWidth,viewportH:window.innerHeight,devicePixelRatio:window.devicePixelRatio}}destroy(){this.deactivate(),this.popup.destroy();}};var T=class extends Error{code;retryable;constructor(e,n,o){super(e),this.code=n,this.retryable=o,this.name="SitepingError";}},H=class extends T{constructor(e){super(e,"NETWORK",true),this.name="SitepingNetworkError";}},U=class extends T{constructor(e){super(e,"VALIDATION",false),this.name="SitepingValidationError";}},Y=class extends T{constructor(e){super(e,"AUTH",false),this.name="SitepingAuthError";}};function Me(t){return {cssSelector:t.anchor.cssSelector,xpath:t.anchor.xpath,textSnippet:t.anchor.textSnippet,elementTag:t.anchor.elementTag,elementId:t.anchor.elementId,textPrefix:t.anchor.textPrefix,textSuffix:t.anchor.textSuffix,fingerprint:t.anchor.fingerprint,neighborText:t.anchor.neighborText,anchorKey:t.anchor.anchorKey??null,xPct:t.rect.xPct,yPct:t.rect.yPct,wPct:t.rect.wPct,hPct:t.rect.hPct,scrollX:t.scrollX,scrollY:t.scrollY,viewportW:t.viewportW,viewportH:t.viewportH,devicePixelRatio:t.devicePixelRatio}}async function W(t,e){let n=await t.text().catch(()=>"Unknown error"),o=n?`${t.status} ${n}`:`${t.status}`,i=`${e}: ${o}`;return t.status===401||t.status===403?new Y(i):t.status>=400&&t.status<500?new U(i):new T(i,"SERVER",false)}function q(t,e){if(t instanceof T&&t instanceof H)return t;let n=t instanceof Error?t.message:String(t);return new H(`${e}: ${n}`)}var Qt=3,Zt=1e4,V="siteping_retry_queue",en=20;async function G(t,e,n=Qt){for(let o=0;o<=n;o++){let i=new AbortController,r=setTimeout(()=>i.abort(),Zt);try{let l=await fetch(t,{...e,signal:i.signal});if(clearTimeout(r),l.ok||l.status>=400&&l.status<500||o===n)return l}catch(l){if(clearTimeout(r),o===n)throw l}let s=1e3*2**o,a=Math.random()*1e3-500;await new Promise(l=>setTimeout(l,s+a));}throw new Error("Max retries exceeded")}var tn="siteping_retry_queue";async function vt(t){return typeof navigator<"u"&&navigator.locks?navigator.locks.request(tn,()=>t()):t()}function nn(t,e){vt(()=>{try{let n=localStorage.getItem(V),o=n?JSON.parse(n):[],i=Array.isArray(o)?o:[];i.length>=en&&i.shift(),i.push({endpoint:t,payload:e}),localStorage.setItem(V,JSON.stringify(i));}catch{}});}async function wt(t){await vt(async()=>{try{let e=localStorage.getItem(V);if(!e)return;let n=JSON.parse(e),o=Array.isArray(n)?n:[],i=o.filter(a=>a.endpoint===t);if(i.length===0)return;let r=[];for(let a of i)try{(await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a.payload)})).ok||r.push(a);}catch{r.push(a);}let s=o.filter(a=>a.endpoint!==t).concat(r);s.length>0?localStorage.setItem(V,JSON.stringify(s)):localStorage.removeItem(V);}catch{}});}var ce=class{constructor(e,n){this.endpoint=e;this.projectName=n;}endpoint;projectName;async sendFeedback(e){try{let n;try{n=await G(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});}catch(o){throw q(o,"Failed to send feedback")}if(!n.ok)throw await W(n,"Failed to send feedback");return await n.json()}catch(n){throw nn(this.endpoint,e),n}}async getFeedbacks(e,n){let o=new URLSearchParams({projectName:e});n?.page&&o.set("page",String(n.page)),n?.limit&&o.set("limit",String(n.limit)),n?.type&&o.set("type",n.type),n?.status&&o.set("status",n.status),n?.search&&o.set("search",n.search),n?.url&&o.set("url",n.url),n?.urlPattern&&o.set("urlPattern",n.urlPattern);let i;try{i=await G(`${this.endpoint}?${o.toString()}`,{method:"GET",cache:"no-store"});}catch(r){throw q(r,"Failed to fetch feedbacks")}if(!i.ok)throw await W(i,"Failed to fetch feedbacks");return await i.json()}async resolveFeedback(e,n){let o;try{o=await G(this.endpoint,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,projectName:this.projectName,status:n?"resolved":"open"})});}catch(i){throw q(i,"Failed to update feedback")}if(!o.ok)throw await W(o,"Failed to update feedback");return await o.json()}async deleteFeedback(e){let n;try{n=await G(this.endpoint,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,projectName:this.projectName})});}catch(o){throw q(o,"Failed to delete feedback")}if(!n.ok)throw await W(n,"Failed to delete feedback")}async deleteAllFeedbacks(e){let n;try{n=await G(this.endpoint,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectName:e,deleteAll:!0})});}catch(o){throw q(o,"Failed to delete all feedbacks")}if(!n.ok)throw await W(n,"Failed to delete all feedbacks")}};var on=["log","info","warn","error"];function rn(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?`
95
+ ${t.stack}`:""}`;try{let e=new WeakSet;return JSON.stringify(t,(n,o)=>{if(typeof o=="function")return "[Function]";if(typeof o=="symbol")return o.toString();if(typeof o=="object"&&o!==null){if(e.has(o))return "[Circular]";e.add(o);}return o})}catch{try{return String(t)}catch{return "[Unserializable]"}}}function sn(t){let e="";for(let n=0;n<t.length&&(n>0&&(e+=" "),e+=rn(t[n]),!(e.length>=500));n++);return e.length>500&&(e=`${e.slice(0,499)}\u2026`),e}var pe=class{maxEntries;entries=[];originals=new Map;disposed=false;constructor(e=50){if(this.maxEntries=Math.min(Math.max(Math.floor(e),0),1e3),!(typeof console>"u"))for(let n of on){let o=console[n];if(typeof o!="function")continue;this.originals.set(n,o);let i=this,r=function(...s){try{i.push(n,s);}catch{}o.apply(this??console,s);};try{Object.defineProperty(r,"name",{value:n});}catch{}console[n]=r;}}push(e,n){this.maxEntries!==0&&(this.entries.length>=this.maxEntries&&this.entries.shift(),this.entries.push({level:e,timestamp:new Date().toISOString(),message:sn(n)}));}getEntries(){return this.entries.slice()}dispose(){if(!this.disposed&&(this.disposed=true,!(typeof console>"u"))){for(let[e,n]of this.originals)try{console[e]=n;}catch{}this.originals.clear();}}};function kt(t){return t.length<=2e3?t:`${t.slice(0,1999)}\u2026`}function Et(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 de=class{maxEntries;entries=[];originalFetch=null;originalXhrOpen=null;originalXhrSend=null;disposed=false;constructor(e=20){this.maxEntries=Math.min(Math.max(Math.floor(e),0),500),this.installFetch(),this.installXhr();}push(e){this.maxEntries!==0&&(this.entries.length>=this.maxEntries&&this.entries.shift(),this.entries.push(e));}installFetch(){if(typeof globalThis.fetch!="function")return;let e=globalThis.fetch;this.originalFetch=e;let n=async(o,i)=>{let r=new Date,s=typeof performance<"u"?performance.now():Date.now(),a=kt(Et(o)),l=(i?.method??(o instanceof Request?o.method:"GET")).toUpperCase();try{let p=await e(o,i);if(!p.ok){let c=typeof performance<"u"?performance.now():Date.now();this.push({url:a,method:l,status:p.status,durationMs:Math.round(c-s),timestamp:r.toISOString()});}return p}catch(p){let c=typeof performance<"u"?performance.now():Date.now();throw this.push({url:a,method:l,status:0,durationMs:Math.round(c-s),timestamp:r.toISOString()}),p}};globalThis.fetch=n;}installXhr(){if(typeof XMLHttpRequest>"u")return;let e=XMLHttpRequest.prototype,n=e.open,o=e.send;this.originalXhrOpen=n,this.originalXhrSend=o;let i=this,r=new WeakMap;e.open=function(s,a,...l){try{r.set(this,{method:s.toUpperCase(),url:kt(Et(a)),startedAt:new Date,t0:typeof performance<"u"?performance.now():Date.now()});}catch{}return n.call(this,s,a,...l)},e.send=function(s){let a=r.get(this);if(a){let l=()=>{try{let p=typeof performance<"u"?performance.now():Date.now(),c=this.status;(c===0||c>=400)&&i.push({url:a.url,method:a.method,status:c,durationMs:Math.round(p-a.t0),timestamp:a.startedAt.toISOString()});}catch{}};try{this.addEventListener("loadend",l,{once:!0});}catch{try{this.addEventListener("loadend",l);}catch{}}}return o.call(this,s??null)};}getEntries(){return this.entries.slice()}dispose(){if(!this.disposed){if(this.disposed=true,this.originalFetch&&typeof globalThis.fetch=="function")try{globalThis.fetch=this.originalFetch;}catch{}if(typeof XMLHttpRequest<"u")try{this.originalXhrOpen&&(XMLHttpRequest.prototype.open=this.originalXhrOpen),this.originalXhrSend&&(XMLHttpRequest.prototype.send=this.originalXhrSend);}catch{}}}};var J=class{listeners=new Map;on(e,n){this.listeners.has(e)||this.listeners.set(e,new Set);let o=this.listeners.get(e);return o.add(n),()=>{o.delete(n);}}off(e,n){let o=this.listeners.get(e);o&&o.delete(n);}emit(e,...n){let o=this.listeners.get(e);if(o)for(let i of o)try{i(...n);}catch(r){console.error(`[siteping] Error in event listener for "${String(e)}":`,r);}}removeAll(){this.listeners.clear();}};var an=54,ue=class{constructor(e,n,o,i$1){this.bus=o;this.t=i$1;let r=n.position??"bottom-right",s=r==="bottom-right";this.items=[{id:"chat",icon:g,label:i$1("fab.messages")},{id:"annotate",icon:h,label:i$1("fab.annotate")},{id:"toggle-annotations",icon:i,iconAlt:j,label:i$1("fab.annotations")}],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(a(f)),this.fab.setAttribute("aria-label",i$1("fab.aria")),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 p=0;p<this.items.length;p++){let c=this.items[p];if(!c)continue;let d=document.createElement("button");d.className="sp-radial-item",d.style.setProperty("--sp-i",String(p)),d.appendChild(a(c.icon)),d.setAttribute("role","menuitem"),d.setAttribute("aria-label",c.label),d.dataset.itemId=c.id,d.addEventListener("click",f=>{f.stopPropagation(),this.handleItemClick(c.id);});let h=document.createElement("span");h.className="sp-radial-label",h.textContent=c.label,h.style.cssText=s?"position:absolute; right:54px; top:50%; transform:translateY(-50%); white-space:nowrap;":"position:absolute; left:54px; top:50%; transform:translateY(-50%); white-space:nowrap;",d.appendChild(h),this.radialContainer.appendChild(d);}this.root=document.createElement("div"),this.root.appendChild(this.radialContainer),this.root.appendChild(this.fab),e.appendChild(this.root);let a$1=e.host;this.onDocumentClick=p=>{this.isOpen&&!p.composedPath().includes(a$1)&&this.close();},document.addEventListener("click",this.onDocumentClick);let l=p=>{p.key==="Escape"&&this.isOpen&&(p.stopPropagation(),this.close());};this.fab.addEventListener("keydown",l),this.radialContainer.addEventListener("keydown",l),this.radialContainer.addEventListener("keydown",p=>{let c=Array.from(this.radialContainer.querySelectorAll(".sp-radial-item"));if(c.length===0||!this.isOpen)return;let d=e.activeElement??document.activeElement,h=c.indexOf(d);switch(p.key){case "ArrowUp":{p.preventDefault();let f=h<=0?c.length-1:h-1;c[f]?.focus();break}case "ArrowDown":{p.preventDefault();let f=h>=c.length-1?0:h+1;c[f]?.focus();break}case "Home":{p.preventDefault(),c[0]?.focus();break}case "End":{p.preventDefault(),c[c.length-1]?.focus();break}}});}bus;t;root;fab;radialContainer;badgeEl=null;isOpen=false;annotationsVisible=true;items;onDocumentClick;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);c(this.badgeEl,n),this.badgeEl.setAttribute("aria-label",this.t("fab.badge").replace("{count}",String(e)));}toggle(){this.isOpen?this.close():this.open();}open(){this.isOpen=true,this.setFabIcon(k),this.fab.setAttribute("aria-expanded","true"),this.radialContainer.querySelectorAll(".sp-radial-item").forEach((n,o)=>{let i=-(16+an*(o+1));n.style.transform=`translate(0px, ${i}px) scale(1)`,n.classList.add("sp-radial-item--open");}),requestAnimationFrame(()=>{this.radialContainer.querySelector(".sp-radial-item")?.focus();});}close(){this.isOpen=false,this.setFabIcon(f),this.fab.setAttribute("aria-expanded","false"),this.radialContainer.querySelectorAll(".sp-radial-item").forEach(n=>{n.style.transform="translate(0, 0) scale(0.8)",n.classList.remove("sp-radial-item--open");}),this.fab.focus();}setFabIcon(e){let n=this.badgeEl;this.fab.replaceChildren(a(e)),n&&this.fab.appendChild(n);}handleItemClick(e){switch(this.close(),e){case "chat":this.bus.emit("panel:toggle",true);break;case "annotate":this.bus.emit("annotation:start");break;case "toggle-annotations":{this.annotationsVisible=!this.annotationsVisible,this.bus.emit("annotations:toggle",this.annotationsVisible);let n=this.radialContainer.querySelector('[data-item-id="toggle-annotations"]');n&&n.replaceChildren(a(this.annotationsVisible?i:j));break}}}destroy(){document.removeEventListener("click",this.onDocumentClick),this.root.remove();}};var St="siteping_identity";function Tt(){try{let t=localStorage.getItem(St);if(!t)return null;let e=JSON.parse(t);if(typeof e=="object"&&e!==null&&"name"in e&&typeof e.name=="string"&&"email"in e&&typeof e.email=="string"){let n=e;if(n.name&&n.email)return n}return null}catch{return null}}function Ct(t){try{localStorage.setItem(St,JSON.stringify(t));}catch{}}function ln(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,o=e.length,i=new Array(n+1);for(let s=0;s<=n;s++)i[s]=s;let r=new Array(n+1);for(let s=1;s<=o;s++){r[0]=s;for(let l=1;l<=n;l++){let p=i[l-1]??0;r[l]=t[l-1]===e[s-1]?p:1+Math.min(p,i[l]??0,r[l-1]??0);}let a=i;i=r,r=a;}return i[n]??0}function O(t,e){if(t===e)return 1;let n=Math.max(t.length,e.length);return n===0?1:1-ln(t,e)/n}function Ie(t,e,n=.6){if(!e||!t)return 0;if(t.includes(e))return 1;let o=e.length;if(o>t.length){let a=O(t,e);return a>=n?a:0}let i=0,r=t.length>500?t.slice(0,500):t,s=r.length-o;for(let a=0;a<=s;a++){let l=r.slice(a,a+o),p=O(l,e);if(p>i&&(i=p),i>=.95)break}return i>=n?i:0}var cn=300,pn=.3;function he(t,e){if(!e.textSnippet)return true;let n=(t.textContent?.trim()??"").slice(0,500);return Ie(n,e.textSnippet,.5)>pn}function dn(t){if(t.anchorKey){let e=t.anchorKey.replace(/\\/g,"\\\\").replace(/"/g,'\\"');try{let n=document.querySelector(`[${K}="${e}"]`);if(n&&he(n,t))return {element:n,confidence:1,strategy:"anchorKey"}}catch{}}if(t.elementId){let e=document.getElementById(t.elementId);if(e&&e.tagName===t.elementTag&&he(e,t))return {element:e,confidence:1,strategy:"id"}}try{let e=document.querySelector(t.cssSelector);if(e&&e.tagName===t.elementTag&&he(e,t))return {element:e,confidence:.95,strategy:"css"}}catch{}try{let n=document.evaluate(t.xpath,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;if(n instanceof Element&&n.tagName===t.elementTag&&he(n,t))return {element:n,confidence:.9,strategy:"xpath"}}catch{}return un(t)}function un(t){let e=t.elementTag.toLowerCase(),n=document.querySelectorAll(e);if(n.length===0)return null;let o=null,i=0,r=Math.min(n.length,cn);for(let s=0;s<r;s++){let a=n[s];if(!a)continue;let l=hn(a,t);if(l>i&&(i=l,o=a,i>=.85))break}return !o||i<.4?null:{element:o,confidence:Math.min(i,.85),strategy:"scan"}}function hn(t,e){let n=0,o=0,i=(t.textContent?.trim()??"").slice(0,500);if(e.textSnippet&&(o+=40,n+=Ie(i,e.textSnippet,.5)*40),e.fingerprint&&(o+=20,n+=ht(t,e.fingerprint)*20),e.textPrefix||e.textSuffix){o+=20;let r=0,s=0;if(e.textPrefix){let a=$(t,"before");r+=a?O(a,e.textPrefix):0,s++;}if(e.textSuffix){let a=$(t,"after");r+=a?O(a,e.textSuffix):0,s++;}s>0&&(n+=r/s*20);}if(e.neighborText){o+=20;let r=se(t);n+=r?O(r,e.neighborText)*20:0;}return o>0?n/o:0}function fe(t,e){let n=dn(t);if(!n)return null;let o=n.element.getBoundingClientRect(),i=new DOMRect(o.x+e.xPct*o.width,o.y+e.yPct*o.height,e.wPct*o.width,e.hPct*o.height);return {element:n.element,rect:i,confidence:n.confidence,strategy:n.strategy}}function De(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 me(t){return {xPct:t.xPct,yPct:t.yPct,wPct:t.wPct,hPct:t.hPct}}var At=13;function Pt(t){return {top:t.top+window.scrollY-At,left:t.right+window.scrollX-At}}function Q(t,e){let n=t.entries[e],o=t.elementIndices[e];if(!(!n||o===void 0))return n.elements[o]}var Rt=300,Ft=200,fn=.7,mn=28,Mt=32,ge=class{constructor(e,n,o,i,r=null){this.colors=e;this.tooltip=n;this.bus=o;this.t=i;this.liveRegion=r;this.container=b("div",{style:`position:absolute;top:0;left:0;pointer-events:none;z-index:${2147483646};`}),this.container.id="siteping-markers",document.body.appendChild(this.container),this.bus.on("annotations:toggle",s=>{this.container.style.display=s?"block":"none";}),this.resizeHandler=()=>this.scheduleReposition(),window.addEventListener("resize",this.resizeHandler,{passive:true}),this.scrollHandler=()=>this.scheduleReposition(),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();}),this.mutationObserver.observe(document.body,{childList:true,subtree:true,attributes:false,characterData:false}),this.onDocumentClickForClusters=s=>{this.container.contains(s.target)||this.collapseAllClusters();},document.addEventListener("click",this.onDocumentClickForClusters);}colors;tooltip;bus;t;liveRegion;container;entries=[];highlightElements=[];pinnedFeedback=null;onDocumentClick=null;repositionTimer=null;mutationObserver=null;scrollHandler=null;resizeHandler=null;anchorCache=new Map;clusters=[];onDocumentClickForClusters=null;get count(){return this.entries.length}scheduleReposition(){this.repositionTimer||("requestIdleCallback"in window?this.repositionTimer=window.requestIdleCallback(()=>{this.repositionTimer=null,this.repositionAll();},{timeout:Ft+100}):this.repositionTimer=+setTimeout(()=>{this.repositionTimer=null,this.repositionAll();},Ft));}repositionAll(){let e=new Set;for(let n of this.entries)for(let o=0;o<n.feedback.annotations.length;o++){let i=n.elements[o];if(!i)continue;let r=n.feedback.annotations[o];if(!r)continue;let s=`${n.feedback.id}:${o}`;e.add(s);let l=this.anchorCache.get(s)?.deref(),p;if(l?.isConnected){let d=l.getBoundingClientRect(),h=me(r);p={element:l,rect:new DOMRect(d.left+h.xPct*d.width,d.top+h.yPct*d.height,h.wPct*d.width,h.hPct*d.height),confidence:1,strategy:"css"};}else p=fe(De(r),me(r)),p?.element&&this.anchorCache.set(s,new WeakRef(p.element));if(!p){i.style.display="none";continue}let c=Pt(p.rect);n.baseTop=c.top,n.baseLeft=c.left,i.style.display="flex",this.applyConfidenceStyle(i,p.confidence,n.feedback);}for(let n of this.anchorCache.keys())e.has(n)||this.anchorCache.delete(n);this.applyClusterPositions(),this.pinnedFeedback&&this.showHighlight(this.pinnedFeedback);}applyClusterPositions(){for(let e of this.clusters)e.expanded?this.applyFanPositions(e):this.applyStackPositions(e);}render(e){this.clear(),e.forEach((n,o)=>{let i=this.buildEntry(n,o+1);this.entries.push(i);}),this.buildClusters(),this.liveRegion&&this.entries.length>0&&(this.liveRegion.textContent=this.t("marker.count").replace("{count}",String(this.entries.length)));}addFeedback(e,n){let o=this.buildEntry(e,n);for(let i of o.elements)i.style.animation="sp-marker-in 0.35s cubic-bezier(0.34,1.56,0.64,1) both";this.entries.push(o),this.buildClusters();}buildEntry(e,n){let o={feedback:e,elements:[],baseTop:0,baseLeft:0};for(let i of e.annotations){let r=fe(De(i),me(i));if(!r)continue;let s=Pt(r.rect);o.baseTop=s.top,o.baseLeft=s.left;let a=this.createMarker(n,e,s);this.applyConfidenceStyle(a,r.confidence,e),this.container.appendChild(a),o.elements.push(a);}return o}buildClusters(){for(let o of this.container.querySelectorAll(".sp-cluster-badge"))o.remove();let e=[];for(let o of this.entries)for(let i=0;i<o.elements.length;i++)e.push({entry:o,elIdx:i});let n=new Set;this.clusters=[];for(let o=0;o<e.length;o++){if(n.has(o))continue;let i=e[o];if(!i)continue;let r={entries:[i.entry],elementIndices:[i.elIdx],expanded:false};n.add(o);for(let s=o+1;s<e.length;s++){if(n.has(s))continue;let a=i.entry,l=e[s];if(!l)continue;let p=l.entry;Math.sqrt((a.baseLeft-p.baseLeft)**2+(a.baseTop-p.baseTop)**2)<mn&&(r.entries.push(p),r.elementIndices.push(l.elIdx),n.add(s));}this.clusters.push(r);}for(let o of this.clusters)o.entries.length<=1||(this.applyStackPositions(o),this.addClusterBadge(o));}applyStackPositions(e){let n=e.entries[0];if(!n)return;let{baseTop:o,baseLeft:i}=n,r=e.entries.length<=1;for(let s=0;s<e.entries.length;s++){let a=Q(e,s);a&&(a.style.top=`${o+(r?0:s*3)}px`,a.style.left=`${i+(r?0:s*3)}px`,a.style.zIndex=String(s+1));}}applyFanPositions(e){let n=e.entries[0];if(!n)return;let{baseTop:o,baseLeft:i}=n,r=e.entries.length,s=(r-1)*Mt,a=i-s/2;for(let l=0;l<r;l++){let p=Q(e,l);p&&(p.style.top=`${o}px`,p.style.left=`${a+l*Mt}px`,p.style.zIndex=String(10+l));}}addClusterBadge(e){let n=Q(e,e.entries.length-1);if(!n)return;let o=b("div",{class:"sp-cluster-badge",style:`
96
+ position:absolute;top:-6px;right:-6px;
97
+ min-width:16px;height:16px;padding:0 4px;
98
+ border-radius:9999px;
99
+ background:${this.colors.accent};color:#fff;
100
+ font-size:10px;font-weight:700;
101
+ display:flex;align-items:center;justify-content:center;
102
+ border:1.5px solid #fff;
103
+ pointer-events:none;
104
+ font-family:"Inter",system-ui,-apple-system,sans-serif;
105
+ line-height:1;
106
+ `});c(o,String(e.entries.length)),n.appendChild(o);}setBadgesVisible(e,n){for(let o=0;o<e.entries.length;o++){let i=Q(e,o)?.querySelector(".sp-cluster-badge");i&&(i.style.display=n?"flex":"none");}}findCluster(e){for(let n of this.clusters)if(!(n.entries.length<=1)){for(let o=0;o<n.entries.length;o++)if(Q(n,o)===e)return n}return null}handleClusterClick(e,n){let o=this.findCluster(e);return o?o.expanded?false:(n.stopPropagation(),this.collapseAllClusters(),o.expanded=true,this.applyFanPositions(o),this.setBadgesVisible(o,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,o){let i=o.status==="resolved";n<fn&&!i?(e.style.borderStyle="dashed",e.style.opacity="0.7",e.title=this.t("marker.approximate").replace("{confidence}",String(Math.round(n*100)))):(e.style.borderStyle="solid",e.style.opacity="1",e.title="");}createMarker(e,n,o){let i=x(n.type,this.colors),r=n.status==="resolved",s=b("div",{style:`
107
+ position:absolute;
108
+ top:${o.top}px;
109
+ left:${o.left}px;
110
+ width:26px;height:26px;
111
+ border-radius:50%;
112
+ background:${r?"rgba(241,245,249,0.9)":"rgba(255,255,255,0.92)"};
113
+ border:2px solid ${r?"#cbd5e1":i};
114
+ display:flex;align-items:center;justify-content:center;
115
+ font-family:"Inter",system-ui,-apple-system,sans-serif;
116
+ font-size:11px;font-weight:700;
117
+ color:${r?"#94a3b8":i};
118
+ cursor:pointer;pointer-events:auto;
119
+ box-shadow:${r?"0 2px 8px rgba(0,0,0,0.06)":`0 2px 12px ${i}25, 0 2px 6px rgba(0,0,0,0.06)`};
120
+ 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;
121
+ user-select:none;
122
+ -webkit-font-smoothing:antialiased;
123
+ `});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=this.t("marker.aria").replace("{number}",String(e)).replace("{type}",C(n.type,this.t)).replace("{message}",a);s.setAttribute("aria-label",l),s.setAttribute("aria-describedby",this.tooltip.tooltipId),c(s,r?"\u2713":String(e)),s.addEventListener("mouseenter",()=>{s.style.transform="scale(1.2)",s.style.boxShadow=r?"0 4px 16px rgba(0,0,0,0.1)":`0 4px 20px ${i}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 ${i}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 p=c=>{c instanceof MouseEvent&&this.handleClusterClick(s,c)||(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",c=>p(c)),s.addEventListener("keydown",c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),p(c));}),s}highlight(e){for(let n of this.entries)if(n.feedback.id===e)for(let o of n.elements)o.style.animation="sp-pulse-ring 0.7s ease-out",o.addEventListener("animationend",()=>{o.style.animation="";},{once:true});}showHighlight(e){this.removeHighlightElements();for(let n of e.annotations){let o=fe(De(n),me(n));if(!o)continue;let i=x(e.type,this.colors),r=o.rect,s=b("div",{style:`
124
+ position:absolute;
125
+ top:${r.top+window.scrollY}px;
126
+ left:${r.left+window.scrollX}px;
127
+ width:${r.width}px;height:${r.height}px;
128
+ border:2px solid ${i};
129
+ background:${i}0c;
130
+ border-radius:8px;
131
+ pointer-events:none;z-index:-1;
132
+ opacity:0;
133
+ box-shadow:0 0 16px ${i}20;
134
+ transition:opacity ${Rt}ms ease;
135
+ `});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(),Rt);this.highlightElements=[];}removeHighlightElements(){for(let e of this.highlightElements)e.remove();this.highlightElements=[];}clear(){this.unpinHighlight(),this.container.replaceChildren(),this.entries=[],this.clusters=[],this.anchorCache.clear();}destroy(){this.unpinHighlight(),this.repositionTimer&&("cancelIdleCallback"in window&&window.cancelIdleCallback(this.repositionTimer),clearTimeout(this.repositionTimer)),this.resizeHandler&&window.removeEventListener("resize",this.resizeHandler),this.scrollHandler&&window.removeEventListener("scroll",this.scrollHandler,{capture:true}),this.onDocumentClickForClusters&&document.removeEventListener("click",this.onDocumentClickForClusters),this.mutationObserver?.disconnect(),this.container.remove();}};var be=class{constructor(e,n){this.store=e;this.projectName=n;}store;projectName;async sendFeedback(e){let n=await this.store.createFeedback({projectName:e.projectName,type:e.type,message:e.message,status:"open",url:e.url,urlPattern:e.urlPattern??null,viewport:e.viewport,userAgent:e.userAgent,authorName:e.authorName,authorEmail:e.authorEmail,clientId:e.clientId,annotations:e.annotations.map(Me),screenshotDataUrl:e.screenshotDataUrl??null});return Le(n)}async getFeedbacks(e,n){let{feedbacks:o,total:i}=await this.store.getFeedbacks({projectName:e,page:n?.page,limit:n?.limit,type:n?.type,status:n?.status,search:n?.search,url:n?.url,urlPattern:n?.urlPattern});return {feedbacks:o.map(Le),total:i}}async resolveFeedback(e,n){let o=await this.store.updateFeedback(e,{status:n?"resolved":"open",resolvedAt:n?new Date:null});return Le(o)}async deleteFeedback(e){await this.store.deleteFeedback(e);}async deleteAllFeedbacks(e){await this.store.deleteAllFeedbacks(e);}};function Le(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(gn),screenshotUrl:t.screenshotUrl??null,diagnostics:t.diagnostics??null}}function gn(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 bn="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)",Ne="cubic-bezier(0.16, 1, 0.3, 1)",_e="cubic-bezier(0.34, 1.56, 0.64, 1)",yn="cubic-bezier(0.25, 1, 0.5, 1)",It=`
136
+ /* ---- Keyframes ---- */
137
+
138
+ @keyframes sp-fab-in {
139
+ from {
140
+ transform: scale(0) rotate(-180deg);
141
+ opacity: 0;
142
+ }
143
+ to {
144
+ transform: scale(1) rotate(0deg);
145
+ opacity: 1;
146
+ }
147
+ }
148
+
149
+ @keyframes sp-fab-glow {
150
+ 0%, 100% { box-shadow: 0 4px 20px var(--sp-accent-glow), 0 2px 8px rgba(0, 0, 0, 0.08); }
151
+ 50% { box-shadow: 0 4px 28px var(--sp-accent-glow), 0 2px 12px rgba(0, 0, 0, 0.1); }
152
+ }
153
+
154
+ @keyframes sp-marker-in {
155
+ 0% {
156
+ transform: scale(0);
157
+ opacity: 0;
158
+ }
159
+ 60% {
160
+ transform: scale(1.2);
161
+ opacity: 1;
162
+ }
163
+ 100% {
164
+ transform: scale(1);
165
+ }
166
+ }
167
+
168
+ @keyframes sp-pulse-ring {
169
+ 0% {
170
+ box-shadow: 0 0 0 0 var(--sp-accent-glow);
171
+ }
172
+ 70% {
173
+ box-shadow: 0 0 0 8px transparent;
174
+ }
175
+ 100% {
176
+ box-shadow: 0 0 0 0 transparent;
177
+ }
178
+ }
179
+
180
+ @keyframes sp-flash-bg {
181
+ 0% { background-color: var(--sp-accent-light); }
182
+ 100% { background-color: transparent; }
183
+ }
184
+
185
+ @keyframes sp-slide-up {
186
+ from {
187
+ transform: translateY(8px);
188
+ opacity: 0;
189
+ }
190
+ to {
191
+ transform: translateY(0);
192
+ opacity: 1;
193
+ }
194
+ }
195
+
196
+ @keyframes sp-fade-in {
197
+ from { opacity: 0; }
198
+ to { opacity: 1; }
199
+ }
200
+
201
+ @keyframes sp-shimmer {
202
+ 0% { background-position: -200% 0; }
203
+ 100% { background-position: 200% 0; }
204
+ }
205
+
206
+ /* ---- Animation classes ---- */
207
+
208
+ .sp-anim-fab-in {
209
+ animation: sp-fab-in 0.5s ${bn} both;
210
+ }
211
+
212
+ .sp-anim-marker-in {
213
+ animation: sp-marker-in 0.35s ${_e} both;
214
+ }
215
+
216
+ .sp-anim-pulse {
217
+ animation: sp-pulse-ring 0.7s ease-out;
218
+ }
219
+
220
+ .sp-anim-flash {
221
+ animation: sp-flash-bg 0.5s ${yn};
222
+ }
223
+
224
+ .sp-anim-slide-up {
225
+ animation: sp-slide-up 0.3s ${Ne} both;
226
+ }
227
+
228
+ .sp-anim-fade-in {
229
+ animation: sp-fade-in 0.2s ease-out both;
230
+ }
231
+
232
+ /* ---- Transition utilities ---- */
233
+
234
+ .sp-panel {
235
+ transform: translateX(110%);
236
+ transition: transform 0.4s ${Ne};
237
+ }
238
+
239
+ .sp-panel.sp-panel--open {
240
+ transform: translateX(0);
241
+ }
242
+
243
+ .sp-radial-item {
244
+ opacity: 0;
245
+ pointer-events: none;
246
+ transform: translate(0, 0) scale(0.8);
247
+ transition:
248
+ transform 0.35s ${_e},
249
+ opacity 0.2s ease,
250
+ background 0.2s ease,
251
+ border-color 0.2s ease,
252
+ box-shadow 0.2s ease;
253
+ }
254
+
255
+ .sp-radial-item.sp-radial-item--open {
256
+ opacity: 1;
257
+ pointer-events: auto;
258
+ }
259
+
260
+ /* Stagger delay via CSS custom property --sp-i */
261
+ .sp-radial-item {
262
+ transition-delay: calc(var(--sp-i, 0) * 50ms);
263
+ }
264
+
265
+ /* ---- Card stagger animation ---- */
266
+
267
+ @keyframes sp-card-in {
268
+ from {
269
+ transform: translateY(12px);
270
+ opacity: 0;
271
+ }
272
+ to {
273
+ transform: translateY(0);
274
+ opacity: 1;
275
+ }
276
+ }
277
+
278
+ .sp-card {
279
+ animation: sp-card-in 0.35s ${Ne} both;
280
+ animation-delay: calc(var(--sp-card-i, 0) * 40ms);
281
+ }
282
+
283
+ /* ---- Loading spinner ---- */
284
+
285
+ @keyframes sp-spin {
286
+ to { transform: rotate(360deg); }
287
+ }
288
+
289
+ .sp-spinner {
290
+ width: 20px;
291
+ height: 20px;
292
+ border: 2px solid var(--sp-border);
293
+ border-top-color: var(--sp-accent);
294
+ border-radius: 50%;
295
+ animation: sp-spin 0.6s linear infinite;
296
+ }
297
+
298
+ /* ---- Badge bounce ---- */
299
+
300
+ @keyframes sp-badge-in {
301
+ 0% { transform: scale(0); }
302
+ 60% { transform: scale(1.3); }
303
+ 100% { transform: scale(1); }
304
+ }
305
+
306
+ .sp-fab-badge {
307
+ animation: sp-badge-in 0.4s ${_e} both;
308
+ }
309
+
310
+ /* ---- Reduced motion ---- */
311
+
312
+ @media (prefers-reduced-motion: reduce) {
313
+ *, *::before, *::after {
314
+ animation-duration: 0.01ms !important;
315
+ animation-iteration-count: 1 !important;
316
+ transition-duration: 0.01ms !important;
317
+ }
318
+ }
319
+
320
+ `;function $e(t){return `
321
+ :host {
322
+ all: initial;
323
+ position: fixed;
324
+ z-index: ${2147483647};
325
+ font-family: var(--sp-font);
326
+ font-size: 14px;
327
+ line-height: 1.5;
328
+ color: var(--sp-text);
329
+ -webkit-font-smoothing: antialiased;
330
+ -moz-osx-font-smoothing: grayscale;
331
+ ${z(t)}
332
+
333
+ /* Identity modal \u2014 theme-aware backdrop + panel */
334
+ --sp-identity-bg: ${t.glassBgHeavy};
335
+ --sp-identity-overlay: ${t.bg==="#ffffff"?"rgba(15, 23, 42, 0.2)":"rgba(0, 0, 0, 0.4)"};
336
+ }
337
+
338
+ *, *::before, *::after {
339
+ box-sizing: border-box;
340
+ margin: 0;
341
+ padding: 0;
342
+ }
343
+
344
+ /* ============================
345
+ Focus visible (accessibility)
346
+ ============================ */
347
+
348
+ :focus-visible {
349
+ outline: 2px solid var(--sp-accent);
350
+ outline-offset: 2px;
351
+ /* Double-ring against any background colour: the bg-coloured halo
352
+ separates the accent ring from busy host-page surfaces. */
353
+ box-shadow: 0 0 0 4px var(--sp-bg);
354
+ }
355
+
356
+ /* ============================
357
+ FAB (Floating Action Button)
358
+ ============================ */
359
+
360
+ .sp-fab {
361
+ position: fixed;
362
+ width: 52px;
363
+ height: 52px;
364
+ border-radius: var(--sp-radius-full);
365
+ background: var(--sp-accent-gradient);
366
+ color: #fff;
367
+ border: none;
368
+ cursor: pointer;
369
+ display: flex;
370
+ align-items: center;
371
+ justify-content: center;
372
+ box-shadow:
373
+ 0 4px 20px var(--sp-accent-glow),
374
+ 0 2px 8px rgba(0, 0, 0, 0.08);
375
+ transition:
376
+ transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
377
+ box-shadow 0.3s ease;
378
+ outline: none;
379
+ }
380
+
381
+ .sp-fab:focus-visible {
382
+ outline: 2px solid #fff;
383
+ outline-offset: 3px;
384
+ }
385
+
386
+ .sp-fab:hover {
387
+ transform: translateY(-2px) scale(1.05);
388
+ box-shadow:
389
+ 0 8px 28px var(--sp-accent-glow),
390
+ 0 4px 12px rgba(0, 0, 0, 0.1);
391
+ }
392
+
393
+ .sp-fab:active {
394
+ transform: translateY(0) scale(0.95);
395
+ transition-duration: 0.1s;
396
+ }
397
+
398
+ .sp-fab--bottom-right {
399
+ bottom: 24px;
400
+ right: 24px;
401
+ }
402
+
403
+ .sp-fab--bottom-left {
404
+ bottom: 24px;
405
+ left: 24px;
406
+ }
407
+
408
+ .sp-fab svg {
409
+ width: 22px;
410
+ height: 22px;
411
+ fill: currentColor;
412
+ transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
413
+ }
414
+
415
+ /* ---- FAB Badge ---- */
416
+
417
+ .sp-fab-badge {
418
+ position: absolute;
419
+ top: -4px;
420
+ right: -4px;
421
+ min-width: 20px;
422
+ height: 20px;
423
+ padding: 0 6px;
424
+ border-radius: var(--sp-radius-full);
425
+ background: #ef4444;
426
+ color: #fff;
427
+ font-size: 11px;
428
+ font-weight: 700;
429
+ display: flex;
430
+ align-items: center;
431
+ justify-content: center;
432
+ border: 2px solid #fff;
433
+ pointer-events: none;
434
+ font-family: var(--sp-font);
435
+ line-height: 1;
436
+ }
437
+
438
+ /* ============================
439
+ Radial Menu
440
+ ============================ */
441
+
442
+ .sp-radial {
443
+ position: fixed;
444
+ pointer-events: none;
445
+ width: 52px;
446
+ height: 52px;
447
+ }
448
+
449
+ .sp-radial--bottom-right {
450
+ bottom: 24px;
451
+ right: 24px;
452
+ }
453
+
454
+ .sp-radial--bottom-left {
455
+ bottom: 24px;
456
+ left: 24px;
457
+ }
458
+
459
+ .sp-radial-item {
460
+ position: absolute;
461
+ left: 4px;
462
+ bottom: 4px;
463
+ width: 44px;
464
+ height: 44px;
465
+ border-radius: var(--sp-radius-full);
466
+ background: var(--sp-glass-bg-heavy);
467
+ backdrop-filter: blur(var(--sp-blur));
468
+ -webkit-backdrop-filter: blur(var(--sp-blur));
469
+ color: var(--sp-text);
470
+ border: 1px solid var(--sp-glass-border);
471
+ cursor: pointer;
472
+ display: flex;
473
+ align-items: center;
474
+ justify-content: center;
475
+ box-shadow: var(--sp-shadow-md);
476
+ font-size: 12px;
477
+ font-weight: 600;
478
+ }
479
+
480
+ .sp-radial-item:hover,
481
+ .sp-radial-item:focus-visible {
482
+ background: rgba(255, 255, 255, 0.95);
483
+ border-color: var(--sp-accent);
484
+ color: var(--sp-accent);
485
+ box-shadow:
486
+ var(--sp-shadow-md),
487
+ 0 0 0 3px var(--sp-accent-light);
488
+ outline: none;
489
+ }
490
+
491
+ .sp-radial-item svg {
492
+ width: 18px;
493
+ height: 18px;
494
+ flex-shrink: 0;
495
+ stroke: currentColor;
496
+ fill: none;
497
+ }
498
+
499
+ .sp-radial-label {
500
+ white-space: nowrap;
501
+ font-size: 12px;
502
+ font-weight: 500;
503
+ color: var(--sp-text);
504
+ pointer-events: none;
505
+ opacity: 0;
506
+ padding: 4px 12px;
507
+ border-radius: var(--sp-radius);
508
+ background: var(--sp-glass-bg-heavy);
509
+ backdrop-filter: blur(12px);
510
+ -webkit-backdrop-filter: blur(12px);
511
+ border: 1px solid var(--sp-glass-border);
512
+ box-shadow: var(--sp-shadow-sm);
513
+ transform: translateX(4px);
514
+ transition: opacity 0.2s ease, transform 0.2s ease;
515
+ }
516
+
517
+ .sp-radial-item:hover .sp-radial-label,
518
+ .sp-radial-item:focus-visible .sp-radial-label {
519
+ opacity: 1;
520
+ transform: translateX(0);
521
+ }
522
+
523
+ /* ============================
524
+ Panel (Side drawer)
525
+ ============================ */
526
+
527
+ .sp-panel {
528
+ position: fixed;
529
+ top: 0;
530
+ right: 0;
531
+ width: 400px;
532
+ max-width: 100vw;
533
+ height: 100vh;
534
+ height: 100dvh;
535
+ background: var(--sp-glass-bg);
536
+ backdrop-filter: blur(var(--sp-blur-heavy));
537
+ -webkit-backdrop-filter: blur(var(--sp-blur-heavy));
538
+ border-left: 1px solid var(--sp-glass-border);
539
+ box-shadow: var(--sp-shadow-xl);
540
+ display: flex;
541
+ flex-direction: column;
542
+ overflow: hidden;
543
+ }
544
+
545
+ @media (max-width: 480px) {
546
+ .sp-panel {
547
+ width: 100vw;
548
+ border-left: none;
549
+ }
550
+ }
551
+
552
+ .sp-panel-header {
553
+ display: flex;
554
+ align-items: center;
555
+ justify-content: space-between;
556
+ padding: 20px 24px;
557
+ border-bottom: 1px solid var(--sp-border);
558
+ background: var(--sp-glass-bg-heavy);
559
+ backdrop-filter: blur(var(--sp-blur));
560
+ -webkit-backdrop-filter: blur(var(--sp-blur));
561
+ position: relative;
562
+ z-index: 2;
563
+ }
564
+
565
+ .sp-panel-title {
566
+ font-size: 17px;
567
+ font-weight: 700;
568
+ color: var(--sp-text);
569
+ letter-spacing: -0.02em;
570
+ }
571
+
572
+ .sp-panel-close {
573
+ width: 44px;
574
+ height: 44px;
575
+ border-radius: var(--sp-radius);
576
+ border: none;
577
+ background: transparent;
578
+ cursor: pointer;
579
+ display: flex;
580
+ align-items: center;
581
+ justify-content: center;
582
+ color: var(--sp-text-tertiary);
583
+ transition: all 0.2s ease;
584
+ }
585
+
586
+ .sp-panel-close:hover {
587
+ background: var(--sp-bg-hover);
588
+ color: var(--sp-text);
589
+ }
590
+
591
+ .sp-panel-close svg {
592
+ width: 16px;
593
+ height: 16px;
594
+ }
595
+
596
+ /* ============================
597
+ Filters & Search
598
+ ============================ */
599
+
600
+ .sp-filters {
601
+ padding: 16px 24px;
602
+ border-bottom: 1px solid var(--sp-border);
603
+ background: var(--sp-glass-bg-heavy);
604
+ backdrop-filter: blur(var(--sp-blur));
605
+ -webkit-backdrop-filter: blur(var(--sp-blur));
606
+ position: sticky;
607
+ top: 0;
608
+ z-index: 1;
609
+ }
610
+
611
+ .sp-search-wrap {
612
+ position: relative;
613
+ margin-bottom: 12px;
614
+ }
615
+
616
+ .sp-search {
617
+ width: 100%;
618
+ height: 40px;
619
+ padding: 0 12px 0 38px;
620
+ border-radius: var(--sp-radius);
621
+ border: 1px solid var(--sp-border);
622
+ background: var(--sp-glass-bg-heavy);
623
+ color: var(--sp-text);
624
+ font-family: var(--sp-font);
625
+ font-size: 13px;
626
+ outline: none;
627
+ transition: all 0.2s ease;
628
+ }
629
+
630
+ .sp-search::placeholder {
631
+ color: var(--sp-text-tertiary);
632
+ }
633
+
634
+ .sp-search:focus {
635
+ border-color: var(--sp-accent);
636
+ box-shadow: 0 0 0 3px var(--sp-accent-light);
637
+ background: #fff;
638
+ }
639
+
640
+ .sp-search-icon {
641
+ position: absolute;
642
+ left: 12px;
643
+ top: 50%;
644
+ transform: translateY(-50%);
645
+ color: var(--sp-text-tertiary);
646
+ width: 16px;
647
+ height: 16px;
648
+ transition: color 0.2s ease;
649
+ }
650
+
651
+ .sp-search:focus ~ .sp-search-icon,
652
+ .sp-search-wrap:focus-within .sp-search-icon {
653
+ color: var(--sp-accent);
654
+ }
655
+
656
+ /* ============================
657
+ Filter bar (type dropdown + status segmented)
658
+ ============================ */
659
+
660
+ .sp-filter-bar {
661
+ display: flex;
662
+ align-items: center;
663
+ gap: 8px;
664
+ margin-bottom: 8px;
665
+ flex-wrap: wrap;
666
+ }
667
+
668
+ /* ============================
669
+ Type filter dropdown
670
+ ============================ */
671
+
672
+ .sp-filter-dropdown {
673
+ position: relative;
674
+ flex: 1 1 auto;
675
+ min-width: 0;
676
+ }
677
+
678
+ .sp-filter-dropdown-btn {
679
+ --sp-chip-color: var(--sp-text-secondary);
680
+ --sp-chip-bg: var(--sp-glass-bg-heavy);
681
+
682
+ display: inline-flex;
683
+ align-items: center;
684
+ gap: 8px;
685
+ width: 100%;
686
+ height: 32px;
687
+ padding: 0 8px 0 10px;
688
+ border-radius: var(--sp-radius-full);
689
+ border: 1px solid var(--sp-border);
690
+ background: var(--sp-glass-bg-heavy);
691
+ color: var(--sp-text);
692
+ font-family: var(--sp-font);
693
+ font-size: 12px;
694
+ font-weight: 500;
695
+ cursor: pointer;
696
+ white-space: nowrap;
697
+ transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
698
+ }
699
+
700
+ .sp-filter-dropdown-btn:hover {
701
+ border-color: var(--sp-chip-color);
702
+ background: var(--sp-chip-bg);
703
+ }
704
+
705
+ .sp-filter-dropdown-btn[aria-expanded="true"] {
706
+ border-color: var(--sp-chip-color);
707
+ background: var(--sp-chip-bg);
708
+ box-shadow: 0 0 0 3px color-mix(in srgb, var(--sp-chip-color) 14%, transparent);
709
+ }
710
+
711
+ .sp-filter-dropdown-btn--filtered {
712
+ border-color: var(--sp-chip-color);
713
+ background: var(--sp-chip-bg);
714
+ }
715
+
716
+ .sp-filter-dropdown-btn__icon {
717
+ display: inline-flex;
718
+ align-items: center;
719
+ justify-content: center;
720
+ width: 18px;
721
+ height: 18px;
722
+ flex-shrink: 0;
723
+ color: var(--sp-chip-color);
724
+ }
725
+
726
+ .sp-filter-dropdown-btn__icon svg {
727
+ width: 14px;
728
+ height: 14px;
729
+ }
730
+
731
+ .sp-filter-dropdown-btn__label {
732
+ display: inline-flex;
733
+ align-items: baseline;
734
+ gap: 6px;
735
+ flex: 1;
736
+ min-width: 0;
737
+ overflow: hidden;
738
+ }
739
+
740
+ .sp-filter-dropdown-btn__prefix {
741
+ color: var(--sp-text-tertiary);
742
+ font-weight: 500;
743
+ font-size: 11px;
744
+ text-transform: uppercase;
745
+ letter-spacing: 0.06em;
746
+ }
747
+
748
+ .sp-filter-dropdown-btn__value {
749
+ color: var(--sp-chip-color);
750
+ font-weight: 600;
751
+ overflow: hidden;
752
+ text-overflow: ellipsis;
753
+ }
754
+
755
+ .sp-filter-dropdown-btn__chevron {
756
+ display: inline-flex;
757
+ align-items: center;
758
+ justify-content: center;
759
+ width: 14px;
760
+ height: 14px;
761
+ flex-shrink: 0;
762
+ color: var(--sp-text-tertiary);
763
+ transition: transform 0.18s ease, color 0.18s ease;
764
+ }
765
+
766
+ .sp-filter-dropdown-btn__chevron svg {
767
+ width: 12px;
768
+ height: 12px;
769
+ }
770
+
771
+ .sp-filter-dropdown-btn[aria-expanded="true"] .sp-filter-dropdown-btn__chevron {
772
+ transform: rotate(180deg);
773
+ color: var(--sp-chip-color);
774
+ }
775
+
776
+ .sp-filter-dropdown-menu {
777
+ position: absolute;
778
+ top: calc(100% + 6px);
779
+ left: 0;
780
+ right: 0;
781
+ min-width: 180px;
782
+ padding: 4px;
783
+ border-radius: var(--sp-radius);
784
+ background: var(--sp-glass-bg-heavy);
785
+ backdrop-filter: blur(var(--sp-blur-heavy));
786
+ -webkit-backdrop-filter: blur(var(--sp-blur-heavy));
787
+ border: 1px solid var(--sp-glass-border);
788
+ box-shadow: var(--sp-shadow-md);
789
+ z-index: 10;
790
+ animation: sp-filter-menu-in 0.15s ease-out both;
791
+ }
792
+
793
+ @keyframes sp-filter-menu-in {
794
+ from { opacity: 0; transform: translateY(-4px) scale(0.98); }
795
+ to { opacity: 1; transform: translateY(0) scale(1); }
796
+ }
797
+
798
+ .sp-filter-dropdown-option {
799
+ --sp-chip-color: var(--sp-text-secondary);
800
+ --sp-chip-bg: transparent;
801
+
802
+ display: flex;
803
+ align-items: center;
804
+ gap: 10px;
805
+ width: 100%;
806
+ padding: 8px 10px;
807
+ border: none;
808
+ border-radius: 8px;
809
+ background: transparent;
810
+ color: var(--sp-text);
811
+ font-family: var(--sp-font);
812
+ font-size: 12px;
813
+ font-weight: 500;
814
+ cursor: pointer;
815
+ text-align: left;
816
+ transition: background 0.12s ease, color 0.12s ease;
817
+ }
818
+
819
+ .sp-filter-dropdown-option__icon {
820
+ display: inline-flex;
821
+ align-items: center;
822
+ justify-content: center;
823
+ width: 22px;
824
+ height: 22px;
825
+ flex-shrink: 0;
826
+ border-radius: 6px;
827
+ background: var(--sp-chip-bg);
828
+ color: var(--sp-chip-color);
829
+ }
830
+
831
+ .sp-filter-dropdown-option__icon svg {
832
+ width: 13px;
833
+ height: 13px;
834
+ }
835
+
836
+ .sp-filter-dropdown-option__label {
837
+ flex: 1;
838
+ min-width: 0;
839
+ }
840
+
841
+ .sp-filter-dropdown-option__check {
842
+ display: inline-flex;
843
+ align-items: center;
844
+ justify-content: center;
845
+ width: 14px;
846
+ height: 14px;
847
+ flex-shrink: 0;
848
+ color: var(--sp-chip-color);
849
+ }
850
+
851
+ .sp-filter-dropdown-option__check svg {
852
+ width: 13px;
853
+ height: 13px;
854
+ }
855
+
856
+ .sp-filter-dropdown-option:hover {
857
+ background: var(--sp-bg-hover);
858
+ }
859
+
860
+ .sp-filter-dropdown-option--active {
861
+ color: var(--sp-chip-color);
862
+ font-weight: 600;
863
+ }
864
+
865
+ .sp-filter-dropdown-option--active:hover {
866
+ background: var(--sp-chip-bg);
867
+ }
868
+
869
+ /* ============================
870
+ Status segmented control
871
+ ============================ */
872
+
873
+ .sp-segmented {
874
+ display: inline-flex;
875
+ align-items: stretch;
876
+ padding: 2px;
877
+ border-radius: var(--sp-radius-full);
878
+ border: 1px solid var(--sp-border);
879
+ background: var(--sp-glass-bg-heavy);
880
+ flex-shrink: 0;
881
+ }
882
+
883
+ .sp-segmented__btn {
884
+ --sp-chip-color: var(--sp-text-tertiary);
885
+ --sp-chip-bg: transparent;
886
+
887
+ display: inline-flex;
888
+ align-items: center;
889
+ gap: 5px;
890
+ height: 26px;
891
+ padding: 0 10px;
892
+ border: none;
893
+ border-radius: var(--sp-radius-full);
894
+ background: transparent;
895
+ color: var(--sp-text-secondary);
896
+ font-family: var(--sp-font);
897
+ font-size: 12px;
898
+ font-weight: 500;
899
+ cursor: pointer;
900
+ white-space: nowrap;
901
+ transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
902
+ }
903
+
904
+ .sp-segmented__icon {
905
+ display: inline-flex;
906
+ align-items: center;
907
+ justify-content: center;
908
+ width: 13px;
909
+ height: 13px;
910
+ flex-shrink: 0;
911
+ color: var(--sp-chip-color);
912
+ transition: color 0.18s ease, transform 0.18s ease;
913
+ }
914
+
915
+ .sp-segmented__icon svg {
916
+ width: 13px;
917
+ height: 13px;
918
+ }
919
+
920
+ .sp-segmented__btn:hover {
921
+ color: var(--sp-chip-color);
922
+ }
923
+
924
+ .sp-segmented__btn:hover .sp-segmented__icon {
925
+ color: var(--sp-chip-color);
926
+ }
927
+
928
+ .sp-segmented__btn--active {
929
+ background: var(--sp-chip-bg);
930
+ color: var(--sp-chip-color);
931
+ font-weight: 600;
932
+ box-shadow:
933
+ inset 0 0 0 1px color-mix(in srgb, var(--sp-chip-color) 35%, transparent),
934
+ 0 1px 2px rgba(0, 0, 0, 0.04);
935
+ }
936
+
937
+ .sp-segmented__btn--active .sp-segmented__icon {
938
+ color: var(--sp-chip-color);
939
+ }
940
+
941
+ .sp-segmented__btn--open.sp-segmented__btn--active .sp-segmented__icon {
942
+ animation: sp-segmented-pulse 2.4s ease-in-out infinite;
943
+ }
944
+
945
+ @keyframes sp-segmented-pulse {
946
+ 0%, 100% { transform: scale(1); }
947
+ 50% { transform: scale(0.85); }
948
+ }
949
+
950
+ @media (prefers-reduced-motion: reduce) {
951
+ .sp-filter-dropdown-btn,
952
+ .sp-filter-dropdown-btn__chevron,
953
+ .sp-filter-dropdown-option,
954
+ .sp-segmented__btn,
955
+ .sp-segmented__icon {
956
+ transition: none;
957
+ }
958
+ .sp-filter-dropdown-menu {
959
+ animation: none;
960
+ }
961
+ .sp-segmented__btn--open.sp-segmented__btn--active .sp-segmented__icon {
962
+ animation: none;
963
+ }
964
+ }
965
+
966
+ /* ============================
967
+ Feedback Cards
968
+ ============================ */
969
+
970
+ .sp-list {
971
+ flex: 1;
972
+ overflow-y: auto;
973
+ padding: 8px 12px;
974
+ }
975
+
976
+ .sp-list::-webkit-scrollbar {
977
+ width: 6px;
978
+ }
979
+
980
+ .sp-list::-webkit-scrollbar-track {
981
+ background: transparent;
982
+ }
983
+
984
+ .sp-list::-webkit-scrollbar-thumb {
985
+ background: var(--sp-border);
986
+ border-radius: var(--sp-radius-full);
987
+ }
988
+
989
+ .sp-list::-webkit-scrollbar-thumb:hover {
990
+ background: var(--sp-text-tertiary);
991
+ }
992
+
993
+ .sp-card {
994
+ display: flex;
995
+ padding: 14px 16px;
996
+ margin-bottom: 6px;
997
+ cursor: pointer;
998
+ border-radius: var(--sp-radius);
999
+ background: var(--sp-glass-bg-heavy);
1000
+ border: 1px solid var(--sp-glass-border);
1001
+ box-shadow: var(--sp-shadow-xs);
1002
+ transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
1003
+ }
1004
+
1005
+ .sp-card:hover {
1006
+ background: #fff;
1007
+ border-color: var(--sp-border);
1008
+ box-shadow: var(--sp-shadow-md);
1009
+ transform: translateY(-2px);
1010
+ }
1011
+
1012
+ .sp-card:active {
1013
+ transform: translateY(0) scale(0.99);
1014
+ transition-duration: 0.1s;
1015
+ }
1016
+
1017
+ .sp-card-bar {
1018
+ width: 3px;
1019
+ border-radius: var(--sp-radius-full);
1020
+ margin-right: 14px;
1021
+ flex-shrink: 0;
1022
+ }
1023
+
1024
+ .sp-card-body {
1025
+ flex: 1;
1026
+ min-width: 0;
1027
+ }
1028
+
1029
+ .sp-card-header {
1030
+ display: flex;
1031
+ align-items: center;
1032
+ gap: 8px;
1033
+ margin-bottom: 6px;
1034
+ }
1035
+
1036
+ .sp-card-number {
1037
+ font-size: 12px;
1038
+ font-weight: 700;
1039
+ color: var(--sp-text-tertiary);
1040
+ font-variant-numeric: tabular-nums;
1041
+ }
1042
+
1043
+ .sp-badge {
1044
+ padding: 2px 10px;
1045
+ border-radius: var(--sp-radius-full);
1046
+ font-size: 11px;
1047
+ font-weight: 600;
1048
+ letter-spacing: 0.02em;
1049
+ }
1050
+
1051
+ .sp-card-date {
1052
+ font-size: 11px;
1053
+ color: var(--sp-text-tertiary);
1054
+ margin-left: auto;
1055
+ }
1056
+
1057
+ .sp-card-message {
1058
+ font-size: 13px;
1059
+ line-height: 1.5;
1060
+ color: var(--sp-text);
1061
+ display: -webkit-box;
1062
+ -webkit-line-clamp: 3;
1063
+ -webkit-box-orient: vertical;
1064
+ overflow: hidden;
1065
+ }
1066
+
1067
+ .sp-card-message--expanded {
1068
+ -webkit-line-clamp: unset;
1069
+ }
1070
+
1071
+ .sp-card-expand {
1072
+ font-size: 12px;
1073
+ font-weight: 500;
1074
+ color: var(--sp-accent);
1075
+ cursor: pointer;
1076
+ background: none;
1077
+ border: none;
1078
+ padding: 4px 0;
1079
+ font-family: var(--sp-font);
1080
+ transition: opacity 0.15s ease;
1081
+ }
1082
+
1083
+ .sp-card-expand:hover {
1084
+ opacity: 0.8;
1085
+ }
1086
+
1087
+ .sp-card-footer {
1088
+ display: flex;
1089
+ align-items: center;
1090
+ justify-content: flex-end;
1091
+ gap: 6px;
1092
+ margin-top: 10px;
1093
+ }
1094
+
1095
+ .sp-btn-resolve,
1096
+ .sp-btn-delete {
1097
+ padding: 8px 14px;
1098
+ border-radius: var(--sp-radius-full);
1099
+ border: 1px solid var(--sp-border);
1100
+ background: transparent;
1101
+ color: var(--sp-text-secondary);
1102
+ font-family: var(--sp-font);
1103
+ font-size: 12px;
1104
+ font-weight: 500;
1105
+ cursor: pointer;
1106
+ display: flex;
1107
+ align-items: center;
1108
+ gap: 4px;
1109
+ transition: all 0.2s ease;
1110
+ }
1111
+
1112
+ .sp-btn-resolve svg,
1113
+ .sp-btn-delete svg {
1114
+ width: 14px;
1115
+ height: 14px;
1116
+ }
1117
+
1118
+ .sp-btn-resolve:hover {
1119
+ border-color: #22c55e;
1120
+ color: #22c55e;
1121
+ background: rgba(34, 197, 94, 0.06);
1122
+ }
1123
+
1124
+ .sp-btn-delete:hover {
1125
+ border-color: #ef4444;
1126
+ color: #ef4444;
1127
+ background: rgba(239, 68, 68, 0.06);
1128
+ }
1129
+
1130
+ .sp-btn-resolve:disabled,
1131
+ .sp-btn-delete:disabled {
1132
+ opacity: 0.5;
1133
+ cursor: not-allowed;
1134
+ pointer-events: none;
1135
+ }
1136
+
1137
+ .sp-spinner--sm {
1138
+ width: 14px;
1139
+ height: 14px;
1140
+ }
1141
+
1142
+ /* ---- Delete All (header) ---- */
1143
+
1144
+ .sp-panel-header-right {
1145
+ display: flex;
1146
+ align-items: center;
1147
+ gap: 8px;
1148
+ }
1149
+
1150
+ .sp-btn-delete-all {
1151
+ padding: 5px 12px;
1152
+ border-radius: var(--sp-radius-full);
1153
+ border: 1px solid var(--sp-border);
1154
+ background: transparent;
1155
+ color: var(--sp-text-tertiary);
1156
+ font-family: var(--sp-font);
1157
+ font-size: 11px;
1158
+ font-weight: 500;
1159
+ cursor: pointer;
1160
+ display: flex;
1161
+ align-items: center;
1162
+ gap: 4px;
1163
+ transition: all 0.2s ease;
1164
+ }
1165
+
1166
+ .sp-btn-delete-all svg {
1167
+ width: 13px;
1168
+ height: 13px;
1169
+ }
1170
+
1171
+ .sp-btn-delete-all:hover {
1172
+ border-color: #ef4444;
1173
+ color: #ef4444;
1174
+ background: rgba(239, 68, 68, 0.06);
1175
+ }
1176
+
1177
+ .sp-btn-delete-all:disabled {
1178
+ opacity: 0.5;
1179
+ cursor: not-allowed;
1180
+ pointer-events: none;
1181
+ }
1182
+
1183
+ /* ---- Confirm Dialog ---- */
1184
+
1185
+ .sp-confirm-backdrop {
1186
+ position: fixed;
1187
+ inset: 0;
1188
+ background: var(--sp-backdrop, rgba(15, 23, 42, 0.2));
1189
+ backdrop-filter: blur(var(--sp-blur));
1190
+ -webkit-backdrop-filter: blur(var(--sp-blur));
1191
+ display: flex;
1192
+ align-items: center;
1193
+ justify-content: center;
1194
+ z-index: ${2147483647};
1195
+ opacity: 0;
1196
+ transition: opacity 0.2s ease;
1197
+ }
1198
+
1199
+ .sp-confirm-dialog {
1200
+ width: 340px;
1201
+ padding: 28px;
1202
+ border-radius: 20px;
1203
+ background: var(--sp-glass-bg-heavy);
1204
+ backdrop-filter: blur(var(--sp-blur-heavy));
1205
+ -webkit-backdrop-filter: blur(var(--sp-blur-heavy));
1206
+ border: 1px solid var(--sp-glass-border);
1207
+ box-shadow: var(--sp-shadow-xl);
1208
+ font-family: var(--sp-font);
1209
+ transform: translateY(8px) scale(0.97);
1210
+ transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
1211
+ }
1212
+
1213
+ .sp-confirm-title {
1214
+ font-size: 17px;
1215
+ font-weight: 700;
1216
+ color: var(--sp-text);
1217
+ letter-spacing: -0.02em;
1218
+ margin-bottom: 8px;
1219
+ }
1220
+
1221
+ .sp-confirm-message {
1222
+ font-size: 14px;
1223
+ color: var(--sp-text-secondary);
1224
+ line-height: 1.5;
1225
+ margin-bottom: 20px;
1226
+ }
1227
+
1228
+ .sp-confirm-actions {
1229
+ display: flex;
1230
+ gap: 8px;
1231
+ justify-content: flex-end;
1232
+ }
1233
+
1234
+ .sp-btn-danger {
1235
+ height: 40px;
1236
+ padding: 0 22px;
1237
+ border-radius: var(--sp-radius);
1238
+ border: none;
1239
+ background: #ef4444;
1240
+ color: #fff;
1241
+ font-family: var(--sp-font);
1242
+ font-size: 14px;
1243
+ font-weight: 600;
1244
+ cursor: pointer;
1245
+ transition: all 0.2s ease;
1246
+ box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
1247
+ }
1248
+
1249
+ .sp-btn-danger:hover {
1250
+ background: #dc2626;
1251
+ box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
1252
+ transform: translateY(-1px);
1253
+ }
1254
+
1255
+ .sp-btn-danger:active {
1256
+ transform: translateY(0) scale(0.98);
1257
+ transition-duration: 0.1s;
1258
+ }
1259
+
1260
+ .sp-card--resolved {
1261
+ opacity: 0.5;
1262
+ }
1263
+
1264
+ .sp-card--resolved .sp-card-message {
1265
+ text-decoration: line-through;
1266
+ text-decoration-color: var(--sp-text-tertiary);
1267
+ }
1268
+
1269
+ /* ============================
1270
+ Loading State
1271
+ ============================ */
1272
+
1273
+ .sp-loading {
1274
+ display: flex;
1275
+ align-items: center;
1276
+ justify-content: center;
1277
+ padding: 48px 24px;
1278
+ }
1279
+
1280
+ /* ============================
1281
+ Identity Form
1282
+ ============================ */
1283
+
1284
+ .sp-identity-title {
1285
+ font-size: 17px;
1286
+ font-weight: 700;
1287
+ color: var(--sp-text);
1288
+ letter-spacing: -0.02em;
1289
+ }
1290
+
1291
+ .sp-input {
1292
+ width: 100%;
1293
+ height: 42px;
1294
+ padding: 0 14px;
1295
+ border-radius: var(--sp-radius);
1296
+ border: 1px solid var(--sp-border);
1297
+ background: var(--sp-glass-bg-heavy);
1298
+ color: var(--sp-text);
1299
+ font-family: var(--sp-font);
1300
+ font-size: 14px;
1301
+ outline: none;
1302
+ transition: all 0.2s ease;
1303
+ }
1304
+
1305
+ .sp-input::placeholder {
1306
+ color: var(--sp-text-tertiary);
1307
+ }
1308
+
1309
+ .sp-input:focus {
1310
+ border-color: var(--sp-accent);
1311
+ box-shadow: 0 0 0 3px var(--sp-accent-light);
1312
+ background: #fff;
1313
+ }
1314
+
1315
+ .sp-input-label {
1316
+ font-size: 13px;
1317
+ font-weight: 500;
1318
+ color: var(--sp-text-secondary);
1319
+ margin-bottom: 6px;
1320
+ display: block;
1321
+ }
1322
+
1323
+ /* ============================
1324
+ Buttons
1325
+ ============================ */
1326
+
1327
+ .sp-btn-primary {
1328
+ height: 40px;
1329
+ padding: 0 22px;
1330
+ border-radius: var(--sp-radius);
1331
+ border: none;
1332
+ background: var(--sp-accent-gradient);
1333
+ color: #fff;
1334
+ font-family: var(--sp-font);
1335
+ font-size: 14px;
1336
+ font-weight: 600;
1337
+ cursor: pointer;
1338
+ transition: all 0.2s ease;
1339
+ box-shadow: 0 2px 8px var(--sp-accent-glow);
1340
+ }
1341
+
1342
+ .sp-btn-primary:hover {
1343
+ box-shadow: 0 4px 16px var(--sp-accent-glow);
1344
+ transform: translateY(-1px);
1345
+ }
1346
+
1347
+ .sp-btn-primary:active {
1348
+ transform: translateY(0) scale(0.98);
1349
+ transition-duration: 0.1s;
1350
+ }
1351
+
1352
+ .sp-btn-primary:disabled {
1353
+ opacity: 0.4;
1354
+ cursor: not-allowed;
1355
+ transform: none;
1356
+ box-shadow: none;
1357
+ }
1358
+
1359
+ .sp-btn-ghost {
1360
+ height: 40px;
1361
+ padding: 0 22px;
1362
+ border-radius: var(--sp-radius);
1363
+ border: 1px solid var(--sp-border);
1364
+ background: var(--sp-glass-bg-heavy);
1365
+ color: var(--sp-text-secondary);
1366
+ font-family: var(--sp-font);
1367
+ font-size: 14px;
1368
+ font-weight: 500;
1369
+ cursor: pointer;
1370
+ transition: all 0.2s ease;
1371
+ }
1372
+
1373
+ .sp-btn-ghost:hover {
1374
+ border-color: var(--sp-accent);
1375
+ color: var(--sp-accent);
1376
+ background: var(--sp-accent-light);
1377
+ }
1378
+
1379
+ /* ============================
1380
+ Empty State
1381
+ ============================ */
1382
+
1383
+ .sp-empty {
1384
+ display: flex;
1385
+ flex-direction: column;
1386
+ align-items: center;
1387
+ justify-content: center;
1388
+ padding: 56px 24px;
1389
+ color: var(--sp-text-tertiary);
1390
+ text-align: center;
1391
+ gap: 8px;
1392
+ animation: sp-fade-in 0.3s ease-out both;
1393
+ }
1394
+
1395
+ .sp-empty-text {
1396
+ font-size: 14px;
1397
+ font-weight: 500;
1398
+ }
1399
+
1400
+ /* ============================
1401
+ Load More
1402
+ ============================ */
1403
+
1404
+ .sp-load-more-wrap {
1405
+ display: flex;
1406
+ justify-content: center;
1407
+ padding: 12px 0 4px;
1408
+ }
1409
+
1410
+ .sp-btn-load-more {
1411
+ width: 100%;
1412
+ }
1413
+
1414
+ /* ============================
1415
+ Forced Colors / High Contrast
1416
+ ============================ */
1417
+
1418
+ @media (forced-colors: active) {
1419
+ .sp-fab,
1420
+ .sp-radial-item,
1421
+ .sp-filter-dropdown-btn,
1422
+ .sp-segmented,
1423
+ .sp-segmented__btn,
1424
+ .sp-card,
1425
+ .sp-panel-close,
1426
+ .sp-search,
1427
+ .sp-btn-resolve,
1428
+ .sp-btn-delete,
1429
+ .sp-btn-delete-all,
1430
+ .sp-btn-primary,
1431
+ .sp-btn-ghost,
1432
+ .sp-btn-danger,
1433
+ .sp-card-expand,
1434
+ .sp-input,
1435
+ .sp-confirm-dialog {
1436
+ border: 2px solid ButtonText !important;
1437
+ background: Canvas !important;
1438
+ color: ButtonText !important;
1439
+ }
1440
+
1441
+ .sp-segmented__btn--active {
1442
+ background: Highlight !important;
1443
+ color: HighlightText !important;
1444
+ }
1445
+
1446
+ .sp-filter-dropdown-menu {
1447
+ border: 2px solid ButtonText !important;
1448
+ background: Canvas !important;
1449
+ }
1450
+
1451
+ .sp-filter-dropdown-option--active {
1452
+ background: Highlight !important;
1453
+ color: HighlightText !important;
1454
+ }
1455
+
1456
+ .sp-fab:focus-visible,
1457
+ .sp-radial-item:focus-visible,
1458
+ .sp-filter-dropdown-btn:focus-visible,
1459
+ .sp-segmented__btn:focus-visible,
1460
+ .sp-filter-dropdown-option:focus-visible,
1461
+ .sp-panel-close:focus-visible,
1462
+ .sp-btn-resolve:focus-visible,
1463
+ .sp-btn-delete:focus-visible,
1464
+ .sp-btn-delete-all:focus-visible,
1465
+ .sp-btn-primary:focus-visible,
1466
+ .sp-btn-ghost:focus-visible,
1467
+ .sp-btn-danger:focus-visible,
1468
+ .sp-card-expand:focus-visible,
1469
+ .sp-input:focus-visible,
1470
+ .sp-search:focus-visible {
1471
+ outline: 3px solid Highlight !important;
1472
+ }
1473
+
1474
+ .sp-panel {
1475
+ border: 2px solid ButtonText !important;
1476
+ }
1477
+
1478
+ .sp-fab-badge {
1479
+ border: 2px solid ButtonText !important;
1480
+ background: Canvas !important;
1481
+ color: ButtonText !important;
1482
+ }
1483
+
1484
+ .sp-card-bar {
1485
+ background: ButtonText !important;
1486
+ }
1487
+ }
1488
+
1489
+ ${It}
1490
+ ${O$1}
1491
+ ${N}
1492
+ ${F}
1493
+ ${D}
1494
+ ${S}
1495
+ ${H$1}
1496
+ `}var xn=120,vn=80,ye=class{constructor(e,n="en"){this.colors=e;this.locale=n;this.root=b("div",{style:`
1497
+ position: fixed;
1498
+ z-index: ${2147483647};
1499
+ max-width: 280px;
1500
+ padding: 12px 14px;
1501
+ border-radius: 14px;
1502
+ background: ${this.colors.glassBgHeavy};
1503
+ backdrop-filter: blur(24px);
1504
+ -webkit-backdrop-filter: blur(24px);
1505
+ border: 1px solid ${this.colors.glassBorder};
1506
+ box-shadow: 0 8px 32px ${this.colors.shadow}, 0 2px 8px ${this.colors.shadow};
1507
+ font-family: "Inter", system-ui, -apple-system, sans-serif;
1508
+ pointer-events: auto;
1509
+ opacity: 0;
1510
+ transform: translateY(6px) scale(0.97);
1511
+ transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
1512
+ visibility: hidden;
1513
+ -webkit-font-smoothing: antialiased;
1514
+ `}),this.root.setAttribute("role","tooltip"),this.root.id=this.tooltipId,this.arrow=b("div",{style:`
1515
+ position: absolute;
1516
+ width: 12px;
1517
+ height: 12px;
1518
+ background: ${this.colors.glassBgHeavy};
1519
+ border: 1px solid ${this.colors.glassBorder};
1520
+ transform: rotate(45deg);
1521
+ pointer-events: none;
1522
+ `}),this.root.appendChild(this.arrow),this.root.addEventListener("mouseenter",()=>this.cancelHide()),this.root.addEventListener("mouseleave",()=>this.scheduleHide()),document.body.appendChild(this.root);}colors;locale;root;arrow;showTimer=null;hideTimer=null;currentFeedbackId=null;tooltipId="sp-tooltip";show(e,n){this.currentFeedbackId!==e.id&&(this.cancelHide(),this.cancelShow(),this.showTimer=setTimeout(()=>{this.currentFeedbackId=e.id,this.render(e),this.position(n);let o=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;this.root.style.transition=o?"none":"",this.root.style.visibility="visible",this.root.style.opacity="1",this.root.style.transform="translateY(0) scale(1)";},xn));}scheduleHide(){this.cancelHide(),this.hideTimer=setTimeout(()=>this.hide(),vn);}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$1){let n=Array.from(this.root.children);for(let d of n)d!==this.arrow&&d.remove();let o=x(e$1.type,this.colors),i=y(e$1.type,this.colors),r=B(this.locale),s=C(e$1.type,r),a=b("div",{style:"display:flex;align-items:center;gap:8px;margin-bottom:8px;"}),l=b("span",{style:`
1523
+ padding:3px 10px;border-radius:9999px;
1524
+ font-size:11px;font-weight:600;
1525
+ color:${o};background:${i};
1526
+ letter-spacing:0.02em;
1527
+ `});c(l,s);let p=b("span",{style:`font-size:11px;color:${this.colors.textSecondary};margin-left:auto;`});c(p,e(e$1.createdAt,this.locale)),a.appendChild(l),a.appendChild(p);let c$1=b("div",{style:`font-size:13px;line-height:1.55;color:${this.colors.text};display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;`});c(c$1,e$1.message),this.root.insertBefore(a,this.arrow),this.root.insertBefore(c$1,this.arrow);}position(e){let n=this.root.getBoundingClientRect(),o=10,i=e.top-n.height-o,r=e.left+e.width/2-n.width/2,s=true;i<8&&(i=e.bottom+o,s=false),r=Math.max(8,Math.min(r,window.innerWidth-n.width-8)),this.root.style.top=`${i}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=`
1528
+ position:absolute;
1529
+ width:12px;height:12px;
1530
+ background:${this.colors.glassBgHeavy};
1531
+ border-right:1px solid ${this.colors.glassBorder};
1532
+ border-bottom:1px solid ${this.colors.glassBorder};
1533
+ transform:rotate(45deg);
1534
+ pointer-events:none;
1535
+ bottom:-6px;
1536
+ left:${a}px;
1537
+ `:this.arrow.style.cssText=`
1538
+ position:absolute;
1539
+ width:12px;height:12px;
1540
+ background:${this.colors.glassBgHeavy};
1541
+ border-left:1px solid ${this.colors.glassBorder};
1542
+ border-top:1px solid ${this.colors.glassBorder};
1543
+ transform:rotate(45deg);
1544
+ pointer-events:none;
1545
+ top:-6px;
1546
+ left:${a}px;
1547
+ `;}contains(e){return this.root.contains(e)}destroy(){this.cancelShow(),this.cancelHide(),this.root.remove();}};var Z=null;function kn(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 xe(){let t=()=>{};return {destroy:t,open:t,close:t,refresh:t,on:()=>t,off:t}}function Dt(t){let e=t.debug?(...u)=>console.debug("[siteping]",...u):()=>{};if(Z)return e("initSiteping() called more than once \u2014 returning existing instance"),Z;if(!t.forceShow)try{if(typeof process<"u")return t.onSkip?.("production"),xe()}catch{}if(window.innerWidth<768){let u="mobile";return t.onSkip?.(u),xe()}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."),xe();if(!t.projectName||typeof t.projectName!="string")return console.error("[siteping] Missing or invalid 'projectName' in config. Expected a non-empty string."),xe();let n=t.locale??"en";n!=="en"&&A(n).catch(()=>{});let o=B(n),i=t.scopeAnnotationsByUrl??true,r=()=>{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:n,scopeAnnotationsByUrl:i});let s=kn(t.captureDiagnostics),a=s.console?new pe(s.maxConsoleEntries):null,l=s.network?new de(s.maxNetworkEntries):null,p=w$1(t.accentColor,t.theme),c=new J,d=new J,h=t.store?new be(t.store,t.projectName):new ce(t.endpoint,t.projectName);t.onOpen&&c.on("open",t.onOpen),t.onClose&&c.on("close",t.onClose),t.onFeedbackSent&&c.on("feedback:sent",t.onFeedbackSent),t.onError&&c.on("feedback:error",t.onError),t.onAnnotationStart&&c.on("annotation:start",t.onAnnotationStart),t.onAnnotationEnd&&c.on("annotation:end",t.onAnnotationEnd),c.on("feedback:sent",u=>d.emit("feedback:sent",u)),c.on("feedback:deleted",u=>d.emit("feedback:deleted",u)),c.on("open",()=>d.emit("panel:open")),c.on("close",()=>d.emit("panel:close")),c.on("open",()=>e("Panel opened")),c.on("close",()=>e("Panel closed")),c.on("feedback:sent",u=>e("Feedback sent",u.id)),c.on("feedback:error",u=>e("Feedback failed",u.message)),c.on("annotation:start",()=>e("Annotation started")),c.on("annotation:end",()=>e("Annotation ended"));let f=document.createElement("siteping-widget");f.style.cssText=`position:fixed;z-index:${2147483647};`;let v=false;try{typeof process<"u"&&process.env?.["NODE_ENV"]==="test"&&(v=!0);}catch{}let D=v?"open":"closed",S=f.attachShadow({mode:D});if("adoptedStyleSheets"in ShadowRoot.prototype){let u=new CSSStyleSheet;u.replaceSync($e(p)),S.adoptedStyleSheets=[u];}else {let u=document.createElement("style");u.textContent=$e(p),S.appendChild(u);}document.body.appendChild(f);let k=document.createElement("div");k.setAttribute("role","status"),k.setAttribute("aria-live","polite"),k.setAttribute("aria-atomic","true"),k.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;",document.body.appendChild(k);let j=new ye(p,n),x=new ge(p,j,c,o,k),E=new ue(S,t,c,o),g=null,R=null,C=false;async function F(){return C?null:g||(R||(R=import('./panel-HDPPIATU.js').then(u=>C?null:(g=new u.Panel(S,p,c,h,t.projectName,x,o,n,{getScope:r,scopeAnnotationsByUrl:i}),g))),R)}if(typeof window<"u"){let u=()=>{C||F();},b=window.requestIdleCallback;typeof b=="function"?b(u):setTimeout(u,200);}let L=false,Nt=c.on("panel:toggle",u=>{g||(u?(L=true,F().then(b=>{b&&L&&b.open(),L=false;}).catch(b=>e("Failed to lazy-load panel:",b))):L=false);}),_t=new le(p,c,o,t.enableScreenshot??false),ve=false,$t=c.on("annotation:complete",async u=>{if(!ve){ve=true;try{let{annotation:b,type:N,message:we,screenshotDataUrl:ke}=u,_=Tt();if(!_){if(_=await En(S,o),!_)return;Ct(_);}let Ot=(()=>{try{return crypto.randomUUID()}catch{return `${Date.now()}-${Math.random().toString(36).slice(2)}`}})(),Ee=r(),Be=null;(a||l)&&(Be={console:a?.getEntries()??[],network:l?.getEntries()??[]});let Bt={projectName:t.projectName,type:N,message:we,url:Ee.url,urlPattern:Ee.urlPattern,viewport:`${window.innerWidth}x${window.innerHeight}`,userAgent:navigator.userAgent,authorName:_.name,authorEmail:_.email,annotations:[b],clientId:Ot,screenshotDataUrl:ke??null,diagnostics:Be};try{let M=await h.sendFeedback(Bt);c.emit("feedback:sent",M),(!i||M.url===Ee.url)&&x.addFeedback(M,x.count+1),k.textContent=o("feedback.sent.confirmation"),g&&await g.refresh();}catch(M){c.emit("feedback:error",M instanceof Error?M:new Error(String(M))),k.textContent=o("feedback.error.message");}}finally{ve=false;}}}),Oe=r(),Ht=i?{limit:20,url:Oe.url}:{limit:20};return h.getFeedbacks(t.projectName,Ht).then(({feedbacks:u})=>{let b=i?u.filter(N=>N.url===Oe.url):u;x.render(b);}).catch(u=>{e("Failed to load initial markers:",u);}),t.endpoint&&wt(t.endpoint).then(()=>e("Retry queue flushed")).catch(()=>{}),Z={destroy:()=>{e("Destroying widget"),C=true,L=false,$t(),Nt(),E.destroy(),g?.destroy(),_t.destroy(),x.destroy(),j.destroy(),a?.dispose(),l?.dispose(),c.removeAll(),d.removeAll(),k.remove(),f.remove(),Z=null;},open:()=>{c.emit("panel:toggle",true);},close:()=>{g?g.close():L=false;},refresh:()=>{if(g?.isCurrentlyOpen){g.refresh();return}let u=r(),b=i?{limit:20,url:u.url}:{limit:20};h.getFeedbacks(t.projectName,b).then(({feedbacks:N})=>{let we=i?N.filter(ke=>ke.url===u.url):N;x.render(we);}).catch(()=>{});},on:(u,b)=>d.on(u,b),off:(u,b)=>{d.off(u,b);}},Z}function En(t,e){return new Promise(n=>{let o=t.activeElement??document.activeElement,i=document.createElement("div");i.style.cssText=`
1548
+ position:fixed;inset:0;
1549
+ background:var(--sp-identity-overlay);
1550
+ backdrop-filter:blur(8px);
1551
+ -webkit-backdrop-filter:blur(8px);
1552
+ display:flex;align-items:center;justify-content:center;
1553
+ z-index:${2147483647};
1554
+ opacity:0;transition:opacity 0.25s ease;
1555
+ `;let r=document.createElement("div");r.style.cssText=`
1556
+ width:340px;padding:28px;border-radius:var(--sp-radius-xl);
1557
+ background:var(--sp-identity-bg);
1558
+ backdrop-filter:blur(var(--sp-blur-heavy));
1559
+ -webkit-backdrop-filter:blur(var(--sp-blur-heavy));
1560
+ border:1px solid var(--sp-glass-border);
1561
+ box-shadow:0 16px 48px var(--sp-shadow), 0 8px 16px var(--sp-shadow);
1562
+ font-family:var(--sp-font, "Inter",system-ui,-apple-system,sans-serif);
1563
+ color:var(--sp-text);
1564
+ transform:translateY(12px) scale(0.97);
1565
+ transition:transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
1566
+ -webkit-font-smoothing:antialiased;
1567
+ `;let s=`sp-identity-title-${Date.now()}`;r.setAttribute("role","dialog"),r.setAttribute("aria-modal","true"),r.setAttribute("aria-labelledby",s);let a=document.createElement("div");a.className="sp-identity-title",a.id=s,a.textContent=e("identity.title"),a.style.marginBottom="20px";let l=`sp-identity-name-${Date.now()}`,p=`sp-identity-email-${Date.now()}`,c=document.createElement("label");c.className="sp-input-label",c.textContent=e("identity.nameLabel"),c.setAttribute("for",l);let d=document.createElement("input");d.className="sp-input",d.id=l,d.type="text",d.placeholder=e("identity.namePlaceholder"),d.style.marginBottom="14px";let h=document.createElement("label");h.className="sp-input-label",h.textContent=e("identity.emailLabel"),h.setAttribute("for",p);let f=document.createElement("input");f.className="sp-input",f.id=p,f.type="email",f.placeholder=e("identity.emailPlaceholder");let v=document.createElement("div");v.style.cssText="display:flex;gap:8px;justify-content:flex-end;margin-top:20px;";let D=x=>{i.removeEventListener("keydown",j),i.style.opacity="0",r.style.transform="translateY(12px) scale(0.97)",setTimeout(()=>{i.remove(),o?.focus(),n(x);},250);},S=document.createElement("button");S.className="sp-btn-ghost",S.textContent=e("identity.cancel"),S.addEventListener("click",()=>D(null));let B=document.createElement("button");B.className="sp-btn-primary",B.textContent=e("identity.submit"),B.addEventListener("click",()=>{let x=d.value.trim(),E=f.value.trim();if(!x||!E)return;if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(E)){f.style.borderColor="var(--sp-type-bug, #ef4444)";return}D({name:x,email:E});});let k='input, button, [tabindex]:not([tabindex="-1"])',j=x=>{let E=x;if(E.key==="Escape"){D(null);return}if(E.key==="Tab"){let g=Array.from(r.querySelectorAll(k));if(g.length===0)return;let R=g[0],C=g[g.length-1];if(!R||!C)return;let F=t.activeElement;E.shiftKey?(F===R||!r.contains(F))&&(E.preventDefault(),C.focus()):(F===C||!r.contains(F))&&(E.preventDefault(),R.focus());}};i.addEventListener("keydown",j),i.addEventListener("click",x=>{x.target===i&&D(null);}),v.appendChild(S),v.appendChild(B),r.appendChild(a),r.appendChild(c),r.appendChild(d),r.appendChild(h),r.appendChild(f),r.appendChild(v),i.appendChild(r),t.appendChild(i),requestAnimationFrame(()=>{i.style.opacity="1",r.style.transform="translateY(0) scale(1)",d.focus();});})}function Lt(t){return Dt(t)}function ii(t){let e=useRef(t);e.current=t;let[n,o]=useState(null);return useEffect(()=>{let i=true,r=Lt(e.current);if(!i){r.destroy();return}let s=r.on("feedback:sent",p=>{e.current.onFeedbackSent?.(p);}),a=r.on("panel:open",()=>{e.current.onOpen?.();}),l=r.on("panel:close",()=>{e.current.onClose?.();});return o(r),()=>{i=false,s(),a(),l(),r.destroy(),o(null);}},[]),n}export{ii as useSiteping};//# sourceMappingURL=react.js.map
1568
+ //# sourceMappingURL=react.js.map