@blipit/browser 0.3.10 → 0.3.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/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ ## 0.3.12
2
+
3
+ - A bug reporter made for phones and tablets (narrow screens or touch-only devices). It first asks how to show the problem: Take a screenshot, Record a video, Attach image, or Skip, just describe it.
4
+ - The screenshot opens full screen between a top bar (Back, the zoom level with − and +, Next) and the drawing tools at the bottom, so no toolbar covers the image, with safe-area insets on notched phones. Pinch with two fingers to zoom (up to 5×) and pan, double-tap to zoom in or back out (when the tool does not act on a tap), and marks land under the finger at any zoom. Tools and icons keep their size; the page itself is never zoomed. 44 px touch targets.
5
+ - Phone browsers cannot record the screen, so Record a video shows illustrated steps for the device's own recorder (iPhone and iPad: Control Centre › Screen Recording, with how to add it under Settings › Control Centre; Android: Quick Settings › Screen record, with how to add the tile), then Hide this and start recording leaves a small bar with "I've recorded it — choose the video". When the page becomes visible again the button pulses. The chosen video opens straight in the video editor (trim, marks, voice-over), then the details and Send.
6
+ - The title, description, type, name and email are kept in `sessionStorage` for 30 minutes while the guide is in use, so a page reload during recording loses nothing; opening the reporter again lands on the guide with the choose button highlighted. Cleared on send or close.
7
+ - Pins and numbered steps are placed when the finger or mouse is released, and can be dragged into place first.
8
+ - The video editor gets the same pinch zoom on phones and an opaque full-screen background.
9
+ - Desktop is unchanged. `blipit.js` is unchanged at 10,235 bytes gzipped; all of this is in the lazily loaded reporter.
10
+
11
+ ## 0.3.11
12
+
13
+ - The bug reporter, session replay, the Report a bug button styles and the simple feedback form load from the compatibility channel `https://blipit.io/sdk/0.3/` (always the newest 0.3.x build) instead of the installed version's folder, so reporter fixes reach your site without a reinstall. The core tells each part its version and interface level (`accepts({ version, api })`); a part that does not support the core, or a channel file that cannot be loaded, falls back to the exact version's file. With `debug` the fallback is logged.
14
+ - `sdkChannel: "exact"` loads every part from the installed version only, for sites that pin files or need Subresource Integrity. A `src` you set for the reporter or replay is still used as given.
15
+ - Channel files are cached for 10 minutes and revalidated; exact-version files stay immutable. Files at older exact paths are never replaced.
16
+ - In development (localhost, 127.0.0.1, `*.local`, `debug: true` or `NODE_ENV=development`) the console says once per session when a newer version is out: `[blipit] 0.3.12 is available (you have 0.3.11) — <what it fixes> — npm install @blipit/browser@latest` (the script tag build names the new `blipit.js` URL). It reads the widget settings the SDK already loads; no extra request, never on other hosts, never throws.
17
+ - `blipit.js` is 10.0 KB gzipped (10,233 bytes), inside the 10 KB budget.
18
+
1
19
  ## 0.3.10
2
20
 
3
21
  - Add voice: when the site's `Permissions-Policy` turns the microphone off (`microphone=()`), the permission panel offers "Add voice". It opens a small Blipit window (`voice.html` served next to the SDK on blipit.io, with its own `Permissions-Policy: microphone=(self)`) from the visitor's click, so pop-up blockers allow it. The window asks for the microphone, shows the site it records for, a level meter and Mute, and records your voice with `MediaRecorder` (webm/opus, mp4/aac in Safari) while the page records the screen. Start, pause, resume and stop follow the recording bar; Stop in the window stops the recording.
package/README.md CHANGED
@@ -136,6 +136,7 @@ key.
136
136
  | `ignoreErrors` | built-in noise list | Extra strings/regexes to drop (matched on error message) |
137
137
  | `beforeSend` | — | Inspect/modify the event; return `null` to drop it |
138
138
  | `debug` | `false` | Log SDK activity to the console, including why the Report a bug button is shown or hidden |
139
+ | `sdkChannel` | `"compatible"` | Where the reporter, replay, button and fallback form load from: `"compatible"` takes the newest build of your line (`/sdk/0.3/`), `"exact"` only the files of the version you installed. See Updates |
139
140
 
140
141
  ## Bug reports
141
142
 
@@ -243,6 +244,29 @@ the browser's screen-share prompt. The UI is translated into English, Arabic (ri
243
244
  Spanish, French, Italian, Japanese, Dutch, Portuguese, Turkish and Chinese, picked from the browser
244
245
  language, and follows the system light or dark theme.
245
246
 
247
+ ## Updates
248
+
249
+ `blipit.js` and the npm package stay on the version you installed. The parts that load on first use (the bug
250
+ reporter, session replay, the Report a bug button styles and the simple feedback form) load from
251
+ `https://blipit.io/sdk/0.3/`, which always holds the newest 0.3.x build, so fixes to the reporter reach your site
252
+ without a reinstall. Before a lazily loaded part runs, the core tells it its own version and interface level; a part
253
+ that does not support your core says no, and the core loads the part from your exact version
254
+ (`https://blipit.io/sdk/<your version>/`) instead. The same happens when the newest file cannot be loaded.
255
+
256
+ - Channel paths (`/sdk/0.3/`) are cached for 10 minutes and then revalidated. Exact paths (`/sdk/0.3.11/`) never
257
+ change and are cached for a year.
258
+ - Both are on the same origin, `https://blipit.io`, so `script-src https://blipit.io` covers them.
259
+ - A file that moves cannot carry a Subresource Integrity hash. If your policy requires SRI, use
260
+ `sdkChannel: "exact"` and load `blipit.js` with a script tag on the exact path with `integrity`; then every file
261
+ comes from that one version and nothing changes under you.
262
+ - Older cores (0.3.10 and before) keep loading their own exact files. Blipit does not put newer files at old exact
263
+ paths: those paths are the fallback and the pin, older cores pass their internal client to the reporter without a
264
+ version check, and browsers keep the year-long cached copy anyway. Update the package to get the newest reporter.
265
+ - In development (localhost, 127.0.0.1, `*.local`, `debug: true` or `NODE_ENV=development`) the console says once per
266
+ session when a newer version is out, with what it fixes and the update command. It uses the widget settings the SDK
267
+ already loads, so there is no extra request, and it is never shown on other hosts. With `feedbackWidget: false` the
268
+ settings are not loaded and the notice is skipped.
269
+
246
270
  ## Content Security Policy
247
271
 
