bugstash 0.1.11 → 0.1.12
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 +182 -168
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +182 -168
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";var It=Object.defineProperty;var fs=Object.getOwnPropertyDescriptor;var hs=Object.getOwnPropertyNames;var vs=Object.prototype.hasOwnProperty;var xs=(e,t)=>{for(var n in t)It(e,n,{get:t[n],enumerable:!0})},ys=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of hs(t))!vs.call(e,r)&&r!==n&&It(e,r,{get:()=>t[r],enumerable:!(s=fs(t,r))||s.enumerable});return e};var ws=e=>ys(It({},"__esModule",{value:!0}),e);var
|
|
1
|
+
"use strict";var It=Object.defineProperty;var fs=Object.getOwnPropertyDescriptor;var hs=Object.getOwnPropertyNames;var vs=Object.prototype.hasOwnProperty;var xs=(e,t)=>{for(var n in t)It(e,n,{get:t[n],enumerable:!0})},ys=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of hs(t))!vs.call(e,r)&&r!==n&&It(e,r,{get:()=>t[r],enumerable:!(s=fs(t,r))||s.enumerable});return e};var ws=e=>ys(It({},"__esModule",{value:!0}),e);var br={};xs(br,{BugStash:()=>ds,default:()=>pr});module.exports=ws(br);var Ie=[],rn=50,He=null,Re=null,Be=null,Ne=null;function nt(e){if(e.id)return`#${e.id}`;let t=e.tagName.toLowerCase(),n=e.className&&typeof e.className=="string"?"."+e.className.trim().split(/\s+/).slice(0,2).join("."):"",s=(e.textContent||"").trim().slice(0,30),r=s?` "${s}"`:"";return`${t}${n}${r}`}function _(e){Ie.push(e),Ie.length>rn&&Ie.shift()}function on(e){e&&(rn=e),He=n=>{let s=n.target;!s||!s.tagName||_({type:"click",category:"ui",message:`Clicked ${nt(s)}`,timestamp:Date.now(),data:{x:n.clientX,y:n.clientY,selector:nt(s)}})},document.addEventListener("click",He,!0);let t=new WeakMap;Re=n=>{let s=n.target;if(!s||!s.tagName)return;let r=s.tagName.toLowerCase();if(r!=="input"&&r!=="textarea"&&r!=="select")return;let a=t.get(s);a&&clearTimeout(a),t.set(s,window.setTimeout(()=>{let l=s instanceof HTMLInputElement&&s.type==="password";_({type:"input",category:"ui",message:`Input ${nt(s)}`,timestamp:Date.now(),data:{selector:nt(s),value:l?"[redacted]":void 0}})},300))},document.addEventListener("input",Re,!0),Be=()=>{_({type:"navigation",category:"navigation",message:`Navigated to ${window.location.pathname}`,timestamp:Date.now(),data:{url:window.location.href}})},window.addEventListener("popstate",Be),Ne=()=>{_({type:"navigation",category:"navigation",message:`Hash changed to ${window.location.hash}`,timestamp:Date.now(),data:{url:window.location.href}})},window.addEventListener("hashchange",Ne),_({type:"navigation",category:"navigation",message:`Page loaded: ${window.location.pathname}`,timestamp:Date.now(),data:{url:window.location.href}})}function he(){return[...Ie]}function an(){Ie=[]}function ln(){He&&document.removeEventListener("click",He,!0),Re&&document.removeEventListener("input",Re,!0),Be&&window.removeEventListener("popstate",Be),Ne&&window.removeEventListener("hashchange",Ne),He=null,Re=null,Be=null,Ne=null}var Ht="[REDACTED]",ks=[[/\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)+" "+Ht}],[/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)+' "'+Ht+'"'}]];function ve(e){let t=e;for(let[n,s]of ks)t=t.replace(n,s);return t}function cn(e){return e.map(ve)}function st(e){if(typeof e=="string")return ve(e);if(Array.isArray(e))return e.map(st);if(e&&typeof e=="object"){let t={};for(let[n,s]of Object.entries(e)){let r=n.toLowerCase();r.includes("password")||r.includes("secret")||r.includes("token")||r.includes("apikey")||r.includes("api_key")||r.includes("private")?t[n]=Ht:t[n]=st(s)}return t}return e}var rt={log:console.log,warn:console.warn,error:console.error,debug:console.debug,info:console.info},De=[],dn=50;function Es(e){return e.map(t=>{if(t instanceof Error)return`${t.name}: ${t.message}
|
|
2
2
|
${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{return String(t)}return String(t)})}function Ls(e,t){let n={level:e,args:cn(Es(t)),timestamp:Date.now()};e==="error"&&(n.stack=new Error().stack?.split(`
|
|
3
3
|
`).slice(2).join(`
|
|
4
|
-
`)),De.push(n),De.length>dn&&De.shift(),_({type:"console",category:`console.${e}`,message:n.args.join(" ").slice(0,200),timestamp:n.timestamp})}function pn(e){e&&(dn=e);for(let t of Object.keys(
|
|
4
|
+
`)),De.push(n),De.length>dn&&De.shift(),_({type:"console",category:`console.${e}`,message:n.args.join(" ").slice(0,200),timestamp:n.timestamp})}function pn(e){e&&(dn=e);for(let t of Object.keys(rt))console[t]=function(...n){Ls(t,n),rt[t].apply(console,n)}}function te(){return[...De]}function bn(){De=[]}function un(){for(let e of Object.keys(rt))console[e]=rt[e]}var xe=[],mn=50,ot,at,it;function Rt(e){xe.push(e),xe.length>mn&&xe.shift(),_({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 gn(e){try{let t=new URL(e,window.location.origin),n=new URLSearchParams(t.search);for(let r of n.keys()){let a=r.toLowerCase();(a.includes("token")||a.includes("key")||a.includes("secret")||a.includes("password")||a.includes("auth"))&&n.set(r,"[REDACTED]")}let s=n.toString();return t.pathname+(s?"?"+s:"")}catch{return ve(e)}}function Ss(){ot=window.fetch,window.fetch=async function(e,t){let n=t?.method?.toUpperCase()??"GET",s=typeof e=="string"?e:e instanceof URL?e.href:e.url,r=gn(s),a=Date.now();try{let l=await ot.call(window,e,t);return Rt({method:n,url:r,status:l.status,statusText:l.statusText,duration:Date.now()-a,responseType:l.headers.get("content-type")??void 0,timestamp:a,failed:l.status>=400}),l}catch(l){throw Rt({method:n,url:r,status:0,statusText:"Network Error",duration:Date.now()-a,timestamp:a,failed:!0}),l}}}function Cs(){at=XMLHttpRequest.prototype.open,it=XMLHttpRequest.prototype.send,XMLHttpRequest.prototype.open=function(e,t,...n){return this.__bs_method=e.toUpperCase(),this.__bs_url=gn(typeof t=="string"?t:t.href),at.apply(this,[e,t,...n])},XMLHttpRequest.prototype.send=function(e){let t=Date.now();return this.addEventListener("loadend",function(){Rt({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})}),it.call(this,e)}}function fn(e){e&&(mn=e),Ss(),Cs()}function ye(){return[...xe]}function ce(){return xe.filter(e=>e.failed)}function hn(){xe=[]}function vn(){ot&&(window.fetch=ot),at&&(XMLHttpRequest.prototype.open=at),it&&(XMLHttpRequest.prototype.send=it)}var lt=[],je=null,Oe=null;function xn(){je=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()};lt.push(t),_({type:"error",category:"exception",message:t.message,timestamp:t.timestamp,data:{source:t.source,lineno:t.lineno}})},Oe=e=>{let t=e.reason,n=t instanceof Error?t.message:typeof t=="string"?t:"Unhandled promise rejection",s={message:n,stack:t instanceof Error?t.stack:void 0,type:"unhandledrejection",timestamp:Date.now()};lt.push(s),_({type:"error",category:"promise",message:n,timestamp:s.timestamp})},window.addEventListener("error",je),window.addEventListener("unhandledrejection",Oe)}function ne(){return[...lt]}function yn(){lt=[]}function wn(){je&&window.removeEventListener("error",je),Oe&&window.removeEventListener("unhandledrejection",Oe),je=null,Oe=null}var $=null,ct=null,dt=null,pt=null;function kn(){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 n=performance.getEntriesByType("paint");for(let r of n)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 s=performance.memory;s&&$&&($.memoryUsage={usedJSHeapSize:s.usedJSHeapSize,totalJSHeapSize:s.totalJSHeapSize})};document.readyState==="complete"?setTimeout(e,0):window.addEventListener("load",()=>setTimeout(e,100))}if(typeof PerformanceObserver<"u"){try{ct=new PerformanceObserver(e=>{let t=e.getEntries(),n=t[t.length-1];n&&$&&($.largestContentfulPaint=Math.round(n.startTime))}),ct.observe({type:"largest-contentful-paint",buffered:!0})}catch{}try{let e=0;dt=new PerformanceObserver(t=>{for(let n of t.getEntries())n.hadRecentInput||(e+=n.value);$&&($.cumulativeLayoutShift=Math.round(e*1e3)/1e3)}),dt.observe({type:"layout-shift",buffered:!0})}catch{}try{pt=new PerformanceObserver(e=>{let[t]=e.getEntries();t&&$&&($.firstInputDelay=Math.round(t.processingStart-t.startTime))}),pt.observe({type:"first-input",buffered:!0})}catch{}}}function we(){return $&&($.timestamp=Date.now()),$?{...$}:null}function En(){ct?.disconnect(),dt?.disconnect(),pt?.disconnect(),ct=null,dt=null,pt=null,$=null}function Ts(){let e=document.createElement("div");if(e.style.cssText=`
|
|
5
5
|
position: fixed; inset: 0; z-index: 2147483647;
|
|
6
6
|
background: white; opacity: 0;
|
|
7
7
|
pointer-events: none;
|
|
@@ -12,13 +12,7 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
|
|
|
12
12
|
15% { opacity: 0.7; }
|
|
13
13
|
100% { opacity: 0; }
|
|
14
14
|
}
|
|
15
|
-
`,document.head.appendChild(t)}document.body.appendChild(e),e.addEventListener("animationend",()=>e.remove())}async function qe(){Ts();try{let e=await $s();if(e)return e}catch{}return null}async function $s(){let e=window.innerWidth,t=window.innerHeight,n=document.documentElement.cloneNode(!0),s=document.documentElement.querySelectorAll("*"),r=n.querySelectorAll("*");for(let
|
|
16
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${t}">
|
|
17
|
-
<foreignObject width="100%" height="100%">
|
|
18
|
-
${l}
|
|
19
|
-
</foreignObject>
|
|
20
|
-
</svg>
|
|
21
|
-
`,c=new Blob([d],{type:"image/svg+xml;charset=utf-8"}),v=URL.createObjectURL(c);return new Promise(b=>{let h=new Image;h.crossOrigin="anonymous",h.onload=()=>{let y=document.createElement("canvas");y.width=e*.5,y.height=t*.5;let M=y.getContext("2d");if(!M){URL.revokeObjectURL(v),b(null);return}M.scale(.5,.5),M.drawImage(h,0,0),URL.revokeObjectURL(v);try{b(y.toDataURL("image/jpeg",.6))}catch{b(null)}},h.onerror=()=>{URL.revokeObjectURL(v),b(null)},h.src=v})}var Ms="https://bugstash-backend.vercel.app",Ln="https://bugstash-backend.vercel.app",F=Ms,Bt=!1;function Sn(e){F=e.replace(/\/$/,""),Bt=!1}function Cn(){return F}async function V(e,t){try{return await fetch(e,t)}catch(n){if(Bt)throw n;Bt=!0;let s=F;F=Ln;let r=e.replace(s,Ln);return fetch(r,t)}}var Nt="bugstash_auth";function Dt(){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 Tn(e){localStorage.setItem(Nt,JSON.stringify(e))}function Ps(){localStorage.removeItem(Nt)}function Q(){return Dt()?.user||null}function $n(){return Dt()?.tokens.accessToken||null}async function ce(){let e=Dt();if(!e)return{"Content-Type":"application/json"};if(e.tokens.expiresAt<Date.now()+6e4)try{let t=await V(`${F}/api/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:e.tokens.refreshToken})});if(t.ok){let n=await t.json();n.success&&(e.tokens=n.data,Tn(e))}}catch{}return{"Content-Type":"application/json",Authorization:`Bearer ${e.tokens.accessToken}`}}async function dt(e,t,n){try{let r=await(await V(`${F}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e,password:t,projectId:n})})).json();return r.success&&Tn({user:r.data.user,tokens:r.data.tokens}),r}catch{return{success:!1,error:"Network error"}}}async function pt(){Ps()}async function jt(e){try{let t=await ce();return await(await V(`${F}/api/reports`,{method:"POST",headers:t,body:JSON.stringify(e)})).json()}catch{return{success:!1,error:"Network error - could not reach BugStash"}}}async function Mn(e,t){try{let n=await ce();return await(await V(`${F}/api/pins/by-page?projectId=${e}&pathname=${encodeURIComponent(t)}`,{headers:n})).json()}catch{return{success:!1,error:"Network error"}}}async function Ot(e){try{let t=await ce();return await(await V(`${F}/api/pins`,{method:"POST",headers:t,body:JSON.stringify(e)})).json()}catch{return{success:!1,error:"Network error"}}}async function bt(e,t){try{let n=await ce();return await(await V(`${F}/api/pins/${e}`,{method:"PUT",headers:n,body:JSON.stringify(t)})).json()}catch{return{success:!1,error:"Network error"}}}async function Pn(e){try{let t=await ce();return await(await V(`${F}/api/pins/${e}`,{method:"DELETE",headers:t})).json()}catch{return{success:!1,error:"Network error"}}}async function zn(e){try{let t=await ce();return await(await V(`${F}/api/pins/${e}/comments`,{headers:t})).json()}catch{return{success:!1,error:"Network error"}}}async function qt(e,t,n=[]){try{let s=await ce();return await(await V(`${F}/api/pins/${e}/comments`,{method:"POST",headers:s,body:JSON.stringify({body:t,mentions:n})})).json()}catch{return{success:!1,error:"Network error"}}}async function An(e){try{let t=await ce();return await(await V(`${F}/api/members/for-project/${e}`,{headers:t})).json()}catch{return{success:!1,error:"Network error"}}}var Ut="bugstash_offline_queue";function _t(e){let t=In();t.push({...e,id:Math.random().toString(36).slice(2),timestamp:Date.now()}),localStorage.setItem(Ut,JSON.stringify(t))}function In(){try{return JSON.parse(localStorage.getItem(Ut)||"[]")}catch{return[]}}async function zs(){let e=In();if(e.length===0)return 0;let t=0,n=[];for(let s of e)try{let r;switch(s.type){case"create_pin":r=await Ot(s.data);break;case"create_comment":r=await qt(s.data.pinId,s.data.body,s.data.mentions);break;case"update_pin":r=await bt(s.data.pinId,s.data.updates);break;case"submit_report":r=await jt(s.data);break;default:r={success:!1,error:"Unknown action"}}r.success?t++:n.push(s)}catch{n.push(s)}return localStorage.setItem(Ut,JSON.stringify(n)),t}typeof window<"u"&&window.addEventListener("online",()=>{zs().catch(()=>{})});var Ft=[{id:"slate",name:"Slate",preview:["#0f1117","#6E9ED0"],vars:{"--bs-bg":"#0f1117","--bs-bg2":"#1a1d27","--bs-bg3":"#2a2d37","--bs-text":"#e8eaed","--bs-muted":"#9ca3af","--bs-border":"#2a2d37","--bs-accent":"#6E9ED0","--bs-accent2":"#C3CAD6","--bs-fab1":"#6E9ED0","--bs-fab2":"#4a7ba8","--bs-radius":"12px","--bs-radius-sm":"8px","--bs-red":"#ef4444","--bs-green":"#22c55e","--bs-orange":"#f97316","--bs-yellow":"#eab308"}},{id:"black",name:"Dark",preview:["#0a0a0a","#ffffff"],vars:{"--bs-bg":"#0a0a0a","--bs-bg2":"#141414","--bs-bg3":"#1e1e1e","--bs-text":"#f5f5f5","--bs-muted":"#737373","--bs-border":"#262626","--bs-accent":"#f5f5f5","--bs-accent2":"#d4d4d4","--bs-fab1":"#262626","--bs-fab2":"#171717","--bs-radius":"12px","--bs-radius-sm":"8px","--bs-red":"#ef4444","--bs-green":"#22c55e","--bs-orange":"#f97316","--bs-yellow":"#eab308"}},{id:"white",name:"Light",preview:["#ffffff","#0a0a0a"],vars:{"--bs-bg":"#ffffff","--bs-bg2":"#f5f5f5","--bs-bg3":"#e5e5e5","--bs-text":"#0a0a0a","--bs-muted":"#737373","--bs-border":"#e5e5e5","--bs-accent":"#0a0a0a","--bs-accent2":"#404040","--bs-fab1":"#0a0a0a","--bs-fab2":"#262626","--bs-radius":"12px","--bs-radius-sm":"8px","--bs-red":"#dc2626","--bs-green":"#16a34a","--bs-orange":"#ea580c","--bs-yellow":"#ca8a04"}}];function ut(){return Ft}function mt(e){return Ft.find(t=>t.id===e)}function Hn(){return Ft[0]}var Wt=[{id:"classic",name:"Center",description:"Centered modal",tabPosition:"top"},{id:"drawer-right",name:"Right Drawer",description:"Slides from right",tabPosition:"top"},{id:"bottom-sheet",name:"Bottom Sheet",description:"Slides from bottom",tabPosition:"top"},{id:"sidebar-tabs",name:"Sidebar",description:"Side navigation",tabPosition:"left"}];function gt(){return Wt}function Ue(e){return Wt.find(t=>t.id===e)}function Rn(){return Wt[0]}var Bn=`
|
|
15
|
+
`,document.head.appendChild(t)}document.body.appendChild(e),e.addEventListener("animationend",()=>e.remove())}async function qe(){Ts();try{let e=await $s();if(e)return e}catch{}try{let e=await Ms();if(e)return e}catch{}try{let e=await Ps();if(e)return e}catch{}return null}async function $s(){let e=window.innerWidth,t=window.innerHeight,n=document.documentElement.cloneNode(!0),s=document.documentElement.querySelectorAll("*"),r=n.querySelectorAll("*");for(let p=0;p<s.length&&p<r.length;p++){let v=window.getComputedStyle(s[p]),w=r[p];if(w.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 ie of M)try{w.style.setProperty(ie,v.getPropertyValue(ie))}catch{}}}n.querySelectorAll('script, [data-bugstash], .bs-fab, .bs-toolbar, .bs-modal, .bs-backdrop, [id="bs-flash-style"]').forEach(p=>p.remove()),n.querySelectorAll("img").forEach(p=>{try{let v=p.getAttribute("src")||"";v&&!v.startsWith("data:")&&!v.startsWith(window.location.origin)&&(p.removeAttribute("src"),p.style.backgroundColor="#e5e7eb")}catch{}}),n.querySelectorAll("iframe").forEach(p=>p.remove()),n.querySelectorAll("canvas").forEach(p=>p.remove()),n.querySelectorAll("video, audio").forEach(p=>p.remove());let l=new XMLSerializer().serializeToString(n),d=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${t}"><foreignObject width="100%" height="100%">${l}</foreignObject></svg>`,c=new Blob([d],{type:"image/svg+xml;charset=utf-8"}),h=URL.createObjectURL(c);return new Promise(p=>{let v=new Image;v.crossOrigin="anonymous",v.onload=()=>{let w=document.createElement("canvas");w.width=e*.5,w.height=t*.5;let M=w.getContext("2d");if(!M){URL.revokeObjectURL(h),p(null);return}M.scale(.5,.5),M.drawImage(v,0,0),URL.revokeObjectURL(h);try{p(w.toDataURL("image/jpeg",.6))}catch{p(null)}},v.onerror=()=>{URL.revokeObjectURL(h),p(null)},v.src=h})}async function Ms(){let e=window;if(e.html2canvas||await new Promise((n,s)=>{let r=document.createElement("script");r.src="https://cdn.jsdelivr.net/npm/html2canvas@1.4.1/dist/html2canvas.min.js",r.onload=()=>n(),r.onerror=()=>s(new Error("Failed to load html2canvas")),document.head.appendChild(r)}),!e.html2canvas)return null;let t=await e.html2canvas(document.body,{scale:.5,useCORS:!0,allowTaint:!1,logging:!1,backgroundColor:null,ignoreElements:n=>n.classList?.contains("bs-fab")||n.classList?.contains("bs-toolbar")||n.classList?.contains("bs-modal")||n.classList?.contains("bs-backdrop")||n.id==="bs-flash-style"});try{return t.toDataURL("image/jpeg",.6)}catch{return null}}async function Ps(){let e=window.innerWidth,t=window.innerHeight,n=document.createElement("canvas");n.width=e*.5,n.height=t*.5;let s=n.getContext("2d");if(!s)return null;s.scale(.5,.5);let r=window.getComputedStyle(document.body).backgroundColor;s.fillStyle=r||"#ffffff",s.fillRect(0,0,e,t),s.fillStyle="#888888",s.font="14px sans-serif",s.fillText(`Screenshot of: ${document.title||window.location.href}`,20,30),s.fillText(`Viewport: ${e}x${t}`,20,54),s.fillText(`Time: ${new Date().toLocaleString()}`,20,78);let a=document.querySelectorAll('main, header, footer, section, article, nav, aside, .card, [class*="container"]');s.strokeStyle="rgba(128,128,128,0.3)",s.lineWidth=1,a.forEach(l=>{let d=l.getBoundingClientRect();d.width>10&&d.height>10&&s.strokeRect(d.left,d.top,d.width,d.height)});try{return n.toDataURL("image/jpeg",.6)}catch{return null}}var zs="https://bugstash-backend.vercel.app",Ln="https://bugstash-backend.vercel.app",W=zs,Bt=!1;function Sn(e){W=e.replace(/\/$/,""),Bt=!1}function Cn(){return W}async function Q(e,t){try{return await fetch(e,t)}catch(n){if(Bt)throw n;Bt=!0;let s=W;W=Ln;let r=e.replace(s,Ln);return fetch(r,t)}}var Nt="bugstash_auth";function Dt(){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 Tn(e){localStorage.setItem(Nt,JSON.stringify(e))}function As(){localStorage.removeItem(Nt)}function V(){return Dt()?.user||null}function $n(){return Dt()?.tokens.accessToken||null}async function de(){let e=Dt();if(!e)return{"Content-Type":"application/json"};if(e.tokens.expiresAt<Date.now()+6e4)try{let t=await Q(`${W}/api/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:e.tokens.refreshToken})});if(t.ok){let n=await t.json();n.success&&(e.tokens=n.data,Tn(e))}}catch{}return{"Content-Type":"application/json",Authorization:`Bearer ${e.tokens.accessToken}`}}async function bt(e,t,n){try{let r=await(await Q(`${W}/api/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e,password:t,projectId:n})})).json();return r.success&&Tn({user:r.data.user,tokens:r.data.tokens}),r}catch{return{success:!1,error:"Network error"}}}async function ut(){As()}async function jt(e){try{let t=await de();return await(await Q(`${W}/api/reports`,{method:"POST",headers:t,body:JSON.stringify(e)})).json()}catch{return{success:!1,error:"Network error - could not reach BugStash"}}}async function Mn(e,t){try{let n=await de();return await(await Q(`${W}/api/pins/by-page?projectId=${e}&pathname=${encodeURIComponent(t)}`,{headers:n})).json()}catch{return{success:!1,error:"Network error"}}}async function Ot(e){try{let t=await de();return await(await Q(`${W}/api/pins`,{method:"POST",headers:t,body:JSON.stringify(e)})).json()}catch{return{success:!1,error:"Network error"}}}async function mt(e,t){try{let n=await de();return await(await Q(`${W}/api/pins/${e}`,{method:"PUT",headers:n,body:JSON.stringify(t)})).json()}catch{return{success:!1,error:"Network error"}}}async function Pn(e){try{let t=await de();return await(await Q(`${W}/api/pins/${e}`,{method:"DELETE",headers:t})).json()}catch{return{success:!1,error:"Network error"}}}async function zn(e){try{let t=await de();return await(await Q(`${W}/api/pins/${e}/comments`,{headers:t})).json()}catch{return{success:!1,error:"Network error"}}}async function qt(e,t,n=[]){try{let s=await de();return await(await Q(`${W}/api/pins/${e}/comments`,{method:"POST",headers:s,body:JSON.stringify({body:t,mentions:n})})).json()}catch{return{success:!1,error:"Network error"}}}async function An(e){try{let t=await de();return await(await Q(`${W}/api/members/for-project/${e}`,{headers:t})).json()}catch{return{success:!1,error:"Network error"}}}var Ut="bugstash_offline_queue";function _t(e){let t=In();t.push({...e,id:Math.random().toString(36).slice(2),timestamp:Date.now()}),localStorage.setItem(Ut,JSON.stringify(t))}function In(){try{return JSON.parse(localStorage.getItem(Ut)||"[]")}catch{return[]}}async function Is(){let e=In();if(e.length===0)return 0;let t=0,n=[];for(let s of e)try{let r;switch(s.type){case"create_pin":r=await Ot(s.data);break;case"create_comment":r=await qt(s.data.pinId,s.data.body,s.data.mentions);break;case"update_pin":r=await mt(s.data.pinId,s.data.updates);break;case"submit_report":r=await jt(s.data);break;default:r={success:!1,error:"Unknown action"}}r.success?t++:n.push(s)}catch{n.push(s)}return localStorage.setItem(Ut,JSON.stringify(n)),t}typeof window<"u"&&window.addEventListener("online",()=>{Is().catch(()=>{})});var Wt=[{id:"slate",name:"Slate",preview:["#0f1117","#6E9ED0"],vars:{"--bs-bg":"#0f1117","--bs-bg2":"#1a1d27","--bs-bg3":"#2a2d37","--bs-text":"#e8eaed","--bs-muted":"#9ca3af","--bs-border":"#2a2d37","--bs-accent":"#6E9ED0","--bs-accent2":"#C3CAD6","--bs-fab1":"#6E9ED0","--bs-fab2":"#4a7ba8","--bs-radius":"12px","--bs-radius-sm":"8px","--bs-red":"#ef4444","--bs-green":"#22c55e","--bs-orange":"#f97316","--bs-yellow":"#eab308"}},{id:"black",name:"Dark",preview:["#0a0a0a","#ffffff"],vars:{"--bs-bg":"#0a0a0a","--bs-bg2":"#141414","--bs-bg3":"#1e1e1e","--bs-text":"#f5f5f5","--bs-muted":"#737373","--bs-border":"#262626","--bs-accent":"#f5f5f5","--bs-accent2":"#d4d4d4","--bs-fab1":"#262626","--bs-fab2":"#171717","--bs-radius":"12px","--bs-radius-sm":"8px","--bs-red":"#ef4444","--bs-green":"#22c55e","--bs-orange":"#f97316","--bs-yellow":"#eab308"}},{id:"white",name:"Light",preview:["#ffffff","#0a0a0a"],vars:{"--bs-bg":"#ffffff","--bs-bg2":"#f5f5f5","--bs-bg3":"#e5e5e5","--bs-text":"#0a0a0a","--bs-muted":"#737373","--bs-border":"#e5e5e5","--bs-accent":"#0a0a0a","--bs-accent2":"#404040","--bs-fab1":"#0a0a0a","--bs-fab2":"#262626","--bs-radius":"12px","--bs-radius-sm":"8px","--bs-red":"#dc2626","--bs-green":"#16a34a","--bs-orange":"#ea580c","--bs-yellow":"#ca8a04"}}];function gt(){return Wt}function ft(e){return Wt.find(t=>t.id===e)}function Hn(){return Wt[0]}var Ft=[{id:"classic",name:"Center",description:"Centered modal",tabPosition:"top"},{id:"drawer-right",name:"Right Drawer",description:"Slides from right",tabPosition:"top"},{id:"bottom-sheet",name:"Bottom Sheet",description:"Slides from bottom",tabPosition:"top"},{id:"sidebar-tabs",name:"Sidebar",description:"Side navigation",tabPosition:"left"}];function ht(){return Ft}function Ue(e){return Ft.find(t=>t.id===e)}function Rn(){return Ft[0]}var Bn=`
|
|
22
16
|
/* \u2500\u2500 1. Classic (default \u2014 no overrides) \u2500\u2500 */
|
|
23
17
|
|
|
24
18
|
/* \u2500\u2500 2. Drawer Right \u2500\u2500 */
|
|
@@ -78,67 +72,89 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
|
|
|
78
72
|
}
|
|
79
73
|
.bs-ly-sidebar-tabs .bs-tab-divider { display: none; }
|
|
80
74
|
.bs-ly-sidebar-tabs .bs-scroll { flex: 1; }
|
|
81
|
-
`;var Le=null,
|
|
75
|
+
`;var Le=null,vt=0,Hs=5e3,ke=new Map,Ee=null,xt=new Set;function _e(e){Ee=e,vt=Date.now(),Rs()}function Rs(){Le||(Le=setInterval(Bs,Hs))}async function Bs(){if(!Ee)return;let e=$n();if(e)try{let t=Cn(),n=window.location.pathname,s=await fetch(`${t}/api/pins/poll?projectId=${Ee}&pathname=${encodeURIComponent(n)}&since=${vt}`,{headers:{Authorization:`Bearer ${e}`}});if(!s.ok)return;let r=await s.json();if(!r.success)return;let{pins:a,serverTime:l}=r.data;vt=l;for(let d of a)xt.has(d.id)?Nn("pin:updated",{type:"pin:updated",projectId:Ee,data:d,userId:"",timestamp:Date.now()}):(xt.add(d.id),Nn("pin:created",{type:"pin:created",projectId:Ee,data:d,userId:"",timestamp:Date.now()}))}catch{}}function Dn(){Le&&(clearInterval(Le),Le=null),Ee=null,xt.clear(),vt=0}function We(e,t){return ke.has(e)||ke.set(e,new Set),ke.get(e).add(t),()=>{ke.get(e)?.delete(t)}}function Nn(e,t){ke.get(e)?.forEach(n=>n(t)),ke.get("*")?.forEach(n=>n(t))}function jn(e){xt=new Set(e)}function On(){return Le!==null}var yt,A=null,U=[],Wn=[],Se=!1,Fe=null,Ns="",qn={open:"#f97316",in_progress:"#3b82f6",resolved:"#22c55e",closed:"#6b7280"};function Ye(e){yt=e,Ns=window.location.pathname,Ds(),Yn(),js(),_s(),Ws()}function Fn(){A&&(A.remove(),A=null),U=[]}function Xe(e){return Se=e!==void 0?e:!Se,A&&A.classList.toggle("bs-pin-mode",Se),Se}function wt(){return Se}function Ds(){if(A)return;A=document.createElement("div"),A.id="bugstash-live-pins";let e=document.createElement("style");e.textContent=`
|
|
76
|
+
/* Container scrolls with page so pins stick to their position */
|
|
82
77
|
#bugstash-live-pins {
|
|
83
|
-
position:
|
|
84
|
-
|
|
78
|
+
position: absolute;
|
|
79
|
+
top: 0;
|
|
80
|
+
left: 0;
|
|
81
|
+
width: 100%;
|
|
82
|
+
min-height: 100%;
|
|
85
83
|
z-index: 2147483640;
|
|
86
84
|
pointer-events: none;
|
|
87
85
|
}
|
|
88
86
|
#bugstash-live-pins.bs-pin-mode {
|
|
89
87
|
pointer-events: auto;
|
|
90
88
|
cursor: crosshair;
|
|
89
|
+
position: fixed;
|
|
90
|
+
inset: 0;
|
|
91
|
+
width: auto;
|
|
92
|
+
min-height: auto;
|
|
91
93
|
}
|
|
94
|
+
|
|
95
|
+
/* \u2500\u2500 Pin Marker \u2014 clean numbered dot \u2500\u2500 */
|
|
92
96
|
.bs-lp {
|
|
93
97
|
position: absolute;
|
|
94
98
|
pointer-events: auto;
|
|
95
99
|
cursor: pointer;
|
|
96
|
-
|
|
100
|
+
transform: translate(-50%, -50%);
|
|
101
|
+
transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1);
|
|
102
|
+
z-index: 1;
|
|
97
103
|
}
|
|
98
|
-
.bs-lp:hover { transform: scale(1.
|
|
104
|
+
.bs-lp:hover { transform: translate(-50%, -50%) scale(1.2); z-index: 5; }
|
|
99
105
|
.bs-lp-dot {
|
|
100
|
-
width:
|
|
101
|
-
height:
|
|
102
|
-
border-radius: 50
|
|
103
|
-
transform: rotate(-45deg);
|
|
106
|
+
width: 24px;
|
|
107
|
+
height: 24px;
|
|
108
|
+
border-radius: 50%;
|
|
104
109
|
display: flex;
|
|
105
110
|
align-items: center;
|
|
106
111
|
justify-content: center;
|
|
107
|
-
box-shadow: 0 2px 8px rgba(0,0,0,0.3);
|
|
108
|
-
border: 2px solid #fff;
|
|
109
112
|
font-size: 11px;
|
|
110
|
-
font-weight:
|
|
113
|
+
font-weight: 800;
|
|
114
|
+
font-family: -apple-system, system-ui, sans-serif;
|
|
111
115
|
color: #fff;
|
|
116
|
+
box-shadow: 0 2px 12px rgba(0,0,0,0.35), 0 0 0 2px rgba(255,255,255,0.9);
|
|
117
|
+
position: relative;
|
|
112
118
|
}
|
|
113
|
-
.bs-lp-
|
|
114
|
-
|
|
115
|
-
|
|
119
|
+
.bs-lp-ring {
|
|
120
|
+
position: absolute;
|
|
121
|
+
inset: -4px;
|
|
122
|
+
border-radius: 50%;
|
|
123
|
+
border: 2px solid currentColor;
|
|
124
|
+
opacity: 0;
|
|
125
|
+
animation: bs-lp-pulse 2s ease-out infinite;
|
|
126
|
+
}
|
|
127
|
+
@keyframes bs-lp-pulse {
|
|
128
|
+
0% { opacity: 0.6; transform: scale(0.8); }
|
|
129
|
+
100% { opacity: 0; transform: scale(1.6); }
|
|
116
130
|
}
|
|
131
|
+
|
|
132
|
+
/* \u2500\u2500 Popup \u2500\u2500 */
|
|
117
133
|
.bs-lp-popup {
|
|
118
134
|
position: absolute;
|
|
119
|
-
left:
|
|
120
|
-
top: -
|
|
121
|
-
width:
|
|
122
|
-
background: #
|
|
123
|
-
border: 1px solid #
|
|
124
|
-
border-radius:
|
|
125
|
-
box-shadow: 0
|
|
135
|
+
left: 32px;
|
|
136
|
+
top: -12px;
|
|
137
|
+
width: 300px;
|
|
138
|
+
background: #111318;
|
|
139
|
+
border: 1px solid #2a2d37;
|
|
140
|
+
border-radius: 10px;
|
|
141
|
+
box-shadow: 0 12px 40px rgba(0,0,0,0.5);
|
|
126
142
|
z-index: 10;
|
|
127
143
|
pointer-events: auto;
|
|
128
144
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
129
|
-
color: #
|
|
145
|
+
color: #e8eaed;
|
|
130
146
|
overflow: hidden;
|
|
131
147
|
}
|
|
132
148
|
.bs-lp-popup-header {
|
|
133
|
-
padding: 12px
|
|
134
|
-
border-bottom: 1px solid #
|
|
149
|
+
padding: 10px 12px;
|
|
150
|
+
border-bottom: 1px solid #1e2028;
|
|
135
151
|
display: flex;
|
|
136
152
|
align-items: center;
|
|
137
153
|
justify-content: space-between;
|
|
138
|
-
gap:
|
|
154
|
+
gap: 6px;
|
|
139
155
|
}
|
|
140
156
|
.bs-lp-popup-title {
|
|
141
|
-
font-size:
|
|
157
|
+
font-size: 13px;
|
|
142
158
|
font-weight: 600;
|
|
143
159
|
flex: 1;
|
|
144
160
|
overflow: hidden;
|
|
@@ -146,173 +162,183 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
|
|
|
146
162
|
white-space: nowrap;
|
|
147
163
|
}
|
|
148
164
|
.bs-lp-popup-status {
|
|
149
|
-
font-size:
|
|
150
|
-
padding: 2px
|
|
165
|
+
font-size: 9px;
|
|
166
|
+
padding: 2px 7px;
|
|
151
167
|
border-radius: 4px;
|
|
152
|
-
font-weight:
|
|
168
|
+
font-weight: 700;
|
|
153
169
|
text-transform: uppercase;
|
|
170
|
+
letter-spacing: 0.3px;
|
|
154
171
|
}
|
|
155
172
|
.bs-lp-popup-body {
|
|
156
|
-
padding: 12px
|
|
157
|
-
font-size:
|
|
173
|
+
padding: 10px 12px;
|
|
174
|
+
font-size: 12px;
|
|
158
175
|
line-height: 1.5;
|
|
159
|
-
color: #
|
|
160
|
-
max-height:
|
|
176
|
+
color: #9ca3af;
|
|
177
|
+
max-height: 100px;
|
|
161
178
|
overflow-y: auto;
|
|
162
179
|
}
|
|
163
180
|
.bs-lp-popup-meta {
|
|
164
|
-
padding:
|
|
165
|
-
font-size:
|
|
166
|
-
color: #
|
|
167
|
-
border-top: 1px solid #
|
|
181
|
+
padding: 6px 12px;
|
|
182
|
+
font-size: 10px;
|
|
183
|
+
color: #6b7280;
|
|
184
|
+
border-top: 1px solid #1e2028;
|
|
168
185
|
display: flex;
|
|
169
186
|
justify-content: space-between;
|
|
170
187
|
}
|
|
171
188
|
.bs-lp-comments {
|
|
172
|
-
max-height:
|
|
189
|
+
max-height: 180px;
|
|
173
190
|
overflow-y: auto;
|
|
174
|
-
border-top: 1px solid #
|
|
191
|
+
border-top: 1px solid #1e2028;
|
|
175
192
|
}
|
|
176
193
|
.bs-lp-comment {
|
|
177
|
-
padding: 8px
|
|
178
|
-
border-bottom: 1px solid #
|
|
194
|
+
padding: 8px 12px;
|
|
195
|
+
border-bottom: 1px solid #1a1d24;
|
|
179
196
|
font-size: 12px;
|
|
180
197
|
}
|
|
181
198
|
.bs-lp-comment-author {
|
|
182
199
|
font-weight: 600;
|
|
183
|
-
color: #
|
|
200
|
+
color: #e8eaed;
|
|
184
201
|
margin-bottom: 2px;
|
|
202
|
+
font-size: 11px;
|
|
185
203
|
}
|
|
186
204
|
.bs-lp-comment-body {
|
|
187
|
-
color: #
|
|
205
|
+
color: #9ca3af;
|
|
188
206
|
line-height: 1.4;
|
|
189
207
|
}
|
|
190
208
|
.bs-lp-comment-time {
|
|
191
209
|
font-size: 10px;
|
|
192
|
-
color: #
|
|
210
|
+
color: #6b7280;
|
|
193
211
|
margin-top: 2px;
|
|
194
212
|
}
|
|
195
213
|
.bs-lp-input-row {
|
|
196
214
|
display: flex;
|
|
197
|
-
border-top: 1px solid #
|
|
215
|
+
border-top: 1px solid #2a2d37;
|
|
198
216
|
}
|
|
199
217
|
.bs-lp-input-row input {
|
|
200
218
|
flex: 1;
|
|
201
219
|
background: transparent;
|
|
202
220
|
border: none;
|
|
203
|
-
padding:
|
|
204
|
-
color: #
|
|
205
|
-
font-size:
|
|
221
|
+
padding: 8px 12px;
|
|
222
|
+
color: #e8eaed;
|
|
223
|
+
font-size: 12px;
|
|
206
224
|
outline: none;
|
|
207
225
|
}
|
|
208
|
-
.bs-lp-input-row input::placeholder { color: #
|
|
226
|
+
.bs-lp-input-row input::placeholder { color: #4b5563; }
|
|
209
227
|
.bs-lp-input-row button {
|
|
210
|
-
background:
|
|
228
|
+
background: #6E9ED0;
|
|
211
229
|
border: none;
|
|
212
230
|
color: #fff;
|
|
213
|
-
padding: 0
|
|
214
|
-
font-size:
|
|
231
|
+
padding: 0 14px;
|
|
232
|
+
font-size: 11px;
|
|
215
233
|
font-weight: 600;
|
|
216
234
|
cursor: pointer;
|
|
217
235
|
}
|
|
218
|
-
.bs-lp-input-row button:hover { opacity: 0.
|
|
236
|
+
.bs-lp-input-row button:hover { opacity: 0.85; }
|
|
219
237
|
.bs-lp-actions {
|
|
220
|
-
padding:
|
|
238
|
+
padding: 6px 12px;
|
|
221
239
|
display: flex;
|
|
222
|
-
gap:
|
|
223
|
-
border-top: 1px solid #
|
|
240
|
+
gap: 4px;
|
|
241
|
+
border-top: 1px solid #1e2028;
|
|
224
242
|
}
|
|
225
243
|
.bs-lp-btn {
|
|
226
244
|
padding: 4px 10px;
|
|
227
245
|
border-radius: 6px;
|
|
228
|
-
border: 1px solid #
|
|
229
|
-
background: #
|
|
230
|
-
color: #
|
|
231
|
-
font-size:
|
|
246
|
+
border: 1px solid #2a2d37;
|
|
247
|
+
background: #1a1d24;
|
|
248
|
+
color: #9ca3af;
|
|
249
|
+
font-size: 10px;
|
|
250
|
+
font-weight: 500;
|
|
232
251
|
cursor: pointer;
|
|
252
|
+
transition: all 0.15s;
|
|
233
253
|
}
|
|
234
|
-
.bs-lp-btn:hover { background: #
|
|
235
|
-
.bs-lp-btn.resolve { border-color: #
|
|
236
|
-
.bs-lp-btn.resolve:hover { background: #
|
|
237
|
-
.bs-lp-btn.delete { border-color: #
|
|
238
|
-
.bs-lp-btn.delete:hover { background: #
|
|
254
|
+
.bs-lp-btn:hover { background: #222630; color: #e8eaed; }
|
|
255
|
+
.bs-lp-btn.resolve { border-color: #22c55e33; color: #4ade80; }
|
|
256
|
+
.bs-lp-btn.resolve:hover { background: #22c55e18; }
|
|
257
|
+
.bs-lp-btn.delete { border-color: #ef444433; color: #f87171; }
|
|
258
|
+
.bs-lp-btn.delete:hover { background: #ef444418; }
|
|
239
259
|
.bs-lp-close {
|
|
240
260
|
background: none;
|
|
241
261
|
border: none;
|
|
242
|
-
color: #
|
|
243
|
-
font-size:
|
|
262
|
+
color: #6b7280;
|
|
263
|
+
font-size: 16px;
|
|
244
264
|
cursor: pointer;
|
|
245
|
-
padding: 0
|
|
265
|
+
padding: 0 2px;
|
|
246
266
|
line-height: 1;
|
|
267
|
+
transition: color 0.15s;
|
|
247
268
|
}
|
|
248
|
-
.bs-lp-close:hover { color: #
|
|
269
|
+
.bs-lp-close:hover { color: #e8eaed; }
|
|
249
270
|
|
|
250
|
-
/* New pin form */
|
|
271
|
+
/* \u2500\u2500 New pin form \u2500\u2500 */
|
|
251
272
|
.bs-lp-newform {
|
|
252
273
|
position: absolute;
|
|
253
|
-
width:
|
|
254
|
-
background: #
|
|
255
|
-
border: 1px solid #
|
|
256
|
-
border-radius:
|
|
257
|
-
box-shadow: 0
|
|
274
|
+
width: 300px;
|
|
275
|
+
background: #111318;
|
|
276
|
+
border: 1px solid #2a2d37;
|
|
277
|
+
border-radius: 10px;
|
|
278
|
+
box-shadow: 0 12px 40px rgba(0,0,0,0.5);
|
|
258
279
|
z-index: 2147483645;
|
|
259
280
|
pointer-events: auto;
|
|
260
281
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
261
|
-
color: #
|
|
262
|
-
padding:
|
|
282
|
+
color: #e8eaed;
|
|
283
|
+
padding: 12px;
|
|
263
284
|
}
|
|
264
285
|
.bs-lp-newform label {
|
|
265
286
|
display: block;
|
|
266
|
-
font-size:
|
|
267
|
-
color: #
|
|
287
|
+
font-size: 10px;
|
|
288
|
+
color: #6b7280;
|
|
268
289
|
margin-bottom: 4px;
|
|
269
|
-
margin-top:
|
|
290
|
+
margin-top: 8px;
|
|
270
291
|
font-weight: 600;
|
|
292
|
+
text-transform: uppercase;
|
|
293
|
+
letter-spacing: 0.3px;
|
|
271
294
|
}
|
|
272
295
|
.bs-lp-newform label:first-child { margin-top: 0; }
|
|
273
296
|
.bs-lp-newform input, .bs-lp-newform textarea, .bs-lp-newform select {
|
|
274
297
|
width: 100%;
|
|
275
|
-
background: #
|
|
276
|
-
border: 1px solid #
|
|
277
|
-
border-radius:
|
|
278
|
-
padding:
|
|
279
|
-
color: #
|
|
280
|
-
font-size:
|
|
298
|
+
background: #1a1d24;
|
|
299
|
+
border: 1px solid #2a2d37;
|
|
300
|
+
border-radius: 6px;
|
|
301
|
+
padding: 7px 10px;
|
|
302
|
+
color: #e8eaed;
|
|
303
|
+
font-size: 12px;
|
|
281
304
|
outline: none;
|
|
282
305
|
font-family: inherit;
|
|
283
306
|
box-sizing: border-box;
|
|
284
307
|
}
|
|
285
|
-
.bs-lp-newform textarea { resize: vertical; min-height:
|
|
308
|
+
.bs-lp-newform textarea { resize: vertical; min-height: 50px; }
|
|
286
309
|
.bs-lp-newform input:focus, .bs-lp-newform textarea:focus, .bs-lp-newform select:focus {
|
|
287
310
|
border-color: #6E9ED0;
|
|
288
311
|
}
|
|
289
312
|
.bs-lp-newform-actions {
|
|
290
313
|
display: flex;
|
|
291
|
-
gap:
|
|
292
|
-
margin-top:
|
|
314
|
+
gap: 6px;
|
|
315
|
+
margin-top: 10px;
|
|
293
316
|
}
|
|
294
317
|
.bs-lp-newform-actions button {
|
|
295
318
|
flex: 1;
|
|
296
|
-
padding:
|
|
297
|
-
border-radius:
|
|
319
|
+
padding: 7px;
|
|
320
|
+
border-radius: 6px;
|
|
298
321
|
border: none;
|
|
299
|
-
font-size:
|
|
322
|
+
font-size: 12px;
|
|
300
323
|
font-weight: 600;
|
|
301
324
|
cursor: pointer;
|
|
302
325
|
}
|
|
303
326
|
.bs-lp-newform-submit {
|
|
304
|
-
background:
|
|
327
|
+
background: #6E9ED0;
|
|
305
328
|
color: #fff;
|
|
306
329
|
}
|
|
330
|
+
.bs-lp-newform-submit:hover { opacity: 0.85; }
|
|
307
331
|
.bs-lp-newform-cancel {
|
|
308
|
-
background: #
|
|
309
|
-
color: #
|
|
332
|
+
background: #2a2d37;
|
|
333
|
+
color: #9ca3af;
|
|
310
334
|
}
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
335
|
+
.bs-lp-newform-cancel:hover { background: #333; }
|
|
336
|
+
`,A.appendChild(e),document.body.appendChild(A),A.addEventListener("click",t=>{if(!Se||t.target.closest(".bs-lp, .bs-lp-popup, .bs-lp-newform"))return;let n=t.clientX+window.scrollX,s=t.clientY+window.scrollY;A.style.pointerEvents="none";let r=document.elementFromPoint(t.clientX,t.clientY);A.style.pointerEvents="",Us(n,s,r)})}async function Yn(){let e=await Mn(yt,window.location.pathname);e.success&&e.data&&(U=e.data,jn(U.map(t=>t.id)),re())}async function js(){let e=await An(yt);e.success&&e.data&&(Wn=e.data)}function re(){A&&(A.querySelectorAll(".bs-lp").forEach(e=>e.remove()),U.forEach((e,t)=>{let n=document.createElement("div");n.className="bs-lp",n.style.left=`${e.pageX}px`,n.style.top=`${e.pageY}px`,n.dataset.pinId=e.id;let s=qn[e.status]||qn.open;n.innerHTML=`
|
|
337
|
+
<div class="bs-lp-dot" style="background:${s};color:${s}">
|
|
338
|
+
${t+1}
|
|
339
|
+
<span class="bs-lp-ring"></span>
|
|
314
340
|
</div>
|
|
315
|
-
`,n.addEventListener("click",r=>{r.stopPropagation(),
|
|
341
|
+
`,n.addEventListener("click",r=>{r.stopPropagation(),Os(e,n)}),A.appendChild(n)}))}function Un(e){let t=Date.now()-e,n=Math.floor(t/6e4);if(n<1)return"just now";if(n<60)return`${n}m ago`;let s=Math.floor(n/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`}function _n(e){return{open:"#f97316",in_progress:"#3b82f6",resolved:"#22c55e",closed:"#6b7280"}[e]||"#6b7280"}async function Os(e,t){ue();let n=document.createElement("div");n.className="bs-lp-popup";let s=await zn(e.id),r=s.success&&s.data?s.data:[],a=V(),l=a&&(a.role==="owner"||a.role==="admin"||a.id===e.createdBy);n.innerHTML=`
|
|
316
342
|
<div class="bs-lp-popup-header">
|
|
317
343
|
<div class="bs-lp-popup-title">${se(e.title)}</div>
|
|
318
344
|
<span class="bs-lp-popup-status" style="background:${_n(e.status)}22;color:${_n(e.status)}">${e.status.replace("_"," ")}</span>
|
|
@@ -340,13 +366,13 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
|
|
|
340
366
|
${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>'}
|
|
341
367
|
${l?'<button class="bs-lp-btn delete" id="bs-lp-delete">Delete</button>':""}
|
|
342
368
|
</div>
|
|
343
|
-
`,t.appendChild(n),Fe=n,n.querySelector(".bs-lp-close").addEventListener("click",c=>{c.stopPropagation(),ue()}),n.querySelector("#bs-lp-comment-send")?.addEventListener("click",async()=>{let c=n.querySelector("#bs-lp-comment-input"),
|
|
369
|
+
`,t.appendChild(n),Fe=n,n.querySelector(".bs-lp-close").addEventListener("click",c=>{c.stopPropagation(),ue()}),n.querySelector("#bs-lp-comment-send")?.addEventListener("click",async()=>{let c=n.querySelector("#bs-lp-comment-input"),h=c.value.trim();if(h)if(c.value="",navigator.onLine){let p=await qt(e.id,h);if(p.success&&p.data){let v=n.querySelector("#bs-lp-comments"),w=p.data;v.innerHTML+=`
|
|
344
370
|
<div class="bs-lp-comment">
|
|
345
|
-
<div class="bs-lp-comment-author">${se(
|
|
346
|
-
<div class="bs-lp-comment-body">${se(
|
|
371
|
+
<div class="bs-lp-comment-author">${se(w.authorName||a?.name||"You")}</div>
|
|
372
|
+
<div class="bs-lp-comment-body">${se(w.body)}</div>
|
|
347
373
|
<div class="bs-lp-comment-time">just now</div>
|
|
348
374
|
</div>
|
|
349
|
-
`,
|
|
375
|
+
`,v.scrollTop=v.scrollHeight}}else _t({type:"create_comment",data:{pinId:e.id,body:h}})}),n.querySelector("#bs-lp-comment-input")?.addEventListener("keydown",c=>{c.key==="Enter"&&n.querySelector("#bs-lp-comment-send")?.dispatchEvent(new Event("click"))}),n.querySelector("#bs-lp-resolve")?.addEventListener("click",async()=>{await mt(e.id,{status:"resolved"}),e.status="resolved",ue(),re()}),n.querySelector("#bs-lp-reopen")?.addEventListener("click",async()=>{await mt(e.id,{status:"open"}),e.status="open",ue(),re()}),n.querySelector("#bs-lp-delete")?.addEventListener("click",async()=>{confirm("Delete this pin?")&&(await Pn(e.id),U=U.filter(c=>c.id!==e.id),ue(),re())}),n.addEventListener("click",c=>c.stopPropagation())}function ue(){Fe?.remove(),Fe=null}function Xn(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 s=e.className.trim().split(/\s+/).filter(r=>!r.startsWith("bs-")).slice(0,3);s.length&&(t+="."+s.join("."))}let n=e.parentElement;if(n&&n!==document.body){let s=Array.from(n.children).filter(r=>r.tagName===e.tagName);if(s.length>1){let r=s.indexOf(e);t+=`:nth-child(${r+1})`}return Xn(n)+" > "+t}return t}function qs(e){if(!e)return"";let t=[],n=e;for(;n&&n!==document.body;){let s=1,r=n.previousElementSibling;for(;r;)r.tagName===n.tagName&&s++,r=r.previousElementSibling;t.unshift(`${n.tagName.toLowerCase()}[${s}]`),n=n.parentElement}return"/body/"+t.join("/")}function Us(e,t,n){ue(),A?.querySelectorAll(".bs-lp-newform").forEach(a=>a.remove());let s=document.createElement("div");s.className="bs-lp-newform",s.style.left=`${e+16}px`,s.style.top=`${t-8}px`,requestAnimationFrame(()=>{let a=s.getBoundingClientRect();a.right>window.innerWidth-16&&(s.style.left=`${e-336}px`),a.bottom>window.innerHeight-16&&(s.style.top=`${t-a.height}px`)});let r=Wn.filter(a=>a.userId!==V()?.id).map(a=>`<option value="${a.userId}">${se(a.name)}</option>`).join("");s.innerHTML=`
|
|
350
376
|
<label>Title *</label>
|
|
351
377
|
<input type="text" id="bs-np-title" placeholder="What's the issue?" autofocus />
|
|
352
378
|
<label>Description</label>
|
|
@@ -377,13 +403,13 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
|
|
|
377
403
|
<button class="bs-lp-newform-cancel" id="bs-np-cancel">Cancel</button>
|
|
378
404
|
<button class="bs-lp-newform-submit" id="bs-np-submit">Create Pin</button>
|
|
379
405
|
</div>
|
|
380
|
-
`,A.appendChild(s),s.addEventListener("click",a=>a.stopPropagation()),s.querySelector("#bs-np-cancel").addEventListener("click",()=>s.remove()),s.querySelector("#bs-np-submit").addEventListener("click",async()=>{let a=s.querySelector("#bs-np-title").value.trim();if(!a){s.querySelector("#bs-np-title").style.borderColor="#ef4444";return}let l=s.querySelector("#bs-np-desc").value.trim(),d=s.querySelector("#bs-np-priority").value,c=s.querySelector("#bs-np-category").value,
|
|
406
|
+
`,A.appendChild(s),s.addEventListener("click",a=>a.stopPropagation()),s.querySelector("#bs-np-cancel").addEventListener("click",()=>s.remove()),s.querySelector("#bs-np-submit").addEventListener("click",async()=>{let a=s.querySelector("#bs-np-title").value.trim();if(!a){s.querySelector("#bs-np-title").style.borderColor="#ef4444";return}let l=s.querySelector("#bs-np-desc").value.trim(),d=s.querySelector("#bs-np-priority").value,c=s.querySelector("#bs-np-category").value,p=s.querySelector("#bs-np-assignee")?.value||void 0,v=Xn(n),w=qs(n),M=te().slice(-20).map(k=>`[${k.level}] ${k.args.join(" ")}`),ie=ne().slice(-10).map(k=>`${k.message} at ${k.source}:${k.lineno}`),Me=ce().slice(-10).map(k=>`${k.method} ${k.url} \u2192 ${k.status}`),R;try{s.style.display="none",A.style.display="none",R=await qe()??void 0,A.style.display="",s.style.display=""}catch{}let P={projectId:yt,pageUrl:window.location.href,pathname:window.location.pathname,elementSelector:v,elementXPath:w,xPercent:0,yPercent:0,pageX:e,pageY:t,title:a,description:l,screenshot:R,priority:d,category:c,assigneeId:p,browserInfo:navigator.userAgent,screenSize:`${screen.width}x${screen.height}`,viewportSize:`${window.innerWidth}x${window.innerHeight}`,devicePixelRatio:window.devicePixelRatio,consoleLogs:M,networkErrors:Me,jsErrors:ie};if(s.remove(),navigator.onLine){let k=await Ot(P);k.success&&k.data&&(U.push(k.data),re())}else _t({type:"create_pin",data:P}),U.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(()=>s.querySelector("#bs-np-title")?.focus(),50)}function _s(){We("pin:created",e=>{let t=e.data;t.pathname===window.location.pathname&&(U.find(n=>n.id===t.id)||(U.push(t),re()))}),We("pin:updated",e=>{let t=e.data,n=U.findIndex(s=>s.id===t.id);n>=0&&(U[n]={...U[n],...t},re())}),We("pin:deleted",e=>{let{id:t}=e.data;U=U.filter(n=>n.id!==t),ue(),re()}),We("comment:created",e=>{let t=e.data;if(Fe){let n=Fe.querySelector("#bs-lp-comments");n&&(n.innerHTML+=`
|
|
381
407
|
<div class="bs-lp-comment">
|
|
382
408
|
<div class="bs-lp-comment-author">${se(t.author?.name||"Someone")}</div>
|
|
383
409
|
<div class="bs-lp-comment-body">${se(t.body)}</div>
|
|
384
410
|
<div class="bs-lp-comment-time">just now</div>
|
|
385
411
|
</div>
|
|
386
|
-
`,n.scrollTop=n.scrollHeight)}})}function
|
|
412
|
+
`,n.scrollTop=n.scrollHeight)}})}function Ws(){let e=window.location.pathname,t=()=>{window.location.pathname!==e&&(e=window.location.pathname,window.location.href,Yn())},n=history.pushState,s=history.replaceState;history.pushState=function(...r){n.apply(this,r),t()},history.replaceState=function(...r){s.apply(this,r),t()},window.addEventListener("popstate",t)}function se(e){let t=document.createElement("div");return t.textContent=e,t.innerHTML}var F,D=null,B=null,f=null,X=null,Je=null,Ke=null,J=!1,Et=!1,Ce="report";var pe=Hn(),me=Rn(),N={bug:'<svg width="28" height="28" viewBox="55 38 60 105" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M95.8 44h-29c-3 0-5.4 2.4-5.4 5.4v29c0 3 2.4 5.4 5.4 5.4h19.5c13 0 23.5-10.5 23.5-23.5v-2.8c0-7.5-6-13.5-13.5-13.5h-.5zm-6.2 28.2H74.8V57.4h14.8c5.8 0 10.4 4.7 10.4 10.4s-4.7 10.4-10.4 10.4z" fill="rgba(255,255,255,0.85)"/><path d="M100.4 96h-33.6c-3 0-5.4 2.4-5.4 5.4v33.6c0 3 2.4 5.4 5.4 5.4h22c15 0 27-12 27-27v-3.9c0-7.5-6-13.5-13.5-13.5h-1.9zm-7.8 32.2H74.8v-20h17.8c6.7 0 12.2 5.5 12.2 12.2 0 4.3-3.5 7.8-7.8 7.8h-4.6z" fill="rgba(255,255,255,1)"/></svg>',x:'<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>',cam:'<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"/><circle cx="12" cy="13" r="4"/></svg>',check:'<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round"><polyline points="20 6 9 17 4 12"/></svg>',report:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="16" y1="13" x2="8" y2="13"/><line x1="16" y1="17" x2="8" y2="17"/></svg>',console:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="4 17 10 11 4 5"/><line x1="12" y1="19" x2="20" y2="19"/></svg>',network:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/></svg>',ctx:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"/></svg>',settings:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="4" y1="21" x2="4" y2="14"/><line x1="4" y1="10" x2="4" y2="3"/><line x1="12" y1="21" x2="12" y2="12"/><line x1="12" y1="8" x2="12" y2="3"/><line x1="20" y1="21" x2="20" y2="16"/><line x1="20" y1="12" x2="20" y2="3"/><line x1="1" y1="14" x2="7" y2="14"/><line x1="9" y1="8" x2="15" y2="8"/><line x1="17" y1="16" x2="23" y2="16"/></svg>',history:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>',pin:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"/><circle cx="12" cy="10" r="3"/></svg>',sun:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="12" cy="12" r="5"/><line x1="12" y1="1" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="23"/><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/><line x1="1" y1="12" x2="3" y2="12"/><line x1="21" y1="12" x2="23" y2="12"/><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/></svg>',moon:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/></svg>',keyboard:'<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><rect x="2" y="4" width="20" height="16" rx="2"/><line x1="6" y1="8" x2="6" y2="8"/><line x1="10" y1="8" x2="10" y2="8"/><line x1="14" y1="8" x2="14" y2="8"/><line x1="18" y1="8" x2="18" y2="8"/><line x1="8" y1="12" x2="16" y2="12"/><line x1="6" y1="16" x2="18" y2="16"/></svg>'},Fs=`
|
|
387
413
|
@import url('https://fonts.googleapis.com/css2?family=Comfortaa:wght@400;600;700&family=Inter:wght@300;400;500;600;700&display=swap');
|
|
388
414
|
|
|
389
415
|
/* \u2500\u2500 FAB \u2500\u2500 */
|
|
@@ -978,13 +1004,6 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
|
|
|
978
1004
|
font-weight: 600;
|
|
979
1005
|
padding: 14px !important;
|
|
980
1006
|
}
|
|
981
|
-
.bs-report-row {
|
|
982
|
-
display: flex;
|
|
983
|
-
gap: 16px;
|
|
984
|
-
margin-bottom: 16px;
|
|
985
|
-
}
|
|
986
|
-
.bs-report-col { flex: 1; }
|
|
987
|
-
.bs-cat-icon { margin-right: 2px; }
|
|
988
1007
|
|
|
989
1008
|
.bs-auto-step-n {
|
|
990
1009
|
width: 20px;
|
|
@@ -1026,18 +1045,16 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
|
|
|
1026
1045
|
.bs-submit-btn:hover { box-shadow: 0 8px 28px rgba(0,0,0,0.3); transform: translateY(-1px); }
|
|
1027
1046
|
.bs-submit-btn:active { transform: translateY(0) scale(0.98); }
|
|
1028
1047
|
.bs-submit-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1048
|
+
.bs-submit-btn.bs-submit-ok {
|
|
1049
|
+
background: var(--bs-green) !important;
|
|
1050
|
+
opacity: 1 !important;
|
|
1051
|
+
display: flex; align-items: center; justify-content: center; gap: 6px;
|
|
1052
|
+
}
|
|
1053
|
+
.bs-submit-btn.bs-submit-err {
|
|
1054
|
+
background: var(--bs-red) !important;
|
|
1055
|
+
opacity: 1 !important;
|
|
1034
1056
|
font-size: 13px;
|
|
1035
|
-
font-weight: 600;
|
|
1036
|
-
margin-top: 12px;
|
|
1037
|
-
animation: bs-slideUp 0.3s ease;
|
|
1038
1057
|
}
|
|
1039
|
-
.bs-msg-ok { background: color-mix(in srgb, var(--bs-green) 10%, transparent); color: var(--bs-green); border: 1px solid color-mix(in srgb, var(--bs-green) 15%, transparent); }
|
|
1040
|
-
.bs-msg-err { background: color-mix(in srgb, var(--bs-red) 10%, transparent); color: var(--bs-red); border: 1px solid color-mix(in srgb, var(--bs-red) 15%, transparent); }
|
|
1041
1058
|
|
|
1042
1059
|
/* \u2500\u2500 Console \u2500\u2500 */
|
|
1043
1060
|
.bs-log {
|
|
@@ -1444,7 +1461,7 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
|
|
|
1444
1461
|
.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); }
|
|
1445
1462
|
.bs-set-ly-name { font-size: 12px; font-weight: 600; color: var(--bs-text); margin-bottom: 2px; }
|
|
1446
1463
|
.bs-set-ly-desc { font-size: 10px; color: var(--bs-muted); }
|
|
1447
|
-
`;function
|
|
1464
|
+
`;function Ys(){return`
|
|
1448
1465
|
<div class="bs-login-form">
|
|
1449
1466
|
<div class="bs-login-logo">BugStash</div>
|
|
1450
1467
|
<div class="bs-login-subtitle">Sign in to report bugs & collaborate</div>
|
|
@@ -1454,7 +1471,7 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
|
|
|
1454
1471
|
<button class="bs-login-btn" id="bs-login-submit">Sign In</button>
|
|
1455
1472
|
<div style="font-size:11px;color:var(--bs-muted);margin-top:4px">Contact your admin for an account</div>
|
|
1456
1473
|
</div>
|
|
1457
|
-
`}function I(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function
|
|
1474
|
+
`}function I(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Xs(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 Kn(e){return new Date(e).toLocaleTimeString("en",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}var Vn="bugstash_history";function Te(){try{return JSON.parse(localStorage.getItem(Vn)||"[]")}catch{return[]}}function Xt(e){try{localStorage.setItem(Vn,JSON.stringify(e))}catch{}}function Js(e){let t=Te(),n=Date.now();t.unshift({...e,id:n}),t.length>50&&(t.length=50),Xt(t)}function Ks(e){let t=Te().filter(n=>n.id!==e);Xt(t)}function Vs(e,t){let n=Te(),s=n.findIndex(r=>r.id===e);s>=0&&(n[s]={...n[s],...t},Xt(n))}function Qn(){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:F.environment??"development",commitHash:F.commitHash,user:F.user}}function Zn(){let e=ne(),t=te(),n=ye(),s=ce(),r=he(),a=we(),l=t.filter(h=>h.level==="error"),d="low";e.length>=3||s.length>=3?d="critical":e.length>=1||s.length>=2?d="high":(l.length>0||s.length>=1)&&(d="medium");let c=[];return e.length&&c.push("has-errors"),s.length&&c.push("network-failures"),l.length&&c.push("console-errors"),a?.pageLoadTime&&a.pageLoadTime>3e3&&c.push("slow-load"),a?.cumulativeLayoutShift&&a.cumulativeLayoutShift>.25&&c.push("layout-shift"),navigator.onLine||c.push("offline"),window.innerWidth<768&&c.push("mobile"),{severity:d,tags:c,counts:{logs:t.length,network:n.length,failedNet:s.length,errors:e.length,crumbs:r.length}}}function Gn(){let e=Zn(),t=[{id:"ui",label:"UI"},{id:"functionality",label:"Feature"},{id:"performance",label:"Speed"},{id:"crash",label:"Crash"},{id:"security",label:"Security"},{id:"other",label:"Other"}],n=e.counts.errors>0||e.counts.failedNet>0;return`<div class="bs-view">
|
|
1458
1475
|
<form data-bs-form>
|
|
1459
1476
|
<div class="bs-report-summary${n?" bs-alert":e.counts.logs>0?" bs-has":""}">
|
|
1460
1477
|
<div class="bs-report-summary-left">
|
|
@@ -1467,23 +1484,21 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
|
|
|
1467
1484
|
<div class="bs-field">
|
|
1468
1485
|
<textarea class="bs-textarea" name="description" placeholder="Steps to reproduce or extra details (optional)"></textarea>
|
|
1469
1486
|
</div>
|
|
1470
|
-
<div class="bs-
|
|
1471
|
-
<div class="bs-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
${t.map(r=>`<button type="button" class="bs-cat-btn${r.id==="functionality"?" bs-picked":""}" data-cat="${r.id}"><span class="bs-cat-icon">${r.icon}</span>${r.label}</button>`).join("")}
|
|
1476
|
-
</div>
|
|
1487
|
+
<div class="bs-field">
|
|
1488
|
+
<div class="bs-field-label">Category</div>
|
|
1489
|
+
<input type="hidden" name="category" value="functionality" />
|
|
1490
|
+
<div class="bs-cat-row">
|
|
1491
|
+
${t.map(r=>`<button type="button" class="bs-cat-btn${r.id==="functionality"?" bs-picked":""}" data-cat="${r.id}">${r.label}</button>`).join("")}
|
|
1477
1492
|
</div>
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
</
|
|
1493
|
+
</div>
|
|
1494
|
+
<div class="bs-field">
|
|
1495
|
+
<div class="bs-field-label">Severity</div>
|
|
1496
|
+
<input type="hidden" name="severity" value="${e.severity}" />
|
|
1497
|
+
<div class="bs-sev-row">
|
|
1498
|
+
<button type="button" class="bs-sev-btn bs-sev-low${e.severity==="low"?" bs-picked":""}" data-sev="low">Low</button>
|
|
1499
|
+
<button type="button" class="bs-sev-btn bs-sev-medium${e.severity==="medium"?" bs-picked":""}" data-sev="medium">Med</button>
|
|
1500
|
+
<button type="button" class="bs-sev-btn bs-sev-high${e.severity==="high"?" bs-picked":""}" data-sev="high">High</button>
|
|
1501
|
+
<button type="button" class="bs-sev-btn bs-sev-critical${e.severity==="critical"?" bs-picked":""}" data-sev="critical">Critical</button>
|
|
1487
1502
|
</div>
|
|
1488
1503
|
</div>
|
|
1489
1504
|
<div class="bs-shot-area" data-bs-screenshot>
|
|
@@ -1495,17 +1510,16 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
|
|
|
1495
1510
|
</div>
|
|
1496
1511
|
<div data-bs-annotate></div>
|
|
1497
1512
|
<button type="submit" class="bs-submit-btn">Submit Report</button>
|
|
1498
|
-
<div data-bs-msg></div>
|
|
1499
1513
|
</form>
|
|
1500
|
-
</div>`}function
|
|
1514
|
+
</div>`}function Qs(){let e=te(),t={error:"bs-le",warn:"bs-lw",log:"bs-ll",info:"bs-li",debug:"bs-ld"};return e.length?`<div class="bs-view">${e.slice().reverse().map(n=>`<div class="bs-log"><span class="bs-log-lv ${t[n.level]||"bs-ll"}">${n.level}</span><span class="bs-log-m">${I(n.args.join(" ")).slice(0,500)}</span><span class="bs-log-t">${Kn(n.timestamp)}</span></div>`).join("")}</div>`:'<div class="bs-view"><div class="bs-empty"><p>No console logs captured yet.<br>Use the app \u2014 logs will appear here automatically.</p></div></div>'}function Zs(){let e=ye();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 Gs(){let e='<div class="bs-view">',t=ne();t.length&&(e+=`<div class="bs-sec">Errors <span class="bs-sec-n">${t.length}</span></div>`,e+=t.slice().reverse().map(a=>`<div class="bs-err-card"><div class="bs-err-m">${I(a.message)}</div>${a.stack?`<div class="bs-err-stack">${I(a.stack)}</div>`:""}<div class="bs-err-meta">${a.type} · ${Kn(a.timestamp)}${a.source?` · ${I(a.source)}:${a.lineno}`:""}</div></div>`).join(""));let n=we();if(n){e+='<div class="bs-sec">Performance</div>';let a=[["Page Load",n.pageLoadTime,5e3],["DOM Ready",n.domContentLoaded,3e3],["First Paint",n.firstPaint,2e3],["FCP",n.firstContentfulPaint,2500],["LCP",n.largestContentfulPaint,4e3],["FID",n.firstInputDelay,300]];for(let[l,d,c]of a){if(d===void 0)continue;let h=Math.min(100,d/c*100);e+=`<div class="bs-pf"><span class="bs-pf-l">${l}</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">${d}ms</span></div>`}if(n.cumulativeLayoutShift!==void 0){let l=Math.min(100,n.cumulativeLayoutShift*400);e+=`<div class="bs-pf"><span class="bs-pf-l">CLS</span><div class="bs-pf-tr"><div class="bs-pf-fl${l>40?" bs-slow":""}" style="width:${l}%"></div></div><span class="bs-pf-v">${n.cumulativeLayoutShift}</span></div>`}}let s=he();s.length&&(e+=`<div class="bs-sec">Your activity trail <span class="bs-sec-n">${s.length}</span></div>`,e+=s.slice().reverse().map(a=>`<div class="bs-bc"><span class="bs-bc-t bs-t-${a.type}">${a.type}</span><span class="bs-bc-m">${I(a.message).slice(0,120)}</span><span class="bs-bc-time">${Xs(a.timestamp)}</span></div>`).join(""));let r=Qn();return e+='<div class="bs-sec">Environment</div>',e+=`<div class="bs-kv">
|
|
1501
1515
|
<span class="bs-kv-k">URL</span><span class="bs-kv-v">${I(r.url)}</span>
|
|
1502
1516
|
<span class="bs-kv-k">Viewport</span><span class="bs-kv-v">${r.viewportWidth}×${r.viewportHeight} @${r.devicePixelRatio}x</span>
|
|
1503
1517
|
<span class="bs-kv-k">Screen</span><span class="bs-kv-v">${r.screenWidth}×${r.screenHeight}</span>
|
|
1504
1518
|
<span class="bs-kv-k">Platform</span><span class="bs-kv-v">${I(r.platform)}</span>
|
|
1505
1519
|
<span class="bs-kv-k">Language</span><span class="bs-kv-v">${r.language}</span>
|
|
1506
|
-
${
|
|
1507
|
-
${
|
|
1508
|
-
</div>`,e+="</div>",e}function
|
|
1520
|
+
${F.commitHash?`<span class="bs-kv-k">Commit</span><span class="bs-kv-v">${I(F.commitHash)}</span>`:""}
|
|
1521
|
+
${F.user?.email?`<span class="bs-kv-k">User</span><span class="bs-kv-v">${I(F.user.email)}</span>`:""}
|
|
1522
|
+
</div>`,e+="</div>",e}function er(){let e=Te();if(!e.length)return'<div class="bs-view"><div class="bs-empty"><p>No reports yet.<br>Submitted bugs will appear here.</p></div></div>';let t={ui:"UI",functionality:"Feature",performance:"Perf",crash:"Crash",security:"Security",other:"Other"},n=r=>{let a=new Date(r),d=new Date().getTime()-a.getTime(),c=Math.floor(d/6e4);if(c<1)return"Just now";if(c<60)return`${c}m ago`;let h=Math.floor(c/60);if(h<24)return`${h}h ago`;let p=Math.floor(h/24);return p<7?`${p}d ago`:a.toLocaleDateString("en",{month:"short",day:"numeric"})},s='<div class="bs-view">';for(let r of e){let a=r.pins?.length?`<div class="bs-hist-pins">${r.pins.slice(0,5).map(l=>`<div class="bs-hist-pin-dot" style="background:${["#ef4444","#3b82f6","#f59e0b","#10b981","#8b5cf6"][l.number%5]}">${l.number}</div>`).join("")}${r.pins.length>5?`<span>+${r.pins.length-5}</span>`:""}</div>`:"";s+=`<div class="bs-hist-card" data-hist-id="${r.id}">
|
|
1509
1523
|
<div class="bs-hist-top">
|
|
1510
1524
|
<div class="bs-hist-title">${I(r.title)}</div>
|
|
1511
1525
|
${r.screenshot?`<img class="bs-hist-thumb" src="${r.screenshot}" alt=""/>`:""}
|
|
@@ -1524,12 +1538,12 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
|
|
|
1524
1538
|
<span>${n(r.createdAt)} · ${I(r.url.replace(/^https?:\/\//,"").slice(0,40))}</span>
|
|
1525
1539
|
${a}
|
|
1526
1540
|
</div>
|
|
1527
|
-
</div>`}return s+="</div>",s}function
|
|
1541
|
+
</div>`}return s+="</div>",s}function tr(){let e=gt(),t=ht(),n='<div class="bs-view">';n+='<div class="bs-set-sec">Layout</div>',n+='<div class="bs-set-ly-grid">';for(let s of t)n+=`<button class="bs-set-ly${s.id===me.id?" bs-picked":""}" data-set-layout="${s.id}"><div class="bs-set-ly-name">${I(s.name)}</div><div class="bs-set-ly-desc">${I(s.description)}</div></button>`;n+="</div>",n+='<div class="bs-set-sec">Theme</div>',n+='<div class="bs-set-grid">';for(let s of e)n+=`<button class="bs-set-card${s.id===pe.id?" bs-picked":""}" data-set-theme="${s.id}"><div class="bs-set-preview" style="background:${s.preview[0]}"><div class="bs-set-dot" style="background:${s.preview[1]}"></div><div class="bs-set-dot" style="background:${s.vars["--bs-accent2"]||s.preview[1]};opacity:0.6"></div></div><div class="bs-set-name">${I(s.name)}</div></button>`;return n+="</div>",n+="</div>",n}function nr(e,t){let n=["#f87171","#3b82f6","#fb923c","#4ade80","#a78bfa","#facc15"],s=n[0],r="draw",a=4,l=1,d=!1,c=[],h=[],p=-1,v=-1,w=!1,M=!1,ie=0,Me=0,R=0,P=0,k=[],Kt=["#ef4444","#3b82f6","#f59e0b","#10b981","#8b5cf6","#ec4899"],le=new Image;le.src=t;let Pe=document.createElement("div");Pe.className="bs-ann-wrap";let ze=document.createElement("div");ze.className="bs-ann-viewport";let y=document.createElement("canvas");y.className="bs-ann-canvas bs-draw";let G=document.createElement("div");G.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>'},ps={select:"Select & Move",draw:"Draw",arrow:"Arrow",rect:"Rectangle",circle:"Circle",text:"Text",highlight:"Highlight",pin:"Pin Issue"},Pt=[],bs=o=>{r=o,p=-1,y.className=`bs-ann-canvas bs-${o}`,Pt.forEach(m=>m.classList.remove("bs-sel")),Pt.find(m=>m.dataset.tool===o)?.classList.add("bs-sel")};Object.keys(Vt).forEach(o=>{let m=document.createElement("button");m.type="button",m.dataset.tool=o,m.className=`bs-ann-btn${o===r?" bs-sel":""}`,m.title=ps[o],m.innerHTML=Vt[o],m.addEventListener("click",()=>bs(o)),Pt.push(m),G.appendChild(m)}),G.appendChild(Object.assign(document.createElement("div"),{className:"bs-ann-sep"})),n.forEach((o,m)=>{let g=document.createElement("button");g.type="button",g.className=`bs-ann-dot${m===0?" bs-sel":""}`,g.style.background=o,g.addEventListener("click",()=>{s=o,G.querySelectorAll(".bs-ann-dot").forEach(C=>C.classList.remove("bs-sel")),g.classList.add("bs-sel")}),G.appendChild(g)}),G.appendChild(Object.assign(document.createElement("div"),{className:"bs-ann-sep"}));let ee=document.createElement("input");ee.type="range",ee.min="1",ee.max="12",ee.value="4",ee.className="bs-ann-size",ee.title="Brush size",ee.addEventListener("input",()=>{a=parseInt(ee.value)}),G.appendChild(ee);let Qe=document.createElement("div");Qe.className="bs-ann-right";let Ze=(o,m)=>{let g=document.createElement("button");return g.type="button",g.className="bs-ann-btn",g.title=o,g.innerHTML=m,g},Qt=Ze("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%"}),Gt=Ze("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>'),en=Ze("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>'),tn=Ze("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>'),nn=Object.assign(document.createElement("button"),{type:"button",className:"bs-ann-clr-btn",textContent:"Clear"}),zt=()=>{y.style.transform=`scale(${l})`,Zt.textContent=`${Math.round(l*100)}%`};Gt.addEventListener("click",()=>{l<3&&(l=Math.min(3,l+.25),zt())}),Qt.addEventListener("click",()=>{l>.5&&(l=Math.max(.5,l-.25),zt())}),en.addEventListener("click",()=>{l=1,zt()}),Qe.appendChild(Object.assign(document.createElement("div"),{className:"bs-ann-sep"})),[Qt,Zt,Gt,en,tn,nn].forEach(o=>Qe.appendChild(o)),G.appendChild(Qe);let Ge=document.createElement("div");Ge.className="bs-ann-pins";let fe=document.createElement("div");fe.className="bs-ann-pin-list",fe.style.display="none",ze.appendChild(y),ze.appendChild(Ge),Pe.appendChild(ze),Pe.appendChild(G),Pe.appendChild(fe),e.innerHTML="",e.appendChild(Pe);let et=()=>{Ge.innerHTML="",fe.innerHTML="",fe.style.display=h.length?"":"none",h.forEach((o,m)=>{let g=document.createElement("div");g.className="bs-ann-pin",g.style.background=o.color,g.style.color=o.color;let C=o.x/(y.width||1)*100,u=o.y/(y.height||1)*100;g.style.left=`${C}%`,g.style.top=`${u}%`,g.innerHTML=`<span class="bs-ann-pin-n">${m+1}</span><span class="bs-ann-pin-pulse"></span>`,g.title=`#${m+1}: ${o.note}`;let T=!1;g.addEventListener("mousedown",z=>{z.stopPropagation(),T=!0,g.classList.add("bs-dragging");let b=L=>{if(!T)return;let S=ze.getBoundingClientRect();o.x=(L.clientX-S.left)/S.width*y.width,o.y=(L.clientY-S.top)/S.height*y.height,g.style.left=`${(L.clientX-S.left)/S.width*100}%`,g.style.top=`${(L.clientY-S.top)/S.height*100}%`},x=()=>{T=!1,g.classList.remove("bs-dragging"),document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",x),et()};document.addEventListener("mousemove",b),document.addEventListener("mouseup",x)}),Ge.appendChild(g);let j=document.createElement("div");j.className="bs-ann-pin-item",j.innerHTML=`
|
|
1528
1542
|
<div class="bs-ann-pin-num" style="background:${o.color}">${m+1}</div>
|
|
1529
1543
|
<div class="bs-ann-pin-body">
|
|
1530
1544
|
<div class="bs-ann-pin-note">${I(o.note)}</div>
|
|
1531
1545
|
<div class="bs-ann-pin-loc">${Math.round(C)}% \xD7 ${Math.round(u)}%</div>
|
|
1532
|
-
</div>`;let q=document.createElement("button");q.type="button",q.className="bs-ann-pin-del",q.innerHTML="×",q.title="Remove pin",q.addEventListener("click",()=>{
|
|
1546
|
+
</div>`;let q=document.createElement("button");q.type="button",q.className="bs-ann-pin-del",q.innerHTML="×",q.title="Remove pin",q.addEventListener("click",()=>{h.splice(m,1),et()}),j.appendChild(q),fe.appendChild(j)})},i,At=()=>d?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.35)",be=(o,m)=>{i.save(),i.strokeStyle=At(),i.lineWidth=m+3,i.lineCap="round",i.lineJoin="round",i.globalAlpha=.5,o(),i.restore()},us=(o,m=!1)=>{if(o.type==="draw"||o.type==="highlight"){if(o.points.length<2)return;let u=o.type==="highlight"?.25:1,T=o.type==="highlight"?o.size*4+10:o.size,j=()=>{i.beginPath(),i.moveTo(o.points[0].x,o.points[0].y);for(let q=1;q<o.points.length;q++)i.lineTo(o.points[q].x,o.points[q].y);i.stroke()};o.type!=="highlight"&&be(j,T),i.strokeStyle=o.color,i.lineWidth=T,i.lineCap="round",i.lineJoin="round",i.globalAlpha=u,j(),i.globalAlpha=1}else if(o.type==="rect"){let u=()=>i.strokeRect(o.x,o.y,o.w,o.h);be(u,o.size),i.strokeStyle=o.color,i.lineWidth=o.size,i.lineCap="round",i.lineJoin="round",u()}else if(o.type==="circle"){let u=()=>{i.beginPath(),i.ellipse(o.cx,o.cy,Math.abs(o.rx),Math.abs(o.ry),0,0,Math.PI*2),i.stroke()};be(u,o.size),i.strokeStyle=o.color,i.lineWidth=o.size,u()}else if(o.type==="arrow"){let u=Math.atan2(o.y2-o.y1,o.x2-o.x1),T=12+o.size*2,j=()=>{i.beginPath(),i.moveTo(o.x1,o.y1),i.lineTo(o.x2,o.y2),i.stroke(),i.beginPath(),i.moveTo(o.x2,o.y2),i.lineTo(o.x2-T*Math.cos(u-.45),o.y2-T*Math.sin(u-.45)),i.moveTo(o.x2,o.y2),i.lineTo(o.x2-T*Math.cos(u+.45),o.y2-T*Math.sin(u+.45)),i.stroke()};be(j,o.size),i.strokeStyle=o.color,i.lineWidth=o.size,i.lineCap="round",i.lineJoin="round",j()}else if(o.type==="text"){let u=o.size*5+12;i.font=`bold ${u}px Inter, -apple-system, sans-serif`,i.fillStyle=At(),i.globalAlpha=.6,i.fillText(o.text,o.x+1,o.y+1),i.globalAlpha=1,i.fillStyle=o.color,i.fillText(o.text,o.x,o.y)}let g=!m&&p>=0&&c[p]===o,C=!m&&!g&&v>=0&&c[v]===o;if(g||C){let u=Ae(o);if(i.save(),i.setLineDash([6,4]),i.strokeStyle=d?"#fff":"#000",i.lineWidth=g?1.5:1,i.globalAlpha=g?.7:.45,i.strokeRect(u.x-4,u.y-4,u.w+8,u.h+8),o.type==="rect"||o.type==="circle"){i.setLineDash([]),i.globalAlpha=g?.9:.6;let j=o.type==="rect"?[[u.x,u.y],[u.x+u.w,u.y],[u.x,u.y+u.h],[u.x+u.w,u.y+u.h]]:[[u.x+u.w/2,u.y],[u.x+u.w,u.y+u.h/2],[u.x+u.w/2,u.y+u.h],[u.x,u.y+u.h/2]];for(let[q,z]of j)i.fillStyle="#fff",i.fillRect(q-5,z-5,10,10),i.strokeStyle=d?"#aaa":"#333",i.lineWidth=1.2,i.strokeRect(q-5,z-5,10,10)}i.restore()}},O=()=>{i.clearRect(0,0,y.width,y.height),i.drawImage(le,0,0);for(let o of c)us(o)},Ae=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),j=Math.min(o.y1,o.y2);return{x:T,y:j,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 m=1/0,g=1/0,C=-1/0,u=-1/0;for(let T of o.points)m=Math.min(m,T.x),g=Math.min(g,T.y),C=Math.max(C,T.x),u=Math.max(u,T.y);return{x:m,y:g,w:C-m||10,h:u-g||10}},tt=(o,m)=>{for(let g=c.length-1;g>=0;g--){let C=Ae(c[g]),u=8;if(o>=C.x-u&&o<=C.x+C.w+u&&m>=C.y-u&&m<=C.y+C.h+u)return g}return-1},ms=(o,m,g)=>{if(o.type==="draw"||o.type==="highlight")for(let C of o.points)C.x+=m,C.y+=g;else o.type==="rect"?(o.x+=m,o.y+=g):o.type==="circle"?(o.cx+=m,o.cy+=g):o.type==="arrow"?(o.x1+=m,o.y1+=g,o.x2+=m,o.y2+=g):o.type==="text"&&(o.x+=m,o.y+=g)};le.onload=()=>{let m=(e.clientWidth||450)/le.width;y.width=le.width,y.height=le.height,y.style.height=`${le.height*m}px`,i=y.getContext("2d"),i.drawImage(le,0,0);let g=[[10,10],[y.width-10,10],[10,y.height-10],[y.width-10,y.height-10],[y.width/2,y.height/2]],C=0;for(let[z,b]of g){let x=i.getImageData(z,b,1,1).data;C+=(x[0]*299+x[1]*587+x[2]*114)/1e3}d=C/g.length<128;let u=z=>{let b=y.getBoundingClientRect();return{x:(z.clientX-b.left)*(y.width/b.width),y:(z.clientY-b.top)*(y.height/b.height)}},T=!1;y.addEventListener("mousedown",z=>{let b=u(z);if(r==="select"){let x=tt(b.x,b.y);if(x>=0){p=x,w=!0;let L=Ae(c[x]);ie=b.x-L.x,Me=b.y-L.y,y.classList.add("bs-grabbing"),y.classList.remove("bs-grab"),O()}else p=-1,O();return}if(r!=="pin"&&r!=="text"){let x=tt(b.x,b.y);if(x>=0){p=x,w=!0,T=!0;let L=Ae(c[x]);ie=b.x-L.x,Me=b.y-L.y,y.classList.add("bs-grabbing"),O();return}}if(M=!0,R=b.x,P=b.y,r==="pin"){M=!1;let x=prompt("Describe the issue at this spot:");if(x){let L=Kt[h.length%Kt.length];h.push({x:b.x,y:b.y,note:x,color:L}),et()}return}if(r==="text"){M=!1;let x=prompt("Enter text:");x&&(c.push({type:"text",color:s,size:a,x:b.x,y:b.y,text:x}),O());return}(r==="draw"||r==="highlight")&&(k=[{x:b.x,y:b.y}])}),y.addEventListener("mousemove",z=>{let b=u(z);if(w&&p>=0){let x=Ae(c[p]),L=b.x-ie-x.x,S=b.y-Me-x.y;ms(c[p],L,S),O();return}if(r==="select"){let x=tt(b.x,b.y);y.classList.toggle("bs-grab",x>=0),v!==x&&(v=x,O());return}if(r!=="pin"&&r!=="text"&&!M){let x=tt(b.x,b.y);y.classList.toggle("bs-grab",x>=0),v!==x&&(v=x,O())}if(M){if(r==="draw"||r==="highlight"){k.push({x:b.x,y:b.y}),O();let x=r==="highlight"?.25:1,L=r==="highlight"?a*4+10:a;if(r!=="highlight"){i.save(),i.strokeStyle=At(),i.lineWidth=L+3,i.lineCap="round",i.lineJoin="round",i.globalAlpha=.5,i.beginPath(),i.moveTo(k[0].x,k[0].y);for(let S=1;S<k.length;S++)i.lineTo(k[S].x,k[S].y);i.stroke(),i.restore()}i.strokeStyle=s,i.lineWidth=L,i.lineCap="round",i.lineJoin="round",i.globalAlpha=x,i.beginPath(),i.moveTo(k[0].x,k[0].y);for(let S=1;S<k.length;S++)i.lineTo(k[S].x,k[S].y);i.stroke(),i.globalAlpha=1}else if(O(),i.strokeStyle=s,i.lineWidth=a,i.lineCap="round",i.lineJoin="round",r==="rect")be(()=>i.strokeRect(R,P,b.x-R,b.y-P),a),i.strokeStyle=s,i.lineWidth=a,i.strokeRect(R,P,b.x-R,b.y-P);else if(r==="circle"){let x=Math.abs(b.x-R)/2,L=Math.abs(b.y-P)/2,S=R+(b.x-R)/2,sn=P+(b.y-P)/2;be(()=>{i.beginPath(),i.ellipse(S,sn,x,L,0,0,Math.PI*2),i.stroke()},a),i.strokeStyle=s,i.lineWidth=a,i.beginPath(),i.ellipse(S,sn,x,L,0,0,Math.PI*2),i.stroke()}else if(r==="arrow"){let x=Math.atan2(b.y-P,b.x-R),L=12+a*2,S=()=>{i.beginPath(),i.moveTo(R,P),i.lineTo(b.x,b.y),i.stroke(),i.beginPath(),i.moveTo(b.x,b.y),i.lineTo(b.x-L*Math.cos(x-.45),b.y-L*Math.sin(x-.45)),i.moveTo(b.x,b.y),i.lineTo(b.x-L*Math.cos(x+.45),b.y-L*Math.sin(x+.45)),i.stroke()};be(S,a),i.strokeStyle=s,i.lineWidth=a,i.lineCap="round",i.lineJoin="round",S()}}});let j=z=>{if(w)return w=!1,T=!1,p=-1,y.classList.remove("bs-grabbing"),y.classList.remove("bs-grab"),O(),void 0;if(!M)return;M=!1;let b=u(z);if(r==="draw"||r==="highlight")k.length>1&&c.push({type:r,color:s,size:a,alpha:r==="highlight"?.25:1,points:[...k]}),k=[];else if(r==="rect")c.push({type:"rect",color:s,size:a,x:R,y:P,w:b.x-R,h:b.y-P});else if(r==="circle"){let x=Math.abs(b.x-R)/2,L=Math.abs(b.y-P)/2;c.push({type:"circle",color:s,size:a,cx:R+(b.x-R)/2,cy:P+(b.y-P)/2,rx:x,ry:L})}else r==="arrow"&&c.push({type:"arrow",color:s,size:a,x1:R,y1:P,x2:b.x,y2:b.y});O()};y.addEventListener("mouseup",j),y.addEventListener("mouseleave",z=>{w?(w=!1,T=!1,y.classList.remove("bs-grabbing"),y.classList.remove("bs-grab"),O()):M&&j(z)});let q=z=>{p>=0&&(z.key==="Delete"||z.key==="Backspace")&&(c.splice(p,1),p=-1,O())};document.addEventListener("keydown",q),tn.addEventListener("click",()=>{c.length&&(c.pop(),p=-1,O())}),nn.addEventListener("click",()=>{c.length=0,h.length=0,p=-1,O(),et()})};let gs=()=>{for(let o=0;o<h.length;o++){let m=h[o],g=16;i.beginPath(),i.arc(m.x,m.y-g,g,0,Math.PI*2),i.fillStyle=m.color,i.fill(),i.strokeStyle="#fff",i.lineWidth=2,i.stroke(),i.beginPath(),i.moveTo(m.x-8,m.y-6),i.lineTo(m.x,m.y+4),i.lineTo(m.x+8,m.y-6),i.fillStyle=m.color,i.fill(),i.fillStyle="#fff",i.font="bold 14px Inter, sans-serif",i.textAlign="center",i.textBaseline="middle",i.fillText(`${o+1}`,m.x,m.y-g),i.textAlign="start",i.textBaseline="alphabetic"}};return{getAnnotation:()=>{try{return p=-1,O(),gs(),y.toDataURL("image/jpeg",.7)}catch{return null}},getPins:()=>h.map((o,m)=>({number:m+1,x:Math.round(o.x),y:Math.round(o.y),note:o.note}))}}function kt(e){if(!f)return;Ce=e,f.querySelectorAll(".bs-tab").forEach(s=>{s.classList.toggle("bs-active",s.dataset.tab===e)});let t=f.querySelector(".bs-scroll"),n={report:Gn,console:Qs,network:Zs,context:Gs,history:er,settings:tr};t.innerHTML=n[e](),t.scrollTop=0,es()}function es(){if(!f)return;if(Ce==="history"){f.querySelectorAll("[data-hist-del]").forEach(n=>{n.addEventListener("click",()=>{let s=parseInt(n.dataset.histDel),r=f.querySelector(`[data-hist-id="${s}"]`);if(!r)return;let a=r.querySelector(".bs-hist-confirm");if(a){a.remove();return}let l=document.createElement("div");l.className="bs-hist-confirm",l.innerHTML="<span>Delete this report?</span>";let d=document.createElement("button");d.type="button",d.className="bs-hist-confirm-yes",d.textContent="Delete";let c=document.createElement("button");c.type="button",c.className="bs-hist-confirm-no",c.textContent="Cancel",d.addEventListener("click",()=>{Ks(s),kt("history")}),c.addEventListener("click",()=>l.remove()),l.appendChild(d),l.appendChild(c),r.appendChild(l)})}),f.querySelectorAll("[data-hist-edit]").forEach(n=>{n.addEventListener("click",()=>{let s=parseInt(n.dataset.histEdit),r=f.querySelector(`[data-hist-id="${s}"]`);if(!r)return;let a=r.querySelector(".bs-hist-edit-wrap");if(a){a.remove();return}r.querySelector(".bs-hist-confirm")?.remove();let l=Te().find(w=>w.id===s);if(!l)return;let d=document.createElement("div");d.className="bs-hist-edit-wrap",d.innerHTML=`
|
|
1533
1547
|
<div class="bs-field" style="margin-bottom:8px">
|
|
1534
1548
|
<input class="bs-input" data-edit-title value="${I(l.title)}" />
|
|
1535
1549
|
</div>
|
|
@@ -1544,7 +1558,7 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
|
|
|
1544
1558
|
<button type="button" class="bs-sev-btn bs-sev-critical${l.severity==="critical"?" bs-picked":""}" data-edit-sev="critical">Critical</button>
|
|
1545
1559
|
</div>
|
|
1546
1560
|
</div>
|
|
1547
|
-
<div class="bs-hist-edit-row"></div>`;let c=l.severity;r.appendChild(d),d.querySelectorAll("[data-edit-sev]").forEach(
|
|
1561
|
+
<div class="bs-hist-edit-row"></div>`;let c=l.severity;r.appendChild(d),d.querySelectorAll("[data-edit-sev]").forEach(w=>{w.addEventListener("click",()=>{c=w.dataset.editSev,d.querySelectorAll(".bs-sev-btn").forEach(M=>M.classList.remove("bs-picked")),w.classList.add("bs-picked")})});let h=d.querySelector(".bs-hist-edit-row"),p=document.createElement("button");p.type="button",p.className="bs-hist-save",p.textContent="Save";let v=document.createElement("button");v.type="button",v.className="bs-hist-cancel",v.textContent="Cancel",p.addEventListener("click",()=>{let w=d.querySelector("[data-edit-title]").value.trim(),M=d.querySelector("[data-edit-desc]").value.trim();w&&(Vs(s,{title:w,description:M,severity:c}),kt("history"))}),v.addEventListener("click",()=>d.remove()),h.appendChild(p),h.appendChild(v)})});return}if(Ce==="settings"){f.querySelectorAll("[data-set-theme]").forEach(n=>{n.addEventListener("click",()=>{let s=n.dataset.setTheme;Lt(s),f.querySelectorAll("[data-set-theme]").forEach(r=>r.classList.remove("bs-picked")),n.classList.add("bs-picked")})}),f.querySelectorAll("[data-set-layout]").forEach(n=>{n.addEventListener("click",()=>{let s=n.dataset.setLayout,r=Ue(s);r&&(me=r,K(),setTimeout(()=>{Ce="settings",oe(),setTimeout(()=>kt("settings"),50)},400))})});return}if(Ce!=="report")return;f.querySelectorAll(".bs-cat-btn").forEach(n=>{n.addEventListener("click",()=>{let s=n.dataset.cat;f.querySelector('input[name="category"]').value=s,f.querySelectorAll(".bs-cat-btn").forEach(r=>r.classList.remove("bs-picked")),n.classList.add("bs-picked")})}),f.querySelectorAll(".bs-sev-btn").forEach(n=>{n.addEventListener("click",()=>{let s=n.dataset.sev;f.querySelector('input[name="severity"]').value=s,f.querySelectorAll(".bs-sev-btn").forEach(r=>r.classList.remove("bs-picked")),n.classList.add("bs-picked")})});let e=null,t=null;f.querySelector("[data-bs-screenshot]")?.addEventListener("click",async()=>{let n=f?.querySelector("[data-bs-shot-title]"),s=f?.querySelector("[data-bs-shot-sub]"),r=f?.querySelector("[data-bs-screenshot]");if(n&&(n.textContent="Capturing..."),f&&(f.style.visibility="hidden"),X&&(X.style.visibility="hidden"),await new Promise(a=>setTimeout(a,200)),e=await qe(),f&&(f.style.visibility=""),X&&(X.style.visibility=""),e){n&&(n.textContent="Screenshot captured!"),s&&(s.textContent="Draw on the image below to highlight the issue"),r?.classList.add("bs-captured");let a=f?.querySelector("[data-bs-annotate]");a&&(t=nr(a,e))}else n&&(n.textContent="Screenshot unavailable"),s&&(s.textContent="Could not capture screenshot on this page")}),f.querySelector("[data-bs-form]")?.addEventListener("submit",async n=>{n.preventDefault();let s=n.target,r=s.querySelector(".bs-submit-btn"),a=s.elements.namedItem("title").value.trim(),l=s.elements.namedItem("description").value.trim(),d=s.elements.namedItem("severity").value,c=s.elements.namedItem("category").value;if(!a)return;r.disabled=!0,r.textContent="Sending...";let h=Zn(),p={projectId:F.projectId,title:a,description:l,category:c,severity:d,tags:h.tags.length?h.tags:void 0,context:Qn(),consoleLogs:te(),errors:ne(),networkCaptures:ce(),breadcrumbs:he(),performance:we()??void 0,screenshot:e??void 0,annotation:t?.getAnnotation()??void 0,pins:t?.getPins().length?t.getPins():void 0,createdAt:Date.now()},v=await jt(p);Js({title:p.title,description:p.description,category:p.category,severity:p.severity,tags:p.tags,screenshot:p.screenshot,pins:p.pins,url:window.location.href,createdAt:p.createdAt,status:v.success?"sent":"draft"}),v.success?(r.innerHTML=`${N.check} Bug reported!`,r.classList.add("bs-submit-ok"),setTimeout(K,1200)):(r.textContent=v.error??"Failed \u2014 saved as draft",r.classList.add("bs-submit-err"),setTimeout(()=>{r.disabled=!1,r.textContent="Submit Report",r.classList.remove("bs-submit-err")},2500))})}function oe(){if(J)return;J=!0,Ce="report",Yt(),X=document.createElement("div"),X.className="bs-backdrop",document.body.appendChild(X);let e=ce().length,t=ne().length;f=document.createElement("div"),f.className=`bs-modal bs-ly-${me.id}`,ge(f);let n=`
|
|
1548
1562
|
<div class="bs-tabs">
|
|
1549
1563
|
<button class="bs-tab bs-active" data-tab="report">${N.report} Report</button>
|
|
1550
1564
|
<button class="bs-tab" data-tab="console">${N.console} Console <span class="bs-tab-badge">${te().length}</span></button>
|
|
@@ -1552,7 +1566,7 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
|
|
|
1552
1566
|
<button class="bs-tab" data-tab="context">${N.ctx} Context ${t?`<span class="bs-tab-badge bs-warn">${t}</span>`:""}</button>
|
|
1553
1567
|
<button class="bs-tab" data-tab="history">${N.history} History <span class="bs-tab-badge">${Te().length}</span></button>
|
|
1554
1568
|
<button class="bs-tab" data-tab="settings" style="margin-left:auto">${N.settings}</button>
|
|
1555
|
-
</div>`,s=
|
|
1569
|
+
</div>`,s=V(),r=s?s.name.split(" ").map(v=>v[0]).join("").toUpperCase().slice(0,2):"",a=wt(),l=s?`
|
|
1556
1570
|
<div class="bs-hdr">
|
|
1557
1571
|
<div class="bs-logo">BugStash</div>
|
|
1558
1572
|
<div class="bs-hdr-right">
|
|
@@ -1570,24 +1584,24 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
|
|
|
1570
1584
|
</div>`:`
|
|
1571
1585
|
<div class="bs-hdr" style="justify-content:flex-end">
|
|
1572
1586
|
<button class="bs-close-btn" data-bs-close title="Close">${N.x}</button>
|
|
1573
|
-
</div>`,d=me.tabPosition==="left",c=me.tabPosition==="bottom",
|
|
1587
|
+
</div>`,d=me.tabPosition==="left",c=me.tabPosition==="bottom",h=s?Gn():Ys();d?f.innerHTML=`
|
|
1574
1588
|
${l}
|
|
1575
1589
|
<div class="bs-body-wrap">
|
|
1576
1590
|
${s?n:""}
|
|
1577
|
-
<div class="bs-scroll">${
|
|
1591
|
+
<div class="bs-scroll">${h}</div>
|
|
1578
1592
|
</div>`:c?f.innerHTML=`
|
|
1579
1593
|
${l}
|
|
1580
|
-
<div class="bs-scroll">${
|
|
1594
|
+
<div class="bs-scroll">${h}</div>
|
|
1581
1595
|
${s?`<div class="bs-tab-divider"></div>${n}`:""}`:f.innerHTML=`
|
|
1582
1596
|
${l}
|
|
1583
1597
|
${s?`${n}<div class="bs-tab-divider"></div>`:""}
|
|
1584
|
-
<div class="bs-scroll">${
|
|
1598
|
+
<div class="bs-scroll">${h}</div>`,document.body.appendChild(f),D&&D.classList.add("bs-open"),requestAnimationFrame(()=>{X?.classList.add("bs-in"),f?.classList.add("bs-in")}),f.querySelectorAll(".bs-tab").forEach(v=>{v.addEventListener("click",()=>kt(v.dataset.tab))}),f.querySelector("[data-bs-close]")?.addEventListener("click",K),X.addEventListener("click",K),f.querySelector("[data-bs-pin-toggle]")?.addEventListener("click",()=>{let v=Xe(),w=f?.querySelector("[data-bs-pin-toggle]");w&&(w.classList.toggle("active",v),w.innerHTML=`
|
|
1585
1599
|
<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>
|
|
1586
|
-
Pins ${
|
|
1587
|
-
`)}),f.querySelector("[data-bs-logout]")?.addEventListener("click",()=>{
|
|
1600
|
+
Pins ${v?"ON":"OFF"}
|
|
1601
|
+
`)}),f.querySelector("[data-bs-logout]")?.addEventListener("click",()=>{ut(),K(),setTimeout(()=>oe(),300)}),s?es():sr();let p=v=>{v.key==="Escape"&&(K(),document.removeEventListener("keydown",p))};document.addEventListener("keydown",p)}function sr(){if(!f)return;let e=f.querySelector("#bs-login-submit"),t=f.querySelector("#bs-login-email"),n=f.querySelector("#bs-login-pass"),s=f.querySelector("#bs-login-error");if(!e||!t||!n)return;let r=async()=>{let a=t.value.trim(),l=n.value;if(!a||!l){s.textContent="Please enter email and password",s.style.display="block";return}e.setAttribute("disabled","true"),e.textContent="Signing in...",s.style.display="none";let d=await bt(a,l,F.projectId);d.success?(Ye(F.projectId),_e(F.projectId),K(),setTimeout(()=>oe(),300)):(s.textContent=d.error||"Invalid credentials",s.style.display="block",e.removeAttribute("disabled"),e.textContent="Sign In")};e.addEventListener("click",r),n.addEventListener("keydown",a=>{a.key==="Enter"&&r()}),t.addEventListener("keydown",a=>{a.key==="Enter"&&n.focus()}),setTimeout(()=>t.focus(),100)}function K(){J&&(D&&D.classList.remove("bs-open"),f&&(f.classList.remove("bs-in"),f.classList.add("bs-out")),X&&X.classList.remove("bs-in"),setTimeout(()=>{f?.remove(),X?.remove(),f=null,X=null,J=!1},350))}function ge(e){for(let[t,n]of Object.entries(pe.vars))e.style.setProperty(t,n)}function Lt(e){let t=ft(e);t&&(pe=t,f&&ge(f),D&&ge(D),B&&ge(B))}function ts(){return pe.id}function ns(e){let t=Ue(e);t&&(me=t,J&&(K(),setTimeout(oe,400)))}function ss(){return me.id}function rs(e){F=e,Je=document.createElement("style"),Je.textContent=Fs+Bn,document.head.appendChild(Je);let t=e.panelPosition==="bottom-left"?"left":"right";D=document.createElement("button"),D.className="bs-fab",ge(D),D.innerHTML=`${N.bug}<span class="bs-fab-label">Report a bug</span>`,D.style[t]="24px",D.addEventListener("click",()=>J?K():oe()),document.body.appendChild(D),B=document.createElement("div"),B.className="bs-toolbar",B.style[t]="32px",ge(B);let s=navigator.platform.toUpperCase().includes("MAC")?"\u2318":"Ctrl",r=[{icon:N.cam,tip:"Screenshot",kbd:`${s}+Shift+S`,action:async()=>{let a=await qe();a&&(J||oe(),setTimeout(()=>{let l=f?.querySelector("[data-bs-screenshot]");if(l){l.__screenshot=a,l.classList.add("bs-captured");let d=l.querySelector("[data-bs-shot-title]"),c=l.querySelector("[data-bs-shot-sub]");d&&(d.textContent="Screenshot captured!"),c&&(c.textContent="Click to retake or annotate"),l.click()}},400))}},{icon:N.pin,tip:"Toggle Pins",kbd:`${s}+Shift+P`,id:"bs-tb-pin",action:()=>{if(!V()){J||oe();return}document.getElementById("bugstash-live-pins")||(Ye(F.projectId),_e(F.projectId));let l=Xe(),d=B?.querySelector("#bs-tb-pin");d&&d.classList.toggle("bs-active",l);let c=f?.querySelector("[data-bs-pin-toggle]");c&&(c.classList.toggle("active",l),c.innerHTML=`
|
|
1588
1602
|
<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>
|
|
1589
|
-
Pins ${
|
|
1590
|
-
`)}},{icon:
|
|
1603
|
+
Pins ${l?"ON":"OFF"}
|
|
1604
|
+
`)}},{icon:pe.id==="black"?N.sun:N.moon,tip:"Toggle Theme",kbd:`${s}+Shift+T`,id:"bs-tb-theme",action:()=>{let a=pe.id==="black"?"white":"black";Lt(a),B&&ge(B);let l=B?.querySelector("#bs-tb-theme");l&&(l.innerHTML=`${pe.id==="black"?N.sun:N.moon}<span class="bs-toolbar-tip">${pe.id==="black"?"Light":"Dark"} Mode<span class="bs-toolbar-kbd">${s}+Shift+T</span></span>`)}},{icon:N.report,tip:"Open Panel",kbd:`${s}+Shift+B`,action:()=>{J?K():oe()}}];for(let a of r){let l=document.createElement("button");l.className="bs-toolbar-btn",a.id&&(l.id=a.id),l.innerHTML=`${a.icon}<span class="bs-toolbar-tip">${a.tip}<span class="bs-toolbar-kbd">${a.kbd}</span></span>`,l.addEventListener("click",d=>{d.stopPropagation(),a.action()}),B.appendChild(l)}document.body.appendChild(B),D.addEventListener("mouseenter",()=>{J||Jn()}),D.addEventListener("mouseleave",a=>{let l=a.relatedTarget;B?.contains(l)||Yt()}),B.addEventListener("mouseenter",()=>Jn()),B.addEventListener("mouseleave",a=>{let l=a.relatedTarget;D?.contains(l)||Yt()}),Ke=a=>{(a.ctrlKey||a.metaKey)&&a.shiftKey&&(a.key==="B"||a.key==="b"?(a.preventDefault(),J?K():oe()):a.key==="S"||a.key==="s"?(a.preventDefault(),r[0].action()):a.key==="P"||a.key==="p"?(a.preventDefault(),r[1].action()):(a.key==="T"||a.key==="t")&&(a.preventDefault(),r[2].action()))},document.addEventListener("keydown",Ke)}function Jn(){Et||J||(Et=!0,B?.classList.add("bs-show"))}function Yt(){Et=!1,B?.classList.remove("bs-show")}function os(){K(),D?.remove(),D=null,B?.remove(),B=null,Et=!1,Je?.remove(),Je=null,Ke&&document.removeEventListener("keydown",Ke),Ke=null}var Z=null,H=null,E=null,ae=null,St="freehand",Ct="#ef4444",rr=3,$e=[],Y=null,Ve=!1,Tt=null,or=[{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"}],ar=["#ef4444","#f97316","#eab308","#22c55e","#3b82f6","#8b5cf6","#ffffff","#000000"];function ls(e){return new Promise(t=>{Tt=t,$e=[],Y=null,St="freehand",Ct="#ef4444",ir(e)})}function ir(e){Z&&Z.remove(),Z=document.createElement("div"),Z.id="bs-annotation-overlay";let t=document.createElement("style");t.textContent=`
|
|
1591
1605
|
#bs-annotation-overlay {
|
|
1592
1606
|
position: fixed; inset: 0; z-index: 2147483647;
|
|
1593
1607
|
background: rgba(0,0,0,0.85);
|
|
@@ -1632,5 +1646,5 @@ ${t.stack??""}`;if(typeof t=="object")try{return JSON.stringify(t,null,2)}catch{
|
|
|
1632
1646
|
overflow: hidden; padding: 16px;
|
|
1633
1647
|
}
|
|
1634
1648
|
.bs-ann-canvas-wrap canvas { cursor: crosshair; border-radius: 4px; }
|
|
1635
|
-
`,Z.appendChild(t);let n=document.createElement("div");n.className="bs-ann-toolbar";for(let d of
|
|
1649
|
+
`,Z.appendChild(t);let n=document.createElement("div");n.className="bs-ann-toolbar";for(let d of or){let c=document.createElement("button");c.className=`bs-ann-tool${d.id===St?" active":""}`,c.title=d.label,c.innerHTML=`<svg viewBox="0 0 24 24"><path d="${d.icon}"/></svg>`,c.addEventListener("click",()=>{St=d.id,n.querySelectorAll(".bs-ann-tool").forEach(h=>h.classList.remove("active")),c.classList.add("active")}),n.appendChild(c)}n.appendChild(as());for(let d of ar){let c=document.createElement("button");c.className=`bs-ann-color${d===Ct?" active":""}`,c.style.background=d,c.addEventListener("click",()=>{Ct=d,n.querySelectorAll(".bs-ann-color").forEach(h=>h.classList.remove("active")),c.classList.add("active")}),n.appendChild(c)}n.appendChild(as());let s=document.createElement("button");s.className="bs-ann-btn bs-ann-undo",s.textContent="Undo",s.addEventListener("click",()=>{$e.pop(),$t()}),n.appendChild(s);let r=document.createElement("button");r.className="bs-ann-btn bs-ann-save",r.textContent="Save",r.addEventListener("click",cr);let a=document.createElement("button");a.className="bs-ann-btn bs-ann-cancel",a.textContent="Cancel",a.addEventListener("click",()=>{Jt(),Tt?.(null)}),n.appendChild(r),n.appendChild(a),Z.appendChild(n);let l=document.createElement("div");l.className="bs-ann-canvas-wrap",H=document.createElement("canvas"),E=H.getContext("2d"),l.appendChild(H),Z.appendChild(l),document.body.appendChild(Z),ae=new Image,ae.onload=()=>{if(!H||!E||!ae)return;let d=window.innerWidth-32,c=window.innerHeight-100,h=ae.width,p=ae.height,v=Math.min(1,d/h,c/p);h=Math.round(h*v),p=Math.round(p*v),H.width=h,H.height=p,$t(),lr()},ae.src=e}function as(){let e=document.createElement("div");return e.className="bs-ann-sep",e}function lr(){if(!H)return;H.addEventListener("mousedown",t=>{Ve=!0;let{x:n,y:s}=is(t);Y={type:St,color:Ct,lineWidth:rr,points:[{x:n,y:s}],x:n,y:s,width:0,height:0}}),H.addEventListener("mousemove",t=>{if(!Ve||!Y)return;let{x:n,y:s}=is(t);Y.type==="freehand"?Y.points.push({x:n,y:s}):(Y.width=n-Y.x,Y.height=s-Y.y),$t(),cs(Y)});let e=()=>{Ve&&Y&&($e.push(Y),Y=null),Ve=!1,$t()};H.addEventListener("mouseup",e),H.addEventListener("mouseleave",e)}function is(e){let t=H.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}}function $t(){if(!(!E||!H||!ae)){E.clearRect(0,0,H.width,H.height),E.drawImage(ae,0,0,H.width,H.height);for(let e of $e)cs(e)}}function cs(e){if(E)switch(E.strokeStyle=e.color,E.fillStyle=e.color,E.lineWidth=e.lineWidth,E.lineCap="round",E.lineJoin="round",e.type){case"freehand":{if(!e.points||e.points.length<2)return;E.beginPath(),E.moveTo(e.points[0].x,e.points[0].y);for(let t=1;t<e.points.length;t++)E.lineTo(e.points[t].x,e.points[t].y);E.stroke();break}case"rectangle":{E.strokeRect(e.x,e.y,e.width,e.height);break}case"circle":{let t=e.x+e.width/2,n=e.y+e.height/2,s=Math.abs(e.width)/2,r=Math.abs(e.height)/2;E.beginPath(),E.ellipse(t,n,s,r,0,0,Math.PI*2),E.stroke();break}case"arrow":{let t=e.x,n=e.y,s=e.x+e.width,r=e.y+e.height,a=14,l=Math.atan2(r-n,s-t);E.beginPath(),E.moveTo(t,n),E.lineTo(s,r),E.stroke(),E.beginPath(),E.moveTo(s,r),E.lineTo(s-a*Math.cos(l-Math.PI/6),r-a*Math.sin(l-Math.PI/6)),E.lineTo(s-a*Math.cos(l+Math.PI/6),r-a*Math.sin(l+Math.PI/6)),E.closePath(),E.fill();break}}}function cr(){if(!H){Jt(),Tt?.(null);return}let t={dataUrl:H.toDataURL("image/png"),annotations:$e};Jt(),Tt?.(t)}function Jt(){Z?.remove(),Z=null,H=null,E=null,ae=null,$e=[],Y=null,Ve=!1}var Mt=!1;function dr(){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 ds={init(e){Mt||typeof window>"u"||(e.environment??dr())==="production"||(Mt=!0,e.endpoint&&Sn(e.endpoint),on(e.maxBreadcrumbs),pn(e.maxLogs),fn(e.maxNetworkCaptures),xn(),e.enablePerformance!==!1&&kn(),rs(e),e.enableLivePins!==!1&&V()&&(Ye(e.projectId),_e(e.projectId)))},destroy(){Mt&&(os(),Fn(),Dn(),un(),vn(),wn(),ln(),En(),Mt=!1)},getLogs:te,clearLogs:bn,getNetworkCaptures:ye,getFailedNetworkCaptures:ce,clearNetworkCaptures:hn,getErrors:ne,clearErrors:yn,getBreadcrumbs:he,clearBreadcrumbs:an,getPerformanceMetrics:we,addBreadcrumb:_,getThemes:gt,getThemeById:ft,setTheme:Lt,getCurrentThemeId:ts,getLayouts:ht,getLayoutById:Ue,setLayout:ns,getCurrentLayoutId:ss,getCurrentUser:V,login:bt,logout:ut,togglePinMode:Xe,isPinModeActive:wt,isConnected:On,openAnnotationEditor:ls,redactString:ve,redactObject:st},pr=ds;0&&(module.exports={BugStash});
|
|
1636
1650
|
//# sourceMappingURL=index.cjs.map
|