bugstash 0.1.24 → 0.1.25

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/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
- "use strict";var sn=Object.defineProperty;var vs=Object.getOwnPropertyDescriptor;var ws=Object.getOwnPropertyNames;var ks=Object.prototype.hasOwnProperty;var Es=(e,t)=>{for(var n in t)sn(e,n,{get:t[n],enumerable:!0})},Ss=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of ws(t))!ks.call(e,s)&&s!==n&&sn(e,s,{get:()=>t[s],enumerable:!(r=vs(t,s))||r.enumerable});return e};var Ls=e=>Ss(sn({},"__esModule",{value:!0}),e);var ii={};Es(ii,{BugStash:()=>fs,default:()=>oi});module.exports=Ls(ii);var Je=[],jn=50,Ke=null,Ge=null,Qe=null,Ze=null;function kt(e){if(e.id)return`#${e.id}`;let t=e.tagName.toLowerCase(),n=e.className&&typeof e.className=="string"?"."+e.className.trim().split(/\s+/).slice(0,2).join("."):"",r=(e.textContent||"").trim().slice(0,30),s=r?` "${r}"`:"";return`${t}${n}${s}`}function Y(e){Je.push(e),Je.length>jn&&Je.shift()}function qn(e){e&&(jn=e),Ke=n=>{let r=n.target;!r||!r.tagName||Y({type:"click",category:"ui",message:`Clicked ${kt(r)}`,timestamp:Date.now(),data:{x:n.clientX,y:n.clientY,selector:kt(r)}})},document.addEventListener("click",Ke,!0);let t=new WeakMap;Ge=n=>{let r=n.target;if(!r||!r.tagName)return;let s=r.tagName.toLowerCase();if(s!=="input"&&s!=="textarea"&&s!=="select")return;let o=t.get(r);o&&clearTimeout(o),t.set(r,window.setTimeout(()=>{let i=r instanceof HTMLInputElement&&r.type==="password";Y({type:"input",category:"ui",message:`Input ${kt(r)}`,timestamp:Date.now(),data:{selector:kt(r),value:i?"[redacted]":void 0}})},300))},document.addEventListener("input",Ge,!0),Qe=()=>{Y({type:"navigation",category:"navigation",message:`Navigated to ${window.location.pathname}`,timestamp:Date.now(),data:{url:window.location.href}})},window.addEventListener("popstate",Qe),Ze=()=>{Y({type:"navigation",category:"navigation",message:`Hash changed to ${window.location.hash}`,timestamp:Date.now(),data:{url:window.location.href}})},window.addEventListener("hashchange",Ze),Y({type:"navigation",category:"navigation",message:`Page loaded: ${window.location.pathname}`,timestamp:Date.now(),data:{url:window.location.href}})}function Te(){return[...Je]}function Un(){Je=[]}function Fn(){Ke&&document.removeEventListener("click",Ke,!0),Ge&&document.removeEventListener("input",Ge,!0),Qe&&window.removeEventListener("popstate",Qe),Ze&&window.removeEventListener("hashchange",Ze),Ke=null,Ge=null,Qe=null,Ze=null}var on="[REDACTED]",Cs=[[/\b(?:\d[ -]*?){13,19}\b/g,"[CC_REDACTED]"],[/\b\d{3}-\d{2}-\d{4}\b/g,"[SSN_REDACTED]"],[/Bearer\s+[A-Za-z0-9\-._~+/]+=*/g,"Bearer [TOKEN_REDACTED]"],[/eyJ[A-Za-z0-9_-]+\.eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g,"[JWT_REDACTED]"],[/(?:api[_-]?key|apikey|secret|token|password|passwd|authorization)['":\s=]+['"]?([A-Za-z0-9\-._~+/]{20,})['"]?/gi,e=>{let t=e.search(/[=:]/);return e.slice(0,t+1)+" "+on}],[/AKIA[0-9A-Z]{16}/g,"[AWS_KEY_REDACTED]"],[/"(?:password|passwd|secret|token|access_token|refresh_token|api_key|apiKey|private_key)":\s*"[^"]*"/gi,e=>{let t=e.indexOf(":");return e.slice(0,t+1)+' "'+on+'"'}]];function Pe(e){let t=e;for(let[n,r]of Cs)t=t.replace(n,r);return t}function Wn(e){return e.map(Pe)}function Et(e){if(typeof e=="string")return Pe(e);if(Array.isArray(e))return e.map(Et);if(e&&typeof e=="object"){let t={};for(let[n,r]of Object.entries(e)){let s=n.toLowerCase();s.includes("password")||s.includes("secret")||s.includes("token")||s.includes("apikey")||s.includes("api_key")||s.includes("private")?t[n]=on:t[n]=Et(r)}return t}return e}var St={log:console.log,warn:console.warn,error:console.error,debug:console.debug,info:console.info},et=[],_n=50;function Ts(e){return e.map(t=>{if(t instanceof Error)return`${t.name}: ${t.message}
2
- ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{return String(t)}return String(t)})}function Ps(e,t){let n={level:e,args:Wn(Ts(t)),timestamp:Date.now()};e==="error"&&(n.stack=new Error().stack?.split(`
1
+ "use strict";var cn=Object.defineProperty;var Ms=Object.getOwnPropertyDescriptor;var As=Object.getOwnPropertyNames;var Rs=Object.prototype.hasOwnProperty;var zs=(e,t)=>{for(var n in t)cn(e,n,{get:t[n],enumerable:!0})},Is=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of As(t))!Rs.call(e,s)&&s!==n&&cn(e,s,{get:()=>t[s],enumerable:!(r=Ms(t,s))||r.enumerable});return e};var Hs=e=>Is(cn({},"__esModule",{value:!0}),e);var wi={};zs(wi,{BugStash:()=>Ss,default:()=>xi});module.exports=Hs(wi);var Ge=[],Wn=50,Qe=null,Ze=null,et=null,tt=null;function Pt(e){if(e.id)return`#${e.id}`;let t=e.tagName.toLowerCase(),n=e.className&&typeof e.className=="string"?"."+e.className.trim().split(/\s+/).slice(0,2).join("."):"",r=(e.textContent||"").trim().slice(0,30),s=r?` "${r}"`:"";return`${t}${n}${s}`}function V(e){Ge.push(e),Ge.length>Wn&&Ge.shift()}function Xn(e){e&&(Wn=e),Qe=n=>{let r=n.target;!r||!r.tagName||V({type:"click",category:"ui",message:`Clicked ${Pt(r)}`,timestamp:Date.now(),data:{x:n.clientX,y:n.clientY,selector:Pt(r)}})},document.addEventListener("click",Qe,!0);let t=new WeakMap;Ze=n=>{let r=n.target;if(!r||!r.tagName)return;let s=r.tagName.toLowerCase();if(s!=="input"&&s!=="textarea"&&s!=="select")return;let o=t.get(r);o&&clearTimeout(o),t.set(r,window.setTimeout(()=>{let a=r instanceof HTMLInputElement&&r.type==="password";V({type:"input",category:"ui",message:`Input ${Pt(r)}`,timestamp:Date.now(),data:{selector:Pt(r),value:a?"[redacted]":void 0}})},300))},document.addEventListener("input",Ze,!0),et=()=>{V({type:"navigation",category:"navigation",message:`Navigated to ${window.location.pathname}`,timestamp:Date.now(),data:{url:window.location.href}})},window.addEventListener("popstate",et),tt=()=>{V({type:"navigation",category:"navigation",message:`Hash changed to ${window.location.hash}`,timestamp:Date.now(),data:{url:window.location.href}})},window.addEventListener("hashchange",tt),V({type:"navigation",category:"navigation",message:`Page loaded: ${window.location.pathname}`,timestamp:Date.now(),data:{url:window.location.href}})}function $e(){return[...Ge]}function Yn(){Ge=[]}function Vn(){Qe&&document.removeEventListener("click",Qe,!0),Ze&&document.removeEventListener("input",Ze,!0),et&&window.removeEventListener("popstate",et),tt&&window.removeEventListener("hashchange",tt),Qe=null,Ze=null,et=null,tt=null}var dn="[REDACTED]",Bs=[[/\b(?:\d[ -]*?){13,19}\b/g,"[CC_REDACTED]"],[/\b\d{3}-\d{2}-\d{4}\b/g,"[SSN_REDACTED]"],[/Bearer\s+[A-Za-z0-9\-._~+/]+=*/g,"Bearer [TOKEN_REDACTED]"],[/eyJ[A-Za-z0-9_-]+\.eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g,"[JWT_REDACTED]"],[/(?:api[_-]?key|apikey|secret|token|password|passwd|authorization)['":\s=]+['"]?([A-Za-z0-9\-._~+/]{20,})['"]?/gi,e=>{let t=e.search(/[=:]/);return e.slice(0,t+1)+" "+dn}],[/AKIA[0-9A-Z]{16}/g,"[AWS_KEY_REDACTED]"],[/"(?:password|passwd|secret|token|access_token|refresh_token|api_key|apiKey|private_key)":\s*"[^"]*"/gi,e=>{let t=e.indexOf(":");return e.slice(0,t+1)+' "'+dn+'"'}]];function Me(e){let t=e;for(let[n,r]of Bs)t=t.replace(n,r);return t}function Jn(e){return e.map(Me)}function Ct(e){if(typeof e=="string")return Me(e);if(Array.isArray(e))return e.map(Ct);if(e&&typeof e=="object"){let t={};for(let[n,r]of Object.entries(e)){let s=n.toLowerCase();s.includes("password")||s.includes("secret")||s.includes("token")||s.includes("apikey")||s.includes("api_key")||s.includes("private")?t[n]=dn:t[n]=Ct(r)}return t}return e}var Tt={log:console.log,warn:console.warn,error:console.error,debug:console.debug,info:console.info},nt=[],Kn=50;function Ds(e){return e.map(t=>{if(t instanceof Error)return`${t.name}: ${t.message}
2
+ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{return String(t)}return String(t)})}function Os(e,t){let n={level:e,args:Jn(Ds(t)),timestamp:Date.now()};e==="error"&&(n.stack=new Error().stack?.split(`
3
3
  `).slice(2).join(`
4
- `)),et.push(n),et.length>_n&&et.shift(),Y({type:"console",category:`console.${e}`,message:n.args.join(" ").slice(0,200),timestamp:n.timestamp})}function Xn(e){e&&(_n=e);for(let t of Object.keys(St))console[t]=function(...n){Ps(t,n),St[t].apply(console,n)}}function le(){return[...et]}function Yn(){et=[]}function Vn(){for(let e of Object.keys(St))console[e]=St[e]}var $e=[],Jn=50,Lt,Ct,Tt;function an(e){$e.push(e),$e.length>Jn&&$e.shift(),Y({type:"network",category:e.failed?"network.error":"network.ok",message:`${e.method} ${e.url} \u2192 ${e.status} (${e.duration}ms)`,timestamp:e.timestamp,data:{status:e.status,duration:e.duration}})}function Kn(e){try{let t=new URL(e,window.location.origin),n=new URLSearchParams(t.search);for(let s of n.keys()){let o=s.toLowerCase();(o.includes("token")||o.includes("key")||o.includes("secret")||o.includes("password")||o.includes("auth"))&&n.set(s,"[REDACTED]")}let r=n.toString();return t.pathname+(r?"?"+r:"")}catch{return Pe(e)}}function $s(){Lt=window.fetch,window.fetch=async function(e,t){let n=t?.method?.toUpperCase()??"GET",r=typeof e=="string"?e:e instanceof URL?e.href:e.url,s=Kn(r),o=Date.now();try{let i=await Lt.call(window,e,t);return an({method:n,url:s,status:i.status,statusText:i.statusText,duration:Date.now()-o,responseType:i.headers.get("content-type")??void 0,timestamp:o,failed:i.status>=400}),i}catch(i){throw an({method:n,url:s,status:0,statusText:"Network Error",duration:Date.now()-o,timestamp:o,failed:!0}),i}}}function Ms(){Ct=XMLHttpRequest.prototype.open,Tt=XMLHttpRequest.prototype.send,XMLHttpRequest.prototype.open=function(e,t,...n){return this.__bs_method=e.toUpperCase(),this.__bs_url=Kn(typeof t=="string"?t:t.href),Ct.apply(this,[e,t,...n])},XMLHttpRequest.prototype.send=function(e){let t=Date.now();return this.addEventListener("loadend",function(){an({method:this.__bs_method??"GET",url:this.__bs_url??"",status:this.status,statusText:this.statusText,duration:Date.now()-t,responseType:this.getResponseHeader("content-type")??void 0,timestamp:t,failed:this.status>=400||this.status===0})}),Tt.call(this,e)}}function Gn(e){e&&(Jn=e),$s(),Ms()}function Me(){return[...$e]}function fe(){return $e.filter(e=>e.failed)}function Qn(){$e=[]}function Zn(){Lt&&(window.fetch=Lt),Ct&&(XMLHttpRequest.prototype.open=Ct),Tt&&(XMLHttpRequest.prototype.send=Tt)}var Pt=[],tt=null,nt=null;function er(){tt=e=>{let t={message:e.message||"Unknown error",source:e.filename,lineno:e.lineno,colno:e.colno,stack:e.error?.stack,type:"error",timestamp:Date.now()};Pt.push(t),Y({type:"error",category:"exception",message:t.message,timestamp:t.timestamp,data:{source:t.source,lineno:t.lineno}})},nt=e=>{let t=e.reason,n=t instanceof Error?t.message:typeof t=="string"?t:"Unhandled promise rejection",r={message:n,stack:t instanceof Error?t.stack:void 0,type:"unhandledrejection",timestamp:Date.now()};Pt.push(r),Y({type:"error",category:"promise",message:n,timestamp:r.timestamp})},window.addEventListener("error",tt),window.addEventListener("unhandledrejection",nt)}function ce(){return[...Pt]}function tr(){Pt=[]}function nr(){tt&&window.removeEventListener("error",tt),nt&&window.removeEventListener("unhandledrejection",nt),tt=null,nt=null}var P=null,$t=null,Mt=null,At=null;function rr(){if(P={timestamp:Date.now()},performance.getEntriesByType){let e=()=>{let[t]=performance.getEntriesByType("navigation");t&&P&&(P.pageLoadTime=Math.round(t.loadEventEnd-t.startTime),P.domContentLoaded=Math.round(t.domContentLoadedEventEnd-t.startTime));let n=performance.getEntriesByType("paint");for(let s of n)s.name==="first-paint"&&P&&(P.firstPaint=Math.round(s.startTime)),s.name==="first-contentful-paint"&&P&&(P.firstContentfulPaint=Math.round(s.startTime));P&&(P.resourceCount=performance.getEntriesByType("resource").length);let r=performance.memory;r&&P&&(P.memoryUsage={usedJSHeapSize:r.usedJSHeapSize,totalJSHeapSize:r.totalJSHeapSize})};document.readyState==="complete"?setTimeout(e,0):window.addEventListener("load",()=>setTimeout(e,100))}if(typeof PerformanceObserver<"u"){try{$t=new PerformanceObserver(e=>{let t=e.getEntries(),n=t[t.length-1];n&&P&&(P.largestContentfulPaint=Math.round(n.startTime))}),$t.observe({type:"largest-contentful-paint",buffered:!0})}catch{}try{let e=0;Mt=new PerformanceObserver(t=>{for(let n of t.getEntries())n.hadRecentInput||(e+=n.value);P&&(P.cumulativeLayoutShift=Math.round(e*1e3)/1e3)}),Mt.observe({type:"layout-shift",buffered:!0})}catch{}try{At=new PerformanceObserver(e=>{let[t]=e.getEntries();t&&P&&(P.firstInputDelay=Math.round(t.processingStart-t.startTime))}),At.observe({type:"first-input",buffered:!0})}catch{}}}function Ae(){return P&&(P.timestamp=Date.now()),P?{...P}:null}function sr(){$t?.disconnect(),Mt?.disconnect(),At?.disconnect(),$t=null,Mt=null,At=null,P=null}function or(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;let n=document.implementation.createHTMLDocument(),r=n.createElement("base"),s=n.createElement("a");return n.head.appendChild(r),n.body.appendChild(s),t&&(r.href=t),s.href=e,s.href}var ir=(()=>{let e=0,t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)})();function te(e){let t=[];for(let n=0,r=e.length;n<r;n++)t.push(e[n]);return t}var Re=null;function zt(e={}){return Re||(e.includeStyleProperties?(Re=e.includeStyleProperties,Re):(Re=te(window.getComputedStyle(document.documentElement)),Re))}function Rt(e,t){let r=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return r?parseFloat(r.replace("px","")):0}function As(e){let t=Rt(e,"border-left-width"),n=Rt(e,"border-right-width");return e.clientWidth+t+n}function Rs(e){let t=Rt(e,"border-top-width"),n=Rt(e,"border-bottom-width");return e.clientHeight+t+n}function ln(e,t={}){let n=t.width||As(e),r=t.height||Rs(e);return{width:n,height:r}}function ar(){let e,t;try{t=process}catch{}let n=t&&t.env?t.env.devicePixelRatio:null;return n&&(e=parseInt(n,10),Number.isNaN(e)&&(e=1)),e||window.devicePixelRatio||1}var K=16384;function lr(e){(e.width>K||e.height>K)&&(e.width>K&&e.height>K?e.width>e.height?(e.height*=K/e.width,e.width=K):(e.width*=K/e.height,e.height=K):e.width>K?(e.height*=K/e.width,e.width=K):(e.width*=K/e.height,e.height=K))}function ze(e){return new Promise((t,n)=>{let r=new Image;r.onload=()=>{r.decode().then(()=>{requestAnimationFrame(()=>t(r))})},r.onerror=n,r.crossOrigin="anonymous",r.decoding="async",r.src=e})}async function zs(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function cr(e,t,n){let r="http://www.w3.org/2000/svg",s=document.createElementNS(r,"svg"),o=document.createElementNS(r,"foreignObject");return s.setAttribute("width",`${t}`),s.setAttribute("height",`${n}`),s.setAttribute("viewBox",`0 0 ${t} ${n}`),o.setAttribute("width","100%"),o.setAttribute("height","100%"),o.setAttribute("x","0"),o.setAttribute("y","0"),o.setAttribute("externalResourcesRequired","true"),s.appendChild(o),o.appendChild(e),zs(s)}var W=(e,t)=>{if(e instanceof t)return!0;let n=Object.getPrototypeOf(e);return n===null?!1:n.constructor.name===t.name||W(n,t)};function Is(e){let t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}function Hs(e,t){return zt(t).map(n=>{let r=e.getPropertyValue(n),s=e.getPropertyPriority(n);return`${n}: ${r}${s?" !important":""};`}).join(" ")}function Ds(e,t,n,r){let s=`.${e}:${t}`,o=n.cssText?Is(n):Hs(n,r);return document.createTextNode(`${s}{${o}}`)}function dr(e,t,n,r){let s=window.getComputedStyle(e,n),o=s.getPropertyValue("content");if(o===""||o==="none")return;let i=ir();try{t.className=`${t.className} ${i}`}catch{return}let a=document.createElement("style");a.appendChild(Ds(i,n,s,r)),t.appendChild(a)}function pr(e,t,n){dr(e,t,":before",n),dr(e,t,":after",n)}var br="application/font-woff",ur="image/jpeg",Bs={woff:br,woff2:br,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:ur,jpeg:ur,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function Os(e){let t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}function Ie(e){let t=Os(e).toLowerCase();return Bs[t]||""}function Ns(e){return e.split(/,/)[1]}function rt(e){return e.search(/^(data:)/)!==-1}function dn(e,t){return`data:${t};base64,${e}`}async function pn(e,t,n){let r=await fetch(e,t);if(r.status===404)throw new Error(`Resource "${r.url}" not found`);let s=await r.blob();return new Promise((o,i)=>{let a=new FileReader;a.onerror=i,a.onloadend=()=>{try{o(n({res:r,result:a.result}))}catch(d){i(d)}},a.readAsDataURL(s)})}var cn={};function js(e,t,n){let r=e.replace(/\?.*/,"");return n&&(r=e),/ttf|otf|eot|woff2?/i.test(r)&&(r=r.replace(/.*\//,"")),t?`[${t}]${r}`:r}async function He(e,t,n){let r=js(e,t,n.includeQueryParams);if(cn[r]!=null)return cn[r];n.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime());let s;try{let o=await pn(e,n.fetchRequestInit,({res:i,result:a})=>(t||(t=i.headers.get("Content-Type")||""),Ns(a)));s=dn(o,t)}catch(o){s=n.imagePlaceholder||"";let i=`Failed to fetch resource: ${e}`;o&&(i=typeof o=="string"?o:o.message),i&&console.warn(i)}return cn[r]=s,s}async function qs(e){let t=e.toDataURL();return t==="data:,"?e.cloneNode(!1):ze(t)}async function Us(e,t){if(e.currentSrc){let o=document.createElement("canvas"),i=o.getContext("2d");o.width=e.clientWidth,o.height=e.clientHeight,i?.drawImage(e,0,0,o.width,o.height);let a=o.toDataURL();return ze(a)}let n=e.poster,r=Ie(n),s=await He(n,r,t);return ze(s)}async function Fs(e,t){var n;try{if(!((n=e?.contentDocument)===null||n===void 0)&&n.body)return await st(e.contentDocument.body,t,!0)}catch{}return e.cloneNode(!1)}async function Ws(e,t){return W(e,HTMLCanvasElement)?qs(e):W(e,HTMLVideoElement)?Us(e,t):W(e,HTMLIFrameElement)?Fs(e,t):e.cloneNode(mr(e))}var _s=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SLOT",mr=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SVG";async function Xs(e,t,n){var r,s;if(mr(t))return t;let o=[];return _s(e)&&e.assignedNodes?o=te(e.assignedNodes()):W(e,HTMLIFrameElement)&&(!((r=e.contentDocument)===null||r===void 0)&&r.body)?o=te(e.contentDocument.body.childNodes):o=te(((s=e.shadowRoot)!==null&&s!==void 0?s:e).childNodes),o.length===0||W(e,HTMLVideoElement)||await o.reduce((i,a)=>i.then(()=>st(a,n)).then(d=>{d&&t.appendChild(d)}),Promise.resolve()),t}function Ys(e,t,n){let r=t.style;if(!r)return;let s=window.getComputedStyle(e);s.cssText?(r.cssText=s.cssText,r.transformOrigin=s.transformOrigin):zt(n).forEach(o=>{let i=s.getPropertyValue(o);o==="font-size"&&i.endsWith("px")&&(i=`${Math.floor(parseFloat(i.substring(0,i.length-2)))-.1}px`),W(e,HTMLIFrameElement)&&o==="display"&&i==="inline"&&(i="block"),o==="d"&&t.getAttribute("d")&&(i=`path(${t.getAttribute("d")})`),r.setProperty(o,i,s.getPropertyPriority(o))})}function Vs(e,t){W(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),W(e,HTMLInputElement)&&t.setAttribute("value",e.value)}function Js(e,t){if(W(e,HTMLSelectElement)){let r=Array.from(t.children).find(s=>e.value===s.getAttribute("value"));r&&r.setAttribute("selected","")}}function Ks(e,t,n){return W(t,Element)&&(Ys(e,t,n),pr(e,t,n),Vs(e,t),Js(e,t)),t}async function Gs(e,t){let n=e.querySelectorAll?e.querySelectorAll("use"):[];if(n.length===0)return e;let r={};for(let o=0;o<n.length;o++){let a=n[o].getAttribute("xlink:href");if(a){let d=e.querySelector(a),p=document.querySelector(a);!d&&p&&!r[a]&&(r[a]=await st(p,t,!0))}}let s=Object.values(r);if(s.length){let o="http://www.w3.org/1999/xhtml",i=document.createElementNS(o,"svg");i.setAttribute("xmlns",o),i.style.position="absolute",i.style.width="0",i.style.height="0",i.style.overflow="hidden",i.style.display="none";let a=document.createElementNS(o,"defs");i.appendChild(a);for(let d=0;d<s.length;d++)a.appendChild(s[d]);e.appendChild(i)}return e}async function st(e,t,n){return!n&&t.filter&&!t.filter(e)?null:Promise.resolve(e).then(r=>Ws(r,t)).then(r=>Xs(e,r,t)).then(r=>Ks(e,r,t)).then(r=>Gs(r,t))}var fr=/url\((['"]?)([^'"]+?)\1\)/g,Qs=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,Zs=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function eo(e){let t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function to(e){let t=[];return e.replace(fr,(n,r,s)=>(t.push(s),n)),t.filter(n=>!rt(n))}async function no(e,t,n,r,s){try{let o=n?or(t,n):t,i=Ie(t),a;if(s){let d=await s(o);a=dn(d,i)}else a=await He(o,i,r);return e.replace(eo(t),`$1${a}$3`)}catch{}return e}function ro(e,{preferredFontFormat:t}){return t?e.replace(Zs,n=>{for(;;){let[r,,s]=Qs.exec(n)||[];if(!s)return"";if(s===t)return`src: ${r};`}}):e}function bn(e){return e.search(fr)!==-1}async function It(e,t,n){if(!bn(e))return e;let r=ro(e,n);return to(r).reduce((o,i)=>o.then(a=>no(a,i,t,n)),Promise.resolve(r))}async function De(e,t,n){var r;let s=(r=t.style)===null||r===void 0?void 0:r.getPropertyValue(e);if(s){let o=await It(s,null,n);return t.style.setProperty(e,o,t.style.getPropertyPriority(e)),!0}return!1}async function so(e,t){await De("background",e,t)||await De("background-image",e,t),await De("mask",e,t)||await De("-webkit-mask",e,t)||await De("mask-image",e,t)||await De("-webkit-mask-image",e,t)}async function oo(e,t){let n=W(e,HTMLImageElement);if(!(n&&!rt(e.src))&&!(W(e,SVGImageElement)&&!rt(e.href.baseVal)))return;let r=n?e.src:e.href.baseVal,s=await He(r,Ie(r),t);await new Promise((o,i)=>{e.onload=o,e.onerror=t.onImageErrorHandler?(...d)=>{try{o(t.onImageErrorHandler(...d))}catch(p){i(p)}}:i;let a=e;a.decode&&(a.decode=o),a.loading==="lazy"&&(a.loading="eager"),n?(e.srcset="",e.src=s):e.href.baseVal=s})}async function io(e,t){let r=te(e.childNodes).map(s=>un(s,t));await Promise.all(r).then(()=>e)}async function un(e,t){W(e,Element)&&(await so(e,t),await oo(e,t),await io(e,t))}function gr(e,t){let{style:n}=e;t.backgroundColor&&(n.backgroundColor=t.backgroundColor),t.width&&(n.width=`${t.width}px`),t.height&&(n.height=`${t.height}px`);let r=t.style;return r!=null&&Object.keys(r).forEach(s=>{n[s]=r[s]}),e}var hr={};async function yr(e){let t=hr[e];if(t!=null)return t;let r=await(await fetch(e)).text();return t={url:e,cssText:r},hr[e]=t,t}async function xr(e,t){let n=e.cssText,r=/url\(["']?([^"')]+)["']?\)/g,o=(n.match(/url\([^)]+\)/g)||[]).map(async i=>{let a=i.replace(r,"$1");return a.startsWith("https://")||(a=new URL(a,e.url).href),pn(a,t.fetchRequestInit,({result:d})=>(n=n.replace(i,`url(${d})`),[i,d]))});return Promise.all(o).then(()=>n)}function vr(e){if(e==null)return[];let t=[],n=/(\/\*[\s\S]*?\*\/)/gi,r=e.replace(n,""),s=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){let d=s.exec(r);if(d===null)break;t.push(d[0])}r=r.replace(s,"");let o=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,i="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",a=new RegExp(i,"gi");for(;;){let d=o.exec(r);if(d===null){if(d=a.exec(r),d===null)break;o.lastIndex=a.lastIndex}else a.lastIndex=o.lastIndex;t.push(d[0])}return t}async function ao(e,t){let n=[],r=[];return e.forEach(s=>{if("cssRules"in s)try{te(s.cssRules||[]).forEach((o,i)=>{if(o.type===CSSRule.IMPORT_RULE){let a=i+1,d=o.href,p=yr(d).then(b=>xr(b,t)).then(b=>vr(b).forEach(y=>{try{s.insertRule(y,y.startsWith("@import")?a+=1:s.cssRules.length)}catch(w){console.error("Error inserting rule from remote css",{rule:y,error:w})}})).catch(b=>{console.error("Error loading remote css",b.toString())});r.push(p)}})}catch(o){let i=e.find(a=>a.href==null)||document.styleSheets[0];s.href!=null&&r.push(yr(s.href).then(a=>xr(a,t)).then(a=>vr(a).forEach(d=>{i.insertRule(d,i.cssRules.length)})).catch(a=>{console.error("Error loading remote stylesheet",a)})),console.error("Error inlining remote css file",o)}}),Promise.all(r).then(()=>(e.forEach(s=>{if("cssRules"in s)try{te(s.cssRules||[]).forEach(o=>{n.push(o)})}catch(o){console.error(`Error while reading CSS rules from ${s.href}`,o)}}),n))}function lo(e){return e.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>bn(t.style.getPropertyValue("src")))}async function co(e,t){if(e.ownerDocument==null)throw new Error("Provided element is not within a Document");let n=te(e.ownerDocument.styleSheets),r=await ao(n,t);return lo(r)}function wr(e){return e.trim().replace(/["']/g,"")}function po(e){let t=new Set;function n(r){(r.style.fontFamily||getComputedStyle(r).fontFamily).split(",").forEach(o=>{t.add(wr(o))}),Array.from(r.children).forEach(o=>{o instanceof HTMLElement&&n(o)})}return n(e),t}async function kr(e,t){let n=await co(e,t),r=po(e);return(await Promise.all(n.filter(o=>r.has(wr(o.style.fontFamily))).map(o=>{let i=o.parentStyleSheet?o.parentStyleSheet.href:null;return It(o.cssText,i,t)}))).join(`
5
- `)}async function Er(e,t){let n=t.fontEmbedCSS!=null?t.fontEmbedCSS:t.skipFonts?null:await kr(e,t);if(n){let r=document.createElement("style"),s=document.createTextNode(n);r.appendChild(s),e.firstChild?e.insertBefore(r,e.firstChild):e.appendChild(r)}}async function bo(e,t={}){let{width:n,height:r}=ln(e,t),s=await st(e,t,!0);return await Er(s,t),await un(s,t),gr(s,t),await cr(s,n,r)}async function uo(e,t={}){let{width:n,height:r}=ln(e,t),s=await bo(e,t),o=await ze(s),i=document.createElement("canvas"),a=i.getContext("2d"),d=t.pixelRatio||ar(),p=t.canvasWidth||n,b=t.canvasHeight||r;return i.width=p*d,i.height=b*d,t.skipAutoScale||lr(i),i.style.width=`${p}`,i.style.height=`${b}`,t.backgroundColor&&(a.fillStyle=t.backgroundColor,a.fillRect(0,0,i.width,i.height)),a.drawImage(o,0,0,i.width,i.height),i}async function Sr(e,t={}){return(await uo(e,t)).toDataURL()}function mo(){let e=document.createElement("div");if(e.style.cssText=`
4
+ `)),nt.push(n),nt.length>Kn&&nt.shift(),V({type:"console",category:`console.${e}`,message:n.args.join(" ").slice(0,200),timestamp:n.timestamp})}function Gn(e){e&&(Kn=e);for(let t of Object.keys(Tt))console[t]=function(...n){Os(t,n),Tt[t].apply(console,n)}}function de(){return[...nt]}function Qn(){nt=[]}function Zn(){for(let e of Object.keys(Tt))console[e]=Tt[e]}var Ae=[],er=50,$t,Mt,At;function pn(e){Ae.push(e),Ae.length>er&&Ae.shift(),V({type:"network",category:e.failed?"network.error":"network.ok",message:`${e.method} ${e.url} \u2192 ${e.status} (${e.duration}ms)`,timestamp:e.timestamp,data:{status:e.status,duration:e.duration}})}function tr(e){try{let t=new URL(e,window.location.origin),n=new URLSearchParams(t.search);for(let s of n.keys()){let o=s.toLowerCase();(o.includes("token")||o.includes("key")||o.includes("secret")||o.includes("password")||o.includes("auth"))&&n.set(s,"[REDACTED]")}let r=n.toString();return t.pathname+(r?"?"+r:"")}catch{return Me(e)}}function Ns(){$t=window.fetch,window.fetch=async function(e,t){let n=t?.method?.toUpperCase()??"GET",r=typeof e=="string"?e:e instanceof URL?e.href:e.url,s=tr(r),o=Date.now();try{let a=await $t.call(window,e,t);return pn({method:n,url:s,status:a.status,statusText:a.statusText,duration:Date.now()-o,responseType:a.headers.get("content-type")??void 0,timestamp:o,failed:a.status>=400}),a}catch(a){throw pn({method:n,url:s,status:0,statusText:"Network Error",duration:Date.now()-o,timestamp:o,failed:!0}),a}}}function js(){Mt=XMLHttpRequest.prototype.open,At=XMLHttpRequest.prototype.send,XMLHttpRequest.prototype.open=function(e,t,...n){return this.__bs_method=e.toUpperCase(),this.__bs_url=tr(typeof t=="string"?t:t.href),Mt.apply(this,[e,t,...n])},XMLHttpRequest.prototype.send=function(e){let t=Date.now();return this.addEventListener("loadend",function(){pn({method:this.__bs_method??"GET",url:this.__bs_url??"",status:this.status,statusText:this.statusText,duration:Date.now()-t,responseType:this.getResponseHeader("content-type")??void 0,timestamp:t,failed:this.status>=400||this.status===0})}),At.call(this,e)}}function nr(e){e&&(er=e),Ns(),js()}function Re(){return[...Ae]}function ge(){return Ae.filter(e=>e.failed)}function rr(){Ae=[]}function sr(){$t&&(window.fetch=$t),Mt&&(XMLHttpRequest.prototype.open=Mt),At&&(XMLHttpRequest.prototype.send=At)}var Rt=[],rt=null,st=null;function or(){rt=e=>{let t={message:e.message||"Unknown error",source:e.filename,lineno:e.lineno,colno:e.colno,stack:e.error?.stack,type:"error",timestamp:Date.now()};Rt.push(t),V({type:"error",category:"exception",message:t.message,timestamp:t.timestamp,data:{source:t.source,lineno:t.lineno}})},st=e=>{let t=e.reason,n=t instanceof Error?t.message:typeof t=="string"?t:"Unhandled promise rejection",r={message:n,stack:t instanceof Error?t.stack:void 0,type:"unhandledrejection",timestamp:Date.now()};Rt.push(r),V({type:"error",category:"promise",message:n,timestamp:r.timestamp})},window.addEventListener("error",rt),window.addEventListener("unhandledrejection",st)}function pe(){return[...Rt]}function ir(){Rt=[]}function ar(){rt&&window.removeEventListener("error",rt),st&&window.removeEventListener("unhandledrejection",st),rt=null,st=null}var z=null,zt=null,It=null,Ht=null;function lr(){if(z={timestamp:Date.now()},performance.getEntriesByType){let e=()=>{let[t]=performance.getEntriesByType("navigation");t&&z&&(z.pageLoadTime=Math.round(t.loadEventEnd-t.startTime),z.domContentLoaded=Math.round(t.domContentLoadedEventEnd-t.startTime));let n=performance.getEntriesByType("paint");for(let s of n)s.name==="first-paint"&&z&&(z.firstPaint=Math.round(s.startTime)),s.name==="first-contentful-paint"&&z&&(z.firstContentfulPaint=Math.round(s.startTime));z&&(z.resourceCount=performance.getEntriesByType("resource").length);let r=performance.memory;r&&z&&(z.memoryUsage={usedJSHeapSize:r.usedJSHeapSize,totalJSHeapSize:r.totalJSHeapSize})};document.readyState==="complete"?setTimeout(e,0):window.addEventListener("load",()=>setTimeout(e,100))}if(typeof PerformanceObserver<"u"){try{zt=new PerformanceObserver(e=>{let t=e.getEntries(),n=t[t.length-1];n&&z&&(z.largestContentfulPaint=Math.round(n.startTime))}),zt.observe({type:"largest-contentful-paint",buffered:!0})}catch{}try{let e=0;It=new PerformanceObserver(t=>{for(let n of t.getEntries())n.hadRecentInput||(e+=n.value);z&&(z.cumulativeLayoutShift=Math.round(e*1e3)/1e3)}),It.observe({type:"layout-shift",buffered:!0})}catch{}try{Ht=new PerformanceObserver(e=>{let[t]=e.getEntries();t&&z&&(z.firstInputDelay=Math.round(t.processingStart-t.startTime))}),Ht.observe({type:"first-input",buffered:!0})}catch{}}}function ze(){return z&&(z.timestamp=Date.now()),z?{...z}:null}function cr(){zt?.disconnect(),It?.disconnect(),Ht?.disconnect(),zt=null,It=null,Ht=null,z=null}function dr(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;let n=document.implementation.createHTMLDocument(),r=n.createElement("base"),s=n.createElement("a");return n.head.appendChild(r),n.body.appendChild(s),t&&(r.href=t),s.href=e,s.href}var pr=(()=>{let e=0,t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)})();function ne(e){let t=[];for(let n=0,r=e.length;n<r;n++)t.push(e[n]);return t}var Ie=null;function Dt(e={}){return Ie||(e.includeStyleProperties?(Ie=e.includeStyleProperties,Ie):(Ie=ne(window.getComputedStyle(document.documentElement)),Ie))}function Bt(e,t){let r=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return r?parseFloat(r.replace("px","")):0}function qs(e){let t=Bt(e,"border-left-width"),n=Bt(e,"border-right-width");return e.clientWidth+t+n}function Fs(e){let t=Bt(e,"border-top-width"),n=Bt(e,"border-bottom-width");return e.clientHeight+t+n}function un(e,t={}){let n=t.width||qs(e),r=t.height||Fs(e);return{width:n,height:r}}function ur(){let e,t;try{t=process}catch{}let n=t&&t.env?t.env.devicePixelRatio:null;return n&&(e=parseInt(n,10),Number.isNaN(e)&&(e=1)),e||window.devicePixelRatio||1}var G=16384;function br(e){(e.width>G||e.height>G)&&(e.width>G&&e.height>G?e.width>e.height?(e.height*=G/e.width,e.width=G):(e.width*=G/e.height,e.height=G):e.width>G?(e.height*=G/e.width,e.width=G):(e.width*=G/e.height,e.height=G))}function He(e){return new Promise((t,n)=>{let r=new Image;r.onload=()=>{r.decode().then(()=>{requestAnimationFrame(()=>t(r))})},r.onerror=n,r.crossOrigin="anonymous",r.decoding="async",r.src=e})}async function Us(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function mr(e,t,n){let r="http://www.w3.org/2000/svg",s=document.createElementNS(r,"svg"),o=document.createElementNS(r,"foreignObject");return s.setAttribute("width",`${t}`),s.setAttribute("height",`${n}`),s.setAttribute("viewBox",`0 0 ${t} ${n}`),o.setAttribute("width","100%"),o.setAttribute("height","100%"),o.setAttribute("x","0"),o.setAttribute("y","0"),o.setAttribute("externalResourcesRequired","true"),s.appendChild(o),o.appendChild(e),Us(s)}var W=(e,t)=>{if(e instanceof t)return!0;let n=Object.getPrototypeOf(e);return n===null?!1:n.constructor.name===t.name||W(n,t)};function _s(e){let t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}function Ws(e,t){return Dt(t).map(n=>{let r=e.getPropertyValue(n),s=e.getPropertyPriority(n);return`${n}: ${r}${s?" !important":""};`}).join(" ")}function Xs(e,t,n,r){let s=`.${e}:${t}`,o=n.cssText?_s(n):Ws(n,r);return document.createTextNode(`${s}{${o}}`)}function fr(e,t,n,r){let s=window.getComputedStyle(e,n),o=s.getPropertyValue("content");if(o===""||o==="none")return;let a=pr();try{t.className=`${t.className} ${a}`}catch{return}let i=document.createElement("style");i.appendChild(Xs(a,n,s,r)),t.appendChild(i)}function gr(e,t,n){fr(e,t,":before",n),fr(e,t,":after",n)}var hr="application/font-woff",yr="image/jpeg",Ys={woff:hr,woff2:hr,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:yr,jpeg:yr,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function Vs(e){let t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}function Be(e){let t=Vs(e).toLowerCase();return Ys[t]||""}function Js(e){return e.split(/,/)[1]}function ot(e){return e.search(/^(data:)/)!==-1}function mn(e,t){return`data:${t};base64,${e}`}async function fn(e,t,n){let r=await fetch(e,t);if(r.status===404)throw new Error(`Resource "${r.url}" not found`);let s=await r.blob();return new Promise((o,a)=>{let i=new FileReader;i.onerror=a,i.onloadend=()=>{try{o(n({res:r,result:i.result}))}catch(c){a(c)}},i.readAsDataURL(s)})}var bn={};function Ks(e,t,n){let r=e.replace(/\?.*/,"");return n&&(r=e),/ttf|otf|eot|woff2?/i.test(r)&&(r=r.replace(/.*\//,"")),t?`[${t}]${r}`:r}async function De(e,t,n){let r=Ks(e,t,n.includeQueryParams);if(bn[r]!=null)return bn[r];n.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime());let s;try{let o=await fn(e,n.fetchRequestInit,({res:a,result:i})=>(t||(t=a.headers.get("Content-Type")||""),Js(i)));s=mn(o,t)}catch(o){s=n.imagePlaceholder||"";let a=`Failed to fetch resource: ${e}`;o&&(a=typeof o=="string"?o:o.message),a&&console.warn(a)}return bn[r]=s,s}async function Gs(e){let t=e.toDataURL();return t==="data:,"?e.cloneNode(!1):He(t)}async function Qs(e,t){if(e.currentSrc){let o=document.createElement("canvas"),a=o.getContext("2d");o.width=e.clientWidth,o.height=e.clientHeight,a?.drawImage(e,0,0,o.width,o.height);let i=o.toDataURL();return He(i)}let n=e.poster,r=Be(n),s=await De(n,r,t);return He(s)}async function Zs(e,t){var n;try{if(!((n=e?.contentDocument)===null||n===void 0)&&n.body)return await it(e.contentDocument.body,t,!0)}catch{}return e.cloneNode(!1)}async function eo(e,t){return W(e,HTMLCanvasElement)?Gs(e):W(e,HTMLVideoElement)?Qs(e,t):W(e,HTMLIFrameElement)?Zs(e,t):e.cloneNode(vr(e))}var to=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SLOT",vr=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SVG";async function no(e,t,n){var r,s;if(vr(t))return t;let o=[];return to(e)&&e.assignedNodes?o=ne(e.assignedNodes()):W(e,HTMLIFrameElement)&&(!((r=e.contentDocument)===null||r===void 0)&&r.body)?o=ne(e.contentDocument.body.childNodes):o=ne(((s=e.shadowRoot)!==null&&s!==void 0?s:e).childNodes),o.length===0||W(e,HTMLVideoElement)||await o.reduce((a,i)=>a.then(()=>it(i,n)).then(c=>{c&&t.appendChild(c)}),Promise.resolve()),t}function ro(e,t,n){let r=t.style;if(!r)return;let s=window.getComputedStyle(e);s.cssText?(r.cssText=s.cssText,r.transformOrigin=s.transformOrigin):Dt(n).forEach(o=>{let a=s.getPropertyValue(o);o==="font-size"&&a.endsWith("px")&&(a=`${Math.floor(parseFloat(a.substring(0,a.length-2)))-.1}px`),W(e,HTMLIFrameElement)&&o==="display"&&a==="inline"&&(a="block"),o==="d"&&t.getAttribute("d")&&(a=`path(${t.getAttribute("d")})`),r.setProperty(o,a,s.getPropertyPriority(o))})}function so(e,t){W(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),W(e,HTMLInputElement)&&t.setAttribute("value",e.value)}function oo(e,t){if(W(e,HTMLSelectElement)){let r=Array.from(t.children).find(s=>e.value===s.getAttribute("value"));r&&r.setAttribute("selected","")}}function io(e,t,n){return W(t,Element)&&(ro(e,t,n),gr(e,t,n),so(e,t),oo(e,t)),t}async function ao(e,t){let n=e.querySelectorAll?e.querySelectorAll("use"):[];if(n.length===0)return e;let r={};for(let o=0;o<n.length;o++){let i=n[o].getAttribute("xlink:href");if(i){let c=e.querySelector(i),u=document.querySelector(i);!c&&u&&!r[i]&&(r[i]=await it(u,t,!0))}}let s=Object.values(r);if(s.length){let o="http://www.w3.org/1999/xhtml",a=document.createElementNS(o,"svg");a.setAttribute("xmlns",o),a.style.position="absolute",a.style.width="0",a.style.height="0",a.style.overflow="hidden",a.style.display="none";let i=document.createElementNS(o,"defs");a.appendChild(i);for(let c=0;c<s.length;c++)i.appendChild(s[c]);e.appendChild(a)}return e}async function it(e,t,n){return!n&&t.filter&&!t.filter(e)?null:Promise.resolve(e).then(r=>eo(r,t)).then(r=>no(e,r,t)).then(r=>io(e,r,t)).then(r=>ao(r,t))}var xr=/url\((['"]?)([^'"]+?)\1\)/g,lo=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,co=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function po(e){let t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function uo(e){let t=[];return e.replace(xr,(n,r,s)=>(t.push(s),n)),t.filter(n=>!ot(n))}async function bo(e,t,n,r,s){try{let o=n?dr(t,n):t,a=Be(t),i;if(s){let c=await s(o);i=mn(c,a)}else i=await De(o,a,r);return e.replace(po(t),`$1${i}$3`)}catch{}return e}function mo(e,{preferredFontFormat:t}){return t?e.replace(co,n=>{for(;;){let[r,,s]=lo.exec(n)||[];if(!s)return"";if(s===t)return`src: ${r};`}}):e}function gn(e){return e.search(xr)!==-1}async function Ot(e,t,n){if(!gn(e))return e;let r=mo(e,n);return uo(r).reduce((o,a)=>o.then(i=>bo(i,a,t,n)),Promise.resolve(r))}async function Oe(e,t,n){var r;let s=(r=t.style)===null||r===void 0?void 0:r.getPropertyValue(e);if(s){let o=await Ot(s,null,n);return t.style.setProperty(e,o,t.style.getPropertyPriority(e)),!0}return!1}async function fo(e,t){await Oe("background",e,t)||await Oe("background-image",e,t),await Oe("mask",e,t)||await Oe("-webkit-mask",e,t)||await Oe("mask-image",e,t)||await Oe("-webkit-mask-image",e,t)}async function go(e,t){let n=W(e,HTMLImageElement);if(!(n&&!ot(e.src))&&!(W(e,SVGImageElement)&&!ot(e.href.baseVal)))return;let r=n?e.src:e.href.baseVal,s=await De(r,Be(r),t);await new Promise((o,a)=>{e.onload=o,e.onerror=t.onImageErrorHandler?(...c)=>{try{o(t.onImageErrorHandler(...c))}catch(u){a(u)}}:a;let i=e;i.decode&&(i.decode=o),i.loading==="lazy"&&(i.loading="eager"),n?(e.srcset="",e.src=s):e.href.baseVal=s})}async function ho(e,t){let r=ne(e.childNodes).map(s=>hn(s,t));await Promise.all(r).then(()=>e)}async function hn(e,t){W(e,Element)&&(await fo(e,t),await go(e,t),await ho(e,t))}function wr(e,t){let{style:n}=e;t.backgroundColor&&(n.backgroundColor=t.backgroundColor),t.width&&(n.width=`${t.width}px`),t.height&&(n.height=`${t.height}px`);let r=t.style;return r!=null&&Object.keys(r).forEach(s=>{n[s]=r[s]}),e}var kr={};async function Er(e){let t=kr[e];if(t!=null)return t;let r=await(await fetch(e)).text();return t={url:e,cssText:r},kr[e]=t,t}async function Lr(e,t){let n=e.cssText,r=/url\(["']?([^"')]+)["']?\)/g,o=(n.match(/url\([^)]+\)/g)||[]).map(async a=>{let i=a.replace(r,"$1");return i.startsWith("https://")||(i=new URL(i,e.url).href),fn(i,t.fetchRequestInit,({result:c})=>(n=n.replace(a,`url(${c})`),[a,c]))});return Promise.all(o).then(()=>n)}function Sr(e){if(e==null)return[];let t=[],n=/(\/\*[\s\S]*?\*\/)/gi,r=e.replace(n,""),s=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){let c=s.exec(r);if(c===null)break;t.push(c[0])}r=r.replace(s,"");let o=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,a="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",i=new RegExp(a,"gi");for(;;){let c=o.exec(r);if(c===null){if(c=i.exec(r),c===null)break;o.lastIndex=i.lastIndex}else i.lastIndex=o.lastIndex;t.push(c[0])}return t}async function yo(e,t){let n=[],r=[];return e.forEach(s=>{if("cssRules"in s)try{ne(s.cssRules||[]).forEach((o,a)=>{if(o.type===CSSRule.IMPORT_RULE){let i=a+1,c=o.href,u=Er(c).then(p=>Lr(p,t)).then(p=>Sr(p).forEach(f=>{try{s.insertRule(f,f.startsWith("@import")?i+=1:s.cssRules.length)}catch(w){console.error("Error inserting rule from remote css",{rule:f,error:w})}})).catch(p=>{console.error("Error loading remote css",p.toString())});r.push(u)}})}catch(o){let a=e.find(i=>i.href==null)||document.styleSheets[0];s.href!=null&&r.push(Er(s.href).then(i=>Lr(i,t)).then(i=>Sr(i).forEach(c=>{a.insertRule(c,a.cssRules.length)})).catch(i=>{console.error("Error loading remote stylesheet",i)})),console.error("Error inlining remote css file",o)}}),Promise.all(r).then(()=>(e.forEach(s=>{if("cssRules"in s)try{ne(s.cssRules||[]).forEach(o=>{n.push(o)})}catch(o){console.error(`Error while reading CSS rules from ${s.href}`,o)}}),n))}function vo(e){return e.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>gn(t.style.getPropertyValue("src")))}async function xo(e,t){if(e.ownerDocument==null)throw new Error("Provided element is not within a Document");let n=ne(e.ownerDocument.styleSheets),r=await yo(n,t);return vo(r)}function Pr(e){return e.trim().replace(/["']/g,"")}function wo(e){let t=new Set;function n(r){(r.style.fontFamily||getComputedStyle(r).fontFamily).split(",").forEach(o=>{t.add(Pr(o))}),Array.from(r.children).forEach(o=>{o instanceof HTMLElement&&n(o)})}return n(e),t}async function Cr(e,t){let n=await xo(e,t),r=wo(e);return(await Promise.all(n.filter(o=>r.has(Pr(o.style.fontFamily))).map(o=>{let a=o.parentStyleSheet?o.parentStyleSheet.href:null;return Ot(o.cssText,a,t)}))).join(`
5
+ `)}async function Tr(e,t){let n=t.fontEmbedCSS!=null?t.fontEmbedCSS:t.skipFonts?null:await Cr(e,t);if(n){let r=document.createElement("style"),s=document.createTextNode(n);r.appendChild(s),e.firstChild?e.insertBefore(r,e.firstChild):e.appendChild(r)}}async function ko(e,t={}){let{width:n,height:r}=un(e,t),s=await it(e,t,!0);return await Tr(s,t),await hn(s,t),wr(s,t),await mr(s,n,r)}async function Eo(e,t={}){let{width:n,height:r}=un(e,t),s=await ko(e,t),o=await He(s),a=document.createElement("canvas"),i=a.getContext("2d"),c=t.pixelRatio||ur(),u=t.canvasWidth||n,p=t.canvasHeight||r;return a.width=u*c,a.height=p*c,t.skipAutoScale||br(a),a.style.width=`${u}`,a.style.height=`${p}`,t.backgroundColor&&(i.fillStyle=t.backgroundColor,i.fillRect(0,0,a.width,a.height)),i.drawImage(o,0,0,a.width,a.height),a}async function $r(e,t={}){return(await Eo(e,t)).toDataURL()}function Lo(){let e=document.createElement("div");if(e.style.cssText=`
6
6
  position: fixed; inset: 0; z-index: 2147483647;
7
7
  background: white; opacity: 0;
8
8
  pointer-events: none;
@@ -13,7 +13,7 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
13
13
  15% { opacity: 0.7; }
14
14
  100% { opacity: 0; }
15
15
  }
16
- `,document.head.appendChild(t)}document.body.appendChild(e),e.addEventListener("animationend",()=>e.remove())}var fo=e=>{let t=e.tagName.toLowerCase();return t==="bugstash-root"||t==="bugstash-overlay"||e.classList?.contains("bs-fab")||e.classList?.contains("bs-toolbar")||e.classList?.contains("bs-modal")||e.classList?.contains("bs-backdrop")||e.id==="bs-flash-style"||e.id==="bugstash-live-pins"||e.id==="bugstash-pin-overlay"};async function mn(e=!1){e&&mo();try{let t=await go();if(t)return t}catch{}try{return await Lr()}catch{try{return await Lr(!0)}catch{return null}}}async function go(){if(!navigator.mediaDevices?.getDisplayMedia)return null;let e=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:"browser",width:{ideal:window.screen.width*(window.devicePixelRatio||1)},height:{ideal:window.screen.height*(window.devicePixelRatio||1)}},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",monitorTypeSurfaces:"exclude"});try{if(!e.getVideoTracks()[0])return null;let n=document.createElement("video");n.srcObject=e,n.muted=!0,n.playsInline=!0,await n.play(),await new Promise(o=>{if(n.readyState>=2){o();return}n.onloadeddata=()=>o()}),await new Promise(o=>requestAnimationFrame(()=>o()));let r=document.createElement("canvas");r.width=n.videoWidth,r.height=n.videoHeight;let s=r.getContext("2d");return s?(s.drawImage(n,0,0),r.toDataURL("image/png")):null}finally{e.getTracks().forEach(t=>t.stop())}}async function Lr(e=!1){let t=window.getComputedStyle(document.body).backgroundColor,n=window.getComputedStyle(document.documentElement).backgroundColor,r=i=>!i||i==="transparent"||i==="rgba(0, 0, 0, 0)",s=r(t)?r(n)?"#ffffff":n:t;return await Sr(document.body,{pixelRatio:Math.min(window.devicePixelRatio||1,2),backgroundColor:s,width:window.innerWidth,height:window.innerHeight,filter:i=>{if(e&&i.tagName==="IMG"){let a=i.src||"";if(a&&!a.startsWith(window.location.origin)&&!a.startsWith("data:"))return!1}return!fo(i)},imagePlaceholder:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"})}var ho="https://bugstash-backend.vercel.app",Cr="https://bugstash-backend.vercel.app",X=ho,fn=!1;function Tr(e){X=e.replace(/\/$/,""),fn=!1}function Pr(){return X}async function se(e,t){try{return await fetch(e,t)}catch(n){if(fn)throw n;fn=!0;let r=X;X=Cr;let s=e.replace(r,Cr);return fetch(s,t)}}var gn="bugstash_auth";function hn(){try{let e=localStorage.getItem(gn);if(!e)return null;let t=JSON.parse(e);return t.tokens.expiresAt<Date.now(),t}catch{return null}}function $r(e){localStorage.setItem(gn,JSON.stringify(e))}function yo(){localStorage.removeItem(gn)}function ne(){return hn()?.user||null}function Mr(){return hn()?.tokens.accessToken||null}async function ge(){let e=hn();if(!e)return{"Content-Type":"application/json"};if(e.tokens.expiresAt<Date.now()+6e4)try{let t=await se(`${X}/api/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:e.tokens.refreshToken})});if(t.ok){let n=await t.json();n.success&&(e.tokens=n.data,$r(e))}}catch{}return{"Content-Type":"application/json",Authorization:`Bearer ${e.tokens.accessToken}`}}async function Dt(e,t,n){try{let s=await(await se(`${X}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e,password:t,projectId:n})})).json();return s.success&&$r({user:s.data.user,tokens:s.data.tokens}),s}catch{return{success:!1,error:"Network error"}}}async function Bt(){yo()}async function yn(e){try{let t=await ge();return await(await se(`${X}/api/reports`,{method:"POST",headers:t,body:JSON.stringify(e)})).json()}catch{return{success:!1,error:"Network error - could not reach BugStash"}}}async function Ar(e,t){try{let n=await ge();return await(await se(`${X}/api/pins/by-page?projectId=${e}&pathname=${encodeURIComponent(t)}`,{headers:n})).json()}catch{return{success:!1,error:"Network error"}}}async function xn(e){try{let t=await ge();return await(await se(`${X}/api/pins`,{method:"POST",headers:t,body:JSON.stringify(e)})).json()}catch{return{success:!1,error:"Network error"}}}async function Ot(e,t){try{let n=await ge();return await(await se(`${X}/api/pins/${e}`,{method:"PUT",headers:n,body:JSON.stringify(t)})).json()}catch{return{success:!1,error:"Network error"}}}async function Rr(e){try{let t=await ge();return await(await se(`${X}/api/pins/${e}`,{method:"DELETE",headers:t})).json()}catch{return{success:!1,error:"Network error"}}}async function zr(e){try{let t=await ge();return await(await se(`${X}/api/pins/${e}/comments`,{headers:t})).json()}catch{return{success:!1,error:"Network error"}}}async function vn(e,t,n=[]){try{let r=await ge();return await(await se(`${X}/api/pins/${e}/comments`,{method:"POST",headers:r,body:JSON.stringify({body:t,mentions:n})})).json()}catch{return{success:!1,error:"Network error"}}}async function Ir(e){try{let t=await ge();return await(await se(`${X}/api/members/for-project/${e}`,{headers:t})).json()}catch{return{success:!1,error:"Network error"}}}var Ht=null;function Hr(e){return Ht||(Ht=(async()=>{try{let t=await fetch(`${X}/api/orgs/projects/${encodeURIComponent(e)}/verify-domain`,{headers:{"Content-Type":"application/json"}});return t.ok?(await t.json()).allowed===!0:!1}catch{return!1}})(),Ht)}var wn="bugstash_offline_queue";function kn(e){let t=Dr();t.push({...e,id:Math.random().toString(36).slice(2),timestamp:Date.now()}),localStorage.setItem(wn,JSON.stringify(t))}function Dr(){try{return JSON.parse(localStorage.getItem(wn)||"[]")}catch{return[]}}async function xo(){let e=Dr();if(e.length===0)return 0;let t=0,n=[];for(let r of e)try{let s;switch(r.type){case"create_pin":s=await xn(r.data);break;case"create_comment":s=await vn(r.data.pinId,r.data.body,r.data.mentions);break;case"update_pin":s=await Ot(r.data.pinId,r.data.updates);break;case"submit_report":s=await yn(r.data);break;default:s={success:!1,error:"Unknown action"}}s.success?t++:n.push(r)}catch{n.push(r)}return localStorage.setItem(wn,JSON.stringify(n)),t}typeof window<"u"&&window.addEventListener("online",()=>{xo().catch(()=>{})});var En=[{id:"slate",name:"Slate",preview:["#0f1117","#6E9ED0"],vars:{"--bs-bg":"#0f1117","--bs-bg2":"#1a1d27","--bs-bg3":"#2a2d37","--bs-text":"#e8eaed","--bs-muted":"#9ca3af","--bs-border":"#2a2d37","--bs-accent":"#6E9ED0","--bs-accent2":"#C3CAD6","--bs-fab1":"#6E9ED0","--bs-fab2":"#4a7ba8","--bs-radius":"12px","--bs-radius-sm":"8px","--bs-red":"#ef4444","--bs-green":"#22c55e","--bs-orange":"#f97316","--bs-yellow":"#eab308"}},{id:"black",name:"Dark",preview:["#0a0a0a","#ffffff"],vars:{"--bs-bg":"#0a0a0a","--bs-bg2":"#141414","--bs-bg3":"#1e1e1e","--bs-text":"#f5f5f5","--bs-muted":"#737373","--bs-border":"#262626","--bs-accent":"#f5f5f5","--bs-accent2":"#d4d4d4","--bs-fab1":"#262626","--bs-fab2":"#171717","--bs-radius":"12px","--bs-radius-sm":"8px","--bs-red":"#ef4444","--bs-green":"#22c55e","--bs-orange":"#f97316","--bs-yellow":"#eab308"}},{id:"white",name:"Light",preview:["#ffffff","#0a0a0a"],vars:{"--bs-bg":"#ffffff","--bs-bg2":"#f5f5f5","--bs-bg3":"#e5e5e5","--bs-text":"#0a0a0a","--bs-muted":"#737373","--bs-border":"#e5e5e5","--bs-accent":"#0a0a0a","--bs-accent2":"#404040","--bs-fab1":"#0a0a0a","--bs-fab2":"#262626","--bs-radius":"12px","--bs-radius-sm":"8px","--bs-red":"#dc2626","--bs-green":"#16a34a","--bs-orange":"#ea580c","--bs-yellow":"#ca8a04"}}];function Nt(){return En}function jt(e){return En.find(t=>t.id===e)}function Br(){return En[0]}var Sn=[{id:"classic",name:"Center",description:"Centered modal",tabPosition:"top"},{id:"drawer-right",name:"Right Drawer",description:"Slides from right",tabPosition:"top"},{id:"bottom-sheet",name:"Bottom Sheet",description:"Slides from bottom",tabPosition:"top"},{id:"sidebar-tabs",name:"Sidebar",description:"Side navigation",tabPosition:"left"}];function qt(){return Sn}function ot(e){return Sn.find(t=>t.id===e)}function Or(){return Sn[0]}var Nr=`
16
+ `,document.head.appendChild(t)}document.body.appendChild(e),e.addEventListener("animationend",()=>e.remove())}var So=e=>{let t=e.tagName.toLowerCase();return t==="bugstash-root"||t==="bugstash-overlay"||e.classList?.contains("bs-fab")||e.classList?.contains("bs-toolbar")||e.classList?.contains("bs-modal")||e.classList?.contains("bs-backdrop")||e.id==="bs-flash-style"||e.id==="bugstash-live-pins"||e.id==="bugstash-pin-overlay"};async function yn(e=!1){e&&Lo();try{let t=await Po();if(t)return t}catch{}try{return await Mr()}catch{try{return await Mr(!0)}catch{return null}}}async function Po(){if(!navigator.mediaDevices?.getDisplayMedia)return null;let e=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:"browser",width:{ideal:window.screen.width*(window.devicePixelRatio||1)},height:{ideal:window.screen.height*(window.devicePixelRatio||1)}},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",monitorTypeSurfaces:"exclude"});try{if(!e.getVideoTracks()[0])return null;let n=document.createElement("video");n.srcObject=e,n.muted=!0,n.playsInline=!0,await n.play(),await new Promise(o=>{if(n.readyState>=2){o();return}n.onloadeddata=()=>o()}),await new Promise(o=>requestAnimationFrame(()=>o()));let r=document.createElement("canvas");r.width=n.videoWidth,r.height=n.videoHeight;let s=r.getContext("2d");return s?(s.drawImage(n,0,0),r.toDataURL("image/png")):null}finally{e.getTracks().forEach(t=>t.stop())}}async function Mr(e=!1){let t=window.getComputedStyle(document.body).backgroundColor,n=window.getComputedStyle(document.documentElement).backgroundColor,r=a=>!a||a==="transparent"||a==="rgba(0, 0, 0, 0)",s=r(t)?r(n)?"#ffffff":n:t;return await $r(document.body,{pixelRatio:Math.min(window.devicePixelRatio||1,2),backgroundColor:s,width:window.innerWidth,height:window.innerHeight,filter:a=>{if(e&&a.tagName==="IMG"){let i=a.src||"";if(i&&!i.startsWith(window.location.origin)&&!i.startsWith("data:"))return!1}return!So(a)},imagePlaceholder:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"})}var Co="https://bugstash-backend.vercel.app",Ar="https://bugstash-backend.vercel.app",Y=Co,vn=!1;function Rr(e){Y=e.replace(/\/$/,""),vn=!1}function zr(){return Y}async function oe(e,t){try{return await fetch(e,t)}catch(n){if(vn)throw n;vn=!0;let r=Y;Y=Ar;let s=e.replace(r,Ar);return fetch(s,t)}}var xn="bugstash_auth";function wn(){try{let e=localStorage.getItem(xn);if(!e)return null;let t=JSON.parse(e);return t.tokens.expiresAt<Date.now(),t}catch{return null}}function Ir(e){localStorage.setItem(xn,JSON.stringify(e))}function To(){localStorage.removeItem(xn)}function ie(){return wn()?.user||null}function Hr(){return wn()?.tokens.accessToken||null}async function he(){let e=wn();if(!e)return{"Content-Type":"application/json"};if(e.tokens.expiresAt<Date.now()+6e4)try{let t=await oe(`${Y}/api/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:e.tokens.refreshToken})});if(t.ok){let n=await t.json();n.success&&(e.tokens=n.data,Ir(e))}}catch{}return{"Content-Type":"application/json",Authorization:`Bearer ${e.tokens.accessToken}`}}async function jt(e,t,n){try{let s=await(await oe(`${Y}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e,password:t,projectId:n})})).json();return s.success&&Ir({user:s.data.user,tokens:s.data.tokens}),s}catch{return{success:!1,error:"Network error"}}}async function qt(){To()}async function kn(e){try{let t=await he();return await(await oe(`${Y}/api/reports`,{method:"POST",headers:t,body:JSON.stringify(e)})).json()}catch{return{success:!1,error:"Network error - could not reach BugStash"}}}async function Br(e,t){try{let n=await he();return await(await oe(`${Y}/api/pins/by-page?projectId=${e}&pathname=${encodeURIComponent(t)}`,{headers:n})).json()}catch{return{success:!1,error:"Network error"}}}async function En(e){try{let t=await he();return await(await oe(`${Y}/api/pins`,{method:"POST",headers:t,body:JSON.stringify(e)})).json()}catch{return{success:!1,error:"Network error"}}}async function Ft(e,t){try{let n=await he();return await(await oe(`${Y}/api/pins/${e}`,{method:"PUT",headers:n,body:JSON.stringify(t)})).json()}catch{return{success:!1,error:"Network error"}}}async function Dr(e){try{let t=await he();return await(await oe(`${Y}/api/pins/${e}`,{method:"DELETE",headers:t})).json()}catch{return{success:!1,error:"Network error"}}}async function Or(e){try{let t=await he();return await(await oe(`${Y}/api/pins/${e}/comments`,{headers:t})).json()}catch{return{success:!1,error:"Network error"}}}async function Ln(e,t,n=[]){try{let r=await he();return await(await oe(`${Y}/api/pins/${e}/comments`,{method:"POST",headers:r,body:JSON.stringify({body:t,mentions:n})})).json()}catch{return{success:!1,error:"Network error"}}}async function Nr(e){try{let t=await he();return await(await oe(`${Y}/api/members/for-project/${e}`,{headers:t})).json()}catch{return{success:!1,error:"Network error"}}}var Nt=null;function jr(e){return Nt||(Nt=(async()=>{try{let t=await fetch(`${Y}/api/orgs/projects/${encodeURIComponent(e)}/verify-domain`,{headers:{"Content-Type":"application/json"}});return t.ok?(await t.json()).allowed===!0:!1}catch{return!1}})(),Nt)}var Sn="bugstash_offline_queue";function Pn(e){let t=qr();t.push({...e,id:Math.random().toString(36).slice(2),timestamp:Date.now()}),localStorage.setItem(Sn,JSON.stringify(t))}function qr(){try{return JSON.parse(localStorage.getItem(Sn)||"[]")}catch{return[]}}async function $o(){let e=qr();if(e.length===0)return 0;let t=0,n=[];for(let r of e)try{let s;switch(r.type){case"create_pin":s=await En(r.data);break;case"create_comment":s=await Ln(r.data.pinId,r.data.body,r.data.mentions);break;case"update_pin":s=await Ft(r.data.pinId,r.data.updates);break;case"submit_report":s=await kn(r.data);break;default:s={success:!1,error:"Unknown action"}}s.success?t++:n.push(r)}catch{n.push(r)}return localStorage.setItem(Sn,JSON.stringify(n)),t}typeof window<"u"&&window.addEventListener("online",()=>{$o().catch(()=>{})});var Cn=[{id:"slate",name:"Slate",preview:["#0f1117","#6E9ED0"],vars:{"--bs-bg":"#0f1117","--bs-bg2":"#1a1d27","--bs-bg3":"#2a2d37","--bs-text":"#e8eaed","--bs-muted":"#9ca3af","--bs-border":"#2a2d37","--bs-accent":"#6E9ED0","--bs-accent2":"#C3CAD6","--bs-fab1":"#6E9ED0","--bs-fab2":"#4a7ba8","--bs-radius":"12px","--bs-radius-sm":"8px","--bs-red":"#ef4444","--bs-green":"#22c55e","--bs-orange":"#f97316","--bs-yellow":"#eab308"}},{id:"black",name:"Dark",preview:["#0a0a0a","#ffffff"],vars:{"--bs-bg":"#0a0a0a","--bs-bg2":"#141414","--bs-bg3":"#1e1e1e","--bs-text":"#f5f5f5","--bs-muted":"#737373","--bs-border":"#262626","--bs-accent":"#f5f5f5","--bs-accent2":"#d4d4d4","--bs-fab1":"#262626","--bs-fab2":"#171717","--bs-radius":"12px","--bs-radius-sm":"8px","--bs-red":"#ef4444","--bs-green":"#22c55e","--bs-orange":"#f97316","--bs-yellow":"#eab308"}},{id:"white",name:"Light",preview:["#ffffff","#0a0a0a"],vars:{"--bs-bg":"#ffffff","--bs-bg2":"#f5f5f5","--bs-bg3":"#e5e5e5","--bs-text":"#0a0a0a","--bs-muted":"#737373","--bs-border":"#e5e5e5","--bs-accent":"#0a0a0a","--bs-accent2":"#404040","--bs-fab1":"#0a0a0a","--bs-fab2":"#262626","--bs-radius":"12px","--bs-radius-sm":"8px","--bs-red":"#dc2626","--bs-green":"#16a34a","--bs-orange":"#ea580c","--bs-yellow":"#ca8a04"}}];function Ut(){return Cn}function _t(e){return Cn.find(t=>t.id===e)}function Fr(){return Cn[0]}var Tn=[{id:"classic",name:"Center",description:"Centered modal",tabPosition:"top"},{id:"drawer-right",name:"Right Drawer",description:"Slides from right",tabPosition:"top"},{id:"bottom-sheet",name:"Bottom Sheet",description:"Slides from bottom",tabPosition:"top"},{id:"sidebar-tabs",name:"Sidebar",description:"Side navigation",tabPosition:"left"}];function Wt(){return Tn}function at(e){return Tn.find(t=>t.id===e)}function Ur(){return Tn[0]}var _r=`
17
17
  /* \u2500\u2500 1. Classic (default \u2014 no overrides) \u2500\u2500 */
18
18
 
19
19
  /* \u2500\u2500 2. Drawer Right \u2500\u2500 */
@@ -73,27 +73,70 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
73
73
  }
74
74
  .bs-ly-sidebar-tabs .bs-tab-divider { display: none; }
75
75
  .bs-ly-sidebar-tabs .bs-scroll { flex: 1; }
76
- `;var Ne=null,Ut=0,vo=5e3,Be=new Map,Oe=null,Ft=new Set;function it(e){Oe=e,Ut=Date.now(),wo()}function wo(){Ne||(Ne=setInterval(ko,vo))}async function ko(){if(!Oe)return;let e=Mr();if(e)try{let t=Pr(),n=window.location.pathname,r=await fetch(`${t}/api/pins/poll?projectId=${Oe}&pathname=${encodeURIComponent(n)}&since=${Ut}`,{headers:{Authorization:`Bearer ${e}`}});if(!r.ok)return;let s=await r.json();if(!s.success)return;let o=Array.isArray(s.data)?s.data:s.data?.pins||[];Ut=s.serverTime||s.data?.serverTime||Date.now();for(let i of o)Ft.has(i.id)?jr("pin:updated",{type:"pin:updated",projectId:Oe,data:i,userId:"",timestamp:Date.now()}):(Ft.add(i.id),jr("pin:created",{type:"pin:created",projectId:Oe,data:i,userId:"",timestamp:Date.now()}))}catch{}}function qr(){Ne&&(clearInterval(Ne),Ne=null),Oe=null,Ft.clear(),Ut=0}function at(e,t){return Be.has(e)||Be.set(e,new Set),Be.get(e).add(t),()=>{Be.get(e)?.delete(t)}}function jr(e,t){Be.get(e)?.forEach(n=>n(t)),Be.get("*")?.forEach(n=>n(t))}function Ln(e){Ft=new Set(e)}function Ur(){return Ne!==null}var Yt,_=null,$=null,z=[],Xr=[],je=!1,Ue=null,Eo="",qe=null,_t=null,Tn=[],lt=null,Pn=null,Fr={open:"#f97316",in_progress:"#3b82f6",resolved:"#22c55e",closed:"#6b7280"},Xt={critical:"#ef4444",high:"#f97316",medium:"#eab308",low:"#6b7280"};function ct(e,t){Yt=e,Pn=t,Eo=window.location.pathname,$o(),Gr(),Mo(),Do(),Bo(),So()}function Yr(){Lo(),_?.remove(),_=null,$?.remove(),$=null,Pn=null,z=[]}function Fe(e){return je=e!==void 0?e:!je,$&&$.style.setProperty("display",je?"block":"none","important"),je}function Vt(){return je}function Vr(e){try{let t=document.documentElement.scrollWidth||document.body.scrollWidth||1,n=document.documentElement.scrollHeight||document.body.scrollHeight||1,r=window.scrollX,s=window.scrollY,o=$n(e.elementSelector,e.elementXPath),i=Wt(e)&&e.xPercent>=0&&e.xPercent<=1&&e.yPercent>=0&&e.yPercent<=1;if(i&&o){let a=o.getBoundingClientRect();if(a.width>0&&a.height>0){let d=a.left+e.xPercent*a.width,p=a.top+e.yPercent*a.height;return{left:`${d}px`,top:`${p}px`}}}if(i)return e.pageX>0||e.pageY>0?{left:`${e.pageX-r}px`,top:`${e.pageY-s}px`}:{left:`${e.xPercent*t-r}px`,top:`${e.yPercent*n-s}px`};if(o){let a=o.getBoundingClientRect();if(a.width>0&&a.height>0){if(e.pageX>0||e.pageY>0){let d=Wt(e)?e.xPercent/100*t:e.pageX,p=Wt(e)?e.yPercent/100*n:e.pageY,b=a.left+a.width/2,y=a.top+a.height/2,w=d-r,k=p-s;return Math.abs(w-b)+Math.abs(k-y)>100?{left:`${b}px`,top:`${y}px`}:{left:`${w}px`,top:`${k}px`}}return{left:`${a.left+a.width/2}px`,top:`${a.top+a.height/2}px`}}}return Wt(e)?{left:`${e.xPercent/100*t-r}px`,top:`${e.yPercent/100*n-s}px`}:{left:`${e.pageX-r}px`,top:`${e.pageY-s}px`}}catch{let t=(e.pageX||0)-(window.scrollX||0),n=(e.pageY||0)-(window.scrollY||0);return{left:`${t}px`,top:`${n}px`}}}function Wt(e){return e.xPercent!=null&&e.yPercent!=null&&(e.xPercent!==0||e.yPercent!==0||e.pageX===0&&e.pageY===0)}function $n(e,t){let n;if(e&&e.startsWith('["')&&e.endsWith('"]'))try{let r=JSON.parse(e);n=Array.isArray(r)?r.filter(s=>typeof s=="string"):[e]}catch{n=[e]}else n=e?[e]:[];for(let r of n)if(r&&r!=="body")try{let s=document.querySelector(r);if(s)return s}catch{}if(t)try{let r=document.evaluate(t,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null);if(r.singleNodeValue instanceof Element)return r.singleNodeValue}catch{}return null}function So(){window.addEventListener("scroll",ke,{passive:!0}),window.addEventListener("resize",ke,{passive:!0}),window.addEventListener("keydown",Jr),_t=new MutationObserver(e=>{e.every(n=>_?.contains(n.target)||$?.contains(n.target))||ke()}),_t.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class"]}),typeof ResizeObserver<"u"&&(lt=new ResizeObserver(()=>ke()))}function Lo(){window.removeEventListener("scroll",ke),window.removeEventListener("resize",ke),window.removeEventListener("keydown",Jr),Kr(),_t?.disconnect(),_t=null,lt?.disconnect(),lt=null,qe&&(cancelAnimationFrame(qe),qe=null)}function Jr(e){e.key==="Escape"&&(Ue?he():je&&(_?.querySelectorAll(".bs-lp-form").forEach(t=>t.remove()),Fe(!1)))}function ke(){qe||(qe=requestAnimationFrame(()=>{qe=null,Co()}))}function Co(){if(!_)return;_.querySelectorAll(".bs-lp").forEach(t=>{let n=t.dataset.pinId,r=z.find(o=>o.id===n);if(!r)return;let s=Vr(r);t.style.left=s.left,t.style.top=s.top})}function To(e){let t=[],n=e.parentElement;for(;n&&n!==document.documentElement;){let r=window.getComputedStyle(n),s=r.overflowY,o=r.overflowX;(s==="auto"||s==="scroll"||o==="auto"||o==="scroll")&&(n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)&&t.push(n),n=n.parentElement}return t}function Po(){Kr();let e=new Set;for(let t of z){let n=$n(t.elementSelector,t.elementXPath);if(!n)continue;let r=To(n);for(let s of r){if(e.has(s))continue;e.add(s);let o=()=>ke();s.addEventListener("scroll",o,{passive:!0}),Tn.push(()=>s.removeEventListener("scroll",o))}}}function Kr(){for(let e of Tn)e();Tn=[]}function $o(){if(_)return;_=document.createElement("div"),_.id="bugstash-live-pins",$=document.createElement("bugstash-overlay"),$.style.setProperty("display","none","important"),$.style.setProperty("position","fixed","important"),$.style.setProperty("inset","0","important"),$.style.setProperty("z-index","2147483641","important"),$.style.setProperty("cursor","crosshair","important"),$.style.setProperty("background","rgba(0,0,0,0.05)","important"),$.style.setProperty("margin","0","important"),$.style.setProperty("padding","0","important"),$.style.setProperty("border","none","important"),$.style.setProperty("opacity","1","important"),$.style.setProperty("visibility","visible","important"),$.style.setProperty("pointer-events","auto","important");let e=document.createElement("style");e.textContent=`
76
+ `;var qe=null,Xt=0,Mo=5e3,Ne=new Map,je=null,Yt=new Set;function lt(e){je=e,Xt=Date.now(),Ao()}function Ao(){qe||(qe=setInterval(Ro,Mo))}async function Ro(){if(!je)return;let e=Hr();if(e)try{let t=zr(),n=window.location.pathname,r=await fetch(`${t}/api/pins/poll?projectId=${je}&pathname=${encodeURIComponent(n)}&since=${Xt}`,{headers:{Authorization:`Bearer ${e}`}});if(!r.ok)return;let s=await r.json();if(!s.success)return;let o=Array.isArray(s.data)?s.data:s.data?.pins||[];Xt=s.serverTime||s.data?.serverTime||Date.now();for(let a of o)Yt.has(a.id)?Wr("pin:updated",{type:"pin:updated",projectId:je,data:a,userId:"",timestamp:Date.now()}):(Yt.add(a.id),Wr("pin:created",{type:"pin:created",projectId:je,data:a,userId:"",timestamp:Date.now()}))}catch{}}function Xr(){qe&&(clearInterval(qe),qe=null),je=null,Yt.clear(),Xt=0}function ct(e,t){return Ne.has(e)||Ne.set(e,new Set),Ne.get(e).add(t),()=>{Ne.get(e)?.delete(t)}}function Wr(e,t){Ne.get(e)?.forEach(n=>n(t)),Ne.get("*")?.forEach(n=>n(t))}function $n(e){Yt=new Set(e)}function Yr(){return qe!==null}var Gt,X=null,E=null,P=[],Qr=[],Fe=!1,_e=null,zo="",Ue=null,Jt=null,An=[],dt=null,pt=null,Ee={x:0,y:0};function Zr(){if(!pt)return;let e=document.createElement("div");e.style.cssText="position:fixed!important;top:0!important;left:0!important;width:1px!important;height:1px!important;pointer-events:none!important;visibility:hidden!important;z-index:-1!important;opacity:0!important;",pt.appendChild(e);try{let t=e.getBoundingClientRect();Ee={x:-t.left,y:-t.top}}finally{e.remove()}}function es(e){return Ee.x===0&&Ee.y===0?e:{left:`${parseFloat(e.left)+Ee.x}px`,top:`${parseFloat(e.top)+Ee.y}px`,hidden:e.hidden}}function Vr(e,t){return{left:`${e+Ee.x}px`,top:`${t+Ee.y}px`}}var Jr={open:"#f97316",in_progress:"#3b82f6",resolved:"#22c55e",closed:"#6b7280"},Kt={critical:"#ef4444",high:"#f97316",medium:"#eab308",low:"#6b7280"};function ut(e,t){Gt=e,pt=t,zo=window.location.pathname,jo(),Zr(),os(),qo(),Yo(),Vo(),Ho()}function ts(){Bo(),X?.remove(),X=null,E?.remove(),E=null,pt=null,P=[]}function We(e){return Fe=e!==void 0?e:!Fe,E&&E.style.setProperty("display",Fe?"block":"none","important"),Fe}function Qt(){return Fe}function ns(e){try{let t=document.documentElement.scrollWidth||document.body.scrollWidth||1,n=document.documentElement.scrollHeight||document.body.scrollHeight||1,r=window.scrollX,s=window.scrollY,o=Rn(e.elementSelector,e.elementXPath),a=Vt(e)&&e.xPercent>=0&&e.xPercent<=1&&e.yPercent>=0&&e.yPercent<=1,i=o?Io(o):!1;if(a&&o){let c=o.getBoundingClientRect();if(c.width>0&&c.height>0){let u=c.left+e.xPercent*c.width,p=c.top+e.yPercent*c.height;return{left:`${u}px`,top:`${p}px`,hidden:i}}}if(a)return e.pageX>0||e.pageY>0?{left:`${e.pageX-r}px`,top:`${e.pageY-s}px`,hidden:!1}:{left:`${e.xPercent*t-r}px`,top:`${e.yPercent*n-s}px`,hidden:!1};if(o){let c=o.getBoundingClientRect();if(c.width>0&&c.height>0){if(e.pageX>0||e.pageY>0){let u=Vt(e)?e.xPercent/100*t:e.pageX,p=Vt(e)?e.yPercent/100*n:e.pageY,f=c.left+c.width/2,w=c.top+c.height/2,S=u-r,M=p-s;return Math.abs(S-f)+Math.abs(M-w)>100?{left:`${f}px`,top:`${w}px`,hidden:i}:{left:`${S}px`,top:`${M}px`,hidden:i}}return{left:`${c.left+c.width/2}px`,top:`${c.top+c.height/2}px`,hidden:i}}}return Vt(e)?{left:`${e.xPercent/100*t-r}px`,top:`${e.yPercent/100*n-s}px`,hidden:!1}:{left:`${e.pageX-r}px`,top:`${e.pageY-s}px`,hidden:!1}}catch{let t=(e.pageX||0)-(window.scrollX||0),n=(e.pageY||0)-(window.scrollY||0);return{left:`${t}px`,top:`${n}px`,hidden:!1}}}function Vt(e){return e.xPercent!=null&&e.yPercent!=null&&(e.xPercent!==0||e.yPercent!==0||e.pageX===0&&e.pageY===0)}function Rn(e,t){let n;if(e&&e.startsWith('["')&&e.endsWith('"]'))try{let r=JSON.parse(e);n=Array.isArray(r)?r.filter(s=>typeof s=="string"):[e]}catch{n=[e]}else n=e?[e]:[];for(let r of n)if(r&&r!=="body")try{let s=document.querySelector(r);if(s)return s}catch{}if(t)try{let r=document.evaluate(t,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null);if(r.singleNodeValue instanceof Element)return r.singleNodeValue}catch{}return null}function Io(e){let t=e.getBoundingClientRect();if(t.bottom<=0||t.top>=window.innerHeight||t.right<=0||t.left>=window.innerWidth)return!0;let n=e.parentElement;for(;n&&n!==document.documentElement;){let r=window.getComputedStyle(n),s=r.overflowY,o=r.overflowX;if(s==="hidden"||s==="scroll"||s==="auto"||o==="hidden"||o==="scroll"||o==="auto"){let a=n.getBoundingClientRect();if(t.bottom<=a.top||t.top>=a.bottom||t.right<=a.left||t.left>=a.right)return!0}n=n.parentElement}return!1}function Ho(){window.addEventListener("scroll",Le,{passive:!0}),window.addEventListener("resize",Le,{passive:!0}),window.addEventListener("keydown",rs),Jt=new MutationObserver(e=>{e.every(n=>X?.contains(n.target)||E?.contains(n.target))||Le()}),Jt.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class"]}),typeof ResizeObserver<"u"&&(dt=new ResizeObserver(()=>Le()))}function Bo(){window.removeEventListener("scroll",Le),window.removeEventListener("resize",Le),window.removeEventListener("keydown",rs),ss(),Jt?.disconnect(),Jt=null,dt?.disconnect(),dt=null,Ue&&(cancelAnimationFrame(Ue),Ue=null)}function rs(e){e.key==="Escape"&&(_e?ye():Fe&&(X?.querySelectorAll(".bs-lp-form").forEach(t=>t.remove()),We(!1)))}function Le(){Ue||(Ue=requestAnimationFrame(()=>{Ue=null,Zr(),Do()}))}function Do(){if(!X)return;X.querySelectorAll(".bs-lp").forEach(t=>{let n=t.dataset.pinId,r=P.find(o=>o.id===n);if(!r)return;let s=es(ns(r));t.style.left=s.left,t.style.top=s.top,t.style.display=s.hidden?"none":""})}function Oo(e){let t=[],n=e.parentElement;for(;n&&n!==document.documentElement;){let r=window.getComputedStyle(n),s=r.overflowY,o=r.overflowX;(s==="auto"||s==="scroll"||o==="auto"||o==="scroll")&&(n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)&&t.push(n),n=n.parentElement}return t}function No(){ss();let e=new Set;for(let t of P){let n=Rn(t.elementSelector,t.elementXPath);if(!n)continue;let r=Oo(n);for(let s of r){if(e.has(s))continue;e.add(s);let o=()=>Le();s.addEventListener("scroll",o,{passive:!0}),An.push(()=>s.removeEventListener("scroll",o))}}}function ss(){for(let e of An)e();An=[]}function jo(){if(X)return;X=document.createElement("div"),X.id="bugstash-live-pins",E=document.createElement("bugstash-overlay"),E.style.setProperty("display","none","important"),E.style.setProperty("position","fixed","important"),E.style.setProperty("inset","0","important"),E.style.setProperty("z-index","2147483641","important"),E.style.setProperty("cursor","crosshair","important"),E.style.setProperty("background","rgba(0,0,0,0.05)","important"),E.style.setProperty("margin","0","important"),E.style.setProperty("padding","0","important"),E.style.setProperty("border","none","important"),E.style.setProperty("opacity","1","important"),E.style.setProperty("visibility","visible","important"),E.style.setProperty("pointer-events","auto","important"),E.style.setProperty("transform","none","important"),E.style.setProperty("filter","none","important"),E.style.setProperty("perspective","none","important"),E.style.setProperty("will-change","auto","important"),E.style.setProperty("contain","none","important"),E.style.setProperty("clip-path","none","important"),E.style.setProperty("isolation","auto","important"),E.style.setProperty("mix-blend-mode","normal","important"),E.style.setProperty("box-sizing","border-box","important"),E.style.setProperty("overflow","visible","important"),E.style.setProperty("float","none","important");let e=document.createElement("style");e.textContent=`
77
+ /* \u2500\u2500\u2500 Isolation Reset \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
78
+ /* Kill ALL inherited properties from the host application.
79
+ Shadow DOM blocks selector-based styles but NOT inheritance.
80
+ font-family, color, direction, line-height, text-align, visibility,
81
+ cursor, letter-spacing, word-spacing, text-transform, white-space,
82
+ etc. all inherit through the shadow boundary. */
83
+ :host {
84
+ all: initial !important;
85
+ position: fixed !important;
86
+ inset: 0 !important;
87
+ pointer-events: none !important;
88
+ z-index: 2147483640 !important;
89
+ display: block !important;
90
+ visibility: visible !important;
91
+ opacity: 1 !important;
92
+ /* Prevent this host from becoming a containing block */
93
+ transform: none !important;
94
+ perspective: none !important;
95
+ filter: none !important;
96
+ will-change: auto !important;
97
+ contain: none !important;
98
+ isolation: auto !important;
99
+ }
100
+ /* Hard reset for every element inside the shadow root */
101
+ *, *::before, *::after {
102
+ box-sizing: border-box !important;
103
+ margin: 0;
104
+ padding: 0;
105
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
106
+ line-height: 1.5;
107
+ color: #e8eaed;
108
+ direction: ltr;
109
+ text-align: left;
110
+ -webkit-text-size-adjust: 100%;
111
+ -webkit-font-smoothing: antialiased;
112
+ -moz-osx-font-smoothing: grayscale;
113
+ }
77
114
  #bugstash-live-pins {
78
- position: fixed;
79
- top: 0;
80
- left: 0;
81
- width: 0;
82
- height: 0;
83
- overflow: visible;
84
- z-index: 2147483640;
85
- pointer-events: none;
115
+ position: fixed !important;
116
+ top: 0 !important;
117
+ left: 0 !important;
118
+ width: 0 !important;
119
+ height: 0 !important;
120
+ overflow: visible !important;
121
+ z-index: 2147483640 !important;
122
+ pointer-events: none !important;
123
+ /* Ensure this container never creates a containing block */
124
+ transform: none !important;
125
+ perspective: none !important;
126
+ filter: none !important;
127
+ will-change: auto !important;
128
+ contain: none !important;
86
129
  }
87
130
  /* \u2500\u2500 Pin Marker \u2500\u2500 */
88
131
  .bs-lp {
89
- position: fixed;
90
- pointer-events: auto;
91
- cursor: pointer;
92
- transform: translate(-50%, -50%);
132
+ position: fixed !important;
133
+ pointer-events: auto !important;
134
+ cursor: pointer !important;
135
+ transform: translate(-50%, -50%) !important;
93
136
  z-index: 1;
94
137
  transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1);
95
138
  }
96
- .bs-lp:hover { transform: translate(-50%, -50%) scale(1.2); z-index: 5; }
139
+ .bs-lp:hover { transform: translate(-50%, -50%) scale(1.2) !important; z-index: 5; }
97
140
  .bs-lp-dot {
98
141
  width: 24px;
99
142
  height: 24px;
@@ -352,21 +395,21 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
352
395
  color: #9ca3af;
353
396
  }
354
397
  .bs-lp-form-cancel:hover { background: rgba(255,255,255,0.1); }
355
- `,_.appendChild(e),Pn.appendChild(_),document.body.appendChild($),$.addEventListener("click",t=>{let n=t.clientX,r=t.clientY,s=null;try{$.style.setProperty("pointer-events","none","important"),s=document.elementFromPoint(n,r)}finally{$.style.setProperty("pointer-events","auto","important")}let o=n+window.scrollX,i=r+window.scrollY,a,d;if(s&&s!==document.body&&s!==document.documentElement){let p=s.getBoundingClientRect();if(p.width>0&&p.height>0)a=(n-p.left)/p.width,d=(r-p.top)/p.height;else{let b=document.documentElement.scrollWidth||document.body.scrollWidth||1,y=document.documentElement.scrollHeight||document.body.scrollHeight||1;a=o/b*100,d=i/y*100}}else{let p=document.documentElement.scrollWidth||document.body.scrollWidth||1,b=document.documentElement.scrollHeight||document.body.scrollHeight||1;a=o/p*100,d=i/b*100}Ho(o,i,a,d,n,r,s)})}async function Gr(){let e=await Ar(Yt,window.location.pathname);e.success&&e.data&&(z=e.data,Ln(z.map(t=>t.id)),pe())}async function Mo(){let e=await Ir(Yt);e.success&&e.data&&(Xr=e.data)}function pe(){if(_){_.querySelectorAll(".bs-lp").forEach(e=>e.remove()),z.forEach((e,t)=>{let n=document.createElement("div");n.className="bs-lp",n.dataset.pinId=e.id;let r=Vr(e);n.style.left=r.left,n.style.top=r.top;let s=Xt[e.priority]||Xt.medium;n.innerHTML=`
398
+ `,X.appendChild(e),pt.appendChild(X),document.body.appendChild(E),E.addEventListener("click",t=>{let n=t.clientX,r=t.clientY,s=null;try{E.style.setProperty("pointer-events","none","important"),s=document.elementFromPoint(n,r)}finally{E.style.setProperty("pointer-events","auto","important")}let o=n+window.scrollX,a=r+window.scrollY,i,c;if(s&&s!==document.body&&s!==document.documentElement){let u=s.getBoundingClientRect();if(u.width>0&&u.height>0)i=(n-u.left)/u.width,c=(r-u.top)/u.height;else{let p=document.documentElement.scrollWidth||document.body.scrollWidth||1,f=document.documentElement.scrollHeight||document.body.scrollHeight||1;i=o/p*100,c=a/f*100}}else{let u=document.documentElement.scrollWidth||document.body.scrollWidth||1,p=document.documentElement.scrollHeight||document.body.scrollHeight||1;i=o/u*100,c=a/p*100}Xo(o,a,i,c,n,r,s)})}async function os(){let e=await Br(Gt,window.location.pathname);e.success&&e.data&&(P=e.data,$n(P.map(t=>t.id)),be())}async function qo(){let e=await Nr(Gt);e.success&&e.data&&(Qr=e.data)}function be(){if(X){X.querySelectorAll(".bs-lp").forEach(e=>e.remove()),P.forEach((e,t)=>{let n=document.createElement("div");n.className="bs-lp",n.dataset.pinId=e.id;let r=es(ns(e));n.style.left=r.left,n.style.top=r.top,r.hidden&&(n.style.display="none");let s=Kt[e.priority]||Kt.medium;n.innerHTML=`
356
399
  <div class="bs-lp-dot" style="background:${s};color:${s}">
357
400
  ${t+1}
358
401
  <span class="bs-lp-ring"></span>
359
402
  </div>
360
- `,n.addEventListener("click",o=>{o.stopPropagation(),Ao(e,n)}),_.appendChild(n)}),Po(),lt?.disconnect();for(let e of z){let t=$n(e.elementSelector,e.elementXPath);t&&lt?.observe(t)}}}function Wr(e){let t=typeof e=="string"?new Date(e).getTime():e;if(isNaN(t))return"";let n=Date.now()-t,r=Math.floor(n/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;let s=Math.floor(r/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`}function _r(e){requestAnimationFrame(()=>{let t=e.getBoundingClientRect(),n=16;t.right>window.innerWidth-n&&(e.style.left="auto",e.style.right="34px"),t.left<n&&(e.style.left=`${n}px`,e.style.right="auto");let r=e.getBoundingClientRect();r.bottom>window.innerHeight-n&&(e.style.top="auto",e.style.bottom="0"),r.top<n&&(e.style.top=`${n}px`,e.style.bottom="auto")})}async function Ao(e,t){he();let n=document.createElement("div");n.className="bs-lp-popup";let r=ne(),s=r&&(r.role==="owner"||r.role==="admin"||r.id===e.createdBy),o=Fr[e.status]||Fr.open,i=Xt[e.priority]||Xt.medium,a=e.priority?e.priority.charAt(0).toUpperCase()+e.priority.slice(1):"Medium";n.innerHTML=`
403
+ `,n.addEventListener("click",o=>{o.stopPropagation(),Fo(e,n)}),X.appendChild(n)}),No(),dt?.disconnect();for(let e of P){let t=Rn(e.elementSelector,e.elementXPath);t&&dt?.observe(t)}}}function Kr(e){let t=typeof e=="string"?new Date(e).getTime():e;if(isNaN(t))return"";let n=Date.now()-t,r=Math.floor(n/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;let s=Math.floor(r/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`}function Gr(e){requestAnimationFrame(()=>{let t=e.getBoundingClientRect(),n=16,r=0,s=0;if(t.right>window.innerWidth-n&&(r=window.innerWidth-n-t.right),t.left+r<n&&(r=n-t.left),t.bottom>window.innerHeight-n&&(s=window.innerHeight-n-t.bottom),t.top+s<n&&(s=n-t.top),r!==0||s!==0){let o=parseFloat(e.style.left)||0,a=parseFloat(e.style.top)||0;e.style.left=`${o+r}px`,e.style.top=`${a+s}px`,e.style.right="auto",e.style.bottom="auto"}})}async function Fo(e,t){ye();let n=document.createElement("div");n.className="bs-lp-popup";let r=ie(),s=e.createdBy||e.createdById,o=r&&(r.role==="owner"||r.role==="admin"||r.id===s),a=Jr[e.status]||Jr.open,i=Kt[e.priority]||Kt.medium,c=e.priority?e.priority.charAt(0).toUpperCase()+e.priority.slice(1):"Medium";n.innerHTML=`
361
404
  <div class="bs-lp-popup-hdr">
362
- <div class="bs-lp-popup-title">${de(e.title)}</div>
363
- <span class="bs-lp-popup-badge" style="background:${i}18;color:${i}">${a}</span>
364
- <span class="bs-lp-popup-badge" style="background:${o}18;color:${o}">${e.status.replace("_"," ")}</span>
405
+ <div class="bs-lp-popup-title">${ue(e.title)}</div>
406
+ <span class="bs-lp-popup-badge" style="background:${i}18;color:${i}">${c}</span>
407
+ <span class="bs-lp-popup-badge" style="background:${a}18;color:${a}">${e.status.replace("_"," ")}</span>
365
408
  <button class="bs-lp-popup-close">&times;</button>
366
409
  </div>
367
- ${e.description?`<div class="bs-lp-popup-desc">${de(e.description)}</div>`:""}
410
+ ${e.description?`<div class="bs-lp-popup-desc">${ue(e.description)}</div>`:""}
368
411
  <div class="bs-lp-popup-info">
369
- <span>${e.creatorName||"Unknown"} &middot; ${Wr(e.createdAt)}</span>
412
+ <span>${e.creatorName||"Unknown"} &middot; ${Kr(e.createdAt)}</span>
370
413
  <span>${e.assigneeName?`\u2192 ${e.assigneeName}`:"Unassigned"}</span>
371
414
  </div>
372
415
  <div class="bs-lp-cmts" id="bs-lp-cmts">
@@ -378,25 +421,25 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
378
421
  </div>
379
422
  <div class="bs-lp-acts">
380
423
  ${e.status!=="resolved"?'<button class="bs-lp-act resolve" id="bs-lp-resolve">Resolve</button>':'<button class="bs-lp-act" id="bs-lp-reopen">Reopen</button>'}
381
- ${s?'<button class="bs-lp-act delete" id="bs-lp-delete">Delete</button>':""}
424
+ ${o?'<button class="bs-lp-act delete" id="bs-lp-delete">Delete</button>':""}
382
425
  </div>
383
- `,t.appendChild(n),Ue=n,zr(e.id).then(p=>{let b=n.querySelector("#bs-lp-cmts");if(!b)return;let y=p.success&&p.data?p.data:[];b.innerHTML=y.length?y.map(w=>`
426
+ `,t.appendChild(n),_e=n,Or(e.id).then(p=>{let f=n.querySelector("#bs-lp-cmts");if(!f)return;let w=p.success&&p.data?p.data:[];f.innerHTML=w.length?w.map(S=>`
384
427
  <div class="bs-lp-cmt">
385
428
  <div class="bs-lp-cmt-top">
386
- <span class="bs-lp-cmt-author">${de(w.author?.name||w.authorName||"Unknown")}</span>
387
- <span class="bs-lp-cmt-time">${Wr(new Date(w.createdAt).getTime())}</span>
429
+ <span class="bs-lp-cmt-author">${ue(S.author?.name||S.authorName||"Unknown")}</span>
430
+ <span class="bs-lp-cmt-time">${Kr(new Date(S.createdAt).getTime())}</span>
388
431
  </div>
389
- <div class="bs-lp-cmt-body">${de(w.body)}</div>
432
+ <div class="bs-lp-cmt-body">${ue(S.body)}</div>
390
433
  </div>
391
- `).join(""):"",_r(n)}),_r(n),n.querySelector(".bs-lp-popup-close").addEventListener("click",p=>{p.stopPropagation(),he()}),n.querySelector("#bs-lp-cmt-send")?.addEventListener("click",async()=>{let p=n.querySelector("#bs-lp-cmt-in"),b=p.value.trim();if(b)if(p.value="",navigator.onLine){let y=await vn(e.id,b);if(y.success&&y.data){let w=n.querySelector("#bs-lp-cmts"),k=y.data;w.innerHTML+=`
434
+ `).join(""):"",Gr(n)}),Gr(n),n.querySelector(".bs-lp-popup-close").addEventListener("click",p=>{p.stopPropagation(),ye()}),n.querySelector("#bs-lp-cmt-send")?.addEventListener("click",async()=>{let p=n.querySelector("#bs-lp-cmt-in"),f=p.value.trim();if(f)if(p.value="",navigator.onLine){let w=await Ln(e.id,f);if(w.success&&w.data){let S=n.querySelector("#bs-lp-cmts"),M=w.data;S.innerHTML+=`
392
435
  <div class="bs-lp-cmt">
393
436
  <div class="bs-lp-cmt-top">
394
- <span class="bs-lp-cmt-author">${de(k.authorName||r?.name||"You")}</span>
437
+ <span class="bs-lp-cmt-author">${ue(M.authorName||r?.name||"You")}</span>
395
438
  <span class="bs-lp-cmt-time">just now</span>
396
439
  </div>
397
- <div class="bs-lp-cmt-body">${de(k.body)}</div>
440
+ <div class="bs-lp-cmt-body">${ue(M.body)}</div>
398
441
  </div>
399
- `,w.scrollTop=w.scrollHeight}}else kn({type:"create_comment",data:{pinId:e.id,body:b}})}),n.querySelector("#bs-lp-cmt-in")?.addEventListener("keydown",p=>{p.key==="Enter"&&n.querySelector("#bs-lp-cmt-send")?.dispatchEvent(new Event("click"))}),n.querySelector("#bs-lp-resolve")?.addEventListener("click",async()=>{await Ot(e.id,{status:"resolved"}),e.status="resolved",he(),pe()}),n.querySelector("#bs-lp-reopen")?.addEventListener("click",async()=>{await Ot(e.id,{status:"open"}),e.status="open",he(),pe()});let d=!1;n.querySelector("#bs-lp-delete")?.addEventListener("click",async()=>{d||confirm("Delete this pin?")&&(d=!0,await Rr(e.id),z=z.filter(p=>p.id!==e.id),he(),pe())}),n.addEventListener("click",p=>p.stopPropagation())}function he(){Ue?.remove(),Ue=null}var Cn=e=>e?typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/([!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g,"\\$1"):"";function Ro(e){if(!e||e===document.body||e===document.documentElement)return["body"];let t=[];for(let r of["data-testid","data-test-id","data-cy"]){let s=e.getAttribute(r);if(s){t.push(`[${r}="${Cn(s)}"]`);break}}if(e.id)try{let r=`#${Cn(e.id)}`;document.querySelectorAll(r).length===1&&t.push(r)}catch{}let n=e.getAttribute("aria-label");if(n){let r=`${e.tagName.toLowerCase()}[aria-label="${Cn(n)}"]`;try{document.querySelectorAll(r).length===1&&t.push(r)}catch{}}return t.push(zo(e)),t}function zo(e){let t=[],n=e;for(;n&&n!==document.body&&n!==document.documentElement;){let r=n,s=r.parentElement;if(!s)break;let o=r.tagName.toLowerCase(),i=Array.from(s.children).filter(a=>a.tagName===r.tagName);i.length>1&&(o+=`:nth-of-type(${i.indexOf(r)+1})`),t.unshift(o),n=s}return t.join(" > ")}function Io(e){if(!e)return"";let t=[],n=e;for(;n&&n!==document.body;){let r=1,s=n.previousElementSibling;for(;s;)s.tagName===n.tagName&&r++,s=s.previousElementSibling;t.unshift(`${n.tagName.toLowerCase()}[${r}]`),n=n.parentElement}return"/body/"+t.join("/")}function Ho(e,t,n,r,s,o,i){he(),_?.querySelectorAll(".bs-lp-form").forEach(k=>k.remove());let a=document.createElement("div");a.className="bs-lp-form";let d=Math.min(300,window.innerWidth-32),p=16,b=s+p,y=o-8;b+d>window.innerWidth-p&&(b=s-d-p),b<p&&(b=p),a.style.left=`${b}px`,a.style.top=`${y}px`,requestAnimationFrame(()=>{let k=a.getBoundingClientRect();k.bottom>window.innerHeight-p&&(a.style.top=`${Math.max(p,o-k.height)}px`)});let w=Xr.filter(k=>k.userId!==ne()?.id).map(k=>`<option value="${k.userId}">${de(k.name)}</option>`).join("");a.innerHTML=`
442
+ `,S.scrollTop=S.scrollHeight}}else Pn({type:"create_comment",data:{pinId:e.id,body:f}})}),n.querySelector("#bs-lp-cmt-in")?.addEventListener("keydown",p=>{p.key==="Enter"&&n.querySelector("#bs-lp-cmt-send")?.dispatchEvent(new Event("click"))}),n.querySelector("#bs-lp-resolve")?.addEventListener("click",async()=>{await Ft(e.id,{status:"resolved"});let p=P.findIndex(f=>f.id===e.id);p>=0&&(P=P.map((f,w)=>w===p?{...f,status:"resolved"}:f)),ye(),be()}),n.querySelector("#bs-lp-reopen")?.addEventListener("click",async()=>{await Ft(e.id,{status:"open"});let p=P.findIndex(f=>f.id===e.id);p>=0&&(P=P.map((f,w)=>w===p?{...f,status:"open"}:f)),ye(),be()});let u=!1;n.querySelector("#bs-lp-delete")?.addEventListener("click",async()=>{u||confirm("Delete this pin?")&&(u=!0,await Dr(e.id),P=P.filter(p=>p.id!==e.id),ye(),be())}),n.addEventListener("click",p=>p.stopPropagation())}function ye(){_e?.remove(),_e=null}var Mn=e=>e?typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/([!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g,"\\$1"):"";function Uo(e){if(!e||e===document.body||e===document.documentElement)return["body"];let t=[];for(let r of["data-testid","data-test-id","data-cy"]){let s=e.getAttribute(r);if(s){t.push(`[${r}="${Mn(s)}"]`);break}}if(e.id)try{let r=`#${Mn(e.id)}`;document.querySelectorAll(r).length===1&&t.push(r)}catch{}let n=e.getAttribute("aria-label");if(n){let r=`${e.tagName.toLowerCase()}[aria-label="${Mn(n)}"]`;try{document.querySelectorAll(r).length===1&&t.push(r)}catch{}}return t.push(_o(e)),t}function _o(e){let t=[],n=e;for(;n&&n!==document.body&&n!==document.documentElement;){let r=n,s=r.parentElement;if(!s)break;let o=r.tagName.toLowerCase(),a=Array.from(s.children).filter(i=>i.tagName===r.tagName);a.length>1&&(o+=`:nth-of-type(${a.indexOf(r)+1})`),t.unshift(o),n=s}return t.join(" > ")}function Wo(e){if(!e)return"";let t=[],n=e;for(;n&&n!==document.body;){let r=1,s=n.previousElementSibling;for(;s;)s.tagName===n.tagName&&r++,s=s.previousElementSibling;t.unshift(`${n.tagName.toLowerCase()}[${r}]`),n=n.parentElement}return"/body/"+t.join("/")}function Xo(e,t,n,r,s,o,a){ye(),X?.querySelectorAll(".bs-lp-form").forEach(M=>M.remove());let i=document.createElement("div");i.className="bs-lp-form";let c=Math.min(300,window.innerWidth-32),u=16,p=s+u,f=o-8;p+c>window.innerWidth-u&&(p=s-c-u),p<u&&(p=u);let w=Vr(p,f);i.style.left=w.left,i.style.top=w.top,requestAnimationFrame(()=>{let M=i.getBoundingClientRect();if(M.bottom>window.innerHeight-u){let re=Vr(p,Math.max(u,o-M.height));i.style.top=re.top}});let S=Qr.filter(M=>M.userId!==ie()?.id).map(M=>`<option value="${M.userId}">${ue(M.name)}</option>`).join("");i.innerHTML=`
400
443
  <label class="bs-lp-form-label">Title *</label>
401
444
  <input type="text" id="bs-np-title" name="pin-title" placeholder="What's the issue?" autofocus />
402
445
  <label class="bs-lp-form-label">Description</label>
@@ -416,26 +459,26 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
416
459
  <option value="content">Content</option>
417
460
  <option value="other" selected>Other</option>
418
461
  </select>
419
- ${w?`
462
+ ${S?`
420
463
  <label class="bs-lp-form-label">Assign to</label>
421
464
  <select id="bs-np-assignee" name="pin-assignee">
422
465
  <option value="">Unassigned</option>
423
- ${w}
466
+ ${S}
424
467
  </select>
425
468
  `:""}
426
469
  <div class="bs-lp-form-btns">
427
470
  <button class="bs-lp-form-cancel" id="bs-np-cancel">Cancel</button>
428
471
  <button class="bs-lp-form-submit" id="bs-np-submit">Create Pin</button>
429
472
  </div>
430
- `,_.appendChild(a),a.addEventListener("click",k=>k.stopPropagation()),a.querySelector("#bs-np-cancel").addEventListener("click",()=>a.remove()),a.querySelector("#bs-np-submit").addEventListener("click",async()=>{let k=a.querySelector("#bs-np-title").value.trim();if(!k){a.querySelector("#bs-np-title").style.borderColor="#ef4444";return}let me=a.querySelector("#bs-np-submit");me.textContent="Creating...",me.style.opacity="0.6",me.style.pointerEvents="none";let Ye=a.querySelector("#bs-np-desc").value.trim(),D=a.querySelector("#bs-np-priority").value,B=a.querySelector("#bs-np-category").value,gt=a.querySelector("#bs-np-assignee")?.value||void 0,re=JSON.stringify(Ro(i)),xe=Io(i),ve=le().slice(-20).map(q=>`[${q.level}] ${q.args.join(" ")}`),v=ce().slice(-10).map(q=>`${q.message} at ${q.source}:${q.lineno}`),ee=fe().slice(-10).map(q=>`${q.method} ${q.url} \u2192 ${q.status}`),Le={projectId:Yt,pageUrl:window.location.href,pathname:window.location.pathname,elementSelector:re,elementXPath:xe,xPercent:n,yPercent:r,pageX:e,pageY:t,title:k,description:Ye,priority:D,category:B,assigneeId:gt,browserInfo:navigator.userAgent,screenSize:`${screen.width}x${screen.height}`,viewportSize:`${window.innerWidth}x${window.innerHeight}`,devicePixelRatio:window.devicePixelRatio,consoleLogs:ve,networkErrors:ee,jsErrors:v};if(a.remove(),navigator.onLine){let q=await xn(Le);q.success&&q.data&&(z.push(q.data),pe())}else kn({type:"create_pin",data:Le}),z.push({...Le,id:"local-"+Date.now(),orgId:"",status:"open",tags:[],createdById:ne()?.id||"",creatorName:ne()?.name||"",commentCount:0,createdAt:Date.now(),updatedAt:Date.now()}),pe()}),setTimeout(()=>a.querySelector("#bs-np-title")?.focus(),50)}function Do(){at("pin:created",e=>{let t=e.data;t.pathname===window.location.pathname&&(z.find(n=>n.id===t.id)||(z.push(t),Ln(z.map(n=>n.id)),pe()))}),at("pin:updated",e=>{let t=e.data,n=z.findIndex(r=>r.id===t.id);n>=0&&(z[n]={...z[n],...t},pe())}),at("pin:deleted",e=>{let{id:t}=e.data;z=z.filter(n=>n.id!==t),he(),pe()}),at("comment:created",e=>{let t=e.data;if(Ue){let n=Ue.querySelector("#bs-lp-cmts");n&&(n.innerHTML+=`
473
+ `,X.appendChild(i),i.addEventListener("click",M=>M.stopPropagation()),i.querySelector("#bs-np-cancel").addEventListener("click",()=>i.remove()),i.querySelector("#bs-np-submit").addEventListener("click",async()=>{let M=i.querySelector("#bs-np-title").value.trim();if(!M){i.querySelector("#bs-np-title").style.borderColor="#ef4444";return}let re=i.querySelector("#bs-np-submit");re.textContent="Creating...",re.style.opacity="0.6",re.style.pointerEvents="none";let N=i.querySelector("#bs-np-desc").value.trim(),j=i.querySelector("#bs-np-priority").value,q=i.querySelector("#bs-np-category").value,se=i.querySelector("#bs-np-assignee")?.value||void 0,xe=JSON.stringify(Uo(a)),we=Wo(a),k=de().slice(-20).map(I=>`[${I.level}] ${I.args.join(" ")}`),te=pe().slice(-10).map(I=>`${I.message} at ${I.source}:${I.lineno}`),xt=ge().slice(-10).map(I=>`${I.method} ${I.url} \u2192 ${I.status}`),Je={projectId:Gt,pageUrl:window.location.href,pathname:window.location.pathname,elementSelector:xe,elementXPath:we,xPercent:n,yPercent:r,pageX:e,pageY:t,title:M,description:N,priority:j,category:q,assigneeId:se,browserInfo:navigator.userAgent,screenSize:`${screen.width}x${screen.height}`,viewportSize:`${window.innerWidth}x${window.innerHeight}`,devicePixelRatio:window.devicePixelRatio,consoleLogs:k,networkErrors:xt,jsErrors:te};if(i.remove(),navigator.onLine){let I=await En(Je);I.success&&I.data&&(P=[...P,I.data],be())}else{Pn({type:"create_pin",data:Je});let I=ie();P=[...P,{...Je,id:"local-"+Date.now(),orgId:"",status:"open",tags:[],createdBy:I?.id||"",creatorName:I?.name||"",commentCount:0,createdAt:Date.now(),updatedAt:Date.now()}],be()}}),setTimeout(()=>i.querySelector("#bs-np-title")?.focus(),50)}function Yo(){ct("pin:created",e=>{let t=e.data;t.pathname===window.location.pathname&&(P.find(n=>n.id===t.id)||(P=[...P,t],$n(P.map(n=>n.id)),be()))}),ct("pin:updated",e=>{let t=e.data,n=P.findIndex(r=>r.id===t.id);n>=0&&(P=P.map((r,s)=>s===n?{...r,...t}:r),be())}),ct("pin:deleted",e=>{let{id:t}=e.data;P=P.filter(n=>n.id!==t),ye(),be()}),ct("comment:created",e=>{let t=e.data;if(_e){let n=_e.querySelector("#bs-lp-cmts");n&&(n.innerHTML+=`
431
474
  <div class="bs-lp-cmt">
432
475
  <div class="bs-lp-cmt-top">
433
- <span class="bs-lp-cmt-author">${de(t.author?.name||"Someone")}</span>
476
+ <span class="bs-lp-cmt-author">${ue(t.author?.name||"Someone")}</span>
434
477
  <span class="bs-lp-cmt-time">just now</span>
435
478
  </div>
436
- <div class="bs-lp-cmt-body">${de(t.body)}</div>
479
+ <div class="bs-lp-cmt-body">${ue(t.body)}</div>
437
480
  </div>
438
- `,n.scrollTop=n.scrollHeight)}})}function Bo(){let e=window.location.pathname,t=()=>{window.location.pathname!==e&&(e=window.location.pathname,window.location.href,Gr())},n=history.pushState,r=history.replaceState;history.pushState=function(...s){n.apply(this,s),t()},history.replaceState=function(...s){r.apply(this,s),t()},window.addEventListener("popstate",t)}function de(e){let t=document.createElement("div");return t.textContent=e,t.innerHTML}var V,O=null,I=null,h=null,G=null,dt=null,pt=null,oe=null,Q=!1,Jt=!1,We="report";var ye=Br(),Ee=Or(),H={bug:'<svg width="28" height="28" viewBox="55 38 60 105" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M95.8 44h-29c-3 0-5.4 2.4-5.4 5.4v29c0 3 2.4 5.4 5.4 5.4h19.5c13 0 23.5-10.5 23.5-23.5v-2.8c0-7.5-6-13.5-13.5-13.5h-.5zm-6.2 28.2H74.8V57.4h14.8c5.8 0 10.4 4.7 10.4 10.4s-4.7 10.4-10.4 10.4z" fill="rgba(255,255,255,0.85)"/><path d="M100.4 96h-33.6c-3 0-5.4 2.4-5.4 5.4v33.6c0 3 2.4 5.4 5.4 5.4h22c15 0 27-12 27-27v-3.9c0-7.5-6-13.5-13.5-13.5h-1.9zm-7.8 32.2H74.8v-20h17.8c6.7 0 12.2 5.5 12.2 12.2 0 4.3-3.5 7.8-7.8 7.8h-4.6z" fill="rgba(255,255,255,1)"/></svg>',x:'<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>',cam:'<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"/><circle cx="12" cy="13" r="4"/></svg>',check:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round"><polyline points="20 6 9 17 4 12"/></svg>',report:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="16" y1="13" x2="8" y2="13"/><line x1="16" y1="17" x2="8" y2="17"/></svg>',console:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="4 17 10 11 4 5"/><line x1="12" y1="19" x2="20" y2="19"/></svg>',network:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/></svg>',ctx:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"/></svg>',settings:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="4" y1="21" x2="4" y2="14"/><line x1="4" y1="10" x2="4" y2="3"/><line x1="12" y1="21" x2="12" y2="12"/><line x1="12" y1="8" x2="12" y2="3"/><line x1="20" y1="21" x2="20" y2="16"/><line x1="20" y1="12" x2="20" y2="3"/><line x1="1" y1="14" x2="7" y2="14"/><line x1="9" y1="8" x2="15" y2="8"/><line x1="17" y1="16" x2="23" y2="16"/></svg>',history:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>',pin:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"/><circle cx="12" cy="10" r="3"/></svg>',sun:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="12" cy="12" r="5"/><line x1="12" y1="1" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="23"/><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/><line x1="1" y1="12" x2="3" y2="12"/><line x1="21" y1="12" x2="23" y2="12"/><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/></svg>',moon:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg>',keyboard:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><rect x="2" y="4" width="20" height="16" rx="2"/><line x1="6" y1="8" x2="6" y2="8"/><line x1="10" y1="8" x2="10" y2="8"/><line x1="14" y1="8" x2="14" y2="8"/><line x1="18" y1="8" x2="18" y2="8"/><line x1="8" y1="12" x2="16" y2="12"/><line x1="6" y1="16" x2="18" y2="16"/></svg>'},Oo=`
481
+ `,n.scrollTop=n.scrollHeight)}})}function Vo(){let e=window.location.pathname,t=()=>{window.location.pathname!==e&&(e=window.location.pathname,window.location.href,os())},n=history.pushState,r=history.replaceState;history.pushState=function(...s){n.apply(this,s),t()},history.replaceState=function(...s){r.apply(this,s),t()},window.addEventListener("popstate",t)}function ue(e){let t=document.createElement("div");return t.textContent=e,t.innerHTML}var J,x=null,$=null,y=null,Q=null,bt=null,mt=null,ae=null,Z=!1,Zt=!1,Se=!1,ft=null,zn=null,as="bugstash_fab_position",Xe="report";var ve=Fr(),Pe=Ur(),O={bug:'<svg width="28" height="28" viewBox="55 38 60 105" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M95.8 44h-29c-3 0-5.4 2.4-5.4 5.4v29c0 3 2.4 5.4 5.4 5.4h19.5c13 0 23.5-10.5 23.5-23.5v-2.8c0-7.5-6-13.5-13.5-13.5h-.5zm-6.2 28.2H74.8V57.4h14.8c5.8 0 10.4 4.7 10.4 10.4s-4.7 10.4-10.4 10.4z" fill="rgba(255,255,255,0.85)"/><path d="M100.4 96h-33.6c-3 0-5.4 2.4-5.4 5.4v33.6c0 3 2.4 5.4 5.4 5.4h22c15 0 27-12 27-27v-3.9c0-7.5-6-13.5-13.5-13.5h-1.9zm-7.8 32.2H74.8v-20h17.8c6.7 0 12.2 5.5 12.2 12.2 0 4.3-3.5 7.8-7.8 7.8h-4.6z" fill="rgba(255,255,255,1)"/></svg>',x:'<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>',cam:'<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"/><circle cx="12" cy="13" r="4"/></svg>',check:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round"><polyline points="20 6 9 17 4 12"/></svg>',report:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="16" y1="13" x2="8" y2="13"/><line x1="16" y1="17" x2="8" y2="17"/></svg>',console:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="4 17 10 11 4 5"/><line x1="12" y1="19" x2="20" y2="19"/></svg>',network:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/></svg>',ctx:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"/></svg>',settings:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="4" y1="21" x2="4" y2="14"/><line x1="4" y1="10" x2="4" y2="3"/><line x1="12" y1="21" x2="12" y2="12"/><line x1="12" y1="8" x2="12" y2="3"/><line x1="20" y1="21" x2="20" y2="16"/><line x1="20" y1="12" x2="20" y2="3"/><line x1="1" y1="14" x2="7" y2="14"/><line x1="9" y1="8" x2="15" y2="8"/><line x1="17" y1="16" x2="23" y2="16"/></svg>',history:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>',pin:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"/><circle cx="12" cy="10" r="3"/></svg>',sun:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="12" cy="12" r="5"/><line x1="12" y1="1" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="23"/><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/><line x1="1" y1="12" x2="3" y2="12"/><line x1="21" y1="12" x2="23" y2="12"/><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/></svg>',moon:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg>',keyboard:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><rect x="2" y="4" width="20" height="16" rx="2"/><line x1="6" y1="8" x2="6" y2="8"/><line x1="10" y1="8" x2="10" y2="8"/><line x1="14" y1="8" x2="14" y2="8"/><line x1="18" y1="8" x2="18" y2="8"/><line x1="8" y1="12" x2="16" y2="12"/><line x1="6" y1="16" x2="18" y2="16"/></svg>'},Jo=`
439
482
  /* \u2500\u2500 Shadow Boundary Reset \u2500\u2500
440
483
  * Cuts ALL inherited CSS from host page (color, font, line-height, etc.)
441
484
  * Every element below must declare its own styles explicitly. */
@@ -461,13 +504,21 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
461
504
  border-radius: var(--bs-radius);
462
505
  background: linear-gradient(135deg, var(--bs-fab1), var(--bs-fab2));
463
506
  color: #fff;
464
- cursor: pointer;
507
+ cursor: grab;
465
508
  box-shadow: 0 4px 24px rgba(0,0,0,0.3), 0 0 0 0 rgba(0,0,0,0.15);
466
509
  display: flex;
467
510
  align-items: center;
468
511
  justify-content: center;
469
512
  transition: all 0.35s cubic-bezier(0.34,1.56,0.64,1);
470
513
  animation: bs-pulse 3s ease-in-out infinite;
514
+ touch-action: none;
515
+ user-select: none;
516
+ -webkit-user-select: none;
517
+ }
518
+ .bs-fab.bs-dragging {
519
+ cursor: grabbing;
520
+ transition: none;
521
+ animation: none;
471
522
  }
472
523
  .bs-fab:hover {
473
524
  transform: scale(1.08) translateY(-2px);
@@ -1521,7 +1572,7 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
1521
1572
  .bs-set-ly.bs-picked { border-color: var(--bs-accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--bs-accent) 25%, transparent); }
1522
1573
  .bs-set-ly-name { font-size: 12px; font-weight: 600; color: var(--bs-text); margin-bottom: 2px; }
1523
1574
  .bs-set-ly-desc { font-size: 10px; color: var(--bs-muted); }
1524
- `;function No(){return`
1575
+ `;function Ko(){return`
1525
1576
  <div class="bs-login-form">
1526
1577
  <div class="bs-login-logo">BugStash</div>
1527
1578
  <div class="bs-login-subtitle">Sign in to report bugs & collaborate</div>
@@ -1531,11 +1582,11 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
1531
1582
  <button class="bs-login-btn" id="bs-login-submit">Sign In</button>
1532
1583
  <div style="font-size:11px;color:var(--bs-muted);margin-top:4px">Contact your admin for an account</div>
1533
1584
  </div>
1534
- `}function A(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function jo(e){let t=Math.floor((Date.now()-e)/1e3);return t<5?"now":t<60?`${t}s ago`:t<3600?`${Math.floor(t/60)}m ago`:new Date(e).toLocaleTimeString()}function Zr(e){return new Date(e).toLocaleTimeString("en",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}var es="bugstash_history";function _e(){try{return JSON.parse(localStorage.getItem(es)||"[]")}catch{return[]}}function An(e){try{localStorage.setItem(es,JSON.stringify(e))}catch{}}function qo(e){let t=_e(),n=Date.now();t.unshift({...e,id:n}),t.length>50&&(t.length=50),An(t)}function Uo(e){let t=_e().filter(n=>n.id!==e);An(t)}function Fo(e,t){let n=_e(),r=n.findIndex(s=>s.id===e);r>=0&&(n[r]={...n[r],...t},An(n))}function ts(){return{url:window.location.href,userAgent:navigator.userAgent,platform:navigator.platform,language:navigator.language,cookiesEnabled:navigator.cookieEnabled,online:navigator.onLine,screenWidth:screen.width,screenHeight:screen.height,viewportWidth:window.innerWidth,viewportHeight:window.innerHeight,devicePixelRatio:window.devicePixelRatio,timestamp:Date.now(),environment:V.environment??"development",commitHash:V.commitHash,user:V.user}}function ns(){let e=ce(),t=le(),n=Me(),r=fe(),s=Te(),o=Ae(),i=t.filter(p=>p.level==="error"),a="low";e.length>=3||r.length>=3?a="critical":e.length>=1||r.length>=2?a="high":(i.length>0||r.length>=1)&&(a="medium");let d=[];return e.length&&d.push("has-errors"),r.length&&d.push("network-failures"),i.length&&d.push("console-errors"),o?.pageLoadTime&&o.pageLoadTime>3e3&&d.push("slow-load"),o?.cumulativeLayoutShift&&o.cumulativeLayoutShift>.25&&d.push("layout-shift"),navigator.onLine||d.push("offline"),window.innerWidth<768&&d.push("mobile"),{severity:a,tags:d,counts:{logs:t.length,network:n.length,failedNet:r.length,errors:e.length,crumbs:s.length}}}function rs(){let e=ns(),t=[{id:"ui",label:"UI"},{id:"functionality",label:"Feature"},{id:"performance",label:"Speed"},{id:"crash",label:"Crash"},{id:"security",label:"Security"},{id:"other",label:"Other"}],n=e.counts.errors>0||e.counts.failedNet>0;return`<div class="bs-view">
1585
+ `}function B(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Go(e){let t=Math.floor((Date.now()-e)/1e3);return t<5?"now":t<60?`${t}s ago`:t<3600?`${Math.floor(t/60)}m ago`:new Date(e).toLocaleTimeString()}function ls(e){return new Date(e).toLocaleTimeString("en",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}var cs="bugstash_history";function Ye(){try{return JSON.parse(localStorage.getItem(cs)||"[]")}catch{return[]}}function Bn(e){try{localStorage.setItem(cs,JSON.stringify(e))}catch{}}function Qo(e){let t=Ye(),n=Date.now();t.unshift({...e,id:n}),t.length>50&&(t.length=50),Bn(t)}function Zo(e){let t=Ye().filter(n=>n.id!==e);Bn(t)}function ei(e,t){let n=Ye(),r=n.findIndex(s=>s.id===e);r>=0&&(n[r]={...n[r],...t},Bn(n))}function ds(){return{url:window.location.href,userAgent:navigator.userAgent,platform:navigator.platform,language:navigator.language,cookiesEnabled:navigator.cookieEnabled,online:navigator.onLine,screenWidth:screen.width,screenHeight:screen.height,viewportWidth:window.innerWidth,viewportHeight:window.innerHeight,devicePixelRatio:window.devicePixelRatio,timestamp:Date.now(),environment:J.environment??"development",commitHash:J.commitHash,user:J.user}}function ps(){let e=pe(),t=de(),n=Re(),r=ge(),s=$e(),o=ze(),a=t.filter(u=>u.level==="error"),i="low";e.length>=3||r.length>=3?i="critical":e.length>=1||r.length>=2?i="high":(a.length>0||r.length>=1)&&(i="medium");let c=[];return e.length&&c.push("has-errors"),r.length&&c.push("network-failures"),a.length&&c.push("console-errors"),o?.pageLoadTime&&o.pageLoadTime>3e3&&c.push("slow-load"),o?.cumulativeLayoutShift&&o.cumulativeLayoutShift>.25&&c.push("layout-shift"),navigator.onLine||c.push("offline"),window.innerWidth<768&&c.push("mobile"),{severity:i,tags:c,counts:{logs:t.length,network:n.length,failedNet:r.length,errors:e.length,crumbs:s.length}}}function us(){let e=ps(),t=[{id:"ui",label:"UI"},{id:"functionality",label:"Feature"},{id:"performance",label:"Speed"},{id:"crash",label:"Crash"},{id:"security",label:"Security"},{id:"other",label:"Other"}],n=e.counts.errors>0||e.counts.failedNet>0;return`<div class="bs-view">
1535
1586
  <form data-bs-form>
1536
1587
  <div class="bs-report-summary${n?" bs-alert":e.counts.logs>0?" bs-has":""}">
1537
1588
  <div class="bs-report-summary-left">
1538
- ${n?`<div class="bs-report-summary-icon bs-warn">!</div><span>${e.counts.errors} error${e.counts.errors!==1?"s":""}, ${e.counts.failedNet} failed request${e.counts.failedNet!==1?"s":""} detected</span>`:`<div class="bs-report-summary-icon">${H.check}</div><span>Auto-collecting ${e.counts.logs} logs, ${e.counts.network} requests, ${e.counts.crumbs} actions</span>`}
1589
+ ${n?`<div class="bs-report-summary-icon bs-warn">!</div><span>${e.counts.errors} error${e.counts.errors!==1?"s":""}, ${e.counts.failedNet} failed request${e.counts.failedNet!==1?"s":""} detected</span>`:`<div class="bs-report-summary-icon">${O.check}</div><span>Auto-collecting ${e.counts.logs} logs, ${e.counts.network} requests, ${e.counts.crumbs} actions</span>`}
1539
1590
  </div>
1540
1591
  </div>
1541
1592
  <div class="bs-field">
@@ -1562,7 +1613,7 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
1562
1613
  </div>
1563
1614
  </div>
1564
1615
  <div class="bs-shot-area" data-bs-screenshot>
1565
- <div class="bs-shot-icon">${H.cam}</div>
1616
+ <div class="bs-shot-icon">${O.cam}</div>
1566
1617
  <div class="bs-shot-text">
1567
1618
  <div class="bs-shot-title" data-bs-shot-title>Attach screenshot</div>
1568
1619
  <div class="bs-shot-sub" data-bs-shot-sub>Capture & annotate the current view</div>
@@ -1571,17 +1622,17 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
1571
1622
  <div data-bs-annotate></div>
1572
1623
  <button type="submit" class="bs-submit-btn">Submit Report</button>
1573
1624
  </form>
1574
- </div>`}function Wo(){let e=le(),t={error:"bs-le",warn:"bs-lw",log:"bs-ll",info:"bs-li",debug:"bs-ld"};return e.length?`<div class="bs-view">${e.slice().reverse().map(n=>`<div class="bs-log"><span class="bs-log-lv ${t[n.level]||"bs-ll"}">${n.level}</span><span class="bs-log-m">${A(n.args.join(" ")).slice(0,500)}</span><span class="bs-log-t">${Zr(n.timestamp)}</span></div>`).join("")}</div>`:'<div class="bs-view"><div class="bs-empty"><p>No console logs captured yet.<br>Use the app \u2014 logs will appear here automatically.</p></div></div>'}function _o(){let e=Me();return e.length?`<div class="bs-view">${e.slice().reverse().map(t=>`<div class="bs-net"><span class="bs-net-m">${t.method}</span><span class="bs-net-s ${t.failed?"bs-fail":"bs-ok"}">${t.status||"ERR"}</span><span class="bs-net-u" title="${A(t.url)}">${A(t.url)}</span><span class="bs-net-d">${t.duration}ms</span></div>`).join("")}</div>`:'<div class="bs-view"><div class="bs-empty"><p>No network requests captured yet.<br>API calls will show up here automatically.</p></div></div>'}function Xo(){let e='<div class="bs-view">',t=ce();t.length&&(e+=`<div class="bs-sec">Errors <span class="bs-sec-n">${t.length}</span></div>`,e+=t.slice().reverse().map(o=>`<div class="bs-err-card"><div class="bs-err-m">${A(o.message)}</div>${o.stack?`<div class="bs-err-stack">${A(o.stack)}</div>`:""}<div class="bs-err-meta">${o.type} &middot; ${Zr(o.timestamp)}${o.source?` &middot; ${A(o.source)}:${o.lineno}`:""}</div></div>`).join(""));let n=Ae();if(n){e+='<div class="bs-sec">Performance</div>';let o=[["Page Load",n.pageLoadTime,5e3],["DOM Ready",n.domContentLoaded,3e3],["First Paint",n.firstPaint,2e3],["FCP",n.firstContentfulPaint,2500],["LCP",n.largestContentfulPaint,4e3],["FID",n.firstInputDelay,300]];for(let[i,a,d]of o){if(a===void 0)continue;let p=Math.min(100,a/d*100);e+=`<div class="bs-pf"><span class="bs-pf-l">${i}</span><div class="bs-pf-tr"><div class="bs-pf-fl${p>75?" bs-slow":""}" style="width:${p}%"></div></div><span class="bs-pf-v">${a}ms</span></div>`}if(n.cumulativeLayoutShift!==void 0){let i=Math.min(100,n.cumulativeLayoutShift*400);e+=`<div class="bs-pf"><span class="bs-pf-l">CLS</span><div class="bs-pf-tr"><div class="bs-pf-fl${i>40?" bs-slow":""}" style="width:${i}%"></div></div><span class="bs-pf-v">${n.cumulativeLayoutShift}</span></div>`}}let r=Te();r.length&&(e+=`<div class="bs-sec">Your activity trail <span class="bs-sec-n">${r.length}</span></div>`,e+=r.slice().reverse().map(o=>`<div class="bs-bc"><span class="bs-bc-t bs-t-${o.type}">${o.type}</span><span class="bs-bc-m">${A(o.message).slice(0,120)}</span><span class="bs-bc-time">${jo(o.timestamp)}</span></div>`).join(""));let s=ts();return e+='<div class="bs-sec">Environment</div>',e+=`<div class="bs-kv">
1575
- <span class="bs-kv-k">URL</span><span class="bs-kv-v">${A(s.url)}</span>
1625
+ </div>`}function ti(){let e=de(),t={error:"bs-le",warn:"bs-lw",log:"bs-ll",info:"bs-li",debug:"bs-ld"};return e.length?`<div class="bs-view">${e.slice().reverse().map(n=>`<div class="bs-log"><span class="bs-log-lv ${t[n.level]||"bs-ll"}">${n.level}</span><span class="bs-log-m">${B(n.args.join(" ")).slice(0,500)}</span><span class="bs-log-t">${ls(n.timestamp)}</span></div>`).join("")}</div>`:'<div class="bs-view"><div class="bs-empty"><p>No console logs captured yet.<br>Use the app \u2014 logs will appear here automatically.</p></div></div>'}function ni(){let e=Re();return e.length?`<div class="bs-view">${e.slice().reverse().map(t=>`<div class="bs-net"><span class="bs-net-m">${t.method}</span><span class="bs-net-s ${t.failed?"bs-fail":"bs-ok"}">${t.status||"ERR"}</span><span class="bs-net-u" title="${B(t.url)}">${B(t.url)}</span><span class="bs-net-d">${t.duration}ms</span></div>`).join("")}</div>`:'<div class="bs-view"><div class="bs-empty"><p>No network requests captured yet.<br>API calls will show up here automatically.</p></div></div>'}function ri(){let e='<div class="bs-view">',t=pe();t.length&&(e+=`<div class="bs-sec">Errors <span class="bs-sec-n">${t.length}</span></div>`,e+=t.slice().reverse().map(o=>`<div class="bs-err-card"><div class="bs-err-m">${B(o.message)}</div>${o.stack?`<div class="bs-err-stack">${B(o.stack)}</div>`:""}<div class="bs-err-meta">${o.type} &middot; ${ls(o.timestamp)}${o.source?` &middot; ${B(o.source)}:${o.lineno}`:""}</div></div>`).join(""));let n=ze();if(n){e+='<div class="bs-sec">Performance</div>';let o=[["Page Load",n.pageLoadTime,5e3],["DOM Ready",n.domContentLoaded,3e3],["First Paint",n.firstPaint,2e3],["FCP",n.firstContentfulPaint,2500],["LCP",n.largestContentfulPaint,4e3],["FID",n.firstInputDelay,300]];for(let[a,i,c]of o){if(i===void 0)continue;let u=Math.min(100,i/c*100);e+=`<div class="bs-pf"><span class="bs-pf-l">${a}</span><div class="bs-pf-tr"><div class="bs-pf-fl${u>75?" bs-slow":""}" style="width:${u}%"></div></div><span class="bs-pf-v">${i}ms</span></div>`}if(n.cumulativeLayoutShift!==void 0){let a=Math.min(100,n.cumulativeLayoutShift*400);e+=`<div class="bs-pf"><span class="bs-pf-l">CLS</span><div class="bs-pf-tr"><div class="bs-pf-fl${a>40?" bs-slow":""}" style="width:${a}%"></div></div><span class="bs-pf-v">${n.cumulativeLayoutShift}</span></div>`}}let r=$e();r.length&&(e+=`<div class="bs-sec">Your activity trail <span class="bs-sec-n">${r.length}</span></div>`,e+=r.slice().reverse().map(o=>`<div class="bs-bc"><span class="bs-bc-t bs-t-${o.type}">${o.type}</span><span class="bs-bc-m">${B(o.message).slice(0,120)}</span><span class="bs-bc-time">${Go(o.timestamp)}</span></div>`).join(""));let s=ds();return e+='<div class="bs-sec">Environment</div>',e+=`<div class="bs-kv">
1626
+ <span class="bs-kv-k">URL</span><span class="bs-kv-v">${B(s.url)}</span>
1576
1627
  <span class="bs-kv-k">Viewport</span><span class="bs-kv-v">${s.viewportWidth}&times;${s.viewportHeight} @${s.devicePixelRatio}x</span>
1577
1628
  <span class="bs-kv-k">Screen</span><span class="bs-kv-v">${s.screenWidth}&times;${s.screenHeight}</span>
1578
- <span class="bs-kv-k">Platform</span><span class="bs-kv-v">${A(s.platform)}</span>
1629
+ <span class="bs-kv-k">Platform</span><span class="bs-kv-v">${B(s.platform)}</span>
1579
1630
  <span class="bs-kv-k">Language</span><span class="bs-kv-v">${s.language}</span>
1580
- ${V.commitHash?`<span class="bs-kv-k">Commit</span><span class="bs-kv-v">${A(V.commitHash)}</span>`:""}
1581
- ${V.user?.email?`<span class="bs-kv-k">User</span><span class="bs-kv-v">${A(V.user.email)}</span>`:""}
1582
- </div>`,e+="</div>",e}function Yo(){let e=_e();if(!e.length)return'<div class="bs-view"><div class="bs-empty"><p>No reports yet.<br>Submitted bugs will appear here.</p></div></div>';let t={ui:"UI",functionality:"Feature",performance:"Perf",crash:"Crash",security:"Security",other:"Other"},n=s=>{let o=new Date(s),a=new Date().getTime()-o.getTime(),d=Math.floor(a/6e4);if(d<1)return"Just now";if(d<60)return`${d}m ago`;let p=Math.floor(d/60);if(p<24)return`${p}h ago`;let b=Math.floor(p/24);return b<7?`${b}d ago`:o.toLocaleDateString("en",{month:"short",day:"numeric"})},r='<div class="bs-view">';for(let s of e){let o=s.pins?.length?`<div class="bs-hist-pins">${s.pins.slice(0,5).map(i=>`<div class="bs-hist-pin-dot" style="background:${["#ef4444","#3b82f6","#f59e0b","#10b981","#8b5cf6"][i.number%5]}">${i.number}</div>`).join("")}${s.pins.length>5?`<span>+${s.pins.length-5}</span>`:""}</div>`:"";r+=`<div class="bs-hist-card" data-hist-id="${s.id}">
1631
+ ${J.commitHash?`<span class="bs-kv-k">Commit</span><span class="bs-kv-v">${B(J.commitHash)}</span>`:""}
1632
+ ${J.user?.email?`<span class="bs-kv-k">User</span><span class="bs-kv-v">${B(J.user.email)}</span>`:""}
1633
+ </div>`,e+="</div>",e}function si(){let e=Ye();if(!e.length)return'<div class="bs-view"><div class="bs-empty"><p>No reports yet.<br>Submitted bugs will appear here.</p></div></div>';let t={ui:"UI",functionality:"Feature",performance:"Perf",crash:"Crash",security:"Security",other:"Other"},n=s=>{let o=new Date(s),i=new Date().getTime()-o.getTime(),c=Math.floor(i/6e4);if(c<1)return"Just now";if(c<60)return`${c}m ago`;let u=Math.floor(c/60);if(u<24)return`${u}h ago`;let p=Math.floor(u/24);return p<7?`${p}d ago`:o.toLocaleDateString("en",{month:"short",day:"numeric"})},r='<div class="bs-view">';for(let s of e){let o=s.pins?.length?`<div class="bs-hist-pins">${s.pins.slice(0,5).map(a=>`<div class="bs-hist-pin-dot" style="background:${["#ef4444","#3b82f6","#f59e0b","#10b981","#8b5cf6"][a.number%5]}">${a.number}</div>`).join("")}${s.pins.length>5?`<span>+${s.pins.length-5}</span>`:""}</div>`:"";r+=`<div class="bs-hist-card" data-hist-id="${s.id}">
1583
1634
  <div class="bs-hist-top">
1584
- <div class="bs-hist-title">${A(s.title)}</div>
1635
+ <div class="bs-hist-title">${B(s.title)}</div>
1585
1636
  ${s.screenshot?`<img class="bs-hist-thumb" src="${s.screenshot}" alt=""/>`:""}
1586
1637
  <div class="bs-hist-actions">
1587
1638
  <button class="bs-hist-btn" data-hist-edit="${s.id}" title="Edit"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><path d="M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"/></svg></button>
@@ -1593,39 +1644,39 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
1593
1644
  <span class="bs-hist-badge bs-sev-${s.severity}">${s.severity}</span>
1594
1645
  <span class="bs-hist-badge bs-status-${s.status}">${s.status}</span>
1595
1646
  </div>
1596
- ${s.description?`<div class="bs-hist-desc">${A(s.description)}</div>`:""}
1647
+ ${s.description?`<div class="bs-hist-desc">${B(s.description)}</div>`:""}
1597
1648
  <div class="bs-hist-foot">
1598
- <span>${n(s.createdAt)} &middot; ${A(s.url.replace(/^https?:\/\//,"").slice(0,40))}</span>
1649
+ <span>${n(s.createdAt)} &middot; ${B(s.url.replace(/^https?:\/\//,"").slice(0,40))}</span>
1599
1650
  ${o}
1600
1651
  </div>
1601
- </div>`}return r+="</div>",r}function Vo(){let e=Nt(),t=qt(),n='<div class="bs-view">';n+='<div class="bs-set-sec">Layout</div>',n+='<div class="bs-set-ly-grid">';for(let r of t)n+=`<button class="bs-set-ly${r.id===Ee.id?" bs-picked":""}" data-set-layout="${r.id}"><div class="bs-set-ly-name">${A(r.name)}</div><div class="bs-set-ly-desc">${A(r.description)}</div></button>`;n+="</div>",n+='<div class="bs-set-sec">Theme</div>',n+='<div class="bs-set-grid">';for(let r of e)n+=`<button class="bs-set-card${r.id===ye.id?" bs-picked":""}" data-set-theme="${r.id}"><div class="bs-set-preview" style="background:${r.preview[0]}"><div class="bs-set-dot" style="background:${r.preview[1]}"></div><div class="bs-set-dot" style="background:${r.vars["--bs-accent2"]||r.preview[1]};opacity:0.6"></div></div><div class="bs-set-name">${A(r.name)}</div></button>`;return n+="</div>",n+="</div>",n}function Jo(e,t){let n=["#f87171","#3b82f6","#fb923c","#4ade80","#a78bfa","#facc15"],r=n[0],s="draw",o=4,i=1,a=!1,d=[],p=[],b=-1,y=-1,w=!1,k=!1,me=0,Ye=0,D=0,B=0,j=[],gt=["#ef4444","#3b82f6","#f59e0b","#10b981","#8b5cf6","#ec4899"],re=new Image;re.src=t;let xe=document.createElement("div");xe.className="bs-ann-wrap";let ve=document.createElement("div");ve.className="bs-ann-viewport";let v=document.createElement("canvas");v.className="bs-ann-canvas bs-draw";let ee=document.createElement("div");ee.className="bs-ann-toolbar";let Le={select:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M3 3l7.07 16.97 2.51-7.39 7.39-2.51L3 3z"/><path d="M13 13l6 6"/></svg>',draw:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M12 19l7-7 3 3-7 7-3-3z"/><path d="M18 13l-1.5-7.5L2 2l3.5 14.5L13 18l5-5z"/><path d="M2 2l7.586 7.586"/></svg>',arrow:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="5" y1="12" x2="19" y2="12"/><polyline points="12 5 19 12 12 19"/></svg>',rect:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2"/></svg>',circle:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/></svg>',text:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><polyline points="4 7 4 4 20 4 20 7"/><line x1="9.5" y1="20" x2="14.5" y2="20"/><line x1="12" y1="4" x2="12" y2="20"/></svg>',highlight:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M9 11l-6 6v3h9l3-3"/><path d="M22 12l-4.6 4.6a2 2 0 01-2.8 0l-5.2-5.2a2 2 0 010-2.8L14 4"/></svg>',pin:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0118 0z"/><circle cx="12" cy="10" r="3"/></svg>'},q={select:"Select & Move",draw:"Draw",arrow:"Arrow",rect:"Rectangle",circle:"Circle",text:"Text",highlight:"Highlight",pin:"Pin Issue"},tn=[],gs=l=>{s=l,b=-1,v.className=`bs-ann-canvas bs-${l}`,tn.forEach(f=>f.classList.remove("bs-sel")),tn.find(f=>f.dataset.tool===l)?.classList.add("bs-sel")};Object.keys(Le).forEach(l=>{let f=document.createElement("button");f.type="button",f.dataset.tool=l,f.className=`bs-ann-btn${l===s?" bs-sel":""}`,f.title=q[l],f.innerHTML=Le[l],f.addEventListener("click",()=>gs(l)),tn.push(f),ee.appendChild(f)}),ee.appendChild(Object.assign(document.createElement("div"),{className:"bs-ann-sep"})),n.forEach((l,f)=>{let g=document.createElement("button");g.type="button",g.className=`bs-ann-dot${f===0?" bs-sel":""}`,g.style.background=l,g.addEventListener("click",()=>{r=l,ee.querySelectorAll(".bs-ann-dot").forEach(C=>C.classList.remove("bs-sel")),g.classList.add("bs-sel")}),ee.appendChild(g)}),ee.appendChild(Object.assign(document.createElement("div"),{className:"bs-ann-sep"}));let ae=document.createElement("input");ae.type="range",ae.min="1",ae.max="12",ae.value="4",ae.className="bs-ann-size",ae.title="Brush size",ae.addEventListener("input",()=>{o=parseInt(ae.value)}),ee.appendChild(ae);let ht=document.createElement("div");ht.className="bs-ann-right";let yt=(l,f)=>{let g=document.createElement("button");return g.type="button",g.className="bs-ann-btn",g.title=l,g.innerHTML=f,g},zn=yt("Zoom out",'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/><line x1="8" y1="11" x2="14" y2="11"/></svg>'),In=Object.assign(document.createElement("span"),{className:"bs-ann-zoom-label",textContent:"100%"}),Hn=yt("Zoom in",'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/><line x1="11" y1="8" x2="11" y2="14"/><line x1="8" y1="11" x2="14" y2="11"/></svg>'),Dn=yt("Fit",'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M15 3h6v6"/><path d="M9 21H3v-6"/><path d="M21 3l-7 7"/><path d="M3 21l7-7"/></svg>'),Bn=yt("Undo",'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><polyline points="1 4 1 10 7 10"/><path d="M3.51 15a9 9 0 105.42-8.49L1 10"/></svg>'),On=Object.assign(document.createElement("button"),{type:"button",className:"bs-ann-clr-btn",textContent:"Clear"}),nn=()=>{v.style.transform=`scale(${i})`,In.textContent=`${Math.round(i*100)}%`};Hn.addEventListener("click",()=>{i<3&&(i=Math.min(3,i+.25),nn())}),zn.addEventListener("click",()=>{i>.5&&(i=Math.max(.5,i-.25),nn())}),Dn.addEventListener("click",()=>{i=1,nn()}),ht.appendChild(Object.assign(document.createElement("div"),{className:"bs-ann-sep"})),[zn,In,Hn,Dn,Bn,On].forEach(l=>ht.appendChild(l)),ee.appendChild(ht);let xt=document.createElement("div");xt.className="bs-ann-pins";let Ce=document.createElement("div");Ce.className="bs-ann-pin-list",Ce.style.display="none",ve.appendChild(v),ve.appendChild(xt),xe.appendChild(ve),xe.appendChild(ee),xe.appendChild(Ce),e.innerHTML="",e.appendChild(xe);let vt=()=>{xt.innerHTML="",Ce.innerHTML="",Ce.style.display=p.length?"":"none",p.forEach((l,f)=>{let g=document.createElement("div");g.className="bs-ann-pin",g.style.background=l.color,g.style.color=l.color;let C=l.x/(v.width||1)*100,m=l.y/(v.height||1)*100;g.style.left=`${C}%`,g.style.top=`${m}%`,g.innerHTML=`<span class="bs-ann-pin-n">${f+1}</span><span class="bs-ann-pin-pulse"></span>`,g.title=`#${f+1}: ${l.note}`;let T=!1;g.addEventListener("mousedown",M=>{M.stopPropagation(),T=!0,g.classList.add("bs-dragging");let u=S=>{if(!T)return;let L=ve.getBoundingClientRect();l.x=(S.clientX-L.left)/L.width*v.width,l.y=(S.clientY-L.top)/L.height*v.height,g.style.left=`${(S.clientX-L.left)/L.width*100}%`,g.style.top=`${(S.clientY-L.top)/L.height*100}%`},x=()=>{T=!1,g.classList.remove("bs-dragging"),document.removeEventListener("mousemove",u),document.removeEventListener("mouseup",x),vt()};document.addEventListener("mousemove",u),document.addEventListener("mouseup",x)}),xt.appendChild(g);let N=document.createElement("div");N.className="bs-ann-pin-item",N.innerHTML=`
1602
- <div class="bs-ann-pin-num" style="background:${l.color}">${f+1}</div>
1652
+ </div>`}return r+="</div>",r}function oi(){let e=Ut(),t=Wt(),n='<div class="bs-view">';n+='<div class="bs-set-sec">Layout</div>',n+='<div class="bs-set-ly-grid">';for(let r of t)n+=`<button class="bs-set-ly${r.id===Pe.id?" bs-picked":""}" data-set-layout="${r.id}"><div class="bs-set-ly-name">${B(r.name)}</div><div class="bs-set-ly-desc">${B(r.description)}</div></button>`;n+="</div>",n+='<div class="bs-set-sec">Theme</div>',n+='<div class="bs-set-grid">';for(let r of e)n+=`<button class="bs-set-card${r.id===ve.id?" bs-picked":""}" data-set-theme="${r.id}"><div class="bs-set-preview" style="background:${r.preview[0]}"><div class="bs-set-dot" style="background:${r.preview[1]}"></div><div class="bs-set-dot" style="background:${r.vars["--bs-accent2"]||r.preview[1]};opacity:0.6"></div></div><div class="bs-set-name">${B(r.name)}</div></button>`;return n+="</div>",n+="</div>",n}function ii(e,t){let n=["#f87171","#3b82f6","#fb923c","#4ade80","#a78bfa","#facc15"],r=n[0],s="draw",o=4,a=1,i=!1,c=[],u=[],p=-1,f=-1,w=!1,S=!1,M=0,re=0,N=0,j=0,q=[],on=["#ef4444","#3b82f6","#f59e0b","#10b981","#8b5cf6","#ec4899"],se=new Image;se.src=t;let xe=document.createElement("div");xe.className="bs-ann-wrap";let we=document.createElement("div");we.className="bs-ann-viewport";let k=document.createElement("canvas");k.className="bs-ann-canvas bs-draw";let te=document.createElement("div");te.className="bs-ann-toolbar";let xt={select:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M3 3l7.07 16.97 2.51-7.39 7.39-2.51L3 3z"/><path d="M13 13l6 6"/></svg>',draw:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M12 19l7-7 3 3-7 7-3-3z"/><path d="M18 13l-1.5-7.5L2 2l3.5 14.5L13 18l5-5z"/><path d="M2 2l7.586 7.586"/></svg>',arrow:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><line x1="5" y1="12" x2="19" y2="12"/><polyline points="12 5 19 12 12 19"/></svg>',rect:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2"/></svg>',circle:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/></svg>',text:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><polyline points="4 7 4 4 20 4 20 7"/><line x1="9.5" y1="20" x2="14.5" y2="20"/><line x1="12" y1="4" x2="12" y2="20"/></svg>',highlight:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M9 11l-6 6v3h9l3-3"/><path d="M22 12l-4.6 4.6a2 2 0 01-2.8 0l-5.2-5.2a2 2 0 010-2.8L14 4"/></svg>',pin:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0118 0z"/><circle cx="12" cy="10" r="3"/></svg>'},Je={select:"Select & Move",draw:"Draw",arrow:"Arrow",rect:"Rectangle",circle:"Circle",text:"Text",highlight:"Highlight",pin:"Pin Issue"},I=[],Ps=l=>{s=l,p=-1,k.className=`bs-ann-canvas bs-${l}`,I.forEach(g=>g.classList.remove("bs-sel")),I.find(g=>g.dataset.tool===l)?.classList.add("bs-sel")};Object.keys(xt).forEach(l=>{let g=document.createElement("button");g.type="button",g.dataset.tool=l,g.className=`bs-ann-btn${l===s?" bs-sel":""}`,g.title=Je[l],g.innerHTML=xt[l],g.addEventListener("click",()=>Ps(l)),I.push(g),te.appendChild(g)}),te.appendChild(Object.assign(document.createElement("div"),{className:"bs-ann-sep"})),n.forEach((l,g)=>{let h=document.createElement("button");h.type="button",h.className=`bs-ann-dot${g===0?" bs-sel":""}`,h.style.background=l,h.addEventListener("click",()=>{r=l,te.querySelectorAll(".bs-ann-dot").forEach(A=>A.classList.remove("bs-sel")),h.classList.add("bs-sel")}),te.appendChild(h)}),te.appendChild(Object.assign(document.createElement("div"),{className:"bs-ann-sep"}));let ce=document.createElement("input");ce.type="range",ce.min="1",ce.max="12",ce.value="4",ce.className="bs-ann-size",ce.title="Brush size",ce.addEventListener("input",()=>{o=parseInt(ce.value)}),te.appendChild(ce);let wt=document.createElement("div");wt.className="bs-ann-right";let kt=(l,g)=>{let h=document.createElement("button");return h.type="button",h.className="bs-ann-btn",h.title=l,h.innerHTML=g,h},On=kt("Zoom out",'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/><line x1="8" y1="11" x2="14" y2="11"/></svg>'),Nn=Object.assign(document.createElement("span"),{className:"bs-ann-zoom-label",textContent:"100%"}),jn=kt("Zoom in",'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/><line x1="11" y1="8" x2="11" y2="14"/><line x1="8" y1="11" x2="14" y2="11"/></svg>'),qn=kt("Fit",'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M15 3h6v6"/><path d="M9 21H3v-6"/><path d="M21 3l-7 7"/><path d="M3 21l7-7"/></svg>'),Fn=kt("Undo",'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><polyline points="1 4 1 10 7 10"/><path d="M3.51 15a9 9 0 105.42-8.49L1 10"/></svg>'),Un=Object.assign(document.createElement("button"),{type:"button",className:"bs-ann-clr-btn",textContent:"Clear"}),an=()=>{k.style.transform=`scale(${a})`,Nn.textContent=`${Math.round(a*100)}%`};jn.addEventListener("click",()=>{a<3&&(a=Math.min(3,a+.25),an())}),On.addEventListener("click",()=>{a>.5&&(a=Math.max(.5,a-.25),an())}),qn.addEventListener("click",()=>{a=1,an()}),wt.appendChild(Object.assign(document.createElement("div"),{className:"bs-ann-sep"})),[On,Nn,jn,qn,Fn,Un].forEach(l=>wt.appendChild(l)),te.appendChild(wt);let Et=document.createElement("div");Et.className="bs-ann-pins";let Te=document.createElement("div");Te.className="bs-ann-pin-list",Te.style.display="none",we.appendChild(k),we.appendChild(Et),xe.appendChild(we),xe.appendChild(te),xe.appendChild(Te),e.innerHTML="",e.appendChild(xe);let Lt=()=>{Et.innerHTML="",Te.innerHTML="",Te.style.display=u.length?"":"none",u.forEach((l,g)=>{let h=document.createElement("div");h.className="bs-ann-pin",h.style.background=l.color,h.style.color=l.color;let A=l.x/(k.width||1)*100,m=l.y/(k.height||1)*100;h.style.left=`${A}%`,h.style.top=`${m}%`,h.innerHTML=`<span class="bs-ann-pin-n">${g+1}</span><span class="bs-ann-pin-pulse"></span>`,h.title=`#${g+1}: ${l.note}`;let R=!1;h.addEventListener("mousedown",H=>{H.stopPropagation(),R=!0,h.classList.add("bs-dragging");let b=C=>{if(!R)return;let T=we.getBoundingClientRect();l.x=(C.clientX-T.left)/T.width*k.width,l.y=(C.clientY-T.top)/T.height*k.height,h.style.left=`${(C.clientX-T.left)/T.width*100}%`,h.style.top=`${(C.clientY-T.top)/T.height*100}%`},v=()=>{R=!1,h.classList.remove("bs-dragging"),document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",v),Lt()};document.addEventListener("mousemove",b),document.addEventListener("mouseup",v)}),Et.appendChild(h);let F=document.createElement("div");F.className="bs-ann-pin-item",F.innerHTML=`
1653
+ <div class="bs-ann-pin-num" style="background:${l.color}">${g+1}</div>
1603
1654
  <div class="bs-ann-pin-body">
1604
- <div class="bs-ann-pin-note">${A(l.note)}</div>
1605
- <div class="bs-ann-pin-loc">${Math.round(C)}% \xD7 ${Math.round(m)}%</div>
1606
- </div>`;let F=document.createElement("button");F.type="button",F.className="bs-ann-pin-del",F.innerHTML="&times;",F.title="Remove pin",F.addEventListener("click",()=>{p.splice(f,1),vt()}),N.appendChild(F),Ce.appendChild(N)})},c,rn=()=>a?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.35)",we=(l,f)=>{c.save(),c.strokeStyle=rn(),c.lineWidth=f+3,c.lineCap="round",c.lineJoin="round",c.globalAlpha=.5,l(),c.restore()},hs=(l,f=!1)=>{if(l.type==="draw"||l.type==="highlight"){if(l.points.length<2)return;let m=l.type==="highlight"?.25:1,T=l.type==="highlight"?l.size*4+10:l.size,N=()=>{c.beginPath(),c.moveTo(l.points[0].x,l.points[0].y);for(let F=1;F<l.points.length;F++)c.lineTo(l.points[F].x,l.points[F].y);c.stroke()};l.type!=="highlight"&&we(N,T),c.strokeStyle=l.color,c.lineWidth=T,c.lineCap="round",c.lineJoin="round",c.globalAlpha=m,N(),c.globalAlpha=1}else if(l.type==="rect"){let m=()=>c.strokeRect(l.x,l.y,l.w,l.h);we(m,l.size),c.strokeStyle=l.color,c.lineWidth=l.size,c.lineCap="round",c.lineJoin="round",m()}else if(l.type==="circle"){let m=()=>{c.beginPath(),c.ellipse(l.cx,l.cy,Math.abs(l.rx),Math.abs(l.ry),0,0,Math.PI*2),c.stroke()};we(m,l.size),c.strokeStyle=l.color,c.lineWidth=l.size,m()}else if(l.type==="arrow"){let m=Math.atan2(l.y2-l.y1,l.x2-l.x1),T=12+l.size*2,N=()=>{c.beginPath(),c.moveTo(l.x1,l.y1),c.lineTo(l.x2,l.y2),c.stroke(),c.beginPath(),c.moveTo(l.x2,l.y2),c.lineTo(l.x2-T*Math.cos(m-.45),l.y2-T*Math.sin(m-.45)),c.moveTo(l.x2,l.y2),c.lineTo(l.x2-T*Math.cos(m+.45),l.y2-T*Math.sin(m+.45)),c.stroke()};we(N,l.size),c.strokeStyle=l.color,c.lineWidth=l.size,c.lineCap="round",c.lineJoin="round",N()}else if(l.type==="text"){let m=l.size*5+12;c.font=`bold ${m}px Inter, -apple-system, sans-serif`,c.fillStyle=rn(),c.globalAlpha=.6,c.fillText(l.text,l.x+1,l.y+1),c.globalAlpha=1,c.fillStyle=l.color,c.fillText(l.text,l.x,l.y)}let g=!f&&b>=0&&d[b]===l,C=!f&&!g&&y>=0&&d[y]===l;if(g||C){let m=Ve(l);if(c.save(),c.setLineDash([6,4]),c.strokeStyle=a?"#fff":"#000",c.lineWidth=g?1.5:1,c.globalAlpha=g?.7:.45,c.strokeRect(m.x-4,m.y-4,m.w+8,m.h+8),l.type==="rect"||l.type==="circle"){c.setLineDash([]),c.globalAlpha=g?.9:.6;let N=l.type==="rect"?[[m.x,m.y],[m.x+m.w,m.y],[m.x,m.y+m.h],[m.x+m.w,m.y+m.h]]:[[m.x+m.w/2,m.y],[m.x+m.w,m.y+m.h/2],[m.x+m.w/2,m.y+m.h],[m.x,m.y+m.h/2]];for(let[F,M]of N)c.fillStyle="#fff",c.fillRect(F-5,M-5,10,10),c.strokeStyle=a?"#aaa":"#333",c.lineWidth=1.2,c.strokeRect(F-5,M-5,10,10)}c.restore()}},U=()=>{c.clearRect(0,0,v.width,v.height),c.drawImage(re,0,0);for(let l of d)hs(l)},Ve=l=>{if(l.type==="rect")return{x:Math.min(l.x,l.x+l.w),y:Math.min(l.y,l.y+l.h),w:Math.abs(l.w),h:Math.abs(l.h)};if(l.type==="circle")return{x:l.cx-Math.abs(l.rx),y:l.cy-Math.abs(l.ry),w:Math.abs(l.rx)*2,h:Math.abs(l.ry)*2};if(l.type==="arrow"){let T=Math.min(l.x1,l.x2),N=Math.min(l.y1,l.y2);return{x:T,y:N,w:Math.abs(l.x2-l.x1)||20,h:Math.abs(l.y2-l.y1)||20}}if(l.type==="text")return{x:l.x,y:l.y-(l.size*5+12),w:l.text.length*(l.size*3+8),h:l.size*5+16};if(l.points.length===0)return{x:0,y:0,w:0,h:0};let f=1/0,g=1/0,C=-1/0,m=-1/0;for(let T of l.points)f=Math.min(f,T.x),g=Math.min(g,T.y),C=Math.max(C,T.x),m=Math.max(m,T.y);return{x:f,y:g,w:C-f||10,h:m-g||10}},wt=(l,f)=>{for(let g=d.length-1;g>=0;g--){let C=Ve(d[g]),m=8;if(l>=C.x-m&&l<=C.x+C.w+m&&f>=C.y-m&&f<=C.y+C.h+m)return g}return-1},ys=(l,f,g)=>{if(l.type==="draw"||l.type==="highlight")for(let C of l.points)C.x+=f,C.y+=g;else l.type==="rect"?(l.x+=f,l.y+=g):l.type==="circle"?(l.cx+=f,l.cy+=g):l.type==="arrow"?(l.x1+=f,l.y1+=g,l.x2+=f,l.y2+=g):l.type==="text"&&(l.x+=f,l.y+=g)};re.onload=()=>{let f=(e.clientWidth||450)/re.width;v.width=re.width,v.height=re.height,v.style.height=`${re.height*f}px`,c=v.getContext("2d"),c.drawImage(re,0,0);let g=[[10,10],[v.width-10,10],[10,v.height-10],[v.width-10,v.height-10],[v.width/2,v.height/2]],C=0;for(let[M,u]of g){let x=c.getImageData(M,u,1,1).data;C+=(x[0]*299+x[1]*587+x[2]*114)/1e3}a=C/g.length<128;let m=M=>{let u=v.getBoundingClientRect();return{x:(M.clientX-u.left)*(v.width/u.width),y:(M.clientY-u.top)*(v.height/u.height)}},T=!1;v.addEventListener("mousedown",M=>{let u=m(M);if(s==="select"){let x=wt(u.x,u.y);if(x>=0){b=x,w=!0;let S=Ve(d[x]);me=u.x-S.x,Ye=u.y-S.y,v.classList.add("bs-grabbing"),v.classList.remove("bs-grab"),U()}else b=-1,U();return}if(s!=="pin"&&s!=="text"){let x=wt(u.x,u.y);if(x>=0){b=x,w=!0,T=!0;let S=Ve(d[x]);me=u.x-S.x,Ye=u.y-S.y,v.classList.add("bs-grabbing"),U();return}}if(k=!0,D=u.x,B=u.y,s==="pin"){k=!1;let x=prompt("Describe the issue at this spot:");if(x){let S=gt[p.length%gt.length];p.push({x:u.x,y:u.y,note:x,color:S}),vt()}return}if(s==="text"){k=!1;let x=prompt("Enter text:");x&&(d.push({type:"text",color:r,size:o,x:u.x,y:u.y,text:x}),U());return}(s==="draw"||s==="highlight")&&(j=[{x:u.x,y:u.y}])}),v.addEventListener("mousemove",M=>{let u=m(M);if(w&&b>=0){let x=Ve(d[b]),S=u.x-me-x.x,L=u.y-Ye-x.y;ys(d[b],S,L),U();return}if(s==="select"){let x=wt(u.x,u.y);v.classList.toggle("bs-grab",x>=0),y!==x&&(y=x,U());return}if(s!=="pin"&&s!=="text"&&!k){let x=wt(u.x,u.y);v.classList.toggle("bs-grab",x>=0),y!==x&&(y=x,U())}if(k){if(s==="draw"||s==="highlight"){j.push({x:u.x,y:u.y}),U();let x=s==="highlight"?.25:1,S=s==="highlight"?o*4+10:o;if(s!=="highlight"){c.save(),c.strokeStyle=rn(),c.lineWidth=S+3,c.lineCap="round",c.lineJoin="round",c.globalAlpha=.5,c.beginPath(),c.moveTo(j[0].x,j[0].y);for(let L=1;L<j.length;L++)c.lineTo(j[L].x,j[L].y);c.stroke(),c.restore()}c.strokeStyle=r,c.lineWidth=S,c.lineCap="round",c.lineJoin="round",c.globalAlpha=x,c.beginPath(),c.moveTo(j[0].x,j[0].y);for(let L=1;L<j.length;L++)c.lineTo(j[L].x,j[L].y);c.stroke(),c.globalAlpha=1}else if(U(),c.strokeStyle=r,c.lineWidth=o,c.lineCap="round",c.lineJoin="round",s==="rect")we(()=>c.strokeRect(D,B,u.x-D,u.y-B),o),c.strokeStyle=r,c.lineWidth=o,c.strokeRect(D,B,u.x-D,u.y-B);else if(s==="circle"){let x=Math.abs(u.x-D)/2,S=Math.abs(u.y-B)/2,L=D+(u.x-D)/2,Nn=B+(u.y-B)/2;we(()=>{c.beginPath(),c.ellipse(L,Nn,x,S,0,0,Math.PI*2),c.stroke()},o),c.strokeStyle=r,c.lineWidth=o,c.beginPath(),c.ellipse(L,Nn,x,S,0,0,Math.PI*2),c.stroke()}else if(s==="arrow"){let x=Math.atan2(u.y-B,u.x-D),S=12+o*2,L=()=>{c.beginPath(),c.moveTo(D,B),c.lineTo(u.x,u.y),c.stroke(),c.beginPath(),c.moveTo(u.x,u.y),c.lineTo(u.x-S*Math.cos(x-.45),u.y-S*Math.sin(x-.45)),c.moveTo(u.x,u.y),c.lineTo(u.x-S*Math.cos(x+.45),u.y-S*Math.sin(x+.45)),c.stroke()};we(L,o),c.strokeStyle=r,c.lineWidth=o,c.lineCap="round",c.lineJoin="round",L()}}});let N=M=>{if(w)return w=!1,T=!1,b=-1,v.classList.remove("bs-grabbing"),v.classList.remove("bs-grab"),U(),void 0;if(!k)return;k=!1;let u=m(M);if(s==="draw"||s==="highlight")j.length>1&&d.push({type:s,color:r,size:o,alpha:s==="highlight"?.25:1,points:[...j]}),j=[];else if(s==="rect")d.push({type:"rect",color:r,size:o,x:D,y:B,w:u.x-D,h:u.y-B});else if(s==="circle"){let x=Math.abs(u.x-D)/2,S=Math.abs(u.y-B)/2;d.push({type:"circle",color:r,size:o,cx:D+(u.x-D)/2,cy:B+(u.y-B)/2,rx:x,ry:S})}else s==="arrow"&&d.push({type:"arrow",color:r,size:o,x1:D,y1:B,x2:u.x,y2:u.y});U()};v.addEventListener("mouseup",N),v.addEventListener("mouseleave",M=>{w?(w=!1,T=!1,v.classList.remove("bs-grabbing"),v.classList.remove("bs-grab"),U()):k&&N(M)});let F=M=>{b>=0&&(M.key==="Delete"||M.key==="Backspace")&&(d.splice(b,1),b=-1,U())};document.addEventListener("keydown",F),Bn.addEventListener("click",()=>{d.length&&(d.pop(),b=-1,U())}),On.addEventListener("click",()=>{d.length=0,p.length=0,b=-1,U(),vt()})};let xs=()=>{for(let l=0;l<p.length;l++){let f=p[l],g=16;c.beginPath(),c.arc(f.x,f.y-g,g,0,Math.PI*2),c.fillStyle=f.color,c.fill(),c.strokeStyle="#fff",c.lineWidth=2,c.stroke(),c.beginPath(),c.moveTo(f.x-8,f.y-6),c.lineTo(f.x,f.y+4),c.lineTo(f.x+8,f.y-6),c.fillStyle=f.color,c.fill(),c.fillStyle="#fff",c.font="bold 14px Inter, sans-serif",c.textAlign="center",c.textBaseline="middle",c.fillText(`${l+1}`,f.x,f.y-g),c.textAlign="start",c.textBaseline="alphabetic"}};return{getAnnotation:()=>{try{return b=-1,U(),xs(),v.toDataURL("image/jpeg",.7)}catch{return null}},getPins:()=>p.map((l,f)=>({number:f+1,x:Math.round(l.x),y:Math.round(l.y),note:l.note}))}}function bt(e){if(!h)return;We=e,h.querySelectorAll(".bs-tab").forEach(r=>{r.classList.toggle("bs-active",r.dataset.tab===e)});let t=h.querySelector(".bs-scroll"),n={report:rs,console:Wo,network:_o,context:Xo,history:Yo,settings:Vo};t.innerHTML=n[e](),t.scrollTop=0,ss()}function ss(){if(!h)return;if(We==="history"){h.querySelectorAll("[data-hist-del]").forEach(n=>{n.addEventListener("click",()=>{let r=parseInt(n.dataset.histDel),s=h.querySelector(`[data-hist-id="${r}"]`);if(!s)return;let o=s.querySelector(".bs-hist-confirm");if(o){o.remove();return}let i=document.createElement("div");i.className="bs-hist-confirm",i.innerHTML="<span>Delete this report?</span>";let a=document.createElement("button");a.type="button",a.className="bs-hist-confirm-yes",a.textContent="Delete";let d=document.createElement("button");d.type="button",d.className="bs-hist-confirm-no",d.textContent="Cancel",a.addEventListener("click",()=>{Uo(r),bt("history")}),d.addEventListener("click",()=>i.remove()),i.appendChild(a),i.appendChild(d),s.appendChild(i)})}),h.querySelectorAll("[data-hist-edit]").forEach(n=>{n.addEventListener("click",()=>{let r=parseInt(n.dataset.histEdit),s=h.querySelector(`[data-hist-id="${r}"]`);if(!s)return;let o=s.querySelector(".bs-hist-edit-wrap");if(o){o.remove();return}s.querySelector(".bs-hist-confirm")?.remove();let i=_e().find(w=>w.id===r);if(!i)return;let a=document.createElement("div");a.className="bs-hist-edit-wrap",a.innerHTML=`
1655
+ <div class="bs-ann-pin-note">${B(l.note)}</div>
1656
+ <div class="bs-ann-pin-loc">${Math.round(A)}% \xD7 ${Math.round(m)}%</div>
1657
+ </div>`;let _=document.createElement("button");_.type="button",_.className="bs-ann-pin-del",_.innerHTML="&times;",_.title="Remove pin",_.addEventListener("click",()=>{u.splice(g,1),Lt()}),F.appendChild(_),Te.appendChild(F)})},d,ln=()=>i?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.35)",ke=(l,g)=>{d.save(),d.strokeStyle=ln(),d.lineWidth=g+3,d.lineCap="round",d.lineJoin="round",d.globalAlpha=.5,l(),d.restore()},Cs=(l,g=!1)=>{if(l.type==="draw"||l.type==="highlight"){if(l.points.length<2)return;let m=l.type==="highlight"?.25:1,R=l.type==="highlight"?l.size*4+10:l.size,F=()=>{d.beginPath(),d.moveTo(l.points[0].x,l.points[0].y);for(let _=1;_<l.points.length;_++)d.lineTo(l.points[_].x,l.points[_].y);d.stroke()};l.type!=="highlight"&&ke(F,R),d.strokeStyle=l.color,d.lineWidth=R,d.lineCap="round",d.lineJoin="round",d.globalAlpha=m,F(),d.globalAlpha=1}else if(l.type==="rect"){let m=()=>d.strokeRect(l.x,l.y,l.w,l.h);ke(m,l.size),d.strokeStyle=l.color,d.lineWidth=l.size,d.lineCap="round",d.lineJoin="round",m()}else if(l.type==="circle"){let m=()=>{d.beginPath(),d.ellipse(l.cx,l.cy,Math.abs(l.rx),Math.abs(l.ry),0,0,Math.PI*2),d.stroke()};ke(m,l.size),d.strokeStyle=l.color,d.lineWidth=l.size,m()}else if(l.type==="arrow"){let m=Math.atan2(l.y2-l.y1,l.x2-l.x1),R=12+l.size*2,F=()=>{d.beginPath(),d.moveTo(l.x1,l.y1),d.lineTo(l.x2,l.y2),d.stroke(),d.beginPath(),d.moveTo(l.x2,l.y2),d.lineTo(l.x2-R*Math.cos(m-.45),l.y2-R*Math.sin(m-.45)),d.moveTo(l.x2,l.y2),d.lineTo(l.x2-R*Math.cos(m+.45),l.y2-R*Math.sin(m+.45)),d.stroke()};ke(F,l.size),d.strokeStyle=l.color,d.lineWidth=l.size,d.lineCap="round",d.lineJoin="round",F()}else if(l.type==="text"){let m=l.size*5+12;d.font=`bold ${m}px Inter, -apple-system, sans-serif`,d.fillStyle=ln(),d.globalAlpha=.6,d.fillText(l.text,l.x+1,l.y+1),d.globalAlpha=1,d.fillStyle=l.color,d.fillText(l.text,l.x,l.y)}let h=!g&&p>=0&&c[p]===l,A=!g&&!h&&f>=0&&c[f]===l;if(h||A){let m=Ke(l);if(d.save(),d.setLineDash([6,4]),d.strokeStyle=i?"#fff":"#000",d.lineWidth=h?1.5:1,d.globalAlpha=h?.7:.45,d.strokeRect(m.x-4,m.y-4,m.w+8,m.h+8),l.type==="rect"||l.type==="circle"){d.setLineDash([]),d.globalAlpha=h?.9:.6;let F=l.type==="rect"?[[m.x,m.y],[m.x+m.w,m.y],[m.x,m.y+m.h],[m.x+m.w,m.y+m.h]]:[[m.x+m.w/2,m.y],[m.x+m.w,m.y+m.h/2],[m.x+m.w/2,m.y+m.h],[m.x,m.y+m.h/2]];for(let[_,H]of F)d.fillStyle="#fff",d.fillRect(_-5,H-5,10,10),d.strokeStyle=i?"#aaa":"#333",d.lineWidth=1.2,d.strokeRect(_-5,H-5,10,10)}d.restore()}},U=()=>{d.clearRect(0,0,k.width,k.height),d.drawImage(se,0,0);for(let l of c)Cs(l)},Ke=l=>{if(l.type==="rect")return{x:Math.min(l.x,l.x+l.w),y:Math.min(l.y,l.y+l.h),w:Math.abs(l.w),h:Math.abs(l.h)};if(l.type==="circle")return{x:l.cx-Math.abs(l.rx),y:l.cy-Math.abs(l.ry),w:Math.abs(l.rx)*2,h:Math.abs(l.ry)*2};if(l.type==="arrow"){let R=Math.min(l.x1,l.x2),F=Math.min(l.y1,l.y2);return{x:R,y:F,w:Math.abs(l.x2-l.x1)||20,h:Math.abs(l.y2-l.y1)||20}}if(l.type==="text")return{x:l.x,y:l.y-(l.size*5+12),w:l.text.length*(l.size*3+8),h:l.size*5+16};if(l.points.length===0)return{x:0,y:0,w:0,h:0};let g=1/0,h=1/0,A=-1/0,m=-1/0;for(let R of l.points)g=Math.min(g,R.x),h=Math.min(h,R.y),A=Math.max(A,R.x),m=Math.max(m,R.y);return{x:g,y:h,w:A-g||10,h:m-h||10}},St=(l,g)=>{for(let h=c.length-1;h>=0;h--){let A=Ke(c[h]),m=8;if(l>=A.x-m&&l<=A.x+A.w+m&&g>=A.y-m&&g<=A.y+A.h+m)return h}return-1},Ts=(l,g,h)=>{if(l.type==="draw"||l.type==="highlight")for(let A of l.points)A.x+=g,A.y+=h;else l.type==="rect"?(l.x+=g,l.y+=h):l.type==="circle"?(l.cx+=g,l.cy+=h):l.type==="arrow"?(l.x1+=g,l.y1+=h,l.x2+=g,l.y2+=h):l.type==="text"&&(l.x+=g,l.y+=h)};se.onload=()=>{let g=(e.clientWidth||450)/se.width;k.width=se.width,k.height=se.height,k.style.height=`${se.height*g}px`,d=k.getContext("2d"),d.drawImage(se,0,0);let h=[[10,10],[k.width-10,10],[10,k.height-10],[k.width-10,k.height-10],[k.width/2,k.height/2]],A=0;for(let[H,b]of h){let v=d.getImageData(H,b,1,1).data;A+=(v[0]*299+v[1]*587+v[2]*114)/1e3}i=A/h.length<128;let m=H=>{let b=k.getBoundingClientRect();return{x:(H.clientX-b.left)*(k.width/b.width),y:(H.clientY-b.top)*(k.height/b.height)}},R=!1;k.addEventListener("mousedown",H=>{let b=m(H);if(s==="select"){let v=St(b.x,b.y);if(v>=0){p=v,w=!0;let C=Ke(c[v]);M=b.x-C.x,re=b.y-C.y,k.classList.add("bs-grabbing"),k.classList.remove("bs-grab"),U()}else p=-1,U();return}if(s!=="pin"&&s!=="text"){let v=St(b.x,b.y);if(v>=0){p=v,w=!0,R=!0;let C=Ke(c[v]);M=b.x-C.x,re=b.y-C.y,k.classList.add("bs-grabbing"),U();return}}if(S=!0,N=b.x,j=b.y,s==="pin"){S=!1;let v=prompt("Describe the issue at this spot:");if(v){let C=on[u.length%on.length];u.push({x:b.x,y:b.y,note:v,color:C}),Lt()}return}if(s==="text"){S=!1;let v=prompt("Enter text:");v&&(c.push({type:"text",color:r,size:o,x:b.x,y:b.y,text:v}),U());return}(s==="draw"||s==="highlight")&&(q=[{x:b.x,y:b.y}])}),k.addEventListener("mousemove",H=>{let b=m(H);if(w&&p>=0){let v=Ke(c[p]),C=b.x-M-v.x,T=b.y-re-v.y;Ts(c[p],C,T),U();return}if(s==="select"){let v=St(b.x,b.y);k.classList.toggle("bs-grab",v>=0),f!==v&&(f=v,U());return}if(s!=="pin"&&s!=="text"&&!S){let v=St(b.x,b.y);k.classList.toggle("bs-grab",v>=0),f!==v&&(f=v,U())}if(S){if(s==="draw"||s==="highlight"){q.push({x:b.x,y:b.y}),U();let v=s==="highlight"?.25:1,C=s==="highlight"?o*4+10:o;if(s!=="highlight"){d.save(),d.strokeStyle=ln(),d.lineWidth=C+3,d.lineCap="round",d.lineJoin="round",d.globalAlpha=.5,d.beginPath(),d.moveTo(q[0].x,q[0].y);for(let T=1;T<q.length;T++)d.lineTo(q[T].x,q[T].y);d.stroke(),d.restore()}d.strokeStyle=r,d.lineWidth=C,d.lineCap="round",d.lineJoin="round",d.globalAlpha=v,d.beginPath(),d.moveTo(q[0].x,q[0].y);for(let T=1;T<q.length;T++)d.lineTo(q[T].x,q[T].y);d.stroke(),d.globalAlpha=1}else if(U(),d.strokeStyle=r,d.lineWidth=o,d.lineCap="round",d.lineJoin="round",s==="rect")ke(()=>d.strokeRect(N,j,b.x-N,b.y-j),o),d.strokeStyle=r,d.lineWidth=o,d.strokeRect(N,j,b.x-N,b.y-j);else if(s==="circle"){let v=Math.abs(b.x-N)/2,C=Math.abs(b.y-j)/2,T=N+(b.x-N)/2,_n=j+(b.y-j)/2;ke(()=>{d.beginPath(),d.ellipse(T,_n,v,C,0,0,Math.PI*2),d.stroke()},o),d.strokeStyle=r,d.lineWidth=o,d.beginPath(),d.ellipse(T,_n,v,C,0,0,Math.PI*2),d.stroke()}else if(s==="arrow"){let v=Math.atan2(b.y-j,b.x-N),C=12+o*2,T=()=>{d.beginPath(),d.moveTo(N,j),d.lineTo(b.x,b.y),d.stroke(),d.beginPath(),d.moveTo(b.x,b.y),d.lineTo(b.x-C*Math.cos(v-.45),b.y-C*Math.sin(v-.45)),d.moveTo(b.x,b.y),d.lineTo(b.x-C*Math.cos(v+.45),b.y-C*Math.sin(v+.45)),d.stroke()};ke(T,o),d.strokeStyle=r,d.lineWidth=o,d.lineCap="round",d.lineJoin="round",T()}}});let F=H=>{if(w)return w=!1,R=!1,p=-1,k.classList.remove("bs-grabbing"),k.classList.remove("bs-grab"),U(),void 0;if(!S)return;S=!1;let b=m(H);if(s==="draw"||s==="highlight")q.length>1&&c.push({type:s,color:r,size:o,alpha:s==="highlight"?.25:1,points:[...q]}),q=[];else if(s==="rect")c.push({type:"rect",color:r,size:o,x:N,y:j,w:b.x-N,h:b.y-j});else if(s==="circle"){let v=Math.abs(b.x-N)/2,C=Math.abs(b.y-j)/2;c.push({type:"circle",color:r,size:o,cx:N+(b.x-N)/2,cy:j+(b.y-j)/2,rx:v,ry:C})}else s==="arrow"&&c.push({type:"arrow",color:r,size:o,x1:N,y1:j,x2:b.x,y2:b.y});U()};k.addEventListener("mouseup",F),k.addEventListener("mouseleave",H=>{w?(w=!1,R=!1,k.classList.remove("bs-grabbing"),k.classList.remove("bs-grab"),U()):S&&F(H)});let _=H=>{p>=0&&(H.key==="Delete"||H.key==="Backspace")&&(c.splice(p,1),p=-1,U())};document.addEventListener("keydown",_),Fn.addEventListener("click",()=>{c.length&&(c.pop(),p=-1,U())}),Un.addEventListener("click",()=>{c.length=0,u.length=0,p=-1,U(),Lt()})};let $s=()=>{for(let l=0;l<u.length;l++){let g=u[l],h=16;d.beginPath(),d.arc(g.x,g.y-h,h,0,Math.PI*2),d.fillStyle=g.color,d.fill(),d.strokeStyle="#fff",d.lineWidth=2,d.stroke(),d.beginPath(),d.moveTo(g.x-8,g.y-6),d.lineTo(g.x,g.y+4),d.lineTo(g.x+8,g.y-6),d.fillStyle=g.color,d.fill(),d.fillStyle="#fff",d.font="bold 14px Inter, sans-serif",d.textAlign="center",d.textBaseline="middle",d.fillText(`${l+1}`,g.x,g.y-h),d.textAlign="start",d.textBaseline="alphabetic"}};return{getAnnotation:()=>{try{return p=-1,U(),$s(),k.toDataURL("image/jpeg",.7)}catch{return null}},getPins:()=>u.map((l,g)=>({number:g+1,x:Math.round(l.x),y:Math.round(l.y),note:l.note}))}}function gt(e){if(!y)return;Xe=e,y.querySelectorAll(".bs-tab").forEach(r=>{r.classList.toggle("bs-active",r.dataset.tab===e)});let t=y.querySelector(".bs-scroll"),n={report:us,console:ti,network:ni,context:ri,history:si,settings:oi};t.innerHTML=n[e](),t.scrollTop=0,bs()}function bs(){if(!y)return;if(Xe==="history"){y.querySelectorAll("[data-hist-del]").forEach(n=>{n.addEventListener("click",()=>{let r=parseInt(n.dataset.histDel),s=y.querySelector(`[data-hist-id="${r}"]`);if(!s)return;let o=s.querySelector(".bs-hist-confirm");if(o){o.remove();return}let a=document.createElement("div");a.className="bs-hist-confirm",a.innerHTML="<span>Delete this report?</span>";let i=document.createElement("button");i.type="button",i.className="bs-hist-confirm-yes",i.textContent="Delete";let c=document.createElement("button");c.type="button",c.className="bs-hist-confirm-no",c.textContent="Cancel",i.addEventListener("click",()=>{Zo(r),gt("history")}),c.addEventListener("click",()=>a.remove()),a.appendChild(i),a.appendChild(c),s.appendChild(a)})}),y.querySelectorAll("[data-hist-edit]").forEach(n=>{n.addEventListener("click",()=>{let r=parseInt(n.dataset.histEdit),s=y.querySelector(`[data-hist-id="${r}"]`);if(!s)return;let o=s.querySelector(".bs-hist-edit-wrap");if(o){o.remove();return}s.querySelector(".bs-hist-confirm")?.remove();let a=Ye().find(w=>w.id===r);if(!a)return;let i=document.createElement("div");i.className="bs-hist-edit-wrap",i.innerHTML=`
1607
1658
  <div class="bs-field" style="margin-bottom:8px">
1608
- <input class="bs-input" data-edit-title value="${A(i.title)}" />
1659
+ <input class="bs-input" data-edit-title value="${B(a.title)}" />
1609
1660
  </div>
1610
1661
  <div class="bs-field" style="margin-bottom:8px">
1611
- <textarea class="bs-textarea" data-edit-desc style="min-height:56px">${A(i.description)}</textarea>
1662
+ <textarea class="bs-textarea" data-edit-desc style="min-height:56px">${B(a.description)}</textarea>
1612
1663
  </div>
1613
1664
  <div class="bs-field" style="margin-bottom:8px">
1614
1665
  <div class="bs-sev-row">
1615
- <button type="button" class="bs-sev-btn bs-sev-low${i.severity==="low"?" bs-picked":""}" data-edit-sev="low">Low</button>
1616
- <button type="button" class="bs-sev-btn bs-sev-medium${i.severity==="medium"?" bs-picked":""}" data-edit-sev="medium">Medium</button>
1617
- <button type="button" class="bs-sev-btn bs-sev-high${i.severity==="high"?" bs-picked":""}" data-edit-sev="high">High</button>
1618
- <button type="button" class="bs-sev-btn bs-sev-critical${i.severity==="critical"?" bs-picked":""}" data-edit-sev="critical">Critical</button>
1666
+ <button type="button" class="bs-sev-btn bs-sev-low${a.severity==="low"?" bs-picked":""}" data-edit-sev="low">Low</button>
1667
+ <button type="button" class="bs-sev-btn bs-sev-medium${a.severity==="medium"?" bs-picked":""}" data-edit-sev="medium">Medium</button>
1668
+ <button type="button" class="bs-sev-btn bs-sev-high${a.severity==="high"?" bs-picked":""}" data-edit-sev="high">High</button>
1669
+ <button type="button" class="bs-sev-btn bs-sev-critical${a.severity==="critical"?" bs-picked":""}" data-edit-sev="critical">Critical</button>
1619
1670
  </div>
1620
1671
  </div>
1621
- <div class="bs-hist-edit-row"></div>`;let d=i.severity;s.appendChild(a),a.querySelectorAll("[data-edit-sev]").forEach(w=>{w.addEventListener("click",()=>{d=w.dataset.editSev,a.querySelectorAll(".bs-sev-btn").forEach(k=>k.classList.remove("bs-picked")),w.classList.add("bs-picked")})});let p=a.querySelector(".bs-hist-edit-row"),b=document.createElement("button");b.type="button",b.className="bs-hist-save",b.textContent="Save";let y=document.createElement("button");y.type="button",y.className="bs-hist-cancel",y.textContent="Cancel",b.addEventListener("click",()=>{let w=a.querySelector("[data-edit-title]").value.trim(),k=a.querySelector("[data-edit-desc]").value.trim();w&&(Fo(r,{title:w,description:k,severity:d}),bt("history"))}),y.addEventListener("click",()=>a.remove()),p.appendChild(b),p.appendChild(y)})});return}if(We==="settings"){h.querySelectorAll("[data-set-theme]").forEach(n=>{n.addEventListener("click",()=>{let r=n.dataset.setTheme;Kt(r),h.querySelectorAll("[data-set-theme]").forEach(s=>s.classList.remove("bs-picked")),n.classList.add("bs-picked")})}),h.querySelectorAll("[data-set-layout]").forEach(n=>{n.addEventListener("click",()=>{let r=n.dataset.setLayout,s=ot(r);s&&(Ee=s,Z(),setTimeout(()=>{We="settings",be(),setTimeout(()=>bt("settings"),50)},400))})});return}if(We!=="report")return;h.querySelectorAll(".bs-cat-btn").forEach(n=>{n.addEventListener("click",()=>{let r=n.dataset.cat;h.querySelector('input[name="category"]').value=r,h.querySelectorAll(".bs-cat-btn").forEach(s=>s.classList.remove("bs-picked")),n.classList.add("bs-picked")})}),h.querySelectorAll(".bs-sev-btn").forEach(n=>{n.addEventListener("click",()=>{let r=n.dataset.sev;h.querySelector('input[name="severity"]').value=r,h.querySelectorAll(".bs-sev-btn").forEach(s=>s.classList.remove("bs-picked")),n.classList.add("bs-picked")})});let e=null,t=null;h.querySelector("[data-bs-screenshot]")?.addEventListener("click",async()=>{let n=h?.querySelector("[data-bs-shot-title]"),r=h?.querySelector("[data-bs-shot-sub]"),s=h?.querySelector("[data-bs-screenshot]");if(n&&(n.textContent="Capturing..."),h&&(h.style.visibility="hidden"),G&&(G.style.visibility="hidden"),await new Promise(o=>setTimeout(o,200)),e=await mn(!0),h&&(h.style.visibility=""),G&&(G.style.visibility=""),e){n&&(n.textContent="Screenshot captured!"),r&&(r.textContent="Draw on the image below to highlight the issue"),s?.classList.add("bs-captured");let o=h?.querySelector("[data-bs-annotate]");o&&(t=Jo(o,e))}else n&&(n.textContent="Screenshot unavailable"),r&&(r.textContent="Could not capture screenshot on this page")}),h.querySelector("[data-bs-form]")?.addEventListener("submit",async n=>{n.preventDefault();let r=n.target,s=r.querySelector(".bs-submit-btn"),o=r.elements.namedItem("title").value.trim(),i=r.elements.namedItem("description").value.trim(),a=r.elements.namedItem("severity").value,d=r.elements.namedItem("category").value;if(!o)return;s.disabled=!0,s.textContent="Sending...";let p=ns(),b={projectId:V.projectId,title:o,description:i,category:d,severity:a,tags:p.tags.length?p.tags:void 0,context:ts(),consoleLogs:le(),errors:ce(),networkCaptures:fe(),breadcrumbs:Te(),performance:Ae()??void 0,screenshot:e??void 0,annotation:t?.getAnnotation()??void 0,pins:t?.getPins().length?t.getPins():void 0,createdAt:Date.now()},y=await yn(b);qo({title:b.title,description:b.description,category:b.category,severity:b.severity,tags:b.tags,screenshot:b.screenshot,pins:b.pins,url:window.location.href,createdAt:b.createdAt,status:y.success?"sent":"draft"}),y.success?(s.innerHTML=`${H.check} Bug reported!`,s.classList.add("bs-submit-ok"),setTimeout(Z,1200)):(s.textContent=y.error??"Failed \u2014 saved as draft",s.classList.add("bs-submit-err"),setTimeout(()=>{s.disabled=!1,s.textContent="Submit Report",s.classList.remove("bs-submit-err")},2500))})}function be(){if(Q)return;Q=!0,We="report",Mn(),G=document.createElement("div"),G.className="bs-backdrop",oe.appendChild(G);let e=fe().length,t=ce().length;h=document.createElement("div"),h.className=`bs-modal bs-ly-${Ee.id}`,Se(h);let n=`
1672
+ <div class="bs-hist-edit-row"></div>`;let c=a.severity;s.appendChild(i),i.querySelectorAll("[data-edit-sev]").forEach(w=>{w.addEventListener("click",()=>{c=w.dataset.editSev,i.querySelectorAll(".bs-sev-btn").forEach(S=>S.classList.remove("bs-picked")),w.classList.add("bs-picked")})});let u=i.querySelector(".bs-hist-edit-row"),p=document.createElement("button");p.type="button",p.className="bs-hist-save",p.textContent="Save";let f=document.createElement("button");f.type="button",f.className="bs-hist-cancel",f.textContent="Cancel",p.addEventListener("click",()=>{let w=i.querySelector("[data-edit-title]").value.trim(),S=i.querySelector("[data-edit-desc]").value.trim();w&&(ei(r,{title:w,description:S,severity:c}),gt("history"))}),f.addEventListener("click",()=>i.remove()),u.appendChild(p),u.appendChild(f)})});return}if(Xe==="settings"){y.querySelectorAll("[data-set-theme]").forEach(n=>{n.addEventListener("click",()=>{let r=n.dataset.setTheme;en(r),y.querySelectorAll("[data-set-theme]").forEach(s=>s.classList.remove("bs-picked")),n.classList.add("bs-picked")})}),y.querySelectorAll("[data-set-layout]").forEach(n=>{n.addEventListener("click",()=>{let r=n.dataset.setLayout,s=at(r);s&&(Pe=s,ee(),setTimeout(()=>{Xe="settings",me(),setTimeout(()=>gt("settings"),50)},400))})});return}if(Xe!=="report")return;y.querySelectorAll(".bs-cat-btn").forEach(n=>{n.addEventListener("click",()=>{let r=n.dataset.cat;y.querySelector('input[name="category"]').value=r,y.querySelectorAll(".bs-cat-btn").forEach(s=>s.classList.remove("bs-picked")),n.classList.add("bs-picked")})}),y.querySelectorAll(".bs-sev-btn").forEach(n=>{n.addEventListener("click",()=>{let r=n.dataset.sev;y.querySelector('input[name="severity"]').value=r,y.querySelectorAll(".bs-sev-btn").forEach(s=>s.classList.remove("bs-picked")),n.classList.add("bs-picked")})});let e=null,t=null;y.querySelector("[data-bs-screenshot]")?.addEventListener("click",async()=>{let n=y?.querySelector("[data-bs-shot-title]"),r=y?.querySelector("[data-bs-shot-sub]"),s=y?.querySelector("[data-bs-screenshot]");if(n&&(n.textContent="Capturing..."),y&&(y.style.visibility="hidden"),Q&&(Q.style.visibility="hidden"),await new Promise(o=>setTimeout(o,200)),e=await yn(!0),y&&(y.style.visibility=""),Q&&(Q.style.visibility=""),e){n&&(n.textContent="Screenshot captured!"),r&&(r.textContent="Draw on the image below to highlight the issue"),s?.classList.add("bs-captured");let o=y?.querySelector("[data-bs-annotate]");o&&(t=ii(o,e))}else n&&(n.textContent="Screenshot unavailable"),r&&(r.textContent="Could not capture screenshot on this page")}),y.querySelector("[data-bs-form]")?.addEventListener("submit",async n=>{n.preventDefault();let r=n.target,s=r.querySelector(".bs-submit-btn"),o=r.elements.namedItem("title").value.trim(),a=r.elements.namedItem("description").value.trim(),i=r.elements.namedItem("severity").value,c=r.elements.namedItem("category").value;if(!o)return;s.disabled=!0,s.textContent="Sending...";let u=ps(),p={projectId:J.projectId,title:o,description:a,category:c,severity:i,tags:u.tags.length?u.tags:void 0,context:ds(),consoleLogs:de(),errors:pe(),networkCaptures:ge(),breadcrumbs:$e(),performance:ze()??void 0,screenshot:e??void 0,annotation:t?.getAnnotation()??void 0,pins:t?.getPins().length?t.getPins():void 0,createdAt:Date.now()},f=await kn(p);Qo({title:p.title,description:p.description,category:p.category,severity:p.severity,tags:p.tags,screenshot:p.screenshot,pins:p.pins,url:window.location.href,createdAt:p.createdAt,status:f.success?"sent":"draft"}),f.success?(s.innerHTML=`${O.check} Bug reported!`,s.classList.add("bs-submit-ok"),setTimeout(ee,1200)):(s.textContent=f.error??"Failed \u2014 saved as draft",s.classList.add("bs-submit-err"),setTimeout(()=>{s.disabled=!1,s.textContent="Submit Report",s.classList.remove("bs-submit-err")},2500))})}function me(){if(Z)return;Z=!0,Xe="report",Hn(),Q=document.createElement("div"),Q.className="bs-backdrop",ae.appendChild(Q);let e=ge().length,t=pe().length;y=document.createElement("div"),y.className=`bs-modal bs-ly-${Pe.id}`,Ce(y);let n=`
1622
1673
  <div class="bs-tabs">
1623
- <button class="bs-tab bs-active" data-tab="report">${H.report} Report</button>
1624
- <button class="bs-tab" data-tab="console">${H.console} Console <span class="bs-tab-badge">${le().length}</span></button>
1625
- <button class="bs-tab" data-tab="network">${H.network} Network ${e?`<span class="bs-tab-badge bs-warn">${e}</span>`:`<span class="bs-tab-badge">${Me().length}</span>`}</button>
1626
- <button class="bs-tab" data-tab="context">${H.ctx} Context ${t?`<span class="bs-tab-badge bs-warn">${t}</span>`:""}</button>
1627
- <button class="bs-tab" data-tab="history">${H.history} History <span class="bs-tab-badge">${_e().length}</span></button>
1628
- </div>`,r=ne(),s=r?r.name.split(" ").map(y=>y[0]).join("").toUpperCase().slice(0,2):"",o=Vt(),i=r?`
1674
+ <button class="bs-tab bs-active" data-tab="report">${O.report} Report</button>
1675
+ <button class="bs-tab" data-tab="console">${O.console} Console <span class="bs-tab-badge">${de().length}</span></button>
1676
+ <button class="bs-tab" data-tab="network">${O.network} Network ${e?`<span class="bs-tab-badge bs-warn">${e}</span>`:`<span class="bs-tab-badge">${Re().length}</span>`}</button>
1677
+ <button class="bs-tab" data-tab="context">${O.ctx} Context ${t?`<span class="bs-tab-badge bs-warn">${t}</span>`:""}</button>
1678
+ <button class="bs-tab" data-tab="history">${O.history} History <span class="bs-tab-badge">${Ye().length}</span></button>
1679
+ </div>`,r=ie(),s=r?r.name.split(" ").map(f=>f[0]).join("").toUpperCase().slice(0,2):"",o=Qt(),a=r?`
1629
1680
  <div class="bs-hdr">
1630
1681
  <div class="bs-logo">BugStash</div>
1631
1682
  <div class="bs-hdr-right">
@@ -1637,35 +1688,35 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
1637
1688
  <div class="bs-user-avatar">${s}</div>
1638
1689
  <span>${r.name.split(" ")[0]}</span>
1639
1690
  </div>
1640
- <button class="bs-hdr-icon" data-tab="settings" title="Settings">${H.settings}</button>
1691
+ <button class="bs-hdr-icon" data-tab="settings" title="Settings">${O.settings}</button>
1641
1692
  <button class="bs-login-logout" data-bs-logout title="Sign out">Logout</button>
1642
- <button class="bs-close-btn" data-bs-close title="Close">${H.x}</button>
1693
+ <button class="bs-close-btn" data-bs-close title="Close">${O.x}</button>
1643
1694
  </div>
1644
1695
  </div>`:`
1645
1696
  <div class="bs-hdr" style="justify-content:flex-end">
1646
- <button class="bs-close-btn" data-bs-close title="Close">${H.x}</button>
1647
- </div>`,a=Ee.tabPosition==="left",d=Ee.tabPosition==="bottom",p=r?rs():No();a?h.innerHTML=`
1648
- ${i}
1697
+ <button class="bs-close-btn" data-bs-close title="Close">${O.x}</button>
1698
+ </div>`,i=Pe.tabPosition==="left",c=Pe.tabPosition==="bottom",u=r?us():Ko();i?y.innerHTML=`
1699
+ ${a}
1649
1700
  <div class="bs-body-wrap">
1650
1701
  ${r?n:""}
1651
- <div class="bs-scroll">${p}</div>
1652
- </div>`:d?h.innerHTML=`
1653
- ${i}
1654
- <div class="bs-scroll">${p}</div>
1655
- ${r?`<div class="bs-tab-divider"></div>${n}`:""}`:h.innerHTML=`
1656
- ${i}
1702
+ <div class="bs-scroll">${u}</div>
1703
+ </div>`:c?y.innerHTML=`
1704
+ ${a}
1705
+ <div class="bs-scroll">${u}</div>
1706
+ ${r?`<div class="bs-tab-divider"></div>${n}`:""}`:y.innerHTML=`
1707
+ ${a}
1657
1708
  ${r?`${n}<div class="bs-tab-divider"></div>`:""}
1658
- <div class="bs-scroll">${p}</div>`,oe.appendChild(h),O&&O.classList.add("bs-open"),requestAnimationFrame(()=>{G?.classList.add("bs-in"),h?.classList.add("bs-in")}),h.querySelectorAll(".bs-tab").forEach(y=>{y.addEventListener("click",()=>bt(y.dataset.tab))}),h.querySelector('.bs-hdr-icon[data-tab="settings"]')?.addEventListener("click",()=>bt("settings")),h.querySelector("[data-bs-close]")?.addEventListener("click",Z),G.addEventListener("click",Z),h.querySelector("[data-bs-pin-toggle]")?.addEventListener("click",()=>{let y=Fe(),w=h?.querySelector("[data-bs-pin-toggle]");w&&(w.classList.toggle("active",y),w.innerHTML=`
1709
+ <div class="bs-scroll">${u}</div>`,ae.appendChild(y),x&&x.classList.add("bs-open"),requestAnimationFrame(()=>{Q?.classList.add("bs-in"),y?.classList.add("bs-in")}),y.querySelectorAll(".bs-tab").forEach(f=>{f.addEventListener("click",()=>gt(f.dataset.tab))}),y.querySelector('.bs-hdr-icon[data-tab="settings"]')?.addEventListener("click",()=>gt("settings")),y.querySelector("[data-bs-close]")?.addEventListener("click",ee),Q.addEventListener("click",ee),y.querySelector("[data-bs-pin-toggle]")?.addEventListener("click",()=>{let f=We(),w=y?.querySelector("[data-bs-pin-toggle]");w&&(w.classList.toggle("active",f),w.innerHTML=`
1659
1710
  <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"/><circle cx="12" cy="10" r="3"/></svg>
1660
- Pins ${y?"ON":"OFF"}
1661
- `)}),h.querySelector("[data-bs-logout]")?.addEventListener("click",()=>{Bt(),Z(),setTimeout(()=>be(),300)}),r?ss():Ko();let b=y=>{y.key==="Escape"&&(Z(),document.removeEventListener("keydown",b))};document.addEventListener("keydown",b)}function Ko(){if(!h)return;let e=h.querySelector("#bs-login-submit"),t=h.querySelector("#bs-login-email"),n=h.querySelector("#bs-login-pass"),r=h.querySelector("#bs-login-error");if(!e||!t||!n)return;let s=async()=>{let o=t.value.trim(),i=n.value;if(!o||!i){r.textContent="Please enter email and password",r.style.display="block";return}e.setAttribute("disabled","true"),e.textContent="Signing in...",r.style.display="none";let a=await Dt(o,i,V.projectId);a.success?(ct(V.projectId,oe),it(V.projectId),Z(),setTimeout(()=>be(),300)):(r.textContent=a.error||"Invalid credentials",r.style.display="block",e.removeAttribute("disabled"),e.textContent="Sign In")};e.addEventListener("click",s),n.addEventListener("keydown",o=>{o.key==="Enter"&&s()}),t.addEventListener("keydown",o=>{o.key==="Enter"&&n.focus()}),setTimeout(()=>t.focus(),100)}function Z(){Q&&(O&&O.classList.remove("bs-open"),h&&(h.classList.remove("bs-in"),h.classList.add("bs-out")),G&&G.classList.remove("bs-in"),setTimeout(()=>{h?.remove(),G?.remove(),h=null,G=null,Q=!1},350))}function Se(e){for(let[t,n]of Object.entries(ye.vars))e.style.setProperty(t,n)}function Kt(e){let t=jt(e);t&&(ye=t,h&&Se(h),O&&Se(O),I&&Se(I))}function os(){return ye.id}function is(e){let t=ot(e);t&&(Ee=t,Q&&(Z(),setTimeout(be,400)))}function as(){return Ee.id}function ls(e,t){V=e,oe=t,dt=document.createElement("style"),dt.textContent=`
1711
+ Pins ${f?"ON":"OFF"}
1712
+ `)}),y.querySelector("[data-bs-logout]")?.addEventListener("click",()=>{qt(),ee(),setTimeout(()=>me(),300)}),r?bs():ai();let p=f=>{f.key==="Escape"&&(ee(),document.removeEventListener("keydown",p))};document.addEventListener("keydown",p)}function ai(){if(!y)return;let e=y.querySelector("#bs-login-submit"),t=y.querySelector("#bs-login-email"),n=y.querySelector("#bs-login-pass"),r=y.querySelector("#bs-login-error");if(!e||!t||!n)return;let s=async()=>{let o=t.value.trim(),a=n.value;if(!o||!a){r.textContent="Please enter email and password",r.style.display="block";return}e.setAttribute("disabled","true"),e.textContent="Signing in...",r.style.display="none";let i=await jt(o,a,J.projectId);i.success?(ut(J.projectId,ae),lt(J.projectId),ee(),setTimeout(()=>me(),300)):(r.textContent=i.error||"Invalid credentials",r.style.display="block",e.removeAttribute("disabled"),e.textContent="Sign In")};e.addEventListener("click",s),n.addEventListener("keydown",o=>{o.key==="Enter"&&s()}),t.addEventListener("keydown",o=>{o.key==="Enter"&&n.focus()}),setTimeout(()=>t.focus(),100)}function ee(){Z&&(x&&x.classList.remove("bs-open"),y&&(y.classList.remove("bs-in"),y.classList.add("bs-out")),Q&&Q.classList.remove("bs-in"),setTimeout(()=>{y?.remove(),Q?.remove(),y=null,Q=null,Z=!1},350))}function Ce(e){for(let[t,n]of Object.entries(ve.vars))e.style.setProperty(t,n)}function en(e){let t=_t(e);t&&(ve=t,y&&Ce(y),x&&Ce(x),$&&Ce($))}function ms(){return ve.id}function fs(e){let t=at(e);t&&(Pe=t,Z&&(ee(),setTimeout(me,400)))}function gs(){return Pe.id}function li(){try{let e=localStorage.getItem(as);if(!e)return null;let t=JSON.parse(e);if(typeof t.top=="number"&&typeof t.left=="number")return t}catch{}return null}function ci(e,t){try{localStorage.setItem(as,JSON.stringify({top:e,left:t}))}catch{}}function di(e,t){let s=window.innerWidth,o=window.innerHeight;return{top:Math.max(8,Math.min(o-56-8,e)),left:Math.max(8,Math.min(s-56-8,t))}}function In(e,t){if(!x)return;let n=di(e,t);x.style.top=`${n.top}px`,x.style.left=`${n.left}px`,x.style.bottom="auto",x.style.right="auto",hs(n.top,n.left)}function hs(e,t){if(!$)return;let n=56,r=8,s=$.offsetHeight||200,o=e-s-r;o<8&&(o=e+n+r),$.style.top=`${o}px`,$.style.bottom="auto",$.style.left=`${t+n/2-20}px`,$.style.right="auto"}function pi(){if(!x)return;let e=0,t=0,n=0,r=0,s=!1;function o(){x&&(x.removeEventListener("pointermove",i),x.removeEventListener("pointerup",c),x.classList.remove("bs-dragging")),zn=null}function a(u){if(!x)return;Se=!1,s=!1,e=u.clientX,t=u.clientY;let p=x.getBoundingClientRect();n=p.top,r=p.left,x.setPointerCapture(u.pointerId),x.addEventListener("pointermove",i),x.addEventListener("pointerup",c),zn=o}function i(u){let p=u.clientX-e,f=u.clientY-t;if(!s&&Math.abs(p)<5&&Math.abs(f)<5)return;s=!0,Se=!0,x?.classList.add("bs-dragging");let w=n+f,S=r+p;In(w,S)}function c(u){if(x?.releasePointerCapture(u.pointerId),o(),s&&x){let p=x.getBoundingClientRect();ci(p.top,p.left),u.preventDefault(),u.stopPropagation(),setTimeout(()=>{Se=!1},10)}else Se=!1}x.addEventListener("pointerdown",a)}function ys(e,t){J=e,ae=t,bt=document.createElement("style"),bt.textContent=`
1662
1713
  @import url('https://fonts.googleapis.com/css2?family=Comfortaa:wght@400;600;700&family=Inter:wght@300;400;500;600;700&display=swap');
1663
- ${Oo}
1664
- ${Nr}
1665
- `,oe.appendChild(dt);let n=e.panelPosition==="bottom-left"?"left":"right";O=document.createElement("button"),O.className="bs-fab",Se(O),O.innerHTML=`${H.bug}<span class="bs-fab-label">Report a bug</span>`,O.style[n]="24px",O.addEventListener("click",()=>Q?Z():be()),oe.appendChild(O),I=document.createElement("div"),I.className="bs-toolbar",I.style[n]="32px",Se(I);let s=navigator.platform.toUpperCase().includes("MAC")?"\u2318":"Ctrl",o=[{icon:H.cam,tip:"Screenshot",kbd:`${s}+Shift+S`,action:async()=>{let i=await mn(!0);i&&(Q||be(),setTimeout(()=>{let a=h?.querySelector("[data-bs-screenshot]");if(a){a.__screenshot=i,a.classList.add("bs-captured");let d=a.querySelector("[data-bs-shot-title]"),p=a.querySelector("[data-bs-shot-sub]");d&&(d.textContent="Screenshot captured!"),p&&(p.textContent="Click to retake or annotate"),a.click()}},400))}},{icon:H.pin,tip:"Toggle Pins",kbd:`${s}+Shift+P`,id:"bs-tb-pin",action:()=>{if(!ne()){Q||be();return}oe?.querySelector("#bugstash-live-pins")||(ct(V.projectId,oe),it(V.projectId));let a=Fe(),d=I?.querySelector("#bs-tb-pin");d&&d.classList.toggle("bs-active",a);let p=h?.querySelector("[data-bs-pin-toggle]");p&&(p.classList.toggle("active",a),p.innerHTML=`
1714
+ ${Jo}
1715
+ ${_r}
1716
+ `,ae.appendChild(bt);let n=e.panelPosition==="bottom-left"?"left":"right";x=document.createElement("button"),x.className="bs-fab",Ce(x),x.innerHTML=`${O.bug}<span class="bs-fab-label">Report a bug</span>`;let r=li();r?In(r.top,r.left):x.style[n]="24px",x.addEventListener("click",()=>{Se||(Z?ee():me())}),ae.appendChild(x),pi(),$=document.createElement("div"),$.className="bs-toolbar",r?hs(r.top,r.left):$.style[n]="32px",Ce($);let o=navigator.platform.toUpperCase().includes("MAC")?"\u2318":"Ctrl",a=[{icon:O.cam,tip:"Screenshot",kbd:`${o}+Shift+S`,action:async()=>{let i=await yn(!0);i&&(Z||me(),setTimeout(()=>{let c=y?.querySelector("[data-bs-screenshot]");if(c){c.__screenshot=i,c.classList.add("bs-captured");let u=c.querySelector("[data-bs-shot-title]"),p=c.querySelector("[data-bs-shot-sub]");u&&(u.textContent="Screenshot captured!"),p&&(p.textContent="Click to retake or annotate"),c.click()}},400))}},{icon:O.pin,tip:"Toggle Pins",kbd:`${o}+Shift+P`,id:"bs-tb-pin",action:()=>{if(!ie()){Z||me();return}ae?.querySelector("#bugstash-live-pins")||(ut(J.projectId,ae),lt(J.projectId));let c=We(),u=$?.querySelector("#bs-tb-pin");u&&u.classList.toggle("bs-active",c);let p=y?.querySelector("[data-bs-pin-toggle]");p&&(p.classList.toggle("active",c),p.innerHTML=`
1666
1717
  <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"/><circle cx="12" cy="10" r="3"/></svg>
1667
- Pins ${a?"ON":"OFF"}
1668
- `)}},{icon:ye.id==="black"?H.sun:H.moon,tip:"Toggle Theme",kbd:`${s}+Shift+T`,id:"bs-tb-theme",action:()=>{let i=ye.id==="black"?"white":"black";Kt(i),I&&Se(I);let a=I?.querySelector("#bs-tb-theme");a&&(a.innerHTML=`${ye.id==="black"?H.sun:H.moon}<span class="bs-toolbar-tip">${ye.id==="black"?"Light":"Dark"} Mode<span class="bs-toolbar-kbd">${s}+Shift+T</span></span>`)}},{icon:H.report,tip:"Open Panel",kbd:`${s}+Shift+B`,action:()=>{Q?Z():be()}}];for(let i of o){let a=document.createElement("button");a.className="bs-toolbar-btn",i.id&&(a.id=i.id),a.innerHTML=`${i.icon}<span class="bs-toolbar-tip">${i.tip}<span class="bs-toolbar-kbd">${i.kbd}</span></span>`,a.addEventListener("click",d=>{d.stopPropagation(),i.action()}),I.appendChild(a)}oe.appendChild(I),O.addEventListener("mouseenter",()=>{Q||Qr()}),O.addEventListener("mouseleave",i=>{let a=i.relatedTarget;I?.contains(a)||Mn()}),I.addEventListener("mouseenter",()=>Qr()),I.addEventListener("mouseleave",i=>{let a=i.relatedTarget;O?.contains(a)||Mn()}),pt=i=>{(i.ctrlKey||i.metaKey)&&i.shiftKey&&(i.key==="B"||i.key==="b"?(i.preventDefault(),Q?Z():be()):i.key==="S"||i.key==="s"?(i.preventDefault(),o[0].action()):i.key==="P"||i.key==="p"?(i.preventDefault(),o[1].action()):(i.key==="T"||i.key==="t")&&(i.preventDefault(),o[2].action()))},document.addEventListener("keydown",pt)}function Qr(){Jt||Q||(Jt=!0,I?.classList.add("bs-show"))}function Mn(){Jt=!1,I?.classList.remove("bs-show")}function cs(){Z(),O?.remove(),O=null,I?.remove(),I=null,Jt=!1,dt?.remove(),dt=null,oe=null,pt&&document.removeEventListener("keydown",pt),pt=null}var ie=null,R=null,E=null,ue=null,Gt="freehand",Qt="#ef4444",Go=3,Xe=[],J=null,ut=!1,Zt=null,Qo=[{id:"freehand",label:"Draw",icon:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25z"},{id:"rectangle",label:"Rect",icon:"M3 3h18v18H3V3zm2 2v14h14V5H5z"},{id:"circle",label:"Circle",icon:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"},{id:"arrow",label:"Arrow",icon:"M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"}],Zo=["#ef4444","#f97316","#eab308","#22c55e","#3b82f6","#8b5cf6","#ffffff","#000000"];function bs(e){return new Promise(t=>{Zt=t,Xe=[],J=null,Gt="freehand",Qt="#ef4444",ei(e)})}function ei(e){ie&&ie.remove(),ie=document.createElement("div"),ie.id="bs-annotation-overlay";let t=document.createElement("style");t.textContent=`
1718
+ Pins ${c?"ON":"OFF"}
1719
+ `)}},{icon:ve.id==="black"?O.sun:O.moon,tip:"Toggle Theme",kbd:`${o}+Shift+T`,id:"bs-tb-theme",action:()=>{let i=ve.id==="black"?"white":"black";en(i),$&&Ce($);let c=$?.querySelector("#bs-tb-theme");c&&(c.innerHTML=`${ve.id==="black"?O.sun:O.moon}<span class="bs-toolbar-tip">${ve.id==="black"?"Light":"Dark"} Mode<span class="bs-toolbar-kbd">${o}+Shift+T</span></span>`)}},{icon:O.report,tip:"Open Panel",kbd:`${o}+Shift+B`,action:()=>{Z?ee():me()}}];for(let i of a){let c=document.createElement("button");c.className="bs-toolbar-btn",i.id&&(c.id=i.id),c.innerHTML=`${i.icon}<span class="bs-toolbar-tip">${i.tip}<span class="bs-toolbar-kbd">${i.kbd}</span></span>`,c.addEventListener("click",u=>{u.stopPropagation(),i.action()}),$.appendChild(c)}ae.appendChild($),x.addEventListener("mouseenter",()=>{Z||is()}),x.addEventListener("mouseleave",i=>{let c=i.relatedTarget;$?.contains(c)||Hn()}),$.addEventListener("mouseenter",()=>is()),$.addEventListener("mouseleave",i=>{let c=i.relatedTarget;x?.contains(c)||Hn()}),mt=i=>{(i.ctrlKey||i.metaKey)&&i.shiftKey&&(i.key==="B"||i.key==="b"?(i.preventDefault(),Z?ee():me()):i.key==="S"||i.key==="s"?(i.preventDefault(),a[0].action()):i.key==="P"||i.key==="p"?(i.preventDefault(),a[1].action()):(i.key==="T"||i.key==="t")&&(i.preventDefault(),a[2].action()))},document.addEventListener("keydown",mt),ft=()=>{if(!(!x||Se)&&x.style.top&&x.style.top!=="auto"){let i=x.getBoundingClientRect();In(i.top,i.left)}},window.addEventListener("resize",ft)}function is(){Zt||Z||(Zt=!0,$?.classList.add("bs-show"))}function Hn(){Zt=!1,$?.classList.remove("bs-show")}function vs(){ee(),zn?.(),Se=!1,x?.remove(),x=null,$?.remove(),$=null,Zt=!1,bt?.remove(),bt=null,ae=null,mt&&document.removeEventListener("keydown",mt),mt=null,ft&&window.removeEventListener("resize",ft),ft=null}var le=null,D=null,L=null,fe=null,tn="freehand",nn="#ef4444",ui=3,Ve=[],K=null,ht=!1,rn=null,bi=[{id:"freehand",label:"Draw",icon:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25z"},{id:"rectangle",label:"Rect",icon:"M3 3h18v18H3V3zm2 2v14h14V5H5z"},{id:"circle",label:"Circle",icon:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"},{id:"arrow",label:"Arrow",icon:"M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"}],mi=["#ef4444","#f97316","#eab308","#22c55e","#3b82f6","#8b5cf6","#ffffff","#000000"];function ks(e){return new Promise(t=>{rn=t,Ve=[],K=null,tn="freehand",nn="#ef4444",fi(e)})}function fi(e){le&&le.remove(),le=document.createElement("div"),le.id="bs-annotation-overlay";let t=document.createElement("style");t.textContent=`
1669
1720
  #bs-annotation-overlay {
1670
1721
  position: fixed; inset: 0; z-index: 2147483647;
1671
1722
  background: rgba(0,0,0,0.85);
@@ -1710,5 +1761,5 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
1710
1761
  overflow: hidden; padding: 16px;
1711
1762
  }
1712
1763
  .bs-ann-canvas-wrap canvas { cursor: crosshair; border-radius: 4px; }
1713
- `,ie.appendChild(t);let n=document.createElement("div");n.className="bs-ann-toolbar";for(let a of Qo){let d=document.createElement("button");d.className=`bs-ann-tool${a.id===Gt?" active":""}`,d.title=a.label,d.innerHTML=`<svg viewBox="0 0 24 24"><path d="${a.icon}"/></svg>`,d.addEventListener("click",()=>{Gt=a.id,n.querySelectorAll(".bs-ann-tool").forEach(p=>p.classList.remove("active")),d.classList.add("active")}),n.appendChild(d)}n.appendChild(ds());for(let a of Zo){let d=document.createElement("button");d.className=`bs-ann-color${a===Qt?" active":""}`,d.style.background=a,d.addEventListener("click",()=>{Qt=a,n.querySelectorAll(".bs-ann-color").forEach(p=>p.classList.remove("active")),d.classList.add("active")}),n.appendChild(d)}n.appendChild(ds());let r=document.createElement("button");r.className="bs-ann-btn bs-ann-undo",r.textContent="Undo",r.addEventListener("click",()=>{Xe.pop(),en()}),n.appendChild(r);let s=document.createElement("button");s.className="bs-ann-btn bs-ann-save",s.textContent="Save",s.addEventListener("click",ni);let o=document.createElement("button");o.className="bs-ann-btn bs-ann-cancel",o.textContent="Cancel",o.addEventListener("click",()=>{Rn(),Zt?.(null)}),n.appendChild(s),n.appendChild(o),ie.appendChild(n);let i=document.createElement("div");i.className="bs-ann-canvas-wrap",R=document.createElement("canvas"),E=R.getContext("2d"),i.appendChild(R),ie.appendChild(i),document.body.appendChild(ie),ue=new Image,ue.onload=()=>{if(!R||!E||!ue)return;let a=window.innerWidth-32,d=window.innerHeight-100,p=ue.width,b=ue.height,y=Math.min(1,a/p,d/b);p=Math.round(p*y),b=Math.round(b*y),R.width=p,R.height=b,en(),ti()},ue.src=e}function ds(){let e=document.createElement("div");return e.className="bs-ann-sep",e}function ti(){if(!R)return;R.addEventListener("mousedown",t=>{ut=!0;let{x:n,y:r}=ps(t);J={type:Gt,color:Qt,lineWidth:Go,points:[{x:n,y:r}],x:n,y:r,width:0,height:0}}),R.addEventListener("mousemove",t=>{if(!ut||!J)return;let{x:n,y:r}=ps(t);J.type==="freehand"?J.points.push({x:n,y:r}):(J.width=n-J.x,J.height=r-J.y),en(),us(J)});let e=()=>{ut&&J&&(Xe.push(J),J=null),ut=!1,en()};R.addEventListener("mouseup",e),R.addEventListener("mouseleave",e)}function ps(e){let t=R.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}}function en(){if(!(!E||!R||!ue)){E.clearRect(0,0,R.width,R.height),E.drawImage(ue,0,0,R.width,R.height);for(let e of Xe)us(e)}}function us(e){if(E)switch(E.strokeStyle=e.color,E.fillStyle=e.color,E.lineWidth=e.lineWidth,E.lineCap="round",E.lineJoin="round",e.type){case"freehand":{if(!e.points||e.points.length<2)return;E.beginPath(),E.moveTo(e.points[0].x,e.points[0].y);for(let t=1;t<e.points.length;t++)E.lineTo(e.points[t].x,e.points[t].y);E.stroke();break}case"rectangle":{E.strokeRect(e.x,e.y,e.width,e.height);break}case"circle":{let t=e.x+e.width/2,n=e.y+e.height/2,r=Math.abs(e.width)/2,s=Math.abs(e.height)/2;E.beginPath(),E.ellipse(t,n,r,s,0,0,Math.PI*2),E.stroke();break}case"arrow":{let t=e.x,n=e.y,r=e.x+e.width,s=e.y+e.height,o=14,i=Math.atan2(s-n,r-t);E.beginPath(),E.moveTo(t,n),E.lineTo(r,s),E.stroke(),E.beginPath(),E.moveTo(r,s),E.lineTo(r-o*Math.cos(i-Math.PI/6),s-o*Math.sin(i-Math.PI/6)),E.lineTo(r-o*Math.cos(i+Math.PI/6),s-o*Math.sin(i+Math.PI/6)),E.closePath(),E.fill();break}}}function ni(){if(!R){Rn(),Zt?.(null);return}let t={dataUrl:R.toDataURL("image/png"),annotations:Xe};Rn(),Zt?.(t)}function Rn(){ie?.remove(),ie=null,R=null,E=null,ue=null,Xe=[],J=null,ut=!1}var ft=!1,mt=null;function ri(){if(mt)return mt;let e=document.createElement("bugstash-root");return e.style.setProperty("position","fixed","important"),e.style.setProperty("inset","0","important"),e.style.setProperty("pointer-events","none","important"),e.style.setProperty("z-index","2147483640","important"),e.style.setProperty("display","block","important"),e.style.setProperty("visibility","visible","important"),e.style.setProperty("opacity","1","important"),e.style.setProperty("margin","0","important"),e.style.setProperty("padding","0","important"),e.style.setProperty("border","none","important"),e.style.setProperty("background","none","important"),e.style.setProperty("font-size","16px","important"),mt=e.attachShadow({mode:"open"}),document.body.appendChild(e),mt}function ms(e){if(ft)return;ft=!0;let t=ri();qn(e.maxBreadcrumbs),Xn(e.maxLogs),Gn(e.maxNetworkCaptures),er(),e.enablePerformance!==!1&&rr(),ls(e,t),e.enableLivePins!==!1&&ne()&&(ct(e.projectId,t),it(e.projectId))}function si(){if(typeof window>"u")return"production";let e=window.location.hostname;return e==="localhost"||e==="127.0.0.1"||e==="0.0.0.0"||e.endsWith(".local")||/^192\.168\./.test(e)||/^10\./.test(e)||/^172\.(1[6-9]|2\d|3[01])\./.test(e)?"development":e.includes("staging")||e.includes("stage")||e.includes("preview")||e.includes("preprod")||e.includes("pre-prod")||e.includes("qa.")||e.includes(".qa")||e.includes("test.")||e.includes(".dev.")||e.includes("vercel.app")||e.includes("netlify.app")||e.includes("pages.dev")||e.includes("ngrok.io")||e.includes("ngrok-free.app")||e.includes("localhost.run")||e.includes("loca.lt")?"staging":"production"}var fs={init(e){if(ft||typeof window>"u"||(e.environment??si())==="production")return;e.endpoint&&Tr(e.endpoint);let n=window.location.hostname;n==="localhost"||n==="127.0.0.1"||n==="0.0.0.0"||n.endsWith(".local")||/^192\.168\./.test(n)||/^10\./.test(n)||/^172\.(1[6-9]|2\d|3[01])\./.test(n)?ms(e):Hr(e.projectId).then(s=>{s&&ms(e)}).catch(()=>{})},destroy(){ft&&(cs(),Yr(),qr(),Vn(),Zn(),nr(),Fn(),sr(),document.querySelector("bugstash-root")?.remove(),mt=null,ft=!1)},getLogs:le,clearLogs:Yn,getNetworkCaptures:Me,getFailedNetworkCaptures:fe,clearNetworkCaptures:Qn,getErrors:ce,clearErrors:tr,getBreadcrumbs:Te,clearBreadcrumbs:Un,getPerformanceMetrics:Ae,addBreadcrumb:Y,getThemes:Nt,getThemeById:jt,setTheme:Kt,getCurrentThemeId:os,getLayouts:qt,getLayoutById:ot,setLayout:is,getCurrentLayoutId:as,getCurrentUser:ne,login:Dt,logout:Bt,togglePinMode:Fe,isPinModeActive:Vt,isConnected:Ur,openAnnotationEditor:bs,redactString:Pe,redactObject:Et},oi=fs;0&&(module.exports={BugStash});
1764
+ `,le.appendChild(t);let n=document.createElement("div");n.className="bs-ann-toolbar";for(let i of bi){let c=document.createElement("button");c.className=`bs-ann-tool${i.id===tn?" active":""}`,c.title=i.label,c.innerHTML=`<svg viewBox="0 0 24 24"><path d="${i.icon}"/></svg>`,c.addEventListener("click",()=>{tn=i.id,n.querySelectorAll(".bs-ann-tool").forEach(u=>u.classList.remove("active")),c.classList.add("active")}),n.appendChild(c)}n.appendChild(xs());for(let i of mi){let c=document.createElement("button");c.className=`bs-ann-color${i===nn?" active":""}`,c.style.background=i,c.addEventListener("click",()=>{nn=i,n.querySelectorAll(".bs-ann-color").forEach(u=>u.classList.remove("active")),c.classList.add("active")}),n.appendChild(c)}n.appendChild(xs());let r=document.createElement("button");r.className="bs-ann-btn bs-ann-undo",r.textContent="Undo",r.addEventListener("click",()=>{Ve.pop(),sn()}),n.appendChild(r);let s=document.createElement("button");s.className="bs-ann-btn bs-ann-save",s.textContent="Save",s.addEventListener("click",hi);let o=document.createElement("button");o.className="bs-ann-btn bs-ann-cancel",o.textContent="Cancel",o.addEventListener("click",()=>{Dn(),rn?.(null)}),n.appendChild(s),n.appendChild(o),le.appendChild(n);let a=document.createElement("div");a.className="bs-ann-canvas-wrap",D=document.createElement("canvas"),L=D.getContext("2d"),a.appendChild(D),le.appendChild(a),document.body.appendChild(le),fe=new Image,fe.onload=()=>{if(!D||!L||!fe)return;let i=window.innerWidth-32,c=window.innerHeight-100,u=fe.width,p=fe.height,f=Math.min(1,i/u,c/p);u=Math.round(u*f),p=Math.round(p*f),D.width=u,D.height=p,sn(),gi()},fe.src=e}function xs(){let e=document.createElement("div");return e.className="bs-ann-sep",e}function gi(){if(!D)return;D.addEventListener("mousedown",t=>{ht=!0;let{x:n,y:r}=ws(t);K={type:tn,color:nn,lineWidth:ui,points:[{x:n,y:r}],x:n,y:r,width:0,height:0}}),D.addEventListener("mousemove",t=>{if(!ht||!K)return;let{x:n,y:r}=ws(t);K.type==="freehand"?K.points.push({x:n,y:r}):(K.width=n-K.x,K.height=r-K.y),sn(),Es(K)});let e=()=>{ht&&K&&(Ve.push(K),K=null),ht=!1,sn()};D.addEventListener("mouseup",e),D.addEventListener("mouseleave",e)}function ws(e){let t=D.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}}function sn(){if(!(!L||!D||!fe)){L.clearRect(0,0,D.width,D.height),L.drawImage(fe,0,0,D.width,D.height);for(let e of Ve)Es(e)}}function Es(e){if(L)switch(L.strokeStyle=e.color,L.fillStyle=e.color,L.lineWidth=e.lineWidth,L.lineCap="round",L.lineJoin="round",e.type){case"freehand":{if(!e.points||e.points.length<2)return;L.beginPath(),L.moveTo(e.points[0].x,e.points[0].y);for(let t=1;t<e.points.length;t++)L.lineTo(e.points[t].x,e.points[t].y);L.stroke();break}case"rectangle":{L.strokeRect(e.x,e.y,e.width,e.height);break}case"circle":{let t=e.x+e.width/2,n=e.y+e.height/2,r=Math.abs(e.width)/2,s=Math.abs(e.height)/2;L.beginPath(),L.ellipse(t,n,r,s,0,0,Math.PI*2),L.stroke();break}case"arrow":{let t=e.x,n=e.y,r=e.x+e.width,s=e.y+e.height,o=14,a=Math.atan2(s-n,r-t);L.beginPath(),L.moveTo(t,n),L.lineTo(r,s),L.stroke(),L.beginPath(),L.moveTo(r,s),L.lineTo(r-o*Math.cos(a-Math.PI/6),s-o*Math.sin(a-Math.PI/6)),L.lineTo(r-o*Math.cos(a+Math.PI/6),s-o*Math.sin(a+Math.PI/6)),L.closePath(),L.fill();break}}}function hi(){if(!D){Dn(),rn?.(null);return}let t={dataUrl:D.toDataURL("image/png"),annotations:Ve};Dn(),rn?.(t)}function Dn(){le?.remove(),le=null,D=null,L=null,fe=null,Ve=[],K=null,ht=!1}var vt=!1,yt=null;function yi(){if(yt)return yt;let e=document.createElement("bugstash-root");return e.style.setProperty("position","fixed","important"),e.style.setProperty("inset","0","important"),e.style.setProperty("pointer-events","none","important"),e.style.setProperty("z-index","2147483640","important"),e.style.setProperty("display","block","important"),e.style.setProperty("visibility","visible","important"),e.style.setProperty("opacity","1","important"),e.style.setProperty("transform","none","important"),e.style.setProperty("perspective","none","important"),e.style.setProperty("filter","none","important"),e.style.setProperty("will-change","auto","important"),e.style.setProperty("contain","none","important"),e.style.setProperty("isolation","auto","important"),e.style.setProperty("mix-blend-mode","normal","important"),e.style.setProperty("clip-path","none","important"),e.style.setProperty("margin","0","important"),e.style.setProperty("padding","0","important"),e.style.setProperty("border","none","important"),e.style.setProperty("background","none","important"),e.style.setProperty("box-sizing","border-box","important"),e.style.setProperty("overflow","visible","important"),e.style.setProperty("min-width","0","important"),e.style.setProperty("min-height","0","important"),e.style.setProperty("max-width","none","important"),e.style.setProperty("max-height","none","important"),e.style.setProperty("float","none","important"),e.style.setProperty("clear","none","important"),e.style.setProperty("columns","auto","important"),e.style.setProperty("font-size","16px","important"),e.style.setProperty("line-height","normal","important"),e.style.setProperty("text-align","left","important"),e.style.setProperty("direction","ltr","important"),yt=e.attachShadow({mode:"open"}),document.body.appendChild(e),yt}function Ls(e){if(vt)return;vt=!0;let t=yi();Xn(e.maxBreadcrumbs),Gn(e.maxLogs),nr(e.maxNetworkCaptures),or(),e.enablePerformance!==!1&&lr(),ys(e,t),e.enableLivePins!==!1&&ie()&&(ut(e.projectId,t),lt(e.projectId))}function vi(){if(typeof window>"u")return"production";let e=window.location.hostname;return e==="localhost"||e==="127.0.0.1"||e==="0.0.0.0"||e.endsWith(".local")||/^192\.168\./.test(e)||/^10\./.test(e)||/^172\.(1[6-9]|2\d|3[01])\./.test(e)?"development":e.includes("staging")||e.includes("stage")||e.includes("preview")||e.includes("preprod")||e.includes("pre-prod")||e.includes("qa.")||e.includes(".qa")||e.includes("test.")||e.includes(".dev.")||e.includes("vercel.app")||e.includes("netlify.app")||e.includes("pages.dev")||e.includes("ngrok.io")||e.includes("ngrok-free.app")||e.includes("localhost.run")||e.includes("loca.lt")?"staging":"production"}var Ss={init(e){if(vt||typeof window>"u"||(e.environment??vi())==="production")return;e.endpoint&&Rr(e.endpoint);let n=window.location.hostname;n==="localhost"||n==="127.0.0.1"||n==="0.0.0.0"||n.endsWith(".local")||/^192\.168\./.test(n)||/^10\./.test(n)||/^172\.(1[6-9]|2\d|3[01])\./.test(n)?Ls(e):jr(e.projectId).then(s=>{s&&Ls(e)}).catch(()=>{})},destroy(){vt&&(vs(),ts(),Xr(),Zn(),sr(),ar(),Vn(),cr(),document.querySelector("bugstash-root")?.remove(),yt=null,vt=!1)},getLogs:de,clearLogs:Qn,getNetworkCaptures:Re,getFailedNetworkCaptures:ge,clearNetworkCaptures:rr,getErrors:pe,clearErrors:ir,getBreadcrumbs:$e,clearBreadcrumbs:Yn,getPerformanceMetrics:ze,addBreadcrumb:V,getThemes:Ut,getThemeById:_t,setTheme:en,getCurrentThemeId:ms,getLayouts:Wt,getLayoutById:at,setLayout:fs,getCurrentLayoutId:gs,getCurrentUser:ie,login:jt,logout:qt,togglePinMode:We,isPinModeActive:Qt,isConnected:Yr,openAnnotationEditor:ks,redactString:Me,redactObject:Ct},xi=Ss;0&&(module.exports={BugStash});
1714
1765
  //# sourceMappingURL=index.cjs.map