248
272
  `script-src https://blipit.io` (the script tag, and the reporter and replay add-ons loaded on first use) and
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var j=Object.defineProperty;var Ae=Object.getOwnPropertyDescriptor;var Fe=Object.getOwnPropertyNames;var Ne=Object.prototype.hasOwnProperty;var De=(e,t)=>{for(var n in t)j(e,n,{get:t[n],enumerable:!0})},Pe=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Fe(t))!Ne.call(e,r)&&r!==n&&j(e,r,{get:()=>t[r],enumerable:!(i=Ae(t,r))||i.enumerable});return e};var Ue=e=>Pe(j({},"__esModule",{value:!0}),e);var St={};De(St,{addBreadcrumb:()=>bt,attachReport:()=>vt,captureException:()=>lt,captureMessage:()=>ft,captureSecurity:()=>mt,flush:()=>wt,init:()=>pt,openReport:()=>te,reportButton:()=>xt,setReportMetadata:()=>ye,setTag:()=>ht,setUser:()=>gt,showFeedback:()=>yt,updateWidget:()=>kt});module.exports=Ue(St);var ie={en:["Report {ref} sent.","We will email you updates."],ar:["\u062A\u0645 \u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0628\u0644\u0627\u063A {ref}.","\u0633\u0646\u0631\u0627\u0633\u0644\u0643 \u0628\u0627\u0644\u062A\u062D\u062F\u064A\u062B\u0627\u062A."],de:["Meldung {ref} gesendet.","Wir informieren Sie per E-Mail."],es:["Reporte {ref} enviado.","Te enviaremos novedades por correo."],fr:["Signalement {ref} envoy\xE9.","Nous vous tiendrons au courant par e-mail."],it:["Segnalazione {ref} inviata.","Ti invieremo aggiornamenti via email."],ja:["\u5831\u544A {ref} \u3092\u9001\u4FE1\u3057\u307E\u3057\u305F\u3002","\u9032\u6357\u306F\u30E1\u30FC\u30EB\u3067\u304A\u77E5\u3089\u305B\u3057\u307E\u3059\u3002"],nl:["Melding {ref} verstuurd.","We mailen je updates."],pt:["Relato {ref} enviado.","Vamos enviar novidades por e-mail."],tr:["{ref} numaral\u0131 bildirim g\xF6nderildi.","Geli\u015Fmeleri e-postayla bildirece\u011Fiz."],zh:["\u62A5\u544A {ref} \u5DF2\u53D1\u9001\u3002","\u6211\u4EEC\u4F1A\u901A\u8FC7\u90AE\u4EF6\u544A\u77E5\u8FDB\u5C55\u3002"]};function ze(e,t,n){if(typeof e!="string"||!/^BR-\d{1,12}$/.test(e))return null;let[i,r]=ie[n.toLowerCase().split(/[-_]/)[0]]??ie.en;return`${i.replace("{ref}",e)}${t===!0?` ${r}`:""}`}function x(e,t,n){let i=document.createElement(e);return i.style.cssText=t,n!==void 0&&(i.textContent=n),i}var W="display:block;width:100%;box-sizing:border-box;margin:4px 0 12px;padding:8px 10px;font:inherit;border:1px solid #c5ccd6;border-radius:6px;background:#fff;color:#111",re="font:inherit;padding:8px 14px;border-radius:6px;cursor:pointer;border:1px solid #c5ccd6;background:#fff;color:#111",q=!1;function oe(e,t,n){if(q||typeof document>"u"||!document.body)return;q=!0;let i=x("dialog","max-width:420px;width:calc(100% - 32px);padding:20px;border:1px solid #c5ccd6;border-radius:10px;font:14px/1.45 system-ui,sans-serif;color:#111;background:#fff");i.setAttribute("aria-labelledby","blipit-fb-title");let r=x("form","margin:0"),o=x("h2","margin:0 0 12px;font-size:17px",n.title??"Tell us what happened");o.id="blipit-fb-title";let c=(b,$,k)=>{let B=x("label","display:block;font-weight:600",b);B.htmlFor=k,$.id=k,r.append(B,$)},d=x("input",W);d.type="text",d.maxLength=128,d.autocomplete="name",d.value=n.name??"";let a=x("input",W);a.type="email",a.maxLength=254,a.autocomplete="email",a.value=n.email??"";let s=x("textarea",`${W};min-height:110px;resize:vertical`);s.required=!0,s.maxLength=5e3;let p=x("p","margin:0 0 12px;min-height:1.2em;font-size:13px");p.setAttribute("role","status"),p.setAttribute("aria-live","polite");let h=x("div","display:flex;gap:8px;justify-content:flex-end"),f=x("button",re,"Cancel");f.type="button";let m=x("button",`${re};background:#111;color:#fff;border-color:#111`,"Send");m.type="submit",r.append(o),c("Name (optional)",d,"blipit-fb-name"),c("Email (optional)",a,"blipit-fb-email"),c("What went wrong?",s,"blipit-fb-message"),h.append(f,m),r.append(p,h),i.append(r),document.body.append(i);let E=()=>{q=!1,i.remove()},R=()=>typeof i.close=="function"&&i.open?i.close():E();f.addEventListener("click",R),i.addEventListener("close",E),r.addEventListener("submit",async b=>{b.preventDefault();let $=s.value.trim();if(!$){p.textContent="Please describe what happened.",s.focus();return}m.disabled=!0,f.disabled=!0,m.setAttribute("aria-busy","true"),m.textContent="Sending\u2026",p.textContent="";try{let k=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-Blipit-Key":t},body:JSON.stringify({name:d.value.trim()||void 0,email:a.value.trim()||void 0,message:$,event_id:n.eventId,url:typeof location<"u"?location.href.split(/[?#]/)[0]:void 0})});if(!k.ok)throw new Error(String(k.status));let B=await k.json().catch(()=>({})),A=ze(B.ref,B.emails,typeof navigator>"u"?"en":navigator.language??"en");p.textContent=A??"Thanks, your message was sent.",m.textContent="Sent",setTimeout(R,A?4e3:1200)}catch{p.textContent="That did not send. Please try again.",m.disabled=!1,f.disabled=!1,m.removeAttribute("aria-busy"),m.textContent="Send"}}),typeof i.showModal=="function"?i.showModal():i.setAttribute("open",""),s.focus()}var se=["login_failed","login_succeeded","login_blocked","password_reset_requested","privilege_granted"];var F=class{constructor(t,n,i,r){this.endpoint=t;this.key=n;this.debug=i;this.instance=r;typeof document<"u"&&document.addEventListener&&document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&this.flushWithBeacon()})}endpoint;key;debug;instance;queue=[];timer;sending=!1;enqueue(t){this.queue.push(t),this.queue.length>30&&this.queue.shift(),this.timer||(this.timer=setTimeout(()=>{this.timer=void 0,this.flush()},1e3))}async flush(){if(!this.sending){this.sending=!0;try{for(;this.queue.length>0;){let t=this.queue[0];if(!await this.send(t))break;this.queue.shift()}}finally{this.sending=!1}}}async send(t,n=0){try{let i=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json","X-Blipit-Key":this.key,...this.instance?{"X-Blipit-Instance":this.instance}:{}},body:JSON.stringify(t),keepalive:!0});return i.status===429||i.status>=500?this.retry(t,n):(this.debug&&i.status>=400&&console.warn("[blipit] event rejected",i.status,await i.text()),!0)}catch{return this.retry(t,n)}}async retry(t,n){return n>=2?(this.debug&&console.warn("[blipit] dropping event after retries",t.event_id),!0):(await new Promise(i=>setTimeout(i,1e3*2**n)),this.send(t,n+1))}flushWithBeacon(){if(!(typeof navigator>"u"||!navigator.sendBeacon))for(;this.queue.length>0;){let t=this.queue.shift(),n=`key=${encodeURIComponent(this.key)}${this.instance?`&instance=${encodeURIComponent(this.instance)}`:""}`,i=`${this.endpoint}${this.endpoint.includes("?")?"&":"?"}${n}`;navigator.sendBeacon(i,JSON.stringify(t))}}};function L(){let e=new Uint8Array(16);if(typeof crypto<"u"&&crypto.getRandomValues)crypto.getRandomValues(e);else for(let n=0;n<16;n++)e[n]=Math.floor(Math.random()*256);e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let n=0;n<16;n++)t+=e[n].toString(16).padStart(2,"0");return t}function v(){return new Date().toISOString()}var Ke=/token|key|password|secret|auth|session|passwd|api/i;function C(e){let t=e.indexOf("?");if(t===-1)return e.slice(0,2048);let n=e.slice(0,t),r=e.slice(t+1).split("&").map(o=>{let c=o.indexOf("=");if(c===-1)return o;let d=o.slice(0,c);return Ke.test(d)?`${d}=[redacted]`:o}).join("&");return`${n}?${r}`.slice(0,2048)}var je=/\b((?:[a-zA-Z0-9_-]*(?:token|key|password|secret|auth|session|passwd|api)[a-zA-Z0-9_-]*)=)[^&\s"']+/gi;function ae(e){return e.replace(je,"$1[redacted]")}function l(e,t){return e.length>t?e.slice(0,t):e}var de=".blipit-mask,[data-blipit-mask]";function H(e){return e.replace(/#.*/,"").replace(/([?&][^=&]*)=[^&]*/g,"$1=").slice(0,2048)}function w(e,t,n){e.push(t),e.length>n&&e.shift()}function X(e){let t=e.id?`#${e.id}`:"",n=typeof e.className=="string"&&e.className.trim()?`.${e.className.trim().split(/\s+/).slice(0,2).join(".")}`:"";return l(`${e.tagName.toLowerCase()}${t}${n}`,128)}function N(e,t){try{let n=new CSSStyleSheet;n.replaceSync(t),e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]}catch{let n=document.createElement("style");n.textContent=t,(e===document?document.head:e).append(n)}}function T(e,t){return`${e.replace(/\/api\/v1\/events.*$/,"").replace(/\/$/,"")}${t}`}function ce(e,t){let n=e?/^(https?:\/\/[^?#]*\/)blipit(?:\.min)?\.js(?:[?#].*)?$/.exec(e):null;return n?n[1]:`https://blipit.io/sdk/${t}/`}function We(e){let t=e.match(/rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:[,\s/]+([\d.]+%?))?/);if(!t||(t[4]===void 0?1:t[4].endsWith("%")?parseFloat(t[4])/100:parseFloat(t[4]))<.5)return null;let[i,r,o]=[t[1],t[2],t[3]].map(c=>{let d=parseFloat(c)/255;return d<=.03928?d/12.92:((d+.055)/1.055)**2.4});return .2126*i+.7152*r+.0722*o}function ue(e){if(e==="light"||e==="dark")return e;if(typeof document<"u"){for(let n of[document.body,document.documentElement]){if(!n)continue;let i=We(getComputedStyle(n).backgroundColor);if(i!==null)return i<.4?"dark":"light"}let t=getComputedStyle(document.documentElement).colorScheme;if(t==="dark")return"dark";if(t&&t!=="normal"&&!t.includes("dark"))return"light"}return typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var pe={ok:0,errored:1,crashed:2},D=class{constructor(t,n,i,r){this.url=t;this.key=n;this.release=i;this.environment=r;this.start(),typeof document<"u"&&document.addEventListener&&document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.end():this.sid||this.start()})}url;key;release;environment;sid="";started="";status="ok";errors=0;did;setUser(t){this.did=t}markError(t){if(!this.sid)return;this.errors+=1;let n=t?"crashed":"errored";pe[n]<=pe[this.status]||(this.status=n,this.send(!1))}start(){this.sid=L(),this.started=v(),this.status="ok",this.errors=0,this.send(!1)}end(){this.sid&&(this.send(!0),this.sid="")}send(t){let n=JSON.stringify({sid:this.sid,did:this.did,status:this.status==="ok"&&t?"exited":this.status,errors:this.errors,started:this.started,release:this.release,environment:this.environment}),i=`${this.url}?key=${encodeURIComponent(this.key)}`;try{if(t&&typeof navigator<"u"&&navigator.sendBeacon){navigator.sendBeacon(i,n);return}if(typeof fetch>"u")return;fetch(this.url,{method:"POST",headers:{"Content-Type":"application/json","X-Blipit-Key":this.key},body:n,keepalive:!0}).catch(()=>{})}catch{return}}};var qe=/^\s*at (?:async )?(?:new )?(?:(.+?) )?\(?((?:file|https?|blob|chrome-extension|moz-extension|safari-web-extension|node|webpack):.*?|[^()]+?)(?::(\d+))?(?::(\d+))?\)?\s*$/,He=/^\s*(?:(.*?)@)?((?:file|https?|blob|chrome-extension|moz-extension|safari-web-extension|node|webpack).*?|[^@]*?)(?::(\d+))?(?::(\d+))?\s*$/,le=/^(chrome|moz|safari-web)-extension:/;function Xe(){if(typeof location<"u"&&location.origin)return location.origin}function Ve(e){if(le.test(e)||e==="<anonymous>"||e==="[native code]")return!1;let t=Xe();return!!(!t||e.startsWith(t)||!/^[a-z]+:/i.test(e))}function fe(e){if(!e)return[];let t=[];for(let n of e.split(`
2
- `)){if(!n||/^\s*(Error|TypeError|RangeError|SyntaxError|ReferenceError)\b/.test(n))continue;let i=qe.exec(n)??He.exec(n);if(!i)continue;let[,r,o,c,d]=i;if(!o)continue;let a={filename:l(o,1024),in_app:Ve(o)};r&&(a.function=l(r,512)),c&&(a.lineno=Number(c)),d&&(a.colno=Number(d)),t.push(a)}return t.reverse(),t.slice(-128)}function me(e){return e.length===0?!1:e.every(t=>le.test(t.filename))}var V="@blipit/browser",M="0.3.10",U=ce(typeof document<"u"?document.currentScript?.src:void 0,M),z="https://in.blipit.io/api/v1/events",Ge=[/ResizeObserver loop/i,/^Script error\.?$/,/__gCrWeb|__firefox__/],Ye={login_failed:"Failed login",login_succeeded:"Successful login",login_blocked:"Blocked login",password_reset_requested:"Password reset requested",privilege_granted:"Privilege granted"},Je={login_failed:"warning",login_succeeded:"info",login_blocked:"warning",password_reset_requested:"info",privilege_granted:"warning"};function Ze(e){if(!se.includes(e?.kind))return;let t=l(String(e.actor??"").trim(),256);if(!t)return;let n={kind:e.kind,actor:t};return e.actorId&&(n.actor_id=l(String(e.actorId),128)),e.ip&&(n.ip=l(String(e.ip).trim(),45)),e.userAgent&&(n.user_agent=l(String(e.userAgent),512)),e.database&&(n.database=l(String(e.database),64)),e.outcome&&(n.outcome=l(String(e.outcome),64)),e.target&&(n.target=l(String(e.target),256)),n}var P=class{constructor(t){this.options=t;this.endpoint=t.endpoint??z,this.transport=new F(this.endpoint,t.key,t.debug??!1,t.instance),t.autoSessionTracking&&(t.release?this.session=new D(T(this.endpoint,"/api/v1/sessions"),t.key,t.release,t.environment??"production"):t.debug&&console.warn("[blipit] session tracking needs the release option")),this.maxBreadcrumbs=Math.min(t.maxBreadcrumbs??50,100),this.ignoreErrors=[...Ge,...t.ignoreErrors??[]]}options;transport;breadcrumbs=[];user;tags={};maxBreadcrumbs;ignoreErrors;seen=new Set;captured=new WeakSet;session;lastEventId;errorIds=[];logs={console:[],network:[],actions:[]};endpoint;replay;setUser(t){this.user=t,this.session?.setUser(t?.id??t?.email)}setTag(t,n){this.tags[l(t,64)]=l(n,256)}addBreadcrumb(t){let n={timestamp:v(),...t};n.message&&(n.message=ae(n.message)),n.data&&typeof n.data.url=="string"&&(n.data={...n.data,url:C(n.data.url)}),this.breadcrumbs.push(n),this.breadcrumbs.length>this.maxBreadcrumbs&&this.breadcrumbs.shift()}captureException(t,n=!0){if(t&&typeof t=="object"){if(this.captured.has(t))return;this.captured.add(t)}let i=t instanceof Error?t:new Error(String(t)),r={type:i.name||"Error",value:l(i.message||String(i),4096),handled:n},o=fe(i.stack);return o.length>0&&(r.stacktrace={frames:o}),this.processAndSend({exception:r,level:"error"})}captureMessage(t,n="info"){return this.processAndSend({message:l(t,8192),level:n})}captureSecurity(t){let n=Ze(t);if(!n){this.options.debug&&console.warn("[blipit] security event dropped, needs a known kind and an actor");return}return this.processAndSend({message:`${Ye[n.kind]} for ${n.actor}`,level:Je[n.kind],security:n},!1)}processAndSend(t,n=!0){if(n&&this.options.sampleRate!==void 0&&Math.random()>this.options.sampleRate)return;let i=t.exception?.value??t.message??"";if(n){for(let d of this.ignoreErrors)if(typeof d=="string"?i.includes(d):d.test(i))return;if((this.options.autoMuteExtensions??!0)&&t.exception?.stacktrace&&me(t.exception.stacktrace.frames))return;let c=`${t.exception?.type??""}|${i}`;if(t.exception?.handled===!1){if(this.seen.has(c)&&this.seen.size<100)return;this.seen.add(c),setTimeout(()=>this.seen.delete(c),5e3)}}let r={event_id:L(),timestamp:v(),platform:"javascript",release:this.options.release,environment:this.options.environment??"production",user:this.user,tags:Object.keys(this.tags).length>0?{...this.tags}:void 0,breadcrumbs:this.breadcrumbs.length>0?[...this.breadcrumbs]:void 0,request:typeof location<"u"?{url:C(location.href)}:void 0,contexts:this.collectContexts(),sdk:{name:V,version:M},...t};for(let c of Object.keys(r))r[c]===void 0&&delete r[c];let o=this.replay?.active()&&(r.level==="error"||r.level==="fatal")?this.replay:void 0;if(o&&(r.tags={...r.tags,replay_id:o.id}),this.options.beforeSend){let c=this.options.beforeSend(r);if(!c)return;r=c}return this.transport.enqueue(r),this.lastEventId=r.event_id,(r.level==="error"||r.level==="fatal")&&w(this.errorIds,r.event_id,20),r.exception&&this.session?.markError(r.exception.handled===!1),o?.error(r.event_id),r.event_id}collectContexts(){if(typeof navigator>"u")return;let t={},n=navigator.userAgent??"",i=/(Edg|OPR|Chrome|Firefox|Safari)\/(\d+[\d.]*)/.exec(n)??void 0;i&&(t.browser={name:i[1],version:i[2]});let r=/\(([^)]+)\)/.exec(n);return r&&r[1]&&(t.os={name:l(r[1],64)}),typeof screen<"u"&&(t.device={screen:`${screen.width}x${screen.height}`}),Object.keys(t).length>0?t:void 0}flush(){return this.transport.flush()}};var Y={en:["Report a bug","Loading\u2026"],ar:["\u0623\u0628\u0644\u063A \u0639\u0646 \u062E\u0637\u0623","\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u062D\u0645\u064A\u0644\u2026"],de:["Fehler melden","Wird geladen\u2026"],es:["Reportar un error","Cargando\u2026"],fr:["Signaler un bug","Chargement\u2026"],it:["Segnala un bug","Caricamento\u2026"],ja:["\u4E0D\u5177\u5408\u3092\u5831\u544A","\u8AAD\u307F\u8FBC\u307F\u4E2D\u2026"],nl:["Bug melden","Laden\u2026"],pt:["Reportar erro","Carregando\u2026"],tr:["Hata bildir","Y\xFCkleniyor\u2026"],zh:["\u62A5\u544A\u95EE\u9898","\u52A0\u8F7D\u4E2D\u2026"]},Qe="button{all:initial;position:fixed;z-index:2147483646;display:flex;align-items:center;gap:8px;padding:11px 18px;border-radius:99px;background:var(--c,linear-gradient(135deg,#3882F6,#2F5BEA));color:#fff;font:600 14px system-ui,-apple-system,sans-serif;letter-spacing:-.01em;cursor:pointer;box-shadow:0 14px 32px -12px rgba(56,130,246,.75),0 2px 6px rgba(11,26,58,.18),inset 0 1px 0 rgba(255,255,255,.22);transition:transform .2s,box-shadow .2s;animation:in .35s cubic-bezier(.2,.8,.2,1)}button:hover{transform:translateY(-2px);box-shadow:0 20px 40px -12px rgba(56,130,246,.85),0 3px 8px rgba(11,26,58,.2),inset 0 1px 0 rgba(255,255,255,.22)}button:active{transform:scale(.97)}button:focus-visible{outline:3px solid #00C2FF;outline-offset:3px}button:disabled{cursor:progress}svg,i{width:18px;height:18px}i{box-sizing:border-box;border:2px solid;border-right-color:transparent;border-radius:50%;animation:r .8s linear infinite}@keyframes r{to{transform:rotate(1turn)}}@keyframes in{from{opacity:0;transform:translateY(12px) scale(.94)}}.o span{display:none}.o{padding:13px}@media(max-width:480px){span{display:none}button{padding:13px}}@media(pointer:coarse){button{min-height:44px;box-sizing:border-box}}@media(prefers-reduced-motion:reduce){button{animation:none;transition:none}i{animation-duration:3s}}",et='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round" aria-hidden="true"><path d="M4 4h16v12H9l-5 4zM12 7v4M12 13.5v.5"/></svg>',he,G={},be,S,J=()=>{},_,ge=0;function O(e,t){e.options.debug&&console.log(`[blipit] ${t}`)}function ye(e){he=e}function tt(e,t){return G[t]??=new Promise((n,i)=>{let r=document.createElement("script");r.src=e,r.async=!0,r.onload=()=>{let o=window[t];o?n(o):i(new Error(t))},r.onerror=i,document.head.appendChild(r)}).catch(n=>{throw delete G[t],n}),G[t]}function ve(){let e=(navigator.language??"en").slice(0,2);return Y[e]?e:"en"}function xe(e,t){let n=document.createElement("button");return n.type="button",n.className="blipit-rb",n.setAttribute("aria-haspopup","dialog"),e?n.textContent=e:(n.lang=ve(),n.textContent=Y[n.lang][0]),n.addEventListener("click",()=>n.hasAttribute("aria-busy")||t()),n}var ke=()=>{};function we(e){ke=e}function Z(e,t){ke(T(e.endpoint,"/api/v1/feedback"),e.options.key,t)}function K(e){if(typeof document>"u")return;let t=typeof e.options.feedbackWidget=="object"?e.options.feedbackWidget:{},n=document.querySelectorAll("button.blipit-rb"),i=r=>{J(r),n.forEach(o=>r?o.setAttribute("aria-busy","true"):o.removeAttribute("aria-busy"))};i(!0),Promise.all([tt(t.src??`${U}blipit-report.js`,"BlipitReport"),be??=Se(e)]).then(([r,o])=>o.enabled!==!1&&r.open(e,{metadata:he,recording:o.recording===!0,recordingMaxMs:o.recording_max_ms,storageFull:o.storage_full===!0,reportsFull:o.reports_full===!0,theme:o.theme,hide:c=>S&&(S.style.display=c?"none":"")}),()=>Z(e,{eventId:e.lastEventId,name:e.user?.username,email:e.user?.email})).finally(()=>i(!1))}async function Se(e){let t=`blipit_fb_${M}_${e.options.key}`;try{let n=JSON.parse(localStorage.getItem(t)??"null");if(n&&Date.now()-n.t<36e5)return n.s}catch{}try{let n=await fetch(T(e.endpoint,"/api/v1/feedback/settings"),{headers:{"X-Blipit-Key":e.options.key,...e.options.instance?{"X-Blipit-Instance":e.options.instance}:{}}});if(!n.ok)return O(e,`widget settings failed (HTTP ${n.status}), using defaults`),{};let i=await n.json();try{localStorage.setItem(t,JSON.stringify({t:Date.now(),s:i}))}catch{}return i}catch{return O(e,"widget settings unreachable (offline, ad blocker or CSP connect-src), using defaults"),{}}}async function Q(e){let t=e.options.feedbackWidget,n=++ge;if(typeof document>"u")return;if(t===!1)return O(e,"Report a bug button off: feedbackWidget is false");let i=await(be??=Se(e));if(n!==ge)return;if(i.enabled===!1)return O(e,"Report a bug button hidden by the project's Bug report widget setting");let r={...i,...typeof t=="object"?t:{}},[o,c]=Y[ve()],d=r.text||o;S=document.createElement("div"),S.setAttribute("data-blipit-ui","");let a=S.attachShadow({mode:"open"}),s=document.createElement("button");s.type="button";let[p,h]=(/^(bottom|middle)-(left|right)$/.test(r.position??"")?r.position:"bottom-right").split("-");s.style.cssText=`${r.color?`--c:${r.color};`:""}${h}:calc(20px + env(safe-area-inset-${h},0px));${p==="bottom"?"bottom:calc(20px + env(safe-area-inset-bottom,0px))":"top:50%;margin-top:-22px"}`,s.setAttribute("aria-haspopup","dialog"),r.style==="icon"&&(s.className="o",s.title=d);let f=b=>{s.disabled=b,s.setAttribute("aria-label",b?c:d),s.innerHTML=b?"<i></i><span></span>":`${et}<span></span>`,s.lastChild.textContent=b?c:d};J=f,f(!1),s.addEventListener("click",()=>K(e)),N(a,Qe),a.append(s);let m=r.shortcut?.toLowerCase().replace(/\s/g,"");_&&document.removeEventListener("keydown",_),_=void 0,m&&(_=b=>{[b.ctrlKey&&"ctrl",b.shiftKey&&"shift",b.altKey&&"alt",b.metaKey&&"meta",b.key.toLowerCase()].filter(Boolean).join("+")===m&&(b.preventDefault(),K(e))},document.addEventListener("keydown",_));let E=S,R=()=>{S===E&&(document.body.append(E),O(e,`Report a bug button shown at ${p}-${h}`))};document.body?R():document.addEventListener("DOMContentLoaded",R)}function Ee(e,t){let n=e.options.feedbackWidget;e.options.feedbackWidget=t===!1?!1:{...typeof n=="object"?n:{},...t},S?.remove(),S=void 0,_&&document.removeEventListener("keydown",_),_=void 0,J=()=>{},Q(e)}function ee(e){return typeof e=="string"?e.length:e?.size}function Re(e){return e&&Number(e)||void 0}function nt(e,t){return async(n,i)=>{let r=typeof n=="string"?n:n instanceof URL?n.href:n.url,o=(i?.method??n.method??"GET").toUpperCase(),c=Date.now();try{let d=await e(n,i);return t(o,r,d.status,c,ee(i?.body),Re(d.headers.get("content-length"))),d}catch(d){throw t(o,r,0,c,ee(i?.body)),d}}}function it(e,t){let n=e.open,i=e.send;e.open=function(r,o){return this._blipit=[String(r).toUpperCase(),String(o)],n.apply(this,arguments)},e.send=function(r){let o=this._blipit;if(o){let c=Date.now();this.addEventListener("loadend",()=>t(o[0],o[1],this.status,c,ee(r),Re(this.getResponseHeader("content-length"))))}return i.apply(this,arguments)}}function $e(e){if(typeof window>"u")return;let t=T(e.endpoint,""),{console:n,network:i,actions:r}=e.logs;window.addEventListener("error",a=>{e.captureException(a.error??a.message,!1)}),window.addEventListener("unhandledrejection",a=>{e.captureException(a.reason,!1)}),typeof document<"u"&&(document.addEventListener("click",a=>{let s=a.target;if(!(s instanceof Element)||s.closest("[data-blipit-ui]"))return;let p=X(s);e.addBreadcrumb({category:"ui.click",message:`Clicked ${p}`});let h=s.closest(de)?"***":l((s.textContent??"").trim().replace(/\s+/g," "),80);w(r,{timestamp:v(),type:"click",selector:p,text:h},50)},{capture:!0,passive:!0}),document.addEventListener("focusin",a=>{let s=a.target;s instanceof Element&&/^(INPUT|TEXTAREA|SELECT)$/.test(s.tagName)&&w(r,{timestamp:v(),type:"focus",selector:X(s)},50)},{capture:!0,passive:!0}));let o=(a,s,p,h,f,m)=>{t&&s.startsWith(t)||(e.addBreadcrumb({category:"http",message:`${a} ${C(s)} \u2192 ${p||"network error"}`,level:p>=400||!p?"error":"info",data:{url:C(s),method:a,status_code:p||void 0}}),w(i,{timestamp:v(),method:a,url:H(s),status:p,duration:Date.now()-h,request_size:f,response_size:m},50))};typeof window.fetch=="function"&&(window.fetch=nt(window.fetch.bind(window),o)),typeof XMLHttpRequest<"u"&&it(XMLHttpRequest.prototype,o);for(let a of["log","info","debug","warn","error"]){let s=console[a].bind(console);console[a]=(...p)=>{let h=l(p.map(f=>typeof f=="string"?f:rt(f)).join(" "),1024);if(a==="warn"||a==="error"){e.addBreadcrumb({category:"console",level:a==="warn"?"warning":"error",message:h});let f=p.find(m=>m instanceof Error);w(n,{timestamp:v(),level:a,message:h,stack:l((f??new Error).stack??"",2e3)},100)}else w(n,{timestamp:v(),level:a,message:h},100);s(...p)}}let c=()=>w(r,{timestamp:v(),type:"navigation",url:H(location.href)},50),d=()=>{e.addBreadcrumb({category:"navigation",message:`Navigated to ${C(location.href)}`}),c()};if(c(),window.history){let a=window.history.pushState.bind(window.history);window.history.pushState=(...s)=>{a(...s),d()},window.addEventListener("popstate",d)}}function rt(e){try{return JSON.stringify(e)??String(e)}catch{return String(e)}}function Be(){let e=0,t=0,n=0,i=0;return r=>(r.hadRecentInput||(t>0&&r.startTime-i<1e3&&r.startTime-n<5e3?t+=r.value:(t=r.value,n=r.startTime),i=r.startTime,t>e&&(e=t)),e)}function ot(e){if(e.size===0)return;let t=[...e.values()].sort((n,i)=>i-n);return t[Math.min(t.length-1,Math.floor(e.size/50))]}function st(e){return/iPad|Tablet|Android(?!.*Mobile)/i.test(e)?"tablet":/Mobi|iPhone|Android/i.test(e)?"mobile":"desktop"}function I(e,t,n){try{new PerformanceObserver(i=>i.getEntries().forEach(r=>t(r))).observe({type:e,buffered:!0,...n})}catch{}}function Te(e,t,n){if(typeof PerformanceObserver>"u"||typeof document>"u")return;let i=performance.getEntriesByType("navigation")[0],r=i?.activationStart??0,o=y=>Math.max(0,Math.round(y-r)),c=document.visibilityState==="hidden",d=location.pathname,a=i?.type,s={},p=Be(),h=new Map,f=!1,m=!1;i&&i.responseStart>0&&(s.ttfb=o(i.responseStart)),c||(I("paint",y=>{y.name==="first-contentful-paint"&&(s.fcp=o(y.startTime))}),I("largest-contentful-paint",y=>{f||(s.lcp=o(y.startTime))}));let E=()=>{f=!0};addEventListener("keydown",E,{once:!0,capture:!0}),addEventListener("pointerdown",E,{once:!0,capture:!0}),I("layout-shift",y=>{s.cls=Math.round(p(y)*1e4)/1e4});let R=y=>{if(!y.interactionId)return;h.set(y.interactionId,Math.max(h.get(y.interactionId)??0,y.duration));let ne=ot(h);ne!==void 0&&(s.inp=Math.round(ne))};I("event",R,{durationThreshold:40}),I("first-input",R);let b=navigator.connection?.effectiveType,$=`${new URL("/api/v1/vitals",e).href}?key=${encodeURIComponent(t)}${n?`&instance=${encodeURIComponent(n)}`:""}`,k=()=>{if(m||Object.keys(s).length===0)return;m=!0;let y=JSON.stringify({path:d.slice(0,512),metrics:s,nav:a,connection:b&&/^(slow-2g|2g|3g|4g)$/.test(b)?b:void 0,device:st(navigator.userAgent)});try{if(navigator.sendBeacon?.($,y))return}catch{}fetch($,{method:"POST",body:y,keepalive:!0}).catch(()=>{})},B=()=>{location.pathname!==d&&(k(),d=location.pathname,a="route",s={},p=Be(),h=new Map,f=!0,m=!1)};document.addEventListener("visibilitychange",()=>document.visibilityState==="hidden"&&k()),addEventListener("pagehide",k),addEventListener("popstate",B);let A=history.pushState;history.pushState=function(...y){A.apply(this,y),B()}}function at(e,t=Math.random){return t()<(e.sessionSampleRate??0)?"session":t()<(e.onErrorSampleRate??1)?"buffer":null}function _e(e,t,n,i,r){let o=at(e);if(!o||typeof document>"u")return;let c=L(),d,a=document.createElement("script");return a.src=e.src??`${r}blipit-replay.js`,a.async=!0,a.onload=()=>{let s=window.BlipitReplay?.start;d=s?.({id:c,mode:o,endpoint:t,key:n,instance:i})},document.head.appendChild(a),{id:c,active:()=>d?.active()??!1,error:s=>d?.error(s),report:s=>d?.report?.(s)}}var Ce='<svg viewBox="0 0 242.4 208.7" aria-hidden="true"><defs><linearGradient id="bm1" x1="0" y1="1" x2=".5" y2="0"><stop offset="0" stop-color="#00C2FF"/><stop offset=".35" stop-color="#3882F6"/><stop offset="1" stop-color="#0F172A"/></linearGradient><linearGradient id="bm2" x1="0" y1="1" x2="1" y2="0"><stop offset="0" stop-color="#3882F6"/><stop offset=".5" stop-color="#00C2FF"/><stop offset="1" stop-color="#3882F6"/></linearGradient></defs><path fill="url(#bm1)" d="M115.5,164.5c-3.9,0-7.8-.4-11.5-1.2-3.7-.8-7.3-1.9-10.8-3.4-3.4-1.4-6.7-3.2-9.7-5.3-3.0-2.0-5.9-4.4-8.5-7.0s-4.9-5.4-7.0-8.5c-2.1-3.1-3.9-6.3-5.3-9.8-1.5-3.5-2.6-7.1-3.4-10.8-.8-3.8-1.2-7.7-1.2-11.5V19.1c0-6.6,5.4-12.0,12.0-12.0s12.0,5.4,12.0,12.0v88.2c0,2.2.2,4.5.7,6.7.4,2.1,1.1,4.2,1.9,6.2.8,2.0,1.9,3.9,3.1,5.7,1.2,1.8,2.6,3.4,4.1,4.9s3.2,2.9,4.9,4.1c1.8,1.2,3.7,2.2,5.6,3.1,2.0.8,4.1,1.5,6.2,1.9,4.4.9,9.1.9,13.4,0,2.1-.4,4.2-1.1,6.2-1.9,2.0-.8,3.9-1.9,5.7-3.1,1.8-1.2,3.4-2.6,4.9-4.1s2.9-3.2,4.1-4.9c1.2-1.8,2.2-3.7,3.1-5.7.8-2.0,1.5-4.1,1.9-6.2.5-2.2.7-4.5.7-6.7s-.2-4.5-.7-6.7c-.4-2.1-1.1-4.2-1.9-6.2-.8-2.0-1.9-3.9-3.1-5.7-1.2-1.8-2.6-3.4-4.1-4.9s-3.2-2.9-4.9-4.1c-1.8-1.2-3.7-2.2-5.7-3.1-2.0-.8-4.1-1.5-6.2-1.9-4.4-.9-9.1-.9-13.4,0-6.5,1.3-12.9-2.9-14.2-9.4-1.3-6.5,2.9-12.9,9.4-14.2,7.6-1.6,15.5-1.6,23.1,0,3.7.8,7.3,1.9,10.8,3.4,3.4,1.4,6.7,3.2,9.7,5.3,3.0,2.0,5.9,4.4,8.5,7.0s4.9,5.4,7.0,8.5c2.1,3.1,3.9,6.3,5.3,9.8,1.5,3.5,2.6,7.1,3.4,10.8.8,3.8,1.2,7.7,1.2,11.5s-.4,7.8-1.2,11.5c-.8,3.7-1.9,7.3-3.4,10.8-1.4,3.4-3.2,6.7-5.3,9.7-2.0,3.0-4.4,5.9-7.0,8.5s-5.4,4.9-8.5,7.0c-3.1,2.1-6.3,3.9-9.8,5.3-3.5,1.5-7.1,2.6-10.8,3.4-3.8.8-7.7,1.2-11.5,1.2Z"/><path fill="url(#bm2)" d="M208.1,103.0c-.0-.6-.8-.9-1.2-.5-3.2,3.1-7.6,5.0-12.4,5.0-3.9,0-9.1-1.6-10.2-2.5-.3-.1-.1,1.4-.1,2.5,0,40.5-34.4,73.0-75.5,70.0-33.4-2.5-60.8-28.8-64.4-62.1-1.0-9.4-.2-18.6,2.2-27.0,1.6-5.6,2.6-11.4,2.6-17.3v-22.4c0-3.4-4.3-5.0-6.5-2.4-13.2,15.4-21.6,35.1-22.7,56.6-2.6,54.1,40.6,98.9,94.1,98.9s94.2-42.3,94.2-94.2c0-1.5-.1-3.0-.1-4.5Z"/><path fill="url(#bm2)" d="M201.2,70.1c-14.8-35.8-50.9-60.5-92.3-58.3h-.1c-8.2.5-14.6,7.4-14.6,15.7v.1c0,5.4,4.7,9.6,10.0,8.8,3.2-.5,6.5-.7,9.9-.7,28.7,0,53.5,17.4,64.3,42.1.2.5.9.6,1.2.1,3.2-4.8,8.7-7.9,14.9-7.9,2.0,0,4.0.3,5.8,1.0.6.2,1.1-.4.9-1.0Z"/><circle fill="#00C2FF" cx="194.5" cy="88" r="15.8"/></svg>';var u=".blipit-rb.blipit-rb",dt=`${u}{all:unset;box-sizing:border-box;display:inline-flex;align-items:center;gap:9px;height:40px;padding-inline:5px 17px;border-radius:99px;font:600 14px/1 system-ui,-apple-system,"Segoe UI",sans-serif;letter-spacing:-.01em;white-space:nowrap;cursor:pointer;user-select:none;-webkit-tap-highlight-color:transparent;color:#fff;background:linear-gradient(135deg,#3882F6,#2F5BEA);box-shadow:0 10px 24px -12px rgba(56,130,246,.8),0 1px 3px rgba(11,26,58,.16),inset 0 1px 0 rgba(255,255,255,.22);transition:transform .2s,box-shadow .2s}${u}:hover{transform:translateY(-1px);box-shadow:0 16px 32px -12px rgba(56,130,246,.85),0 2px 6px rgba(11,26,58,.18),inset 0 1px 0 rgba(255,255,255,.22)}${u}:active{transform:scale(.97)}${u}:focus-visible{outline:3px solid #00C2FF;outline-offset:3px}${u}[aria-busy=true]{cursor:progress}${u}>span{all:unset}${u}>.blipit-rb-m{position:relative;display:grid;place-items:center;flex:none;width:30px;height:30px;border-radius:99px;background:#fff;box-shadow:0 0 0 1px rgba(11,26,58,.08),0 1px 2px rgba(11,26,58,.12)}${u} svg{display:block;width:19px;height:17px}${u}[data-size=sm]{height:32px;gap:7px;padding-inline:4px 13px;font-size:13px}${u}[data-size=sm]>.blipit-rb-m{width:24px;height:24px}${u}[data-size=sm] svg{width:15px;height:13px}${u}[data-variant=outline],${u}[data-variant=ghost]{color:#0B1A3A;background:transparent;box-shadow:inset 0 0 0 1px #CBD7EA}${u}[data-variant=ghost]{box-shadow:none}${u}[data-variant=outline]:hover,${u}[data-variant=ghost]:hover{transform:none;background:rgba(56,130,246,.08);box-shadow:inset 0 0 0 1px rgba(56,130,246,.45)}${u}[data-variant=ghost]:hover{box-shadow:none}${u}[data-theme=dark]{background:linear-gradient(135deg,#5B9BFF,#3D6BF0);box-shadow:0 10px 24px -12px rgba(91,155,255,.7),inset 0 1px 0 rgba(255,255,255,.2)}${u}[data-theme=dark][data-variant=outline],${u}[data-theme=dark][data-variant=ghost]{color:#E8EEF8;background:transparent;box-shadow:inset 0 0 0 1px rgba(255,255,255,.16)}${u}[data-theme=dark][data-variant=ghost]{box-shadow:none}${u}[data-theme=dark][data-variant=outline]:hover,${u}[data-theme=dark][data-variant=ghost]:hover{background:rgba(91,155,255,.16);box-shadow:inset 0 0 0 1px rgba(91,155,255,.45)}${u}[data-theme=dark][data-variant=ghost]:hover{box-shadow:none}${u}[data-theme=dark]>.blipit-rb-m{box-shadow:0 0 0 1px rgba(255,255,255,.1)}${u}[aria-busy=true] svg{visibility:hidden}${u}[aria-busy=true]>.blipit-rb-m::after{content:"";position:absolute;inset:4px;border:2px solid #3882F6;border-right-color:transparent;border-radius:50%;animation:blipit-rb-r .8s linear infinite}@keyframes blipit-rb-r{to{transform:rotate(1turn)}}@media(pointer:coarse){${u}{min-height:44px}}@media(prefers-reduced-motion:reduce){${u}{transition:none}${u}:hover,${u}:active{transform:none}${u}[aria-busy=true]>.blipit-rb-m::after{animation-duration:3s}}@media(forced-colors:active){${u}{border:1px solid ButtonText}}`,Le=0;function Me(e,t={}){Le||N(document,dt);let n=++Le,i=document.createElement("span");i.className="blipit-rb-m",i.innerHTML=Ce.replace(/bm(\d)/g,`bm$1-${n}`);let r=document.createElement("span");r.textContent=e.textContent,e.replaceChildren(i,r),e.classList.add("blipit-rb"),e.setAttribute("data-variant",t.variant==="outline"||t.variant==="ghost"?t.variant:"solid"),e.setAttribute("data-size",t.size==="sm"?"sm":"md"),e.setAttribute("data-theme",ue(t.theme==="light"||t.theme==="dark"?t.theme:void 0))}var g,Oe=new Set;function Ie(e,t){Oe.has(t)||(Oe.add(t),console[e](t))}var ct="[blipit] init() has no key, so error tracking and the Report a bug button are off. Pass your public key (blipit_pk_...) from app.blipit.io, API keys.",ut="[blipit] init() got a secret key (blipit_sk_...), so Blipit did not start: secret keys must never be in browser code. Use the public key (blipit_pk_...) and create a new secret key in app.blipit.io, API keys.";function pt(e){if(g)return;let t=typeof e?.key=="string"?e.key.trim():"";if(!t)return Ie("warn",ct);if(t.startsWith("blipit_sk_"))return Ie("error",ut);if(g=new P({...e,key:t}),e.user){let{id:n,name:i,email:r,username:o}=e.user;g.setUser({id:n===void 0?void 0:String(n),email:r,username:o??i})}$e(g),e.webVitals!==!1&&typeof window<"u"&&Te(e.endpoint??z,t,e.instance),e.replay&&(g.replay=_e(e.replay,e.endpoint??z,t,e.instance,U)),typeof window<"u"&&Q(g),e.debug&&console.log(`[blipit] ${V}@${M} initialized`)}function lt(e){return g?.captureException(e,!0)}function ft(e,t){return g?.captureMessage(e,t)}function mt(e){return g?.captureSecurity(e)}function gt(e){g?.setUser(e)}function ht(e,t){g?.setTag(e,t)}function bt(e){g?.addBreadcrumb(e)}function yt(e={}){g&&Z(g,{...e,eventId:e.eventId??g.lastEventId})}function te(){g&&K(g)}function vt(e){e.addEventListener("click",t=>{t.preventDefault(),te()})}function xt(e={}){let t=xe(e.label,te);return Me(t,e),t}function kt(e){g&&Ee(g,e)}function wt(){return g?.flush()??Promise.resolve()}we(oe);0&&(module.exports={addBreadcrumb,attachReport,captureException,captureMessage,captureSecurity,flush,init,openReport,reportButton,setReportMetadata,setTag,setUser,showFeedback,updateWidget});
1
+ "use strict";var z=Object.defineProperty;var Pe=Object.getOwnPropertyDescriptor;var We=Object.getOwnPropertyNames;var je=Object.prototype.hasOwnProperty;var Ke=(e,t)=>{for(var n in t)z(e,n,{get:t[n],enumerable:!0})},Ue=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of We(t))!je.call(e,i)&&i!==n&&z(e,i,{get:()=>t[i],enumerable:!(r=Pe(t,i))||r.enumerable});return e};var ze=e=>Ue(z({},"__esModule",{value:!0}),e);var Tt={};Ke(Tt,{addBreadcrumb:()=>wt,attachReport:()=>Et,captureException:()=>bt,captureMessage:()=>yt,captureSecurity:()=>xt,flush:()=>$t,init:()=>ht,openReport:()=>te,reportButton:()=>_t,setReportMetadata:()=>we,setTag:()=>kt,setUser:()=>vt,showFeedback:()=>St,updateWidget:()=>Rt});module.exports=ze(Tt);var He=5e3,re={en:["Report {ref} sent.","We will email you updates."],ar:["\u062A\u0645 \u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0628\u0644\u0627\u063A {ref}.","\u0633\u0646\u0631\u0627\u0633\u0644\u0643 \u0628\u0627\u0644\u062A\u062D\u062F\u064A\u062B\u0627\u062A."],de:["Meldung {ref} gesendet.","Wir informieren Sie per E-Mail."],es:["Reporte {ref} enviado.","Te enviaremos novedades por correo."],fr:["Signalement {ref} envoy\xE9.","Nous vous tiendrons au courant par e-mail."],it:["Segnalazione {ref} inviata.","Ti invieremo aggiornamenti via email."],ja:["\u5831\u544A {ref} \u3092\u9001\u4FE1\u3057\u307E\u3057\u305F\u3002","\u9032\u6357\u306F\u30E1\u30FC\u30EB\u3067\u304A\u77E5\u3089\u305B\u3057\u307E\u3059\u3002"],nl:["Melding {ref} verstuurd.","We mailen je updates."],pt:["Relato {ref} enviado.","Vamos enviar novidades por e-mail."],tr:["{ref} numaral\u0131 bildirim g\xF6nderildi.","Geli\u015Fmeleri e-postayla bildirece\u011Fiz."],zh:["\u62A5\u544A {ref} \u5DF2\u53D1\u9001\u3002","\u6211\u4EEC\u4F1A\u901A\u8FC7\u90AE\u4EF6\u544A\u77E5\u8FDB\u5C55\u3002"]};function qe(e,t,n){if(typeof e!="string"||!/^BR-\d{1,12}$/.test(e))return null;let[r,i]=re[n.toLowerCase().split(/[-_]/)[0]]??re.en;return`${r.replace("{ref}",e)}${t===!0?` ${i}`:""}`}function k(e,t,n){let r=document.createElement(e);return r.style.cssText=t,n!==void 0&&(r.textContent=n),r}var H="display:block;width:100%;box-sizing:border-box;margin:4px 0 12px;padding:8px 10px;font:inherit;border:1px solid #c5ccd6;border-radius:6px;background:#fff;color:#111",ie="font:inherit;padding:8px 14px;border-radius:6px;cursor:pointer;border:1px solid #c5ccd6;background:#fff;color:#111",q=!1;function oe(e,t,n){if(q||typeof document>"u"||!document.body)return;q=!0;let r=k("dialog","max-width:420px;width:calc(100% - 32px);padding:20px;border:1px solid #c5ccd6;border-radius:10px;font:14px/1.45 system-ui,sans-serif;color:#111;background:#fff");r.setAttribute("aria-labelledby","blipit-fb-title");let i=k("form","margin:0"),o=k("h2","margin:0 0 12px;font-size:17px",n.title??"Tell us what happened");o.id="blipit-fb-title";let a=(b,T,w)=>{let O=k("label","display:block;font-weight:600",b);O.htmlFor=w,T.id=w,i.append(O,T)},d=k("input",H);d.type="text",d.maxLength=128,d.autocomplete="name",d.value=n.name??"";let c=k("input",H);c.type="email",c.maxLength=254,c.autocomplete="email",c.value=n.email??"";let s=k("textarea",`${H};min-height:110px;resize:vertical`);s.required=!0,s.maxLength=He;let l=k("p","margin:0 0 12px;min-height:1.2em;font-size:13px");l.setAttribute("role","status"),l.setAttribute("aria-live","polite");let h=k("div","display:flex;gap:8px;justify-content:flex-end"),f=k("button",ie,"Cancel");f.type="button";let m=k("button",`${ie};background:#111;color:#fff;border-color:#111`,"Send");m.type="submit",i.append(o),a("Name (optional)",d,"blipit-fb-name"),a("Email (optional)",c,"blipit-fb-email"),a("What went wrong?",s,"blipit-fb-message"),h.append(f,m),i.append(l,h),r.append(i),document.body.append(r);let R=()=>{q=!1,r.remove()},$=()=>typeof r.close=="function"&&r.open?r.close():R();f.addEventListener("click",$),r.addEventListener("close",R),i.addEventListener("submit",async b=>{b.preventDefault();let T=s.value.trim();if(!T){l.textContent="Please describe what happened.",s.focus();return}m.disabled=!0,f.disabled=!0,m.setAttribute("aria-busy","true"),m.textContent="Sending\u2026",l.textContent="";try{let w=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-Blipit-Key":t},body:JSON.stringify({name:d.value.trim()||void 0,email:c.value.trim()||void 0,message:T,event_id:n.eventId,url:typeof location<"u"?location.href.split(/[?#]/)[0]:void 0})});if(!w.ok)throw new Error(String(w.status));let O=await w.json().catch(()=>({})),N=qe(O.ref,O.emails,typeof navigator>"u"?"en":navigator.language??"en");l.textContent=N??"Thanks, your message was sent.",m.textContent="Sent",setTimeout($,N?4e3:1200)}catch{l.textContent="That did not send. Please try again.",m.disabled=!1,f.disabled=!1,m.removeAttribute("aria-busy"),m.textContent="Send"}}),typeof r.showModal=="function"?r.showModal():r.setAttribute("open",""),s.focus()}var se=["login_failed","login_succeeded","login_blocked","password_reset_requested","privilege_granted"];var D=class{constructor(t,n,r,i){this.endpoint=t;this.key=n;this.debug=r;this.instance=i;typeof document<"u"&&document.addEventListener&&document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&this.flushWithBeacon()})}endpoint;key;debug;instance;queue=[];timer;sending=!1;enqueue(t){this.queue.push(t),this.queue.length>30&&this.queue.shift(),this.timer||(this.timer=setTimeout(()=>{this.timer=void 0,this.flush()},1e3))}async flush(){if(!this.sending){this.sending=!0;try{for(;this.queue.length>0;){let t=this.queue[0];if(!await this.send(t))break;this.queue.shift()}}finally{this.sending=!1}}}async send(t,n=0){try{let r=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json","X-Blipit-Key":this.key,...this.instance?{"X-Blipit-Instance":this.instance}:{}},body:JSON.stringify(t),keepalive:!0});return r.status===429||r.status>=500?this.retry(t,n):(this.debug&&r.status>=400&&console.warn("[blipit] event rejected",r.status,await r.text()),!0)}catch{return this.retry(t,n)}}async retry(t,n){return n>=2?(this.debug&&console.warn("[blipit] dropping event after retries",t.event_id),!0):(await new Promise(r=>setTimeout(r,1e3*2**n)),this.send(t,n+1))}flushWithBeacon(){if(!(typeof navigator>"u"||!navigator.sendBeacon))for(;this.queue.length>0;){let t=this.queue.shift(),n=`key=${encodeURIComponent(this.key)}${this.instance?`&instance=${encodeURIComponent(this.instance)}`:""}`,r=`${this.endpoint}${this.endpoint.includes("?")?"&":"?"}${n}`;navigator.sendBeacon(r,JSON.stringify(t))}}};function B(){let e=new Uint8Array(16);if(typeof crypto<"u"&&crypto.getRandomValues)crypto.getRandomValues(e);else for(let n=0;n<16;n++)e[n]=Math.floor(Math.random()*256);e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let n=0;n<16;n++)t+=e[n].toString(16).padStart(2,"0");return t}function v(){return new Date().toISOString()}var Ve=/token|key|password|secret|auth|session|passwd|api/i;function M(e){let t=e.indexOf("?");if(t===-1)return e.slice(0,2048);let n=e.slice(0,t),i=e.slice(t+1).split("&").map(o=>{let a=o.indexOf("=");if(a===-1)return o;let d=o.slice(0,a);return Ve.test(d)?`${d}=[redacted]`:o}).join("&");return`${n}?${i}`.slice(0,2048)}var Xe=/\b((?:[a-zA-Z0-9_-]*(?:token|key|password|secret|auth|session|passwd|api)[a-zA-Z0-9_-]*)=)[^&\s"']+/gi;function ae(e){return e.replace(Xe,"$1[redacted]")}function p(e,t){return e.length>t?e.slice(0,t):e}var de=".blipit-mask,[data-blipit-mask]";function V(e){return e.replace(/#.*/,"").replace(/([?&][^=&]*)=[^&]*/g,"$1=").slice(0,2048)}function E(e,t,n){e.push(t),e.length>n&&e.shift()}function X(e){let t=e.id?`#${e.id}`:"",n=typeof e.className=="string"&&e.className.trim()?`.${e.className.trim().split(/\s+/).slice(0,2).join(".")}`:"";return p(`${e.tagName.toLowerCase()}${t}${n}`,128)}function P(e,t){try{let n=new CSSStyleSheet;n.replaceSync(t),e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]}catch{let n=document.createElement("style");n.textContent=t,(e===document?document.head:e).append(n)}}function C(e,t){return`${e.replace(/\/api\/v1\/events.*$/,"").replace(/\/$/,"")}${t}`}function ce(e,t){let n=e?/^(https?:\/\/[^?#]*\/)blipit(?:\.min)?\.js(?:[?#].*)?$/.exec(e):null;return n?n[1]:`https://blipit.io/sdk/${t}/`}function ue(e,t){let n=`/sdk/${t}/`,[r,i]=t.split(".");return e.endsWith(n)?`${e.slice(0,-n.length)}/sdk/${r==="0"?`${r}.${i}`:r}/`:e}function Ye(e){let t=e.match(/rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:[,\s/]+([\d.]+%?))?/);if(!t||(t[4]===void 0?1:t[4].endsWith("%")?parseFloat(t[4])/100:parseFloat(t[4]))<.5)return null;let[r,i,o]=[t[1],t[2],t[3]].map(a=>{let d=parseFloat(a)/255;return d<=.03928?d/12.92:((d+.055)/1.055)**2.4});return .2126*r+.7152*i+.0722*o}function le(e){if(e==="light"||e==="dark")return e;if(typeof document<"u"){for(let n of[document.body,document.documentElement]){if(!n)continue;let r=Ye(getComputedStyle(n).backgroundColor);if(r!==null)return r<.4?"dark":"light"}let t=getComputedStyle(document.documentElement).colorScheme;if(t==="dark")return"dark";if(t&&t!=="normal"&&!t.includes("dark"))return"light"}return typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var pe={ok:0,errored:1,crashed:2},W=class{constructor(t,n,r,i){this.url=t;this.key=n;this.release=r;this.environment=i;this.start(),typeof document<"u"&&document.addEventListener&&document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.end():this.sid||this.start()})}url;key;release;environment;sid="";started="";status="ok";errors=0;did;setUser(t){this.did=t}markError(t){if(!this.sid)return;this.errors+=1;let n=t?"crashed":"errored";pe[n]<=pe[this.status]||(this.status=n,this.send(!1))}start(){this.sid=B(),this.started=v(),this.status="ok",this.errors=0,this.send(!1)}end(){this.sid&&(this.send(!0),this.sid="")}send(t){let n=JSON.stringify({sid:this.sid,did:this.did,status:this.status==="ok"&&t?"exited":this.status,errors:this.errors,started:this.started,release:this.release,environment:this.environment}),r=`${this.url}?key=${encodeURIComponent(this.key)}`;try{if(t&&typeof navigator<"u"&&navigator.sendBeacon){navigator.sendBeacon(r,n);return}if(typeof fetch>"u")return;fetch(this.url,{method:"POST",headers:{"Content-Type":"application/json","X-Blipit-Key":this.key},body:n,keepalive:!0}).catch(()=>{})}catch{return}}};var Ge=/^\s*at (?:async )?(?:new )?(?:(.+?) )?\(?((?:file|https?|blob|chrome-extension|moz-extension|safari-web-extension|node|webpack):.*?|[^()]+?)(?::(\d+))?(?::(\d+))?\)?\s*$/,Je=/^\s*(?:(.*?)@)?((?:file|https?|blob|chrome-extension|moz-extension|safari-web-extension|node|webpack).*?|[^@]*?)(?::(\d+))?(?::(\d+))?\s*$/,fe=/^(chrome|moz|safari-web)-extension:/;function Ze(){if(typeof location<"u"&&location.origin)return location.origin}function Qe(e){if(fe.test(e)||e==="<anonymous>"||e==="[native code]")return!1;let t=Ze();return!!(!t||e.startsWith(t)||!/^[a-z]+:/i.test(e))}function me(e){if(!e)return[];let t=[];for(let n of e.split(`
2
+ `)){if(!n||/^\s*(Error|TypeError|RangeError|SyntaxError|ReferenceError)\b/.test(n))continue;let r=Ge.exec(n)??Je.exec(n);if(!r)continue;let[,i,o,a,d]=r;if(!o)continue;let c={filename:p(o,1024),in_app:Qe(o)};i&&(c.function=p(i,512)),a&&(c.lineno=Number(a)),d&&(c.colno=Number(d)),t.push(c)}return t.reverse(),t.slice(-128)}function ge(e){return e.length===0?!1:e.every(t=>fe.test(t.filename))}var I="@blipit/browser",S="0.3.12",he=ce(typeof document<"u"?document.currentScript?.src:void 0,S),x={exact:he,channel:ue(he,S),debug:!1,tag:!1},K="https://in.blipit.io/api/v1/events",et=[/ResizeObserver loop/i,/^Script error\.?$/,/__gCrWeb|__firefox__/],tt={login_failed:"Failed login",login_succeeded:"Successful login",login_blocked:"Blocked login",password_reset_requested:"Password reset requested",privilege_granted:"Privilege granted"},nt={login_failed:"warning",login_succeeded:"info",login_blocked:"warning",password_reset_requested:"info",privilege_granted:"warning"};function rt(e){if(!se.includes(e?.kind))return;let t=p(String(e.actor??"").trim(),256);if(!t)return;let n={kind:e.kind,actor:t};return e.actorId&&(n.actor_id=p(String(e.actorId),128)),e.ip&&(n.ip=p(String(e.ip).trim(),45)),e.userAgent&&(n.user_agent=p(String(e.userAgent),512)),e.database&&(n.database=p(String(e.database),64)),e.outcome&&(n.outcome=p(String(e.outcome),64)),e.target&&(n.target=p(String(e.target),256)),n}var j=class{constructor(t){this.options=t;this.endpoint=t.endpoint??K,this.transport=new D(this.endpoint,t.key,t.debug??!1,t.instance),t.autoSessionTracking&&(t.release?this.session=new W(C(this.endpoint,"/api/v1/sessions"),t.key,t.release,t.environment??"production"):t.debug&&console.warn("[blipit] session tracking needs the release option")),this.maxBreadcrumbs=Math.min(t.maxBreadcrumbs??50,100),this.ignoreErrors=[...et,...t.ignoreErrors??[]]}options;transport;breadcrumbs=[];user;tags={};maxBreadcrumbs;ignoreErrors;seen=new Set;captured=new WeakSet;session;lastEventId;errorIds=[];logs={console:[],network:[],actions:[]};endpoint;replay;setUser(t){this.user=t,this.session?.setUser(t?.id??t?.email)}setTag(t,n){this.tags[p(t,64)]=p(n,256)}addBreadcrumb(t){let n={timestamp:v(),...t};n.message&&(n.message=ae(n.message)),n.data&&typeof n.data.url=="string"&&(n.data={...n.data,url:M(n.data.url)}),this.breadcrumbs.push(n),this.breadcrumbs.length>this.maxBreadcrumbs&&this.breadcrumbs.shift()}captureException(t,n=!0){if(t&&typeof t=="object"){if(this.captured.has(t))return;this.captured.add(t)}let r=t instanceof Error?t:new Error(String(t)),i={type:r.name||"Error",value:p(r.message||String(r),4096),handled:n},o=me(r.stack);return o.length>0&&(i.stacktrace={frames:o}),this.processAndSend({exception:i,level:"error"})}captureMessage(t,n="info"){return this.processAndSend({message:p(t,8192),level:n})}captureSecurity(t){let n=rt(t);if(!n){this.options.debug&&console.warn("[blipit] security event dropped, needs a known kind and an actor");return}return this.processAndSend({message:`${tt[n.kind]} for ${n.actor}`,level:nt[n.kind],security:n},!1)}processAndSend(t,n=!0){if(n&&this.options.sampleRate!==void 0&&Math.random()>this.options.sampleRate)return;let r=t.exception?.value??t.message??"";if(n){for(let d of this.ignoreErrors)if(typeof d=="string"?r.includes(d):d.test(r))return;if((this.options.autoMuteExtensions??!0)&&t.exception?.stacktrace&&ge(t.exception.stacktrace.frames))return;let a=`${t.exception?.type??""}|${r}`;if(t.exception?.handled===!1){if(this.seen.has(a)&&this.seen.size<100)return;this.seen.add(a),setTimeout(()=>this.seen.delete(a),5e3)}}let i={event_id:B(),timestamp:v(),platform:"javascript",release:this.options.release,environment:this.options.environment??"production",user:this.user,tags:Object.keys(this.tags).length>0?{...this.tags}:void 0,breadcrumbs:this.breadcrumbs.length>0?[...this.breadcrumbs]:void 0,request:typeof location<"u"?{url:M(location.href)}:void 0,contexts:this.collectContexts(),sdk:this.options._sdk??{name:I,version:S},...t};for(let a of Object.keys(i))i[a]===void 0&&delete i[a];let o=this.replay?.active()&&(i.level==="error"||i.level==="fatal")?this.replay:void 0;if(o&&(i.tags={...i.tags,replay_id:o.id}),this.options.beforeSend){let a=this.options.beforeSend(i);if(!a)return;i=a}return this.transport.enqueue(i),this.lastEventId=i.event_id,(i.level==="error"||i.level==="fatal")&&E(this.errorIds,i.event_id,20),i.exception&&this.session?.markError(i.exception.handled===!1),o?.error(i.event_id),i.event_id}collectContexts(){if(typeof navigator>"u")return;let t={},n=navigator.userAgent??"",r=/(Edg|OPR|Chrome|Firefox|Safari)\/(\d+[\d.]*)/.exec(n)??void 0;r&&(t.browser={name:r[1],version:r[2]});let i=/\(([^)]+)\)/.exec(n);return i&&i[1]&&(t.os={name:p(i[1],64)}),typeof screen<"u"&&(t.device={screen:`${screen.width}x${screen.height}`}),Object.keys(t).length>0?t:void 0}flush(){return this.transport.flush()}};var Y={en:["Report a bug","Loading\u2026"],ar:["\u0623\u0628\u0644\u063A \u0639\u0646 \u062E\u0637\u0623","\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u062D\u0645\u064A\u0644\u2026"],de:["Fehler melden","Wird geladen\u2026"],es:["Reportar un error","Cargando\u2026"],fr:["Signaler un bug","Chargement\u2026"],it:["Segnala un bug","Caricamento\u2026"],ja:["\u4E0D\u5177\u5408\u3092\u5831\u544A","\u8AAD\u307F\u8FBC\u307F\u4E2D\u2026"],nl:["Bug melden","Laden\u2026"],pt:["Reportar erro","Carregando\u2026"],tr:["Hata bildir","Y\xFCkleniyor\u2026"],zh:["\u62A5\u544A\u95EE\u9898","\u52A0\u8F7D\u4E2D\u2026"]},it="button{all:initial;position:fixed;z-index:2147483646;display:flex;align-items:center;gap:8px;padding:11px 18px;border-radius:99px;background:var(--c,linear-gradient(135deg,#3882F6,#2F5BEA));color:#fff;font:600 14px system-ui,-apple-system,sans-serif;letter-spacing:-.01em;cursor:pointer;box-shadow:0 14px 32px -12px rgba(56,130,246,.75),0 2px 6px rgba(11,26,58,.18),inset 0 1px 0 rgba(255,255,255,.22);transition:transform .2s,box-shadow .2s;animation:in .35s cubic-bezier(.2,.8,.2,1)}button:hover{transform:translateY(-2px);box-shadow:0 20px 40px -12px rgba(56,130,246,.85),0 3px 8px rgba(11,26,58,.2),inset 0 1px 0 rgba(255,255,255,.22)}button:active{transform:scale(.97)}button:focus-visible{outline:3px solid #00C2FF;outline-offset:3px}button:disabled{cursor:progress}svg,i{width:18px;height:18px}i{box-sizing:border-box;border:2px solid;border-right-color:transparent;border-radius:50%;animation:r .8s linear infinite}@keyframes r{to{transform:rotate(1turn)}}@keyframes in{from{opacity:0;transform:translateY(12px) scale(.94)}}.o span{display:none}.o{padding:13px}@media(max-width:480px){span{display:none}button{padding:13px}}@media(pointer:coarse){button{min-height:44px;box-sizing:border-box}}@media(prefers-reduced-motion:reduce){button{animation:none;transition:none}i{animation-duration:3s}}",ot='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round" aria-hidden="true"><path d="M4 4h16v12H9l-5 4zM12 7v4M12 13.5v.5"/></svg>',ve,be={},ke,_,G=()=>{},L,ye=0;function A(e,t){e.options.debug&&console.log(`[blipit] ${t}`)}function we(e){ve=e}var xe=(e,t)=>new Promise((n,r)=>{let i=document.createElement("script");i.src=e,i.async=!0,i.onload=()=>n(window[t]),i.onerror=r,document.head.appendChild(i)});function J(e,t,n){return be[t]??=(async()=>{if(!n&&x.channel!==x.exact){try{let i=await xe(x.channel+e,t);if(i?.accepts?.({version:S,api:1}))return i}catch{}window[t]=void 0,x.debug&&console.log(`[blipit] fallback ${x.exact}${e}`)}let r=await xe(n??x.exact+e,t);if(!r)throw Error(t);return r})().catch(r=>{throw delete be[t],r})}function st(e,t){try{let n=e.options._sdk??{name:I,version:S},r=t?.[n.name],i=e.options.debug||/^(localhost$|127\.|\[::1])|\.local$/.test(location.hostname);try{i||=process.env.NODE_ENV==="development"}catch{}if(!i||!r||r.version.localeCompare(n.version,"en",{numeric:!0})<1)return;let o=`blipit_latest_${r.version}`,a=sessionStorage;if(a[o])return;a[o]=1,console.info(`[blipit] ${r.version} is available (you have ${n.version})${r.note?` \u2014 ${r.note}`:""} \u2014 ${x.tag?`load ${x.exact.replace(S,r.version)}blipit.js`:`npm install ${n.name}@latest`}`)}catch{}}function Se(){let e=(navigator.language??"en").slice(0,2);return Y[e]?e:"en"}function Ee(e,t){let n=document.createElement("button");return n.type="button",n.className="blipit-rb",n.setAttribute("aria-haspopup","dialog"),e?n.textContent=e:(n.lang=Se(),n.textContent=Y[n.lang][0]),n.addEventListener("click",()=>n.hasAttribute("aria-busy")||t()),n}var _e=()=>{};function Re(e){_e=e}function Z(e,t){_e(C(e.endpoint,"/api/v1/feedback"),e.options.key,t)}function U(e){if(typeof document>"u")return;let t=typeof e.options.feedbackWidget=="object"?e.options.feedbackWidget:{},n=document.querySelectorAll("button.blipit-rb"),r=i=>{G(i),n.forEach(o=>i?o.setAttribute("aria-busy","true"):o.removeAttribute("aria-busy"))};r(!0),Promise.all([J("blipit-report.js","BlipitReport",t.src),ke??=$e(e)]).then(([i,o])=>o.enabled!==!1&&i.open(e,{metadata:ve,recording:o.recording===!0,recordingMaxMs:o.recording_max_ms,storageFull:o.storage_full===!0,reportsFull:o.reports_full===!0,theme:o.theme,hide:a=>_&&(_.style.display=a?"none":"")}),()=>Z(e,{eventId:e.lastEventId,name:e.user?.username,email:e.user?.email})).finally(()=>r(!1))}async function $e(e){let t=`blipit_fb_${S}_${e.options.key}`;try{let n=JSON.parse(localStorage.getItem(t)??"null");if(n&&Date.now()-n.t<36e5)return n.s}catch{}try{let n=await fetch(C(e.endpoint,"/api/v1/feedback/settings"),{headers:{"X-Blipit-Key":e.options.key,...e.options.instance?{"X-Blipit-Instance":e.options.instance}:{}}});if(!n.ok)return A(e,`widget settings failed (HTTP ${n.status}), using defaults`),{};let r=await n.json();try{localStorage.setItem(t,JSON.stringify({t:Date.now(),s:r}))}catch{}return r}catch{return A(e,"widget settings unreachable (offline, ad blocker or CSP connect-src), using defaults"),{}}}async function Q(e){let t=e.options.feedbackWidget,n=++ye;if(typeof document>"u")return;if(t===!1)return A(e,"Report a bug button off: feedbackWidget is false");let r=await(ke??=$e(e));if(st(e,r.latest),n!==ye)return;if(r.enabled===!1)return A(e,"Report a bug button hidden by the project's Bug report widget setting");let i={...r,...typeof t=="object"?t:{}},[o,a]=Y[Se()],d=i.text||o;_=document.createElement("div"),_.setAttribute("data-blipit-ui","");let c=_.attachShadow({mode:"open"}),s=document.createElement("button");s.type="button";let[l,h]=(/^(bottom|middle)-(left|right)$/.test(i.position??"")?i.position:"bottom-right").split("-");s.style.cssText=`${i.color?`--c:${i.color};`:""}${h}:calc(20px + env(safe-area-inset-${h},0px));${l==="bottom"?"bottom:calc(20px + env(safe-area-inset-bottom,0px))":"top:50%;margin-top:-22px"}`,s.setAttribute("aria-haspopup","dialog"),i.style==="icon"&&(s.className="o",s.title=d);let f=b=>{s.disabled=b,s.setAttribute("aria-label",b?a:d),s.innerHTML=b?"<i></i><span></span>":`${ot}<span></span>`,s.lastChild.textContent=b?a:d};G=f,f(!1),s.addEventListener("click",()=>U(e)),P(c,it),c.append(s);let m=i.shortcut?.toLowerCase().replace(/\s/g,"");L&&document.removeEventListener("keydown",L),L=void 0,m&&(L=b=>{[b.ctrlKey&&"ctrl",b.shiftKey&&"shift",b.altKey&&"alt",b.metaKey&&"meta",b.key.toLowerCase()].filter(Boolean).join("+")===m&&(b.preventDefault(),U(e))},document.addEventListener("keydown",L));let R=_,$=()=>{_===R&&(document.body.append(R),A(e,`Report a bug button shown at ${l}-${h}`))};document.body?$():document.addEventListener("DOMContentLoaded",$)}function Te(e,t){let n=e.options.feedbackWidget;e.options.feedbackWidget=t===!1?!1:{...typeof n=="object"?n:{},...t},_?.remove(),_=void 0,L&&document.removeEventListener("keydown",L),L=void 0,G=()=>{},Q(e)}function ee(e){return typeof e=="string"?e.length:e?.size}function Oe(e){return e&&Number(e)||void 0}function at(e,t){return async(n,r)=>{let i=typeof n=="string"?n:n instanceof URL?n.href:n.url,o=(r?.method??n.method??"GET").toUpperCase(),a=Date.now();try{let d=await e(n,r);return t(o,i,d.status,a,ee(r?.body),Oe(d.headers.get("content-length"))),d}catch(d){throw t(o,i,0,a,ee(r?.body)),d}}}function dt(e,t){let n=e.open,r=e.send;e.open=function(i,o){return this._blipit=[String(i).toUpperCase(),String(o)],n.apply(this,arguments)},e.send=function(i){let o=this._blipit;if(o){let a=Date.now();this.addEventListener("loadend",()=>t(o[0],o[1],this.status,a,ee(i),Oe(this.getResponseHeader("content-length"))))}return r.apply(this,arguments)}}function Ce(e){if(typeof window>"u")return;let t=C(e.endpoint,""),{console:n,network:r,actions:i}=e.logs;window.addEventListener("error",c=>{e.captureException(c.error??c.message,!1)}),window.addEventListener("unhandledrejection",c=>{e.captureException(c.reason,!1)}),typeof document<"u"&&(document.addEventListener("click",c=>{let s=c.target;if(!(s instanceof Element)||s.closest("[data-blipit-ui]"))return;let l=X(s);e.addBreadcrumb({category:"ui.click",message:`Clicked ${l}`});let h=s.closest(de)?"***":p((s.textContent??"").trim().replace(/\s+/g," "),80);E(i,{timestamp:v(),type:"click",selector:l,text:h},50)},{capture:!0,passive:!0}),document.addEventListener("focusin",c=>{let s=c.target;s instanceof Element&&/^(INPUT|TEXTAREA|SELECT)$/.test(s.tagName)&&E(i,{timestamp:v(),type:"focus",selector:X(s)},50)},{capture:!0,passive:!0}));let o=(c,s,l,h,f,m)=>{t&&s.startsWith(t)||(e.addBreadcrumb({category:"http",message:`${c} ${M(s)} \u2192 ${l||"network error"}`,level:l>=400||!l?"error":"info",data:{url:M(s),method:c,status_code:l||void 0}}),E(r,{timestamp:v(),method:c,url:V(s),status:l,duration:Date.now()-h,request_size:f,response_size:m},50))};typeof window.fetch=="function"&&(window.fetch=at(window.fetch.bind(window),o)),typeof XMLHttpRequest<"u"&&dt(XMLHttpRequest.prototype,o);for(let c of["log","info","debug","warn","error"]){let s=console[c].bind(console);console[c]=(...l)=>{let h=p(l.map(f=>typeof f=="string"?f:ct(f)).join(" "),1024);if(c==="warn"||c==="error"){e.addBreadcrumb({category:"console",level:c==="warn"?"warning":"error",message:h});let f=l.find(m=>m instanceof Error);E(n,{timestamp:v(),level:c,message:h,stack:p((f??new Error).stack??"",2e3)},100)}else E(n,{timestamp:v(),level:c,message:h},100);s(...l)}}let a=()=>E(i,{timestamp:v(),type:"navigation",url:V(location.href)},50),d=()=>{e.addBreadcrumb({category:"navigation",message:`Navigated to ${M(location.href)}`}),a()};if(a(),window.history){let c=window.history.pushState.bind(window.history);window.history.pushState=(...s)=>{c(...s),d()},window.addEventListener("popstate",d)}}function ct(e){try{return JSON.stringify(e)??String(e)}catch{return String(e)}}function Le(){let e=0,t=0,n=0,r=0;return i=>(i.hadRecentInput||(t>0&&i.startTime-r<1e3&&i.startTime-n<5e3?t+=i.value:(t=i.value,n=i.startTime),r=i.startTime,t>e&&(e=t)),e)}function ut(e){if(e.size===0)return;let t=[...e.values()].sort((n,r)=>r-n);return t[Math.min(t.length-1,Math.floor(e.size/50))]}function lt(e){return/iPad|Tablet|Android(?!.*Mobile)/i.test(e)?"tablet":/Mobi|iPhone|Android/i.test(e)?"mobile":"desktop"}function F(e,t,n){try{new PerformanceObserver(r=>r.getEntries().forEach(i=>t(i))).observe({type:e,buffered:!0,...n})}catch{}}function Me(e,t,n){if(typeof PerformanceObserver>"u"||typeof document>"u")return;let r=performance.getEntriesByType("navigation")[0],i=r?.activationStart??0,o=y=>Math.max(0,Math.round(y-i)),a=document.visibilityState==="hidden",d=location.pathname,c=r?.type,s={},l=Le(),h=new Map,f=!1,m=!1;r&&r.responseStart>0&&(s.ttfb=o(r.responseStart)),a||(F("paint",y=>{y.name==="first-contentful-paint"&&(s.fcp=o(y.startTime))}),F("largest-contentful-paint",y=>{f||(s.lcp=o(y.startTime))}));let R=()=>{f=!0};addEventListener("keydown",R,{once:!0,capture:!0}),addEventListener("pointerdown",R,{once:!0,capture:!0}),F("layout-shift",y=>{s.cls=Math.round(l(y)*1e4)/1e4});let $=y=>{if(!y.interactionId)return;h.set(y.interactionId,Math.max(h.get(y.interactionId)??0,y.duration));let ne=ut(h);ne!==void 0&&(s.inp=Math.round(ne))};F("event",$,{durationThreshold:40}),F("first-input",$);let b=navigator.connection?.effectiveType,T=`${new URL("/api/v1/vitals",e).href}?key=${encodeURIComponent(t)}${n?`&instance=${encodeURIComponent(n)}`:""}`,w=()=>{if(m||Object.keys(s).length===0)return;m=!0;let y=JSON.stringify({path:d.slice(0,512),metrics:s,nav:c,connection:b&&/^(slow-2g|2g|3g|4g)$/.test(b)?b:void 0,device:lt(navigator.userAgent)});try{if(navigator.sendBeacon?.(T,y))return}catch{}fetch(T,{method:"POST",body:y,keepalive:!0}).catch(()=>{})},O=()=>{location.pathname!==d&&(w(),d=location.pathname,c="route",s={},l=Le(),h=new Map,f=!0,m=!1)};document.addEventListener("visibilitychange",()=>document.visibilityState==="hidden"&&w()),addEventListener("pagehide",w),addEventListener("popstate",O);let N=history.pushState;history.pushState=function(...y){N.apply(this,y),O()}}function pt(e,t=Math.random){return t()<(e.sessionSampleRate??0)?"session":t()<(e.onErrorSampleRate??1)?"buffer":null}function Be(e,t,n,r){let i=pt(e);if(!i||typeof document>"u")return;let o=B(),a;return J("blipit-replay.js","BlipitReplay",e.src).then(d=>a=d.start({id:o,mode:i,endpoint:t,key:n,instance:r}),()=>{}),{id:o,active:()=>a?.active()??!1,error:d=>a?.error(d),report:d=>a?.report?.(d)}}var Ie='<svg viewBox="0 0 242.4 208.7" aria-hidden="true"><defs><linearGradient id="bm1" x1="0" y1="1" x2=".5" y2="0"><stop offset="0" stop-color="#00C2FF"/><stop offset=".35" stop-color="#3882F6"/><stop offset="1" stop-color="#0F172A"/></linearGradient><linearGradient id="bm2" x1="0" y1="1" x2="1" y2="0"><stop offset="0" stop-color="#3882F6"/><stop offset=".5" stop-color="#00C2FF"/><stop offset="1" stop-color="#3882F6"/></linearGradient></defs><path fill="url(#bm1)" d="M115.5,164.5c-3.9,0-7.8-.4-11.5-1.2-3.7-.8-7.3-1.9-10.8-3.4-3.4-1.4-6.7-3.2-9.7-5.3-3.0-2.0-5.9-4.4-8.5-7.0s-4.9-5.4-7.0-8.5c-2.1-3.1-3.9-6.3-5.3-9.8-1.5-3.5-2.6-7.1-3.4-10.8-.8-3.8-1.2-7.7-1.2-11.5V19.1c0-6.6,5.4-12.0,12.0-12.0s12.0,5.4,12.0,12.0v88.2c0,2.2.2,4.5.7,6.7.4,2.1,1.1,4.2,1.9,6.2.8,2.0,1.9,3.9,3.1,5.7,1.2,1.8,2.6,3.4,4.1,4.9s3.2,2.9,4.9,4.1c1.8,1.2,3.7,2.2,5.6,3.1,2.0.8,4.1,1.5,6.2,1.9,4.4.9,9.1.9,13.4,0,2.1-.4,4.2-1.1,6.2-1.9,2.0-.8,3.9-1.9,5.7-3.1,1.8-1.2,3.4-2.6,4.9-4.1s2.9-3.2,4.1-4.9c1.2-1.8,2.2-3.7,3.1-5.7.8-2.0,1.5-4.1,1.9-6.2.5-2.2.7-4.5.7-6.7s-.2-4.5-.7-6.7c-.4-2.1-1.1-4.2-1.9-6.2-.8-2.0-1.9-3.9-3.1-5.7-1.2-1.8-2.6-3.4-4.1-4.9s-3.2-2.9-4.9-4.1c-1.8-1.2-3.7-2.2-5.7-3.1-2.0-.8-4.1-1.5-6.2-1.9-4.4-.9-9.1-.9-13.4,0-6.5,1.3-12.9-2.9-14.2-9.4-1.3-6.5,2.9-12.9,9.4-14.2,7.6-1.6,15.5-1.6,23.1,0,3.7.8,7.3,1.9,10.8,3.4,3.4,1.4,6.7,3.2,9.7,5.3,3.0,2.0,5.9,4.4,8.5,7.0s4.9,5.4,7.0,8.5c2.1,3.1,3.9,6.3,5.3,9.8,1.5,3.5,2.6,7.1,3.4,10.8.8,3.8,1.2,7.7,1.2,11.5s-.4,7.8-1.2,11.5c-.8,3.7-1.9,7.3-3.4,10.8-1.4,3.4-3.2,6.7-5.3,9.7-2.0,3.0-4.4,5.9-7.0,8.5s-5.4,4.9-8.5,7.0c-3.1,2.1-6.3,3.9-9.8,5.3-3.5,1.5-7.1,2.6-10.8,3.4-3.8.8-7.7,1.2-11.5,1.2Z"/><path fill="url(#bm2)" d="M208.1,103.0c-.0-.6-.8-.9-1.2-.5-3.2,3.1-7.6,5.0-12.4,5.0-3.9,0-9.1-1.6-10.2-2.5-.3-.1-.1,1.4-.1,2.5,0,40.5-34.4,73.0-75.5,70.0-33.4-2.5-60.8-28.8-64.4-62.1-1.0-9.4-.2-18.6,2.2-27.0,1.6-5.6,2.6-11.4,2.6-17.3v-22.4c0-3.4-4.3-5.0-6.5-2.4-13.2,15.4-21.6,35.1-22.7,56.6-2.6,54.1,40.6,98.9,94.1,98.9s94.2-42.3,94.2-94.2c0-1.5-.1-3.0-.1-4.5Z"/><path fill="url(#bm2)" d="M201.2,70.1c-14.8-35.8-50.9-60.5-92.3-58.3h-.1c-8.2.5-14.6,7.4-14.6,15.7v.1c0,5.4,4.7,9.6,10.0,8.8,3.2-.5,6.5-.7,9.9-.7,28.7,0,53.5,17.4,64.3,42.1.2.5.9.6,1.2.1,3.2-4.8,8.7-7.9,14.9-7.9,2.0,0,4.0.3,5.8,1.0.6.2,1.1-.4.9-1.0Z"/><circle fill="#00C2FF" cx="194.5" cy="88" r="15.8"/></svg>';var u=".blipit-rb.blipit-rb",ft=`${u}{all:unset;box-sizing:border-box;display:inline-flex;align-items:center;gap:9px;height:40px;padding-inline:5px 17px;border-radius:99px;font:600 14px/1 system-ui,-apple-system,"Segoe UI",sans-serif;letter-spacing:-.01em;white-space:nowrap;cursor:pointer;user-select:none;-webkit-tap-highlight-color:transparent;color:#fff;background:linear-gradient(135deg,#3882F6,#2F5BEA);box-shadow:0 10px 24px -12px rgba(56,130,246,.8),0 1px 3px rgba(11,26,58,.16),inset 0 1px 0 rgba(255,255,255,.22);transition:transform .2s,box-shadow .2s}${u}:hover{transform:translateY(-1px);box-shadow:0 16px 32px -12px rgba(56,130,246,.85),0 2px 6px rgba(11,26,58,.18),inset 0 1px 0 rgba(255,255,255,.22)}${u}:active{transform:scale(.97)}${u}:focus-visible{outline:3px solid #00C2FF;outline-offset:3px}${u}[aria-busy=true]{cursor:progress}${u}>span{all:unset}${u}>.blipit-rb-m{position:relative;display:grid;place-items:center;flex:none;width:30px;height:30px;border-radius:99px;background:#fff;box-shadow:0 0 0 1px rgba(11,26,58,.08),0 1px 2px rgba(11,26,58,.12)}${u} svg{display:block;width:19px;height:17px}${u}[data-size=sm]{height:32px;gap:7px;padding-inline:4px 13px;font-size:13px}${u}[data-size=sm]>.blipit-rb-m{width:24px;height:24px}${u}[data-size=sm] svg{width:15px;height:13px}${u}[data-variant=outline],${u}[data-variant=ghost]{color:#0B1A3A;background:transparent;box-shadow:inset 0 0 0 1px #CBD7EA}${u}[data-variant=ghost]{box-shadow:none}${u}[data-variant=outline]:hover,${u}[data-variant=ghost]:hover{transform:none;background:rgba(56,130,246,.08);box-shadow:inset 0 0 0 1px rgba(56,130,246,.45)}${u}[data-variant=ghost]:hover{box-shadow:none}${u}[data-theme=dark]{background:linear-gradient(135deg,#5B9BFF,#3D6BF0);box-shadow:0 10px 24px -12px rgba(91,155,255,.7),inset 0 1px 0 rgba(255,255,255,.2)}${u}[data-theme=dark][data-variant=outline],${u}[data-theme=dark][data-variant=ghost]{color:#E8EEF8;background:transparent;box-shadow:inset 0 0 0 1px rgba(255,255,255,.16)}${u}[data-theme=dark][data-variant=ghost]{box-shadow:none}${u}[data-theme=dark][data-variant=outline]:hover,${u}[data-theme=dark][data-variant=ghost]:hover{background:rgba(91,155,255,.16);box-shadow:inset 0 0 0 1px rgba(91,155,255,.45)}${u}[data-theme=dark][data-variant=ghost]:hover{box-shadow:none}${u}[data-theme=dark]>.blipit-rb-m{box-shadow:0 0 0 1px rgba(255,255,255,.1)}${u}[aria-busy=true] svg{visibility:hidden}${u}[aria-busy=true]>.blipit-rb-m::after{content:"";position:absolute;inset:4px;border:2px solid #3882F6;border-right-color:transparent;border-radius:50%;animation:blipit-rb-r .8s linear infinite}@keyframes blipit-rb-r{to{transform:rotate(1turn)}}@media(pointer:coarse){${u}{min-height:44px}}@media(prefers-reduced-motion:reduce){${u}{transition:none}${u}:hover,${u}:active{transform:none}${u}[aria-busy=true]>.blipit-rb-m::after{animation-duration:3s}}@media(forced-colors:active){${u}{border:1px solid ButtonText}}`,Ae=0;function Fe(e,t={}){Ae||P(document,ft);let n=++Ae,r=document.createElement("span");r.className="blipit-rb-m",r.innerHTML=Ie.replace(/bm(\d)/g,`bm$1-${n}`);let i=document.createElement("span");i.textContent=e.textContent,e.replaceChildren(r,i),e.classList.add("blipit-rb"),e.setAttribute("data-variant",t.variant==="outline"||t.variant==="ghost"?t.variant:"solid"),e.setAttribute("data-size",t.size==="sm"?"sm":"md"),e.setAttribute("data-theme",le(t.theme==="light"||t.theme==="dark"?t.theme:void 0))}var g,Ne=new Set;function De(e,t){Ne.has(t)||(Ne.add(t),console[e](t))}var mt="[blipit] init() has no key, so error tracking and the Report a bug button are off. Pass your public key (blipit_pk_...) from app.blipit.io, API keys.",gt="[blipit] init() got a secret key (blipit_sk_...), so Blipit did not start: secret keys must never be in browser code. Use the public key (blipit_pk_...) and create a new secret key in app.blipit.io, API keys.";function ht(e){if(g)return;let t=typeof e?.key=="string"?e.key.trim():"";if(!t)return De("warn",mt);if(t.startsWith("blipit_sk_"))return De("error",gt);if(g=new j({...e,key:t}),e.sdkChannel==="exact"&&(x.channel=x.exact),x.debug=!!e.debug,e.user){let{id:n,name:r,email:i,username:o}=e.user;g.setUser({id:n===void 0?void 0:String(n),email:i,username:o??r})}Ce(g),e.webVitals!==!1&&typeof window<"u"&&Me(e.endpoint??K,t,e.instance),e.replay&&(g.replay=Be(e.replay,e.endpoint??K,t,e.instance)),typeof window<"u"&&Q(g),e.debug&&console.log(`[blipit] ${I}@${S} initialized`)}function bt(e){return g?.captureException(e,!0)}function yt(e,t){return g?.captureMessage(e,t)}function xt(e){return g?.captureSecurity(e)}function vt(e){g?.setUser(e)}function kt(e,t){g?.setTag(e,t)}function wt(e){g?.addBreadcrumb(e)}function St(e={}){g&&Z(g,{...e,eventId:e.eventId??g.lastEventId})}function te(){g&&U(g)}function Et(e){e.addEventListener("click",t=>{t.preventDefault(),te()})}function _t(e={}){let t=Ee(e.label,te);return Fe(t,e),t}function Rt(e){g&&Te(g,e)}function $t(){return g?.flush()??Promise.resolve()}Re(oe);0&&(module.exports={addBreadcrumb,attachReport,captureException,captureMessage,captureSecurity,flush,init,openReport,reportButton,setReportMetadata,setTag,setUser,showFeedback,updateWidget});
package/dist/index.d.cts CHANGED
@@ -46,6 +46,11 @@ interface BlipitOptions {
46
46
  id?: string | number;
47
47
  name?: string;
48
48
  };
49
+ sdkChannel?: "compatible" | "exact";
50
+ _sdk?: {
51
+ name: string;
52
+ version: string;
53
+ };
49
54
  }
50
55
  interface ReplayOptions {
51
56
  sessionSampleRate?: number;
package/dist/index.d.ts CHANGED
@@ -46,6 +46,11 @@ interface BlipitOptions {
46
46
  id?: string | number;
47
47
  name?: string;
48
48
  };
49
+ sdkChannel?: "compatible" | "exact";
50
+ _sdk?: {
51
+ name: string;
52
+ version: string;
53
+ };
49
54
  }
50
55
  interface ReplayOptions {
51
56
  sessionSampleRate?: number;
@@ -1,2 +1,2 @@
1
- "use strict";var Blipit=(()=>{var U=Object.defineProperty;var Re=Object.getOwnPropertyDescriptor;var _e=Object.getOwnPropertyNames;var Be=Object.prototype.hasOwnProperty;var Te=(e,t)=>{for(var n in t)U(e,n,{get:t[n],enumerable:!0})},Oe=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of _e(t))!Be.call(e,i)&&i!==n&&U(e,i,{get:()=>t[i],enumerable:!(r=Re(t,i))||r.enumerable});return e};var Ce=e=>Oe(U({},"__esModule",{value:!0}),e);var ct={};Te(ct,{addBreadcrumb:()=>it,attachReport:()=>ot,captureException:()=>Qe,captureMessage:()=>Ze,captureSecurity:()=>et,flush:()=>at,init:()=>Ge,openReport:()=>D,reportButton:()=>dt,setReportMetadata:()=>he,setTag:()=>nt,setUser:()=>tt,showFeedback:()=>rt,updateWidget:()=>st});var Z=["login_failed","login_succeeded","login_blocked","password_reset_requested","privilege_granted"];var I=class{constructor(t,n,r,i){this.endpoint=t;this.key=n;this.debug=r;this.instance=i;typeof document<"u"&&document.addEventListener&&document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&this.flushWithBeacon()})}endpoint;key;debug;instance;queue=[];timer;sending=!1;enqueue(t){this.queue.push(t),this.queue.length>30&&this.queue.shift(),this.timer||(this.timer=setTimeout(()=>{this.timer=void 0,this.flush()},1e3))}async flush(){if(!this.sending){this.sending=!0;try{for(;this.queue.length>0;){let t=this.queue[0];if(!await this.send(t))break;this.queue.shift()}}finally{this.sending=!1}}}async send(t,n=0){try{let r=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json","X-Blipit-Key":this.key,...this.instance?{"X-Blipit-Instance":this.instance}:{}},body:JSON.stringify(t),keepalive:!0});return r.status===429||r.status>=500?this.retry(t,n):(this.debug&&r.status>=400&&console.warn("[blipit] event rejected",r.status,await r.text()),!0)}catch{return this.retry(t,n)}}async retry(t,n){return n>=2?(this.debug&&console.warn("[blipit] dropping event after retries",t.event_id),!0):(await new Promise(r=>setTimeout(r,1e3*2**n)),this.send(t,n+1))}flushWithBeacon(){if(!(typeof navigator>"u"||!navigator.sendBeacon))for(;this.queue.length>0;){let t=this.queue.shift(),n=`key=${encodeURIComponent(this.key)}${this.instance?`&instance=${encodeURIComponent(this.instance)}`:""}`,r=`${this.endpoint}${this.endpoint.includes("?")?"&":"?"}${n}`;navigator.sendBeacon(r,JSON.stringify(t))}}};function R(){let e=new Uint8Array(16);if(typeof crypto<"u"&&crypto.getRandomValues)crypto.getRandomValues(e);else for(let n=0;n<16;n++)e[n]=Math.floor(Math.random()*256);e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let n=0;n<16;n++)t+=e[n].toString(16).padStart(2,"0");return t}function b(){return new Date().toISOString()}var Ie=/token|key|password|secret|auth|session|passwd|api/i;function w(e){let t=e.indexOf("?");if(t===-1)return e.slice(0,2048);let n=e.slice(0,t),i=e.slice(t+1).split("&").map(o=>{let d=o.indexOf("=");if(d===-1)return o;let c=o.slice(0,d);return Ie.test(c)?`${c}=[redacted]`:o}).join("&");return`${n}?${i}`.slice(0,2048)}var Le=/\b((?:[a-zA-Z0-9_-]*(?:token|key|password|secret|auth|session|passwd|api)[a-zA-Z0-9_-]*)=)[^&\s"']+/gi;function ee(e){return e.replace(Le,"$1[redacted]")}function u(e,t){return e.length>t?e.slice(0,t):e}var te=".blipit-mask,[data-blipit-mask]";function F(e){return e.replace(/#.*/,"").replace(/([?&][^=&]*)=[^&]*/g,"$1=").slice(0,2048)}function v(e,t,n){e.push(t),e.length>n&&e.shift()}function j(e){let t=e.id?`#${e.id}`:"",n=typeof e.className=="string"&&e.className.trim()?`.${e.className.trim().split(/\s+/).slice(0,2).join(".")}`:"";return u(`${e.tagName.toLowerCase()}${t}${n}`,128)}function ne(e,t){try{let n=new CSSStyleSheet;n.replaceSync(t),e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]}catch{let n=document.createElement("style");n.textContent=t,(e===document?document.head:e).append(n)}}function S(e,t){return`${e.replace(/\/api\/v1\/events.*$/,"").replace(/\/$/,"")}${t}`}function ie(e,t){let n=e?/^(https?:\/\/[^?#]*\/)blipit(?:\.min)?\.js(?:[?#].*)?$/.exec(e):null;return n?n[1]:`https://blipit.io/sdk/${t}/`}var re={ok:0,errored:1,crashed:2},L=class{constructor(t,n,r,i){this.url=t;this.key=n;this.release=r;this.environment=i;this.start(),typeof document<"u"&&document.addEventListener&&document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.end():this.sid||this.start()})}url;key;release;environment;sid="";started="";status="ok";errors=0;did;setUser(t){this.did=t}markError(t){if(!this.sid)return;this.errors+=1;let n=t?"crashed":"errored";re[n]<=re[this.status]||(this.status=n,this.send(!1))}start(){this.sid=R(),this.started=b(),this.status="ok",this.errors=0,this.send(!1)}end(){this.sid&&(this.send(!0),this.sid="")}send(t){let n=JSON.stringify({sid:this.sid,did:this.did,status:this.status==="ok"&&t?"exited":this.status,errors:this.errors,started:this.started,release:this.release,environment:this.environment}),r=`${this.url}?key=${encodeURIComponent(this.key)}`;try{if(t&&typeof navigator<"u"&&navigator.sendBeacon){navigator.sendBeacon(r,n);return}if(typeof fetch>"u")return;fetch(this.url,{method:"POST",headers:{"Content-Type":"application/json","X-Blipit-Key":this.key},body:n,keepalive:!0}).catch(()=>{})}catch{return}}};var $e=/^\s*at (?:async )?(?:new )?(?:(.+?) )?\(?((?:file|https?|blob|chrome-extension|moz-extension|safari-web-extension|node|webpack):.*?|[^()]+?)(?::(\d+))?(?::(\d+))?\)?\s*$/,Me=/^\s*(?:(.*?)@)?((?:file|https?|blob|chrome-extension|moz-extension|safari-web-extension|node|webpack).*?|[^@]*?)(?::(\d+))?(?::(\d+))?\s*$/,oe=/^(chrome|moz|safari-web)-extension:/;function Ae(){if(typeof location<"u"&&location.origin)return location.origin}function Ne(e){if(oe.test(e)||e==="<anonymous>"||e==="[native code]")return!1;let t=Ae();return!!(!t||e.startsWith(t)||!/^[a-z]+:/i.test(e))}function se(e){if(!e)return[];let t=[];for(let n of e.split(`
2
- `)){if(!n||/^\s*(Error|TypeError|RangeError|SyntaxError|ReferenceError)\b/.test(n))continue;let r=$e.exec(n)??Me.exec(n);if(!r)continue;let[,i,o,d,c]=r;if(!o)continue;let a={filename:u(o,1024),in_app:Ne(o)};i&&(a.function=u(i,512)),d&&(a.lineno=Number(d)),c&&(a.colno=Number(c)),t.push(a)}return t.reverse(),t.slice(-128)}function ae(e){return e.length===0?!1:e.every(t=>oe.test(t.filename))}var K="@blipit/browser",_="0.3.10",E=ie(typeof document<"u"?document.currentScript?.src:void 0,_),M="https://in.blipit.io/api/v1/events",De=[/ResizeObserver loop/i,/^Script error\.?$/,/__gCrWeb|__firefox__/],Pe={login_failed:"Failed login",login_succeeded:"Successful login",login_blocked:"Blocked login",password_reset_requested:"Password reset requested",privilege_granted:"Privilege granted"},Ue={login_failed:"warning",login_succeeded:"info",login_blocked:"warning",password_reset_requested:"info",privilege_granted:"warning"};function Fe(e){if(!Z.includes(e?.kind))return;let t=u(String(e.actor??"").trim(),256);if(!t)return;let n={kind:e.kind,actor:t};return e.actorId&&(n.actor_id=u(String(e.actorId),128)),e.ip&&(n.ip=u(String(e.ip).trim(),45)),e.userAgent&&(n.user_agent=u(String(e.userAgent),512)),e.database&&(n.database=u(String(e.database),64)),e.outcome&&(n.outcome=u(String(e.outcome),64)),e.target&&(n.target=u(String(e.target),256)),n}var $=class{constructor(t){this.options=t;this.endpoint=t.endpoint??M,this.transport=new I(this.endpoint,t.key,t.debug??!1,t.instance),t.autoSessionTracking&&(t.release?this.session=new L(S(this.endpoint,"/api/v1/sessions"),t.key,t.release,t.environment??"production"):t.debug&&console.warn("[blipit] session tracking needs the release option")),this.maxBreadcrumbs=Math.min(t.maxBreadcrumbs??50,100),this.ignoreErrors=[...De,...t.ignoreErrors??[]]}options;transport;breadcrumbs=[];user;tags={};maxBreadcrumbs;ignoreErrors;seen=new Set;captured=new WeakSet;session;lastEventId;errorIds=[];logs={console:[],network:[],actions:[]};endpoint;replay;setUser(t){this.user=t,this.session?.setUser(t?.id??t?.email)}setTag(t,n){this.tags[u(t,64)]=u(n,256)}addBreadcrumb(t){let n={timestamp:b(),...t};n.message&&(n.message=ee(n.message)),n.data&&typeof n.data.url=="string"&&(n.data={...n.data,url:w(n.data.url)}),this.breadcrumbs.push(n),this.breadcrumbs.length>this.maxBreadcrumbs&&this.breadcrumbs.shift()}captureException(t,n=!0){if(t&&typeof t=="object"){if(this.captured.has(t))return;this.captured.add(t)}let r=t instanceof Error?t:new Error(String(t)),i={type:r.name||"Error",value:u(r.message||String(r),4096),handled:n},o=se(r.stack);return o.length>0&&(i.stacktrace={frames:o}),this.processAndSend({exception:i,level:"error"})}captureMessage(t,n="info"){return this.processAndSend({message:u(t,8192),level:n})}captureSecurity(t){let n=Fe(t);if(!n){this.options.debug&&console.warn("[blipit] security event dropped, needs a known kind and an actor");return}return this.processAndSend({message:`${Pe[n.kind]} for ${n.actor}`,level:Ue[n.kind],security:n},!1)}processAndSend(t,n=!0){if(n&&this.options.sampleRate!==void 0&&Math.random()>this.options.sampleRate)return;let r=t.exception?.value??t.message??"";if(n){for(let c of this.ignoreErrors)if(typeof c=="string"?r.includes(c):c.test(r))return;if((this.options.autoMuteExtensions??!0)&&t.exception?.stacktrace&&ae(t.exception.stacktrace.frames))return;let d=`${t.exception?.type??""}|${r}`;if(t.exception?.handled===!1){if(this.seen.has(d)&&this.seen.size<100)return;this.seen.add(d),setTimeout(()=>this.seen.delete(d),5e3)}}let i={event_id:R(),timestamp:b(),platform:"javascript",release:this.options.release,environment:this.options.environment??"production",user:this.user,tags:Object.keys(this.tags).length>0?{...this.tags}:void 0,breadcrumbs:this.breadcrumbs.length>0?[...this.breadcrumbs]:void 0,request:typeof location<"u"?{url:w(location.href)}:void 0,contexts:this.collectContexts(),sdk:{name:K,version:_},...t};for(let d of Object.keys(i))i[d]===void 0&&delete i[d];let o=this.replay?.active()&&(i.level==="error"||i.level==="fatal")?this.replay:void 0;if(o&&(i.tags={...i.tags,replay_id:o.id}),this.options.beforeSend){let d=this.options.beforeSend(i);if(!d)return;i=d}return this.transport.enqueue(i),this.lastEventId=i.event_id,(i.level==="error"||i.level==="fatal")&&v(this.errorIds,i.event_id,20),i.exception&&this.session?.markError(i.exception.handled===!1),o?.error(i.event_id),i.event_id}collectContexts(){if(typeof navigator>"u")return;let t={},n=navigator.userAgent??"",r=/(Edg|OPR|Chrome|Firefox|Safari)\/(\d+[\d.]*)/.exec(n)??void 0;r&&(t.browser={name:r[1],version:r[2]});let i=/\(([^)]+)\)/.exec(n);return i&&i[1]&&(t.os={name:u(i[1],64)}),typeof screen<"u"&&(t.device={screen:`${screen.width}x${screen.height}`}),Object.keys(t).length>0?t:void 0}flush(){return this.transport.flush()}};function q(e){return typeof e=="string"?e.length:e?.size}function de(e){return e&&Number(e)||void 0}function je(e,t){return async(n,r)=>{let i=typeof n=="string"?n:n instanceof URL?n.href:n.url,o=(r?.method??n.method??"GET").toUpperCase(),d=Date.now();try{let c=await e(n,r);return t(o,i,c.status,d,q(r?.body),de(c.headers.get("content-length"))),c}catch(c){throw t(o,i,0,d,q(r?.body)),c}}}function Ke(e,t){let n=e.open,r=e.send;e.open=function(i,o){return this._blipit=[String(i).toUpperCase(),String(o)],n.apply(this,arguments)},e.send=function(i){let o=this._blipit;if(o){let d=Date.now();this.addEventListener("loadend",()=>t(o[0],o[1],this.status,d,q(i),de(this.getResponseHeader("content-length"))))}return r.apply(this,arguments)}}function ce(e){if(typeof window>"u")return;let t=S(e.endpoint,""),{console:n,network:r,actions:i}=e.logs;window.addEventListener("error",a=>{e.captureException(a.error??a.message,!1)}),window.addEventListener("unhandledrejection",a=>{e.captureException(a.reason,!1)}),typeof document<"u"&&(document.addEventListener("click",a=>{let s=a.target;if(!(s instanceof Element)||s.closest("[data-blipit-ui]"))return;let l=j(s);e.addBreadcrumb({category:"ui.click",message:`Clicked ${l}`});let m=s.closest(te)?"***":u((s.textContent??"").trim().replace(/\s+/g," "),80);v(i,{timestamp:b(),type:"click",selector:l,text:m},50)},{capture:!0,passive:!0}),document.addEventListener("focusin",a=>{let s=a.target;s instanceof Element&&/^(INPUT|TEXTAREA|SELECT)$/.test(s.tagName)&&v(i,{timestamp:b(),type:"focus",selector:j(s)},50)},{capture:!0,passive:!0}));let o=(a,s,l,m,h,y)=>{t&&s.startsWith(t)||(e.addBreadcrumb({category:"http",message:`${a} ${w(s)} \u2192 ${l||"network error"}`,level:l>=400||!l?"error":"info",data:{url:w(s),method:a,status_code:l||void 0}}),v(r,{timestamp:b(),method:a,url:F(s),status:l,duration:Date.now()-m,request_size:h,response_size:y},50))};typeof window.fetch=="function"&&(window.fetch=je(window.fetch.bind(window),o)),typeof XMLHttpRequest<"u"&&Ke(XMLHttpRequest.prototype,o);for(let a of["log","info","debug","warn","error"]){let s=console[a].bind(console);console[a]=(...l)=>{let m=u(l.map(h=>typeof h=="string"?h:qe(h)).join(" "),1024);if(a==="warn"||a==="error"){e.addBreadcrumb({category:"console",level:a==="warn"?"warning":"error",message:m});let h=l.find(y=>y instanceof Error);v(n,{timestamp:b(),level:a,message:m,stack:u((h??new Error).stack??"",2e3)},100)}else v(n,{timestamp:b(),level:a,message:m},100);s(...l)}}let d=()=>v(i,{timestamp:b(),type:"navigation",url:F(location.href)},50),c=()=>{e.addBreadcrumb({category:"navigation",message:`Navigated to ${w(location.href)}`}),d()};if(d(),window.history){let a=window.history.pushState.bind(window.history);window.history.pushState=(...s)=>{a(...s),c()},window.addEventListener("popstate",c)}}function qe(e){try{return JSON.stringify(e)??String(e)}catch{return String(e)}}function ue(){let e=0,t=0,n=0,r=0;return i=>(i.hadRecentInput||(t>0&&i.startTime-r<1e3&&i.startTime-n<5e3?t+=i.value:(t=i.value,n=i.startTime),r=i.startTime,t>e&&(e=t)),e)}function We(e){if(e.size===0)return;let t=[...e.values()].sort((n,r)=>r-n);return t[Math.min(t.length-1,Math.floor(e.size/50))]}function He(e){return/iPad|Tablet|Android(?!.*Mobile)/i.test(e)?"tablet":/Mobi|iPhone|Android/i.test(e)?"mobile":"desktop"}function O(e,t,n){try{new PerformanceObserver(r=>r.getEntries().forEach(i=>t(i))).observe({type:e,buffered:!0,...n})}catch{}}function pe(e,t,n){if(typeof PerformanceObserver>"u"||typeof document>"u")return;let r=performance.getEntriesByType("navigation")[0],i=r?.activationStart??0,o=f=>Math.max(0,Math.round(f-i)),d=document.visibilityState==="hidden",c=location.pathname,a=r?.type,s={},l=ue(),m=new Map,h=!1,y=!1;r&&r.responseStart>0&&(s.ttfb=o(r.responseStart)),d||(O("paint",f=>{f.name==="first-contentful-paint"&&(s.fcp=o(f.startTime))}),O("largest-contentful-paint",f=>{h||(s.lcp=o(f.startTime))}));let B=()=>{h=!0};addEventListener("keydown",B,{once:!0,capture:!0}),addEventListener("pointerdown",B,{once:!0,capture:!0}),O("layout-shift",f=>{s.cls=Math.round(l(f)*1e4)/1e4});let T=f=>{if(!f.interactionId)return;m.set(f.interactionId,Math.max(m.get(f.interactionId)??0,f.duration));let Q=We(m);Q!==void 0&&(s.inp=Math.round(Q))};O("event",T,{durationThreshold:40}),O("first-input",T);let g=navigator.connection?.effectiveType,J=`${new URL("/api/v1/vitals",e).href}?key=${encodeURIComponent(t)}${n?`&instance=${encodeURIComponent(n)}`:""}`,P=()=>{if(y||Object.keys(s).length===0)return;y=!0;let f=JSON.stringify({path:c.slice(0,512),metrics:s,nav:a,connection:g&&/^(slow-2g|2g|3g|4g)$/.test(g)?g:void 0,device:He(navigator.userAgent)});try{if(navigator.sendBeacon?.(J,f))return}catch{}fetch(J,{method:"POST",body:f,keepalive:!0}).catch(()=>{})},G=()=>{location.pathname!==c&&(P(),c=location.pathname,a="route",s={},l=ue(),m=new Map,h=!0,y=!1)};document.addEventListener("visibilitychange",()=>document.visibilityState==="hidden"&&P()),addEventListener("pagehide",P),addEventListener("popstate",G);let Ee=history.pushState;history.pushState=function(...f){Ee.apply(this,f),G()}}function ze(e,t=Math.random){return t()<(e.sessionSampleRate??0)?"session":t()<(e.onErrorSampleRate??1)?"buffer":null}function le(e,t,n,r,i){let o=ze(e);if(!o||typeof document>"u")return;let d=R(),c,a=document.createElement("script");return a.src=e.src??`${i}blipit-replay.js`,a.async=!0,a.onload=()=>{let s=window.BlipitReplay?.start;c=s?.({id:d,mode:o,endpoint:t,key:n,instance:r})},document.head.appendChild(a),{id:d,active:()=>c?.active()??!1,error:s=>c?.error(s),report:s=>c?.report?.(s)}}var H={en:["Report a bug","Loading\u2026"],ar:["\u0623\u0628\u0644\u063A \u0639\u0646 \u062E\u0637\u0623","\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u062D\u0645\u064A\u0644\u2026"],de:["Fehler melden","Wird geladen\u2026"],es:["Reportar un error","Cargando\u2026"],fr:["Signaler un bug","Chargement\u2026"],it:["Segnala un bug","Caricamento\u2026"],ja:["\u4E0D\u5177\u5408\u3092\u5831\u544A","\u8AAD\u307F\u8FBC\u307F\u4E2D\u2026"],nl:["Bug melden","Laden\u2026"],pt:["Reportar erro","Carregando\u2026"],tr:["Hata bildir","Y\xFCkleniyor\u2026"],zh:["\u62A5\u544A\u95EE\u9898","\u52A0\u8F7D\u4E2D\u2026"]},Xe="button{all:initial;position:fixed;z-index:2147483646;display:flex;align-items:center;gap:8px;padding:11px 18px;border-radius:99px;background:var(--c,linear-gradient(135deg,#3882F6,#2F5BEA));color:#fff;font:600 14px system-ui,-apple-system,sans-serif;letter-spacing:-.01em;cursor:pointer;box-shadow:0 14px 32px -12px rgba(56,130,246,.75),0 2px 6px rgba(11,26,58,.18),inset 0 1px 0 rgba(255,255,255,.22);transition:transform .2s,box-shadow .2s;animation:in .35s cubic-bezier(.2,.8,.2,1)}button:hover{transform:translateY(-2px);box-shadow:0 20px 40px -12px rgba(56,130,246,.85),0 3px 8px rgba(11,26,58,.2),inset 0 1px 0 rgba(255,255,255,.22)}button:active{transform:scale(.97)}button:focus-visible{outline:3px solid #00C2FF;outline-offset:3px}button:disabled{cursor:progress}svg,i{width:18px;height:18px}i{box-sizing:border-box;border:2px solid;border-right-color:transparent;border-radius:50%;animation:r .8s linear infinite}@keyframes r{to{transform:rotate(1turn)}}@keyframes in{from{opacity:0;transform:translateY(12px) scale(.94)}}.o span{display:none}.o{padding:13px}@media(max-width:480px){span{display:none}button{padding:13px}}@media(pointer:coarse){button{min-height:44px;box-sizing:border-box}}@media(prefers-reduced-motion:reduce){button{animation:none;transition:none}i{animation-duration:3s}}",Ve='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round" aria-hidden="true"><path d="M4 4h16v12H9l-5 4zM12 7v4M12 13.5v.5"/></svg>',me,W={},ge,x,z=()=>{},k,fe=0;function C(e,t){e.options.debug&&console.log(`[blipit] ${t}`)}function he(e){me=e}function N(e,t){return W[t]??=new Promise((n,r)=>{let i=document.createElement("script");i.src=e,i.async=!0,i.onload=()=>{let o=window[t];o?n(o):r(new Error(t))},i.onerror=r,document.head.appendChild(i)}).catch(n=>{throw delete W[t],n}),W[t]}function be(){let e=(navigator.language??"en").slice(0,2);return H[e]?e:"en"}function X(e,t){let n=document.createElement("button");return n.type="button",n.className="blipit-rb",n.setAttribute("aria-haspopup","dialog"),e?n.textContent=e:(n.lang=be(),n.textContent=H[n.lang][0]),n.addEventListener("click",()=>n.hasAttribute("aria-busy")||t()),n}var ye=()=>{};function ve(e){ye=e}function V(e,t){ye(S(e.endpoint,"/api/v1/feedback"),e.options.key,t)}function A(e){if(typeof document>"u")return;let t=typeof e.options.feedbackWidget=="object"?e.options.feedbackWidget:{},n=document.querySelectorAll("button.blipit-rb"),r=i=>{z(i),n.forEach(o=>i?o.setAttribute("aria-busy","true"):o.removeAttribute("aria-busy"))};r(!0),Promise.all([N(t.src??`${E}blipit-report.js`,"BlipitReport"),ge??=xe(e)]).then(([i,o])=>o.enabled!==!1&&i.open(e,{metadata:me,recording:o.recording===!0,recordingMaxMs:o.recording_max_ms,storageFull:o.storage_full===!0,reportsFull:o.reports_full===!0,theme:o.theme,hide:d=>x&&(x.style.display=d?"none":"")}),()=>V(e,{eventId:e.lastEventId,name:e.user?.username,email:e.user?.email})).finally(()=>r(!1))}async function xe(e){let t=`blipit_fb_${_}_${e.options.key}`;try{let n=JSON.parse(localStorage.getItem(t)??"null");if(n&&Date.now()-n.t<36e5)return n.s}catch{}try{let n=await fetch(S(e.endpoint,"/api/v1/feedback/settings"),{headers:{"X-Blipit-Key":e.options.key,...e.options.instance?{"X-Blipit-Instance":e.options.instance}:{}}});if(!n.ok)return C(e,`widget settings failed (HTTP ${n.status}), using defaults`),{};let r=await n.json();try{localStorage.setItem(t,JSON.stringify({t:Date.now(),s:r}))}catch{}return r}catch{return C(e,"widget settings unreachable (offline, ad blocker or CSP connect-src), using defaults"),{}}}async function Y(e){let t=e.options.feedbackWidget,n=++fe;if(typeof document>"u")return;if(t===!1)return C(e,"Report a bug button off: feedbackWidget is false");let r=await(ge??=xe(e));if(n!==fe)return;if(r.enabled===!1)return C(e,"Report a bug button hidden by the project's Bug report widget setting");let i={...r,...typeof t=="object"?t:{}},[o,d]=H[be()],c=i.text||o;x=document.createElement("div"),x.setAttribute("data-blipit-ui","");let a=x.attachShadow({mode:"open"}),s=document.createElement("button");s.type="button";let[l,m]=(/^(bottom|middle)-(left|right)$/.test(i.position??"")?i.position:"bottom-right").split("-");s.style.cssText=`${i.color?`--c:${i.color};`:""}${m}:calc(20px + env(safe-area-inset-${m},0px));${l==="bottom"?"bottom:calc(20px + env(safe-area-inset-bottom,0px))":"top:50%;margin-top:-22px"}`,s.setAttribute("aria-haspopup","dialog"),i.style==="icon"&&(s.className="o",s.title=c);let h=g=>{s.disabled=g,s.setAttribute("aria-label",g?d:c),s.innerHTML=g?"<i></i><span></span>":`${Ve}<span></span>`,s.lastChild.textContent=g?d:c};z=h,h(!1),s.addEventListener("click",()=>A(e)),ne(a,Xe),a.append(s);let y=i.shortcut?.toLowerCase().replace(/\s/g,"");k&&document.removeEventListener("keydown",k),k=void 0,y&&(k=g=>{[g.ctrlKey&&"ctrl",g.shiftKey&&"shift",g.altKey&&"alt",g.metaKey&&"meta",g.key.toLowerCase()].filter(Boolean).join("+")===y&&(g.preventDefault(),A(e))},document.addEventListener("keydown",k));let B=x,T=()=>{x===B&&(document.body.append(B),C(e,`Report a bug button shown at ${l}-${m}`))};document.body?T():document.addEventListener("DOMContentLoaded",T)}function Se(e,t){let n=e.options.feedbackWidget;e.options.feedbackWidget=t===!1?!1:{...typeof n=="object"?n:{},...t},x?.remove(),x=void 0,k&&document.removeEventListener("keydown",k),k=void 0,z=()=>{},Y(e)}var p,ke=new Set;function we(e,t){ke.has(t)||(ke.add(t),console[e](t))}var Ye="[blipit] init() has no key, so error tracking and the Report a bug button are off. Pass your public key (blipit_pk_...) from app.blipit.io, API keys.",Je="[blipit] init() got a secret key (blipit_sk_...), so Blipit did not start: secret keys must never be in browser code. Use the public key (blipit_pk_...) and create a new secret key in app.blipit.io, API keys.";function Ge(e){if(p)return;let t=typeof e?.key=="string"?e.key.trim():"";if(!t)return we("warn",Ye);if(t.startsWith("blipit_sk_"))return we("error",Je);if(p=new $({...e,key:t}),e.user){let{id:n,name:r,email:i,username:o}=e.user;p.setUser({id:n===void 0?void 0:String(n),email:i,username:o??r})}ce(p),e.webVitals!==!1&&typeof window<"u"&&pe(e.endpoint??M,t,e.instance),e.replay&&(p.replay=le(e.replay,e.endpoint??M,t,e.instance,E)),typeof window<"u"&&Y(p),e.debug&&console.log(`[blipit] ${K}@${_} initialized`)}function Qe(e){return p?.captureException(e,!0)}function Ze(e,t){return p?.captureMessage(e,t)}function et(e){return p?.captureSecurity(e)}function tt(e){p?.setUser(e)}function nt(e,t){p?.setTag(e,t)}function it(e){p?.addBreadcrumb(e)}function rt(e={}){p&&V(p,{...e,eventId:e.eventId??p.lastEventId})}function D(){p&&A(p)}function ot(e){e.addEventListener("click",t=>{t.preventDefault(),D()})}function st(e){p&&Se(p,e)}function at(){return p?.flush()??Promise.resolve()}ve((e,t,n)=>N(`${E}blipit-feedback.js`,"BlipitFeedback").then(r=>r.showFeedbackDialog(e,t,n),()=>{}));function dt(e={}){let t=X(e.label,D);return t.style.visibility="hidden",N(`${E}blipit-button.js`,"BlipitButton").then(n=>n.paint(t,e)).catch(()=>{}).then(()=>t.style.removeProperty("visibility")),t}return Ce(ct);})();
1
+ "use strict";var Blipit=(()=>{var F=Object.defineProperty;var $e=Object.getOwnPropertyDescriptor;var Be=Object.getOwnPropertyNames;var Te=Object.prototype.hasOwnProperty;var Ie=(e,t)=>{for(var n in t)F(e,n,{get:t[n],enumerable:!0})},Le=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Be(t))!Te.call(e,r)&&r!==n&&F(e,r,{get:()=>t[r],enumerable:!(i=$e(t,r))||i.enumerable});return e};var Me=e=>Le(F({},"__esModule",{value:!0}),e);var ft={};Ie(ft,{addBreadcrumb:()=>at,attachReport:()=>dt,captureException:()=>nt,captureMessage:()=>rt,captureSecurity:()=>it,flush:()=>lt,init:()=>tt,openReport:()=>P,reportButton:()=>pt,setReportMetadata:()=>ye,setTag:()=>st,setUser:()=>ot,showFeedback:()=>ct,updateWidget:()=>ut});var G=["login_failed","login_succeeded","login_blocked","password_reset_requested","privilege_granted"];var M=class{constructor(t,n,i,r){this.endpoint=t;this.key=n;this.debug=i;this.instance=r;typeof document<"u"&&document.addEventListener&&document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&this.flushWithBeacon()})}endpoint;key;debug;instance;queue=[];timer;sending=!1;enqueue(t){this.queue.push(t),this.queue.length>30&&this.queue.shift(),this.timer||(this.timer=setTimeout(()=>{this.timer=void 0,this.flush()},1e3))}async flush(){if(!this.sending){this.sending=!0;try{for(;this.queue.length>0;){let t=this.queue[0];if(!await this.send(t))break;this.queue.shift()}}finally{this.sending=!1}}}async send(t,n=0){try{let i=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json","X-Blipit-Key":this.key,...this.instance?{"X-Blipit-Instance":this.instance}:{}},body:JSON.stringify(t),keepalive:!0});return i.status===429||i.status>=500?this.retry(t,n):(this.debug&&i.status>=400&&console.warn("[blipit] event rejected",i.status,await i.text()),!0)}catch{return this.retry(t,n)}}async retry(t,n){return n>=2?(this.debug&&console.warn("[blipit] dropping event after retries",t.event_id),!0):(await new Promise(i=>setTimeout(i,1e3*2**n)),this.send(t,n+1))}flushWithBeacon(){if(!(typeof navigator>"u"||!navigator.sendBeacon))for(;this.queue.length>0;){let t=this.queue.shift(),n=`key=${encodeURIComponent(this.key)}${this.instance?`&instance=${encodeURIComponent(this.instance)}`:""}`,i=`${this.endpoint}${this.endpoint.includes("?")?"&":"?"}${n}`;navigator.sendBeacon(i,JSON.stringify(t))}}};function R(){let e=new Uint8Array(16);if(typeof crypto<"u"&&crypto.getRandomValues)crypto.getRandomValues(e);else for(let n=0;n<16;n++)e[n]=Math.floor(Math.random()*256);e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let n=0;n<16;n++)t+=e[n].toString(16).padStart(2,"0");return t}function y(){return new Date().toISOString()}var Ce=/token|key|password|secret|auth|session|passwd|api/i;function _(e){let t=e.indexOf("?");if(t===-1)return e.slice(0,2048);let n=e.slice(0,t),r=e.slice(t+1).split("&").map(o=>{let a=o.indexOf("=");if(a===-1)return o;let d=o.slice(0,a);return Ce.test(d)?`${d}=[redacted]`:o}).join("&");return`${n}?${r}`.slice(0,2048)}var Ae=/\b((?:[a-zA-Z0-9_-]*(?:token|key|password|secret|auth|session|passwd|api)[a-zA-Z0-9_-]*)=)[^&\s"']+/gi;function Q(e){return e.replace(Ae,"$1[redacted]")}function u(e,t){return e.length>t?e.slice(0,t):e}var ee=".blipit-mask,[data-blipit-mask]";function U(e){return e.replace(/#.*/,"").replace(/([?&][^=&]*)=[^&]*/g,"$1=").slice(0,2048)}function k(e,t,n){e.push(t),e.length>n&&e.shift()}function j(e){let t=e.id?`#${e.id}`:"",n=typeof e.className=="string"&&e.className.trim()?`.${e.className.trim().split(/\s+/).slice(0,2).join(".")}`:"";return u(`${e.tagName.toLowerCase()}${t}${n}`,128)}function te(e,t){try{let n=new CSSStyleSheet;n.replaceSync(t),e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]}catch{let n=document.createElement("style");n.textContent=t,(e===document?document.head:e).append(n)}}function S(e,t){return`${e.replace(/\/api\/v1\/events.*$/,"").replace(/\/$/,"")}${t}`}function ne(e,t){let n=e?/^(https?:\/\/[^?#]*\/)blipit(?:\.min)?\.js(?:[?#].*)?$/.exec(e):null;return n?n[1]:`https://blipit.io/sdk/${t}/`}function re(e,t){let n=`/sdk/${t}/`,[i,r]=t.split(".");return e.endsWith(n)?`${e.slice(0,-n.length)}/sdk/${i==="0"?`${i}.${r}`:i}/`:e}var ie={ok:0,errored:1,crashed:2},C=class{constructor(t,n,i,r){this.url=t;this.key=n;this.release=i;this.environment=r;this.start(),typeof document<"u"&&document.addEventListener&&document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.end():this.sid||this.start()})}url;key;release;environment;sid="";started="";status="ok";errors=0;did;setUser(t){this.did=t}markError(t){if(!this.sid)return;this.errors+=1;let n=t?"crashed":"errored";ie[n]<=ie[this.status]||(this.status=n,this.send(!1))}start(){this.sid=R(),this.started=y(),this.status="ok",this.errors=0,this.send(!1)}end(){this.sid&&(this.send(!0),this.sid="")}send(t){let n=JSON.stringify({sid:this.sid,did:this.did,status:this.status==="ok"&&t?"exited":this.status,errors:this.errors,started:this.started,release:this.release,environment:this.environment}),i=`${this.url}?key=${encodeURIComponent(this.key)}`;try{if(t&&typeof navigator<"u"&&navigator.sendBeacon){navigator.sendBeacon(i,n);return}if(typeof fetch>"u")return;fetch(this.url,{method:"POST",headers:{"Content-Type":"application/json","X-Blipit-Key":this.key},body:n,keepalive:!0}).catch(()=>{})}catch{return}}};var De=/^\s*at (?:async )?(?:new )?(?:(.+?) )?\(?((?:file|https?|blob|chrome-extension|moz-extension|safari-web-extension|node|webpack):.*?|[^()]+?)(?::(\d+))?(?::(\d+))?\)?\s*$/,Ne=/^\s*(?:(.*?)@)?((?:file|https?|blob|chrome-extension|moz-extension|safari-web-extension|node|webpack).*?|[^@]*?)(?::(\d+))?(?::(\d+))?\s*$/,oe=/^(chrome|moz|safari-web)-extension:/;function Pe(){if(typeof location<"u"&&location.origin)return location.origin}function We(e){if(oe.test(e)||e==="<anonymous>"||e==="[native code]")return!1;let t=Pe();return!!(!t||e.startsWith(t)||!/^[a-z]+:/i.test(e))}function se(e){if(!e)return[];let t=[];for(let n of e.split(`
2
+ `)){if(!n||/^\s*(Error|TypeError|RangeError|SyntaxError|ReferenceError)\b/.test(n))continue;let i=De.exec(n)??Ne.exec(n);if(!i)continue;let[,r,o,a,d]=i;if(!o)continue;let c={filename:u(o,1024),in_app:We(o)};r&&(c.function=u(r,512)),a&&(c.lineno=Number(a)),d&&(c.colno=Number(d)),t.push(c)}return t.reverse(),t.slice(-128)}function ae(e){return e.length===0?!1:e.every(t=>oe.test(t.filename))}var T="@blipit/browser",x="0.3.12",ce=ne(typeof document<"u"?document.currentScript?.src:void 0,x),h={exact:ce,channel:re(ce,x),debug:!1,tag:!1},D="https://in.blipit.io/api/v1/events",Fe=[/ResizeObserver loop/i,/^Script error\.?$/,/__gCrWeb|__firefox__/],Ue={login_failed:"Failed login",login_succeeded:"Successful login",login_blocked:"Blocked login",password_reset_requested:"Password reset requested",privilege_granted:"Privilege granted"},je={login_failed:"warning",login_succeeded:"info",login_blocked:"warning",password_reset_requested:"info",privilege_granted:"warning"};function Ke(e){if(!G.includes(e?.kind))return;let t=u(String(e.actor??"").trim(),256);if(!t)return;let n={kind:e.kind,actor:t};return e.actorId&&(n.actor_id=u(String(e.actorId),128)),e.ip&&(n.ip=u(String(e.ip).trim(),45)),e.userAgent&&(n.user_agent=u(String(e.userAgent),512)),e.database&&(n.database=u(String(e.database),64)),e.outcome&&(n.outcome=u(String(e.outcome),64)),e.target&&(n.target=u(String(e.target),256)),n}var A=class{constructor(t){this.options=t;this.endpoint=t.endpoint??D,this.transport=new M(this.endpoint,t.key,t.debug??!1,t.instance),t.autoSessionTracking&&(t.release?this.session=new C(S(this.endpoint,"/api/v1/sessions"),t.key,t.release,t.environment??"production"):t.debug&&console.warn("[blipit] session tracking needs the release option")),this.maxBreadcrumbs=Math.min(t.maxBreadcrumbs??50,100),this.ignoreErrors=[...Fe,...t.ignoreErrors??[]]}options;transport;breadcrumbs=[];user;tags={};maxBreadcrumbs;ignoreErrors;seen=new Set;captured=new WeakSet;session;lastEventId;errorIds=[];logs={console:[],network:[],actions:[]};endpoint;replay;setUser(t){this.user=t,this.session?.setUser(t?.id??t?.email)}setTag(t,n){this.tags[u(t,64)]=u(n,256)}addBreadcrumb(t){let n={timestamp:y(),...t};n.message&&(n.message=Q(n.message)),n.data&&typeof n.data.url=="string"&&(n.data={...n.data,url:_(n.data.url)}),this.breadcrumbs.push(n),this.breadcrumbs.length>this.maxBreadcrumbs&&this.breadcrumbs.shift()}captureException(t,n=!0){if(t&&typeof t=="object"){if(this.captured.has(t))return;this.captured.add(t)}let i=t instanceof Error?t:new Error(String(t)),r={type:i.name||"Error",value:u(i.message||String(i),4096),handled:n},o=se(i.stack);return o.length>0&&(r.stacktrace={frames:o}),this.processAndSend({exception:r,level:"error"})}captureMessage(t,n="info"){return this.processAndSend({message:u(t,8192),level:n})}captureSecurity(t){let n=Ke(t);if(!n){this.options.debug&&console.warn("[blipit] security event dropped, needs a known kind and an actor");return}return this.processAndSend({message:`${Ue[n.kind]} for ${n.actor}`,level:je[n.kind],security:n},!1)}processAndSend(t,n=!0){if(n&&this.options.sampleRate!==void 0&&Math.random()>this.options.sampleRate)return;let i=t.exception?.value??t.message??"";if(n){for(let d of this.ignoreErrors)if(typeof d=="string"?i.includes(d):d.test(i))return;if((this.options.autoMuteExtensions??!0)&&t.exception?.stacktrace&&ae(t.exception.stacktrace.frames))return;let a=`${t.exception?.type??""}|${i}`;if(t.exception?.handled===!1){if(this.seen.has(a)&&this.seen.size<100)return;this.seen.add(a),setTimeout(()=>this.seen.delete(a),5e3)}}let r={event_id:R(),timestamp:y(),platform:"javascript",release:this.options.release,environment:this.options.environment??"production",user:this.user,tags:Object.keys(this.tags).length>0?{...this.tags}:void 0,breadcrumbs:this.breadcrumbs.length>0?[...this.breadcrumbs]:void 0,request:typeof location<"u"?{url:_(location.href)}:void 0,contexts:this.collectContexts(),sdk:this.options._sdk??{name:T,version:x},...t};for(let a of Object.keys(r))r[a]===void 0&&delete r[a];let o=this.replay?.active()&&(r.level==="error"||r.level==="fatal")?this.replay:void 0;if(o&&(r.tags={...r.tags,replay_id:o.id}),this.options.beforeSend){let a=this.options.beforeSend(r);if(!a)return;r=a}return this.transport.enqueue(r),this.lastEventId=r.event_id,(r.level==="error"||r.level==="fatal")&&k(this.errorIds,r.event_id,20),r.exception&&this.session?.markError(r.exception.handled===!1),o?.error(r.event_id),r.event_id}collectContexts(){if(typeof navigator>"u")return;let t={},n=navigator.userAgent??"",i=/(Edg|OPR|Chrome|Firefox|Safari)\/(\d+[\d.]*)/.exec(n)??void 0;i&&(t.browser={name:i[1],version:i[2]});let r=/\(([^)]+)\)/.exec(n);return r&&r[1]&&(t.os={name:u(r[1],64)}),typeof screen<"u"&&(t.device={screen:`${screen.width}x${screen.height}`}),Object.keys(t).length>0?t:void 0}flush(){return this.transport.flush()}};function K(e){return typeof e=="string"?e.length:e?.size}function de(e){return e&&Number(e)||void 0}function qe(e,t){return async(n,i)=>{let r=typeof n=="string"?n:n instanceof URL?n.href:n.url,o=(i?.method??n.method??"GET").toUpperCase(),a=Date.now();try{let d=await e(n,i);return t(o,r,d.status,a,K(i?.body),de(d.headers.get("content-length"))),d}catch(d){throw t(o,r,0,a,K(i?.body)),d}}}function He(e,t){let n=e.open,i=e.send;e.open=function(r,o){return this._blipit=[String(r).toUpperCase(),String(o)],n.apply(this,arguments)},e.send=function(r){let o=this._blipit;if(o){let a=Date.now();this.addEventListener("loadend",()=>t(o[0],o[1],this.status,a,K(r),de(this.getResponseHeader("content-length"))))}return i.apply(this,arguments)}}function ue(e){if(typeof window>"u")return;let t=S(e.endpoint,""),{console:n,network:i,actions:r}=e.logs;window.addEventListener("error",c=>{e.captureException(c.error??c.message,!1)}),window.addEventListener("unhandledrejection",c=>{e.captureException(c.reason,!1)}),typeof document<"u"&&(document.addEventListener("click",c=>{let s=c.target;if(!(s instanceof Element)||s.closest("[data-blipit-ui]"))return;let p=j(s);e.addBreadcrumb({category:"ui.click",message:`Clicked ${p}`});let m=s.closest(ee)?"***":u((s.textContent??"").trim().replace(/\s+/g," "),80);k(r,{timestamp:y(),type:"click",selector:p,text:m},50)},{capture:!0,passive:!0}),document.addEventListener("focusin",c=>{let s=c.target;s instanceof Element&&/^(INPUT|TEXTAREA|SELECT)$/.test(s.tagName)&&k(r,{timestamp:y(),type:"focus",selector:j(s)},50)},{capture:!0,passive:!0}));let o=(c,s,p,m,b,v)=>{t&&s.startsWith(t)||(e.addBreadcrumb({category:"http",message:`${c} ${_(s)} \u2192 ${p||"network error"}`,level:p>=400||!p?"error":"info",data:{url:_(s),method:c,status_code:p||void 0}}),k(i,{timestamp:y(),method:c,url:U(s),status:p,duration:Date.now()-m,request_size:b,response_size:v},50))};typeof window.fetch=="function"&&(window.fetch=qe(window.fetch.bind(window),o)),typeof XMLHttpRequest<"u"&&He(XMLHttpRequest.prototype,o);for(let c of["log","info","debug","warn","error"]){let s=console[c].bind(console);console[c]=(...p)=>{let m=u(p.map(b=>typeof b=="string"?b:ze(b)).join(" "),1024);if(c==="warn"||c==="error"){e.addBreadcrumb({category:"console",level:c==="warn"?"warning":"error",message:m});let b=p.find(v=>v instanceof Error);k(n,{timestamp:y(),level:c,message:m,stack:u((b??new Error).stack??"",2e3)},100)}else k(n,{timestamp:y(),level:c,message:m},100);s(...p)}}let a=()=>k(r,{timestamp:y(),type:"navigation",url:U(location.href)},50),d=()=>{e.addBreadcrumb({category:"navigation",message:`Navigated to ${_(location.href)}`}),a()};if(a(),window.history){let c=window.history.pushState.bind(window.history);window.history.pushState=(...s)=>{c(...s),d()},window.addEventListener("popstate",d)}}function ze(e){try{return JSON.stringify(e)??String(e)}catch{return String(e)}}function le(){let e=0,t=0,n=0,i=0;return r=>(r.hadRecentInput||(t>0&&r.startTime-i<1e3&&r.startTime-n<5e3?t+=r.value:(t=r.value,n=r.startTime),i=r.startTime,t>e&&(e=t)),e)}function Ve(e){if(e.size===0)return;let t=[...e.values()].sort((n,i)=>i-n);return t[Math.min(t.length-1,Math.floor(e.size/50))]}function Xe(e){return/iPad|Tablet|Android(?!.*Mobile)/i.test(e)?"tablet":/Mobi|iPhone|Android/i.test(e)?"mobile":"desktop"}function I(e,t,n){try{new PerformanceObserver(i=>i.getEntries().forEach(r=>t(r))).observe({type:e,buffered:!0,...n})}catch{}}function pe(e,t,n){if(typeof PerformanceObserver>"u"||typeof document>"u")return;let i=performance.getEntriesByType("navigation")[0],r=i?.activationStart??0,o=f=>Math.max(0,Math.round(f-r)),a=document.visibilityState==="hidden",d=location.pathname,c=i?.type,s={},p=le(),m=new Map,b=!1,v=!1;i&&i.responseStart>0&&(s.ttfb=o(i.responseStart)),a||(I("paint",f=>{f.name==="first-contentful-paint"&&(s.fcp=o(f.startTime))}),I("largest-contentful-paint",f=>{b||(s.lcp=o(f.startTime))}));let $=()=>{b=!0};addEventListener("keydown",$,{once:!0,capture:!0}),addEventListener("pointerdown",$,{once:!0,capture:!0}),I("layout-shift",f=>{s.cls=Math.round(p(f)*1e4)/1e4});let B=f=>{if(!f.interactionId)return;m.set(f.interactionId,Math.max(m.get(f.interactionId)??0,f.duration));let Z=Ve(m);Z!==void 0&&(s.inp=Math.round(Z))};I("event",B,{durationThreshold:40}),I("first-input",B);let g=navigator.connection?.effectiveType,Y=`${new URL("/api/v1/vitals",e).href}?key=${encodeURIComponent(t)}${n?`&instance=${encodeURIComponent(n)}`:""}`,W=()=>{if(v||Object.keys(s).length===0)return;v=!0;let f=JSON.stringify({path:d.slice(0,512),metrics:s,nav:c,connection:g&&/^(slow-2g|2g|3g|4g)$/.test(g)?g:void 0,device:Xe(navigator.userAgent)});try{if(navigator.sendBeacon?.(Y,f))return}catch{}fetch(Y,{method:"POST",body:f,keepalive:!0}).catch(()=>{})},J=()=>{location.pathname!==d&&(W(),d=location.pathname,c="route",s={},p=le(),m=new Map,b=!0,v=!1)};document.addEventListener("visibilitychange",()=>document.visibilityState==="hidden"&&W()),addEventListener("pagehide",W),addEventListener("popstate",J);let Oe=history.pushState;history.pushState=function(...f){Oe.apply(this,f),J()}}var q={en:["Report a bug","Loading\u2026"],ar:["\u0623\u0628\u0644\u063A \u0639\u0646 \u062E\u0637\u0623","\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u062D\u0645\u064A\u0644\u2026"],de:["Fehler melden","Wird geladen\u2026"],es:["Reportar un error","Cargando\u2026"],fr:["Signaler un bug","Chargement\u2026"],it:["Segnala un bug","Caricamento\u2026"],ja:["\u4E0D\u5177\u5408\u3092\u5831\u544A","\u8AAD\u307F\u8FBC\u307F\u4E2D\u2026"],nl:["Bug melden","Laden\u2026"],pt:["Reportar erro","Carregando\u2026"],tr:["Hata bildir","Y\xFCkleniyor\u2026"],zh:["\u62A5\u544A\u95EE\u9898","\u52A0\u8F7D\u4E2D\u2026"]},Ye="button{all:initial;position:fixed;z-index:2147483646;display:flex;align-items:center;gap:8px;padding:11px 18px;border-radius:99px;background:var(--c,linear-gradient(135deg,#3882F6,#2F5BEA));color:#fff;font:600 14px system-ui,-apple-system,sans-serif;letter-spacing:-.01em;cursor:pointer;box-shadow:0 14px 32px -12px rgba(56,130,246,.75),0 2px 6px rgba(11,26,58,.18),inset 0 1px 0 rgba(255,255,255,.22);transition:transform .2s,box-shadow .2s;animation:in .35s cubic-bezier(.2,.8,.2,1)}button:hover{transform:translateY(-2px);box-shadow:0 20px 40px -12px rgba(56,130,246,.85),0 3px 8px rgba(11,26,58,.2),inset 0 1px 0 rgba(255,255,255,.22)}button:active{transform:scale(.97)}button:focus-visible{outline:3px solid #00C2FF;outline-offset:3px}button:disabled{cursor:progress}svg,i{width:18px;height:18px}i{box-sizing:border-box;border:2px solid;border-right-color:transparent;border-radius:50%;animation:r .8s linear infinite}@keyframes r{to{transform:rotate(1turn)}}@keyframes in{from{opacity:0;transform:translateY(12px) scale(.94)}}.o span{display:none}.o{padding:13px}@media(max-width:480px){span{display:none}button{padding:13px}}@media(pointer:coarse){button{min-height:44px;box-sizing:border-box}}@media(prefers-reduced-motion:reduce){button{animation:none;transition:none}i{animation-duration:3s}}",Je='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round" aria-hidden="true"><path d="M4 4h16v12H9l-5 4zM12 7v4M12 13.5v.5"/></svg>',he,fe={},be,w,H=()=>{},E,me=0;function L(e,t){e.options.debug&&console.log(`[blipit] ${t}`)}function ye(e){he=e}var ge=(e,t)=>new Promise((n,i)=>{let r=document.createElement("script");r.src=e,r.async=!0,r.onload=()=>n(window[t]),r.onerror=i,document.head.appendChild(r)});function O(e,t,n){return fe[t]??=(async()=>{if(!n&&h.channel!==h.exact){try{let r=await ge(h.channel+e,t);if(r?.accepts?.({version:x,api:1}))return r}catch{}window[t]=void 0,h.debug&&console.log(`[blipit] fallback ${h.exact}${e}`)}let i=await ge(n??h.exact+e,t);if(!i)throw Error(t);return i})().catch(i=>{throw delete fe[t],i})}function Ze(e,t){try{let n=e.options._sdk??{name:T,version:x},i=t?.[n.name],r=e.options.debug||/^(localhost$|127\.|\[::1])|\.local$/.test(location.hostname);try{r||=process.env.NODE_ENV==="development"}catch{}if(!r||!i||i.version.localeCompare(n.version,"en",{numeric:!0})<1)return;let o=`blipit_latest_${i.version}`,a=sessionStorage;if(a[o])return;a[o]=1,console.info(`[blipit] ${i.version} is available (you have ${n.version})${i.note?` \u2014 ${i.note}`:""} \u2014 ${h.tag?`load ${h.exact.replace(x,i.version)}blipit.js`:`npm install ${n.name}@latest`}`)}catch{}}function ve(){let e=(navigator.language??"en").slice(0,2);return q[e]?e:"en"}function z(e,t){let n=document.createElement("button");return n.type="button",n.className="blipit-rb",n.setAttribute("aria-haspopup","dialog"),e?n.textContent=e:(n.lang=ve(),n.textContent=q[n.lang][0]),n.addEventListener("click",()=>n.hasAttribute("aria-busy")||t()),n}var xe=()=>{};function ke(e){xe=e}function V(e,t){xe(S(e.endpoint,"/api/v1/feedback"),e.options.key,t)}function N(e){if(typeof document>"u")return;let t=typeof e.options.feedbackWidget=="object"?e.options.feedbackWidget:{},n=document.querySelectorAll("button.blipit-rb"),i=r=>{H(r),n.forEach(o=>r?o.setAttribute("aria-busy","true"):o.removeAttribute("aria-busy"))};i(!0),Promise.all([O("blipit-report.js","BlipitReport",t.src),be??=we(e)]).then(([r,o])=>o.enabled!==!1&&r.open(e,{metadata:he,recording:o.recording===!0,recordingMaxMs:o.recording_max_ms,storageFull:o.storage_full===!0,reportsFull:o.reports_full===!0,theme:o.theme,hide:a=>w&&(w.style.display=a?"none":"")}),()=>V(e,{eventId:e.lastEventId,name:e.user?.username,email:e.user?.email})).finally(()=>i(!1))}async function we(e){let t=`blipit_fb_${x}_${e.options.key}`;try{let n=JSON.parse(localStorage.getItem(t)??"null");if(n&&Date.now()-n.t<36e5)return n.s}catch{}try{let n=await fetch(S(e.endpoint,"/api/v1/feedback/settings"),{headers:{"X-Blipit-Key":e.options.key,...e.options.instance?{"X-Blipit-Instance":e.options.instance}:{}}});if(!n.ok)return L(e,`widget settings failed (HTTP ${n.status}), using defaults`),{};let i=await n.json();try{localStorage.setItem(t,JSON.stringify({t:Date.now(),s:i}))}catch{}return i}catch{return L(e,"widget settings unreachable (offline, ad blocker or CSP connect-src), using defaults"),{}}}async function X(e){let t=e.options.feedbackWidget,n=++me;if(typeof document>"u")return;if(t===!1)return L(e,"Report a bug button off: feedbackWidget is false");let i=await(be??=we(e));if(Ze(e,i.latest),n!==me)return;if(i.enabled===!1)return L(e,"Report a bug button hidden by the project's Bug report widget setting");let r={...i,...typeof t=="object"?t:{}},[o,a]=q[ve()],d=r.text||o;w=document.createElement("div"),w.setAttribute("data-blipit-ui","");let c=w.attachShadow({mode:"open"}),s=document.createElement("button");s.type="button";let[p,m]=(/^(bottom|middle)-(left|right)$/.test(r.position??"")?r.position:"bottom-right").split("-");s.style.cssText=`${r.color?`--c:${r.color};`:""}${m}:calc(20px + env(safe-area-inset-${m},0px));${p==="bottom"?"bottom:calc(20px + env(safe-area-inset-bottom,0px))":"top:50%;margin-top:-22px"}`,s.setAttribute("aria-haspopup","dialog"),r.style==="icon"&&(s.className="o",s.title=d);let b=g=>{s.disabled=g,s.setAttribute("aria-label",g?a:d),s.innerHTML=g?"<i></i><span></span>":`${Je}<span></span>`,s.lastChild.textContent=g?a:d};H=b,b(!1),s.addEventListener("click",()=>N(e)),te(c,Ye),c.append(s);let v=r.shortcut?.toLowerCase().replace(/\s/g,"");E&&document.removeEventListener("keydown",E),E=void 0,v&&(E=g=>{[g.ctrlKey&&"ctrl",g.shiftKey&&"shift",g.altKey&&"alt",g.metaKey&&"meta",g.key.toLowerCase()].filter(Boolean).join("+")===v&&(g.preventDefault(),N(e))},document.addEventListener("keydown",E));let $=w,B=()=>{w===$&&(document.body.append($),L(e,`Report a bug button shown at ${p}-${m}`))};document.body?B():document.addEventListener("DOMContentLoaded",B)}function Se(e,t){let n=e.options.feedbackWidget;e.options.feedbackWidget=t===!1?!1:{...typeof n=="object"?n:{},...t},w?.remove(),w=void 0,E&&document.removeEventListener("keydown",E),E=void 0,H=()=>{},X(e)}function Ge(e,t=Math.random){return t()<(e.sessionSampleRate??0)?"session":t()<(e.onErrorSampleRate??1)?"buffer":null}function Ee(e,t,n,i){let r=Ge(e);if(!r||typeof document>"u")return;let o=R(),a;return O("blipit-replay.js","BlipitReplay",e.src).then(d=>a=d.start({id:o,mode:r,endpoint:t,key:n,instance:i}),()=>{}),{id:o,active:()=>a?.active()??!1,error:d=>a?.error(d),report:d=>a?.report?.(d)}}var l,_e=new Set;function Re(e,t){_e.has(t)||(_e.add(t),console[e](t))}var Qe="[blipit] init() has no key, so error tracking and the Report a bug button are off. Pass your public key (blipit_pk_...) from app.blipit.io, API keys.",et="[blipit] init() got a secret key (blipit_sk_...), so Blipit did not start: secret keys must never be in browser code. Use the public key (blipit_pk_...) and create a new secret key in app.blipit.io, API keys.";function tt(e){if(l)return;let t=typeof e?.key=="string"?e.key.trim():"";if(!t)return Re("warn",Qe);if(t.startsWith("blipit_sk_"))return Re("error",et);if(l=new A({...e,key:t}),e.sdkChannel==="exact"&&(h.channel=h.exact),h.debug=!!e.debug,e.user){let{id:n,name:i,email:r,username:o}=e.user;l.setUser({id:n===void 0?void 0:String(n),email:r,username:o??i})}ue(l),e.webVitals!==!1&&typeof window<"u"&&pe(e.endpoint??D,t,e.instance),e.replay&&(l.replay=Ee(e.replay,e.endpoint??D,t,e.instance)),typeof window<"u"&&X(l),e.debug&&console.log(`[blipit] ${T}@${x} initialized`)}function nt(e){return l?.captureException(e,!0)}function rt(e,t){return l?.captureMessage(e,t)}function it(e){return l?.captureSecurity(e)}function ot(e){l?.setUser(e)}function st(e,t){l?.setTag(e,t)}function at(e){l?.addBreadcrumb(e)}function ct(e={}){l&&V(l,{...e,eventId:e.eventId??l.lastEventId})}function P(){l&&N(l)}function dt(e){e.addEventListener("click",t=>{t.preventDefault(),P()})}function ut(e){l&&Se(l,e)}function lt(){return l?.flush()??Promise.resolve()}h.tag=!0;ke((e,t,n)=>O("blipit-feedback.js","BlipitFeedback").then(i=>i.showFeedbackDialog(e,t,n),()=>{}));function pt(e={}){let t=z(e.label,P);return t.style.visibility="hidden",O("blipit-button.js","BlipitButton").then(n=>n.paint(t,e)).catch(()=>{}).then(()=>t.style.removeProperty("visibility")),t}return Me(ft);})();
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- var te={en:["Report {ref} sent.","We will email you updates."],ar:["\u062A\u0645 \u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0628\u0644\u0627\u063A {ref}.","\u0633\u0646\u0631\u0627\u0633\u0644\u0643 \u0628\u0627\u0644\u062A\u062D\u062F\u064A\u062B\u0627\u062A."],de:["Meldung {ref} gesendet.","Wir informieren Sie per E-Mail."],es:["Reporte {ref} enviado.","Te enviaremos novedades por correo."],fr:["Signalement {ref} envoy\xE9.","Nous vous tiendrons au courant par e-mail."],it:["Segnalazione {ref} inviata.","Ti invieremo aggiornamenti via email."],ja:["\u5831\u544A {ref} \u3092\u9001\u4FE1\u3057\u307E\u3057\u305F\u3002","\u9032\u6357\u306F\u30E1\u30FC\u30EB\u3067\u304A\u77E5\u3089\u305B\u3057\u307E\u3059\u3002"],nl:["Melding {ref} verstuurd.","We mailen je updates."],pt:["Relato {ref} enviado.","Vamos enviar novidades por e-mail."],tr:["{ref} numaral\u0131 bildirim g\xF6nderildi.","Geli\u015Fmeleri e-postayla bildirece\u011Fiz."],zh:["\u62A5\u544A {ref} \u5DF2\u53D1\u9001\u3002","\u6211\u4EEC\u4F1A\u901A\u8FC7\u90AE\u4EF6\u544A\u77E5\u8FDB\u5C55\u3002"]};function Oe(e,t,n){if(typeof e!="string"||!/^BR-\d{1,12}$/.test(e))return null;let[i,r]=te[n.toLowerCase().split(/[-_]/)[0]]??te.en;return`${i.replace("{ref}",e)}${t===!0?` ${r}`:""}`}function x(e,t,n){let i=document.createElement(e);return i.style.cssText=t,n!==void 0&&(i.textContent=n),i}var j="display:block;width:100%;box-sizing:border-box;margin:4px 0 12px;padding:8px 10px;font:inherit;border:1px solid #c5ccd6;border-radius:6px;background:#fff;color:#111",ne="font:inherit;padding:8px 14px;border-radius:6px;cursor:pointer;border:1px solid #c5ccd6;background:#fff;color:#111",W=!1;function ie(e,t,n){if(W||typeof document>"u"||!document.body)return;W=!0;let i=x("dialog","max-width:420px;width:calc(100% - 32px);padding:20px;border:1px solid #c5ccd6;border-radius:10px;font:14px/1.45 system-ui,sans-serif;color:#111;background:#fff");i.setAttribute("aria-labelledby","blipit-fb-title");let r=x("form","margin:0"),o=x("h2","margin:0 0 12px;font-size:17px",n.title??"Tell us what happened");o.id="blipit-fb-title";let c=(b,$,k)=>{let B=x("label","display:block;font-weight:600",b);B.htmlFor=k,$.id=k,r.append(B,$)},d=x("input",j);d.type="text",d.maxLength=128,d.autocomplete="name",d.value=n.name??"";let a=x("input",j);a.type="email",a.maxLength=254,a.autocomplete="email",a.value=n.email??"";let s=x("textarea",`${j};min-height:110px;resize:vertical`);s.required=!0,s.maxLength=5e3;let p=x("p","margin:0 0 12px;min-height:1.2em;font-size:13px");p.setAttribute("role","status"),p.setAttribute("aria-live","polite");let h=x("div","display:flex;gap:8px;justify-content:flex-end"),f=x("button",ne,"Cancel");f.type="button";let m=x("button",`${ne};background:#111;color:#fff;border-color:#111`,"Send");m.type="submit",r.append(o),c("Name (optional)",d,"blipit-fb-name"),c("Email (optional)",a,"blipit-fb-email"),c("What went wrong?",s,"blipit-fb-message"),h.append(f,m),r.append(p,h),i.append(r),document.body.append(i);let E=()=>{W=!1,i.remove()},R=()=>typeof i.close=="function"&&i.open?i.close():E();f.addEventListener("click",R),i.addEventListener("close",E),r.addEventListener("submit",async b=>{b.preventDefault();let $=s.value.trim();if(!$){p.textContent="Please describe what happened.",s.focus();return}m.disabled=!0,f.disabled=!0,m.setAttribute("aria-busy","true"),m.textContent="Sending\u2026",p.textContent="";try{let k=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-Blipit-Key":t},body:JSON.stringify({name:d.value.trim()||void 0,email:a.value.trim()||void 0,message:$,event_id:n.eventId,url:typeof location<"u"?location.href.split(/[?#]/)[0]:void 0})});if(!k.ok)throw new Error(String(k.status));let B=await k.json().catch(()=>({})),A=Oe(B.ref,B.emails,typeof navigator>"u"?"en":navigator.language??"en");p.textContent=A??"Thanks, your message was sent.",m.textContent="Sent",setTimeout(R,A?4e3:1200)}catch{p.textContent="That did not send. Please try again.",m.disabled=!1,f.disabled=!1,m.removeAttribute("aria-busy"),m.textContent="Send"}}),typeof i.showModal=="function"?i.showModal():i.setAttribute("open",""),s.focus()}var re=["login_failed","login_succeeded","login_blocked","password_reset_requested","privilege_granted"];var F=class{constructor(t,n,i,r){this.endpoint=t;this.key=n;this.debug=i;this.instance=r;typeof document<"u"&&document.addEventListener&&document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&this.flushWithBeacon()})}endpoint;key;debug;instance;queue=[];timer;sending=!1;enqueue(t){this.queue.push(t),this.queue.length>30&&this.queue.shift(),this.timer||(this.timer=setTimeout(()=>{this.timer=void 0,this.flush()},1e3))}async flush(){if(!this.sending){this.sending=!0;try{for(;this.queue.length>0;){let t=this.queue[0];if(!await this.send(t))break;this.queue.shift()}}finally{this.sending=!1}}}async send(t,n=0){try{let i=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json","X-Blipit-Key":this.key,...this.instance?{"X-Blipit-Instance":this.instance}:{}},body:JSON.stringify(t),keepalive:!0});return i.status===429||i.status>=500?this.retry(t,n):(this.debug&&i.status>=400&&console.warn("[blipit] event rejected",i.status,await i.text()),!0)}catch{return this.retry(t,n)}}async retry(t,n){return n>=2?(this.debug&&console.warn("[blipit] dropping event after retries",t.event_id),!0):(await new Promise(i=>setTimeout(i,1e3*2**n)),this.send(t,n+1))}flushWithBeacon(){if(!(typeof navigator>"u"||!navigator.sendBeacon))for(;this.queue.length>0;){let t=this.queue.shift(),n=`key=${encodeURIComponent(this.key)}${this.instance?`&instance=${encodeURIComponent(this.instance)}`:""}`,i=`${this.endpoint}${this.endpoint.includes("?")?"&":"?"}${n}`;navigator.sendBeacon(i,JSON.stringify(t))}}};function L(){let e=new Uint8Array(16);if(typeof crypto<"u"&&crypto.getRandomValues)crypto.getRandomValues(e);else for(let n=0;n<16;n++)e[n]=Math.floor(Math.random()*256);e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let n=0;n<16;n++)t+=e[n].toString(16).padStart(2,"0");return t}function v(){return new Date().toISOString()}var Ie=/token|key|password|secret|auth|session|passwd|api/i;function C(e){let t=e.indexOf("?");if(t===-1)return e.slice(0,2048);let n=e.slice(0,t),r=e.slice(t+1).split("&").map(o=>{let c=o.indexOf("=");if(c===-1)return o;let d=o.slice(0,c);return Ie.test(d)?`${d}=[redacted]`:o}).join("&");return`${n}?${r}`.slice(0,2048)}var Ae=/\b((?:[a-zA-Z0-9_-]*(?:token|key|password|secret|auth|session|passwd|api)[a-zA-Z0-9_-]*)=)[^&\s"']+/gi;function oe(e){return e.replace(Ae,"$1[redacted]")}function l(e,t){return e.length>t?e.slice(0,t):e}var se=".blipit-mask,[data-blipit-mask]";function q(e){return e.replace(/#.*/,"").replace(/([?&][^=&]*)=[^&]*/g,"$1=").slice(0,2048)}function w(e,t,n){e.push(t),e.length>n&&e.shift()}function H(e){let t=e.id?`#${e.id}`:"",n=typeof e.className=="string"&&e.className.trim()?`.${e.className.trim().split(/\s+/).slice(0,2).join(".")}`:"";return l(`${e.tagName.toLowerCase()}${t}${n}`,128)}function N(e,t){try{let n=new CSSStyleSheet;n.replaceSync(t),e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]}catch{let n=document.createElement("style");n.textContent=t,(e===document?document.head:e).append(n)}}function T(e,t){return`${e.replace(/\/api\/v1\/events.*$/,"").replace(/\/$/,"")}${t}`}function ae(e,t){let n=e?/^(https?:\/\/[^?#]*\/)blipit(?:\.min)?\.js(?:[?#].*)?$/.exec(e):null;return n?n[1]:`https://blipit.io/sdk/${t}/`}function Fe(e){let t=e.match(/rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:[,\s/]+([\d.]+%?))?/);if(!t||(t[4]===void 0?1:t[4].endsWith("%")?parseFloat(t[4])/100:parseFloat(t[4]))<.5)return null;let[i,r,o]=[t[1],t[2],t[3]].map(c=>{let d=parseFloat(c)/255;return d<=.03928?d/12.92:((d+.055)/1.055)**2.4});return .2126*i+.7152*r+.0722*o}function de(e){if(e==="light"||e==="dark")return e;if(typeof document<"u"){for(let n of[document.body,document.documentElement]){if(!n)continue;let i=Fe(getComputedStyle(n).backgroundColor);if(i!==null)return i<.4?"dark":"light"}let t=getComputedStyle(document.documentElement).colorScheme;if(t==="dark")return"dark";if(t&&t!=="normal"&&!t.includes("dark"))return"light"}return typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var ce={ok:0,errored:1,crashed:2},D=class{constructor(t,n,i,r){this.url=t;this.key=n;this.release=i;this.environment=r;this.start(),typeof document<"u"&&document.addEventListener&&document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.end():this.sid||this.start()})}url;key;release;environment;sid="";started="";status="ok";errors=0;did;setUser(t){this.did=t}markError(t){if(!this.sid)return;this.errors+=1;let n=t?"crashed":"errored";ce[n]<=ce[this.status]||(this.status=n,this.send(!1))}start(){this.sid=L(),this.started=v(),this.status="ok",this.errors=0,this.send(!1)}end(){this.sid&&(this.send(!0),this.sid="")}send(t){let n=JSON.stringify({sid:this.sid,did:this.did,status:this.status==="ok"&&t?"exited":this.status,errors:this.errors,started:this.started,release:this.release,environment:this.environment}),i=`${this.url}?key=${encodeURIComponent(this.key)}`;try{if(t&&typeof navigator<"u"&&navigator.sendBeacon){navigator.sendBeacon(i,n);return}if(typeof fetch>"u")return;fetch(this.url,{method:"POST",headers:{"Content-Type":"application/json","X-Blipit-Key":this.key},body:n,keepalive:!0}).catch(()=>{})}catch{return}}};var Ne=/^\s*at (?:async )?(?:new )?(?:(.+?) )?\(?((?:file|https?|blob|chrome-extension|moz-extension|safari-web-extension|node|webpack):.*?|[^()]+?)(?::(\d+))?(?::(\d+))?\)?\s*$/,De=/^\s*(?:(.*?)@)?((?:file|https?|blob|chrome-extension|moz-extension|safari-web-extension|node|webpack).*?|[^@]*?)(?::(\d+))?(?::(\d+))?\s*$/,ue=/^(chrome|moz|safari-web)-extension:/;function Pe(){if(typeof location<"u"&&location.origin)return location.origin}function Ue(e){if(ue.test(e)||e==="<anonymous>"||e==="[native code]")return!1;let t=Pe();return!!(!t||e.startsWith(t)||!/^[a-z]+:/i.test(e))}function pe(e){if(!e)return[];let t=[];for(let n of e.split(`
2
- `)){if(!n||/^\s*(Error|TypeError|RangeError|SyntaxError|ReferenceError)\b/.test(n))continue;let i=Ne.exec(n)??De.exec(n);if(!i)continue;let[,r,o,c,d]=i;if(!o)continue;let a={filename:l(o,1024),in_app:Ue(o)};r&&(a.function=l(r,512)),c&&(a.lineno=Number(c)),d&&(a.colno=Number(d)),t.push(a)}return t.reverse(),t.slice(-128)}function le(e){return e.length===0?!1:e.every(t=>ue.test(t.filename))}var X="@blipit/browser",M="0.3.10",U=ae(typeof document<"u"?document.currentScript?.src:void 0,M),z="https://in.blipit.io/api/v1/events",ze=[/ResizeObserver loop/i,/^Script error\.?$/,/__gCrWeb|__firefox__/],Ke={login_failed:"Failed login",login_succeeded:"Successful login",login_blocked:"Blocked login",password_reset_requested:"Password reset requested",privilege_granted:"Privilege granted"},je={login_failed:"warning",login_succeeded:"info",login_blocked:"warning",password_reset_requested:"info",privilege_granted:"warning"};function We(e){if(!re.includes(e?.kind))return;let t=l(String(e.actor??"").trim(),256);if(!t)return;let n={kind:e.kind,actor:t};return e.actorId&&(n.actor_id=l(String(e.actorId),128)),e.ip&&(n.ip=l(String(e.ip).trim(),45)),e.userAgent&&(n.user_agent=l(String(e.userAgent),512)),e.database&&(n.database=l(String(e.database),64)),e.outcome&&(n.outcome=l(String(e.outcome),64)),e.target&&(n.target=l(String(e.target),256)),n}var P=class{constructor(t){this.options=t;this.endpoint=t.endpoint??z,this.transport=new F(this.endpoint,t.key,t.debug??!1,t.instance),t.autoSessionTracking&&(t.release?this.session=new D(T(this.endpoint,"/api/v1/sessions"),t.key,t.release,t.environment??"production"):t.debug&&console.warn("[blipit] session tracking needs the release option")),this.maxBreadcrumbs=Math.min(t.maxBreadcrumbs??50,100),this.ignoreErrors=[...ze,...t.ignoreErrors??[]]}options;transport;breadcrumbs=[];user;tags={};maxBreadcrumbs;ignoreErrors;seen=new Set;captured=new WeakSet;session;lastEventId;errorIds=[];logs={console:[],network:[],actions:[]};endpoint;replay;setUser(t){this.user=t,this.session?.setUser(t?.id??t?.email)}setTag(t,n){this.tags[l(t,64)]=l(n,256)}addBreadcrumb(t){let n={timestamp:v(),...t};n.message&&(n.message=oe(n.message)),n.data&&typeof n.data.url=="string"&&(n.data={...n.data,url:C(n.data.url)}),this.breadcrumbs.push(n),this.breadcrumbs.length>this.maxBreadcrumbs&&this.breadcrumbs.shift()}captureException(t,n=!0){if(t&&typeof t=="object"){if(this.captured.has(t))return;this.captured.add(t)}let i=t instanceof Error?t:new Error(String(t)),r={type:i.name||"Error",value:l(i.message||String(i),4096),handled:n},o=pe(i.stack);return o.length>0&&(r.stacktrace={frames:o}),this.processAndSend({exception:r,level:"error"})}captureMessage(t,n="info"){return this.processAndSend({message:l(t,8192),level:n})}captureSecurity(t){let n=We(t);if(!n){this.options.debug&&console.warn("[blipit] security event dropped, needs a known kind and an actor");return}return this.processAndSend({message:`${Ke[n.kind]} for ${n.actor}`,level:je[n.kind],security:n},!1)}processAndSend(t,n=!0){if(n&&this.options.sampleRate!==void 0&&Math.random()>this.options.sampleRate)return;let i=t.exception?.value??t.message??"";if(n){for(let d of this.ignoreErrors)if(typeof d=="string"?i.includes(d):d.test(i))return;if((this.options.autoMuteExtensions??!0)&&t.exception?.stacktrace&&le(t.exception.stacktrace.frames))return;let c=`${t.exception?.type??""}|${i}`;if(t.exception?.handled===!1){if(this.seen.has(c)&&this.seen.size<100)return;this.seen.add(c),setTimeout(()=>this.seen.delete(c),5e3)}}let r={event_id:L(),timestamp:v(),platform:"javascript",release:this.options.release,environment:this.options.environment??"production",user:this.user,tags:Object.keys(this.tags).length>0?{...this.tags}:void 0,breadcrumbs:this.breadcrumbs.length>0?[...this.breadcrumbs]:void 0,request:typeof location<"u"?{url:C(location.href)}:void 0,contexts:this.collectContexts(),sdk:{name:X,version:M},...t};for(let c of Object.keys(r))r[c]===void 0&&delete r[c];let o=this.replay?.active()&&(r.level==="error"||r.level==="fatal")?this.replay:void 0;if(o&&(r.tags={...r.tags,replay_id:o.id}),this.options.beforeSend){let c=this.options.beforeSend(r);if(!c)return;r=c}return this.transport.enqueue(r),this.lastEventId=r.event_id,(r.level==="error"||r.level==="fatal")&&w(this.errorIds,r.event_id,20),r.exception&&this.session?.markError(r.exception.handled===!1),o?.error(r.event_id),r.event_id}collectContexts(){if(typeof navigator>"u")return;let t={},n=navigator.userAgent??"",i=/(Edg|OPR|Chrome|Firefox|Safari)\/(\d+[\d.]*)/.exec(n)??void 0;i&&(t.browser={name:i[1],version:i[2]});let r=/\(([^)]+)\)/.exec(n);return r&&r[1]&&(t.os={name:l(r[1],64)}),typeof screen<"u"&&(t.device={screen:`${screen.width}x${screen.height}`}),Object.keys(t).length>0?t:void 0}flush(){return this.transport.flush()}};var G={en:["Report a bug","Loading\u2026"],ar:["\u0623\u0628\u0644\u063A \u0639\u0646 \u062E\u0637\u0623","\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u062D\u0645\u064A\u0644\u2026"],de:["Fehler melden","Wird geladen\u2026"],es:["Reportar un error","Cargando\u2026"],fr:["Signaler un bug","Chargement\u2026"],it:["Segnala un bug","Caricamento\u2026"],ja:["\u4E0D\u5177\u5408\u3092\u5831\u544A","\u8AAD\u307F\u8FBC\u307F\u4E2D\u2026"],nl:["Bug melden","Laden\u2026"],pt:["Reportar erro","Carregando\u2026"],tr:["Hata bildir","Y\xFCkleniyor\u2026"],zh:["\u62A5\u544A\u95EE\u9898","\u52A0\u8F7D\u4E2D\u2026"]},qe="button{all:initial;position:fixed;z-index:2147483646;display:flex;align-items:center;gap:8px;padding:11px 18px;border-radius:99px;background:var(--c,linear-gradient(135deg,#3882F6,#2F5BEA));color:#fff;font:600 14px system-ui,-apple-system,sans-serif;letter-spacing:-.01em;cursor:pointer;box-shadow:0 14px 32px -12px rgba(56,130,246,.75),0 2px 6px rgba(11,26,58,.18),inset 0 1px 0 rgba(255,255,255,.22);transition:transform .2s,box-shadow .2s;animation:in .35s cubic-bezier(.2,.8,.2,1)}button:hover{transform:translateY(-2px);box-shadow:0 20px 40px -12px rgba(56,130,246,.85),0 3px 8px rgba(11,26,58,.2),inset 0 1px 0 rgba(255,255,255,.22)}button:active{transform:scale(.97)}button:focus-visible{outline:3px solid #00C2FF;outline-offset:3px}button:disabled{cursor:progress}svg,i{width:18px;height:18px}i{box-sizing:border-box;border:2px solid;border-right-color:transparent;border-radius:50%;animation:r .8s linear infinite}@keyframes r{to{transform:rotate(1turn)}}@keyframes in{from{opacity:0;transform:translateY(12px) scale(.94)}}.o span{display:none}.o{padding:13px}@media(max-width:480px){span{display:none}button{padding:13px}}@media(pointer:coarse){button{min-height:44px;box-sizing:border-box}}@media(prefers-reduced-motion:reduce){button{animation:none;transition:none}i{animation-duration:3s}}",He='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round" aria-hidden="true"><path d="M4 4h16v12H9l-5 4zM12 7v4M12 13.5v.5"/></svg>',me,V={},ge,S,Y=()=>{},_,fe=0;function O(e,t){e.options.debug&&console.log(`[blipit] ${t}`)}function Xe(e){me=e}function Ve(e,t){return V[t]??=new Promise((n,i)=>{let r=document.createElement("script");r.src=e,r.async=!0,r.onload=()=>{let o=window[t];o?n(o):i(new Error(t))},r.onerror=i,document.head.appendChild(r)}).catch(n=>{throw delete V[t],n}),V[t]}function he(){let e=(navigator.language??"en").slice(0,2);return G[e]?e:"en"}function be(e,t){let n=document.createElement("button");return n.type="button",n.className="blipit-rb",n.setAttribute("aria-haspopup","dialog"),e?n.textContent=e:(n.lang=he(),n.textContent=G[n.lang][0]),n.addEventListener("click",()=>n.hasAttribute("aria-busy")||t()),n}var ye=()=>{};function ve(e){ye=e}function J(e,t){ye(T(e.endpoint,"/api/v1/feedback"),e.options.key,t)}function K(e){if(typeof document>"u")return;let t=typeof e.options.feedbackWidget=="object"?e.options.feedbackWidget:{},n=document.querySelectorAll("button.blipit-rb"),i=r=>{Y(r),n.forEach(o=>r?o.setAttribute("aria-busy","true"):o.removeAttribute("aria-busy"))};i(!0),Promise.all([Ve(t.src??`${U}blipit-report.js`,"BlipitReport"),ge??=xe(e)]).then(([r,o])=>o.enabled!==!1&&r.open(e,{metadata:me,recording:o.recording===!0,recordingMaxMs:o.recording_max_ms,storageFull:o.storage_full===!0,reportsFull:o.reports_full===!0,theme:o.theme,hide:c=>S&&(S.style.display=c?"none":"")}),()=>J(e,{eventId:e.lastEventId,name:e.user?.username,email:e.user?.email})).finally(()=>i(!1))}async function xe(e){let t=`blipit_fb_${M}_${e.options.key}`;try{let n=JSON.parse(localStorage.getItem(t)??"null");if(n&&Date.now()-n.t<36e5)return n.s}catch{}try{let n=await fetch(T(e.endpoint,"/api/v1/feedback/settings"),{headers:{"X-Blipit-Key":e.options.key,...e.options.instance?{"X-Blipit-Instance":e.options.instance}:{}}});if(!n.ok)return O(e,`widget settings failed (HTTP ${n.status}), using defaults`),{};let i=await n.json();try{localStorage.setItem(t,JSON.stringify({t:Date.now(),s:i}))}catch{}return i}catch{return O(e,"widget settings unreachable (offline, ad blocker or CSP connect-src), using defaults"),{}}}async function Z(e){let t=e.options.feedbackWidget,n=++fe;if(typeof document>"u")return;if(t===!1)return O(e,"Report a bug button off: feedbackWidget is false");let i=await(ge??=xe(e));if(n!==fe)return;if(i.enabled===!1)return O(e,"Report a bug button hidden by the project's Bug report widget setting");let r={...i,...typeof t=="object"?t:{}},[o,c]=G[he()],d=r.text||o;S=document.createElement("div"),S.setAttribute("data-blipit-ui","");let a=S.attachShadow({mode:"open"}),s=document.createElement("button");s.type="button";let[p,h]=(/^(bottom|middle)-(left|right)$/.test(r.position??"")?r.position:"bottom-right").split("-");s.style.cssText=`${r.color?`--c:${r.color};`:""}${h}:calc(20px + env(safe-area-inset-${h},0px));${p==="bottom"?"bottom:calc(20px + env(safe-area-inset-bottom,0px))":"top:50%;margin-top:-22px"}`,s.setAttribute("aria-haspopup","dialog"),r.style==="icon"&&(s.className="o",s.title=d);let f=b=>{s.disabled=b,s.setAttribute("aria-label",b?c:d),s.innerHTML=b?"<i></i><span></span>":`${He}<span></span>`,s.lastChild.textContent=b?c:d};Y=f,f(!1),s.addEventListener("click",()=>K(e)),N(a,qe),a.append(s);let m=r.shortcut?.toLowerCase().replace(/\s/g,"");_&&document.removeEventListener("keydown",_),_=void 0,m&&(_=b=>{[b.ctrlKey&&"ctrl",b.shiftKey&&"shift",b.altKey&&"alt",b.metaKey&&"meta",b.key.toLowerCase()].filter(Boolean).join("+")===m&&(b.preventDefault(),K(e))},document.addEventListener("keydown",_));let E=S,R=()=>{S===E&&(document.body.append(E),O(e,`Report a bug button shown at ${p}-${h}`))};document.body?R():document.addEventListener("DOMContentLoaded",R)}function ke(e,t){let n=e.options.feedbackWidget;e.options.feedbackWidget=t===!1?!1:{...typeof n=="object"?n:{},...t},S?.remove(),S=void 0,_&&document.removeEventListener("keydown",_),_=void 0,Y=()=>{},Z(e)}function Q(e){return typeof e=="string"?e.length:e?.size}function we(e){return e&&Number(e)||void 0}function Ge(e,t){return async(n,i)=>{let r=typeof n=="string"?n:n instanceof URL?n.href:n.url,o=(i?.method??n.method??"GET").toUpperCase(),c=Date.now();try{let d=await e(n,i);return t(o,r,d.status,c,Q(i?.body),we(d.headers.get("content-length"))),d}catch(d){throw t(o,r,0,c,Q(i?.body)),d}}}function Ye(e,t){let n=e.open,i=e.send;e.open=function(r,o){return this._blipit=[String(r).toUpperCase(),String(o)],n.apply(this,arguments)},e.send=function(r){let o=this._blipit;if(o){let c=Date.now();this.addEventListener("loadend",()=>t(o[0],o[1],this.status,c,Q(r),we(this.getResponseHeader("content-length"))))}return i.apply(this,arguments)}}function Se(e){if(typeof window>"u")return;let t=T(e.endpoint,""),{console:n,network:i,actions:r}=e.logs;window.addEventListener("error",a=>{e.captureException(a.error??a.message,!1)}),window.addEventListener("unhandledrejection",a=>{e.captureException(a.reason,!1)}),typeof document<"u"&&(document.addEventListener("click",a=>{let s=a.target;if(!(s instanceof Element)||s.closest("[data-blipit-ui]"))return;let p=H(s);e.addBreadcrumb({category:"ui.click",message:`Clicked ${p}`});let h=s.closest(se)?"***":l((s.textContent??"").trim().replace(/\s+/g," "),80);w(r,{timestamp:v(),type:"click",selector:p,text:h},50)},{capture:!0,passive:!0}),document.addEventListener("focusin",a=>{let s=a.target;s instanceof Element&&/^(INPUT|TEXTAREA|SELECT)$/.test(s.tagName)&&w(r,{timestamp:v(),type:"focus",selector:H(s)},50)},{capture:!0,passive:!0}));let o=(a,s,p,h,f,m)=>{t&&s.startsWith(t)||(e.addBreadcrumb({category:"http",message:`${a} ${C(s)} \u2192 ${p||"network error"}`,level:p>=400||!p?"error":"info",data:{url:C(s),method:a,status_code:p||void 0}}),w(i,{timestamp:v(),method:a,url:q(s),status:p,duration:Date.now()-h,request_size:f,response_size:m},50))};typeof window.fetch=="function"&&(window.fetch=Ge(window.fetch.bind(window),o)),typeof XMLHttpRequest<"u"&&Ye(XMLHttpRequest.prototype,o);for(let a of["log","info","debug","warn","error"]){let s=console[a].bind(console);console[a]=(...p)=>{let h=l(p.map(f=>typeof f=="string"?f:Je(f)).join(" "),1024);if(a==="warn"||a==="error"){e.addBreadcrumb({category:"console",level:a==="warn"?"warning":"error",message:h});let f=p.find(m=>m instanceof Error);w(n,{timestamp:v(),level:a,message:h,stack:l((f??new Error).stack??"",2e3)},100)}else w(n,{timestamp:v(),level:a,message:h},100);s(...p)}}let c=()=>w(r,{timestamp:v(),type:"navigation",url:q(location.href)},50),d=()=>{e.addBreadcrumb({category:"navigation",message:`Navigated to ${C(location.href)}`}),c()};if(c(),window.history){let a=window.history.pushState.bind(window.history);window.history.pushState=(...s)=>{a(...s),d()},window.addEventListener("popstate",d)}}function Je(e){try{return JSON.stringify(e)??String(e)}catch{return String(e)}}function Ee(){let e=0,t=0,n=0,i=0;return r=>(r.hadRecentInput||(t>0&&r.startTime-i<1e3&&r.startTime-n<5e3?t+=r.value:(t=r.value,n=r.startTime),i=r.startTime,t>e&&(e=t)),e)}function Ze(e){if(e.size===0)return;let t=[...e.values()].sort((n,i)=>i-n);return t[Math.min(t.length-1,Math.floor(e.size/50))]}function Qe(e){return/iPad|Tablet|Android(?!.*Mobile)/i.test(e)?"tablet":/Mobi|iPhone|Android/i.test(e)?"mobile":"desktop"}function I(e,t,n){try{new PerformanceObserver(i=>i.getEntries().forEach(r=>t(r))).observe({type:e,buffered:!0,...n})}catch{}}function Re(e,t,n){if(typeof PerformanceObserver>"u"||typeof document>"u")return;let i=performance.getEntriesByType("navigation")[0],r=i?.activationStart??0,o=y=>Math.max(0,Math.round(y-r)),c=document.visibilityState==="hidden",d=location.pathname,a=i?.type,s={},p=Ee(),h=new Map,f=!1,m=!1;i&&i.responseStart>0&&(s.ttfb=o(i.responseStart)),c||(I("paint",y=>{y.name==="first-contentful-paint"&&(s.fcp=o(y.startTime))}),I("largest-contentful-paint",y=>{f||(s.lcp=o(y.startTime))}));let E=()=>{f=!0};addEventListener("keydown",E,{once:!0,capture:!0}),addEventListener("pointerdown",E,{once:!0,capture:!0}),I("layout-shift",y=>{s.cls=Math.round(p(y)*1e4)/1e4});let R=y=>{if(!y.interactionId)return;h.set(y.interactionId,Math.max(h.get(y.interactionId)??0,y.duration));let ee=Ze(h);ee!==void 0&&(s.inp=Math.round(ee))};I("event",R,{durationThreshold:40}),I("first-input",R);let b=navigator.connection?.effectiveType,$=`${new URL("/api/v1/vitals",e).href}?key=${encodeURIComponent(t)}${n?`&instance=${encodeURIComponent(n)}`:""}`,k=()=>{if(m||Object.keys(s).length===0)return;m=!0;let y=JSON.stringify({path:d.slice(0,512),metrics:s,nav:a,connection:b&&/^(slow-2g|2g|3g|4g)$/.test(b)?b:void 0,device:Qe(navigator.userAgent)});try{if(navigator.sendBeacon?.($,y))return}catch{}fetch($,{method:"POST",body:y,keepalive:!0}).catch(()=>{})},B=()=>{location.pathname!==d&&(k(),d=location.pathname,a="route",s={},p=Ee(),h=new Map,f=!0,m=!1)};document.addEventListener("visibilitychange",()=>document.visibilityState==="hidden"&&k()),addEventListener("pagehide",k),addEventListener("popstate",B);let A=history.pushState;history.pushState=function(...y){A.apply(this,y),B()}}function et(e,t=Math.random){return t()<(e.sessionSampleRate??0)?"session":t()<(e.onErrorSampleRate??1)?"buffer":null}function $e(e,t,n,i,r){let o=et(e);if(!o||typeof document>"u")return;let c=L(),d,a=document.createElement("script");return a.src=e.src??`${r}blipit-replay.js`,a.async=!0,a.onload=()=>{let s=window.BlipitReplay?.start;d=s?.({id:c,mode:o,endpoint:t,key:n,instance:i})},document.head.appendChild(a),{id:c,active:()=>d?.active()??!1,error:s=>d?.error(s),report:s=>d?.report?.(s)}}var Be='<svg viewBox="0 0 242.4 208.7" aria-hidden="true"><defs><linearGradient id="bm1" x1="0" y1="1" x2=".5" y2="0"><stop offset="0" stop-color="#00C2FF"/><stop offset=".35" stop-color="#3882F6"/><stop offset="1" stop-color="#0F172A"/></linearGradient><linearGradient id="bm2" x1="0" y1="1" x2="1" y2="0"><stop offset="0" stop-color="#3882F6"/><stop offset=".5" stop-color="#00C2FF"/><stop offset="1" stop-color="#3882F6"/></linearGradient></defs><path fill="url(#bm1)" d="M115.5,164.5c-3.9,0-7.8-.4-11.5-1.2-3.7-.8-7.3-1.9-10.8-3.4-3.4-1.4-6.7-3.2-9.7-5.3-3.0-2.0-5.9-4.4-8.5-7.0s-4.9-5.4-7.0-8.5c-2.1-3.1-3.9-6.3-5.3-9.8-1.5-3.5-2.6-7.1-3.4-10.8-.8-3.8-1.2-7.7-1.2-11.5V19.1c0-6.6,5.4-12.0,12.0-12.0s12.0,5.4,12.0,12.0v88.2c0,2.2.2,4.5.7,6.7.4,2.1,1.1,4.2,1.9,6.2.8,2.0,1.9,3.9,3.1,5.7,1.2,1.8,2.6,3.4,4.1,4.9s3.2,2.9,4.9,4.1c1.8,1.2,3.7,2.2,5.6,3.1,2.0.8,4.1,1.5,6.2,1.9,4.4.9,9.1.9,13.4,0,2.1-.4,4.2-1.1,6.2-1.9,2.0-.8,3.9-1.9,5.7-3.1,1.8-1.2,3.4-2.6,4.9-4.1s2.9-3.2,4.1-4.9c1.2-1.8,2.2-3.7,3.1-5.7.8-2.0,1.5-4.1,1.9-6.2.5-2.2.7-4.5.7-6.7s-.2-4.5-.7-6.7c-.4-2.1-1.1-4.2-1.9-6.2-.8-2.0-1.9-3.9-3.1-5.7-1.2-1.8-2.6-3.4-4.1-4.9s-3.2-2.9-4.9-4.1c-1.8-1.2-3.7-2.2-5.7-3.1-2.0-.8-4.1-1.5-6.2-1.9-4.4-.9-9.1-.9-13.4,0-6.5,1.3-12.9-2.9-14.2-9.4-1.3-6.5,2.9-12.9,9.4-14.2,7.6-1.6,15.5-1.6,23.1,0,3.7.8,7.3,1.9,10.8,3.4,3.4,1.4,6.7,3.2,9.7,5.3,3.0,2.0,5.9,4.4,8.5,7.0s4.9,5.4,7.0,8.5c2.1,3.1,3.9,6.3,5.3,9.8,1.5,3.5,2.6,7.1,3.4,10.8.8,3.8,1.2,7.7,1.2,11.5s-.4,7.8-1.2,11.5c-.8,3.7-1.9,7.3-3.4,10.8-1.4,3.4-3.2,6.7-5.3,9.7-2.0,3.0-4.4,5.9-7.0,8.5s-5.4,4.9-8.5,7.0c-3.1,2.1-6.3,3.9-9.8,5.3-3.5,1.5-7.1,2.6-10.8,3.4-3.8.8-7.7,1.2-11.5,1.2Z"/><path fill="url(#bm2)" d="M208.1,103.0c-.0-.6-.8-.9-1.2-.5-3.2,3.1-7.6,5.0-12.4,5.0-3.9,0-9.1-1.6-10.2-2.5-.3-.1-.1,1.4-.1,2.5,0,40.5-34.4,73.0-75.5,70.0-33.4-2.5-60.8-28.8-64.4-62.1-1.0-9.4-.2-18.6,2.2-27.0,1.6-5.6,2.6-11.4,2.6-17.3v-22.4c0-3.4-4.3-5.0-6.5-2.4-13.2,15.4-21.6,35.1-22.7,56.6-2.6,54.1,40.6,98.9,94.1,98.9s94.2-42.3,94.2-94.2c0-1.5-.1-3.0-.1-4.5Z"/><path fill="url(#bm2)" d="M201.2,70.1c-14.8-35.8-50.9-60.5-92.3-58.3h-.1c-8.2.5-14.6,7.4-14.6,15.7v.1c0,5.4,4.7,9.6,10.0,8.8,3.2-.5,6.5-.7,9.9-.7,28.7,0,53.5,17.4,64.3,42.1.2.5.9.6,1.2.1,3.2-4.8,8.7-7.9,14.9-7.9,2.0,0,4.0.3,5.8,1.0.6.2,1.1-.4.9-1.0Z"/><circle fill="#00C2FF" cx="194.5" cy="88" r="15.8"/></svg>';var u=".blipit-rb.blipit-rb",tt=`${u}{all:unset;box-sizing:border-box;display:inline-flex;align-items:center;gap:9px;height:40px;padding-inline:5px 17px;border-radius:99px;font:600 14px/1 system-ui,-apple-system,"Segoe UI",sans-serif;letter-spacing:-.01em;white-space:nowrap;cursor:pointer;user-select:none;-webkit-tap-highlight-color:transparent;color:#fff;background:linear-gradient(135deg,#3882F6,#2F5BEA);box-shadow:0 10px 24px -12px rgba(56,130,246,.8),0 1px 3px rgba(11,26,58,.16),inset 0 1px 0 rgba(255,255,255,.22);transition:transform .2s,box-shadow .2s}${u}:hover{transform:translateY(-1px);box-shadow:0 16px 32px -12px rgba(56,130,246,.85),0 2px 6px rgba(11,26,58,.18),inset 0 1px 0 rgba(255,255,255,.22)}${u}:active{transform:scale(.97)}${u}:focus-visible{outline:3px solid #00C2FF;outline-offset:3px}${u}[aria-busy=true]{cursor:progress}${u}>span{all:unset}${u}>.blipit-rb-m{position:relative;display:grid;place-items:center;flex:none;width:30px;height:30px;border-radius:99px;background:#fff;box-shadow:0 0 0 1px rgba(11,26,58,.08),0 1px 2px rgba(11,26,58,.12)}${u} svg{display:block;width:19px;height:17px}${u}[data-size=sm]{height:32px;gap:7px;padding-inline:4px 13px;font-size:13px}${u}[data-size=sm]>.blipit-rb-m{width:24px;height:24px}${u}[data-size=sm] svg{width:15px;height:13px}${u}[data-variant=outline],${u}[data-variant=ghost]{color:#0B1A3A;background:transparent;box-shadow:inset 0 0 0 1px #CBD7EA}${u}[data-variant=ghost]{box-shadow:none}${u}[data-variant=outline]:hover,${u}[data-variant=ghost]:hover{transform:none;background:rgba(56,130,246,.08);box-shadow:inset 0 0 0 1px rgba(56,130,246,.45)}${u}[data-variant=ghost]:hover{box-shadow:none}${u}[data-theme=dark]{background:linear-gradient(135deg,#5B9BFF,#3D6BF0);box-shadow:0 10px 24px -12px rgba(91,155,255,.7),inset 0 1px 0 rgba(255,255,255,.2)}${u}[data-theme=dark][data-variant=outline],${u}[data-theme=dark][data-variant=ghost]{color:#E8EEF8;background:transparent;box-shadow:inset 0 0 0 1px rgba(255,255,255,.16)}${u}[data-theme=dark][data-variant=ghost]{box-shadow:none}${u}[data-theme=dark][data-variant=outline]:hover,${u}[data-theme=dark][data-variant=ghost]:hover{background:rgba(91,155,255,.16);box-shadow:inset 0 0 0 1px rgba(91,155,255,.45)}${u}[data-theme=dark][data-variant=ghost]:hover{box-shadow:none}${u}[data-theme=dark]>.blipit-rb-m{box-shadow:0 0 0 1px rgba(255,255,255,.1)}${u}[aria-busy=true] svg{visibility:hidden}${u}[aria-busy=true]>.blipit-rb-m::after{content:"";position:absolute;inset:4px;border:2px solid #3882F6;border-right-color:transparent;border-radius:50%;animation:blipit-rb-r .8s linear infinite}@keyframes blipit-rb-r{to{transform:rotate(1turn)}}@media(pointer:coarse){${u}{min-height:44px}}@media(prefers-reduced-motion:reduce){${u}{transition:none}${u}:hover,${u}:active{transform:none}${u}[aria-busy=true]>.blipit-rb-m::after{animation-duration:3s}}@media(forced-colors:active){${u}{border:1px solid ButtonText}}`,Te=0;function _e(e,t={}){Te||N(document,tt);let n=++Te,i=document.createElement("span");i.className="blipit-rb-m",i.innerHTML=Be.replace(/bm(\d)/g,`bm$1-${n}`);let r=document.createElement("span");r.textContent=e.textContent,e.replaceChildren(i,r),e.classList.add("blipit-rb"),e.setAttribute("data-variant",t.variant==="outline"||t.variant==="ghost"?t.variant:"solid"),e.setAttribute("data-size",t.size==="sm"?"sm":"md"),e.setAttribute("data-theme",de(t.theme==="light"||t.theme==="dark"?t.theme:void 0))}var g,Ce=new Set;function Le(e,t){Ce.has(t)||(Ce.add(t),console[e](t))}var nt="[blipit] init() has no key, so error tracking and the Report a bug button are off. Pass your public key (blipit_pk_...) from app.blipit.io, API keys.",it="[blipit] init() got a secret key (blipit_sk_...), so Blipit did not start: secret keys must never be in browser code. Use the public key (blipit_pk_...) and create a new secret key in app.blipit.io, API keys.";function Dt(e){if(g)return;let t=typeof e?.key=="string"?e.key.trim():"";if(!t)return Le("warn",nt);if(t.startsWith("blipit_sk_"))return Le("error",it);if(g=new P({...e,key:t}),e.user){let{id:n,name:i,email:r,username:o}=e.user;g.setUser({id:n===void 0?void 0:String(n),email:r,username:o??i})}Se(g),e.webVitals!==!1&&typeof window<"u"&&Re(e.endpoint??z,t,e.instance),e.replay&&(g.replay=$e(e.replay,e.endpoint??z,t,e.instance,U)),typeof window<"u"&&Z(g),e.debug&&console.log(`[blipit] ${X}@${M} initialized`)}function Pt(e){return g?.captureException(e,!0)}function Ut(e,t){return g?.captureMessage(e,t)}function zt(e){return g?.captureSecurity(e)}function Kt(e){g?.setUser(e)}function jt(e,t){g?.setTag(e,t)}function Wt(e){g?.addBreadcrumb(e)}function qt(e={}){g&&J(g,{...e,eventId:e.eventId??g.lastEventId})}function Me(){g&&K(g)}function Ht(e){e.addEventListener("click",t=>{t.preventDefault(),Me()})}function Xt(e={}){let t=be(e.label,Me);return _e(t,e),t}function Vt(e){g&&ke(g,e)}function Gt(){return g?.flush()??Promise.resolve()}ve(ie);export{Wt as addBreadcrumb,Ht as attachReport,Pt as captureException,Ut as captureMessage,zt as captureSecurity,Gt as flush,Dt as init,Me as openReport,Xt as reportButton,Xe as setReportMetadata,jt as setTag,Kt as setUser,qt as showFeedback,Vt as updateWidget};
1
+ var Ne=5e3,te={en:["Report {ref} sent.","We will email you updates."],ar:["\u062A\u0645 \u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0628\u0644\u0627\u063A {ref}.","\u0633\u0646\u0631\u0627\u0633\u0644\u0643 \u0628\u0627\u0644\u062A\u062D\u062F\u064A\u062B\u0627\u062A."],de:["Meldung {ref} gesendet.","Wir informieren Sie per E-Mail."],es:["Reporte {ref} enviado.","Te enviaremos novedades por correo."],fr:["Signalement {ref} envoy\xE9.","Nous vous tiendrons au courant par e-mail."],it:["Segnalazione {ref} inviata.","Ti invieremo aggiornamenti via email."],ja:["\u5831\u544A {ref} \u3092\u9001\u4FE1\u3057\u307E\u3057\u305F\u3002","\u9032\u6357\u306F\u30E1\u30FC\u30EB\u3067\u304A\u77E5\u3089\u305B\u3057\u307E\u3059\u3002"],nl:["Melding {ref} verstuurd.","We mailen je updates."],pt:["Relato {ref} enviado.","Vamos enviar novidades por e-mail."],tr:["{ref} numaral\u0131 bildirim g\xF6nderildi.","Geli\u015Fmeleri e-postayla bildirece\u011Fiz."],zh:["\u62A5\u544A {ref} \u5DF2\u53D1\u9001\u3002","\u6211\u4EEC\u4F1A\u901A\u8FC7\u90AE\u4EF6\u544A\u77E5\u8FDB\u5C55\u3002"]};function De(e,t,n){if(typeof e!="string"||!/^BR-\d{1,12}$/.test(e))return null;let[r,i]=te[n.toLowerCase().split(/[-_]/)[0]]??te.en;return`${r.replace("{ref}",e)}${t===!0?` ${i}`:""}`}function k(e,t,n){let r=document.createElement(e);return r.style.cssText=t,n!==void 0&&(r.textContent=n),r}var z="display:block;width:100%;box-sizing:border-box;margin:4px 0 12px;padding:8px 10px;font:inherit;border:1px solid #c5ccd6;border-radius:6px;background:#fff;color:#111",ne="font:inherit;padding:8px 14px;border-radius:6px;cursor:pointer;border:1px solid #c5ccd6;background:#fff;color:#111",H=!1;function re(e,t,n){if(H||typeof document>"u"||!document.body)return;H=!0;let r=k("dialog","max-width:420px;width:calc(100% - 32px);padding:20px;border:1px solid #c5ccd6;border-radius:10px;font:14px/1.45 system-ui,sans-serif;color:#111;background:#fff");r.setAttribute("aria-labelledby","blipit-fb-title");let i=k("form","margin:0"),o=k("h2","margin:0 0 12px;font-size:17px",n.title??"Tell us what happened");o.id="blipit-fb-title";let a=(b,T,w)=>{let O=k("label","display:block;font-weight:600",b);O.htmlFor=w,T.id=w,i.append(O,T)},d=k("input",z);d.type="text",d.maxLength=128,d.autocomplete="name",d.value=n.name??"";let c=k("input",z);c.type="email",c.maxLength=254,c.autocomplete="email",c.value=n.email??"";let s=k("textarea",`${z};min-height:110px;resize:vertical`);s.required=!0,s.maxLength=Ne;let l=k("p","margin:0 0 12px;min-height:1.2em;font-size:13px");l.setAttribute("role","status"),l.setAttribute("aria-live","polite");let h=k("div","display:flex;gap:8px;justify-content:flex-end"),f=k("button",ne,"Cancel");f.type="button";let m=k("button",`${ne};background:#111;color:#fff;border-color:#111`,"Send");m.type="submit",i.append(o),a("Name (optional)",d,"blipit-fb-name"),a("Email (optional)",c,"blipit-fb-email"),a("What went wrong?",s,"blipit-fb-message"),h.append(f,m),i.append(l,h),r.append(i),document.body.append(r);let R=()=>{H=!1,r.remove()},$=()=>typeof r.close=="function"&&r.open?r.close():R();f.addEventListener("click",$),r.addEventListener("close",R),i.addEventListener("submit",async b=>{b.preventDefault();let T=s.value.trim();if(!T){l.textContent="Please describe what happened.",s.focus();return}m.disabled=!0,f.disabled=!0,m.setAttribute("aria-busy","true"),m.textContent="Sending\u2026",l.textContent="";try{let w=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json","X-Blipit-Key":t},body:JSON.stringify({name:d.value.trim()||void 0,email:c.value.trim()||void 0,message:T,event_id:n.eventId,url:typeof location<"u"?location.href.split(/[?#]/)[0]:void 0})});if(!w.ok)throw new Error(String(w.status));let O=await w.json().catch(()=>({})),N=De(O.ref,O.emails,typeof navigator>"u"?"en":navigator.language??"en");l.textContent=N??"Thanks, your message was sent.",m.textContent="Sent",setTimeout($,N?4e3:1200)}catch{l.textContent="That did not send. Please try again.",m.disabled=!1,f.disabled=!1,m.removeAttribute("aria-busy"),m.textContent="Send"}}),typeof r.showModal=="function"?r.showModal():r.setAttribute("open",""),s.focus()}var ie=["login_failed","login_succeeded","login_blocked","password_reset_requested","privilege_granted"];var D=class{constructor(t,n,r,i){this.endpoint=t;this.key=n;this.debug=r;this.instance=i;typeof document<"u"&&document.addEventListener&&document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&this.flushWithBeacon()})}endpoint;key;debug;instance;queue=[];timer;sending=!1;enqueue(t){this.queue.push(t),this.queue.length>30&&this.queue.shift(),this.timer||(this.timer=setTimeout(()=>{this.timer=void 0,this.flush()},1e3))}async flush(){if(!this.sending){this.sending=!0;try{for(;this.queue.length>0;){let t=this.queue[0];if(!await this.send(t))break;this.queue.shift()}}finally{this.sending=!1}}}async send(t,n=0){try{let r=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json","X-Blipit-Key":this.key,...this.instance?{"X-Blipit-Instance":this.instance}:{}},body:JSON.stringify(t),keepalive:!0});return r.status===429||r.status>=500?this.retry(t,n):(this.debug&&r.status>=400&&console.warn("[blipit] event rejected",r.status,await r.text()),!0)}catch{return this.retry(t,n)}}async retry(t,n){return n>=2?(this.debug&&console.warn("[blipit] dropping event after retries",t.event_id),!0):(await new Promise(r=>setTimeout(r,1e3*2**n)),this.send(t,n+1))}flushWithBeacon(){if(!(typeof navigator>"u"||!navigator.sendBeacon))for(;this.queue.length>0;){let t=this.queue.shift(),n=`key=${encodeURIComponent(this.key)}${this.instance?`&instance=${encodeURIComponent(this.instance)}`:""}`,r=`${this.endpoint}${this.endpoint.includes("?")?"&":"?"}${n}`;navigator.sendBeacon(r,JSON.stringify(t))}}};function B(){let e=new Uint8Array(16);if(typeof crypto<"u"&&crypto.getRandomValues)crypto.getRandomValues(e);else for(let n=0;n<16;n++)e[n]=Math.floor(Math.random()*256);e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let n=0;n<16;n++)t+=e[n].toString(16).padStart(2,"0");return t}function v(){return new Date().toISOString()}var Pe=/token|key|password|secret|auth|session|passwd|api/i;function M(e){let t=e.indexOf("?");if(t===-1)return e.slice(0,2048);let n=e.slice(0,t),i=e.slice(t+1).split("&").map(o=>{let a=o.indexOf("=");if(a===-1)return o;let d=o.slice(0,a);return Pe.test(d)?`${d}=[redacted]`:o}).join("&");return`${n}?${i}`.slice(0,2048)}var We=/\b((?:[a-zA-Z0-9_-]*(?:token|key|password|secret|auth|session|passwd|api)[a-zA-Z0-9_-]*)=)[^&\s"']+/gi;function oe(e){return e.replace(We,"$1[redacted]")}function p(e,t){return e.length>t?e.slice(0,t):e}var se=".blipit-mask,[data-blipit-mask]";function q(e){return e.replace(/#.*/,"").replace(/([?&][^=&]*)=[^&]*/g,"$1=").slice(0,2048)}function E(e,t,n){e.push(t),e.length>n&&e.shift()}function V(e){let t=e.id?`#${e.id}`:"",n=typeof e.className=="string"&&e.className.trim()?`.${e.className.trim().split(/\s+/).slice(0,2).join(".")}`:"";return p(`${e.tagName.toLowerCase()}${t}${n}`,128)}function P(e,t){try{let n=new CSSStyleSheet;n.replaceSync(t),e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]}catch{let n=document.createElement("style");n.textContent=t,(e===document?document.head:e).append(n)}}function C(e,t){return`${e.replace(/\/api\/v1\/events.*$/,"").replace(/\/$/,"")}${t}`}function ae(e,t){let n=e?/^(https?:\/\/[^?#]*\/)blipit(?:\.min)?\.js(?:[?#].*)?$/.exec(e):null;return n?n[1]:`https://blipit.io/sdk/${t}/`}function de(e,t){let n=`/sdk/${t}/`,[r,i]=t.split(".");return e.endsWith(n)?`${e.slice(0,-n.length)}/sdk/${r==="0"?`${r}.${i}`:r}/`:e}function je(e){let t=e.match(/rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:[,\s/]+([\d.]+%?))?/);if(!t||(t[4]===void 0?1:t[4].endsWith("%")?parseFloat(t[4])/100:parseFloat(t[4]))<.5)return null;let[r,i,o]=[t[1],t[2],t[3]].map(a=>{let d=parseFloat(a)/255;return d<=.03928?d/12.92:((d+.055)/1.055)**2.4});return .2126*r+.7152*i+.0722*o}function ce(e){if(e==="light"||e==="dark")return e;if(typeof document<"u"){for(let n of[document.body,document.documentElement]){if(!n)continue;let r=je(getComputedStyle(n).backgroundColor);if(r!==null)return r<.4?"dark":"light"}let t=getComputedStyle(document.documentElement).colorScheme;if(t==="dark")return"dark";if(t&&t!=="normal"&&!t.includes("dark"))return"light"}return typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var ue={ok:0,errored:1,crashed:2},W=class{constructor(t,n,r,i){this.url=t;this.key=n;this.release=r;this.environment=i;this.start(),typeof document<"u"&&document.addEventListener&&document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.end():this.sid||this.start()})}url;key;release;environment;sid="";started="";status="ok";errors=0;did;setUser(t){this.did=t}markError(t){if(!this.sid)return;this.errors+=1;let n=t?"crashed":"errored";ue[n]<=ue[this.status]||(this.status=n,this.send(!1))}start(){this.sid=B(),this.started=v(),this.status="ok",this.errors=0,this.send(!1)}end(){this.sid&&(this.send(!0),this.sid="")}send(t){let n=JSON.stringify({sid:this.sid,did:this.did,status:this.status==="ok"&&t?"exited":this.status,errors:this.errors,started:this.started,release:this.release,environment:this.environment}),r=`${this.url}?key=${encodeURIComponent(this.key)}`;try{if(t&&typeof navigator<"u"&&navigator.sendBeacon){navigator.sendBeacon(r,n);return}if(typeof fetch>"u")return;fetch(this.url,{method:"POST",headers:{"Content-Type":"application/json","X-Blipit-Key":this.key},body:n,keepalive:!0}).catch(()=>{})}catch{return}}};var Ke=/^\s*at (?:async )?(?:new )?(?:(.+?) )?\(?((?:file|https?|blob|chrome-extension|moz-extension|safari-web-extension|node|webpack):.*?|[^()]+?)(?::(\d+))?(?::(\d+))?\)?\s*$/,Ue=/^\s*(?:(.*?)@)?((?:file|https?|blob|chrome-extension|moz-extension|safari-web-extension|node|webpack).*?|[^@]*?)(?::(\d+))?(?::(\d+))?\s*$/,le=/^(chrome|moz|safari-web)-extension:/;function ze(){if(typeof location<"u"&&location.origin)return location.origin}function He(e){if(le.test(e)||e==="<anonymous>"||e==="[native code]")return!1;let t=ze();return!!(!t||e.startsWith(t)||!/^[a-z]+:/i.test(e))}function pe(e){if(!e)return[];let t=[];for(let n of e.split(`
2
+ `)){if(!n||/^\s*(Error|TypeError|RangeError|SyntaxError|ReferenceError)\b/.test(n))continue;let r=Ke.exec(n)??Ue.exec(n);if(!r)continue;let[,i,o,a,d]=r;if(!o)continue;let c={filename:p(o,1024),in_app:He(o)};i&&(c.function=p(i,512)),a&&(c.lineno=Number(a)),d&&(c.colno=Number(d)),t.push(c)}return t.reverse(),t.slice(-128)}function fe(e){return e.length===0?!1:e.every(t=>le.test(t.filename))}var I="@blipit/browser",S="0.3.12",me=ae(typeof document<"u"?document.currentScript?.src:void 0,S),x={exact:me,channel:de(me,S),debug:!1,tag:!1},K="https://in.blipit.io/api/v1/events",qe=[/ResizeObserver loop/i,/^Script error\.?$/,/__gCrWeb|__firefox__/],Ve={login_failed:"Failed login",login_succeeded:"Successful login",login_blocked:"Blocked login",password_reset_requested:"Password reset requested",privilege_granted:"Privilege granted"},Xe={login_failed:"warning",login_succeeded:"info",login_blocked:"warning",password_reset_requested:"info",privilege_granted:"warning"};function Ye(e){if(!ie.includes(e?.kind))return;let t=p(String(e.actor??"").trim(),256);if(!t)return;let n={kind:e.kind,actor:t};return e.actorId&&(n.actor_id=p(String(e.actorId),128)),e.ip&&(n.ip=p(String(e.ip).trim(),45)),e.userAgent&&(n.user_agent=p(String(e.userAgent),512)),e.database&&(n.database=p(String(e.database),64)),e.outcome&&(n.outcome=p(String(e.outcome),64)),e.target&&(n.target=p(String(e.target),256)),n}var j=class{constructor(t){this.options=t;this.endpoint=t.endpoint??K,this.transport=new D(this.endpoint,t.key,t.debug??!1,t.instance),t.autoSessionTracking&&(t.release?this.session=new W(C(this.endpoint,"/api/v1/sessions"),t.key,t.release,t.environment??"production"):t.debug&&console.warn("[blipit] session tracking needs the release option")),this.maxBreadcrumbs=Math.min(t.maxBreadcrumbs??50,100),this.ignoreErrors=[...qe,...t.ignoreErrors??[]]}options;transport;breadcrumbs=[];user;tags={};maxBreadcrumbs;ignoreErrors;seen=new Set;captured=new WeakSet;session;lastEventId;errorIds=[];logs={console:[],network:[],actions:[]};endpoint;replay;setUser(t){this.user=t,this.session?.setUser(t?.id??t?.email)}setTag(t,n){this.tags[p(t,64)]=p(n,256)}addBreadcrumb(t){let n={timestamp:v(),...t};n.message&&(n.message=oe(n.message)),n.data&&typeof n.data.url=="string"&&(n.data={...n.data,url:M(n.data.url)}),this.breadcrumbs.push(n),this.breadcrumbs.length>this.maxBreadcrumbs&&this.breadcrumbs.shift()}captureException(t,n=!0){if(t&&typeof t=="object"){if(this.captured.has(t))return;this.captured.add(t)}let r=t instanceof Error?t:new Error(String(t)),i={type:r.name||"Error",value:p(r.message||String(r),4096),handled:n},o=pe(r.stack);return o.length>0&&(i.stacktrace={frames:o}),this.processAndSend({exception:i,level:"error"})}captureMessage(t,n="info"){return this.processAndSend({message:p(t,8192),level:n})}captureSecurity(t){let n=Ye(t);if(!n){this.options.debug&&console.warn("[blipit] security event dropped, needs a known kind and an actor");return}return this.processAndSend({message:`${Ve[n.kind]} for ${n.actor}`,level:Xe[n.kind],security:n},!1)}processAndSend(t,n=!0){if(n&&this.options.sampleRate!==void 0&&Math.random()>this.options.sampleRate)return;let r=t.exception?.value??t.message??"";if(n){for(let d of this.ignoreErrors)if(typeof d=="string"?r.includes(d):d.test(r))return;if((this.options.autoMuteExtensions??!0)&&t.exception?.stacktrace&&fe(t.exception.stacktrace.frames))return;let a=`${t.exception?.type??""}|${r}`;if(t.exception?.handled===!1){if(this.seen.has(a)&&this.seen.size<100)return;this.seen.add(a),setTimeout(()=>this.seen.delete(a),5e3)}}let i={event_id:B(),timestamp:v(),platform:"javascript",release:this.options.release,environment:this.options.environment??"production",user:this.user,tags:Object.keys(this.tags).length>0?{...this.tags}:void 0,breadcrumbs:this.breadcrumbs.length>0?[...this.breadcrumbs]:void 0,request:typeof location<"u"?{url:M(location.href)}:void 0,contexts:this.collectContexts(),sdk:this.options._sdk??{name:I,version:S},...t};for(let a of Object.keys(i))i[a]===void 0&&delete i[a];let o=this.replay?.active()&&(i.level==="error"||i.level==="fatal")?this.replay:void 0;if(o&&(i.tags={...i.tags,replay_id:o.id}),this.options.beforeSend){let a=this.options.beforeSend(i);if(!a)return;i=a}return this.transport.enqueue(i),this.lastEventId=i.event_id,(i.level==="error"||i.level==="fatal")&&E(this.errorIds,i.event_id,20),i.exception&&this.session?.markError(i.exception.handled===!1),o?.error(i.event_id),i.event_id}collectContexts(){if(typeof navigator>"u")return;let t={},n=navigator.userAgent??"",r=/(Edg|OPR|Chrome|Firefox|Safari)\/(\d+[\d.]*)/.exec(n)??void 0;r&&(t.browser={name:r[1],version:r[2]});let i=/\(([^)]+)\)/.exec(n);return i&&i[1]&&(t.os={name:p(i[1],64)}),typeof screen<"u"&&(t.device={screen:`${screen.width}x${screen.height}`}),Object.keys(t).length>0?t:void 0}flush(){return this.transport.flush()}};var X={en:["Report a bug","Loading\u2026"],ar:["\u0623\u0628\u0644\u063A \u0639\u0646 \u062E\u0637\u0623","\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u062D\u0645\u064A\u0644\u2026"],de:["Fehler melden","Wird geladen\u2026"],es:["Reportar un error","Cargando\u2026"],fr:["Signaler un bug","Chargement\u2026"],it:["Segnala un bug","Caricamento\u2026"],ja:["\u4E0D\u5177\u5408\u3092\u5831\u544A","\u8AAD\u307F\u8FBC\u307F\u4E2D\u2026"],nl:["Bug melden","Laden\u2026"],pt:["Reportar erro","Carregando\u2026"],tr:["Hata bildir","Y\xFCkleniyor\u2026"],zh:["\u62A5\u544A\u95EE\u9898","\u52A0\u8F7D\u4E2D\u2026"]},Ge="button{all:initial;position:fixed;z-index:2147483646;display:flex;align-items:center;gap:8px;padding:11px 18px;border-radius:99px;background:var(--c,linear-gradient(135deg,#3882F6,#2F5BEA));color:#fff;font:600 14px system-ui,-apple-system,sans-serif;letter-spacing:-.01em;cursor:pointer;box-shadow:0 14px 32px -12px rgba(56,130,246,.75),0 2px 6px rgba(11,26,58,.18),inset 0 1px 0 rgba(255,255,255,.22);transition:transform .2s,box-shadow .2s;animation:in .35s cubic-bezier(.2,.8,.2,1)}button:hover{transform:translateY(-2px);box-shadow:0 20px 40px -12px rgba(56,130,246,.85),0 3px 8px rgba(11,26,58,.2),inset 0 1px 0 rgba(255,255,255,.22)}button:active{transform:scale(.97)}button:focus-visible{outline:3px solid #00C2FF;outline-offset:3px}button:disabled{cursor:progress}svg,i{width:18px;height:18px}i{box-sizing:border-box;border:2px solid;border-right-color:transparent;border-radius:50%;animation:r .8s linear infinite}@keyframes r{to{transform:rotate(1turn)}}@keyframes in{from{opacity:0;transform:translateY(12px) scale(.94)}}.o span{display:none}.o{padding:13px}@media(max-width:480px){span{display:none}button{padding:13px}}@media(pointer:coarse){button{min-height:44px;box-sizing:border-box}}@media(prefers-reduced-motion:reduce){button{animation:none;transition:none}i{animation-duration:3s}}",Je='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round" aria-hidden="true"><path d="M4 4h16v12H9l-5 4zM12 7v4M12 13.5v.5"/></svg>',ye,ge={},xe,_,Y=()=>{},L,he=0;function A(e,t){e.options.debug&&console.log(`[blipit] ${t}`)}function Ze(e){ye=e}var be=(e,t)=>new Promise((n,r)=>{let i=document.createElement("script");i.src=e,i.async=!0,i.onload=()=>n(window[t]),i.onerror=r,document.head.appendChild(i)});function G(e,t,n){return ge[t]??=(async()=>{if(!n&&x.channel!==x.exact){try{let i=await be(x.channel+e,t);if(i?.accepts?.({version:S,api:1}))return i}catch{}window[t]=void 0,x.debug&&console.log(`[blipit] fallback ${x.exact}${e}`)}let r=await be(n??x.exact+e,t);if(!r)throw Error(t);return r})().catch(r=>{throw delete ge[t],r})}function Qe(e,t){try{let n=e.options._sdk??{name:I,version:S},r=t?.[n.name],i=e.options.debug||/^(localhost$|127\.|\[::1])|\.local$/.test(location.hostname);try{i||=process.env.NODE_ENV==="development"}catch{}if(!i||!r||r.version.localeCompare(n.version,"en",{numeric:!0})<1)return;let o=`blipit_latest_${r.version}`,a=sessionStorage;if(a[o])return;a[o]=1,console.info(`[blipit] ${r.version} is available (you have ${n.version})${r.note?` \u2014 ${r.note}`:""} \u2014 ${x.tag?`load ${x.exact.replace(S,r.version)}blipit.js`:`npm install ${n.name}@latest`}`)}catch{}}function ve(){let e=(navigator.language??"en").slice(0,2);return X[e]?e:"en"}function ke(e,t){let n=document.createElement("button");return n.type="button",n.className="blipit-rb",n.setAttribute("aria-haspopup","dialog"),e?n.textContent=e:(n.lang=ve(),n.textContent=X[n.lang][0]),n.addEventListener("click",()=>n.hasAttribute("aria-busy")||t()),n}var we=()=>{};function Se(e){we=e}function J(e,t){we(C(e.endpoint,"/api/v1/feedback"),e.options.key,t)}function U(e){if(typeof document>"u")return;let t=typeof e.options.feedbackWidget=="object"?e.options.feedbackWidget:{},n=document.querySelectorAll("button.blipit-rb"),r=i=>{Y(i),n.forEach(o=>i?o.setAttribute("aria-busy","true"):o.removeAttribute("aria-busy"))};r(!0),Promise.all([G("blipit-report.js","BlipitReport",t.src),xe??=Ee(e)]).then(([i,o])=>o.enabled!==!1&&i.open(e,{metadata:ye,recording:o.recording===!0,recordingMaxMs:o.recording_max_ms,storageFull:o.storage_full===!0,reportsFull:o.reports_full===!0,theme:o.theme,hide:a=>_&&(_.style.display=a?"none":"")}),()=>J(e,{eventId:e.lastEventId,name:e.user?.username,email:e.user?.email})).finally(()=>r(!1))}async function Ee(e){let t=`blipit_fb_${S}_${e.options.key}`;try{let n=JSON.parse(localStorage.getItem(t)??"null");if(n&&Date.now()-n.t<36e5)return n.s}catch{}try{let n=await fetch(C(e.endpoint,"/api/v1/feedback/settings"),{headers:{"X-Blipit-Key":e.options.key,...e.options.instance?{"X-Blipit-Instance":e.options.instance}:{}}});if(!n.ok)return A(e,`widget settings failed (HTTP ${n.status}), using defaults`),{};let r=await n.json();try{localStorage.setItem(t,JSON.stringify({t:Date.now(),s:r}))}catch{}return r}catch{return A(e,"widget settings unreachable (offline, ad blocker or CSP connect-src), using defaults"),{}}}async function Z(e){let t=e.options.feedbackWidget,n=++he;if(typeof document>"u")return;if(t===!1)return A(e,"Report a bug button off: feedbackWidget is false");let r=await(xe??=Ee(e));if(Qe(e,r.latest),n!==he)return;if(r.enabled===!1)return A(e,"Report a bug button hidden by the project's Bug report widget setting");let i={...r,...typeof t=="object"?t:{}},[o,a]=X[ve()],d=i.text||o;_=document.createElement("div"),_.setAttribute("data-blipit-ui","");let c=_.attachShadow({mode:"open"}),s=document.createElement("button");s.type="button";let[l,h]=(/^(bottom|middle)-(left|right)$/.test(i.position??"")?i.position:"bottom-right").split("-");s.style.cssText=`${i.color?`--c:${i.color};`:""}${h}:calc(20px + env(safe-area-inset-${h},0px));${l==="bottom"?"bottom:calc(20px + env(safe-area-inset-bottom,0px))":"top:50%;margin-top:-22px"}`,s.setAttribute("aria-haspopup","dialog"),i.style==="icon"&&(s.className="o",s.title=d);let f=b=>{s.disabled=b,s.setAttribute("aria-label",b?a:d),s.innerHTML=b?"<i></i><span></span>":`${Je}<span></span>`,s.lastChild.textContent=b?a:d};Y=f,f(!1),s.addEventListener("click",()=>U(e)),P(c,Ge),c.append(s);let m=i.shortcut?.toLowerCase().replace(/\s/g,"");L&&document.removeEventListener("keydown",L),L=void 0,m&&(L=b=>{[b.ctrlKey&&"ctrl",b.shiftKey&&"shift",b.altKey&&"alt",b.metaKey&&"meta",b.key.toLowerCase()].filter(Boolean).join("+")===m&&(b.preventDefault(),U(e))},document.addEventListener("keydown",L));let R=_,$=()=>{_===R&&(document.body.append(R),A(e,`Report a bug button shown at ${l}-${h}`))};document.body?$():document.addEventListener("DOMContentLoaded",$)}function _e(e,t){let n=e.options.feedbackWidget;e.options.feedbackWidget=t===!1?!1:{...typeof n=="object"?n:{},...t},_?.remove(),_=void 0,L&&document.removeEventListener("keydown",L),L=void 0,Y=()=>{},Z(e)}function Q(e){return typeof e=="string"?e.length:e?.size}function Re(e){return e&&Number(e)||void 0}function et(e,t){return async(n,r)=>{let i=typeof n=="string"?n:n instanceof URL?n.href:n.url,o=(r?.method??n.method??"GET").toUpperCase(),a=Date.now();try{let d=await e(n,r);return t(o,i,d.status,a,Q(r?.body),Re(d.headers.get("content-length"))),d}catch(d){throw t(o,i,0,a,Q(r?.body)),d}}}function tt(e,t){let n=e.open,r=e.send;e.open=function(i,o){return this._blipit=[String(i).toUpperCase(),String(o)],n.apply(this,arguments)},e.send=function(i){let o=this._blipit;if(o){let a=Date.now();this.addEventListener("loadend",()=>t(o[0],o[1],this.status,a,Q(i),Re(this.getResponseHeader("content-length"))))}return r.apply(this,arguments)}}function $e(e){if(typeof window>"u")return;let t=C(e.endpoint,""),{console:n,network:r,actions:i}=e.logs;window.addEventListener("error",c=>{e.captureException(c.error??c.message,!1)}),window.addEventListener("unhandledrejection",c=>{e.captureException(c.reason,!1)}),typeof document<"u"&&(document.addEventListener("click",c=>{let s=c.target;if(!(s instanceof Element)||s.closest("[data-blipit-ui]"))return;let l=V(s);e.addBreadcrumb({category:"ui.click",message:`Clicked ${l}`});let h=s.closest(se)?"***":p((s.textContent??"").trim().replace(/\s+/g," "),80);E(i,{timestamp:v(),type:"click",selector:l,text:h},50)},{capture:!0,passive:!0}),document.addEventListener("focusin",c=>{let s=c.target;s instanceof Element&&/^(INPUT|TEXTAREA|SELECT)$/.test(s.tagName)&&E(i,{timestamp:v(),type:"focus",selector:V(s)},50)},{capture:!0,passive:!0}));let o=(c,s,l,h,f,m)=>{t&&s.startsWith(t)||(e.addBreadcrumb({category:"http",message:`${c} ${M(s)} \u2192 ${l||"network error"}`,level:l>=400||!l?"error":"info",data:{url:M(s),method:c,status_code:l||void 0}}),E(r,{timestamp:v(),method:c,url:q(s),status:l,duration:Date.now()-h,request_size:f,response_size:m},50))};typeof window.fetch=="function"&&(window.fetch=et(window.fetch.bind(window),o)),typeof XMLHttpRequest<"u"&&tt(XMLHttpRequest.prototype,o);for(let c of["log","info","debug","warn","error"]){let s=console[c].bind(console);console[c]=(...l)=>{let h=p(l.map(f=>typeof f=="string"?f:nt(f)).join(" "),1024);if(c==="warn"||c==="error"){e.addBreadcrumb({category:"console",level:c==="warn"?"warning":"error",message:h});let f=l.find(m=>m instanceof Error);E(n,{timestamp:v(),level:c,message:h,stack:p((f??new Error).stack??"",2e3)},100)}else E(n,{timestamp:v(),level:c,message:h},100);s(...l)}}let a=()=>E(i,{timestamp:v(),type:"navigation",url:q(location.href)},50),d=()=>{e.addBreadcrumb({category:"navigation",message:`Navigated to ${M(location.href)}`}),a()};if(a(),window.history){let c=window.history.pushState.bind(window.history);window.history.pushState=(...s)=>{c(...s),d()},window.addEventListener("popstate",d)}}function nt(e){try{return JSON.stringify(e)??String(e)}catch{return String(e)}}function Te(){let e=0,t=0,n=0,r=0;return i=>(i.hadRecentInput||(t>0&&i.startTime-r<1e3&&i.startTime-n<5e3?t+=i.value:(t=i.value,n=i.startTime),r=i.startTime,t>e&&(e=t)),e)}function rt(e){if(e.size===0)return;let t=[...e.values()].sort((n,r)=>r-n);return t[Math.min(t.length-1,Math.floor(e.size/50))]}function it(e){return/iPad|Tablet|Android(?!.*Mobile)/i.test(e)?"tablet":/Mobi|iPhone|Android/i.test(e)?"mobile":"desktop"}function F(e,t,n){try{new PerformanceObserver(r=>r.getEntries().forEach(i=>t(i))).observe({type:e,buffered:!0,...n})}catch{}}function Oe(e,t,n){if(typeof PerformanceObserver>"u"||typeof document>"u")return;let r=performance.getEntriesByType("navigation")[0],i=r?.activationStart??0,o=y=>Math.max(0,Math.round(y-i)),a=document.visibilityState==="hidden",d=location.pathname,c=r?.type,s={},l=Te(),h=new Map,f=!1,m=!1;r&&r.responseStart>0&&(s.ttfb=o(r.responseStart)),a||(F("paint",y=>{y.name==="first-contentful-paint"&&(s.fcp=o(y.startTime))}),F("largest-contentful-paint",y=>{f||(s.lcp=o(y.startTime))}));let R=()=>{f=!0};addEventListener("keydown",R,{once:!0,capture:!0}),addEventListener("pointerdown",R,{once:!0,capture:!0}),F("layout-shift",y=>{s.cls=Math.round(l(y)*1e4)/1e4});let $=y=>{if(!y.interactionId)return;h.set(y.interactionId,Math.max(h.get(y.interactionId)??0,y.duration));let ee=rt(h);ee!==void 0&&(s.inp=Math.round(ee))};F("event",$,{durationThreshold:40}),F("first-input",$);let b=navigator.connection?.effectiveType,T=`${new URL("/api/v1/vitals",e).href}?key=${encodeURIComponent(t)}${n?`&instance=${encodeURIComponent(n)}`:""}`,w=()=>{if(m||Object.keys(s).length===0)return;m=!0;let y=JSON.stringify({path:d.slice(0,512),metrics:s,nav:c,connection:b&&/^(slow-2g|2g|3g|4g)$/.test(b)?b:void 0,device:it(navigator.userAgent)});try{if(navigator.sendBeacon?.(T,y))return}catch{}fetch(T,{method:"POST",body:y,keepalive:!0}).catch(()=>{})},O=()=>{location.pathname!==d&&(w(),d=location.pathname,c="route",s={},l=Te(),h=new Map,f=!0,m=!1)};document.addEventListener("visibilitychange",()=>document.visibilityState==="hidden"&&w()),addEventListener("pagehide",w),addEventListener("popstate",O);let N=history.pushState;history.pushState=function(...y){N.apply(this,y),O()}}function ot(e,t=Math.random){return t()<(e.sessionSampleRate??0)?"session":t()<(e.onErrorSampleRate??1)?"buffer":null}function Ce(e,t,n,r){let i=ot(e);if(!i||typeof document>"u")return;let o=B(),a;return G("blipit-replay.js","BlipitReplay",e.src).then(d=>a=d.start({id:o,mode:i,endpoint:t,key:n,instance:r}),()=>{}),{id:o,active:()=>a?.active()??!1,error:d=>a?.error(d),report:d=>a?.report?.(d)}}var Le='<svg viewBox="0 0 242.4 208.7" aria-hidden="true"><defs><linearGradient id="bm1" x1="0" y1="1" x2=".5" y2="0"><stop offset="0" stop-color="#00C2FF"/><stop offset=".35" stop-color="#3882F6"/><stop offset="1" stop-color="#0F172A"/></linearGradient><linearGradient id="bm2" x1="0" y1="1" x2="1" y2="0"><stop offset="0" stop-color="#3882F6"/><stop offset=".5" stop-color="#00C2FF"/><stop offset="1" stop-color="#3882F6"/></linearGradient></defs><path fill="url(#bm1)" d="M115.5,164.5c-3.9,0-7.8-.4-11.5-1.2-3.7-.8-7.3-1.9-10.8-3.4-3.4-1.4-6.7-3.2-9.7-5.3-3.0-2.0-5.9-4.4-8.5-7.0s-4.9-5.4-7.0-8.5c-2.1-3.1-3.9-6.3-5.3-9.8-1.5-3.5-2.6-7.1-3.4-10.8-.8-3.8-1.2-7.7-1.2-11.5V19.1c0-6.6,5.4-12.0,12.0-12.0s12.0,5.4,12.0,12.0v88.2c0,2.2.2,4.5.7,6.7.4,2.1,1.1,4.2,1.9,6.2.8,2.0,1.9,3.9,3.1,5.7,1.2,1.8,2.6,3.4,4.1,4.9s3.2,2.9,4.9,4.1c1.8,1.2,3.7,2.2,5.6,3.1,2.0.8,4.1,1.5,6.2,1.9,4.4.9,9.1.9,13.4,0,2.1-.4,4.2-1.1,6.2-1.9,2.0-.8,3.9-1.9,5.7-3.1,1.8-1.2,3.4-2.6,4.9-4.1s2.9-3.2,4.1-4.9c1.2-1.8,2.2-3.7,3.1-5.7.8-2.0,1.5-4.1,1.9-6.2.5-2.2.7-4.5.7-6.7s-.2-4.5-.7-6.7c-.4-2.1-1.1-4.2-1.9-6.2-.8-2.0-1.9-3.9-3.1-5.7-1.2-1.8-2.6-3.4-4.1-4.9s-3.2-2.9-4.9-4.1c-1.8-1.2-3.7-2.2-5.7-3.1-2.0-.8-4.1-1.5-6.2-1.9-4.4-.9-9.1-.9-13.4,0-6.5,1.3-12.9-2.9-14.2-9.4-1.3-6.5,2.9-12.9,9.4-14.2,7.6-1.6,15.5-1.6,23.1,0,3.7.8,7.3,1.9,10.8,3.4,3.4,1.4,6.7,3.2,9.7,5.3,3.0,2.0,5.9,4.4,8.5,7.0s4.9,5.4,7.0,8.5c2.1,3.1,3.9,6.3,5.3,9.8,1.5,3.5,2.6,7.1,3.4,10.8.8,3.8,1.2,7.7,1.2,11.5s-.4,7.8-1.2,11.5c-.8,3.7-1.9,7.3-3.4,10.8-1.4,3.4-3.2,6.7-5.3,9.7-2.0,3.0-4.4,5.9-7.0,8.5s-5.4,4.9-8.5,7.0c-3.1,2.1-6.3,3.9-9.8,5.3-3.5,1.5-7.1,2.6-10.8,3.4-3.8.8-7.7,1.2-11.5,1.2Z"/><path fill="url(#bm2)" d="M208.1,103.0c-.0-.6-.8-.9-1.2-.5-3.2,3.1-7.6,5.0-12.4,5.0-3.9,0-9.1-1.6-10.2-2.5-.3-.1-.1,1.4-.1,2.5,0,40.5-34.4,73.0-75.5,70.0-33.4-2.5-60.8-28.8-64.4-62.1-1.0-9.4-.2-18.6,2.2-27.0,1.6-5.6,2.6-11.4,2.6-17.3v-22.4c0-3.4-4.3-5.0-6.5-2.4-13.2,15.4-21.6,35.1-22.7,56.6-2.6,54.1,40.6,98.9,94.1,98.9s94.2-42.3,94.2-94.2c0-1.5-.1-3.0-.1-4.5Z"/><path fill="url(#bm2)" d="M201.2,70.1c-14.8-35.8-50.9-60.5-92.3-58.3h-.1c-8.2.5-14.6,7.4-14.6,15.7v.1c0,5.4,4.7,9.6,10.0,8.8,3.2-.5,6.5-.7,9.9-.7,28.7,0,53.5,17.4,64.3,42.1.2.5.9.6,1.2.1,3.2-4.8,8.7-7.9,14.9-7.9,2.0,0,4.0.3,5.8,1.0.6.2,1.1-.4.9-1.0Z"/><circle fill="#00C2FF" cx="194.5" cy="88" r="15.8"/></svg>';var u=".blipit-rb.blipit-rb",st=`${u}{all:unset;box-sizing:border-box;display:inline-flex;align-items:center;gap:9px;height:40px;padding-inline:5px 17px;border-radius:99px;font:600 14px/1 system-ui,-apple-system,"Segoe UI",sans-serif;letter-spacing:-.01em;white-space:nowrap;cursor:pointer;user-select:none;-webkit-tap-highlight-color:transparent;color:#fff;background:linear-gradient(135deg,#3882F6,#2F5BEA);box-shadow:0 10px 24px -12px rgba(56,130,246,.8),0 1px 3px rgba(11,26,58,.16),inset 0 1px 0 rgba(255,255,255,.22);transition:transform .2s,box-shadow .2s}${u}:hover{transform:translateY(-1px);box-shadow:0 16px 32px -12px rgba(56,130,246,.85),0 2px 6px rgba(11,26,58,.18),inset 0 1px 0 rgba(255,255,255,.22)}${u}:active{transform:scale(.97)}${u}:focus-visible{outline:3px solid #00C2FF;outline-offset:3px}${u}[aria-busy=true]{cursor:progress}${u}>span{all:unset}${u}>.blipit-rb-m{position:relative;display:grid;place-items:center;flex:none;width:30px;height:30px;border-radius:99px;background:#fff;box-shadow:0 0 0 1px rgba(11,26,58,.08),0 1px 2px rgba(11,26,58,.12)}${u} svg{display:block;width:19px;height:17px}${u}[data-size=sm]{height:32px;gap:7px;padding-inline:4px 13px;font-size:13px}${u}[data-size=sm]>.blipit-rb-m{width:24px;height:24px}${u}[data-size=sm] svg{width:15px;height:13px}${u}[data-variant=outline],${u}[data-variant=ghost]{color:#0B1A3A;background:transparent;box-shadow:inset 0 0 0 1px #CBD7EA}${u}[data-variant=ghost]{box-shadow:none}${u}[data-variant=outline]:hover,${u}[data-variant=ghost]:hover{transform:none;background:rgba(56,130,246,.08);box-shadow:inset 0 0 0 1px rgba(56,130,246,.45)}${u}[data-variant=ghost]:hover{box-shadow:none}${u}[data-theme=dark]{background:linear-gradient(135deg,#5B9BFF,#3D6BF0);box-shadow:0 10px 24px -12px rgba(91,155,255,.7),inset 0 1px 0 rgba(255,255,255,.2)}${u}[data-theme=dark][data-variant=outline],${u}[data-theme=dark][data-variant=ghost]{color:#E8EEF8;background:transparent;box-shadow:inset 0 0 0 1px rgba(255,255,255,.16)}${u}[data-theme=dark][data-variant=ghost]{box-shadow:none}${u}[data-theme=dark][data-variant=outline]:hover,${u}[data-theme=dark][data-variant=ghost]:hover{background:rgba(91,155,255,.16);box-shadow:inset 0 0 0 1px rgba(91,155,255,.45)}${u}[data-theme=dark][data-variant=ghost]:hover{box-shadow:none}${u}[data-theme=dark]>.blipit-rb-m{box-shadow:0 0 0 1px rgba(255,255,255,.1)}${u}[aria-busy=true] svg{visibility:hidden}${u}[aria-busy=true]>.blipit-rb-m::after{content:"";position:absolute;inset:4px;border:2px solid #3882F6;border-right-color:transparent;border-radius:50%;animation:blipit-rb-r .8s linear infinite}@keyframes blipit-rb-r{to{transform:rotate(1turn)}}@media(pointer:coarse){${u}{min-height:44px}}@media(prefers-reduced-motion:reduce){${u}{transition:none}${u}:hover,${u}:active{transform:none}${u}[aria-busy=true]>.blipit-rb-m::after{animation-duration:3s}}@media(forced-colors:active){${u}{border:1px solid ButtonText}}`,Me=0;function Be(e,t={}){Me||P(document,st);let n=++Me,r=document.createElement("span");r.className="blipit-rb-m",r.innerHTML=Le.replace(/bm(\d)/g,`bm$1-${n}`);let i=document.createElement("span");i.textContent=e.textContent,e.replaceChildren(r,i),e.classList.add("blipit-rb"),e.setAttribute("data-variant",t.variant==="outline"||t.variant==="ghost"?t.variant:"solid"),e.setAttribute("data-size",t.size==="sm"?"sm":"md"),e.setAttribute("data-theme",ce(t.theme==="light"||t.theme==="dark"?t.theme:void 0))}var g,Ie=new Set;function Ae(e,t){Ie.has(t)||(Ie.add(t),console[e](t))}var at="[blipit] init() has no key, so error tracking and the Report a bug button are off. Pass your public key (blipit_pk_...) from app.blipit.io, API keys.",dt="[blipit] init() got a secret key (blipit_sk_...), so Blipit did not start: secret keys must never be in browser code. Use the public key (blipit_pk_...) and create a new secret key in app.blipit.io, API keys.";function Yt(e){if(g)return;let t=typeof e?.key=="string"?e.key.trim():"";if(!t)return Ae("warn",at);if(t.startsWith("blipit_sk_"))return Ae("error",dt);if(g=new j({...e,key:t}),e.sdkChannel==="exact"&&(x.channel=x.exact),x.debug=!!e.debug,e.user){let{id:n,name:r,email:i,username:o}=e.user;g.setUser({id:n===void 0?void 0:String(n),email:i,username:o??r})}$e(g),e.webVitals!==!1&&typeof window<"u"&&Oe(e.endpoint??K,t,e.instance),e.replay&&(g.replay=Ce(e.replay,e.endpoint??K,t,e.instance)),typeof window<"u"&&Z(g),e.debug&&console.log(`[blipit] ${I}@${S} initialized`)}function Gt(e){return g?.captureException(e,!0)}function Jt(e,t){return g?.captureMessage(e,t)}function Zt(e){return g?.captureSecurity(e)}function Qt(e){g?.setUser(e)}function en(e,t){g?.setTag(e,t)}function tn(e){g?.addBreadcrumb(e)}function nn(e={}){g&&J(g,{...e,eventId:e.eventId??g.lastEventId})}function Fe(){g&&U(g)}function rn(e){e.addEventListener("click",t=>{t.preventDefault(),Fe()})}function on(e={}){let t=ke(e.label,Fe);return Be(t,e),t}function sn(e){g&&_e(g,e)}function an(){return g?.flush()??Promise.resolve()}Se(re);export{tn as addBreadcrumb,rn as attachReport,Gt as captureException,Jt as captureMessage,Zt as captureSecurity,an as flush,Yt as init,Fe as openReport,on as reportButton,Ze as setReportMetadata,en as setTag,Qt as setUser,nn as showFeedback,sn as updateWidget};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blipit/browser",
3
- "version": "0.3.10",
3
+ "version": "0.3.12",
4
4
  "description": "Blipit error monitoring SDK for browsers. Know your app broke before your users tell you.",
5
5
  "license": "MIT",
6
6
  "type": "module",