bugstash 0.1.8 → 0.1.10

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,13 +1,13 @@
1
- "use strict";var At=Object.defineProperty;var mn=Object.getOwnPropertyDescriptor;var hn=Object.getOwnPropertyNames;var xn=Object.prototype.hasOwnProperty;var vn=(e,t)=>{for(var s in t)At(e,s,{get:t[s],enumerable:!0})},yn=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of hn(t))!xn.call(e,r)&&r!==s&&At(e,r,{get:()=>t[r],enumerable:!(n=mn(t,r))||n.enumerable});return e};var wn=e=>yn(At({},"__esModule",{value:!0}),e);var lr={};vn(lr,{BugStash:()=>dn,default:()=>ir});module.exports=wn(lr);var ze=[],ns=50,Ae=null,Ie=null,He=null,Re=null;function Ze(e){if(e.id)return`#${e.id}`;let t=e.tagName.toLowerCase(),s=e.className&&typeof e.className=="string"?"."+e.className.trim().split(/\s+/).slice(0,2).join("."):"",n=(e.textContent||"").trim().slice(0,30),r=n?` "${n}"`:"";return`${t}${s}${r}`}function q(e){ze.push(e),ze.length>ns&&ze.shift()}function rs(e){e&&(ns=e),Ae=s=>{let n=s.target;!n||!n.tagName||q({type:"click",category:"ui",message:`Clicked ${Ze(n)}`,timestamp:Date.now(),data:{x:s.clientX,y:s.clientY,selector:Ze(n)}})},document.addEventListener("click",Ae,!0);let t=new WeakMap;Ie=s=>{let n=s.target;if(!n||!n.tagName)return;let r=n.tagName.toLowerCase();if(r!=="input"&&r!=="textarea"&&r!=="select")return;let i=t.get(n);i&&clearTimeout(i),t.set(n,window.setTimeout(()=>{let c=n instanceof HTMLInputElement&&n.type==="password";q({type:"input",category:"ui",message:`Input ${Ze(n)}`,timestamp:Date.now(),data:{selector:Ze(n),value:c?"[redacted]":void 0}})},300))},document.addEventListener("input",Ie,!0),He=()=>{q({type:"navigation",category:"navigation",message:`Navigated to ${window.location.pathname}`,timestamp:Date.now(),data:{url:window.location.href}})},window.addEventListener("popstate",He),Re=()=>{q({type:"navigation",category:"navigation",message:`Hash changed to ${window.location.hash}`,timestamp:Date.now(),data:{url:window.location.href}})},window.addEventListener("hashchange",Re),q({type:"navigation",category:"navigation",message:`Page loaded: ${window.location.pathname}`,timestamp:Date.now(),data:{url:window.location.href}})}function me(){return[...ze]}function os(){ze=[]}function as(){Ae&&document.removeEventListener("click",Ae,!0),Ie&&document.removeEventListener("input",Ie,!0),He&&window.removeEventListener("popstate",He),Re&&window.removeEventListener("hashchange",Re),Ae=null,Ie=null,He=null,Re=null}var It="[REDACTED]",kn=[[/\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)+" "+It}],[/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)+' "'+It+'"'}]];function he(e){let t=e;for(let[s,n]of kn)t=t.replace(s,n);return t}function is(e){return e.map(he)}function Qe(e){if(typeof e=="string")return he(e);if(Array.isArray(e))return e.map(Qe);if(e&&typeof e=="object"){let t={};for(let[s,n]of Object.entries(e)){let r=s.toLowerCase();r.includes("password")||r.includes("secret")||r.includes("token")||r.includes("apikey")||r.includes("api_key")||r.includes("private")?t[s]=It:t[s]=Qe(n)}return t}return e}var Ge={log:console.log,warn:console.warn,error:console.error,debug:console.debug,info:console.info},Ne=[],ls=50;function En(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 Ln(e,t){let s={level:e,args:is(En(t)),timestamp:Date.now()};e==="error"&&(s.stack=new Error().stack?.split(`
1
+ "use strict";var Pt=Object.defineProperty;var pn=Object.getOwnPropertyDescriptor;var un=Object.getOwnPropertyNames;var fn=Object.prototype.hasOwnProperty;var gn=(e,t)=>{for(var s in t)Pt(e,s,{get:t[s],enumerable:!0})},mn=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of un(t))!fn.call(e,r)&&r!==s&&Pt(e,r,{get:()=>t[r],enumerable:!(n=pn(t,r))||n.enumerable});return e};var hn=e=>mn(Pt({},"__esModule",{value:!0}),e);var ar={};gn(ar,{BugStash:()=>on,default:()=>or});module.exports=hn(ar);var Pe=[],ts=50,ze=null,Ae=null,Ie=null,He=null;function Ve(e){if(e.id)return`#${e.id}`;let t=e.tagName.toLowerCase(),s=e.className&&typeof e.className=="string"?"."+e.className.trim().split(/\s+/).slice(0,2).join("."):"",n=(e.textContent||"").trim().slice(0,30),r=n?` "${n}"`:"";return`${t}${s}${r}`}function q(e){Pe.push(e),Pe.length>ts&&Pe.shift()}function ss(e){e&&(ts=e),ze=s=>{let n=s.target;!n||!n.tagName||q({type:"click",category:"ui",message:`Clicked ${Ve(n)}`,timestamp:Date.now(),data:{x:s.clientX,y:s.clientY,selector:Ve(n)}})},document.addEventListener("click",ze,!0);let t=new WeakMap;Ae=s=>{let n=s.target;if(!n||!n.tagName)return;let r=n.tagName.toLowerCase();if(r!=="input"&&r!=="textarea"&&r!=="select")return;let i=t.get(n);i&&clearTimeout(i),t.set(n,window.setTimeout(()=>{let c=n instanceof HTMLInputElement&&n.type==="password";q({type:"input",category:"ui",message:`Input ${Ve(n)}`,timestamp:Date.now(),data:{selector:Ve(n),value:c?"[redacted]":void 0}})},300))},document.addEventListener("input",Ae,!0),Ie=()=>{q({type:"navigation",category:"navigation",message:`Navigated to ${window.location.pathname}`,timestamp:Date.now(),data:{url:window.location.href}})},window.addEventListener("popstate",Ie),He=()=>{q({type:"navigation",category:"navigation",message:`Hash changed to ${window.location.hash}`,timestamp:Date.now(),data:{url:window.location.href}})},window.addEventListener("hashchange",He),q({type:"navigation",category:"navigation",message:`Page loaded: ${window.location.pathname}`,timestamp:Date.now(),data:{url:window.location.href}})}function ue(){return[...Pe]}function ns(){Pe=[]}function rs(){ze&&document.removeEventListener("click",ze,!0),Ae&&document.removeEventListener("input",Ae,!0),Ie&&window.removeEventListener("popstate",Ie),He&&window.removeEventListener("hashchange",He),ze=null,Ae=null,Ie=null,He=null}var zt="[REDACTED]",xn=[[/\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)+" "+zt}],[/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)+' "'+zt+'"'}]];function fe(e){let t=e;for(let[s,n]of xn)t=t.replace(s,n);return t}function os(e){return e.map(fe)}function Ke(e){if(typeof e=="string")return fe(e);if(Array.isArray(e))return e.map(Ke);if(e&&typeof e=="object"){let t={};for(let[s,n]of Object.entries(e)){let r=s.toLowerCase();r.includes("password")||r.includes("secret")||r.includes("token")||r.includes("apikey")||r.includes("api_key")||r.includes("private")?t[s]=zt:t[s]=Ke(n)}return t}return e}var Ze={log:console.log,warn:console.warn,error:console.error,debug:console.debug,info:console.info},Re=[],as=50;function vn(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 yn(e,t){let s={level:e,args:os(vn(t)),timestamp:Date.now()};e==="error"&&(s.stack=new Error().stack?.split(`
3
3
  `).slice(2).join(`
4
- `)),Ne.push(s),Ne.length>ls&&Ne.shift(),q({type:"console",category:`console.${e}`,message:s.args.join(" ").slice(0,200),timestamp:s.timestamp})}function cs(e){e&&(ls=e);for(let t of Object.keys(Ge))console[t]=function(...s){Ln(t,s),Ge[t].apply(console,s)}}function ee(){return[...Ne]}function ds(){Ne=[]}function bs(){for(let e of Object.keys(Ge))console[e]=Ge[e]}var xe=[],ps=50,et,tt,st;function Ht(e){xe.push(e),xe.length>ps&&xe.shift(),q({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 us(e){try{let t=new URL(e,window.location.origin),s=new URLSearchParams(t.search);for(let r of s.keys()){let i=r.toLowerCase();(i.includes("token")||i.includes("key")||i.includes("secret")||i.includes("password")||i.includes("auth"))&&s.set(r,"[REDACTED]")}let n=s.toString();return t.pathname+(n?"?"+n:"")}catch{return he(e)}}function Sn(){et=window.fetch,window.fetch=async function(e,t){let s=t?.method?.toUpperCase()??"GET",n=typeof e=="string"?e:e instanceof URL?e.href:e.url,r=us(n),i=Date.now();try{let c=await et.call(window,e,t);return Ht({method:s,url:r,status:c.status,statusText:c.statusText,duration:Date.now()-i,responseType:c.headers.get("content-type")??void 0,timestamp:i,failed:c.status>=400}),c}catch(c){throw Ht({method:s,url:r,status:0,statusText:"Network Error",duration:Date.now()-i,timestamp:i,failed:!0}),c}}}function Cn(){tt=XMLHttpRequest.prototype.open,st=XMLHttpRequest.prototype.send,XMLHttpRequest.prototype.open=function(e,t,...s){return this.__bs_method=e.toUpperCase(),this.__bs_url=us(typeof t=="string"?t:t.href),tt.apply(this,[e,t,...s])},XMLHttpRequest.prototype.send=function(e){let t=Date.now();return this.addEventListener("loadend",function(){Ht({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})}),st.call(this,e)}}function fs(e){e&&(ps=e),Sn(),Cn()}function ve(){return[...xe]}function le(){return xe.filter(e=>e.failed)}function gs(){xe=[]}function ms(){et&&(window.fetch=et),tt&&(XMLHttpRequest.prototype.open=tt),st&&(XMLHttpRequest.prototype.send=st)}var nt=[],Be=null,De=null;function hs(){Be=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()};nt.push(t),q({type:"error",category:"exception",message:t.message,timestamp:t.timestamp,data:{source:t.source,lineno:t.lineno}})},De=e=>{let t=e.reason,s=t instanceof Error?t.message:typeof t=="string"?t:"Unhandled promise rejection",n={message:s,stack:t instanceof Error?t.stack:void 0,type:"unhandledrejection",timestamp:Date.now()};nt.push(n),q({type:"error",category:"promise",message:s,timestamp:n.timestamp})},window.addEventListener("error",Be),window.addEventListener("unhandledrejection",De)}function te(){return[...nt]}function xs(){nt=[]}function vs(){Be&&window.removeEventListener("error",Be),De&&window.removeEventListener("unhandledrejection",De),Be=null,De=null}var M=null,rt=null,ot=null,at=null;function ys(){if(M={timestamp:Date.now()},performance.getEntriesByType){let e=()=>{let[t]=performance.getEntriesByType("navigation");t&&M&&(M.pageLoadTime=Math.round(t.loadEventEnd-t.startTime),M.domContentLoaded=Math.round(t.domContentLoadedEventEnd-t.startTime));let s=performance.getEntriesByType("paint");for(let r of s)r.name==="first-paint"&&M&&(M.firstPaint=Math.round(r.startTime)),r.name==="first-contentful-paint"&&M&&(M.firstContentfulPaint=Math.round(r.startTime));M&&(M.resourceCount=performance.getEntriesByType("resource").length);let n=performance.memory;n&&M&&(M.memoryUsage={usedJSHeapSize:n.usedJSHeapSize,totalJSHeapSize:n.totalJSHeapSize})};document.readyState==="complete"?setTimeout(e,0):window.addEventListener("load",()=>setTimeout(e,100))}if(typeof PerformanceObserver<"u"){try{rt=new PerformanceObserver(e=>{let t=e.getEntries(),s=t[t.length-1];s&&M&&(M.largestContentfulPaint=Math.round(s.startTime))}),rt.observe({type:"largest-contentful-paint",buffered:!0})}catch{}try{let e=0;ot=new PerformanceObserver(t=>{for(let s of t.getEntries())s.hadRecentInput||(e+=s.value);M&&(M.cumulativeLayoutShift=Math.round(e*1e3)/1e3)}),ot.observe({type:"layout-shift",buffered:!0})}catch{}try{at=new PerformanceObserver(e=>{let[t]=e.getEntries();t&&M&&(M.firstInputDelay=Math.round(t.processingStart-t.startTime))}),at.observe({type:"first-input",buffered:!0})}catch{}}}function ye(){return M&&(M.timestamp=Date.now()),M?{...M}:null}function ws(){rt?.disconnect(),ot?.disconnect(),at?.disconnect(),rt=null,ot=null,at=null,M=null}async function it(){try{let e=await Tn();if(e)return e}catch{}try{let e=await Mn();if(e)return e}catch{}return null}async function Tn(){let e=window.innerWidth,t=window.innerHeight,s=document.documentElement.cloneNode(!0),n=document.documentElement.querySelectorAll("*"),r=s.querySelectorAll("*");for(let g=0;g<n.length&&g<r.length;g++){let x=window.getComputedStyle(n[g]),y=r[g];if(y.style){let $=["background","background-color","background-image","color","font","font-size","font-family","font-weight","border","border-radius","padding","margin","display","flex-direction","align-items","justify-content","gap","width","height","max-width","max-height","overflow","position","top","left","right","bottom","box-shadow","text-shadow","opacity","transform","text-align","line-height","letter-spacing","text-decoration","visibility","z-index","grid-template-columns","grid-template-rows","box-sizing"];for(let ae of $)try{y.style.setProperty(ae,x.getPropertyValue(ae))}catch{}}}s.querySelectorAll("script, [data-bugstash], .bs-fab, .bs-modal, .bs-backdrop").forEach(g=>g.remove());let c=new XMLSerializer().serializeToString(s),p=`
4
+ `)),Re.push(s),Re.length>as&&Re.shift(),q({type:"console",category:`console.${e}`,message:s.args.join(" ").slice(0,200),timestamp:s.timestamp})}function is(e){e&&(as=e);for(let t of Object.keys(Ze))console[t]=function(...s){yn(t,s),Ze[t].apply(console,s)}}function G(){return[...Re]}function ls(){Re=[]}function cs(){for(let e of Object.keys(Ze))console[e]=Ze[e]}var ge=[],ds=50,Qe,Ge,et;function At(e){ge.push(e),ge.length>ds&&ge.shift(),q({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 bs(e){try{let t=new URL(e,window.location.origin),s=new URLSearchParams(t.search);for(let r of s.keys()){let i=r.toLowerCase();(i.includes("token")||i.includes("key")||i.includes("secret")||i.includes("password")||i.includes("auth"))&&s.set(r,"[REDACTED]")}let n=s.toString();return t.pathname+(n?"?"+n:"")}catch{return fe(e)}}function wn(){Qe=window.fetch,window.fetch=async function(e,t){let s=t?.method?.toUpperCase()??"GET",n=typeof e=="string"?e:e instanceof URL?e.href:e.url,r=bs(n),i=Date.now();try{let c=await Qe.call(window,e,t);return At({method:s,url:r,status:c.status,statusText:c.statusText,duration:Date.now()-i,responseType:c.headers.get("content-type")??void 0,timestamp:i,failed:c.status>=400}),c}catch(c){throw At({method:s,url:r,status:0,statusText:"Network Error",duration:Date.now()-i,timestamp:i,failed:!0}),c}}}function kn(){Ge=XMLHttpRequest.prototype.open,et=XMLHttpRequest.prototype.send,XMLHttpRequest.prototype.open=function(e,t,...s){return this.__bs_method=e.toUpperCase(),this.__bs_url=bs(typeof t=="string"?t:t.href),Ge.apply(this,[e,t,...s])},XMLHttpRequest.prototype.send=function(e){let t=Date.now();return this.addEventListener("loadend",function(){At({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})}),et.call(this,e)}}function ps(e){e&&(ds=e),wn(),kn()}function me(){return[...ge]}function ae(){return ge.filter(e=>e.failed)}function us(){ge=[]}function fs(){Qe&&(window.fetch=Qe),Ge&&(XMLHttpRequest.prototype.open=Ge),et&&(XMLHttpRequest.prototype.send=et)}var tt=[],Be=null,Ne=null;function gs(){Be=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()};tt.push(t),q({type:"error",category:"exception",message:t.message,timestamp:t.timestamp,data:{source:t.source,lineno:t.lineno}})},Ne=e=>{let t=e.reason,s=t instanceof Error?t.message:typeof t=="string"?t:"Unhandled promise rejection",n={message:s,stack:t instanceof Error?t.stack:void 0,type:"unhandledrejection",timestamp:Date.now()};tt.push(n),q({type:"error",category:"promise",message:s,timestamp:n.timestamp})},window.addEventListener("error",Be),window.addEventListener("unhandledrejection",Ne)}function ee(){return[...tt]}function ms(){tt=[]}function hs(){Be&&window.removeEventListener("error",Be),Ne&&window.removeEventListener("unhandledrejection",Ne),Be=null,Ne=null}var $=null,st=null,nt=null,rt=null;function xs(){if($={timestamp:Date.now()},performance.getEntriesByType){let e=()=>{let[t]=performance.getEntriesByType("navigation");t&&$&&($.pageLoadTime=Math.round(t.loadEventEnd-t.startTime),$.domContentLoaded=Math.round(t.domContentLoadedEventEnd-t.startTime));let s=performance.getEntriesByType("paint");for(let r of s)r.name==="first-paint"&&$&&($.firstPaint=Math.round(r.startTime)),r.name==="first-contentful-paint"&&$&&($.firstContentfulPaint=Math.round(r.startTime));$&&($.resourceCount=performance.getEntriesByType("resource").length);let n=performance.memory;n&&$&&($.memoryUsage={usedJSHeapSize:n.usedJSHeapSize,totalJSHeapSize:n.totalJSHeapSize})};document.readyState==="complete"?setTimeout(e,0):window.addEventListener("load",()=>setTimeout(e,100))}if(typeof PerformanceObserver<"u"){try{st=new PerformanceObserver(e=>{let t=e.getEntries(),s=t[t.length-1];s&&$&&($.largestContentfulPaint=Math.round(s.startTime))}),st.observe({type:"largest-contentful-paint",buffered:!0})}catch{}try{let e=0;nt=new PerformanceObserver(t=>{for(let s of t.getEntries())s.hadRecentInput||(e+=s.value);$&&($.cumulativeLayoutShift=Math.round(e*1e3)/1e3)}),nt.observe({type:"layout-shift",buffered:!0})}catch{}try{rt=new PerformanceObserver(e=>{let[t]=e.getEntries();t&&$&&($.firstInputDelay=Math.round(t.processingStart-t.startTime))}),rt.observe({type:"first-input",buffered:!0})}catch{}}}function he(){return $&&($.timestamp=Date.now()),$?{...$}:null}function vs(){st?.disconnect(),nt?.disconnect(),rt?.disconnect(),st=null,nt=null,rt=null,$=null}async function ot(){try{let e=await En();if(e)return e}catch{}try{let e=await Ln();if(e)return e}catch{}return null}async function En(){let e=window.innerWidth,t=window.innerHeight,s=document.documentElement.cloneNode(!0),n=document.documentElement.querySelectorAll("*"),r=s.querySelectorAll("*");for(let g=0;g<n.length&&g<r.length;g++){let h=window.getComputedStyle(n[g]),y=r[g];if(y.style){let M=["background","background-color","background-image","color","font","font-size","font-family","font-weight","border","border-radius","padding","margin","display","flex-direction","align-items","justify-content","gap","width","height","max-width","max-height","overflow","position","top","left","right","bottom","box-shadow","text-shadow","opacity","transform","text-align","line-height","letter-spacing","text-decoration","visibility","z-index","grid-template-columns","grid-template-rows","box-sizing"];for(let re of M)try{y.style.setProperty(re,h.getPropertyValue(re))}catch{}}}s.querySelectorAll("script, [data-bugstash], .bs-fab, .bs-modal, .bs-backdrop").forEach(g=>g.remove());let c=new XMLSerializer().serializeToString(s),p=`
5
5
  <svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${t}">
6
6
  <foreignObject width="100%" height="100%">
7
7
  ${c}
8
8
  </foreignObject>
9
9
  </svg>
10
- `,l=new Blob([p],{type:"image/svg+xml;charset=utf-8"}),h=URL.createObjectURL(l);return new Promise(g=>{let x=new Image;x.onload=()=>{let y=document.createElement("canvas");y.width=e*.5,y.height=t*.5;let $=y.getContext("2d");if(!$){URL.revokeObjectURL(h),g(null);return}$.scale(.5,.5),$.drawImage(x,0,0),URL.revokeObjectURL(h),g(y.toDataURL("image/jpeg",.6))},x.onerror=()=>{URL.revokeObjectURL(h),g(null)},x.src=h})}async function Mn(){if(!navigator.mediaDevices?.getDisplayMedia)return null;let e=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:"browser"}}),t=e.getVideoTracks()[0],s=document.createElement("video");return new Promise(n=>{s.onloadedmetadata=()=>{s.play();let r=document.createElement("canvas");r.width=s.videoWidth*.5,r.height=s.videoHeight*.5;let i=r.getContext("2d");if(!i){t.stop(),n(null);return}i.scale(.5,.5),i.drawImage(s,0,0),t.stop(),n(r.toDataURL("image/jpeg",.6))},s.onerror=()=>{t.stop(),n(null)},s.srcObject=e})}var $n="https://api.bugstash.com",ks="https://bugstash-backend.azurewebsites.net",U=$n,Rt=!1;function Es(e){U=e.replace(/\/$/,""),Rt=!1}function Ls(){return U}async function X(e,t){try{return await fetch(e,t)}catch(s){if(Rt)throw s;Rt=!0;let n=U;U=ks;let r=e.replace(n,ks);return fetch(r,t)}}var Nt="bugstash_auth";function Bt(){try{let e=localStorage.getItem(Nt);if(!e)return null;let t=JSON.parse(e);return t.tokens.expiresAt<Date.now(),t}catch{return null}}function Ss(e){localStorage.setItem(Nt,JSON.stringify(e))}function Pn(){localStorage.removeItem(Nt)}function V(){return Bt()?.user||null}function Cs(){return Bt()?.tokens.accessToken||null}async function ce(){let e=Bt();if(!e)return{"Content-Type":"application/json"};if(e.tokens.expiresAt<Date.now()+6e4)try{let t=await X(`${U}/api/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:e.tokens.refreshToken})});if(t.ok){let s=await t.json();s.success&&(e.tokens=s.data,Ss(e))}}catch{}return{"Content-Type":"application/json",Authorization:`Bearer ${e.tokens.accessToken}`}}async function lt(e,t,s){try{let r=await(await X(`${U}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e,password:t,projectId:s})})).json();return r.success&&Ss({user:r.data.user,tokens:r.data.tokens}),r}catch{return{success:!1,error:"Network error"}}}async function ct(){Pn()}async function Dt(e){try{let t=await ce();return await(await X(`${U}/api/reports`,{method:"POST",headers:t,body:JSON.stringify(e)})).json()}catch{return{success:!1,error:"Network error - could not reach BugStash"}}}async function Ts(e,t){try{let s=await ce();return await(await X(`${U}/api/pins/by-page?projectId=${e}&pathname=${encodeURIComponent(t)}`,{headers:s})).json()}catch{return{success:!1,error:"Network error"}}}async function Ot(e){try{let t=await ce();return await(await X(`${U}/api/pins`,{method:"POST",headers:t,body:JSON.stringify(e)})).json()}catch{return{success:!1,error:"Network error"}}}async function dt(e,t){try{let s=await ce();return await(await X(`${U}/api/pins/${e}`,{method:"PUT",headers:s,body:JSON.stringify(t)})).json()}catch{return{success:!1,error:"Network error"}}}async function Ms(e){try{let t=await ce();return await(await X(`${U}/api/pins/${e}`,{method:"DELETE",headers:t})).json()}catch{return{success:!1,error:"Network error"}}}async function $s(e){try{let t=await ce();return await(await X(`${U}/api/pins/${e}/comments`,{headers:t})).json()}catch{return{success:!1,error:"Network error"}}}async function jt(e,t,s=[]){try{let n=await ce();return await(await X(`${U}/api/pins/${e}/comments`,{method:"POST",headers:n,body:JSON.stringify({body:t,mentions:s})})).json()}catch{return{success:!1,error:"Network error"}}}async function Ps(e){try{let t=await ce();return await(await X(`${U}/api/members/for-project/${e}`,{headers:t})).json()}catch{return{success:!1,error:"Network error"}}}var qt="bugstash_offline_queue";function Ut(e){let t=zs();t.push({...e,id:Math.random().toString(36).slice(2),timestamp:Date.now()}),localStorage.setItem(qt,JSON.stringify(t))}function zs(){try{return JSON.parse(localStorage.getItem(qt)||"[]")}catch{return[]}}async function zn(){let e=zs();if(e.length===0)return 0;let t=0,s=[];for(let n of e)try{let r;switch(n.type){case"create_pin":r=await Ot(n.data);break;case"create_comment":r=await jt(n.data.pinId,n.data.body,n.data.mentions);break;case"update_pin":r=await dt(n.data.pinId,n.data.updates);break;case"submit_report":r=await Dt(n.data);break;default:r={success:!1,error:"Unknown action"}}r.success?t++:s.push(n)}catch{s.push(n)}return localStorage.setItem(qt,JSON.stringify(s)),t}typeof window<"u"&&window.addEventListener("online",()=>{zn().catch(()=>{})});var Wt=[{id:"midnight",name:"Midnight",preview:["#1a1d2e","#6E9ED0"],vars:{"--bs-bg":"#1a1d2e","--bs-bg2":"#222639","--bs-bg3":"#2a2e42","--bs-text":"#e2e5ed","--bs-muted":"#7c82a0","--bs-border":"#333754","--bs-accent":"#6E9ED0","--bs-accent2":"#8FAFD6","--bs-fab1":"#6E9ED0","--bs-fab2":"#8FAFD6","--bs-radius":"16px","--bs-radius-sm":"10px","--bs-red":"#f87171","--bs-green":"#4ade80","--bs-orange":"#fb923c","--bs-yellow":"#fbbf24"}},{id:"purple",name:"Deep Purple",preview:["#1c1628","#a78bfa"],vars:{"--bs-bg":"#1c1628","--bs-bg2":"#241e34","--bs-bg3":"#2e2640","--bs-text":"#e8e0f5","--bs-muted":"#8b7faa","--bs-border":"#3b3255","--bs-accent":"#a78bfa","--bs-accent2":"#c4b5fd","--bs-fab1":"#a78bfa","--bs-fab2":"#c084fc","--bs-radius":"16px","--bs-radius-sm":"10px","--bs-red":"#fb7185","--bs-green":"#6ee7b7","--bs-orange":"#fdba74","--bs-yellow":"#fde68a"}},{id:"cyberpunk",name:"Cyberpunk",preview:["#0a0a12","#00fff0"],vars:{"--bs-bg":"#0a0a12","--bs-bg2":"#12121f","--bs-bg3":"#1a1a2c","--bs-text":"#e0f7fa","--bs-muted":"#5e7f88","--bs-border":"#1e3a3f","--bs-accent":"#00fff0","--bs-accent2":"#00c8ff","--bs-fab1":"#00fff0","--bs-fab2":"#ff00c8","--bs-radius":"4px","--bs-radius-sm":"2px","--bs-red":"#ff3860","--bs-green":"#00ff88","--bs-orange":"#ffaa00","--bs-yellow":"#ffe600"}},{id:"sunset",name:"Sunset",preview:["#1f1318","#f97316"],vars:{"--bs-bg":"#1f1318","--bs-bg2":"#291a20","--bs-bg3":"#33212a","--bs-text":"#f5e6ea","--bs-muted":"#a07880","--bs-border":"#4a2a34","--bs-accent":"#f97316","--bs-accent2":"#fb923c","--bs-fab1":"#f97316","--bs-fab2":"#ef4444","--bs-radius":"14px","--bs-radius-sm":"8px","--bs-red":"#ef4444","--bs-green":"#4ade80","--bs-orange":"#fb923c","--bs-yellow":"#fbbf24"}},{id:"ocean",name:"Ocean",preview:["#0d1b2a","#2dd4bf"],vars:{"--bs-bg":"#0d1b2a","--bs-bg2":"#132638","--bs-bg3":"#1a3146","--bs-text":"#d6f0ee","--bs-muted":"#5c8a8e","--bs-border":"#1f4050","--bs-accent":"#2dd4bf","--bs-accent2":"#5eead4","--bs-fab1":"#2dd4bf","--bs-fab2":"#22d3ee","--bs-radius":"16px","--bs-radius-sm":"10px","--bs-red":"#fca5a5","--bs-green":"#6ee7b7","--bs-orange":"#fdba74","--bs-yellow":"#fde68a"}},{id:"rose",name:"Rose Gold",preview:["#1f1520","#f472b6"],vars:{"--bs-bg":"#1f1520","--bs-bg2":"#2a1c2a","--bs-bg3":"#352434","--bs-text":"#f5e0ec","--bs-muted":"#a07090","--bs-border":"#4a2a44","--bs-accent":"#f472b6","--bs-accent2":"#f9a8d4","--bs-fab1":"#f472b6","--bs-fab2":"#e879f9","--bs-radius":"20px","--bs-radius-sm":"12px","--bs-red":"#fb7185","--bs-green":"#86efac","--bs-orange":"#fdba74","--bs-yellow":"#fde68a"}},{id:"arctic",name:"Arctic Light",preview:["#f0f4f8","#3b82f6"],vars:{"--bs-bg":"#f0f4f8","--bs-bg2":"#e2e8f0","--bs-bg3":"#ffffff","--bs-text":"#1e293b","--bs-muted":"#64748b","--bs-border":"#cbd5e1","--bs-accent":"#3b82f6","--bs-accent2":"#60a5fa","--bs-fab1":"#3b82f6","--bs-fab2":"#6366f1","--bs-radius":"16px","--bs-radius-sm":"10px","--bs-red":"#ef4444","--bs-green":"#22c55e","--bs-orange":"#f97316","--bs-yellow":"#eab308"}},{id:"glass",name:"Glassmorphism",preview:["rgba(30,30,50,0.6)","#a5b4fc"],vars:{"--bs-bg":"rgba(22,22,40,0.75)","--bs-bg2":"rgba(35,35,60,0.6)","--bs-bg3":"rgba(45,45,75,0.5)","--bs-text":"#e8eaff","--bs-muted":"#8888bb","--bs-border":"rgba(255,255,255,0.1)","--bs-accent":"#a5b4fc","--bs-accent2":"#c7d2fe","--bs-fab1":"#818cf8","--bs-fab2":"#a78bfa","--bs-radius":"20px","--bs-radius-sm":"12px","--bs-red":"#fca5a5","--bs-green":"#86efac","--bs-orange":"#fdba74","--bs-yellow":"#fde68a"}},{id:"neon",name:"Neon",preview:["#080c08","#39ff14"],vars:{"--bs-bg":"#080c08","--bs-bg2":"#0f150f","--bs-bg3":"#161e16","--bs-text":"#d0f0c0","--bs-muted":"#5a7a50","--bs-border":"#1e3018","--bs-accent":"#39ff14","--bs-accent2":"#7dff5e","--bs-fab1":"#39ff14","--bs-fab2":"#00ff88","--bs-radius":"8px","--bs-radius-sm":"4px","--bs-red":"#ff4444","--bs-green":"#39ff14","--bs-orange":"#ffaa00","--bs-yellow":"#e6ff00"}},{id:"forest",name:"Forest",preview:["#111c15","#34d399"],vars:{"--bs-bg":"#111c15","--bs-bg2":"#18261d","--bs-bg3":"#203026","--bs-text":"#d1f0dd","--bs-muted":"#6a9a7a","--bs-border":"#2a4a33","--bs-accent":"#34d399","--bs-accent2":"#6ee7b7","--bs-fab1":"#34d399","--bs-fab2":"#2dd4bf","--bs-radius":"14px","--bs-radius-sm":"8px","--bs-red":"#fca5a5","--bs-green":"#4ade80","--bs-orange":"#fdba74","--bs-yellow":"#fde68a"}},{id:"minimal-dark",name:"Minimal Dark",preview:["#18181b","#a1a1aa"],vars:{"--bs-bg":"#18181b","--bs-bg2":"#212124","--bs-bg3":"#2a2a2e","--bs-text":"#e4e4e7","--bs-muted":"#71717a","--bs-border":"#333338","--bs-accent":"#a1a1aa","--bs-accent2":"#d4d4d8","--bs-fab1":"#52525b","--bs-fab2":"#71717a","--bs-radius":"12px","--bs-radius-sm":"8px","--bs-red":"#f87171","--bs-green":"#4ade80","--bs-orange":"#fb923c","--bs-yellow":"#fbbf24"}},{id:"minimal-light",name:"Minimal Light",preview:["#fafafa","#52525b"],vars:{"--bs-bg":"#fafafa","--bs-bg2":"#f0f0f0","--bs-bg3":"#ffffff","--bs-text":"#18181b","--bs-muted":"#71717a","--bs-border":"#e4e4e7","--bs-accent":"#18181b","--bs-accent2":"#3f3f46","--bs-fab1":"#18181b","--bs-fab2":"#3f3f46","--bs-radius":"12px","--bs-radius-sm":"8px","--bs-red":"#dc2626","--bs-green":"#16a34a","--bs-orange":"#ea580c","--bs-yellow":"#ca8a04"}},{id:"dracula",name:"Dracula",preview:["#282a36","#bd93f9"],vars:{"--bs-bg":"#282a36","--bs-bg2":"#2e303e","--bs-bg3":"#363848","--bs-text":"#f8f8f2","--bs-muted":"#6272a4","--bs-border":"#44475a","--bs-accent":"#bd93f9","--bs-accent2":"#caa9fa","--bs-fab1":"#bd93f9","--bs-fab2":"#ff79c6","--bs-radius":"12px","--bs-radius-sm":"8px","--bs-red":"#ff5555","--bs-green":"#50fa7b","--bs-orange":"#ffb86c","--bs-yellow":"#f1fa8c"}},{id:"nord",name:"Nord",preview:["#2e3440","#88c0d0"],vars:{"--bs-bg":"#2e3440","--bs-bg2":"#3b4252","--bs-bg3":"#434c5e","--bs-text":"#eceff4","--bs-muted":"#7b88a1","--bs-border":"#4c566a","--bs-accent":"#88c0d0","--bs-accent2":"#8fbcbb","--bs-fab1":"#88c0d0","--bs-fab2":"#81a1c1","--bs-radius":"10px","--bs-radius-sm":"6px","--bs-red":"#bf616a","--bs-green":"#a3be8c","--bs-orange":"#d08770","--bs-yellow":"#ebcb8b"}},{id:"monokai",name:"Monokai",preview:["#272822","#a6e22e"],vars:{"--bs-bg":"#272822","--bs-bg2":"#2f302a","--bs-bg3":"#383930","--bs-text":"#f8f8f2","--bs-muted":"#75715e","--bs-border":"#49483e","--bs-accent":"#a6e22e","--bs-accent2":"#c4f060","--bs-fab1":"#a6e22e","--bs-fab2":"#66d9ef","--bs-radius":"8px","--bs-radius-sm":"4px","--bs-red":"#f92672","--bs-green":"#a6e22e","--bs-orange":"#fd971f","--bs-yellow":"#e6db74"}},{id:"solarized",name:"Solarized Dark",preview:["#002b36","#268bd2"],vars:{"--bs-bg":"#002b36","--bs-bg2":"#073642","--bs-bg3":"#0e4050","--bs-text":"#eee8d5","--bs-muted":"#839496","--bs-border":"#1a4f5c","--bs-accent":"#268bd2","--bs-accent2":"#2aa198","--bs-fab1":"#268bd2","--bs-fab2":"#2aa198","--bs-radius":"10px","--bs-radius-sm":"6px","--bs-red":"#dc322f","--bs-green":"#859900","--bs-orange":"#cb4b16","--bs-yellow":"#b58900"}},{id:"candy",name:"Candy",preview:["#fef1f8","#ec4899"],vars:{"--bs-bg":"#fef1f8","--bs-bg2":"#fce7f3","--bs-bg3":"#ffffff","--bs-text":"#4a1942","--bs-muted":"#9f5090","--bs-border":"#f0c6e0","--bs-accent":"#ec4899","--bs-accent2":"#f472b6","--bs-fab1":"#ec4899","--bs-fab2":"#a855f7","--bs-radius":"20px","--bs-radius-sm":"14px","--bs-red":"#e11d48","--bs-green":"#059669","--bs-orange":"#ea580c","--bs-yellow":"#ca8a04"}},{id:"slate",name:"Slate",preview:["#1e2432","#94a3b8"],vars:{"--bs-bg":"#1e2432","--bs-bg2":"#263040","--bs-bg3":"#2e384a","--bs-text":"#e2e8f0","--bs-muted":"#64748b","--bs-border":"#374462","--bs-accent":"#94a3b8","--bs-accent2":"#cbd5e1","--bs-fab1":"#475569","--bs-fab2":"#64748b","--bs-radius":"14px","--bs-radius-sm":"8px","--bs-red":"#f87171","--bs-green":"#4ade80","--bs-orange":"#fb923c","--bs-yellow":"#fbbf24"}},{id:"ember",name:"Ember",preview:["#1a0f0f","#ef4444"],vars:{"--bs-bg":"#1a0f0f","--bs-bg2":"#241515","--bs-bg3":"#2e1c1c","--bs-text":"#fde8e8","--bs-muted":"#a06060","--bs-border":"#4a2222","--bs-accent":"#ef4444","--bs-accent2":"#f87171","--bs-fab1":"#ef4444","--bs-fab2":"#f97316","--bs-radius":"12px","--bs-radius-sm":"8px","--bs-red":"#fca5a5","--bs-green":"#86efac","--bs-orange":"#fdba74","--bs-yellow":"#fde68a"}},{id:"lavender",name:"Lavender",preview:["#f5f0ff","#7c3aed"],vars:{"--bs-bg":"#f5f0ff","--bs-bg2":"#ede5ff","--bs-bg3":"#ffffff","--bs-text":"#2e1065","--bs-muted":"#7c6a9a","--bs-border":"#d8c8f0","--bs-accent":"#7c3aed","--bs-accent2":"#8b5cf6","--bs-fab1":"#7c3aed","--bs-fab2":"#a855f7","--bs-radius":"18px","--bs-radius-sm":"12px","--bs-red":"#dc2626","--bs-green":"#16a34a","--bs-orange":"#ea580c","--bs-yellow":"#ca8a04"}}];function bt(){return Wt}function pt(e){return Wt.find(t=>t.id===e)}function As(){return Wt[0]}var _t=[{id:"classic",name:"Classic Center",description:"Centered modal, top tabs",tabPosition:"top"},{id:"drawer-right",name:"Right Drawer",description:"Slides in from the right",tabPosition:"top"},{id:"drawer-left",name:"Left Drawer",description:"Slides in from the left",tabPosition:"top"},{id:"bottom-sheet",name:"Bottom Sheet",description:"Slides up from the bottom",tabPosition:"top"},{id:"top-bar",name:"Top Drop",description:"Drops down from the top",tabPosition:"top"},{id:"compact",name:"Compact",description:"Small centered popup",tabPosition:"top"},{id:"wide",name:"Wide",description:"Wide horizontal modal",tabPosition:"top"},{id:"fullscreen",name:"Fullscreen",description:"Full screen overlay",tabPosition:"top"},{id:"corner-br",name:"Corner Card",description:"Bottom-right corner card",tabPosition:"top"},{id:"corner-bl",name:"Corner Left",description:"Bottom-left corner card",tabPosition:"top"},{id:"pill-tabs",name:"Pill Tabs",description:"Centered with pill-style tabs",tabPosition:"top"},{id:"sidebar-tabs",name:"Sidebar Tabs",description:"Vertical tabs on the left",tabPosition:"left"},{id:"segmented",name:"Segmented",description:"Tabs as segmented control",tabPosition:"top"},{id:"minimal",name:"Minimal",description:"Ultra clean, spacious",tabPosition:"top"},{id:"dense",name:"Dense",description:"Compact, tight spacing",tabPosition:"top"},{id:"rounded",name:"Bubble",description:"Extra rounded, playful",tabPosition:"top"},{id:"sharp",name:"Sharp",description:"Square corners, industrial",tabPosition:"top"},{id:"split",name:"Split View",description:"Two-column layout",tabPosition:"left"},{id:"floating",name:"Floating",description:"Heavy shadow, borderless",tabPosition:"top"},{id:"bottom-tabs",name:"Bottom Tabs",description:"Tabs at the bottom",tabPosition:"bottom"}];function ut(){return _t}function Oe(e){return _t.find(t=>t.id===e)}function Is(){return _t[0]}var Hs=`
10
+ `,l=new Blob([p],{type:"image/svg+xml;charset=utf-8"}),x=URL.createObjectURL(l);return new Promise(g=>{let h=new Image;h.onload=()=>{let y=document.createElement("canvas");y.width=e*.5,y.height=t*.5;let M=y.getContext("2d");if(!M){URL.revokeObjectURL(x),g(null);return}M.scale(.5,.5),M.drawImage(h,0,0),URL.revokeObjectURL(x),g(y.toDataURL("image/jpeg",.6))},h.onerror=()=>{URL.revokeObjectURL(x),g(null)},h.src=x})}async function Ln(){if(!navigator.mediaDevices?.getDisplayMedia)return null;let e=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:"browser"}}),t=e.getVideoTracks()[0],s=document.createElement("video");return new Promise(n=>{s.onloadedmetadata=()=>{s.play();let r=document.createElement("canvas");r.width=s.videoWidth*.5,r.height=s.videoHeight*.5;let i=r.getContext("2d");if(!i){t.stop(),n(null);return}i.scale(.5,.5),i.drawImage(s,0,0),t.stop(),n(r.toDataURL("image/jpeg",.6))},s.onerror=()=>{t.stop(),n(null)},s.srcObject=e})}var Sn="https://bugstash-backend.vercel.app",ys="https://bugstash-backend.vercel.app",U=Sn,It=!1;function ws(e){U=e.replace(/\/$/,""),It=!1}function ks(){return U}async function X(e,t){try{return await fetch(e,t)}catch(s){if(It)throw s;It=!0;let n=U;U=ys;let r=e.replace(n,ys);return fetch(r,t)}}var Ht="bugstash_auth";function Rt(){try{let e=localStorage.getItem(Ht);if(!e)return null;let t=JSON.parse(e);return t.tokens.expiresAt<Date.now(),t}catch{return null}}function Es(e){localStorage.setItem(Ht,JSON.stringify(e))}function Cn(){localStorage.removeItem(Ht)}function J(){return Rt()?.user||null}function Ls(){return Rt()?.tokens.accessToken||null}async function ie(){let e=Rt();if(!e)return{"Content-Type":"application/json"};if(e.tokens.expiresAt<Date.now()+6e4)try{let t=await X(`${U}/api/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:e.tokens.refreshToken})});if(t.ok){let s=await t.json();s.success&&(e.tokens=s.data,Es(e))}}catch{}return{"Content-Type":"application/json",Authorization:`Bearer ${e.tokens.accessToken}`}}async function at(e,t,s){try{let r=await(await X(`${U}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e,password:t,projectId:s})})).json();return r.success&&Es({user:r.data.user,tokens:r.data.tokens}),r}catch{return{success:!1,error:"Network error"}}}async function it(){Cn()}async function Bt(e){try{let t=await ie();return await(await X(`${U}/api/reports`,{method:"POST",headers:t,body:JSON.stringify(e)})).json()}catch{return{success:!1,error:"Network error - could not reach BugStash"}}}async function Ss(e,t){try{let s=await ie();return await(await X(`${U}/api/pins/by-page?projectId=${e}&pathname=${encodeURIComponent(t)}`,{headers:s})).json()}catch{return{success:!1,error:"Network error"}}}async function Nt(e){try{let t=await ie();return await(await X(`${U}/api/pins`,{method:"POST",headers:t,body:JSON.stringify(e)})).json()}catch{return{success:!1,error:"Network error"}}}async function lt(e,t){try{let s=await ie();return await(await X(`${U}/api/pins/${e}`,{method:"PUT",headers:s,body:JSON.stringify(t)})).json()}catch{return{success:!1,error:"Network error"}}}async function Cs(e){try{let t=await ie();return await(await X(`${U}/api/pins/${e}`,{method:"DELETE",headers:t})).json()}catch{return{success:!1,error:"Network error"}}}async function Ts(e){try{let t=await ie();return await(await X(`${U}/api/pins/${e}/comments`,{headers:t})).json()}catch{return{success:!1,error:"Network error"}}}async function Dt(e,t,s=[]){try{let n=await ie();return await(await X(`${U}/api/pins/${e}/comments`,{method:"POST",headers:n,body:JSON.stringify({body:t,mentions:s})})).json()}catch{return{success:!1,error:"Network error"}}}async function $s(e){try{let t=await ie();return await(await X(`${U}/api/members/for-project/${e}`,{headers:t})).json()}catch{return{success:!1,error:"Network error"}}}var jt="bugstash_offline_queue";function Ot(e){let t=Ms();t.push({...e,id:Math.random().toString(36).slice(2),timestamp:Date.now()}),localStorage.setItem(jt,JSON.stringify(t))}function Ms(){try{return JSON.parse(localStorage.getItem(jt)||"[]")}catch{return[]}}async function Tn(){let e=Ms();if(e.length===0)return 0;let t=0,s=[];for(let n of e)try{let r;switch(n.type){case"create_pin":r=await Nt(n.data);break;case"create_comment":r=await Dt(n.data.pinId,n.data.body,n.data.mentions);break;case"update_pin":r=await lt(n.data.pinId,n.data.updates);break;case"submit_report":r=await Bt(n.data);break;default:r={success:!1,error:"Unknown action"}}r.success?t++:s.push(n)}catch{s.push(n)}return localStorage.setItem(jt,JSON.stringify(s)),t}typeof window<"u"&&window.addEventListener("online",()=>{Tn().catch(()=>{})});var qt=[{id:"midnight",name:"Midnight",preview:["#1a1d2e","#6E9ED0"],vars:{"--bs-bg":"#1a1d2e","--bs-bg2":"#222639","--bs-bg3":"#2a2e42","--bs-text":"#e2e5ed","--bs-muted":"#7c82a0","--bs-border":"#333754","--bs-accent":"#6E9ED0","--bs-accent2":"#8FAFD6","--bs-fab1":"#6E9ED0","--bs-fab2":"#8FAFD6","--bs-radius":"16px","--bs-radius-sm":"10px","--bs-red":"#f87171","--bs-green":"#4ade80","--bs-orange":"#fb923c","--bs-yellow":"#fbbf24"}},{id:"purple",name:"Deep Purple",preview:["#1c1628","#a78bfa"],vars:{"--bs-bg":"#1c1628","--bs-bg2":"#241e34","--bs-bg3":"#2e2640","--bs-text":"#e8e0f5","--bs-muted":"#8b7faa","--bs-border":"#3b3255","--bs-accent":"#a78bfa","--bs-accent2":"#c4b5fd","--bs-fab1":"#a78bfa","--bs-fab2":"#c084fc","--bs-radius":"16px","--bs-radius-sm":"10px","--bs-red":"#fb7185","--bs-green":"#6ee7b7","--bs-orange":"#fdba74","--bs-yellow":"#fde68a"}},{id:"cyberpunk",name:"Cyberpunk",preview:["#0a0a12","#00fff0"],vars:{"--bs-bg":"#0a0a12","--bs-bg2":"#12121f","--bs-bg3":"#1a1a2c","--bs-text":"#e0f7fa","--bs-muted":"#5e7f88","--bs-border":"#1e3a3f","--bs-accent":"#00fff0","--bs-accent2":"#00c8ff","--bs-fab1":"#00fff0","--bs-fab2":"#ff00c8","--bs-radius":"4px","--bs-radius-sm":"2px","--bs-red":"#ff3860","--bs-green":"#00ff88","--bs-orange":"#ffaa00","--bs-yellow":"#ffe600"}},{id:"sunset",name:"Sunset",preview:["#1f1318","#f97316"],vars:{"--bs-bg":"#1f1318","--bs-bg2":"#291a20","--bs-bg3":"#33212a","--bs-text":"#f5e6ea","--bs-muted":"#a07880","--bs-border":"#4a2a34","--bs-accent":"#f97316","--bs-accent2":"#fb923c","--bs-fab1":"#f97316","--bs-fab2":"#ef4444","--bs-radius":"14px","--bs-radius-sm":"8px","--bs-red":"#ef4444","--bs-green":"#4ade80","--bs-orange":"#fb923c","--bs-yellow":"#fbbf24"}},{id:"ocean",name:"Ocean",preview:["#0d1b2a","#2dd4bf"],vars:{"--bs-bg":"#0d1b2a","--bs-bg2":"#132638","--bs-bg3":"#1a3146","--bs-text":"#d6f0ee","--bs-muted":"#5c8a8e","--bs-border":"#1f4050","--bs-accent":"#2dd4bf","--bs-accent2":"#5eead4","--bs-fab1":"#2dd4bf","--bs-fab2":"#22d3ee","--bs-radius":"16px","--bs-radius-sm":"10px","--bs-red":"#fca5a5","--bs-green":"#6ee7b7","--bs-orange":"#fdba74","--bs-yellow":"#fde68a"}},{id:"rose",name:"Rose Gold",preview:["#1f1520","#f472b6"],vars:{"--bs-bg":"#1f1520","--bs-bg2":"#2a1c2a","--bs-bg3":"#352434","--bs-text":"#f5e0ec","--bs-muted":"#a07090","--bs-border":"#4a2a44","--bs-accent":"#f472b6","--bs-accent2":"#f9a8d4","--bs-fab1":"#f472b6","--bs-fab2":"#e879f9","--bs-radius":"20px","--bs-radius-sm":"12px","--bs-red":"#fb7185","--bs-green":"#86efac","--bs-orange":"#fdba74","--bs-yellow":"#fde68a"}},{id:"arctic",name:"Arctic Light",preview:["#f0f4f8","#3b82f6"],vars:{"--bs-bg":"#f0f4f8","--bs-bg2":"#e2e8f0","--bs-bg3":"#ffffff","--bs-text":"#1e293b","--bs-muted":"#64748b","--bs-border":"#cbd5e1","--bs-accent":"#3b82f6","--bs-accent2":"#60a5fa","--bs-fab1":"#3b82f6","--bs-fab2":"#6366f1","--bs-radius":"16px","--bs-radius-sm":"10px","--bs-red":"#ef4444","--bs-green":"#22c55e","--bs-orange":"#f97316","--bs-yellow":"#eab308"}},{id:"glass",name:"Glassmorphism",preview:["rgba(30,30,50,0.6)","#a5b4fc"],vars:{"--bs-bg":"rgba(22,22,40,0.75)","--bs-bg2":"rgba(35,35,60,0.6)","--bs-bg3":"rgba(45,45,75,0.5)","--bs-text":"#e8eaff","--bs-muted":"#8888bb","--bs-border":"rgba(255,255,255,0.1)","--bs-accent":"#a5b4fc","--bs-accent2":"#c7d2fe","--bs-fab1":"#818cf8","--bs-fab2":"#a78bfa","--bs-radius":"20px","--bs-radius-sm":"12px","--bs-red":"#fca5a5","--bs-green":"#86efac","--bs-orange":"#fdba74","--bs-yellow":"#fde68a"}},{id:"neon",name:"Neon",preview:["#080c08","#39ff14"],vars:{"--bs-bg":"#080c08","--bs-bg2":"#0f150f","--bs-bg3":"#161e16","--bs-text":"#d0f0c0","--bs-muted":"#5a7a50","--bs-border":"#1e3018","--bs-accent":"#39ff14","--bs-accent2":"#7dff5e","--bs-fab1":"#39ff14","--bs-fab2":"#00ff88","--bs-radius":"8px","--bs-radius-sm":"4px","--bs-red":"#ff4444","--bs-green":"#39ff14","--bs-orange":"#ffaa00","--bs-yellow":"#e6ff00"}},{id:"forest",name:"Forest",preview:["#111c15","#34d399"],vars:{"--bs-bg":"#111c15","--bs-bg2":"#18261d","--bs-bg3":"#203026","--bs-text":"#d1f0dd","--bs-muted":"#6a9a7a","--bs-border":"#2a4a33","--bs-accent":"#34d399","--bs-accent2":"#6ee7b7","--bs-fab1":"#34d399","--bs-fab2":"#2dd4bf","--bs-radius":"14px","--bs-radius-sm":"8px","--bs-red":"#fca5a5","--bs-green":"#4ade80","--bs-orange":"#fdba74","--bs-yellow":"#fde68a"}},{id:"minimal-dark",name:"Minimal Dark",preview:["#18181b","#a1a1aa"],vars:{"--bs-bg":"#18181b","--bs-bg2":"#212124","--bs-bg3":"#2a2a2e","--bs-text":"#e4e4e7","--bs-muted":"#71717a","--bs-border":"#333338","--bs-accent":"#a1a1aa","--bs-accent2":"#d4d4d8","--bs-fab1":"#52525b","--bs-fab2":"#71717a","--bs-radius":"12px","--bs-radius-sm":"8px","--bs-red":"#f87171","--bs-green":"#4ade80","--bs-orange":"#fb923c","--bs-yellow":"#fbbf24"}},{id:"minimal-light",name:"Minimal Light",preview:["#fafafa","#52525b"],vars:{"--bs-bg":"#fafafa","--bs-bg2":"#f0f0f0","--bs-bg3":"#ffffff","--bs-text":"#18181b","--bs-muted":"#71717a","--bs-border":"#e4e4e7","--bs-accent":"#18181b","--bs-accent2":"#3f3f46","--bs-fab1":"#18181b","--bs-fab2":"#3f3f46","--bs-radius":"12px","--bs-radius-sm":"8px","--bs-red":"#dc2626","--bs-green":"#16a34a","--bs-orange":"#ea580c","--bs-yellow":"#ca8a04"}},{id:"dracula",name:"Dracula",preview:["#282a36","#bd93f9"],vars:{"--bs-bg":"#282a36","--bs-bg2":"#2e303e","--bs-bg3":"#363848","--bs-text":"#f8f8f2","--bs-muted":"#6272a4","--bs-border":"#44475a","--bs-accent":"#bd93f9","--bs-accent2":"#caa9fa","--bs-fab1":"#bd93f9","--bs-fab2":"#ff79c6","--bs-radius":"12px","--bs-radius-sm":"8px","--bs-red":"#ff5555","--bs-green":"#50fa7b","--bs-orange":"#ffb86c","--bs-yellow":"#f1fa8c"}},{id:"nord",name:"Nord",preview:["#2e3440","#88c0d0"],vars:{"--bs-bg":"#2e3440","--bs-bg2":"#3b4252","--bs-bg3":"#434c5e","--bs-text":"#eceff4","--bs-muted":"#7b88a1","--bs-border":"#4c566a","--bs-accent":"#88c0d0","--bs-accent2":"#8fbcbb","--bs-fab1":"#88c0d0","--bs-fab2":"#81a1c1","--bs-radius":"10px","--bs-radius-sm":"6px","--bs-red":"#bf616a","--bs-green":"#a3be8c","--bs-orange":"#d08770","--bs-yellow":"#ebcb8b"}},{id:"monokai",name:"Monokai",preview:["#272822","#a6e22e"],vars:{"--bs-bg":"#272822","--bs-bg2":"#2f302a","--bs-bg3":"#383930","--bs-text":"#f8f8f2","--bs-muted":"#75715e","--bs-border":"#49483e","--bs-accent":"#a6e22e","--bs-accent2":"#c4f060","--bs-fab1":"#a6e22e","--bs-fab2":"#66d9ef","--bs-radius":"8px","--bs-radius-sm":"4px","--bs-red":"#f92672","--bs-green":"#a6e22e","--bs-orange":"#fd971f","--bs-yellow":"#e6db74"}},{id:"solarized",name:"Solarized Dark",preview:["#002b36","#268bd2"],vars:{"--bs-bg":"#002b36","--bs-bg2":"#073642","--bs-bg3":"#0e4050","--bs-text":"#eee8d5","--bs-muted":"#839496","--bs-border":"#1a4f5c","--bs-accent":"#268bd2","--bs-accent2":"#2aa198","--bs-fab1":"#268bd2","--bs-fab2":"#2aa198","--bs-radius":"10px","--bs-radius-sm":"6px","--bs-red":"#dc322f","--bs-green":"#859900","--bs-orange":"#cb4b16","--bs-yellow":"#b58900"}},{id:"candy",name:"Candy",preview:["#fef1f8","#ec4899"],vars:{"--bs-bg":"#fef1f8","--bs-bg2":"#fce7f3","--bs-bg3":"#ffffff","--bs-text":"#4a1942","--bs-muted":"#9f5090","--bs-border":"#f0c6e0","--bs-accent":"#ec4899","--bs-accent2":"#f472b6","--bs-fab1":"#ec4899","--bs-fab2":"#a855f7","--bs-radius":"20px","--bs-radius-sm":"14px","--bs-red":"#e11d48","--bs-green":"#059669","--bs-orange":"#ea580c","--bs-yellow":"#ca8a04"}},{id:"slate",name:"Slate",preview:["#1e2432","#94a3b8"],vars:{"--bs-bg":"#1e2432","--bs-bg2":"#263040","--bs-bg3":"#2e384a","--bs-text":"#e2e8f0","--bs-muted":"#64748b","--bs-border":"#374462","--bs-accent":"#94a3b8","--bs-accent2":"#cbd5e1","--bs-fab1":"#475569","--bs-fab2":"#64748b","--bs-radius":"14px","--bs-radius-sm":"8px","--bs-red":"#f87171","--bs-green":"#4ade80","--bs-orange":"#fb923c","--bs-yellow":"#fbbf24"}},{id:"ember",name:"Ember",preview:["#1a0f0f","#ef4444"],vars:{"--bs-bg":"#1a0f0f","--bs-bg2":"#241515","--bs-bg3":"#2e1c1c","--bs-text":"#fde8e8","--bs-muted":"#a06060","--bs-border":"#4a2222","--bs-accent":"#ef4444","--bs-accent2":"#f87171","--bs-fab1":"#ef4444","--bs-fab2":"#f97316","--bs-radius":"12px","--bs-radius-sm":"8px","--bs-red":"#fca5a5","--bs-green":"#86efac","--bs-orange":"#fdba74","--bs-yellow":"#fde68a"}},{id:"lavender",name:"Lavender",preview:["#f5f0ff","#7c3aed"],vars:{"--bs-bg":"#f5f0ff","--bs-bg2":"#ede5ff","--bs-bg3":"#ffffff","--bs-text":"#2e1065","--bs-muted":"#7c6a9a","--bs-border":"#d8c8f0","--bs-accent":"#7c3aed","--bs-accent2":"#8b5cf6","--bs-fab1":"#7c3aed","--bs-fab2":"#a855f7","--bs-radius":"18px","--bs-radius-sm":"12px","--bs-red":"#dc2626","--bs-green":"#16a34a","--bs-orange":"#ea580c","--bs-yellow":"#ca8a04"}}];function ct(){return qt}function dt(e){return qt.find(t=>t.id===e)}function Ps(){return qt[0]}var Ut=[{id:"classic",name:"Classic Center",description:"Centered modal, top tabs",tabPosition:"top"},{id:"drawer-right",name:"Right Drawer",description:"Slides in from the right",tabPosition:"top"},{id:"drawer-left",name:"Left Drawer",description:"Slides in from the left",tabPosition:"top"},{id:"bottom-sheet",name:"Bottom Sheet",description:"Slides up from the bottom",tabPosition:"top"},{id:"top-bar",name:"Top Drop",description:"Drops down from the top",tabPosition:"top"},{id:"compact",name:"Compact",description:"Small centered popup",tabPosition:"top"},{id:"wide",name:"Wide",description:"Wide horizontal modal",tabPosition:"top"},{id:"fullscreen",name:"Fullscreen",description:"Full screen overlay",tabPosition:"top"},{id:"corner-br",name:"Corner Card",description:"Bottom-right corner card",tabPosition:"top"},{id:"corner-bl",name:"Corner Left",description:"Bottom-left corner card",tabPosition:"top"},{id:"pill-tabs",name:"Pill Tabs",description:"Centered with pill-style tabs",tabPosition:"top"},{id:"sidebar-tabs",name:"Sidebar Tabs",description:"Vertical tabs on the left",tabPosition:"left"},{id:"segmented",name:"Segmented",description:"Tabs as segmented control",tabPosition:"top"},{id:"minimal",name:"Minimal",description:"Ultra clean, spacious",tabPosition:"top"},{id:"dense",name:"Dense",description:"Compact, tight spacing",tabPosition:"top"},{id:"rounded",name:"Bubble",description:"Extra rounded, playful",tabPosition:"top"},{id:"sharp",name:"Sharp",description:"Square corners, industrial",tabPosition:"top"},{id:"split",name:"Split View",description:"Two-column layout",tabPosition:"left"},{id:"floating",name:"Floating",description:"Heavy shadow, borderless",tabPosition:"top"},{id:"bottom-tabs",name:"Bottom Tabs",description:"Tabs at the bottom",tabPosition:"bottom"}];function bt(){return Ut}function De(e){return Ut.find(t=>t.id===e)}function zs(){return Ut[0]}var As=`
11
11
  /* \u2500\u2500 1. Classic (default \u2014 no overrides) \u2500\u2500 */
12
12
 
13
13
  /* \u2500\u2500 2. Drawer Right \u2500\u2500 */
@@ -334,7 +334,7 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
334
334
  }
335
335
  .bs-ly-bottom-tabs .bs-tab-divider { order: 98; }
336
336
  .bs-ly-bottom-tabs .bs-scroll { order: 1; }
337
- `;var A=null,ft=null,je=0,Ns=10,we=new Map,gt=null,de=!1,se=null;function mt(e){gt=e;let t=Cs();t&&Bs(e,t)}function Bs(e,t){if(A?.readyState===WebSocket.OPEN)return;let s=Ls();de=!1;try{let n=`${s.replace(/^http/,"ws")}/socket.io/?EIO=4&transport=websocket`;A=new WebSocket(n),A.onopen=()=>{je=0},A.onmessage=r=>{let i=r.data;if(i.startsWith("0")&&!de){try{let p=JSON.parse(i.slice(1)).pingInterval||25e3;se&&clearInterval(se),se=setInterval(()=>{A?.readyState===WebSocket.OPEN&&A.send("2")},p)}catch{}A.send("40"+JSON.stringify({token:t}));return}if(i==="2"){A.send("3");return}if(i!=="3"){if(i.startsWith("40")&&!de){de=!0,A.send("42"+JSON.stringify(["join:project",e]));return}if(i.startsWith("44")){A?.close();return}if(i.startsWith("42"))try{let c=JSON.parse(i.slice(2));if(Array.isArray(c)&&c.length>=2){let[p,l]=c,h=typeof l=="object"&&l!==null?l:{type:p,data:l,projectId:e,userId:"",timestamp:Date.now()};An(p,h)}}catch{}}},A.onclose=()=>{de=!1,se&&(clearInterval(se),se=null),Rs(e,t)},A.onerror=()=>{A?.close()}}catch{Rs(e,t)}}function Rs(e,t){if(je>=Ns)return;je++;let s=Math.min(1e3*Math.pow(2,je),3e4);ft=setTimeout(()=>Bs(e,t),s)}function Ds(){ft&&clearTimeout(ft),se&&clearInterval(se),ft=null,se=null,je=Ns,de=!1,A&&(A.close(),A=null),gt=null}function qe(e,t){return we.has(e)||we.set(e,new Set),we.get(e).add(t),()=>{we.get(e)?.delete(t)}}function An(e,t){we.get(e)?.forEach(s=>s(t)),we.get("*")?.forEach(s=>s(t))}function Os(e){!A||A.readyState!==WebSocket.OPEN||!de||!gt||A.send("42"+JSON.stringify(["page:navigate",{projectId:gt,pageUrl:e}]))}function js(){return de&&A?.readyState===WebSocket.OPEN}var ht,I=null,W=[],_s=[],ke=!1,Ue=null,In="",qs={open:"#f97316",in_progress:"#3b82f6",resolved:"#22c55e",closed:"#6b7280"};function xt(e){ht=e,In=window.location.pathname,Hn(),Ys(),Rn(),On(),jn()}function Fs(){I&&(I.remove(),I=null),W=[]}function vt(e){return ke=e!==void 0?e:!ke,I&&I.classList.toggle("bs-pin-mode",ke),ke}function yt(){return ke}function Hn(){if(I)return;I=document.createElement("div"),I.id="bugstash-live-pins";let e=document.createElement("style");e.textContent=`
337
+ `;var ye=null,pt=0,$n=5e3,xe=new Map,ve=null,ut=new Set;function ft(e){ve=e,pt=Date.now(),Mn()}function Mn(){ye||(ye=setInterval(Pn,$n))}async function Pn(){if(!ve)return;let e=Ls();if(e)try{let t=ks(),s=window.location.pathname,n=await fetch(`${t}/api/pins/poll?projectId=${ve}&pathname=${encodeURIComponent(s)}&since=${pt}`,{headers:{Authorization:`Bearer ${e}`}});if(!n.ok)return;let r=await n.json();if(!r.success)return;let{pins:i,serverTime:c}=r.data;pt=c;for(let p of i)ut.has(p.id)?Is("pin:updated",{type:"pin:updated",projectId:ve,data:p,userId:"",timestamp:Date.now()}):(ut.add(p.id),Is("pin:created",{type:"pin:created",projectId:ve,data:p,userId:"",timestamp:Date.now()}))}catch{}}function Hs(){ye&&(clearInterval(ye),ye=null),ve=null,ut.clear(),pt=0}function je(e,t){return xe.has(e)||xe.set(e,new Set),xe.get(e).add(t),()=>{xe.get(e)?.delete(t)}}function Is(e,t){xe.get(e)?.forEach(s=>s(t)),xe.get("*")?.forEach(s=>s(t))}function Rs(e){ut=new Set(e)}function Bs(){return ye!==null}var gt,A=null,j=[],Os=[],we=!1,Oe=null,zn="",Ns={open:"#f97316",in_progress:"#3b82f6",resolved:"#22c55e",closed:"#6b7280"};function mt(e){gt=e,zn=window.location.pathname,An(),Us(),In(),Nn(),Dn()}function qs(){A&&(A.remove(),A=null),j=[]}function ht(e){return we=e!==void 0?e:!we,A&&A.classList.toggle("bs-pin-mode",we),we}function xt(){return we}function An(){if(A)return;A=document.createElement("div"),A.id="bugstash-live-pins";let e=document.createElement("style");e.textContent=`
338
338
  #bugstash-live-pins {
339
339
  position: fixed;
340
340
  inset: 0;
@@ -564,27 +564,27 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
564
564
  background: #333754;
565
565
  color: #a0a4b8;
566
566
  }
567
- `,I.appendChild(e),document.body.appendChild(I),I.addEventListener("click",t=>{if(!ke||t.target.closest(".bs-lp, .bs-lp-popup, .bs-lp-newform"))return;let s=t.clientX+window.scrollX,n=t.clientY+window.scrollY;I.style.pointerEvents="none";let r=document.elementFromPoint(t.clientX,t.clientY);I.style.pointerEvents="",Dn(s,n,r)})}async function Ys(){let e=await Ts(ht,window.location.pathname);e.success&&e.data&&(W=e.data,re())}async function Rn(){let e=await Ps(ht);e.success&&e.data&&(_s=e.data)}function re(){I&&(I.querySelectorAll(".bs-lp").forEach(e=>e.remove()),W.forEach((e,t)=>{let s=document.createElement("div");s.className="bs-lp",s.style.left=`${e.pageX}px`,s.style.top=`${e.pageY}px`,s.dataset.pinId=e.id;let n=qs[e.status]||qs.open;s.innerHTML=`
567
+ `,A.appendChild(e),document.body.appendChild(A),A.addEventListener("click",t=>{if(!we||t.target.closest(".bs-lp, .bs-lp-popup, .bs-lp-newform"))return;let s=t.clientX+window.scrollX,n=t.clientY+window.scrollY;A.style.pointerEvents="none";let r=document.elementFromPoint(t.clientX,t.clientY);A.style.pointerEvents="",Bn(s,n,r)})}async function Us(){let e=await Ss(gt,window.location.pathname);e.success&&e.data&&(j=e.data,Rs(j.map(t=>t.id)),se())}async function In(){let e=await $s(gt);e.success&&e.data&&(Os=e.data)}function se(){A&&(A.querySelectorAll(".bs-lp").forEach(e=>e.remove()),j.forEach((e,t)=>{let s=document.createElement("div");s.className="bs-lp",s.style.left=`${e.pageX}px`,s.style.top=`${e.pageY}px`,s.dataset.pinId=e.id;let n=Ns[e.status]||Ns.open;s.innerHTML=`
568
568
  <div class="bs-lp-dot" style="background:${n}">
569
569
  <span>${t+1}</span>
570
570
  </div>
571
- `,s.addEventListener("click",r=>{r.stopPropagation(),Nn(e,s)}),I.appendChild(s)}))}function Us(e){let t=Date.now()-e,s=Math.floor(t/6e4);if(s<1)return"just now";if(s<60)return`${s}m ago`;let n=Math.floor(s/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}function Ws(e){return{open:"#f97316",in_progress:"#3b82f6",resolved:"#22c55e",closed:"#6b7280"}[e]||"#6b7280"}async function Nn(e,t){pe();let s=document.createElement("div");s.className="bs-lp-popup";let n=await $s(e.id),r=n.success&&n.data?n.data:[],i=V(),c=i&&(i.role==="owner"||i.role==="admin"||i.id===e.createdBy);s.innerHTML=`
571
+ `,s.addEventListener("click",r=>{r.stopPropagation(),Hn(e,s)}),A.appendChild(s)}))}function Ds(e){let t=Date.now()-e,s=Math.floor(t/6e4);if(s<1)return"just now";if(s<60)return`${s}m ago`;let n=Math.floor(s/60);return n<24?`${n}h ago`:`${Math.floor(n/24)}d ago`}function js(e){return{open:"#f97316",in_progress:"#3b82f6",resolved:"#22c55e",closed:"#6b7280"}[e]||"#6b7280"}async function Hn(e,t){ce();let s=document.createElement("div");s.className="bs-lp-popup";let n=await Ts(e.id),r=n.success&&n.data?n.data:[],i=J(),c=i&&(i.role==="owner"||i.role==="admin"||i.id===e.createdBy);s.innerHTML=`
572
572
  <div class="bs-lp-popup-header">
573
- <div class="bs-lp-popup-title">${ne(e.title)}</div>
574
- <span class="bs-lp-popup-status" style="background:${Ws(e.status)}22;color:${Ws(e.status)}">${e.status.replace("_"," ")}</span>
573
+ <div class="bs-lp-popup-title">${te(e.title)}</div>
574
+ <span class="bs-lp-popup-status" style="background:${js(e.status)}22;color:${js(e.status)}">${e.status.replace("_"," ")}</span>
575
575
  <button class="bs-lp-close">&times;</button>
576
576
  </div>
577
- ${e.description?`<div class="bs-lp-popup-body">${ne(e.description)}</div>`:""}
577
+ ${e.description?`<div class="bs-lp-popup-body">${te(e.description)}</div>`:""}
578
578
  <div class="bs-lp-popup-meta">
579
- <span>${e.creatorName||"Unknown"} &middot; ${Us(e.createdAt)}</span>
579
+ <span>${e.creatorName||"Unknown"} &middot; ${Ds(e.createdAt)}</span>
580
580
  <span>${e.assigneeName?`Assigned: ${e.assigneeName}`:"Unassigned"}</span>
581
581
  </div>
582
582
  <div class="bs-lp-comments" id="bs-lp-comments">
583
583
  ${r.map(l=>`
584
584
  <div class="bs-lp-comment">
585
- <div class="bs-lp-comment-author">${ne(l.author?.name||l.authorName||"Unknown")}</div>
586
- <div class="bs-lp-comment-body">${ne(l.body)}</div>
587
- <div class="bs-lp-comment-time">${Us(new Date(l.createdAt).getTime())}</div>
585
+ <div class="bs-lp-comment-author">${te(l.author?.name||l.authorName||"Unknown")}</div>
586
+ <div class="bs-lp-comment-body">${te(l.body)}</div>
587
+ <div class="bs-lp-comment-time">${Ds(new Date(l.createdAt).getTime())}</div>
588
588
  </div>
589
589
  `).join("")}
590
590
  </div>
@@ -596,13 +596,13 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
596
596
  ${e.status!=="resolved"?'<button class="bs-lp-btn resolve" id="bs-lp-resolve">Resolve</button>':'<button class="bs-lp-btn" id="bs-lp-reopen">Reopen</button>'}
597
597
  ${c?'<button class="bs-lp-btn delete" id="bs-lp-delete">Delete</button>':""}
598
598
  </div>
599
- `,t.appendChild(s),Ue=s,s.querySelector(".bs-lp-close").addEventListener("click",l=>{l.stopPropagation(),pe()}),s.querySelector("#bs-lp-comment-send")?.addEventListener("click",async()=>{let l=s.querySelector("#bs-lp-comment-input"),h=l.value.trim();if(h)if(l.value="",navigator.onLine){let g=await jt(e.id,h);if(g.success&&g.data){let x=s.querySelector("#bs-lp-comments"),y=g.data;x.innerHTML+=`
599
+ `,t.appendChild(s),Oe=s,s.querySelector(".bs-lp-close").addEventListener("click",l=>{l.stopPropagation(),ce()}),s.querySelector("#bs-lp-comment-send")?.addEventListener("click",async()=>{let l=s.querySelector("#bs-lp-comment-input"),x=l.value.trim();if(x)if(l.value="",navigator.onLine){let g=await Dt(e.id,x);if(g.success&&g.data){let h=s.querySelector("#bs-lp-comments"),y=g.data;h.innerHTML+=`
600
600
  <div class="bs-lp-comment">
601
- <div class="bs-lp-comment-author">${ne(y.authorName||i?.name||"You")}</div>
602
- <div class="bs-lp-comment-body">${ne(y.body)}</div>
601
+ <div class="bs-lp-comment-author">${te(y.authorName||i?.name||"You")}</div>
602
+ <div class="bs-lp-comment-body">${te(y.body)}</div>
603
603
  <div class="bs-lp-comment-time">just now</div>
604
604
  </div>
605
- `,x.scrollTop=x.scrollHeight}}else Ut({type:"create_comment",data:{pinId:e.id,body:h}})}),s.querySelector("#bs-lp-comment-input")?.addEventListener("keydown",l=>{l.key==="Enter"&&s.querySelector("#bs-lp-comment-send")?.dispatchEvent(new Event("click"))}),s.querySelector("#bs-lp-resolve")?.addEventListener("click",async()=>{await dt(e.id,{status:"resolved"}),e.status="resolved",pe(),re()}),s.querySelector("#bs-lp-reopen")?.addEventListener("click",async()=>{await dt(e.id,{status:"open"}),e.status="open",pe(),re()}),s.querySelector("#bs-lp-delete")?.addEventListener("click",async()=>{confirm("Delete this pin?")&&(await Ms(e.id),W=W.filter(l=>l.id!==e.id),pe(),re())}),s.addEventListener("click",l=>l.stopPropagation())}function pe(){Ue?.remove(),Ue=null}function Js(e){if(!e||e===document.body||e===document.documentElement)return"body";if(e.id)return`#${e.id}`;let t=e.tagName.toLowerCase();if(e.className&&typeof e.className=="string"){let n=e.className.trim().split(/\s+/).filter(r=>!r.startsWith("bs-")).slice(0,3);n.length&&(t+="."+n.join("."))}let s=e.parentElement;if(s&&s!==document.body){let n=Array.from(s.children).filter(r=>r.tagName===e.tagName);if(n.length>1){let r=n.indexOf(e);t+=`:nth-child(${r+1})`}return Js(s)+" > "+t}return t}function Bn(e){if(!e)return"";let t=[],s=e;for(;s&&s!==document.body;){let n=1,r=s.previousElementSibling;for(;r;)r.tagName===s.tagName&&n++,r=r.previousElementSibling;t.unshift(`${s.tagName.toLowerCase()}[${n}]`),s=s.parentElement}return"/body/"+t.join("/")}function Dn(e,t,s){pe(),I?.querySelectorAll(".bs-lp-newform").forEach(i=>i.remove());let n=document.createElement("div");n.className="bs-lp-newform",n.style.left=`${e+16}px`,n.style.top=`${t-8}px`,requestAnimationFrame(()=>{let i=n.getBoundingClientRect();i.right>window.innerWidth-16&&(n.style.left=`${e-336}px`),i.bottom>window.innerHeight-16&&(n.style.top=`${t-i.height}px`)});let r=_s.filter(i=>i.userId!==V()?.id).map(i=>`<option value="${i.userId}">${ne(i.name)}</option>`).join("");n.innerHTML=`
605
+ `,h.scrollTop=h.scrollHeight}}else Ot({type:"create_comment",data:{pinId:e.id,body:x}})}),s.querySelector("#bs-lp-comment-input")?.addEventListener("keydown",l=>{l.key==="Enter"&&s.querySelector("#bs-lp-comment-send")?.dispatchEvent(new Event("click"))}),s.querySelector("#bs-lp-resolve")?.addEventListener("click",async()=>{await lt(e.id,{status:"resolved"}),e.status="resolved",ce(),se()}),s.querySelector("#bs-lp-reopen")?.addEventListener("click",async()=>{await lt(e.id,{status:"open"}),e.status="open",ce(),se()}),s.querySelector("#bs-lp-delete")?.addEventListener("click",async()=>{confirm("Delete this pin?")&&(await Cs(e.id),j=j.filter(l=>l.id!==e.id),ce(),se())}),s.addEventListener("click",l=>l.stopPropagation())}function ce(){Oe?.remove(),Oe=null}function _s(e){if(!e||e===document.body||e===document.documentElement)return"body";if(e.id)return`#${e.id}`;let t=e.tagName.toLowerCase();if(e.className&&typeof e.className=="string"){let n=e.className.trim().split(/\s+/).filter(r=>!r.startsWith("bs-")).slice(0,3);n.length&&(t+="."+n.join("."))}let s=e.parentElement;if(s&&s!==document.body){let n=Array.from(s.children).filter(r=>r.tagName===e.tagName);if(n.length>1){let r=n.indexOf(e);t+=`:nth-child(${r+1})`}return _s(s)+" > "+t}return t}function Rn(e){if(!e)return"";let t=[],s=e;for(;s&&s!==document.body;){let n=1,r=s.previousElementSibling;for(;r;)r.tagName===s.tagName&&n++,r=r.previousElementSibling;t.unshift(`${s.tagName.toLowerCase()}[${n}]`),s=s.parentElement}return"/body/"+t.join("/")}function Bn(e,t,s){ce(),A?.querySelectorAll(".bs-lp-newform").forEach(i=>i.remove());let n=document.createElement("div");n.className="bs-lp-newform",n.style.left=`${e+16}px`,n.style.top=`${t-8}px`,requestAnimationFrame(()=>{let i=n.getBoundingClientRect();i.right>window.innerWidth-16&&(n.style.left=`${e-336}px`),i.bottom>window.innerHeight-16&&(n.style.top=`${t-i.height}px`)});let r=Os.filter(i=>i.userId!==J()?.id).map(i=>`<option value="${i.userId}">${te(i.name)}</option>`).join("");n.innerHTML=`
606
606
  <label>Title *</label>
607
607
  <input type="text" id="bs-np-title" placeholder="What's the issue?" autofocus />
608
608
  <label>Description</label>
@@ -633,13 +633,13 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
633
633
  <button class="bs-lp-newform-cancel" id="bs-np-cancel">Cancel</button>
634
634
  <button class="bs-lp-newform-submit" id="bs-np-submit">Create Pin</button>
635
635
  </div>
636
- `,I.appendChild(n),n.addEventListener("click",i=>i.stopPropagation()),n.querySelector("#bs-np-cancel").addEventListener("click",()=>n.remove()),n.querySelector("#bs-np-submit").addEventListener("click",async()=>{let i=n.querySelector("#bs-np-title").value.trim();if(!i){n.querySelector("#bs-np-title").style.borderColor="#ef4444";return}let c=n.querySelector("#bs-np-desc").value.trim(),p=n.querySelector("#bs-np-priority").value,l=n.querySelector("#bs-np-category").value,g=n.querySelector("#bs-np-assignee")?.value||void 0,x=Js(s),y=Bn(s),$=ee().slice(-20).map(k=>`[${k.level}] ${k.args.join(" ")}`),ae=te().slice(-10).map(k=>`${k.message} at ${k.source}:${k.lineno}`),Te=le().slice(-10).map(k=>`${k.method} ${k.url} \u2192 ${k.status}`),N;try{n.style.display="none",I.style.display="none",N=await it()??void 0,I.style.display="",n.style.display=""}catch{}let P={projectId:ht,pageUrl:window.location.href,pathname:window.location.pathname,elementSelector:x,elementXPath:y,xPercent:0,yPercent:0,pageX:e,pageY:t,title:i,description:c,screenshot:N,priority:p,category:l,assigneeId:g,browserInfo:navigator.userAgent,screenSize:`${screen.width}x${screen.height}`,viewportSize:`${window.innerWidth}x${window.innerHeight}`,devicePixelRatio:window.devicePixelRatio,consoleLogs:$,networkErrors:Te,jsErrors:ae};if(n.remove(),navigator.onLine){let k=await Ot(P);k.success&&k.data&&(W.push(k.data),re())}else Ut({type:"create_pin",data:P}),W.push({...P,id:"local-"+Date.now(),orgId:"",status:"open",tags:[],createdById:V()?.id||"",creatorName:V()?.name||"",commentCount:0,createdAt:Date.now(),updatedAt:Date.now()}),re()}),setTimeout(()=>n.querySelector("#bs-np-title")?.focus(),50)}function On(){qe("pin:created",e=>{let t=e.data;t.pathname===window.location.pathname&&(W.find(s=>s.id===t.id)||(W.push(t),re()))}),qe("pin:updated",e=>{let t=e.data,s=W.findIndex(n=>n.id===t.id);s>=0&&(W[s]={...W[s],...t},re())}),qe("pin:deleted",e=>{let{id:t}=e.data;W=W.filter(s=>s.id!==t),pe(),re()}),qe("comment:created",e=>{let t=e.data;if(Ue){let s=Ue.querySelector("#bs-lp-comments");s&&(s.innerHTML+=`
636
+ `,A.appendChild(n),n.addEventListener("click",i=>i.stopPropagation()),n.querySelector("#bs-np-cancel").addEventListener("click",()=>n.remove()),n.querySelector("#bs-np-submit").addEventListener("click",async()=>{let i=n.querySelector("#bs-np-title").value.trim();if(!i){n.querySelector("#bs-np-title").style.borderColor="#ef4444";return}let c=n.querySelector("#bs-np-desc").value.trim(),p=n.querySelector("#bs-np-priority").value,l=n.querySelector("#bs-np-category").value,g=n.querySelector("#bs-np-assignee")?.value||void 0,h=_s(s),y=Rn(s),M=G().slice(-20).map(k=>`[${k.level}] ${k.args.join(" ")}`),re=ee().slice(-10).map(k=>`${k.message} at ${k.source}:${k.lineno}`),Ce=ae().slice(-10).map(k=>`${k.method} ${k.url} \u2192 ${k.status}`),R;try{n.style.display="none",A.style.display="none",R=await ot()??void 0,A.style.display="",n.style.display=""}catch{}let P={projectId:gt,pageUrl:window.location.href,pathname:window.location.pathname,elementSelector:h,elementXPath:y,xPercent:0,yPercent:0,pageX:e,pageY:t,title:i,description:c,screenshot:R,priority:p,category:l,assigneeId:g,browserInfo:navigator.userAgent,screenSize:`${screen.width}x${screen.height}`,viewportSize:`${window.innerWidth}x${window.innerHeight}`,devicePixelRatio:window.devicePixelRatio,consoleLogs:M,networkErrors:Ce,jsErrors:re};if(n.remove(),navigator.onLine){let k=await Nt(P);k.success&&k.data&&(j.push(k.data),se())}else Ot({type:"create_pin",data:P}),j.push({...P,id:"local-"+Date.now(),orgId:"",status:"open",tags:[],createdById:J()?.id||"",creatorName:J()?.name||"",commentCount:0,createdAt:Date.now(),updatedAt:Date.now()}),se()}),setTimeout(()=>n.querySelector("#bs-np-title")?.focus(),50)}function Nn(){je("pin:created",e=>{let t=e.data;t.pathname===window.location.pathname&&(j.find(s=>s.id===t.id)||(j.push(t),se()))}),je("pin:updated",e=>{let t=e.data,s=j.findIndex(n=>n.id===t.id);s>=0&&(j[s]={...j[s],...t},se())}),je("pin:deleted",e=>{let{id:t}=e.data;j=j.filter(s=>s.id!==t),ce(),se()}),je("comment:created",e=>{let t=e.data;if(Oe){let s=Oe.querySelector("#bs-lp-comments");s&&(s.innerHTML+=`
637
637
  <div class="bs-lp-comment">
638
- <div class="bs-lp-comment-author">${ne(t.author?.name||"Someone")}</div>
639
- <div class="bs-lp-comment-body">${ne(t.body)}</div>
638
+ <div class="bs-lp-comment-author">${te(t.author?.name||"Someone")}</div>
639
+ <div class="bs-lp-comment-body">${te(t.body)}</div>
640
640
  <div class="bs-lp-comment-time">just now</div>
641
641
  </div>
642
- `,s.scrollTop=s.scrollHeight)}})}function jn(){let e=window.location.pathname,t=()=>{window.location.pathname!==e&&(e=window.location.pathname,Os(window.location.href),Ys())},s=history.pushState,n=history.replaceState;history.pushState=function(...r){s.apply(this,r),t()},history.replaceState=function(...r){n.apply(this,r),t()},window.addEventListener("popstate",t)}function ne(e){let t=document.createElement("div");return t.textContent=e,t.innerHTML}var Y,j=null,m=null,F=null,We=null,_e=null,fe=!1,Ee="report";var Et=As(),ue=Is(),K={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>'},qn=`
642
+ `,s.scrollTop=s.scrollHeight)}})}function Dn(){let e=window.location.pathname,t=()=>{window.location.pathname!==e&&(e=window.location.pathname,window.location.href,Us())},s=history.pushState,n=history.replaceState;history.pushState=function(...r){s.apply(this,r),t()},history.replaceState=function(...r){n.apply(this,r),t()},window.addEventListener("popstate",t)}function te(e){let t=document.createElement("div");return t.textContent=e,t.innerHTML}var W,O=null,m=null,F=null,qe=null,Ue=null,be=!1,ke="report";var wt=Ps(),de=zs(),V={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>'},jn=`
643
643
  @import url('https://fonts.googleapis.com/css2?family=Comfortaa:wght@400;600;700&family=Inter:wght@300;400;500;600;700&display=swap');
644
644
 
645
645
  /* \u2500\u2500 FAB \u2500\u2500 */
@@ -1594,7 +1594,7 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
1594
1594
  .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); }
1595
1595
  .bs-set-ly-name { font-size: 12px; font-weight: 600; color: var(--bs-text); margin-bottom: 2px; }
1596
1596
  .bs-set-ly-desc { font-size: 10px; color: var(--bs-muted); }
1597
- `;function Un(){return`
1597
+ `;function On(){return`
1598
1598
  <div class="bs-login-form">
1599
1599
  <div class="bs-login-logo">BugStash</div>
1600
1600
  <div class="bs-login-subtitle">Sign in to report bugs & collaborate</div>
@@ -1604,7 +1604,7 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
1604
1604
  <button class="bs-login-btn" id="bs-login-submit">Sign In</button>
1605
1605
  <div style="font-size:11px;color:var(--bs-muted);margin-top:4px">Contact your admin for an account</div>
1606
1606
  </div>
1607
- `}function H(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Wn(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 Xs(e){return new Date(e).toLocaleTimeString("en",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}var Vs="bugstash_history";function Se(){try{return JSON.parse(localStorage.getItem(Vs)||"[]")}catch{return[]}}function Ft(e){try{localStorage.setItem(Vs,JSON.stringify(e))}catch{}}function _n(e){let t=Se(),s=Date.now();t.unshift({...e,id:s}),t.length>50&&(t.length=50),Ft(t)}function Fn(e){let t=Se().filter(s=>s.id!==e);Ft(t)}function Yn(e,t){let s=Se(),n=s.findIndex(r=>r.id===e);n>=0&&(s[n]={...s[n],...t},Ft(s))}function Ks(){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:Y.environment??"development",commitHash:Y.commitHash,user:Y.user}}function Zs(){let e=te(),t=ee(),s=ve(),n=le(),r=me(),i=ye(),c=t.filter(h=>h.level==="error"),p="low";e.length>=3||n.length>=3?p="critical":e.length>=1||n.length>=2?p="high":(c.length>0||n.length>=1)&&(p="medium");let l=[];return e.length&&l.push("has-errors"),n.length&&l.push("network-failures"),c.length&&l.push("console-errors"),i?.pageLoadTime&&i.pageLoadTime>3e3&&l.push("slow-load"),i?.cumulativeLayoutShift&&i.cumulativeLayoutShift>.25&&l.push("layout-shift"),navigator.onLine||l.push("offline"),window.innerWidth<768&&l.push("mobile"),{severity:p,tags:l,counts:{logs:t.length,network:s.length,failedNet:n.length,errors:e.length,crumbs:r.length}}}function Qs(){let e=Zs(),t=[{id:"ui",label:"UI Bug"},{id:"functionality",label:"Broken Feature"},{id:"performance",label:"Slow / Laggy"},{id:"crash",label:"Crash"},{id:"security",label:"Security"},{id:"other",label:"Other"}];return`<div class="bs-view">
1607
+ `}function I(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function qn(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 Fs(e){return new Date(e).toLocaleTimeString("en",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}var Ws="bugstash_history";function Le(){try{return JSON.parse(localStorage.getItem(Ws)||"[]")}catch{return[]}}function _t(e){try{localStorage.setItem(Ws,JSON.stringify(e))}catch{}}function Un(e){let t=Le(),s=Date.now();t.unshift({...e,id:s}),t.length>50&&(t.length=50),_t(t)}function _n(e){let t=Le().filter(s=>s.id!==e);_t(t)}function Fn(e,t){let s=Le(),n=s.findIndex(r=>r.id===e);n>=0&&(s[n]={...s[n],...t},_t(s))}function Ys(){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:W.environment??"development",commitHash:W.commitHash,user:W.user}}function Xs(){let e=ee(),t=G(),s=me(),n=ae(),r=ue(),i=he(),c=t.filter(x=>x.level==="error"),p="low";e.length>=3||n.length>=3?p="critical":e.length>=1||n.length>=2?p="high":(c.length>0||n.length>=1)&&(p="medium");let l=[];return e.length&&l.push("has-errors"),n.length&&l.push("network-failures"),c.length&&l.push("console-errors"),i?.pageLoadTime&&i.pageLoadTime>3e3&&l.push("slow-load"),i?.cumulativeLayoutShift&&i.cumulativeLayoutShift>.25&&l.push("layout-shift"),navigator.onLine||l.push("offline"),window.innerWidth<768&&l.push("mobile"),{severity:p,tags:l,counts:{logs:t.length,network:s.length,failedNet:n.length,errors:e.length,crumbs:r.length}}}function Js(){let e=Xs(),t=[{id:"ui",label:"UI Bug"},{id:"functionality",label:"Broken Feature"},{id:"performance",label:"Slow / Laggy"},{id:"crash",label:"Crash"},{id:"security",label:"Security"},{id:"other",label:"Other"}];return`<div class="bs-view">
1608
1608
  <form data-bs-form>
1609
1609
  <div class="bs-ctx-bar">
1610
1610
  <div class="bs-ctx-chip${e.counts.logs?" bs-has":""}"><span class="bs-ctx-n">${e.counts.logs}</span><span class="bs-ctx-l">Logs</span></div>
@@ -1638,7 +1638,7 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
1638
1638
  </div>
1639
1639
  </div>
1640
1640
  <div class="bs-shot-area" data-bs-screenshot>
1641
- <div class="bs-shot-icon">${K.cam}</div>
1641
+ <div class="bs-shot-icon">${V.cam}</div>
1642
1642
  <div class="bs-shot-text">
1643
1643
  <div class="bs-shot-title" data-bs-shot-title>Attach screenshot</div>
1644
1644
  <div class="bs-shot-sub" data-bs-shot-sub>Captures & lets you annotate the current view</div>
@@ -1648,17 +1648,17 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
1648
1648
  <button type="submit" class="bs-submit-btn">Submit Report</button>
1649
1649
  <div data-bs-msg></div>
1650
1650
  </form>
1651
- </div>`}function Jn(){let e=ee(),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(s=>`<div class="bs-log"><span class="bs-log-lv ${t[s.level]||"bs-ll"}">${s.level}</span><span class="bs-log-m">${H(s.args.join(" ")).slice(0,500)}</span><span class="bs-log-t">${Xs(s.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 Xn(){let e=ve();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="${H(t.url)}">${H(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 Vn(){let e='<div class="bs-view">',t=te();t.length&&(e+=`<div class="bs-sec">Errors <span class="bs-sec-n">${t.length}</span></div>`,e+=t.slice().reverse().map(i=>`<div class="bs-err-card"><div class="bs-err-m">${H(i.message)}</div>${i.stack?`<div class="bs-err-stack">${H(i.stack)}</div>`:""}<div class="bs-err-meta">${i.type} &middot; ${Xs(i.timestamp)}${i.source?` &middot; ${H(i.source)}:${i.lineno}`:""}</div></div>`).join(""));let s=ye();if(s){e+='<div class="bs-sec">Performance</div>';let i=[["Page Load",s.pageLoadTime,5e3],["DOM Ready",s.domContentLoaded,3e3],["First Paint",s.firstPaint,2e3],["FCP",s.firstContentfulPaint,2500],["LCP",s.largestContentfulPaint,4e3],["FID",s.firstInputDelay,300]];for(let[c,p,l]of i){if(p===void 0)continue;let h=Math.min(100,p/l*100);e+=`<div class="bs-pf"><span class="bs-pf-l">${c}</span><div class="bs-pf-tr"><div class="bs-pf-fl${h>75?" bs-slow":""}" style="width:${h}%"></div></div><span class="bs-pf-v">${p}ms</span></div>`}if(s.cumulativeLayoutShift!==void 0){let c=Math.min(100,s.cumulativeLayoutShift*400);e+=`<div class="bs-pf"><span class="bs-pf-l">CLS</span><div class="bs-pf-tr"><div class="bs-pf-fl${c>40?" bs-slow":""}" style="width:${c}%"></div></div><span class="bs-pf-v">${s.cumulativeLayoutShift}</span></div>`}}let n=me();n.length&&(e+=`<div class="bs-sec">Your activity trail <span class="bs-sec-n">${n.length}</span></div>`,e+=n.slice().reverse().map(i=>`<div class="bs-bc"><span class="bs-bc-t bs-t-${i.type}">${i.type}</span><span class="bs-bc-m">${H(i.message).slice(0,120)}</span><span class="bs-bc-time">${Wn(i.timestamp)}</span></div>`).join(""));let r=Ks();return e+='<div class="bs-sec">Environment</div>',e+=`<div class="bs-kv">
1652
- <span class="bs-kv-k">URL</span><span class="bs-kv-v">${H(r.url)}</span>
1651
+ </div>`}function Wn(){let e=G(),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(s=>`<div class="bs-log"><span class="bs-log-lv ${t[s.level]||"bs-ll"}">${s.level}</span><span class="bs-log-m">${I(s.args.join(" ")).slice(0,500)}</span><span class="bs-log-t">${Fs(s.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 Yn(){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="${I(t.url)}">${I(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 Xn(){let e='<div class="bs-view">',t=ee();t.length&&(e+=`<div class="bs-sec">Errors <span class="bs-sec-n">${t.length}</span></div>`,e+=t.slice().reverse().map(i=>`<div class="bs-err-card"><div class="bs-err-m">${I(i.message)}</div>${i.stack?`<div class="bs-err-stack">${I(i.stack)}</div>`:""}<div class="bs-err-meta">${i.type} &middot; ${Fs(i.timestamp)}${i.source?` &middot; ${I(i.source)}:${i.lineno}`:""}</div></div>`).join(""));let s=he();if(s){e+='<div class="bs-sec">Performance</div>';let i=[["Page Load",s.pageLoadTime,5e3],["DOM Ready",s.domContentLoaded,3e3],["First Paint",s.firstPaint,2e3],["FCP",s.firstContentfulPaint,2500],["LCP",s.largestContentfulPaint,4e3],["FID",s.firstInputDelay,300]];for(let[c,p,l]of i){if(p===void 0)continue;let x=Math.min(100,p/l*100);e+=`<div class="bs-pf"><span class="bs-pf-l">${c}</span><div class="bs-pf-tr"><div class="bs-pf-fl${x>75?" bs-slow":""}" style="width:${x}%"></div></div><span class="bs-pf-v">${p}ms</span></div>`}if(s.cumulativeLayoutShift!==void 0){let c=Math.min(100,s.cumulativeLayoutShift*400);e+=`<div class="bs-pf"><span class="bs-pf-l">CLS</span><div class="bs-pf-tr"><div class="bs-pf-fl${c>40?" bs-slow":""}" style="width:${c}%"></div></div><span class="bs-pf-v">${s.cumulativeLayoutShift}</span></div>`}}let n=ue();n.length&&(e+=`<div class="bs-sec">Your activity trail <span class="bs-sec-n">${n.length}</span></div>`,e+=n.slice().reverse().map(i=>`<div class="bs-bc"><span class="bs-bc-t bs-t-${i.type}">${i.type}</span><span class="bs-bc-m">${I(i.message).slice(0,120)}</span><span class="bs-bc-time">${qn(i.timestamp)}</span></div>`).join(""));let r=Ys();return e+='<div class="bs-sec">Environment</div>',e+=`<div class="bs-kv">
1652
+ <span class="bs-kv-k">URL</span><span class="bs-kv-v">${I(r.url)}</span>
1653
1653
  <span class="bs-kv-k">Viewport</span><span class="bs-kv-v">${r.viewportWidth}&times;${r.viewportHeight} @${r.devicePixelRatio}x</span>
1654
1654
  <span class="bs-kv-k">Screen</span><span class="bs-kv-v">${r.screenWidth}&times;${r.screenHeight}</span>
1655
- <span class="bs-kv-k">Platform</span><span class="bs-kv-v">${H(r.platform)}</span>
1655
+ <span class="bs-kv-k">Platform</span><span class="bs-kv-v">${I(r.platform)}</span>
1656
1656
  <span class="bs-kv-k">Language</span><span class="bs-kv-v">${r.language}</span>
1657
- ${Y.commitHash?`<span class="bs-kv-k">Commit</span><span class="bs-kv-v">${H(Y.commitHash)}</span>`:""}
1658
- ${Y.user?.email?`<span class="bs-kv-k">User</span><span class="bs-kv-v">${H(Y.user.email)}</span>`:""}
1659
- </div>`,e+="</div>",e}function Kn(){let e=Se();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"},s=r=>{let i=new Date(r),p=new Date().getTime()-i.getTime(),l=Math.floor(p/6e4);if(l<1)return"Just now";if(l<60)return`${l}m ago`;let h=Math.floor(l/60);if(h<24)return`${h}h ago`;let g=Math.floor(h/24);return g<7?`${g}d ago`:i.toLocaleDateString("en",{month:"short",day:"numeric"})},n='<div class="bs-view">';for(let r of e){let i=r.pins?.length?`<div class="bs-hist-pins">${r.pins.slice(0,5).map(c=>`<div class="bs-hist-pin-dot" style="background:${["#ef4444","#3b82f6","#f59e0b","#10b981","#8b5cf6"][c.number%5]}">${c.number}</div>`).join("")}${r.pins.length>5?`<span>+${r.pins.length-5}</span>`:""}</div>`:"";n+=`<div class="bs-hist-card" data-hist-id="${r.id}">
1657
+ ${W.commitHash?`<span class="bs-kv-k">Commit</span><span class="bs-kv-v">${I(W.commitHash)}</span>`:""}
1658
+ ${W.user?.email?`<span class="bs-kv-k">User</span><span class="bs-kv-v">${I(W.user.email)}</span>`:""}
1659
+ </div>`,e+="</div>",e}function Jn(){let e=Le();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"},s=r=>{let i=new Date(r),p=new Date().getTime()-i.getTime(),l=Math.floor(p/6e4);if(l<1)return"Just now";if(l<60)return`${l}m ago`;let x=Math.floor(l/60);if(x<24)return`${x}h ago`;let g=Math.floor(x/24);return g<7?`${g}d ago`:i.toLocaleDateString("en",{month:"short",day:"numeric"})},n='<div class="bs-view">';for(let r of e){let i=r.pins?.length?`<div class="bs-hist-pins">${r.pins.slice(0,5).map(c=>`<div class="bs-hist-pin-dot" style="background:${["#ef4444","#3b82f6","#f59e0b","#10b981","#8b5cf6"][c.number%5]}">${c.number}</div>`).join("")}${r.pins.length>5?`<span>+${r.pins.length-5}</span>`:""}</div>`:"";n+=`<div class="bs-hist-card" data-hist-id="${r.id}">
1660
1660
  <div class="bs-hist-top">
1661
- <div class="bs-hist-title">${H(r.title)}</div>
1661
+ <div class="bs-hist-title">${I(r.title)}</div>
1662
1662
  ${r.screenshot?`<img class="bs-hist-thumb" src="${r.screenshot}" alt=""/>`:""}
1663
1663
  <div class="bs-hist-actions">
1664
1664
  <button class="bs-hist-btn" data-hist-edit="${r.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>
@@ -1670,22 +1670,22 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
1670
1670
  <span class="bs-hist-badge bs-sev-${r.severity}">${r.severity}</span>
1671
1671
  <span class="bs-hist-badge bs-status-${r.status}">${r.status}</span>
1672
1672
  </div>
1673
- ${r.description?`<div class="bs-hist-desc">${H(r.description)}</div>`:""}
1673
+ ${r.description?`<div class="bs-hist-desc">${I(r.description)}</div>`:""}
1674
1674
  <div class="bs-hist-foot">
1675
- <span>${s(r.createdAt)} &middot; ${H(r.url.replace(/^https?:\/\//,"").slice(0,40))}</span>
1675
+ <span>${s(r.createdAt)} &middot; ${I(r.url.replace(/^https?:\/\//,"").slice(0,40))}</span>
1676
1676
  ${i}
1677
1677
  </div>
1678
- </div>`}return n+="</div>",n}function Zn(){let e=bt(),t=ut(),s='<div class="bs-view">';s+='<div class="bs-set-sec">Layout</div>',s+='<div class="bs-set-ly-grid">';for(let n of t)s+=`<button class="bs-set-ly${n.id===ue.id?" bs-picked":""}" data-set-layout="${n.id}"><div class="bs-set-ly-name">${H(n.name)}</div><div class="bs-set-ly-desc">${H(n.description)}</div></button>`;s+="</div>",s+='<div class="bs-set-sec">Theme</div>',s+='<div class="bs-set-grid">';for(let n of e)s+=`<button class="bs-set-card${n.id===Et.id?" bs-picked":""}" data-set-theme="${n.id}"><div class="bs-set-preview" style="background:${n.preview[0]}"><div class="bs-set-dot" style="background:${n.preview[1]}"></div><div class="bs-set-dot" style="background:${n.vars["--bs-accent2"]||n.preview[1]};opacity:0.6"></div></div><div class="bs-set-name">${H(n.name)}</div></button>`;return s+="</div>",s+="</div>",s}function Qn(e,t){let s=["#f87171","#3b82f6","#fb923c","#4ade80","#a78bfa","#facc15"],n=s[0],r="draw",i=4,c=1,p=!1,l=[],h=[],g=-1,x=-1,y=!1,$=!1,ae=0,Te=0,N=0,P=0,k=[],Xt=["#ef4444","#3b82f6","#f59e0b","#10b981","#8b5cf6","#ec4899"],ie=new Image;ie.src=t;let Me=document.createElement("div");Me.className="bs-ann-wrap";let $e=document.createElement("div");$e.className="bs-ann-viewport";let w=document.createElement("canvas");w.className="bs-ann-canvas bs-draw";let Q=document.createElement("div");Q.className="bs-ann-toolbar";let Vt={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>'},bn={select:"Select & Move",draw:"Draw",arrow:"Arrow",rect:"Rectangle",circle:"Circle",text:"Text",highlight:"Highlight",pin:"Pin Issue"},$t=[],pn=o=>{r=o,g=-1,w.className=`bs-ann-canvas bs-${o}`,$t.forEach(u=>u.classList.remove("bs-sel")),$t.find(u=>u.dataset.tool===o)?.classList.add("bs-sel")};Object.keys(Vt).forEach(o=>{let u=document.createElement("button");u.type="button",u.dataset.tool=o,u.className=`bs-ann-btn${o===r?" bs-sel":""}`,u.title=bn[o],u.innerHTML=Vt[o],u.addEventListener("click",()=>pn(o)),$t.push(u),Q.appendChild(u)}),Q.appendChild(Object.assign(document.createElement("div"),{className:"bs-ann-sep"})),s.forEach((o,u)=>{let f=document.createElement("button");f.type="button",f.className=`bs-ann-dot${u===0?" bs-sel":""}`,f.style.background=o,f.addEventListener("click",()=>{n=o,Q.querySelectorAll(".bs-ann-dot").forEach(C=>C.classList.remove("bs-sel")),f.classList.add("bs-sel")}),Q.appendChild(f)}),Q.appendChild(Object.assign(document.createElement("div"),{className:"bs-ann-sep"}));let G=document.createElement("input");G.type="range",G.min="1",G.max="12",G.value="4",G.className="bs-ann-size",G.title="Brush size",G.addEventListener("input",()=>{i=parseInt(G.value)}),Q.appendChild(G);let Ye=document.createElement("div");Ye.className="bs-ann-right";let Je=(o,u)=>{let f=document.createElement("button");return f.type="button",f.className="bs-ann-btn",f.title=o,f.innerHTML=u,f},Kt=Je("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>'),Zt=Object.assign(document.createElement("span"),{className:"bs-ann-zoom-label",textContent:"100%"}),Qt=Je("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>'),Gt=Je("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>'),es=Je("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>'),ts=Object.assign(document.createElement("button"),{type:"button",className:"bs-ann-clr-btn",textContent:"Clear"}),Pt=()=>{w.style.transform=`scale(${c})`,Zt.textContent=`${Math.round(c*100)}%`};Qt.addEventListener("click",()=>{c<3&&(c=Math.min(3,c+.25),Pt())}),Kt.addEventListener("click",()=>{c>.5&&(c=Math.max(.5,c-.25),Pt())}),Gt.addEventListener("click",()=>{c=1,Pt()}),Ye.appendChild(Object.assign(document.createElement("div"),{className:"bs-ann-sep"})),[Kt,Zt,Qt,Gt,es,ts].forEach(o=>Ye.appendChild(o)),Q.appendChild(Ye);let Xe=document.createElement("div");Xe.className="bs-ann-pins";let ge=document.createElement("div");ge.className="bs-ann-pin-list",ge.style.display="none",$e.appendChild(w),$e.appendChild(Xe),Me.appendChild($e),Me.appendChild(Q),Me.appendChild(ge),e.innerHTML="",e.appendChild(Me);let Ve=()=>{Xe.innerHTML="",ge.innerHTML="",ge.style.display=h.length?"":"none",h.forEach((o,u)=>{let f=document.createElement("div");f.className="bs-ann-pin",f.style.background=o.color,f.style.color=o.color;let C=o.x/(w.width||1)*100,b=o.y/(w.height||1)*100;f.style.left=`${C}%`,f.style.top=`${b}%`,f.innerHTML=`<span class="bs-ann-pin-n">${u+1}</span><span class="bs-ann-pin-pulse"></span>`,f.title=`#${u+1}: ${o.note}`;let T=!1;f.addEventListener("mousedown",z=>{z.stopPropagation(),T=!0,f.classList.add("bs-dragging");let d=L=>{if(!T)return;let S=$e.getBoundingClientRect();o.x=(L.clientX-S.left)/S.width*w.width,o.y=(L.clientY-S.top)/S.height*w.height,f.style.left=`${(L.clientX-S.left)/S.width*100}%`,f.style.top=`${(L.clientY-S.top)/S.height*100}%`},v=()=>{T=!1,f.classList.remove("bs-dragging"),document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",v),Ve()};document.addEventListener("mousemove",d),document.addEventListener("mouseup",v)}),Xe.appendChild(f);let B=document.createElement("div");B.className="bs-ann-pin-item",B.innerHTML=`
1678
+ </div>`}return n+="</div>",n}function Vn(){let e=ct(),t=bt(),s='<div class="bs-view">';s+='<div class="bs-set-sec">Layout</div>',s+='<div class="bs-set-ly-grid">';for(let n of t)s+=`<button class="bs-set-ly${n.id===de.id?" bs-picked":""}" data-set-layout="${n.id}"><div class="bs-set-ly-name">${I(n.name)}</div><div class="bs-set-ly-desc">${I(n.description)}</div></button>`;s+="</div>",s+='<div class="bs-set-sec">Theme</div>',s+='<div class="bs-set-grid">';for(let n of e)s+=`<button class="bs-set-card${n.id===wt.id?" bs-picked":""}" data-set-theme="${n.id}"><div class="bs-set-preview" style="background:${n.preview[0]}"><div class="bs-set-dot" style="background:${n.preview[1]}"></div><div class="bs-set-dot" style="background:${n.vars["--bs-accent2"]||n.preview[1]};opacity:0.6"></div></div><div class="bs-set-name">${I(n.name)}</div></button>`;return s+="</div>",s+="</div>",s}function Kn(e,t){let s=["#f87171","#3b82f6","#fb923c","#4ade80","#a78bfa","#facc15"],n=s[0],r="draw",i=4,c=1,p=!1,l=[],x=[],g=-1,h=-1,y=!1,M=!1,re=0,Ce=0,R=0,P=0,k=[],Yt=["#ef4444","#3b82f6","#f59e0b","#10b981","#8b5cf6","#ec4899"],oe=new Image;oe.src=t;let Te=document.createElement("div");Te.className="bs-ann-wrap";let $e=document.createElement("div");$e.className="bs-ann-viewport";let w=document.createElement("canvas");w.className="bs-ann-canvas bs-draw";let Z=document.createElement("div");Z.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>'},an={select:"Select & Move",draw:"Draw",arrow:"Arrow",rect:"Rectangle",circle:"Circle",text:"Text",highlight:"Highlight",pin:"Pin Issue"},Tt=[],ln=o=>{r=o,g=-1,w.className=`bs-ann-canvas bs-${o}`,Tt.forEach(u=>u.classList.remove("bs-sel")),Tt.find(u=>u.dataset.tool===o)?.classList.add("bs-sel")};Object.keys(Xt).forEach(o=>{let u=document.createElement("button");u.type="button",u.dataset.tool=o,u.className=`bs-ann-btn${o===r?" bs-sel":""}`,u.title=an[o],u.innerHTML=Xt[o],u.addEventListener("click",()=>ln(o)),Tt.push(u),Z.appendChild(u)}),Z.appendChild(Object.assign(document.createElement("div"),{className:"bs-ann-sep"})),s.forEach((o,u)=>{let f=document.createElement("button");f.type="button",f.className=`bs-ann-dot${u===0?" bs-sel":""}`,f.style.background=o,f.addEventListener("click",()=>{n=o,Z.querySelectorAll(".bs-ann-dot").forEach(C=>C.classList.remove("bs-sel")),f.classList.add("bs-sel")}),Z.appendChild(f)}),Z.appendChild(Object.assign(document.createElement("div"),{className:"bs-ann-sep"}));let Q=document.createElement("input");Q.type="range",Q.min="1",Q.max="12",Q.value="4",Q.className="bs-ann-size",Q.title="Brush size",Q.addEventListener("input",()=>{i=parseInt(Q.value)}),Z.appendChild(Q);let Fe=document.createElement("div");Fe.className="bs-ann-right";let We=(o,u)=>{let f=document.createElement("button");return f.type="button",f.className="bs-ann-btn",f.title=o,f.innerHTML=u,f},Jt=We("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>'),Vt=Object.assign(document.createElement("span"),{className:"bs-ann-zoom-label",textContent:"100%"}),Kt=We("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>'),Zt=We("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>'),Qt=We("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>'),Gt=Object.assign(document.createElement("button"),{type:"button",className:"bs-ann-clr-btn",textContent:"Clear"}),$t=()=>{w.style.transform=`scale(${c})`,Vt.textContent=`${Math.round(c*100)}%`};Kt.addEventListener("click",()=>{c<3&&(c=Math.min(3,c+.25),$t())}),Jt.addEventListener("click",()=>{c>.5&&(c=Math.max(.5,c-.25),$t())}),Zt.addEventListener("click",()=>{c=1,$t()}),Fe.appendChild(Object.assign(document.createElement("div"),{className:"bs-ann-sep"})),[Jt,Vt,Kt,Zt,Qt,Gt].forEach(o=>Fe.appendChild(o)),Z.appendChild(Fe);let Ye=document.createElement("div");Ye.className="bs-ann-pins";let pe=document.createElement("div");pe.className="bs-ann-pin-list",pe.style.display="none",$e.appendChild(w),$e.appendChild(Ye),Te.appendChild($e),Te.appendChild(Z),Te.appendChild(pe),e.innerHTML="",e.appendChild(Te);let Xe=()=>{Ye.innerHTML="",pe.innerHTML="",pe.style.display=x.length?"":"none",x.forEach((o,u)=>{let f=document.createElement("div");f.className="bs-ann-pin",f.style.background=o.color,f.style.color=o.color;let C=o.x/(w.width||1)*100,b=o.y/(w.height||1)*100;f.style.left=`${C}%`,f.style.top=`${b}%`,f.innerHTML=`<span class="bs-ann-pin-n">${u+1}</span><span class="bs-ann-pin-pulse"></span>`,f.title=`#${u+1}: ${o.note}`;let T=!1;f.addEventListener("mousedown",z=>{z.stopPropagation(),T=!0,f.classList.add("bs-dragging");let d=L=>{if(!T)return;let S=$e.getBoundingClientRect();o.x=(L.clientX-S.left)/S.width*w.width,o.y=(L.clientY-S.top)/S.height*w.height,f.style.left=`${(L.clientX-S.left)/S.width*100}%`,f.style.top=`${(L.clientY-S.top)/S.height*100}%`},v=()=>{T=!1,f.classList.remove("bs-dragging"),document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",v),Xe()};document.addEventListener("mousemove",d),document.addEventListener("mouseup",v)}),Ye.appendChild(f);let B=document.createElement("div");B.className="bs-ann-pin-item",B.innerHTML=`
1679
1679
  <div class="bs-ann-pin-num" style="background:${o.color}">${u+1}</div>
1680
1680
  <div class="bs-ann-pin-body">
1681
- <div class="bs-ann-pin-note">${H(o.note)}</div>
1681
+ <div class="bs-ann-pin-note">${I(o.note)}</div>
1682
1682
  <div class="bs-ann-pin-loc">${Math.round(C)}% \xD7 ${Math.round(b)}%</div>
1683
- </div>`;let O=document.createElement("button");O.type="button",O.className="bs-ann-pin-del",O.innerHTML="&times;",O.title="Remove pin",O.addEventListener("click",()=>{h.splice(u,1),Ve()}),B.appendChild(O),ge.appendChild(B)})},a,zt=()=>p?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.35)",be=(o,u)=>{a.save(),a.strokeStyle=zt(),a.lineWidth=u+3,a.lineCap="round",a.lineJoin="round",a.globalAlpha=.5,o(),a.restore()},un=(o,u=!1)=>{if(o.type==="draw"||o.type==="highlight"){if(o.points.length<2)return;let b=o.type==="highlight"?.25:1,T=o.type==="highlight"?o.size*4+10:o.size,B=()=>{a.beginPath(),a.moveTo(o.points[0].x,o.points[0].y);for(let O=1;O<o.points.length;O++)a.lineTo(o.points[O].x,o.points[O].y);a.stroke()};o.type!=="highlight"&&be(B,T),a.strokeStyle=o.color,a.lineWidth=T,a.lineCap="round",a.lineJoin="round",a.globalAlpha=b,B(),a.globalAlpha=1}else if(o.type==="rect"){let b=()=>a.strokeRect(o.x,o.y,o.w,o.h);be(b,o.size),a.strokeStyle=o.color,a.lineWidth=o.size,a.lineCap="round",a.lineJoin="round",b()}else if(o.type==="circle"){let b=()=>{a.beginPath(),a.ellipse(o.cx,o.cy,Math.abs(o.rx),Math.abs(o.ry),0,0,Math.PI*2),a.stroke()};be(b,o.size),a.strokeStyle=o.color,a.lineWidth=o.size,b()}else if(o.type==="arrow"){let b=Math.atan2(o.y2-o.y1,o.x2-o.x1),T=12+o.size*2,B=()=>{a.beginPath(),a.moveTo(o.x1,o.y1),a.lineTo(o.x2,o.y2),a.stroke(),a.beginPath(),a.moveTo(o.x2,o.y2),a.lineTo(o.x2-T*Math.cos(b-.45),o.y2-T*Math.sin(b-.45)),a.moveTo(o.x2,o.y2),a.lineTo(o.x2-T*Math.cos(b+.45),o.y2-T*Math.sin(b+.45)),a.stroke()};be(B,o.size),a.strokeStyle=o.color,a.lineWidth=o.size,a.lineCap="round",a.lineJoin="round",B()}else if(o.type==="text"){let b=o.size*5+12;a.font=`bold ${b}px Inter, -apple-system, sans-serif`,a.fillStyle=zt(),a.globalAlpha=.6,a.fillText(o.text,o.x+1,o.y+1),a.globalAlpha=1,a.fillStyle=o.color,a.fillText(o.text,o.x,o.y)}let f=!u&&g>=0&&l[g]===o,C=!u&&!f&&x>=0&&l[x]===o;if(f||C){let b=Pe(o);if(a.save(),a.setLineDash([6,4]),a.strokeStyle=p?"#fff":"#000",a.lineWidth=f?1.5:1,a.globalAlpha=f?.7:.45,a.strokeRect(b.x-4,b.y-4,b.w+8,b.h+8),o.type==="rect"||o.type==="circle"){a.setLineDash([]),a.globalAlpha=f?.9:.6;let B=o.type==="rect"?[[b.x,b.y],[b.x+b.w,b.y],[b.x,b.y+b.h],[b.x+b.w,b.y+b.h]]:[[b.x+b.w/2,b.y],[b.x+b.w,b.y+b.h/2],[b.x+b.w/2,b.y+b.h],[b.x,b.y+b.h/2]];for(let[O,z]of B)a.fillStyle="#fff",a.fillRect(O-5,z-5,10,10),a.strokeStyle=p?"#aaa":"#333",a.lineWidth=1.2,a.strokeRect(O-5,z-5,10,10)}a.restore()}},D=()=>{a.clearRect(0,0,w.width,w.height),a.drawImage(ie,0,0);for(let o of l)un(o)},Pe=o=>{if(o.type==="rect")return{x:Math.min(o.x,o.x+o.w),y:Math.min(o.y,o.y+o.h),w:Math.abs(o.w),h:Math.abs(o.h)};if(o.type==="circle")return{x:o.cx-Math.abs(o.rx),y:o.cy-Math.abs(o.ry),w:Math.abs(o.rx)*2,h:Math.abs(o.ry)*2};if(o.type==="arrow"){let T=Math.min(o.x1,o.x2),B=Math.min(o.y1,o.y2);return{x:T,y:B,w:Math.abs(o.x2-o.x1)||20,h:Math.abs(o.y2-o.y1)||20}}if(o.type==="text")return{x:o.x,y:o.y-(o.size*5+12),w:o.text.length*(o.size*3+8),h:o.size*5+16};if(o.points.length===0)return{x:0,y:0,w:0,h:0};let u=1/0,f=1/0,C=-1/0,b=-1/0;for(let T of o.points)u=Math.min(u,T.x),f=Math.min(f,T.y),C=Math.max(C,T.x),b=Math.max(b,T.y);return{x:u,y:f,w:C-u||10,h:b-f||10}},Ke=(o,u)=>{for(let f=l.length-1;f>=0;f--){let C=Pe(l[f]),b=8;if(o>=C.x-b&&o<=C.x+C.w+b&&u>=C.y-b&&u<=C.y+C.h+b)return f}return-1},fn=(o,u,f)=>{if(o.type==="draw"||o.type==="highlight")for(let C of o.points)C.x+=u,C.y+=f;else o.type==="rect"?(o.x+=u,o.y+=f):o.type==="circle"?(o.cx+=u,o.cy+=f):o.type==="arrow"?(o.x1+=u,o.y1+=f,o.x2+=u,o.y2+=f):o.type==="text"&&(o.x+=u,o.y+=f)};ie.onload=()=>{let u=(e.clientWidth||450)/ie.width;w.width=ie.width,w.height=ie.height,w.style.height=`${ie.height*u}px`,a=w.getContext("2d"),a.drawImage(ie,0,0);let f=[[10,10],[w.width-10,10],[10,w.height-10],[w.width-10,w.height-10],[w.width/2,w.height/2]],C=0;for(let[z,d]of f){let v=a.getImageData(z,d,1,1).data;C+=(v[0]*299+v[1]*587+v[2]*114)/1e3}p=C/f.length<128;let b=z=>{let d=w.getBoundingClientRect();return{x:(z.clientX-d.left)*(w.width/d.width),y:(z.clientY-d.top)*(w.height/d.height)}},T=!1;w.addEventListener("mousedown",z=>{let d=b(z);if(r==="select"){let v=Ke(d.x,d.y);if(v>=0){g=v,y=!0;let L=Pe(l[v]);ae=d.x-L.x,Te=d.y-L.y,w.classList.add("bs-grabbing"),w.classList.remove("bs-grab"),D()}else g=-1,D();return}if(r!=="pin"&&r!=="text"){let v=Ke(d.x,d.y);if(v>=0){g=v,y=!0,T=!0;let L=Pe(l[v]);ae=d.x-L.x,Te=d.y-L.y,w.classList.add("bs-grabbing"),D();return}}if($=!0,N=d.x,P=d.y,r==="pin"){$=!1;let v=prompt("Describe the issue at this spot:");if(v){let L=Xt[h.length%Xt.length];h.push({x:d.x,y:d.y,note:v,color:L}),Ve()}return}if(r==="text"){$=!1;let v=prompt("Enter text:");v&&(l.push({type:"text",color:n,size:i,x:d.x,y:d.y,text:v}),D());return}(r==="draw"||r==="highlight")&&(k=[{x:d.x,y:d.y}])}),w.addEventListener("mousemove",z=>{let d=b(z);if(y&&g>=0){let v=Pe(l[g]),L=d.x-ae-v.x,S=d.y-Te-v.y;fn(l[g],L,S),D();return}if(r==="select"){let v=Ke(d.x,d.y);w.classList.toggle("bs-grab",v>=0),x!==v&&(x=v,D());return}if(r!=="pin"&&r!=="text"&&!$){let v=Ke(d.x,d.y);w.classList.toggle("bs-grab",v>=0),x!==v&&(x=v,D())}if($){if(r==="draw"||r==="highlight"){k.push({x:d.x,y:d.y}),D();let v=r==="highlight"?.25:1,L=r==="highlight"?i*4+10:i;if(r!=="highlight"){a.save(),a.strokeStyle=zt(),a.lineWidth=L+3,a.lineCap="round",a.lineJoin="round",a.globalAlpha=.5,a.beginPath(),a.moveTo(k[0].x,k[0].y);for(let S=1;S<k.length;S++)a.lineTo(k[S].x,k[S].y);a.stroke(),a.restore()}a.strokeStyle=n,a.lineWidth=L,a.lineCap="round",a.lineJoin="round",a.globalAlpha=v,a.beginPath(),a.moveTo(k[0].x,k[0].y);for(let S=1;S<k.length;S++)a.lineTo(k[S].x,k[S].y);a.stroke(),a.globalAlpha=1}else if(D(),a.strokeStyle=n,a.lineWidth=i,a.lineCap="round",a.lineJoin="round",r==="rect")be(()=>a.strokeRect(N,P,d.x-N,d.y-P),i),a.strokeStyle=n,a.lineWidth=i,a.strokeRect(N,P,d.x-N,d.y-P);else if(r==="circle"){let v=Math.abs(d.x-N)/2,L=Math.abs(d.y-P)/2,S=N+(d.x-N)/2,ss=P+(d.y-P)/2;be(()=>{a.beginPath(),a.ellipse(S,ss,v,L,0,0,Math.PI*2),a.stroke()},i),a.strokeStyle=n,a.lineWidth=i,a.beginPath(),a.ellipse(S,ss,v,L,0,0,Math.PI*2),a.stroke()}else if(r==="arrow"){let v=Math.atan2(d.y-P,d.x-N),L=12+i*2,S=()=>{a.beginPath(),a.moveTo(N,P),a.lineTo(d.x,d.y),a.stroke(),a.beginPath(),a.moveTo(d.x,d.y),a.lineTo(d.x-L*Math.cos(v-.45),d.y-L*Math.sin(v-.45)),a.moveTo(d.x,d.y),a.lineTo(d.x-L*Math.cos(v+.45),d.y-L*Math.sin(v+.45)),a.stroke()};be(S,i),a.strokeStyle=n,a.lineWidth=i,a.lineCap="round",a.lineJoin="round",S()}}});let B=z=>{if(y)return y=!1,T=!1,g=-1,w.classList.remove("bs-grabbing"),w.classList.remove("bs-grab"),D(),void 0;if(!$)return;$=!1;let d=b(z);if(r==="draw"||r==="highlight")k.length>1&&l.push({type:r,color:n,size:i,alpha:r==="highlight"?.25:1,points:[...k]}),k=[];else if(r==="rect")l.push({type:"rect",color:n,size:i,x:N,y:P,w:d.x-N,h:d.y-P});else if(r==="circle"){let v=Math.abs(d.x-N)/2,L=Math.abs(d.y-P)/2;l.push({type:"circle",color:n,size:i,cx:N+(d.x-N)/2,cy:P+(d.y-P)/2,rx:v,ry:L})}else r==="arrow"&&l.push({type:"arrow",color:n,size:i,x1:N,y1:P,x2:d.x,y2:d.y});D()};w.addEventListener("mouseup",B),w.addEventListener("mouseleave",z=>{y?(y=!1,T=!1,w.classList.remove("bs-grabbing"),w.classList.remove("bs-grab"),D()):$&&B(z)});let O=z=>{g>=0&&(z.key==="Delete"||z.key==="Backspace")&&(l.splice(g,1),g=-1,D())};document.addEventListener("keydown",O),es.addEventListener("click",()=>{l.length&&(l.pop(),g=-1,D())}),ts.addEventListener("click",()=>{l.length=0,h.length=0,g=-1,D(),Ve()})};let gn=()=>{for(let o=0;o<h.length;o++){let u=h[o],f=16;a.beginPath(),a.arc(u.x,u.y-f,f,0,Math.PI*2),a.fillStyle=u.color,a.fill(),a.strokeStyle="#fff",a.lineWidth=2,a.stroke(),a.beginPath(),a.moveTo(u.x-8,u.y-6),a.lineTo(u.x,u.y+4),a.lineTo(u.x+8,u.y-6),a.fillStyle=u.color,a.fill(),a.fillStyle="#fff",a.font="bold 14px Inter, sans-serif",a.textAlign="center",a.textBaseline="middle",a.fillText(`${o+1}`,u.x,u.y-f),a.textAlign="start",a.textBaseline="alphabetic"}};return{getAnnotation:()=>{try{return g=-1,D(),gn(),w.toDataURL("image/jpeg",.7)}catch{return null}},getPins:()=>h.map((o,u)=>({number:u+1,x:Math.round(o.x),y:Math.round(o.y),note:o.note}))}}function wt(e){if(!m)return;Ee=e,m.querySelectorAll(".bs-tab").forEach(n=>{n.classList.toggle("bs-active",n.dataset.tab===e)});let t=m.querySelector(".bs-scroll"),s={report:Qs,console:Jn,network:Xn,context:Vn,history:Kn,settings:Zn};t.innerHTML=s[e](),t.scrollTop=0,Gs()}function Gs(){if(!m)return;if(Ee==="history"){m.querySelectorAll("[data-hist-del]").forEach(s=>{s.addEventListener("click",()=>{let n=parseInt(s.dataset.histDel),r=m.querySelector(`[data-hist-id="${n}"]`);if(!r)return;let i=r.querySelector(".bs-hist-confirm");if(i){i.remove();return}let c=document.createElement("div");c.className="bs-hist-confirm",c.innerHTML="<span>Delete this report?</span>";let p=document.createElement("button");p.type="button",p.className="bs-hist-confirm-yes",p.textContent="Delete";let l=document.createElement("button");l.type="button",l.className="bs-hist-confirm-no",l.textContent="Cancel",p.addEventListener("click",()=>{Fn(n),wt("history")}),l.addEventListener("click",()=>c.remove()),c.appendChild(p),c.appendChild(l),r.appendChild(c)})}),m.querySelectorAll("[data-hist-edit]").forEach(s=>{s.addEventListener("click",()=>{let n=parseInt(s.dataset.histEdit),r=m.querySelector(`[data-hist-id="${n}"]`);if(!r)return;let i=r.querySelector(".bs-hist-edit-wrap");if(i){i.remove();return}r.querySelector(".bs-hist-confirm")?.remove();let c=Se().find(y=>y.id===n);if(!c)return;let p=document.createElement("div");p.className="bs-hist-edit-wrap",p.innerHTML=`
1683
+ </div>`;let D=document.createElement("button");D.type="button",D.className="bs-ann-pin-del",D.innerHTML="&times;",D.title="Remove pin",D.addEventListener("click",()=>{x.splice(u,1),Xe()}),B.appendChild(D),pe.appendChild(B)})},a,Mt=()=>p?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.35)",le=(o,u)=>{a.save(),a.strokeStyle=Mt(),a.lineWidth=u+3,a.lineCap="round",a.lineJoin="round",a.globalAlpha=.5,o(),a.restore()},cn=(o,u=!1)=>{if(o.type==="draw"||o.type==="highlight"){if(o.points.length<2)return;let b=o.type==="highlight"?.25:1,T=o.type==="highlight"?o.size*4+10:o.size,B=()=>{a.beginPath(),a.moveTo(o.points[0].x,o.points[0].y);for(let D=1;D<o.points.length;D++)a.lineTo(o.points[D].x,o.points[D].y);a.stroke()};o.type!=="highlight"&&le(B,T),a.strokeStyle=o.color,a.lineWidth=T,a.lineCap="round",a.lineJoin="round",a.globalAlpha=b,B(),a.globalAlpha=1}else if(o.type==="rect"){let b=()=>a.strokeRect(o.x,o.y,o.w,o.h);le(b,o.size),a.strokeStyle=o.color,a.lineWidth=o.size,a.lineCap="round",a.lineJoin="round",b()}else if(o.type==="circle"){let b=()=>{a.beginPath(),a.ellipse(o.cx,o.cy,Math.abs(o.rx),Math.abs(o.ry),0,0,Math.PI*2),a.stroke()};le(b,o.size),a.strokeStyle=o.color,a.lineWidth=o.size,b()}else if(o.type==="arrow"){let b=Math.atan2(o.y2-o.y1,o.x2-o.x1),T=12+o.size*2,B=()=>{a.beginPath(),a.moveTo(o.x1,o.y1),a.lineTo(o.x2,o.y2),a.stroke(),a.beginPath(),a.moveTo(o.x2,o.y2),a.lineTo(o.x2-T*Math.cos(b-.45),o.y2-T*Math.sin(b-.45)),a.moveTo(o.x2,o.y2),a.lineTo(o.x2-T*Math.cos(b+.45),o.y2-T*Math.sin(b+.45)),a.stroke()};le(B,o.size),a.strokeStyle=o.color,a.lineWidth=o.size,a.lineCap="round",a.lineJoin="round",B()}else if(o.type==="text"){let b=o.size*5+12;a.font=`bold ${b}px Inter, -apple-system, sans-serif`,a.fillStyle=Mt(),a.globalAlpha=.6,a.fillText(o.text,o.x+1,o.y+1),a.globalAlpha=1,a.fillStyle=o.color,a.fillText(o.text,o.x,o.y)}let f=!u&&g>=0&&l[g]===o,C=!u&&!f&&h>=0&&l[h]===o;if(f||C){let b=Me(o);if(a.save(),a.setLineDash([6,4]),a.strokeStyle=p?"#fff":"#000",a.lineWidth=f?1.5:1,a.globalAlpha=f?.7:.45,a.strokeRect(b.x-4,b.y-4,b.w+8,b.h+8),o.type==="rect"||o.type==="circle"){a.setLineDash([]),a.globalAlpha=f?.9:.6;let B=o.type==="rect"?[[b.x,b.y],[b.x+b.w,b.y],[b.x,b.y+b.h],[b.x+b.w,b.y+b.h]]:[[b.x+b.w/2,b.y],[b.x+b.w,b.y+b.h/2],[b.x+b.w/2,b.y+b.h],[b.x,b.y+b.h/2]];for(let[D,z]of B)a.fillStyle="#fff",a.fillRect(D-5,z-5,10,10),a.strokeStyle=p?"#aaa":"#333",a.lineWidth=1.2,a.strokeRect(D-5,z-5,10,10)}a.restore()}},N=()=>{a.clearRect(0,0,w.width,w.height),a.drawImage(oe,0,0);for(let o of l)cn(o)},Me=o=>{if(o.type==="rect")return{x:Math.min(o.x,o.x+o.w),y:Math.min(o.y,o.y+o.h),w:Math.abs(o.w),h:Math.abs(o.h)};if(o.type==="circle")return{x:o.cx-Math.abs(o.rx),y:o.cy-Math.abs(o.ry),w:Math.abs(o.rx)*2,h:Math.abs(o.ry)*2};if(o.type==="arrow"){let T=Math.min(o.x1,o.x2),B=Math.min(o.y1,o.y2);return{x:T,y:B,w:Math.abs(o.x2-o.x1)||20,h:Math.abs(o.y2-o.y1)||20}}if(o.type==="text")return{x:o.x,y:o.y-(o.size*5+12),w:o.text.length*(o.size*3+8),h:o.size*5+16};if(o.points.length===0)return{x:0,y:0,w:0,h:0};let u=1/0,f=1/0,C=-1/0,b=-1/0;for(let T of o.points)u=Math.min(u,T.x),f=Math.min(f,T.y),C=Math.max(C,T.x),b=Math.max(b,T.y);return{x:u,y:f,w:C-u||10,h:b-f||10}},Je=(o,u)=>{for(let f=l.length-1;f>=0;f--){let C=Me(l[f]),b=8;if(o>=C.x-b&&o<=C.x+C.w+b&&u>=C.y-b&&u<=C.y+C.h+b)return f}return-1},dn=(o,u,f)=>{if(o.type==="draw"||o.type==="highlight")for(let C of o.points)C.x+=u,C.y+=f;else o.type==="rect"?(o.x+=u,o.y+=f):o.type==="circle"?(o.cx+=u,o.cy+=f):o.type==="arrow"?(o.x1+=u,o.y1+=f,o.x2+=u,o.y2+=f):o.type==="text"&&(o.x+=u,o.y+=f)};oe.onload=()=>{let u=(e.clientWidth||450)/oe.width;w.width=oe.width,w.height=oe.height,w.style.height=`${oe.height*u}px`,a=w.getContext("2d"),a.drawImage(oe,0,0);let f=[[10,10],[w.width-10,10],[10,w.height-10],[w.width-10,w.height-10],[w.width/2,w.height/2]],C=0;for(let[z,d]of f){let v=a.getImageData(z,d,1,1).data;C+=(v[0]*299+v[1]*587+v[2]*114)/1e3}p=C/f.length<128;let b=z=>{let d=w.getBoundingClientRect();return{x:(z.clientX-d.left)*(w.width/d.width),y:(z.clientY-d.top)*(w.height/d.height)}},T=!1;w.addEventListener("mousedown",z=>{let d=b(z);if(r==="select"){let v=Je(d.x,d.y);if(v>=0){g=v,y=!0;let L=Me(l[v]);re=d.x-L.x,Ce=d.y-L.y,w.classList.add("bs-grabbing"),w.classList.remove("bs-grab"),N()}else g=-1,N();return}if(r!=="pin"&&r!=="text"){let v=Je(d.x,d.y);if(v>=0){g=v,y=!0,T=!0;let L=Me(l[v]);re=d.x-L.x,Ce=d.y-L.y,w.classList.add("bs-grabbing"),N();return}}if(M=!0,R=d.x,P=d.y,r==="pin"){M=!1;let v=prompt("Describe the issue at this spot:");if(v){let L=Yt[x.length%Yt.length];x.push({x:d.x,y:d.y,note:v,color:L}),Xe()}return}if(r==="text"){M=!1;let v=prompt("Enter text:");v&&(l.push({type:"text",color:n,size:i,x:d.x,y:d.y,text:v}),N());return}(r==="draw"||r==="highlight")&&(k=[{x:d.x,y:d.y}])}),w.addEventListener("mousemove",z=>{let d=b(z);if(y&&g>=0){let v=Me(l[g]),L=d.x-re-v.x,S=d.y-Ce-v.y;dn(l[g],L,S),N();return}if(r==="select"){let v=Je(d.x,d.y);w.classList.toggle("bs-grab",v>=0),h!==v&&(h=v,N());return}if(r!=="pin"&&r!=="text"&&!M){let v=Je(d.x,d.y);w.classList.toggle("bs-grab",v>=0),h!==v&&(h=v,N())}if(M){if(r==="draw"||r==="highlight"){k.push({x:d.x,y:d.y}),N();let v=r==="highlight"?.25:1,L=r==="highlight"?i*4+10:i;if(r!=="highlight"){a.save(),a.strokeStyle=Mt(),a.lineWidth=L+3,a.lineCap="round",a.lineJoin="round",a.globalAlpha=.5,a.beginPath(),a.moveTo(k[0].x,k[0].y);for(let S=1;S<k.length;S++)a.lineTo(k[S].x,k[S].y);a.stroke(),a.restore()}a.strokeStyle=n,a.lineWidth=L,a.lineCap="round",a.lineJoin="round",a.globalAlpha=v,a.beginPath(),a.moveTo(k[0].x,k[0].y);for(let S=1;S<k.length;S++)a.lineTo(k[S].x,k[S].y);a.stroke(),a.globalAlpha=1}else if(N(),a.strokeStyle=n,a.lineWidth=i,a.lineCap="round",a.lineJoin="round",r==="rect")le(()=>a.strokeRect(R,P,d.x-R,d.y-P),i),a.strokeStyle=n,a.lineWidth=i,a.strokeRect(R,P,d.x-R,d.y-P);else if(r==="circle"){let v=Math.abs(d.x-R)/2,L=Math.abs(d.y-P)/2,S=R+(d.x-R)/2,es=P+(d.y-P)/2;le(()=>{a.beginPath(),a.ellipse(S,es,v,L,0,0,Math.PI*2),a.stroke()},i),a.strokeStyle=n,a.lineWidth=i,a.beginPath(),a.ellipse(S,es,v,L,0,0,Math.PI*2),a.stroke()}else if(r==="arrow"){let v=Math.atan2(d.y-P,d.x-R),L=12+i*2,S=()=>{a.beginPath(),a.moveTo(R,P),a.lineTo(d.x,d.y),a.stroke(),a.beginPath(),a.moveTo(d.x,d.y),a.lineTo(d.x-L*Math.cos(v-.45),d.y-L*Math.sin(v-.45)),a.moveTo(d.x,d.y),a.lineTo(d.x-L*Math.cos(v+.45),d.y-L*Math.sin(v+.45)),a.stroke()};le(S,i),a.strokeStyle=n,a.lineWidth=i,a.lineCap="round",a.lineJoin="round",S()}}});let B=z=>{if(y)return y=!1,T=!1,g=-1,w.classList.remove("bs-grabbing"),w.classList.remove("bs-grab"),N(),void 0;if(!M)return;M=!1;let d=b(z);if(r==="draw"||r==="highlight")k.length>1&&l.push({type:r,color:n,size:i,alpha:r==="highlight"?.25:1,points:[...k]}),k=[];else if(r==="rect")l.push({type:"rect",color:n,size:i,x:R,y:P,w:d.x-R,h:d.y-P});else if(r==="circle"){let v=Math.abs(d.x-R)/2,L=Math.abs(d.y-P)/2;l.push({type:"circle",color:n,size:i,cx:R+(d.x-R)/2,cy:P+(d.y-P)/2,rx:v,ry:L})}else r==="arrow"&&l.push({type:"arrow",color:n,size:i,x1:R,y1:P,x2:d.x,y2:d.y});N()};w.addEventListener("mouseup",B),w.addEventListener("mouseleave",z=>{y?(y=!1,T=!1,w.classList.remove("bs-grabbing"),w.classList.remove("bs-grab"),N()):M&&B(z)});let D=z=>{g>=0&&(z.key==="Delete"||z.key==="Backspace")&&(l.splice(g,1),g=-1,N())};document.addEventListener("keydown",D),Qt.addEventListener("click",()=>{l.length&&(l.pop(),g=-1,N())}),Gt.addEventListener("click",()=>{l.length=0,x.length=0,g=-1,N(),Xe()})};let bn=()=>{for(let o=0;o<x.length;o++){let u=x[o],f=16;a.beginPath(),a.arc(u.x,u.y-f,f,0,Math.PI*2),a.fillStyle=u.color,a.fill(),a.strokeStyle="#fff",a.lineWidth=2,a.stroke(),a.beginPath(),a.moveTo(u.x-8,u.y-6),a.lineTo(u.x,u.y+4),a.lineTo(u.x+8,u.y-6),a.fillStyle=u.color,a.fill(),a.fillStyle="#fff",a.font="bold 14px Inter, sans-serif",a.textAlign="center",a.textBaseline="middle",a.fillText(`${o+1}`,u.x,u.y-f),a.textAlign="start",a.textBaseline="alphabetic"}};return{getAnnotation:()=>{try{return g=-1,N(),bn(),w.toDataURL("image/jpeg",.7)}catch{return null}},getPins:()=>x.map((o,u)=>({number:u+1,x:Math.round(o.x),y:Math.round(o.y),note:o.note}))}}function vt(e){if(!m)return;ke=e,m.querySelectorAll(".bs-tab").forEach(n=>{n.classList.toggle("bs-active",n.dataset.tab===e)});let t=m.querySelector(".bs-scroll"),s={report:Js,console:Wn,network:Yn,context:Xn,history:Jn,settings:Vn};t.innerHTML=s[e](),t.scrollTop=0,Vs()}function Vs(){if(!m)return;if(ke==="history"){m.querySelectorAll("[data-hist-del]").forEach(s=>{s.addEventListener("click",()=>{let n=parseInt(s.dataset.histDel),r=m.querySelector(`[data-hist-id="${n}"]`);if(!r)return;let i=r.querySelector(".bs-hist-confirm");if(i){i.remove();return}let c=document.createElement("div");c.className="bs-hist-confirm",c.innerHTML="<span>Delete this report?</span>";let p=document.createElement("button");p.type="button",p.className="bs-hist-confirm-yes",p.textContent="Delete";let l=document.createElement("button");l.type="button",l.className="bs-hist-confirm-no",l.textContent="Cancel",p.addEventListener("click",()=>{_n(n),vt("history")}),l.addEventListener("click",()=>c.remove()),c.appendChild(p),c.appendChild(l),r.appendChild(c)})}),m.querySelectorAll("[data-hist-edit]").forEach(s=>{s.addEventListener("click",()=>{let n=parseInt(s.dataset.histEdit),r=m.querySelector(`[data-hist-id="${n}"]`);if(!r)return;let i=r.querySelector(".bs-hist-edit-wrap");if(i){i.remove();return}r.querySelector(".bs-hist-confirm")?.remove();let c=Le().find(y=>y.id===n);if(!c)return;let p=document.createElement("div");p.className="bs-hist-edit-wrap",p.innerHTML=`
1684
1684
  <div class="bs-field" style="margin-bottom:8px">
1685
- <input class="bs-input" data-edit-title value="${H(c.title)}" />
1685
+ <input class="bs-input" data-edit-title value="${I(c.title)}" />
1686
1686
  </div>
1687
1687
  <div class="bs-field" style="margin-bottom:8px">
1688
- <textarea class="bs-textarea" data-edit-desc style="min-height:56px">${H(c.description)}</textarea>
1688
+ <textarea class="bs-textarea" data-edit-desc style="min-height:56px">${I(c.description)}</textarea>
1689
1689
  </div>
1690
1690
  <div class="bs-field" style="margin-bottom:8px">
1691
1691
  <div class="bs-sev-row">
@@ -1695,15 +1695,15 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
1695
1695
  <button type="button" class="bs-sev-btn bs-sev-critical${c.severity==="critical"?" bs-picked":""}" data-edit-sev="critical">Critical</button>
1696
1696
  </div>
1697
1697
  </div>
1698
- <div class="bs-hist-edit-row"></div>`;let l=c.severity;r.appendChild(p),p.querySelectorAll("[data-edit-sev]").forEach(y=>{y.addEventListener("click",()=>{l=y.dataset.editSev,p.querySelectorAll(".bs-sev-btn").forEach($=>$.classList.remove("bs-picked")),y.classList.add("bs-picked")})});let h=p.querySelector(".bs-hist-edit-row"),g=document.createElement("button");g.type="button",g.className="bs-hist-save",g.textContent="Save";let x=document.createElement("button");x.type="button",x.className="bs-hist-cancel",x.textContent="Cancel",g.addEventListener("click",()=>{let y=p.querySelector("[data-edit-title]").value.trim(),$=p.querySelector("[data-edit-desc]").value.trim();y&&(Yn(n,{title:y,description:$,severity:l}),wt("history"))}),x.addEventListener("click",()=>p.remove()),h.appendChild(g),h.appendChild(x)})});return}if(Ee==="settings"){m.querySelectorAll("[data-set-theme]").forEach(s=>{s.addEventListener("click",()=>{let n=s.dataset.setTheme;Yt(n),m.querySelectorAll("[data-set-theme]").forEach(r=>r.classList.remove("bs-picked")),s.classList.add("bs-picked")})}),m.querySelectorAll("[data-set-layout]").forEach(s=>{s.addEventListener("click",()=>{let n=s.dataset.setLayout,r=Oe(n);r&&(ue=r,J(),setTimeout(()=>{Ee="settings",Le(),setTimeout(()=>wt("settings"),50)},400))})});return}if(Ee!=="report")return;m.querySelectorAll(".bs-cat-btn").forEach(s=>{s.addEventListener("click",()=>{let n=s.dataset.cat;m.querySelector('input[name="category"]').value=n,m.querySelectorAll(".bs-cat-btn").forEach(r=>r.classList.remove("bs-picked")),s.classList.add("bs-picked")})}),m.querySelectorAll(".bs-sev-btn").forEach(s=>{s.addEventListener("click",()=>{let n=s.dataset.sev;m.querySelector('input[name="severity"]').value=n,m.querySelectorAll(".bs-sev-btn").forEach(r=>r.classList.remove("bs-picked")),s.classList.add("bs-picked")})});let e=null,t=null;m.querySelector("[data-bs-screenshot]")?.addEventListener("click",async()=>{let s=m?.querySelector("[data-bs-shot-title]"),n=m?.querySelector("[data-bs-shot-sub]"),r=m?.querySelector("[data-bs-screenshot]");if(s&&(s.textContent="Capturing..."),m&&(m.style.visibility="hidden"),F&&(F.style.visibility="hidden"),await new Promise(i=>setTimeout(i,200)),e=await it(),m&&(m.style.visibility=""),F&&(F.style.visibility=""),e){s&&(s.textContent="Screenshot captured!"),n&&(n.textContent="Draw on the image below to highlight the issue"),r?.classList.add("bs-captured");let i=m?.querySelector("[data-bs-annotate]");i&&(t=Qn(i,e))}else s&&(s.textContent="Screenshot unavailable"),n&&(n.textContent="Could not capture screenshot on this page")}),m.querySelector("[data-bs-form]")?.addEventListener("submit",async s=>{s.preventDefault();let n=s.target,r=n.querySelector(".bs-submit-btn"),i=n.querySelector("[data-bs-msg]"),c=n.elements.namedItem("title").value.trim(),p=n.elements.namedItem("description").value.trim(),l=n.elements.namedItem("severity").value,h=n.elements.namedItem("category").value;if(!c)return;r.disabled=!0,r.textContent="Sending...";let g=Zs(),x={projectId:Y.projectId,title:c,description:p,category:h,severity:l,tags:g.tags.length?g.tags:void 0,context:Ks(),consoleLogs:ee(),errors:te(),networkCaptures:le(),breadcrumbs:me(),performance:ye()??void 0,screenshot:e??void 0,annotation:t?.getAnnotation()??void 0,pins:t?.getPins().length?t.getPins():void 0,createdAt:Date.now()},y=await Dt(x);_n({title:x.title,description:x.description,category:x.category,severity:x.severity,tags:x.tags,screenshot:x.screenshot,pins:x.pins,url:window.location.href,createdAt:x.createdAt,status:y.success?"sent":"draft"}),y.success?(i.className="bs-msg bs-msg-ok",i.innerHTML=`${K.check} Bug reported \u2014 thank you!`,setTimeout(J,1200)):(i.className="bs-msg bs-msg-err",i.textContent=y.error??"Could not send. Saved as draft.",r.disabled=!1,r.textContent="Submit Report")})}function Le(){if(fe)return;fe=!0,Ee="report",F=document.createElement("div"),F.className="bs-backdrop",document.body.appendChild(F);let e=le().length,t=te().length;m=document.createElement("div"),m.className=`bs-modal bs-ly-${ue.id}`,kt(m);let s=`
1698
+ <div class="bs-hist-edit-row"></div>`;let l=c.severity;r.appendChild(p),p.querySelectorAll("[data-edit-sev]").forEach(y=>{y.addEventListener("click",()=>{l=y.dataset.editSev,p.querySelectorAll(".bs-sev-btn").forEach(M=>M.classList.remove("bs-picked")),y.classList.add("bs-picked")})});let x=p.querySelector(".bs-hist-edit-row"),g=document.createElement("button");g.type="button",g.className="bs-hist-save",g.textContent="Save";let h=document.createElement("button");h.type="button",h.className="bs-hist-cancel",h.textContent="Cancel",g.addEventListener("click",()=>{let y=p.querySelector("[data-edit-title]").value.trim(),M=p.querySelector("[data-edit-desc]").value.trim();y&&(Fn(n,{title:y,description:M,severity:l}),vt("history"))}),h.addEventListener("click",()=>p.remove()),x.appendChild(g),x.appendChild(h)})});return}if(ke==="settings"){m.querySelectorAll("[data-set-theme]").forEach(s=>{s.addEventListener("click",()=>{let n=s.dataset.setTheme;Ft(n),m.querySelectorAll("[data-set-theme]").forEach(r=>r.classList.remove("bs-picked")),s.classList.add("bs-picked")})}),m.querySelectorAll("[data-set-layout]").forEach(s=>{s.addEventListener("click",()=>{let n=s.dataset.setLayout,r=De(n);r&&(de=r,Y(),setTimeout(()=>{ke="settings",Ee(),setTimeout(()=>vt("settings"),50)},400))})});return}if(ke!=="report")return;m.querySelectorAll(".bs-cat-btn").forEach(s=>{s.addEventListener("click",()=>{let n=s.dataset.cat;m.querySelector('input[name="category"]').value=n,m.querySelectorAll(".bs-cat-btn").forEach(r=>r.classList.remove("bs-picked")),s.classList.add("bs-picked")})}),m.querySelectorAll(".bs-sev-btn").forEach(s=>{s.addEventListener("click",()=>{let n=s.dataset.sev;m.querySelector('input[name="severity"]').value=n,m.querySelectorAll(".bs-sev-btn").forEach(r=>r.classList.remove("bs-picked")),s.classList.add("bs-picked")})});let e=null,t=null;m.querySelector("[data-bs-screenshot]")?.addEventListener("click",async()=>{let s=m?.querySelector("[data-bs-shot-title]"),n=m?.querySelector("[data-bs-shot-sub]"),r=m?.querySelector("[data-bs-screenshot]");if(s&&(s.textContent="Capturing..."),m&&(m.style.visibility="hidden"),F&&(F.style.visibility="hidden"),await new Promise(i=>setTimeout(i,200)),e=await ot(),m&&(m.style.visibility=""),F&&(F.style.visibility=""),e){s&&(s.textContent="Screenshot captured!"),n&&(n.textContent="Draw on the image below to highlight the issue"),r?.classList.add("bs-captured");let i=m?.querySelector("[data-bs-annotate]");i&&(t=Kn(i,e))}else s&&(s.textContent="Screenshot unavailable"),n&&(n.textContent="Could not capture screenshot on this page")}),m.querySelector("[data-bs-form]")?.addEventListener("submit",async s=>{s.preventDefault();let n=s.target,r=n.querySelector(".bs-submit-btn"),i=n.querySelector("[data-bs-msg]"),c=n.elements.namedItem("title").value.trim(),p=n.elements.namedItem("description").value.trim(),l=n.elements.namedItem("severity").value,x=n.elements.namedItem("category").value;if(!c)return;r.disabled=!0,r.textContent="Sending...";let g=Xs(),h={projectId:W.projectId,title:c,description:p,category:x,severity:l,tags:g.tags.length?g.tags:void 0,context:Ys(),consoleLogs:G(),errors:ee(),networkCaptures:ae(),breadcrumbs:ue(),performance:he()??void 0,screenshot:e??void 0,annotation:t?.getAnnotation()??void 0,pins:t?.getPins().length?t.getPins():void 0,createdAt:Date.now()},y=await Bt(h);Un({title:h.title,description:h.description,category:h.category,severity:h.severity,tags:h.tags,screenshot:h.screenshot,pins:h.pins,url:window.location.href,createdAt:h.createdAt,status:y.success?"sent":"draft"}),y.success?(i.className="bs-msg bs-msg-ok",i.innerHTML=`${V.check} Bug reported \u2014 thank you!`,setTimeout(Y,1200)):(i.className="bs-msg bs-msg-err",i.textContent=y.error??"Could not send. Saved as draft.",r.disabled=!1,r.textContent="Submit Report")})}function Ee(){if(be)return;be=!0,ke="report",F=document.createElement("div"),F.className="bs-backdrop",document.body.appendChild(F);let e=ae().length,t=ee().length;m=document.createElement("div"),m.className=`bs-modal bs-ly-${de.id}`,yt(m);let s=`
1699
1699
  <div class="bs-tabs">
1700
- <button class="bs-tab bs-active" data-tab="report">${K.report} Report</button>
1701
- <button class="bs-tab" data-tab="console">${K.console} Console <span class="bs-tab-badge">${ee().length}</span></button>
1702
- <button class="bs-tab" data-tab="network">${K.network} Network ${e?`<span class="bs-tab-badge bs-warn">${e}</span>`:`<span class="bs-tab-badge">${ve().length}</span>`}</button>
1703
- <button class="bs-tab" data-tab="context">${K.ctx} Context ${t?`<span class="bs-tab-badge bs-warn">${t}</span>`:""}</button>
1704
- <button class="bs-tab" data-tab="history">${K.history} History <span class="bs-tab-badge">${Se().length}</span></button>
1705
- <button class="bs-tab" data-tab="settings" style="margin-left:auto">${K.settings}</button>
1706
- </div>`,n=V(),r=n?n.name.split(" ").map(x=>x[0]).join("").toUpperCase().slice(0,2):"",i=yt(),c=`
1700
+ <button class="bs-tab bs-active" data-tab="report">${V.report} Report</button>
1701
+ <button class="bs-tab" data-tab="console">${V.console} Console <span class="bs-tab-badge">${G().length}</span></button>
1702
+ <button class="bs-tab" data-tab="network">${V.network} Network ${e?`<span class="bs-tab-badge bs-warn">${e}</span>`:`<span class="bs-tab-badge">${me().length}</span>`}</button>
1703
+ <button class="bs-tab" data-tab="context">${V.ctx} Context ${t?`<span class="bs-tab-badge bs-warn">${t}</span>`:""}</button>
1704
+ <button class="bs-tab" data-tab="history">${V.history} History <span class="bs-tab-badge">${Le().length}</span></button>
1705
+ <button class="bs-tab" data-tab="settings" style="margin-left:auto">${V.settings}</button>
1706
+ </div>`,n=J(),r=n?n.name.split(" ").map(h=>h[0]).join("").toUpperCase().slice(0,2):"",i=xt(),c=`
1707
1707
  <div class="bs-hdr">
1708
1708
  <div class="bs-logo">BugStash</div>
1709
1709
  <div class="bs-hdr-right">
@@ -1718,23 +1718,23 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
1718
1718
  </div>
1719
1719
  <button class="bs-login-logout" data-bs-logout title="Sign out">Logout</button>
1720
1720
  `:""}
1721
- <button class="bs-close-btn" data-bs-close title="Close">${K.x}</button>
1721
+ <button class="bs-close-btn" data-bs-close title="Close">${V.x}</button>
1722
1722
  </div>
1723
- </div>`,p=ue.tabPosition==="left",l=ue.tabPosition==="bottom",h=n?Qs():Un();p?m.innerHTML=`
1723
+ </div>`,p=de.tabPosition==="left",l=de.tabPosition==="bottom",x=n?Js():On();p?m.innerHTML=`
1724
1724
  ${c}
1725
1725
  <div class="bs-body-wrap">
1726
1726
  ${n?s:""}
1727
- <div class="bs-scroll">${h}</div>
1727
+ <div class="bs-scroll">${x}</div>
1728
1728
  </div>`:l?m.innerHTML=`
1729
1729
  ${c}
1730
- <div class="bs-scroll">${h}</div>
1730
+ <div class="bs-scroll">${x}</div>
1731
1731
  ${n?`<div class="bs-tab-divider"></div>${s}`:""}`:m.innerHTML=`
1732
1732
  ${c}
1733
1733
  ${n?`${s}<div class="bs-tab-divider"></div>`:""}
1734
- <div class="bs-scroll">${h}</div>`,document.body.appendChild(m),j&&j.classList.add("bs-open"),requestAnimationFrame(()=>{F?.classList.add("bs-in"),m?.classList.add("bs-in")}),m.querySelectorAll(".bs-tab").forEach(x=>{x.addEventListener("click",()=>wt(x.dataset.tab))}),m.querySelector("[data-bs-close]")?.addEventListener("click",J),F.addEventListener("click",J),m.querySelector("[data-bs-pin-toggle]")?.addEventListener("click",()=>{let x=vt(),y=m?.querySelector("[data-bs-pin-toggle]");y&&(y.classList.toggle("active",x),y.innerHTML=`
1734
+ <div class="bs-scroll">${x}</div>`,document.body.appendChild(m),O&&O.classList.add("bs-open"),requestAnimationFrame(()=>{F?.classList.add("bs-in"),m?.classList.add("bs-in")}),m.querySelectorAll(".bs-tab").forEach(h=>{h.addEventListener("click",()=>vt(h.dataset.tab))}),m.querySelector("[data-bs-close]")?.addEventListener("click",Y),F.addEventListener("click",Y),m.querySelector("[data-bs-pin-toggle]")?.addEventListener("click",()=>{let h=ht(),y=m?.querySelector("[data-bs-pin-toggle]");y&&(y.classList.toggle("active",h),y.innerHTML=`
1735
1735
  <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>
1736
- Pins ${x?"ON":"OFF"}
1737
- `)}),m.querySelector("[data-bs-logout]")?.addEventListener("click",()=>{ct(),J(),setTimeout(()=>Le(),300)}),n?Gs():Gn();let g=x=>{x.key==="Escape"&&(J(),document.removeEventListener("keydown",g))};document.addEventListener("keydown",g)}function Gn(){if(!m)return;let e=m.querySelector("#bs-login-submit"),t=m.querySelector("#bs-login-email"),s=m.querySelector("#bs-login-pass"),n=m.querySelector("#bs-login-error");if(!e||!t||!s)return;let r=async()=>{let i=t.value.trim(),c=s.value;if(!i||!c){n.textContent="Please enter email and password",n.style.display="block";return}e.setAttribute("disabled","true"),e.textContent="Signing in...",n.style.display="none";let p=await lt(i,c,Y.projectId);p.success?(xt(Y.projectId),mt(Y.projectId),J(),setTimeout(()=>Le(),300)):(n.textContent=p.error||"Invalid credentials",n.style.display="block",e.removeAttribute("disabled"),e.textContent="Sign In")};e.addEventListener("click",r),s.addEventListener("keydown",i=>{i.key==="Enter"&&r()}),t.addEventListener("keydown",i=>{i.key==="Enter"&&s.focus()}),setTimeout(()=>t.focus(),100)}function J(){fe&&(j&&j.classList.remove("bs-open"),m&&(m.classList.remove("bs-in"),m.classList.add("bs-out")),F&&F.classList.remove("bs-in"),setTimeout(()=>{m?.remove(),F?.remove(),m=null,F=null,fe=!1},350))}function kt(e){for(let[t,s]of Object.entries(Et.vars))e.style.setProperty(t,s)}function Yt(e){let t=pt(e);t&&(Et=t,m&&kt(m),j&&kt(j))}function en(){return Et.id}function tn(e){let t=Oe(e);t&&(ue=t,fe&&(J(),setTimeout(Le,400)))}function sn(){return ue.id}function nn(e){Y=e,We=document.createElement("style"),We.textContent=qn+Hs,document.head.appendChild(We),j=document.createElement("button"),j.className="bs-fab",kt(j),j.innerHTML=`${K.bug}<span class="bs-fab-label">Report a bug</span>`,j.style[e.panelPosition==="bottom-left"?"left":"right"]="24px",j.addEventListener("click",()=>fe?J():Le()),document.body.appendChild(j),_e=t=>{(t.ctrlKey||t.metaKey)&&t.shiftKey&&t.key==="B"&&(t.preventDefault(),fe?J():Le())},document.addEventListener("keydown",_e)}function rn(){J(),j?.remove(),j=null,We?.remove(),We=null,_e&&document.removeEventListener("keydown",_e),_e=null}var Z=null,R=null,E=null,oe=null,Lt="freehand",St="#ef4444",er=3,Ce=[],_=null,Fe=!1,Ct=null,tr=[{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"}],sr=["#ef4444","#f97316","#eab308","#22c55e","#3b82f6","#8b5cf6","#ffffff","#000000"];function ln(e){return new Promise(t=>{Ct=t,Ce=[],_=null,Lt="freehand",St="#ef4444",nr(e)})}function nr(e){Z&&Z.remove(),Z=document.createElement("div"),Z.id="bs-annotation-overlay";let t=document.createElement("style");t.textContent=`
1736
+ Pins ${h?"ON":"OFF"}
1737
+ `)}),m.querySelector("[data-bs-logout]")?.addEventListener("click",()=>{it(),Y(),setTimeout(()=>Ee(),300)}),n?Vs():Zn();let g=h=>{h.key==="Escape"&&(Y(),document.removeEventListener("keydown",g))};document.addEventListener("keydown",g)}function Zn(){if(!m)return;let e=m.querySelector("#bs-login-submit"),t=m.querySelector("#bs-login-email"),s=m.querySelector("#bs-login-pass"),n=m.querySelector("#bs-login-error");if(!e||!t||!s)return;let r=async()=>{let i=t.value.trim(),c=s.value;if(!i||!c){n.textContent="Please enter email and password",n.style.display="block";return}e.setAttribute("disabled","true"),e.textContent="Signing in...",n.style.display="none";let p=await at(i,c,W.projectId);p.success?(mt(W.projectId),ft(W.projectId),Y(),setTimeout(()=>Ee(),300)):(n.textContent=p.error||"Invalid credentials",n.style.display="block",e.removeAttribute("disabled"),e.textContent="Sign In")};e.addEventListener("click",r),s.addEventListener("keydown",i=>{i.key==="Enter"&&r()}),t.addEventListener("keydown",i=>{i.key==="Enter"&&s.focus()}),setTimeout(()=>t.focus(),100)}function Y(){be&&(O&&O.classList.remove("bs-open"),m&&(m.classList.remove("bs-in"),m.classList.add("bs-out")),F&&F.classList.remove("bs-in"),setTimeout(()=>{m?.remove(),F?.remove(),m=null,F=null,be=!1},350))}function yt(e){for(let[t,s]of Object.entries(wt.vars))e.style.setProperty(t,s)}function Ft(e){let t=dt(e);t&&(wt=t,m&&yt(m),O&&yt(O))}function Ks(){return wt.id}function Zs(e){let t=De(e);t&&(de=t,be&&(Y(),setTimeout(Ee,400)))}function Qs(){return de.id}function Gs(e){W=e,qe=document.createElement("style"),qe.textContent=jn+As,document.head.appendChild(qe),O=document.createElement("button"),O.className="bs-fab",yt(O),O.innerHTML=`${V.bug}<span class="bs-fab-label">Report a bug</span>`,O.style[e.panelPosition==="bottom-left"?"left":"right"]="24px",O.addEventListener("click",()=>be?Y():Ee()),document.body.appendChild(O),Ue=t=>{(t.ctrlKey||t.metaKey)&&t.shiftKey&&t.key==="B"&&(t.preventDefault(),be?Y():Ee())},document.addEventListener("keydown",Ue)}function en(){Y(),O?.remove(),O=null,qe?.remove(),qe=null,Ue&&document.removeEventListener("keydown",Ue),Ue=null}var K=null,H=null,E=null,ne=null,kt="freehand",Et="#ef4444",Qn=3,Se=[],_=null,_e=!1,Lt=null,Gn=[{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"}],er=["#ef4444","#f97316","#eab308","#22c55e","#3b82f6","#8b5cf6","#ffffff","#000000"];function nn(e){return new Promise(t=>{Lt=t,Se=[],_=null,kt="freehand",Et="#ef4444",tr(e)})}function tr(e){K&&K.remove(),K=document.createElement("div"),K.id="bs-annotation-overlay";let t=document.createElement("style");t.textContent=`
1738
1738
  #bs-annotation-overlay {
1739
1739
  position: fixed; inset: 0; z-index: 2147483647;
1740
1740
  background: rgba(0,0,0,0.85);
@@ -1779,5 +1779,5 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
1779
1779
  overflow: hidden; padding: 16px;
1780
1780
  }
1781
1781
  .bs-ann-canvas-wrap canvas { cursor: crosshair; border-radius: 4px; }
1782
- `,Z.appendChild(t);let s=document.createElement("div");s.className="bs-ann-toolbar";for(let p of tr){let l=document.createElement("button");l.className=`bs-ann-tool${p.id===Lt?" active":""}`,l.title=p.label,l.innerHTML=`<svg viewBox="0 0 24 24"><path d="${p.icon}"/></svg>`,l.addEventListener("click",()=>{Lt=p.id,s.querySelectorAll(".bs-ann-tool").forEach(h=>h.classList.remove("active")),l.classList.add("active")}),s.appendChild(l)}s.appendChild(on());for(let p of sr){let l=document.createElement("button");l.className=`bs-ann-color${p===St?" active":""}`,l.style.background=p,l.addEventListener("click",()=>{St=p,s.querySelectorAll(".bs-ann-color").forEach(h=>h.classList.remove("active")),l.classList.add("active")}),s.appendChild(l)}s.appendChild(on());let n=document.createElement("button");n.className="bs-ann-btn bs-ann-undo",n.textContent="Undo",n.addEventListener("click",()=>{Ce.pop(),Tt()}),s.appendChild(n);let r=document.createElement("button");r.className="bs-ann-btn bs-ann-save",r.textContent="Save",r.addEventListener("click",or);let i=document.createElement("button");i.className="bs-ann-btn bs-ann-cancel",i.textContent="Cancel",i.addEventListener("click",()=>{Jt(),Ct?.(null)}),s.appendChild(r),s.appendChild(i),Z.appendChild(s);let c=document.createElement("div");c.className="bs-ann-canvas-wrap",R=document.createElement("canvas"),E=R.getContext("2d"),c.appendChild(R),Z.appendChild(c),document.body.appendChild(Z),oe=new Image,oe.onload=()=>{if(!R||!E||!oe)return;let p=window.innerWidth-32,l=window.innerHeight-100,h=oe.width,g=oe.height,x=Math.min(1,p/h,l/g);h=Math.round(h*x),g=Math.round(g*x),R.width=h,R.height=g,Tt(),rr()},oe.src=e}function on(){let e=document.createElement("div");return e.className="bs-ann-sep",e}function rr(){if(!R)return;R.addEventListener("mousedown",t=>{Fe=!0;let{x:s,y:n}=an(t);_={type:Lt,color:St,lineWidth:er,points:[{x:s,y:n}],x:s,y:n,width:0,height:0}}),R.addEventListener("mousemove",t=>{if(!Fe||!_)return;let{x:s,y:n}=an(t);_.type==="freehand"?_.points.push({x:s,y:n}):(_.width=s-_.x,_.height=n-_.y),Tt(),cn(_)});let e=()=>{Fe&&_&&(Ce.push(_),_=null),Fe=!1,Tt()};R.addEventListener("mouseup",e),R.addEventListener("mouseleave",e)}function an(e){let t=R.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}}function Tt(){if(!(!E||!R||!oe)){E.clearRect(0,0,R.width,R.height),E.drawImage(oe,0,0,R.width,R.height);for(let e of Ce)cn(e)}}function cn(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,s=e.y+e.height/2,n=Math.abs(e.width)/2,r=Math.abs(e.height)/2;E.beginPath(),E.ellipse(t,s,n,r,0,0,Math.PI*2),E.stroke();break}case"arrow":{let t=e.x,s=e.y,n=e.x+e.width,r=e.y+e.height,i=14,c=Math.atan2(r-s,n-t);E.beginPath(),E.moveTo(t,s),E.lineTo(n,r),E.stroke(),E.beginPath(),E.moveTo(n,r),E.lineTo(n-i*Math.cos(c-Math.PI/6),r-i*Math.sin(c-Math.PI/6)),E.lineTo(n-i*Math.cos(c+Math.PI/6),r-i*Math.sin(c+Math.PI/6)),E.closePath(),E.fill();break}}}function or(){if(!R){Jt(),Ct?.(null);return}let t={dataUrl:R.toDataURL("image/png"),annotations:Ce};Jt(),Ct?.(t)}function Jt(){Z?.remove(),Z=null,R=null,E=null,oe=null,Ce=[],_=null,Fe=!1}var Mt=!1;function ar(){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 dn={init(e){Mt||typeof window>"u"||(e.environment??ar())==="production"||(Mt=!0,e.endpoint&&Es(e.endpoint),rs(e.maxBreadcrumbs),cs(e.maxLogs),fs(e.maxNetworkCaptures),hs(),e.enablePerformance!==!1&&ys(),nn(e),e.enableLivePins!==!1&&V()&&(xt(e.projectId),mt(e.projectId)))},destroy(){Mt&&(rn(),Fs(),Ds(),bs(),ms(),vs(),as(),ws(),Mt=!1)},getLogs:ee,clearLogs:ds,getNetworkCaptures:ve,getFailedNetworkCaptures:le,clearNetworkCaptures:gs,getErrors:te,clearErrors:xs,getBreadcrumbs:me,clearBreadcrumbs:os,getPerformanceMetrics:ye,addBreadcrumb:q,getThemes:bt,getThemeById:pt,setTheme:Yt,getCurrentThemeId:en,getLayouts:ut,getLayoutById:Oe,setLayout:tn,getCurrentLayoutId:sn,getCurrentUser:V,login:lt,logout:ct,togglePinMode:vt,isPinModeActive:yt,isConnected:js,openAnnotationEditor:ln,redactString:he,redactObject:Qe},ir=dn;0&&(module.exports={BugStash});
1782
+ `,K.appendChild(t);let s=document.createElement("div");s.className="bs-ann-toolbar";for(let p of Gn){let l=document.createElement("button");l.className=`bs-ann-tool${p.id===kt?" active":""}`,l.title=p.label,l.innerHTML=`<svg viewBox="0 0 24 24"><path d="${p.icon}"/></svg>`,l.addEventListener("click",()=>{kt=p.id,s.querySelectorAll(".bs-ann-tool").forEach(x=>x.classList.remove("active")),l.classList.add("active")}),s.appendChild(l)}s.appendChild(tn());for(let p of er){let l=document.createElement("button");l.className=`bs-ann-color${p===Et?" active":""}`,l.style.background=p,l.addEventListener("click",()=>{Et=p,s.querySelectorAll(".bs-ann-color").forEach(x=>x.classList.remove("active")),l.classList.add("active")}),s.appendChild(l)}s.appendChild(tn());let n=document.createElement("button");n.className="bs-ann-btn bs-ann-undo",n.textContent="Undo",n.addEventListener("click",()=>{Se.pop(),St()}),s.appendChild(n);let r=document.createElement("button");r.className="bs-ann-btn bs-ann-save",r.textContent="Save",r.addEventListener("click",nr);let i=document.createElement("button");i.className="bs-ann-btn bs-ann-cancel",i.textContent="Cancel",i.addEventListener("click",()=>{Wt(),Lt?.(null)}),s.appendChild(r),s.appendChild(i),K.appendChild(s);let c=document.createElement("div");c.className="bs-ann-canvas-wrap",H=document.createElement("canvas"),E=H.getContext("2d"),c.appendChild(H),K.appendChild(c),document.body.appendChild(K),ne=new Image,ne.onload=()=>{if(!H||!E||!ne)return;let p=window.innerWidth-32,l=window.innerHeight-100,x=ne.width,g=ne.height,h=Math.min(1,p/x,l/g);x=Math.round(x*h),g=Math.round(g*h),H.width=x,H.height=g,St(),sr()},ne.src=e}function tn(){let e=document.createElement("div");return e.className="bs-ann-sep",e}function sr(){if(!H)return;H.addEventListener("mousedown",t=>{_e=!0;let{x:s,y:n}=sn(t);_={type:kt,color:Et,lineWidth:Qn,points:[{x:s,y:n}],x:s,y:n,width:0,height:0}}),H.addEventListener("mousemove",t=>{if(!_e||!_)return;let{x:s,y:n}=sn(t);_.type==="freehand"?_.points.push({x:s,y:n}):(_.width=s-_.x,_.height=n-_.y),St(),rn(_)});let e=()=>{_e&&_&&(Se.push(_),_=null),_e=!1,St()};H.addEventListener("mouseup",e),H.addEventListener("mouseleave",e)}function sn(e){let t=H.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}}function St(){if(!(!E||!H||!ne)){E.clearRect(0,0,H.width,H.height),E.drawImage(ne,0,0,H.width,H.height);for(let e of Se)rn(e)}}function rn(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,s=e.y+e.height/2,n=Math.abs(e.width)/2,r=Math.abs(e.height)/2;E.beginPath(),E.ellipse(t,s,n,r,0,0,Math.PI*2),E.stroke();break}case"arrow":{let t=e.x,s=e.y,n=e.x+e.width,r=e.y+e.height,i=14,c=Math.atan2(r-s,n-t);E.beginPath(),E.moveTo(t,s),E.lineTo(n,r),E.stroke(),E.beginPath(),E.moveTo(n,r),E.lineTo(n-i*Math.cos(c-Math.PI/6),r-i*Math.sin(c-Math.PI/6)),E.lineTo(n-i*Math.cos(c+Math.PI/6),r-i*Math.sin(c+Math.PI/6)),E.closePath(),E.fill();break}}}function nr(){if(!H){Wt(),Lt?.(null);return}let t={dataUrl:H.toDataURL("image/png"),annotations:Se};Wt(),Lt?.(t)}function Wt(){K?.remove(),K=null,H=null,E=null,ne=null,Se=[],_=null,_e=!1}var Ct=!1;function rr(){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 on={init(e){Ct||typeof window>"u"||(e.environment??rr())==="production"||(Ct=!0,e.endpoint&&ws(e.endpoint),ss(e.maxBreadcrumbs),is(e.maxLogs),ps(e.maxNetworkCaptures),gs(),e.enablePerformance!==!1&&xs(),Gs(e),e.enableLivePins!==!1&&J()&&(mt(e.projectId),ft(e.projectId)))},destroy(){Ct&&(en(),qs(),Hs(),cs(),fs(),hs(),rs(),vs(),Ct=!1)},getLogs:G,clearLogs:ls,getNetworkCaptures:me,getFailedNetworkCaptures:ae,clearNetworkCaptures:us,getErrors:ee,clearErrors:ms,getBreadcrumbs:ue,clearBreadcrumbs:ns,getPerformanceMetrics:he,addBreadcrumb:q,getThemes:ct,getThemeById:dt,setTheme:Ft,getCurrentThemeId:Ks,getLayouts:bt,getLayoutById:De,setLayout:Zs,getCurrentLayoutId:Qs,getCurrentUser:J,login:at,logout:it,togglePinMode:ht,isPinModeActive:xt,isConnected:Bs,openAnnotationEditor:nn,redactString:fe,redactObject:Ke},or=on;0&&(module.exports={BugStash});
1783
1783
  //# sourceMappingURL=index.cjs.map