@spectosh/browser 0.3.0 → 0.3.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectosh/browser",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Specto for bundler users — session replay (rrweb DOM capture, console/network/error/rage/dead-click signals, privacy-masked in the browser) and Point, the cursor mode people use to mark what is broken.",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -3,8 +3,9 @@
3
3
  // a readable name, where it sits (breadcrumb), its state, the styles that
4
4
  // usually explain a bug, and a masked snapshot of its markup. Masking follows
5
5
  // the recording's rules: inputs never give their value, `specto-mask` and
6
- // strict privacy hide text, sensitive attributes are dropped.
7
- import { scrubText } from '../scrub.js'
6
+ // strict privacy hide text (except where the site shows it: showsText),
7
+ // sensitive attributes are dropped.
8
+ import { scrubText, showsText } from '../scrub.js'
8
9
 
9
10
  const TEST_ATTRS = ['data-testid', 'data-test', 'data-test-id', 'data-cy', 'data-qa']
10
11
  const STYLE_KEYS = ['display', 'visibility', 'opacity', 'pointerEvents', 'zIndex', 'overflow', 'cursor', 'color', 'background']
@@ -19,13 +20,14 @@ const attr = (el, k) => { try { return el.getAttribute(k) } catch { return null
19
20
  export const stableId = (id) => Boolean(id) && id.length <= 64 && !/\d{4,}|^:|:r\w*:|^(ember|react|radix|headlessui|mui|rc|el)[-_:]?\d/i.test(id) && /^[A-Za-z][\w-]*$/.test(id)
20
21
  const stableClass = (c) => c && !c.startsWith('specto-') && c.length <= 40 && !/\d{3,}|^(css|sc|jsx|emotion|tw)-|__[A-Za-z0-9]{5,}$|^[a-z0-9]{6,}$/i.test(c)
21
22
 
22
- export function isMasked(el, strict) {
23
- if (strict) return true
23
+ export function isMasked(el, strict, unmask = '') {
24
+ const t = tagOf(el)
25
+ if (t === 'input' || t === 'textarea' || t === 'select' || attr(el, 'contenteditable') === 'true') return true
26
+ if (strict) return !showsText(el, unmask)
24
27
  for (let n = el; n && n.nodeType === 1; n = n.parentElement) {
25
28
  if (n.classList?.contains('specto-mask') || n.classList?.contains('specto-block')) return true
26
29
  }
27
- const t = tagOf(el)
28
- return t === 'input' || t === 'textarea' || t === 'select' || attr(el, 'contenteditable') === 'true'
30
+ return false
29
31
  }
30
32
 
31
33
  function testIdOf(el) {
@@ -173,7 +175,7 @@ export function stylesOf(el) {
173
175
  }
174
176
 
175
177
  // a compact, masked snapshot of the element's markup (agents read it)
176
- export function snapshotOf(el, { strict = false, maxNodes = 60, maxDepth = 4, maxChars = 4000 } = {}) {
178
+ export function snapshotOf(el, { strict = false, unmask = '', maxNodes = 60, maxDepth = 4, maxChars = 4000 } = {}) {
177
179
  let nodes = 0
178
180
  const walk = (n, depth, masked) => {
179
181
  if (nodes++ > maxNodes) return '…'
@@ -185,7 +187,8 @@ export function snapshotOf(el, { strict = false, maxNodes = 60, maxDepth = 4, ma
185
187
  if (n.nodeType !== 1) return ''
186
188
  const tag = tagOf(n)
187
189
  if (['script', 'style', 'noscript', 'template', 'svg'].includes(tag)) return tag === 'svg' ? '<svg/>' : ''
188
- const m = masked || isMasked(n, strict)
190
+ // strict: each element by itself (a shown element may sit in a masked one)
191
+ const m = strict ? isMasked(n, true, unmask) || Boolean(n.closest?.('[contenteditable="true"]')) : masked || isMasked(n, false)
189
192
  const attrs = []
190
193
  for (const a of Array.from(n.attributes || [])) {
191
194
  if (!KEEP_ATTRS.has(a.name)) continue
@@ -205,7 +208,7 @@ export function snapshotOf(el, { strict = false, maxNodes = 60, maxDepth = 4, ma
205
208
  }
206
209
  return `${open}${inner}</${tag}>`
207
210
  }
208
- return walk(el, 0, isMasked(el, strict)).slice(0, maxChars)
211
+ return walk(el, 0, isMasked(el, strict, unmask)).slice(0, maxChars)
209
212
  }
210
213
 
211
214
  // the chip next to the cursor: component › test id › selector
@@ -215,8 +218,8 @@ export function chipOf(el, d) {
215
218
  }
216
219
 
217
220
  // everything at once, for a marker
218
- export function describe(el, { strict = false } = {}) {
219
- const masked = isMasked(el, strict)
221
+ export function describe(el, { strict = false, unmask = '' } = {}) {
222
+ const masked = isMasked(el, strict, unmask)
220
223
  const { component, source } = componentOf(el)
221
224
  const name = accessibleName(el, masked)
222
225
  const role = roleOf(el)
@@ -235,7 +238,7 @@ export function describe(el, { strict = false } = {}) {
235
238
  text: masked ? null : (name || null),
236
239
  state: stateOf(el),
237
240
  styles: stylesOf(el),
238
- snapshot: snapshotOf(el, { strict }),
241
+ snapshot: snapshotOf(el, { strict, unmask }),
239
242
  }
240
243
  return d
241
244
  }
@@ -60,6 +60,7 @@ export function openPoint(rec, cfg = {}) {
60
60
  if (document.getElementById('specto-point')) return null
61
61
  const p = rec._point
62
62
  const strict = () => p.strict()
63
+ const unmask = () => p.unmask?.() || ''
63
64
  const markers = [] // { n, el, kind, flag, note, at, desc, ctx, region }
64
65
  let state = 'armed' // armed | marking | flow | sent
65
66
  let hover = null
@@ -167,7 +168,7 @@ export function openPoint(rec, cfg = {}) {
167
168
  if (markers.length >= MAX_MARKERS) { say(`At most ${MAX_MARKERS} markers in one report`, true); return }
168
169
  offerVoice()
169
170
  const at = Date.now()
170
- const desc = describe(el, { strict: strict() })
171
+ const desc = describe(el, { strict: strict(), unmask: unmask() })
171
172
  const ctx = contextFor({ recent: p.recent(), contains: (c) => el === c || el.contains(c) || c.contains?.(el), now: at })
172
173
  const m = {
173
174
  n: markers.length + 1, el, kind: region ? 'region' : 'element', flag: 'broken', note: '', at, desc, ctx,
@@ -264,7 +265,7 @@ export function openPoint(rec, cfg = {}) {
264
265
  outline.style.width = `${r.width}px`
265
266
  outline.style.height = `${r.height}px`
266
267
  if (hover !== el) {
267
- const masked = isMasked(el, strict())
268
+ const masked = isMasked(el, strict(), unmask())
268
269
  const { component } = componentOf(el)
269
270
  const label = chipOf(el, { component, name: accessibleName(el, masked).slice(0, 30) })
270
271
  outline.querySelector('.chip').textContent = label
package/src/recorder.js CHANGED
@@ -27,8 +27,9 @@
27
27
  // sessionStorage; a new session starts after 30 minutes without interaction
28
28
  // or after 4 hours. Batches are numbered so the server de-duplicates retries.
29
29
  //
30
- // Privacy: inputs are always masked; strict privacy masks all text and keeps
31
- // only the path of recorded URLs;
30
+ // Privacy: inputs are always masked; strict privacy masks all text (except
31
+ // what the site shows: `specto-unmask`, the `unmask` option or the
32
+ // project's selectors) and keeps only the path of recorded URLs;
32
33
  // `specto-mask` / `specto-block` classes for fine control; sensitive
33
34
  // attributes, URL credentials and PII-looking text are scrubbed in the
34
35
  // browser. Honors an opt-out flag, Do-Not-Track / Global Privacy Control when
@@ -38,9 +39,9 @@
38
39
  import { record } from 'rrweb'
39
40
  import { createUploader } from './uploader.js'
40
41
  import { resolveDestination } from './destination.js'
41
- import { scrubText } from './scrub.js'
42
+ import { scrubText, showsText } from './scrub.js'
42
43
 
43
- export const SDK_VERSION = '0.3.0'
44
+ export const SDK_VERSION = '0.3.1'
44
45
 
45
46
  // ---- privacy helpers --------------------------------------------------------
46
47
  // Attribute scrubbing — rrweb masks text/inputs but NOT element attributes,
@@ -252,6 +253,8 @@ async function remoteConfig(url, key) {
252
253
  * endpoint full ingest URL (legacy; overrides host)
253
254
  * configUrl project config URL (default: endpoint's /api/sdk/config; false = none)
254
255
  * privacy 'balanced' | 'strict' (strict masks all text, drops console text and URL query strings)
256
+ * unmask under strict privacy, a CSS selector list whose text is shown (scrubbed),
257
+ * e.g. 'nav, .price' — also the `specto-unmask` class / data-specto-unmask
255
258
  * sampleRate 0..1 — fraction of sessions recorded (decided once per session)
256
259
  * privacySignals 'respect' never records visitors whose browser sends
257
260
  * Do-Not-Track or Global Privacy Control; by default the
@@ -319,7 +322,7 @@ function createRecorder(opts, dest, signal = false) {
319
322
  let session = null // { id, sk, b, started, active, sampled }
320
323
  // the page's own settings apply until the project's arrive (then the
321
324
  // stricter of both); `now()` is whichever is in force
322
- const local = { strict: opts.privacy === 'strict', console: opts.console !== false, networkDetails: opts.networkDetails !== false }
325
+ const local = { strict: opts.privacy === 'strict', unmask: typeof opts.unmask === 'string' ? opts.unmask : '', console: opts.console !== false, networkDetails: opts.networkDetails !== false }
323
326
  let cfg = null
324
327
  const now = () => cfg || local
325
328
  // the page an error or rage click happened on (sessions span page loads)
@@ -496,6 +499,7 @@ function createRecorder(opts, dest, signal = false) {
496
499
  endpoint: endpoint.replace(/\/api\/ingest$/, '/api/point'),
497
500
  release,
498
501
  strict: () => now().strict,
502
+ unmask: () => now().unmask || '',
499
503
  identified: () => identified,
500
504
  recent: () => ({ network: recent.network.slice(), console: recent.console.slice(), event: recent.event.slice(), clicks: recent.clicks.slice() }),
501
505
  active: (on) => { pointOn = Boolean(on) },
@@ -533,6 +537,8 @@ function createRecorder(opts, dest, signal = false) {
533
537
  readyResolve(r)
534
538
  cfg = {
535
539
  strict: opts.privacy === 'strict' || r.privacy === 'strict',
540
+ // the text a strict page shows: the page's own list and the project's
541
+ unmask: [typeof opts.unmask === 'string' ? opts.unmask : '', typeof r.unmask === 'string' ? r.unmask : ''].filter(Boolean).join(','),
536
542
  console: opts.console !== false && r.captureConsole !== false,
537
543
  networkDetails: opts.networkDetails !== false && r.captureNetworkDetails !== false,
538
544
  sampleRate: Math.min(opts.sampleRate ?? 1, typeof r.sampleRate === 'number' ? r.sampleRate : 1),
@@ -582,6 +588,9 @@ function createRecorder(opts, dest, signal = false) {
582
588
  maskInputOptions: { password: true, email: true, tel: true, color: false },
583
589
  maskTextClass: 'specto-mask',
584
590
  maskTextSelector: strict ? '*' : undefined,
591
+ // every masked text comes here: shown (and scrubbed) only where a strict
592
+ // page shows it, never inside specto-mask
593
+ maskTextFn: (text, el) => (now().strict && showsText(el, now().unmask) ? scrubText(text) : String(text).replace(/\S/g, '*')),
585
594
  blockClass: 'specto-block',
586
595
  recordCanvas: false,
587
596
  collectFonts: false,
package/src/scrub.js CHANGED
@@ -13,3 +13,16 @@ export function scrubText(s) {
13
13
  for (const [re, rep] of TEXT_SCRUBBERS) out = out.replace(re, rep)
14
14
  return out
15
15
  }
16
+
17
+ // Strict privacy masks every text on the page. The site can show the text of
18
+ // elements it has checked: `specto-unmask` / `data-specto-unmask` in its
19
+ // markup, or the project's selector list (Settings → Privacy & masking).
20
+ // Never inside `specto-mask` / `specto-block`, never a form field, and what
21
+ // shows is still scrubbed (above). An invalid selector shows nothing.
22
+ export const UNMASK = '.specto-unmask,[data-specto-unmask]'
23
+ export function showsText(el, extra) {
24
+ try {
25
+ if (!el || !el.closest || el.closest('.specto-mask,.specto-block')) return false
26
+ return Boolean(el.closest(UNMASK) || (extra && el.closest(extra)))
27
+ } catch { return false }
28
+ }
package/types/index.d.ts CHANGED
@@ -16,6 +16,8 @@ export interface RecordingOptions {
16
16
  configUrl?: string | false
17
17
  /** `'strict'` masks all text (inputs are always masked) and keeps only the path of URLs. */
18
18
  privacy?: 'balanced' | 'strict'
19
+ /** Under strict privacy, a CSS selector list whose text is shown (still scrubbed of emails and card-like numbers), e.g. `'nav, .price'`. Also the `specto-unmask` class. */
20
+ unmask?: string
19
21
  /** Fraction of sessions recorded, decided once per session (0–1). */
20
22
  sampleRate?: number
21
23
  /** `'required'`: record and store nothing until `grantConsent()`. */
@@ -1,252 +0,0 @@
1
- const e=require("./src-BfP2ol_O.cjs");var t=[`data-testid`,`data-test`,`data-test-id`,`data-cy`,`data-qa`],n=[`display`,`visibility`,`opacity`,`pointerEvents`,`zIndex`,`overflow`,`cursor`,`color`,`background`],r=new Set([`id`,`class`,`role`,`type`,`name`,`href`,`disabled`,`aria-disabled`,`aria-expanded`,`aria-busy`,`aria-hidden`,`aria-pressed`,`aria-selected`,`aria-checked`,`for`,`data-specto-src`,...t]),i=new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`source`,`track`,`wbr`]),a=e=>String(e).replace(/\\/g,`\\\\`).replace(/"/g,`\\"`),o=e=>String(e?.tagName||``).toLowerCase(),s=(e,t)=>{try{return e.getAttribute(t)}catch{return null}},c=e=>!!e&&e.length<=64&&!/\d{4,}|^:|:r\w*:|^(ember|react|radix|headlessui|mui|rc|el)[-_:]?\d/i.test(e)&&/^[A-Za-z][\w-]*$/.test(e),l=e=>e&&!e.startsWith(`specto-`)&&e.length<=40&&!/\d{3,}|^(css|sc|jsx|emotion|tw)-|__[A-Za-z0-9]{5,}$|^[a-z0-9]{6,}$/i.test(e);function u(e,t){if(t)return!0;for(let t=e;t&&t.nodeType===1;t=t.parentElement)if(t.classList?.contains(`specto-mask`)||t.classList?.contains(`specto-block`))return!0;let n=o(e);return n===`input`||n===`textarea`||n===`select`||s(e,`contenteditable`)===`true`}function d(e){for(let n of t){let t=s(e,n);if(t)return[n,t]}return null}function f(e){let t=o(e),n=e.id;if(c(n))return{sel:`${t}#${n}`,anchor:!0};let r=d(e);if(r)return{sel:`${t}[${r[0]}="${a(r[1])}"]`,anchor:!0};let i=typeof e.className==`string`?e.className.trim().split(/\s+/).filter(l).slice(0,2):[],s=i.length?`${t}.${i.join(`.`)}`:t,u=e.parentElement;if(u){let n=Array.from(u.children||[]).filter(e=>o(e)===t);n.length>1&&(s+=`:nth-of-type(${n.indexOf(e)+1})`)}return{sel:s,anchor:!1}}function p(e,t=5){let n=[];for(let r=e,i=0;r&&r.nodeType===1&&i<t&&o(r)!==`html`&&o(r)!==`body`;r=r.parentElement,i++){let e=f(r);if(n.unshift(e.sel),e.anchor)break}return n.join(` > `)||o(e)||`body`}function m(t,n){let r=s(t,`aria-label`)||s(t,`title`)||s(t,`alt`);if(r&&!n)return e._(r).trim().slice(0,80);let i=s(t,`aria-labelledby`);if(i&&!n)try{let t=document.getElementById(i)?.textContent;if(t)return e._(t).trim().slice(0,80)}catch{}if(n)return``;let a=(t.innerText??t.textContent??``).replace(/\s+/g,` `).trim();return e._(a).slice(0,80)}function h(e){let t=s(e,`role`);if(t)return t;let n=o(e);return n===`a`&&s(e,`href`)!=null?`link`:n===`button`||n===`input`&&[`submit`,`button`,`reset`].includes(s(e,`type`))?`button`:n===`input`?s(e,`type`)===`checkbox`?`checkbox`:s(e,`type`)===`radio`?`radio`:`textbox`:n===`select`?`combobox`:n===`textarea`?`textbox`:/^h[1-6]$/.test(n)?`heading`:n===`img`?`img`:null}function g(e,{masked:t}={}){let n=[],r=d(e);r&&n.push(`[${r[0]}="${a(r[1])}"]`),c(e.id)&&n.push(`#${e.id}`);let i=h(e),o=m(e,t);return i&&o&&o.length<=40&&n.push(`role=${i}[name="${a(o)}"]`),n.push(p(e)),[...new Set(n)].slice(0,6)}function _(e){let t=null;for(let n=e;n&&n.nodeType===1&&!t;n=n.parentElement)t=s(n,`data-specto-src`);let n=e&&Object.keys(e).find(e=>e.startsWith(`__reactFiber$`)||e.startsWith(`__reactInternalInstance$`));if(n)for(let r=e[n],i=0;r&&i<60;r=r.return,i++){let e=r.type;if(!e||typeof e==`string`)continue;let n=e.displayName||e.name||e.render?.displayName||e.render?.name||e.type?.displayName||e.type?.name;if(n&&/^[A-Z]/.test(n)&&!/^(Fragment|Suspense|StrictMode|Profiler|Provider|Consumer|Context)/.test(n)){let e=r._debugSource;return!t&&e?.fileName&&(t=`${String(e.fileName).replace(/^.*?\/(src|app|pages|components)\//,`$1/`)}:${e.lineNumber}`),{component:n.slice(0,120),source:t}}}for(let n=e,r=0;n&&r<20;n=n.parentElement,r++){let e=n.__vueParentComponent;if(e){let n=e.type?.name||e.type?.__name||e.type?.__file&&String(e.type.__file).split(`/`).pop().replace(/\.vue$/,``);if(n)return{component:n,source:t||(e.type?.__file?String(e.type.__file).replace(/^.*?\/src\//,`src/`):null)}}let r=n.__svelte_meta;if(r?.loc?.file)return{component:String(r.loc.file).split(`/`).pop().replace(/\.svelte$/,``),source:t||`${r.loc.file}:${r.loc.line}`}}return{component:null,source:t}}function v(t){let n=[];for(let r=t.parentElement,i=0;r&&r.nodeType===1&&i<25&&n.length<6;r=r.parentElement,i++){let t=o(r);if(t===`body`||t===`html`)break;let i=s(r,`role`),a=s(r,`aria-label`);([`main`,`nav`,`header`,`footer`,`aside`,`form`,`dialog`,`section`,`table`].includes(t)||[`dialog`,`navigation`,`form`,`region`,`tabpanel`,`menu`].includes(i)||c(r.id)||d(r))&&n.unshift(`${t}${c(r.id)?`#${r.id}`:``}${a?`[${e._(a).slice(0,30)}]`:``}`)}return n}function y(e){let t={},n=o(e);e.disabled===!0||s(e,`aria-disabled`)===`true`?t.disabled=!0:[`button`,`input`,`select`,`textarea`].includes(n)&&(t.disabled=!1),n===`input`&&[`checkbox`,`radio`].includes(s(e,`type`))&&(t.checked=!!e.checked);let r=s(e,`aria-expanded`);return r!=null&&(t.expanded=r===`true`),s(e,`aria-busy`)===`true`&&(t.busy=!0),Object.keys(t).length?t:void 0}function b(e){try{let t=getComputedStyle(e),r={};for(let e of n){let n=e===`background`?t.backgroundColor:t[e];n!=null&&n!==``&&(r[e]=String(n).slice(0,80))}return r}catch{return{}}}function x(t,{strict:n=!1,maxNodes:a=60,maxDepth:s=4,maxChars:c=4e3}={}){let l=0,d=(t,f,p)=>{if(l++>a)return`…`;if(t.nodeType===3){let n=String(t.textContent||``).replace(/\s+/g,` `);return n.trim()?p?n.replace(/\S/g,`•`).slice(0,60):e._(n).slice(0,120).replace(/</g,`&lt;`):n?` `:``}if(t.nodeType!==1)return``;let m=o(t);if([`script`,`style`,`noscript`,`template`,`svg`].includes(m))return m===`svg`?`<svg/>`:``;let h=p||u(t,n),g=[];for(let n of Array.from(t.attributes||[])){if(!r.has(n.name))continue;let t=n.value;if(n.name===`href`)try{t=new URL(t,location.href).pathname}catch{t=``}n.name===`class`&&(t=t.split(/\s+/).filter(e=>e&&!e.startsWith(`specto-`)).slice(0,4).join(` `)),g.push(t===``?n.name:`${n.name}="${e._(t).slice(0,80).replace(/"/g,`&quot;`)}"`)}m===`input`&&g.push(`value="[masked]"`);let _=`<${m}${g.length?` `+g.join(` `):``}>`;if(i.has(m))return _;if(f>=s)return`${_}…</${m}>`;let v=``;for(let e of Array.from(t.childNodes||[]))if(v+=d(e,f+1,h),v.length>c)break;return`${_}${v}</${m}>`};return d(t,0,u(t,n)).slice(0,c)}function S(e,t){let n=d(e);return[t.component,n?n[1]:null,t.name||o(e)].filter(Boolean).slice(0,2).join(` › `)||o(e)}function ee(t,{strict:n=!1}={}){let r=u(t,n),{component:i,source:a}=_(t),c=m(t,r),l=h(t),d=null;try{let e=t.getBoundingClientRect();d={x:Math.round(e.left),y:Math.round(e.top),w:Math.round(e.width),h:Math.round(e.height)}}catch{}return{tag:o(t),role:l,label:r?null:s(t,`aria-label`)?e._(s(t,`aria-label`)).slice(0,120):null,name:c?`${c}${l?` ${l}`:``}`:l||o(t),component:i,source:a,selectors:g(t,{masked:r}),path:v(t),rect:d,text:r?null:c||null,state:y(t),styles:b(t),snapshot:x(t,{strict:n})}}var C=1e3,w=6e3,T=1e4;function E(e,t,n=Date.now()){for(let r=e.length-1;r>=0;r--){let i=e[r];if(n-i.at>6e4)break;try{if(i.el&&t(i.el))return i.at}catch{}}return null}function te({recent:e,contains:t,now:n=Date.now()}){let r=E(e.clicks||[],t,n),[i,a]=r?[r-C,r+w]:[n-T,n],o=(e.network||[]).filter(e=>e.at>=i&&e.at<=a).slice(-20).map(e=>({at:e.at,method:e.method,url:e.url,status:e.status,dur:e.dur,...e.error?{error:!0}:{}})),s=(e.console||[]).filter(e=>e.level===`error`||e.level===`warn`).slice(-15).map(e=>({at:e.at,level:e.level,text:e.text})),c=(e.event||[]).filter(e=>e.type===`error`).slice(-5).map(e=>({at:e.at,level:`error`,text:e.message,stack:e.stack})),l=(e.event||[]).filter(e=>[`click`,`nav`,`rage`,`dead`,`custom`].includes(e.type)&&e.at<=n&&n-e.at<12e4).slice(-15).map(e=>({at:e.at,type:e.type,target:e.sel||e.target||null,path:e.path||null,name:e.name||null}));return{network:o,console:[...s,...c].sort((e,t)=>e.at-t.at).slice(-20),events:l,clickedAt:r}}function ne(){let e=navigator.userAgent||``,t=window.innerWidth,n=(navigator.maxTouchPoints||0)>0,r=e=>{try{return window.matchMedia(e).matches}catch{return!1}};return{browser:e.slice(0,200),os:/Windows/.test(e)?`Windows`:/Mac OS X|Macintosh/.test(e)?n?`iPadOS`:`macOS`:/Android/.test(e)?`Android`:/iPhone|iPad|iOS/.test(e)?`iOS`:/Linux/.test(e)?`Linux`:null,device:t<640?`phone`:t<1024&&n?`tablet`:`desktop`,locale:navigator.language||null,tz:(()=>{try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return null}})(),reducedMotion:r(`(prefers-reduced-motion: reduce)`),colorScheme:r(`(prefers-color-scheme: dark)`)?`dark`:`light`,viewport:{w:t,h:window.innerHeight}}}var D=[`audio/webm;codecs=opus`,`audio/ogg;codecs=opus`,`audio/mp4`,`audio/webm`],O=.08,k=700,re=2e4,ie=()=>typeof window<`u`&&window.MediaRecorder!==void 0&&!!navigator.mediaDevices?.getUserMedia;async function ae({onPhrase:e=()=>{},keep:t=!1}={}){let n=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0}}),r=D.find(e=>{try{return MediaRecorder.isTypeSupported(e)}catch{return!1}})||``,i={...r?{mimeType:r}:{},audioBitsPerSecond:16e3},a=Date.now(),o=null,s=null,c=null;try{s=new(window.AudioContext||window.webkitAudioContext);let e=s.createMediaStreamSource(n);o=s.createAnalyser(),o.fftSize=1024,c=new Uint8Array(o.fftSize),e.connect(o)}catch{}let l=()=>{if(!o)return 0;o.getByteTimeDomainData(c);let e=0;for(let t of c)e+=(t-128)*(t-128);return Math.min(1,Math.sqrt(e/c.length)/40)},u=null,d=!1,f=()=>{if(d)return;let e=new MediaRecorder(n,i),t={rec:e,chunks:[],at:Date.now(),spoke:!o,loudAt:0};e.ondataavailable=e=>{e.data?.size&&t.chunks.push(e.data)},e.start(),u=t},p=()=>new Promise(t=>{let n=u;if(u=null,!n)return t();n.rec.onstop=()=>{if(n.spoke&&n.chunks.length){let t=n.rec.mimeType||r||`audio/webm`;try{e({blob:new Blob(n.chunks,{type:t}),mime:t,startedAt:n.at,endedAt:Date.now()})}catch{}}t()};try{n.rec.stop()}catch{t()}}),m=()=>{u&&(p(),f())};f();let h=setInterval(()=>{if(!u)return;let e=Date.now();o&&l()>=O&&(u.spoke=!0,u.loudAt=e),u.spoke&&(u.loudAt&&e-u.loudAt>k||e-u.at>re)&&m()},50),g=null;t&&(g={rec:new MediaRecorder(n,i),chunks:[]},g.rec.ondataavailable=e=>{e.data?.size&&g.chunks.push(e.data)},g.rec.start(1e3));let _=null;return{startedAt:a,level:l,cut:m,stop:()=>_||(d=!0,clearInterval(h),_=(async()=>{await p();let e=null;g&&(e=await new Promise(e=>{let t=g.rec.mimeType||r||`audio/webm`,n=()=>e({blob:new Blob(g.chunks,{type:t}),mime:t,startedAt:a});if(g.rec.state===`inactive`)return n();g.rec.onstop=n;try{g.rec.stop()}catch{n()}}));for(let e of n.getTracks())e.stop();try{s?.close()}catch{}return e})(),_)}}function oe(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result).split(`,`)[1]||``),r.onerror=()=>n(r.error),r.readAsDataURL(e)})}var A=`specto-point-used`,j=`specto-point-visits`,se=`specto-point-visit`,M=`specto-point-hint`,N=`specto-point-nudged`,P=`specto-point-me`,F=`specto-point-hidden`,I=12e3,L=`specto-point-receipts`,R=7776e6,z=()=>{try{return(JSON.parse(localStorage.getItem(`specto-point-receipts`)||`[]`)||[]).filter(e=>e&&e.r&&Date.now()-e.at<R)}catch{return[]}},ce=e=>H.set(localStorage,L,JSON.stringify(e.slice(-20))),B=e=>{let t=z().filter(t=>t.r!==e);t.push({r:e,at:Date.now()}),ce(t),H.set(localStorage,`${L}-at`,String(Date.now()))},le=e=>ce(z().filter(t=>t.r!==e)),ue=2e3,V=2592e6,H={get:(e,t)=>{try{return e.getItem(t)}catch{return null}},set:(e,t,n)=>{try{e.setItem(t,n)}catch{}}};function de(e,t=location.pathname){return!e?.length||e.some(e=>RegExp(`^${e.replace(/[.+?^${}()|[\]\\]/g,`\\$&`).replace(/\*/g,`.*`)}$`).test(t))}function fe(e){let t=parseInt(String(e).slice(1),16);if(!Number.isFinite(t))return`#fff`;let[n,r,i]=[t>>16,t>>8&255,t&255].map(e=>(e/=255,e<=.03928?e/12.92:((e+.055)/1.055)**2.4));return .2126*n+.7152*r+.0722*i>.4?`#0E1320`:`#fff`}var U=()=>/Mac|iPhone|iPad/.test(globalThis.navigator?.platform||``);function pe(e,t=U()){return e.trigger===`double-ctrl`?t?[`⌘`,`⌘`]:[`Ctrl`,`Ctrl`]:e.trigger===`chord`?[`Alt`,`Shift`,`P`]:e.trigger===`hold-alt`?[t?`⌥`:`Alt`]:e.trigger===`hold-ctrl`?[`Ctrl`]:e.trigger===`custom`?String(e.shortcut?.label||``).split(`+`).filter(Boolean):[]}function W(e,t=U()){let n=pe(e,t);return n.length?e.trigger.startsWith(`hold`)?`hold ${n[0]}`:e.trigger===`double-ctrl`?n.join(` `):n.join(`+`):``}var G=e=>String(e).replace(/[&<>"]/g,e=>({"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`})[e]),me=(e,t=`kc`)=>e.map(e=>`<kbd class="${t}">${G(e)}</kbd>`).join(``);function he(e){let t=pe(e);return t.length?e.trigger===`double-ctrl`?`Tap ${t[0]===`⌘`?`⌘`:`Ctrl`} twice`:e.trigger.startsWith(`hold`)?`Hold ${t[0]}`:`Press ${t.join(`+`)}`:``}var ge=[`bottom-right`,`bottom-left`,`edge`];function K(e,t){if(t===!1)return null;if(!t||typeof t!=`object`)return e;let n=e||{label:`Report a problem`,position:`bottom-right`,color:`#0E1320`,pages:[]},r=Array.isArray(t.offset)?t.offset.slice(0,2).map(e=>Math.max(0,Math.min(600,Math.round(Number(e)||0)))):null;return{...n,...ge.includes(t.position)?{position:t.position}:{},...typeof t.label==`string`&&t.label.trim()?{label:t.label.trim().slice(0,40)}:{},.../^#[0-9a-f]{6}$/i.test(t.color||``)?{color:t.color}:{},...r&&r.length===2?{offset:r}:{}}}function _e(e,{used:t,visits:n,last:r,release:i,now:a=Date.now()}){return!e||t?!1:e.when===`monthly`?!r||a-r.at>=V:e.when===`release`?!!i&&r?.release!==i:n>=3&&!r}function ve(e,t,n){let r=0;if(t.includes(`network`))for(let t of e.network||[])t.at>n&&(t.error||t.status>=500)&&(r=Math.max(r,t.at));for(let i of e.event||[])i.at<=n||(i.type===`error`&&t.includes(`error`)||i.type===`rage`&&t.includes(`rage`)||i.type===`dead`&&t.includes(`dead`))&&(r=Math.max(r,i.at));return r}function q(e,t,{open:n,may:r,local:i}){let a=e._point,o=typeof matchMedia==`function`&&matchMedia(`(pointer: coarse)`).matches,s=o?[]:pe(t);H.get(sessionStorage,se)||(H.set(sessionStorage,se,`1`),H.set(localStorage,j,String((Number(H.get(localStorage,j))||0)+1)));let c=document.createElement(`div`);c.id=`specto-point-entry`,c.className=`specto-block`,c.setAttribute(`style`,`all:initial;position:fixed;top:0;left:0;width:0;height:0;overflow:visible;z-index:var(--specto-launcher-z,2147483645)`);let l=c.attachShadow({mode:`open`}),u=K(t.launcher,i),d={};try{d=JSON.parse(H.get(localStorage,P)||`{}`)||{}}catch{}let f=e=>{d={...d,...e},H.set(localStorage,P,JSON.stringify(d)),x(),V()},p=()=>u?.position===`edge`?`edge`:d.side||(u?.position===`bottom-left`?`left`:`right`),m=()=>p()===`left`?`left`:`right`;l.innerHTML=`<style>${Y}</style>
2
- <button class="pill" type="button" hidden>
3
- <svg class="ic" viewBox="0 0 16 16" aria-hidden="true"><circle cx="8" cy="8" r="5.5"/><circle class="d" cx="8" cy="8" r="1.6"/></svg>
4
- <span class="lbl"></span>${s.length?`<span class="keys" aria-hidden="true">${me(s)}</span>`:``}
5
- </button>
6
- <div class="menu lmenu" role="menu" aria-label="Report a problem button" hidden>
7
- <button class="m-open" type="button" role="menuitem">${G(u?.label||`Report a problem`)}</button>
8
- <hr>
9
- <button class="m-size" type="button" role="menuitem"></button>
10
- <button class="m-side" type="button" role="menuitem"></button>
11
- <button class="m-hide" type="button" role="menuitem">Hide for this visit</button>
12
- <p class="tip">Or drag it out of the way</p>
13
- </div>
14
- <div class="menu cmenu" role="menu" aria-label="Report a problem here" hidden>
15
- <button class="c-go" type="button" role="menuitem"><svg class="ic" viewBox="0 0 16 16" aria-hidden="true"><circle cx="8" cy="8" r="5.5"/><circle class="d" cx="8" cy="8" r="1.6"/></svg>Report a problem here</button>
16
- <p class="tip">Shift + right-click for the browser’s menu</p>
17
- </div>
18
- <div class="card nudge" role="dialog" aria-label="Something didn't work?" hidden>
19
- <div class="hd"><span class="red" aria-hidden="true"></span><b>That didn’t work?</b></div>
20
- <p>Show us what happened: point at it and say what you expected. Takes 20 seconds.</p>
21
- <div class="row"><button class="go" type="button">Show us</button><button class="no" type="button">Not now</button>${s.length?`<span class="or">or ${me(s)}</span>`:``}</div>
22
- </div>
23
- <div class="card hint" role="dialog" aria-label="Report a problem" hidden>
24
- <div class="hd">${s.length?`<span class="big" aria-hidden="true">${me(s,`kc lg`)}</span>`:``}<b>Spot something broken?</b></div>
25
- <p>${s.length?`${he(t)}, click`:`${o?`Tap`:`Click`} “${G(K(t.launcher,i)?.label||`Report a problem`)}”, then ${o?`tap`:`click`}`} what’s wrong and tell us. We see exactly what you saw.</p>
26
- <div class="row"><button class="go" type="button">Try it now</button><button class="no" type="button">Got it</button></div>
27
- </div>`;let h=e=>l.querySelector(e);document.documentElement.appendChild(c);let g=h(`.pill`),_=h(`.nudge`),v=h(`.hint`),y=h(`.lmenu`),b=h(`.cmenu`);function x(){g.querySelector(`.lbl`).textContent=u?.label||``,g.className=`pill ${p()}${d.compact&&p()!==`edge`?` compact`:``}`,g.setAttribute(`aria-label`,u?.label||`Report a problem`),g.title=`${u?.label||`Report a problem`}${s.length?` (${W(t)})`:``}`,g.style.setProperty(`--bg`,u?.color||`#0E1320`),g.style.setProperty(`--ink`,fe(u?.color||`#0E1320`));for(let[e,t]of[`x`,`y`].entries()){let n=t===`y`&&Number.isFinite(d.y)?d.y:u?.offset?.[e];n==null?c.style.removeProperty(`--specto-launcher-${t}`):c.style.setProperty(`--specto-launcher-${t}`,`${n}px`)}y.querySelector(`.m-size`).textContent=d.compact?`Show the label`:`Make it smaller`,y.querySelector(`.m-side`).textContent=p()===`left`?`Move it to the right`:`Move it to the left`,y.querySelector(`.m-side`).hidden=p()===`edge`,y.querySelector(`.m-size`).hidden=p()===`edge`,_.classList.toggle(`left`,m()===`left`),_.classList.toggle(`right`,m()===`right`);let e=t.hint?.where===`launcher`?m():t.hint?.where===`bottom-left`?`left`:`right`;v.classList.toggle(`left`,e===`left`),v.classList.toggle(`right`,e===`right`),v.classList.toggle(`by`,!!u&&u.position!==`edge`&&e===m())}x();let S=null,ee=0,C=!1,w=()=>{y.hidden=!0,b.hidden=!0,C=!1};function T(){w();let e=g.getBoundingClientRect();y.style.bottom=`${Math.max(8,innerHeight-e.top+8)}px`,y.style.left=p()===`left`?`${Math.max(8,e.left)}px`:``,y.style.right=p()===`left`?``:`${Math.max(8,innerWidth-e.right)}px`,y.hidden=!1,C=!0,y.querySelector(`button`).focus()}g.addEventListener(`click`,e=>{S?.moved?e.preventDefault():(g.hidden=!0,n(`launcher`))}),g.addEventListener(`contextmenu`,e=>{e.preventDefault(),e.stopPropagation(),T()}),g.addEventListener(`pointerdown`,e=>{e.button===0&&(S={x:e.clientX,y:e.clientY,moved:!1},e.pointerType!==`mouse`&&(ee=setTimeout(()=>{S&&!S.moved&&(S=null,T())},550)))});let E=e=>{if(!S||!S.moved&&Math.hypot(e.clientX-S.x,e.clientY-S.y)<6)return;clearTimeout(ee),S.moved=!0,g.classList.add(`dragging`);let t=g.getBoundingClientRect(),n=p()===`edge`;g.style.left=`${n?innerWidth-t.width:Math.min(innerWidth-t.width-8,Math.max(8,e.clientX-t.width/2))}px`,g.style.right=`auto`,g.style.top=`${Math.min(innerHeight-t.height-8,Math.max(8,e.clientY-t.height/2))}px`,g.style.bottom=`auto`,g.style.transform=n?`rotate(180deg)`:`none`},te=e=>{if(clearTimeout(ee),!S?.moved){S=null;return}let t=g.getBoundingClientRect();g.classList.remove(`dragging`);for(let e of[`left`,`right`,`top`,`bottom`,`transform`])g.style[e]=``;let n=Math.round(Math.min(innerHeight-t.height-8,Math.max(8,innerHeight-t.bottom)));f({y:n,...p()===`edge`?{}:{side:e.clientX<innerWidth/2?`left`:`right`}}),setTimeout(()=>{S=null},0)};window.addEventListener(`pointermove`,E,!0),window.addEventListener(`pointerup`,te,!0),y.querySelector(`.m-open`).addEventListener(`click`,()=>{w(),g.hidden=!0,n(`launcher`)}),y.querySelector(`.m-size`).addEventListener(`click`,()=>{w(),f({compact:!d.compact})}),y.querySelector(`.m-side`).addEventListener(`click`,()=>{w(),f({side:p()===`left`?`right`:`left`})}),y.querySelector(`.m-hide`).addEventListener(`click`,()=>{w(),H.set(sessionStorage,F,`1`),V()});let ne=null,D=e=>!!e.closest(`a[href],input,textarea,select,img,video,[contenteditable=""],[contenteditable="true"]`)||!!String(getSelection?.()||``).trim(),O=e=>{if(!t.context||t.context===`off`||e.composedPath?.().includes(c)||document.getElementById(`specto-point`)||!r())return;let i=e.target instanceof Element?e.target:null;if(i){if(e.shiftKey||e.altKey){if(t.context===`menu`&&e.shiftKey)return;e.preventDefault(),w(),n(`context`,i)}else t.context!==`menu`||D(i)||(e.preventDefault(),w(),ne=i,b.style.left=`${Math.min(e.clientX,innerWidth-250)}px`,b.style.top=`${Math.min(e.clientY,innerHeight-90)}px`,b.hidden=!1,C=!0,b.querySelector(`button`).focus())}};b.querySelector(`.c-go`).addEventListener(`click`,()=>{let e=ne;w(),e?.isConnected&&n(`context`,e)}),window.addEventListener(`contextmenu`,O,!0);let k=e=>{C&&!e.composedPath?.().includes(c)&&w()},re=e=>{C&&e.key===`Escape`&&(w(),g.focus?.())};window.addEventListener(`pointerdown`,k,!0),window.addEventListener(`keydown`,re,!0),window.addEventListener(`scroll`,w,{passive:!0,capture:!0});let ie=0,ae=0,oe=Date.now(),L=()=>{ie=Date.now()};window.addEventListener(`keydown`,L,!0);let R=()=>{_.hidden=!0};_.querySelector(`.go`).addEventListener(`click`,()=>{R(),n(`nudge`)}),_.querySelector(`.no`).addEventListener(`click`,R);let z=null;try{z=JSON.parse(H.get(localStorage,M)||`null`)}catch{}let ce=()=>H.get(localStorage,A)===`1`,B=()=>{v.hidden=!0};v.querySelector(`.go`).addEventListener(`click`,()=>{B(),n(`hint`)}),v.querySelector(`.no`).addEventListener(`click`,B);let le=!1,V=()=>{let e=!!document.getElementById(`specto-point`),n=r()&&!e,i=!!document.getElementById(`specto-feedback-host`),o=H.get(sessionStorage,F)===`1`;if(g.hidden=!(u&&n&&!i&&!o&&de(u.pages)),g.hidden&&!y.hidden&&w(),e&&(R(),B()),t.nudge&&n&&!ae&&!H.get(sessionStorage,N)){let e=ve(a.recent(),t.nudge,oe),n=Date.now()-ie<ue||/^(INPUT|TEXTAREA|SELECT)$/.test(document.activeElement?.tagName||``)||document.activeElement?.isContentEditable;e&&!n&&(ae=Date.now(),H.set(sessionStorage,N,`1`),B(),_.hidden=!1,setTimeout(R,I)),e&&(oe=e)}if(t.hint&&n&&!le){le=!0;let e=Number(H.get(localStorage,j))||0;_e(t.hint,{used:ce(),visits:e,last:z,release:a.release})&&(H.set(localStorage,M,JSON.stringify({at:Date.now(),release:a.release||null})),setTimeout(()=>{_.hidden&&!document.getElementById(`specto-point`)&&(v.hidden=!1)},1500))}};V();let U=setInterval(V,1e3),ge=new MutationObserver(V);return ge.observe(document.documentElement,{childList:!0}),{launcher(e){u=K(t.launcher,e),x(),V()},stop(){clearInterval(U),ge.disconnect(),window.removeEventListener(`keydown`,L,!0),window.removeEventListener(`pointermove`,E,!0),window.removeEventListener(`pointerup`,te,!0),window.removeEventListener(`contextmenu`,O,!0),window.removeEventListener(`pointerdown`,k,!0),window.removeEventListener(`keydown`,re,!0),window.removeEventListener(`scroll`,w,!0),c.remove()}}}function ye(e,{open:t}={}){let n=(e||[]).filter(e=>e&&e.title).slice(0,3);if(!n.length||document.getElementById(`specto-point-fixed`))return null;let r=document.createElement(`div`);r.id=`specto-point-fixed`,r.className=`specto-block`,r.setAttribute(`style`,`all:initial;position:fixed;top:0;left:0;width:0;height:0;overflow:visible;z-index:2147483646`);let i=r.attachShadow({mode:`open`}),a=n[0];i.innerHTML=`<style>${Y}${J}</style>
28
- <div class="card fixed" role="status" aria-live="polite">
29
- <button class="x" type="button" aria-label="Dismiss"><svg viewBox="0 0 12 12" aria-hidden="true"><path d="M3 3l6 6M9 3l-6 6"/></svg></button>
30
- <div class="hd"><span class="okc" aria-hidden="true"><svg viewBox="0 0 12 12"><path d="M2.5 6.2 5 8.5 9.5 3.5"/></svg></span><b></b></div>
31
- <p class="msg"></p>${n.length>1?`<p class="more">And ${n.length-1} more you reported ${n.length>2?`are`:`is`} fixed too.</p>`:``}
32
- <div class="row"><button class="go" type="button">Got it</button><button class="no still" type="button">Still happening?</button></div>
33
- </div>`,i.querySelector(`b`).textContent=`Fixed: ${a.title}`,i.querySelector(`.msg`).textContent=a.message||`The fix is live. Thank you, it helped.`;let o=()=>r.remove();return i.querySelector(`.x`).addEventListener(`click`,o),i.querySelector(`.go`).addEventListener(`click`,o),i.querySelector(`.still`).addEventListener(`click`,()=>{o(),t?.(`fixed`,null,a.receipt)}),document.documentElement.appendChild(r),{close:o}}var J=`
34
- .card.fixed{top:20px;right:20px;bottom:auto;width:340px;padding:16px 16px 14px}
35
- .fixed .hd{align-items:flex-start;padding-right:22px}
36
- .fixed .hd b{line-height:1.4}
37
- .okc{width:22px;height:22px;flex:none;border-radius:50%;background:#14C8A6;display:flex;align-items:center;justify-content:center}
38
- .okc svg{width:12px;height:12px;fill:none;stroke:#0E1320;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
39
- .fixed .more{font-size:12px;color:#8A93A6}
40
- .fixed .row{margin-top:2px}
41
- .x{position:absolute;top:8px;right:8px;width:28px;height:28px;border:0;border-radius:6px;background:none;color:#8A93A6;display:flex;align-items:center;justify-content:center;cursor:pointer}
42
- .x svg{width:12px;height:12px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round}
43
- .x:hover{color:#F4F5F8}
44
- @media (max-width:480px){.card.fixed{left:12px;right:12px;width:auto}}
45
- `,Y=`
46
- :host{all:initial}
47
- *{-webkit-user-select:none;user-select:none}
48
- input,textarea{-webkit-user-select:text;user-select:text}
49
- *{box-sizing:border-box;font-family:ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif}
50
- [hidden]{display:none!important}
51
- .kc{display:inline-flex;align-items:center;justify-content:center;min-width:20px;height:20px;padding:0 5px;border:1px solid rgba(255,255,255,.22);border-bottom-width:2px;border-radius:5px;background:rgba(255,255,255,.06);color:inherit;font:600 10.5px/1 ui-monospace,SFMono-Regular,Menlo,monospace;white-space:nowrap}
52
- .kc.lg{min-width:34px;height:26px;padding:0 8px;font-size:12.5px;border-bottom-width:3px;border-radius:6px}
53
- .keys,.or,.big{display:inline-flex;align-items:center;gap:3px}
54
- .pill{position:fixed;bottom:var(--specto-launcher-y,20px);display:inline-flex;align-items:center;gap:10px;height:40px;padding:0 12px 0 11px;border:0;border-radius:999px;background:var(--bg,#0E1320);color:var(--ink,#fff);font:600 13px/1 ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif;cursor:pointer;box-shadow:0 8px 22px rgba(7,10,16,.28);white-space:nowrap}
55
- .pill.right{right:var(--specto-launcher-x,20px)}.pill.left{left:var(--specto-launcher-x,20px)}
56
- .pill .ic{width:16px;height:16px;flex:none;fill:none;stroke:#A9A0FF;stroke-width:1.6}
57
- .pill .ic .d{fill:#A9A0FF;stroke:none}
58
- .pill .keys{opacity:.7}
59
- .pill .kc{height:18px;min-width:18px;border-color:currentColor;background:transparent;opacity:.85}
60
- .pill.edge{right:0;bottom:auto;top:calc(50% + var(--specto-launcher-y,0px) - 20px);height:auto;padding:14px 9px;gap:8px;border-radius:10px 0 0 10px;writing-mode:vertical-rl;transform:translateY(-50%) rotate(180deg)}
61
- .pill.edge .keys{display:none}
62
- .pill:hover{filter:brightness(1.12)}
63
- .pill:focus-visible,.card button:focus-visible{outline:2px solid #5B4BF0;outline-offset:2px}
64
- .card{position:fixed;bottom:calc(var(--specto-launcher-y,20px) + 52px);width:330px;background:#0E1320;color:#F4F5F8;border-radius:12px;padding:14px 16px;box-shadow:0 12px 32px rgba(7,10,16,.35);font-size:13px;display:flex;flex-direction:column;gap:10px}
65
- .card.right{right:var(--specto-launcher-x,20px)}.card.left{left:var(--specto-launcher-x,20px)}
66
- .card.hint:not(.by){bottom:24px}
67
- .hd{display:flex;align-items:center;gap:10px}
68
- .hd b{font-size:14px;font-weight:600}
69
- .red{width:8px;height:8px;border-radius:50%;background:#F87171;flex:none}
70
- .card p{margin:0;line-height:1.5;color:#C3C8D4}
71
- .row{display:flex;align-items:center;gap:10px}
72
- .go{height:34px;padding:0 14px;background:#5B4BF0;border:0;color:#fff;border-radius:8px;font-weight:600;font-size:13px;cursor:pointer}
73
- .no{height:34px;padding:0 10px;background:none;border:0;color:#8A93A6;font-size:13px;cursor:pointer}
74
- .or{margin-left:auto;gap:4px;font-size:11px;color:#8A93A6}
75
- .pill.compact{width:44px;height:44px;padding:0;justify-content:center;gap:0}
76
- .pill.compact .lbl,.pill.compact .keys{display:none}
77
- .pill.compact .ic{width:20px;height:20px}
78
- .pill.compact::after{content:"";position:absolute;inset:-4px;border-radius:50%;border:2px solid rgba(169,160,255,.55);animation:sp-pulse 2.4s ease-out 2;pointer-events:none}
79
- @keyframes sp-pulse{0%{transform:scale(.85);opacity:1}100%{transform:scale(1.35);opacity:0}}
80
- .pill.dragging{cursor:grabbing;transition:none;box-shadow:0 14px 34px rgba(7,10,16,.4)}
81
- .menu{position:fixed;min-width:210px;background:#0E1320;color:#F4F5F8;border:1px solid #2a3346;border-radius:10px;padding:5px;box-shadow:0 12px 32px rgba(7,10,16,.4);font-size:13px;display:flex;flex-direction:column}
82
- .menu button{display:flex;align-items:center;gap:8px;text-align:left;background:none;border:0;color:inherit;font:inherit;padding:8px 10px;border-radius:7px;cursor:pointer}
83
- .menu button:hover,.menu button:focus-visible{background:rgba(91,75,240,.22);outline:none}
84
- .menu .m-open,.menu .c-go{font-weight:600}
85
- .menu .ic{width:16px;height:16px;fill:none;stroke:#A9A0FF;stroke-width:1.6}
86
- .menu .ic .d{fill:#A9A0FF;stroke:none}
87
- .menu hr{border:0;border-top:1px solid #232c40;margin:4px 2px}
88
- .menu .tip{margin:4px 10px 6px;font-size:11px;color:#8A93A6}
89
- @media (prefers-reduced-motion:reduce){.pill.compact::after{animation:none;opacity:0}}
90
- @media (max-width:480px){.card{width:calc(100vw - 40px)}}
91
- `,be=[`broken`,`wrong`,`slow`,`confusing`,`idea`],xe=`specto-point-voice`,Se=`specto-point-sent`,Ce=`specto-point-used`,we=2,Te=6e3,Ee=[``,`①`,`②`,`③`,`④`,`⑤`,`⑥`,`⑦`,`⑧`,`⑨`,`⑩`],De=`<svg viewBox="0 0 18 18" aria-hidden="true"><rect x="6.5" y="2" width="5" height="9" rx="2.5"/><path d="M3.5 8.5a5.5 5.5 0 0 0 11 0M9 14v2.5"/></svg>`,Oe=`<svg viewBox="0 0 12 12" aria-hidden="true"><path d="M2.5 6.2 5 8.5 9.5 3.5"/></svg>`,X={get:e=>{try{return localStorage.getItem(e)}catch{return null}},set:(e,t)=>{try{localStorage.setItem(e,t)}catch{}}},ke={broken:`#F43F5E`,wrong:`#F59E0B`,slow:`#8B5CF6`,confusing:`#0EA5E9`,idea:`#10B981`},Ae={broken:`Broken`,wrong:`Wrong`,slow:`Slow`,confusing:`Confusing`,idea:`Idea`},je=`specto-point-howto`,Me=20,Ne=8,Pe={"double-ctrl":`Double-tap Ctrl`,"hold-alt":`Hold Alt`,"hold-ctrl":`Hold Ctrl`,chord:`Alt + Shift + P`},Fe=[`pointerdown`,`pointerup`,`mousedown`,`mouseup`,`click`,`dblclick`,`auxclick`,`contextmenu`,`touchstart`,`touchend`];function Z(e,t={}){if(document.getElementById(`specto-point`))return null;let n=e._point,r=()=>n.strict(),i=[],a=`armed`,o=null,s=null,c=null,l=null,d=null,f=null,p=0,h=[],g=0,v=!1,y=!1,b=0,x=!1,C=!1,w=document.createElement(`div`);w.id=`specto-point`,w.className=`specto-block`,w.setAttribute(`style`,`all:initial;position:fixed;top:0;left:0;width:0;height:0;overflow:visible;z-index:2147483646`);let T=w.attachShadow({mode:`open`});T.innerHTML=`<style>${Ie}</style>
92
- <div class="ring" data-state="armed" aria-hidden="true"><span class="badge"></span><span class="dot"></span></div>
93
- <div class="outline" aria-hidden="true"><span class="chip"></span></div>
94
- <div class="frame" aria-hidden="true"></div>
95
- <div class="marks"></div>
96
- <section class="rail" role="region" aria-label="Specto Point — report what is wrong">
97
- <header><b>Point</b><span class="hint"></span><button class="x" aria-label="Leave Point" title="Leave (Esc)">×</button></header>
98
- <ol class="list"></ol>
99
- <p class="empty">Click what is wrong. Drag to frame an area.</p>
100
- <div class="vcard" hidden>
101
- <b>Tell us like you’d tell a friend</b>
102
- <p>Point at things and just talk: “this button does nothing”. Your words show up here as you go.</p>
103
- <p class="fine">Your browser will ask to use the microphone. We only turn your voice into text; the recording is deleted.</p>
104
- <button class="vstart" type="button">${De}Start talking</button>
105
- <p class="fine c">Rather type? Just start typing.</p>
106
- </div>
107
- <div class="listening" hidden>
108
- <div class="lh"><span class="rd" aria-hidden="true"></span>Listening<span class="bars" aria-hidden="true"><i></i><i></i><i></i><i></i><i></i></span></div>
109
- <p class="cap" aria-live="polite"></p>
110
- <p class="fine">Each phrase shows up a moment after you pause, on the marker you were pointing at.</p>
111
- </div>
112
- <details class="exp"><summary>Expected / what happened</summary>
113
- <input class="expected" maxlength="500" placeholder="What did you expect?" aria-label="What did you expect?">
114
- <input class="actual" maxlength="500" placeholder="What happened instead?" aria-label="What happened instead?">
115
- </details>
116
- <label class="keep" hidden><input type="checkbox"> Also send my voice recording (kept 30 days)</label>
117
- <button class="flowbtn" type="button" title="F — use the page normally while Specto brackets this stretch of the recording">Record a flow</button>
118
- <div class="row bottom">
119
- <button class="mic" type="button" hidden aria-label="Talk" title="M — talk instead of typing; your words appear as you go">${De}</button>
120
- <button class="typei" type="button" hidden>Type instead</button>
121
- <button class="send" type="button" disabled>Send</button>
122
- </div>
123
- <p class="status" role="status" aria-live="polite"></p>
124
- </section>
125
- <div class="howto" hidden role="dialog" aria-label="How Point works"></div>`;let E=e=>T.querySelector(e),D=E(`.ring`),O=E(`.outline`),k=E(`.frame`),re=E(`.marks`),A=E(`.rail`),j=E(`.list`),se=E(`.status`),M=E(`.hint`);document.documentElement.appendChild(w);let N=document.createElement(`style`);N.id=`specto-point-cursor`,N.textContent=`html.specto-point-on,html.specto-point-on *{cursor:none!important}`,document.head?.appendChild(N);let P=e=>document.documentElement.classList.toggle(`specto-point-on`,e);P(!0),n.active(!0);let F=e=>e.composedPath?.().includes(w),I=(e,t)=>{se.textContent=e||``,se.classList.toggle(`bad`,!!t)};function L(e){a=e,D.dataset.state=l?`${e} listening`:e;let t=e===`flow`;P(!t&&e!==`sent`),n.active(!t&&e!==`sent`),O.style.display=t?`none`:``,M.textContent=e===`flow`?`Use the page — F ends the flow`:`Esc to cancel`,E(`.flowbtn`).textContent=c&&!c.end?`End the flow`:c?.end?`Flow recorded ✓`:`Record a flow`,E(`.flowbtn`).classList.toggle(`on`,e===`flow`),E(`.send`).disabled=y||!(i.length||c?.end||E(`.expected`).value.trim()||E(`.actual`).value.trim()),E(`.empty`).hidden=i.length>0,D.querySelector(`.badge`).textContent=e===`marking`||e===`armed`?String(i.length+1):``}function R(e){e!==g&&(l&&(l.cut(),h.push({at:Date.now(),marker:e})),g=e)}function z(e,t){if(i.length>=Me){I(`At most ${Me} markers in one report`,!0);return}Xe();let a=Date.now(),o=ee(e,{strict:r()}),s=te({recent:n.recent(),contains:t=>e===t||e.contains(t)||t.contains?.(e),now:a}),c={n:i.length+1,el:e,kind:t?`region`:`element`,flag:`broken`,note:``,at:a,desc:o,ctx:s,region:t?{x:t.x+scrollX,y:t.y+scrollY,w:t.w,h:t.h}:null};t&&(c.desc.rect={x:Math.round(t.x),y:Math.round(t.y),w:Math.round(t.w),h:Math.round(t.h)}),i.push(c),R(c.n),H(),L(`marking`),tt||ce(e,t)}function ce(e,t){if(innerWidth<=560)return;let n;try{n=t||e.getBoundingClientRect()}catch{return}let r=A.getBoundingClientRect();n.x<r.right&&n.x+(n.w??n.width)>r.left&&n.y<r.bottom&&n.y+(n.h??n.height)>r.top&&A.classList.toggle(`left`)}function ue(e){i.splice(e,1),i.forEach((e,t)=>{e.n=t+1}),R(i.length?i[i.length-1].n:0),H(),L(i.length?`marking`:`armed`)}let V=e=>{e.flag=be[(be.indexOf(e.flag)+1)%be.length],H()};function H(){j.replaceChildren(...i.map((e,t)=>{let n=document.createElement(`li`);return n.innerHTML=`<button class="num" type="button" title="Change the flag" style="--c:${ke[e.flag]}">${e.n}</button>
126
- <span class="what"><span class="name"></span><button class="flag" type="button" style="--c:${ke[e.flag]}">${Ae[e.flag]}</button></span>
127
- <textarea class="note" rows="1" maxlength="1000" placeholder="${l?`Talk, or type here`:`Note (optional)`}" aria-label="Note for marker ${e.n}"></textarea>
128
- <button class="rm" type="button" aria-label="Remove marker ${e.n}">×</button>`,n.dataset.n=String(e.n),n.querySelector(`.name`).textContent=e.desc.component?`${e.desc.component} · ${e.desc.name}`:e.desc.name,n.querySelector(`.note`).value=e.note,n.querySelector(`.note`).addEventListener(`input`,t=>{e.note=t.target.value}),n.querySelector(`.note`).addEventListener(`focus`,()=>R(e.n)),n.querySelector(`.num`).addEventListener(`click`,()=>V(e)),n.querySelector(`.flag`).addEventListener(`click`,()=>V(e)),n.querySelector(`.rm`).addEventListener(`click`,()=>ue(t)),n.addEventListener(`pointerenter`,()=>R(e.n)),n})),re.replaceChildren(...i.map(e=>{let t=document.createElement(`div`);return t.className=`mk ${e.kind}`,t.style.setProperty(`--c`,ke[e.flag]),t.innerHTML=`<button class="pin" type="button" aria-label="Marker ${e.n}: ${Ae[e.flag]} — click to change">${e.n}</button>`,t.querySelector(`.pin`).addEventListener(`click`,t=>{t.stopPropagation(),V(e)}),e.node=t,t})),de()}function de(){for(let e of i){if(!e.node)continue;let t;if(e.region)t={left:e.region.x-scrollX,top:e.region.y-scrollY,width:e.region.w,height:e.region.h};else try{t=e.el.getBoundingClientRect()}catch{t=null}!t||!e.region&&!e.el.isConnected?e.node.style.display=`none`:(e.node.style.display=``,e.node.style.transform=`translate(${t.left}px, ${t.top}px)`,e.node.style.width=`${Math.max(4,t.width)}px`,e.node.style.height=`${Math.max(4,t.height)}px`)}}let fe=()=>{if(!x){if(de(),l){let e=l.level();D.style.setProperty(`--lv`,e.toFixed(2)),E(`.bars`).style.setProperty(`--lv`,Math.min(1,e*2.5).toFixed(2))}b=requestAnimationFrame(fe)}};b=requestAnimationFrame(fe);let U=(e,t)=>{let n=document.elementFromPoint(e,t);return n&&n!==w&&n!==document.documentElement?n:null};function W(e){if(!e){O.style.opacity=`0`;return}let t;try{t=e.getBoundingClientRect()}catch{return}if(O.style.opacity=`1`,O.style.transform=`translate(${t.left}px, ${t.top}px)`,O.style.width=`${t.width}px`,O.style.height=`${t.height}px`,o!==e){let n=u(e,r()),{component:i}=_(e),a=S(e,{component:i,name:m(e,n).slice(0,30)});O.querySelector(`.chip`).textContent=a,O.classList.toggle(`below`,t.top<24)}}let G=e=>{if(D.style.transform=`translate(${e.clientX}px, ${e.clientY}px)`,D.classList.add(`seen`),a===`flow`||a===`sent`)return;if(F(e)){W(null),o=null;return}if(s&&(Math.abs(e.clientX-s.x)>Ne||Math.abs(e.clientY-s.y)>Ne)){s.region={x:Math.min(s.x,e.clientX),y:Math.min(s.y,e.clientY),w:Math.abs(e.clientX-s.x),h:Math.abs(e.clientY-s.y)},Object.assign(k.style,{display:`block`,transform:`translate(${s.region.x}px, ${s.region.y}px)`,width:`${s.region.w}px`,height:`${s.region.h}px`}),W(null);return}let t=U(e.clientX,e.clientY);W(t),o=t;let n=t&&i.find(e=>e.el===t||e.el.contains?.(t));n&&R(n.n)},he=e=>{if(!(x||a===`flow`||a===`sent`||F(e))&&(e.preventDefault(),e.stopImmediatePropagation(),e.type===`pointerdown`&&e.button===0&&(s={x:e.clientX,y:e.clientY,el:U(e.clientX,e.clientY),region:null}),e.type===`pointerup`&&s)){let e=s;if(s=null,k.style.display=`none`,e.region&&e.region.w>Ne&&e.region.h>Ne){let t=e.region.x+e.region.w/2,n=e.region.y+e.region.h/2;z(U(t,n)||document.body,e.region)}else e.el&&z(e.el,null)}},ge=e=>{let t=e.composedPath?.()[0];return t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`)&&F(e)},K=e=>{if(x||a===`sent`)return;if(ge(e)){e.key===`Escape`?(e.target.blur?.(),A.focus?.()):e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),Q());return}let t=e.key;if((!Y.hidden||l)&&t.length===1&&t!==`?`&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&a!==`flow`)Ze(e);else if((e.ctrlKey||e.metaKey)&&(t===`a`||t===`A`))e.preventDefault();else if([`Escape`,`Enter`,`Backspace`,`f`,`F`,`m`,`M`,`?`,`Tab`].includes(t)&&(a!==`flow`||[`f`,`F`,`Escape`].includes(t))){if(e.preventDefault(),e.stopImmediatePropagation(),t===`Escape`){if(a===`flow`){q();return}if(i.length&&!v){v=!0,I(`Press Esc again to discard this report`),setTimeout(()=>{v=!1},3e3);return}$()}else t===`Enter`?o&&!i.some(e=>e.el===o)&&_e.active?z(o,null):Q():t===`Backspace`?i.length&&ue(i.length-1):t===`f`||t===`F`?a===`flow`?q():ve():t===`m`||t===`M`?Je():t===`?`?Qe(!0):t===`Tab`&&_e.next(e.shiftKey)}},_e={active:!1,i:-1,next(e){let t=Array.from(document.querySelectorAll(`a[href],button,input,select,textarea,summary,[tabindex]:not([tabindex="-1"]),[role=button],[role=link]`)).filter(e=>{let t=e.getBoundingClientRect();return t.width>0&&t.height>0&&!w.contains(e)});if(t.length){this.active=!0,this.i=(this.i+(e?-1:1)+t.length)%t.length,o=t[this.i];try{o.scrollIntoView({block:`nearest`})}catch{}W(o)}}};function ve(){c?.end&&(c=null),c={start:Date.now(),end:null},W(null),L(`flow`),ye()}function q(){c&&!c.end&&(c.end=Date.now(),L(i.length?`marking`:`armed`),I(`Flow recorded (${Math.round((c.end-c.start)/1e3)} s)`))}function ye(){if(x||!c||c.end)return;let e=Math.round((Date.now()-c.start)/1e3);M.textContent=`Recording the flow ${String(Math.floor(e/60)).padStart(2,`0`)}:${String(e%60).padStart(2,`0`)} — F ends it`,setTimeout(ye,500)}let J=E(`.mic`),Y=E(`.vcard`),Z=!!t.voice&&ie(),Le=t.voiceLang&&t.voiceLang!==`auto`?t.voiceLang:String(navigator.language||``).slice(0,2).toLowerCase(),Re=String(n.endpoint).replace(/\/api\/point$/,`/api/point-transcribe`);Z&&(J.hidden=!1),Z&&t.keepAudio&&(E(`.keep`).hidden=!1);let ze=e=>{let t=0;for(let n of h)if(n.at<=e)t=n.marker;else break;return t};function Be(e){let t=e&&j.querySelector(`li[data-n="${e}"]`);return t?t.querySelector(`.note`):(E(`.exp`).open=!0,E(`.actual`))}async function Ve(e){let t=ze(e.startedAt),r=Date.now();p++,L(a);try{let a=await fetch(Re,{method:`POST`,headers:{"Content-Type":`text/plain;charset=UTF-8`},credentials:`omit`,body:JSON.stringify({key:n.key,mime:e.mime,data:await oe(e.blob),lang:Le})}),o=await a.json().catch(()=>({})),s=a.ok?String(o.text||``).trim():``;if(s){We(t,s,e.startedAt,r);let n=i.find(e=>e.n===t),a=Be(n?t:0);n&&(n.note=`${n.note?`${n.note} `:``}${s}`.slice(0,1e3)),a&&(a.value=n?n.note:`${a.value?`${a.value} `:``}${s}`.slice(0,500),a.dispatchEvent(new Event(`input`)))}else a.ok||I(`Some of what you said couldn’t be written down — type it if it’s missing`,!0)}catch{I(`Some of what you said couldn’t be written down — type it if it’s missing`,!0)}p--,L(a)}let He=E(`.cap`),Ue=[];function We(e,t,n,r){Ue.push({n:e,words:t,at:n,end:r}),He.replaceChildren(...Ue.slice(-4).map(e=>{let t=document.createElement(`span`),n=i.find(t=>t.n===e.n);return n&&(t.className=`said`,t.style.setProperty(`--c`,ke[n.flag])),t.textContent=`${e.words}${n?` ${Ee[n.n]||`(${n.n})`}`:``} `,t}))}function Ge(e){J.classList.toggle(`on`,e),J.setAttribute(`aria-label`,e?`Stop talking`:`Talk`),E(`.typei`).hidden=!e,E(`.listening`).hidden=!e}async function Ke(){if(!l)return;let e=l;l=null,Ge(!1),L(a),d=await e.stop()}async function qe(){if(Z&&!l){Y.hidden=!0,J.hidden=!1;try{l=await ae({onPhrase:Ve,keep:!!t.keepAudio}),f||={startedAt:l.startedAt},X.set(xe,`yes`),h.push({at:l.startedAt,marker:g}),Ue.length||(He.textContent=`Say what you see…`),Ge(!0),L(a)}catch(e){l=null,e?.name===`NotAllowedError`&&X.set(xe,`no`),I(e?.name===`NotAllowedError`?`The microphone is blocked for this site — type instead`:`The microphone could not start — type instead`,!0)}}}let Je=()=>l?Ke():qe(),Ye=!1;function Xe(){Ye||!Z||l||X.get(xe)||(Ye=!0,Y.hidden=!1,J.hidden=!0)}E(`.typei`).addEventListener(`click`,()=>{Ke(),Be(g)?.focus()});function Ze(e){Y.hidden=!0,J.hidden=!Z,l&&Ke();let t=Be(g);t&&(e.preventDefault(),e.stopImmediatePropagation(),t.focus(),t.value+=e.key,t.dispatchEvent(new Event(`input`)))}function Qe(e){let n=!1;try{n=localStorage.getItem(je)===`1`}catch{}if(n&&!e)return;try{localStorage.setItem(je,`1`)}catch{}C=!0;let r=E(`.howto`);r.innerHTML=`<div class="scene" aria-hidden="true"><div class="page"><i></i><i></i><b class="btn">Pay</b></div><span class="cur"></span><span class="pinh">1</span><span class="wave"></span></div>
129
- <ol><li><b>${Pe[t.trigger]||`Use the shortcut`}</b> to point</li><li><b>Click</b> what is wrong</li>${t.voice?`<li><b>Say</b> what you see</li>`:`<li><b>Add a note</b> if you like</li>`}<li><b>Enter</b> sends it</li></ol>
130
- <button class="ok" type="button">Got it</button>`,r.hidden=!1;let i=()=>{r.hidden||(r.hidden=!0,Xe())};r.querySelector(`.ok`).addEventListener(`click`,i),setTimeout(i,9e3)}async function Q(){if(y)return;c&&!c.end&&q();let r=E(`.expected`).value.trim(),o=E(`.actual`).value.trim();if(!i.length&&!c?.end&&!r&&!o){I(`Mark something first — click what is wrong`,!0);return}y=!0,L(a);let s=E(`.send`);s.innerHTML=`<span class="spin" aria-hidden="true"></span>Sending…`,A.classList.add(`busy`),I(``);try{l&&await Ke(),p>0&&I(`Writing down the last of what you said…`);for(let e=Date.now()+Te;p>0&&Date.now()<e;)await new Promise(e=>setTimeout(e,100));I(``);let a=!!(t.keepAudio&&E(`.keep input`).checked&&d?.blob?.size),s={page:location.pathname,release:n.release||void 0,expected:r||void 0,actual:o||void 0,markers:i.map(e=>({n:e.n,kind:e.kind,flag:e.flag,note:e.note.trim()||void 0,at:e.at,...e.desc,viewport:{w:innerWidth,h:innerHeight},scroll:{x:Math.round(scrollX),y:Math.round(scrollY)},dpr:devicePixelRatio||1,events:e.ctx.events,network:e.ctx.network,console:e.ctx.console})),flow:c?.end?c:void 0,env:ne(),voice:f?{live:!0,startedAt:f.startedAt,timeline:h,lang:Le||void 0,keep:a,phrases:Ue.map(e=>({at:e.at,end:e.end,marker:i.some(t=>t.n===e.n)?e.n:0,text:e.words}))}:void 0,via:t.via||void 0},u={key:n.key,sessionId:e.sessionId||null,report:s,notify:{on:!!t.notify?.tick},...t.about?{about:t.about}:{}};a&&(u.audio={mime:d.mime,data:await oe(d.blob)});let m=await fetch(n.endpoint,{method:`POST`,headers:{"Content-Type":`text/plain;charset=UTF-8`},credentials:`omit`,body:JSON.stringify(u)}),g=await m.json().catch(()=>({}));if(!m.ok)throw Error(g.error||`HTTP ${m.status}`);$e(g.bug,g.receipt,g.reopened)}catch(e){y=!1,s.textContent=`Send`,A.classList.remove(`busy`),L(a),I(`Couldn't send: ${String(e?.message||e).slice(0,80)} — try again`,!0)}}function $e(e,r=null,i=!1){L(`sent`),n.active(!1),P(!1),W(null),A.classList.add(`done`);let a=Math.floor(Number(e))||0,o=t.thanks?.message?t.thanks.message.replace(/\{number\}/g,a?String(a):``):i?`Thanks — bug #${a} is open again, and the team can see what you saw.`:a?`Sent as bug #${a} — thank you.`:`Sent — thank you.`,s=document.createElement(`div`);s.className=`thanks`,s.innerHTML=`<div class="th"><span class="okc" aria-hidden="true">${Oe}</span><b></b></div>`,s.querySelector(`b`).textContent=o;let c=(Number(X.get(Se))||0)+1;X.set(Se,String(c));let l=pe(t),u=typeof matchMedia==`function`&&matchMedia(`(pointer: coarse)`).matches,d=t.thanks?.teach!==!1&&l.length>0&&!u&&t.via!==`shortcut`&&c<=we;if(d){let e=document.createElement(`p`);e.className=`teach`,e.innerHTML=`Next time, from any page: ${t.trigger===`double-ctrl`?`tap `:``}<span class="caps">${me(l)}</span> and click what’s wrong.`,s.append(e)}let f=t.notify&&r?et(r):null;f&&s.append(f),A.replaceChildren(s),t.onSent?.(e);let p=null,m=e=>{clearTimeout(p),p=setTimeout($,e)};s.addEventListener(`pointerenter`,()=>clearTimeout(p)),s.addEventListener(`focusin`,()=>clearTimeout(p)),s.addEventListener(`pointerleave`,()=>{s.contains(s.getRootNode().activeElement)||m(2500)}),s.addEventListener(`focusout`,()=>m(2500)),m(f?6500:d?5200:2600)}function et(e){let r=n.endpoint.replace(/\/api\/point$/,`/api/point-notify`),i=t=>fetch(r,{method:`POST`,headers:{"Content-Type":`text/plain;charset=UTF-8`},credentials:`omit`,body:JSON.stringify({key:n.key,receipt:e,...t})}),a=!!n.identified?.(),o=document.createElement(`div`);o.className=`tell`,o.innerHTML=`<label class="tick"><input type="checkbox"><span><b>Tell me when it’s fixed</b><small></small></span></label>`;let s=o.querySelector(`input`),c=o.querySelector(`small`);s.checked=!!t.notify.tick,c.textContent=a&&t.notify.email?`Here, and by email`:`We’ll show it here next time you visit`,s.checked&&B(e);let l=null;return t.notify.email&&!a&&(l=document.createElement(`form`),l.className=`mail`,l.innerHTML=`<label for="sp-mail">Email me too (optional)</label><div><input id="sp-mail" type="email" autocomplete="email" placeholder="you@example.com" maxlength="254"><button type="submit">Save</button></div><p class="mailmsg" role="status"></p>`,l.hidden=!s.checked,l.addEventListener(`submit`,async e=>{e.preventDefault();let t=l.querySelector(`input`),n=l.querySelector(`.mailmsg`),r=t.value.trim();if(r){n.textContent=`Saving…`;try{let e=await i({on:!0,email:r}),a=await e.json().catch(()=>({}));n.textContent=e.ok?`Saved — one email when it’s fixed, then we delete it`:a.error||`Couldn’t save it`,e.ok&&(t.disabled=!0)}catch{n.textContent=`Couldn’t save it`}}}),o.append(l)),s.addEventListener(`change`,()=>{let t=s.checked;t?B(e):le(e),l&&(l.hidden=!t),i({on:t}).catch(()=>{})}),o}function $(){if(!x){x=!0,cancelAnimationFrame(b),l&&l.stop(),n.active(!1),P(!1);for(let e of Fe)window.removeEventListener(e,he,!0);window.removeEventListener(`pointermove`,G,!0),window.removeEventListener(`keydown`,K,!0),w.remove(),N.remove(),t.onClose?.()}}for(let e of Fe)window.addEventListener(e,he,{capture:!0,passive:!1});try{getSelection()?.removeAllRanges()}catch{}window.addEventListener(`pointermove`,G,!0),window.addEventListener(`keydown`,K,!0),E(`.x`).addEventListener(`click`,$);let tt=!1,nt=(e,t)=>{let n=A.offsetWidth,r=A.offsetHeight;A.style.left=`${Math.min(innerWidth-n-8,Math.max(8,e))}px`,A.style.top=`${Math.min(innerHeight-Math.min(r,120),Math.max(8,t))}px`,A.style.right=`auto`,A.style.bottom=`auto`,tt=!0},rt=A.querySelector(`header`);rt.title=`Drag to move`,rt.addEventListener(`pointerdown`,e=>{if(e.button!==0||e.target.closest(`button`)||innerWidth<=560)return;let t=A.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;A.classList.add(`moving`);let i=e=>nt(e.clientX-n,e.clientY-r),a=()=>{A.classList.remove(`moving`),window.removeEventListener(`pointermove`,i,!0),window.removeEventListener(`pointerup`,a,!0)};window.addEventListener(`pointermove`,i,!0),window.addEventListener(`pointerup`,a,!0),e.preventDefault()}),E(`.send`).addEventListener(`click`,Q),E(`.flowbtn`).addEventListener(`click`,()=>c&&!c.end?q():ve()),J.addEventListener(`click`,Je),E(`.vstart`).addEventListener(`click`,qe);for(let e of[`.expected`,`.actual`])E(e).addEventListener(`input`,()=>L(a));L(`armed`),X.set(Ce,`1`);let it=X.get(xe);return Z&&it===`yes`&&qe(),Qe(!1),C||Xe(),t.target?.isConnected&&!w.contains(t.target)&&z(t.target,null),{toggle:()=>i.length||c?.end?Q():$(),released:()=>{!i.length&&!c&&!C&&a===`armed`&&$()},close:$,send:Q,get markers(){return i.length},get state(){return a}}}var Ie=`
131
- :host{all:initial}
132
- *{-webkit-user-select:none;user-select:none}
133
- input,textarea{-webkit-user-select:text;user-select:text}
134
- *{box-sizing:border-box;font-family:ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif}
135
- [hidden]{display:none!important}
136
- .ring{position:fixed;left:0;top:0;width:24px;height:24px;margin:-12px 0 0 -12px;border-radius:50%;border:2px solid #94A3B8;background:rgba(148,163,184,.12);pointer-events:none;z-index:4;transition:border-color .15s,background .15s;will-change:transform}
137
- .ring .dot{position:absolute;left:50%;top:50%;width:4px;height:4px;margin:-2px;border-radius:50%;background:#94A3B8}
138
- .ring .badge{position:absolute;left:16px;top:-12px;min-width:16px;height:16px;padding:0 4px;border-radius:8px;background:#0E1320;color:#fff;font-size:10px;font-weight:700;line-height:16px;text-align:center;display:none}
139
- .ring[data-state~="marking"]{border-color:#5B4BF0;background:rgba(91,75,240,.16)}
140
- .ring[data-state~="marking"] .dot{background:#5B4BF0}
141
- .ring[data-state~="armed"] .badge,.ring[data-state~="marking"] .badge{display:block}
142
- .ring[data-state~="listening"]{box-shadow:0 0 0 calc(2px + var(--lv,0) * 10px) rgba(91,75,240,.35)}
143
- .ring[data-state~="flow"]{width:14px;height:14px;margin:-7px 0 0 -7px;border-color:#F43F5E;background:#F43F5E;opacity:.9}
144
- .ring[data-state~="flow"] .dot{display:none}
145
- .ring[data-state~="sent"]{display:none}
146
- .ring:not(.seen){opacity:0}
147
- @media (prefers-reduced-motion:reduce){.ring{transition:none}}
148
- .outline{position:fixed;left:0;top:0;border:1.5px solid #5B4BF0;border-radius:3px;background:rgba(91,75,240,.06);pointer-events:none;opacity:0;z-index:2}
149
- .outline .chip{position:absolute;left:-1px;bottom:100%;margin-bottom:4px;max-width:320px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;background:#0E1320;color:#fff;font-size:11px;font-weight:600;padding:3px 7px;border-radius:5px}
150
- .outline.below .chip{bottom:auto;top:100%;margin:4px 0 0}
151
- .frame{position:fixed;left:0;top:0;display:none;border:1.5px dashed #5B4BF0;background:rgba(91,75,240,.08);pointer-events:none;z-index:2}
152
- .marks{position:fixed;left:0;top:0;width:0;height:0;z-index:3}
153
- .mk{position:fixed;left:0;top:0;border:2px solid var(--c);border-radius:4px;pointer-events:none}
154
- .mk.region{border-style:dashed}
155
- .mk .pin{position:absolute;left:-11px;top:-11px;width:22px;height:22px;border-radius:50%;border:2px solid #fff;background:var(--c);color:#fff;font:700 11px/18px ui-sans-serif,system-ui;text-align:center;pointer-events:auto;cursor:pointer;padding:0;box-shadow:0 2px 8px rgba(0,0,0,.35)}
156
- .rail{position:fixed;top:16px;right:16px;width:320px;max-height:calc(100vh - 32px);overflow:auto;background:#0E1320;color:#E6E8EE;border:1px solid #2a3346;border-radius:12px;padding:12px;box-shadow:0 12px 40px rgba(0,0,0,.45);font-size:13px;z-index:5;cursor:default}
157
- .rail *{cursor:auto}
158
- .rail header,.rail header *:not(button){cursor:grab}
159
- .rail.moving,.rail.moving *{cursor:grabbing!important;user-select:none}
160
- .rail.left{right:auto;left:16px}
161
- .rail button{cursor:pointer}
162
- .rail header{display:flex;align-items:center;gap:8px;margin-bottom:8px}
163
- .rail header b{font-size:14px}
164
- .hint{flex:1;color:#94A3B8;font-size:11.5px}
165
- .x{background:none;border:0;color:#94A3B8;font-size:18px;line-height:1;padding:2px 6px}
166
- .list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px}
167
- .list li{display:grid;grid-template-columns:22px 1fr 18px;gap:4px 8px;align-items:center;background:#151B2B;border:1px solid #232c40;border-radius:8px;padding:6px 8px}
168
- .num{width:22px;height:22px;border-radius:50%;border:0;background:var(--c);color:#fff;font-weight:700;font-size:11px;padding:0}
169
- .what{display:flex;align-items:center;gap:6px;min-width:0}
170
- .name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:600}
171
- .flag{border:1px solid var(--c);color:var(--c);background:transparent;border-radius:999px;font-size:10.5px;font-weight:700;padding:1px 7px}
172
- .note{grid-column:2/4;grid-row:2;width:100%;background:#0B0F19;border:1px solid #2a3346;border-radius:6px;color:#E6E8EE;padding:5px 8px;font-size:12.5px;outline:none;resize:none;min-height:28px;field-sizing:content;max-height:120px;line-height:1.45}
173
- .vcard{margin-top:10px;background:#151B2B;border:1px solid #3b3a7a;border-radius:10px;padding:12px}
174
- .vcard b{font-size:13.5px}
175
- .vcard p{margin:6px 0;color:#C3C8D4;font-size:12.5px;line-height:1.5}
176
- .vcard .fine{color:#94A3B8;font-size:11.5px}
177
- .vcard .c{text-align:center;margin-bottom:0}
178
- .kc{display:inline-flex;align-items:center;justify-content:center;min-width:20px;height:20px;padding:0 5px;border:1px solid rgba(255,255,255,.22);border-bottom-width:2px;border-radius:5px;background:rgba(255,255,255,.06);color:inherit;font:600 10.5px/1 ui-monospace,SFMono-Regular,Menlo,monospace}
179
- .caps{display:inline-flex;gap:3px;vertical-align:middle;margin:0 2px}
180
- .vstart{width:100%;height:44px;margin-top:6px;display:flex;align-items:center;justify-content:center;gap:8px;background:#5B4BF0;border:0;color:#fff;font-weight:700;border-radius:10px;font-size:13.5px}
181
- .vstart svg,.mic svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round}
182
- .listening{margin-top:10px;background:rgba(255,255,255,.04);border-radius:10px;padding:12px;display:flex;flex-direction:column;gap:8px}
183
- .lh{display:flex;align-items:center;gap:8px;font-size:12px;color:#C3C8D4}
184
- .rd{width:8px;height:8px;border-radius:50%;background:#F87171;box-shadow:0 0 0 4px rgba(248,113,113,.2)}
185
- .bars{margin-left:auto;display:flex;align-items:flex-end;gap:2px;height:14px}
186
- .bars i{display:block;width:3px;border-radius:2px;background:#14C8A6;height:calc(3px + var(--lv,0) * 11px)}
187
- .bars i:nth-child(2){height:calc(5px + var(--lv,0) * 9px)}.bars i:nth-child(3){height:calc(3px + var(--lv,0) * 8px)}.bars i:nth-child(4){height:calc(6px + var(--lv,0) * 8px)}.bars i:nth-child(5){height:calc(2px + var(--lv,0) * 6px)}
188
- .cap{margin:0;font-size:14px;line-height:1.6;color:#F4F5F8;min-height:1.6em}
189
- .cap .said{color:var(--c);font-weight:600}
190
- .listening .fine{margin:0;font-size:11px;color:#8A93A6;line-height:1.5}
191
- .flowbtn{margin-top:10px;width:100%;background:#151B2B;border:1px solid #2a3346;color:#E6E8EE;border-radius:8px;padding:7px 8px;font-size:12px;font-weight:600}
192
- .flowbtn.on{border-color:#F43F5E;color:#FDA4AF}
193
- .bottom{gap:8px}
194
- .mic{flex:none;width:44px;height:44px;border-radius:50%;display:flex;align-items:center;justify-content:center;background:transparent;border:1px solid rgba(169,160,255,.5);color:#A9A0FF;padding:0}
195
- .mic.on{background:#F87171;border-color:#F87171;color:#0E1320}
196
- .typei{height:44px;padding:0 12px;border:1px solid rgba(255,255,255,.12);border-radius:10px;background:transparent;color:#C3C8D4;font-size:13px}
197
- .send{flex:1;height:44px;background:#5B4BF0;border:0;color:#fff;font-weight:700;border-radius:10px;padding:0 16px;font-size:14px}
198
- .send:disabled{opacity:.45;cursor:default}
199
- .rail.busy .send:disabled{opacity:1}
200
- .rail.busy .list,.rail.busy .exp,.rail.busy .flowbtn,.rail.busy .mic,.rail.busy .typei,.rail.busy .listening{opacity:.5;pointer-events:none}
201
- .send{display:flex;align-items:center;justify-content:center;gap:8px}
202
- .spin{width:15px;height:15px;border-radius:50%;border:2px solid rgba(255,255,255,.35);border-top-color:#fff;animation:sp-spin .7s linear infinite}
203
- @keyframes sp-spin{to{transform:rotate(360deg)}}
204
- @media (prefers-reduced-motion:reduce){.spin{animation-duration:2s}}
205
- @media (max-width:560px){.rail{top:auto;left:8px;right:8px;bottom:8px;width:auto;max-height:55vh;border-radius:14px}.howto{width:calc(100vw - 24px);bottom:auto;top:12px}}
206
- .rail.done{width:auto;max-width:360px;padding:14px 16px}
207
- .thanks{margin:0;color:#F4F5F8;display:flex;flex-direction:column;gap:8px}
208
- .th{display:flex;align-items:center;gap:10px}
209
- .th b{font-size:14px;font-weight:600}
210
- .okc{width:22px;height:22px;flex:none;border-radius:50%;background:#14C8A6;display:flex;align-items:center;justify-content:center}
211
- .okc svg{width:12px;height:12px;fill:none;stroke:#0E1320;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
212
- .teach{margin:0;font-size:13px;line-height:1.7;color:#C3C8D4}
213
- .tell{border-top:1px solid rgba(255,255,255,.1);padding-top:12px;display:flex;flex-direction:column;gap:10px}
214
- .tick{display:flex;gap:10px;align-items:flex-start;font-size:13px;line-height:1.5;color:#C3C8D4;cursor:pointer}
215
- .tick input{width:16px;height:16px;margin:2px 0 0;flex:none;accent-color:#14C8A6;cursor:pointer}
216
- .tick b{display:block;color:#F4F5F8;font-weight:600}
217
- .tick small{font-size:13px}
218
- .mail{display:flex;flex-direction:column;gap:6px;padding-left:26px;margin:0}
219
- .mail label{font-size:12px;color:#C3C8D4}
220
- .mail div{display:flex;gap:8px}
221
- .mail input{flex:1;min-width:0;height:34px;border-radius:8px;border:1px solid rgba(255,255,255,.22);background:rgba(255,255,255,.06);color:#F4F5F8;padding:0 10px;font:inherit;font-size:13px}
222
- .mail input:disabled{opacity:.6}
223
- .mail button{height:34px;padding:0 14px;border:0;border-radius:8px;background:#F4F5F8;color:#0E1320;font:inherit;font-size:13px;font-weight:600;cursor:pointer}
224
- .mailmsg{margin:0;font-size:12px;color:#8A93A6}
225
- .mailmsg:empty{display:none}
226
- .keep{display:flex;gap:6px;align-items:center;margin-top:10px;font-size:12px;color:#C3C8D4}
227
- .note:focus,.exp input:focus{border-color:#5B4BF0}
228
- .rm{grid-column:3;grid-row:1;background:none;border:0;color:#64748B;font-size:15px;padding:0}
229
- .empty{color:#94A3B8;margin:6px 0 8px;font-size:12.5px}
230
- .row{display:flex;align-items:center;gap:8px;margin-top:10px}
231
- .exp{margin-top:10px;color:#94A3B8;font-size:12px}
232
- .exp summary{cursor:pointer}
233
- .exp input{display:block;width:100%;margin-top:6px;background:#0B0F19;border:1px solid #2a3346;border-radius:6px;color:#E6E8EE;padding:6px 8px;font-size:12.5px;outline:none}
234
- .status{margin:8px 0 0;font-size:12px;color:#94A3B8;min-height:1em}
235
- .status:empty{display:none}
236
- .status.bad{color:#FCA5A5}
237
- .howto{position:fixed;left:50%;bottom:24px;transform:translateX(-50%);width:360px;background:#0E1320;color:#E6E8EE;border:1px solid #2a3346;border-radius:14px;padding:14px;box-shadow:0 16px 50px rgba(0,0,0,.5);z-index:6;font-size:13px}
238
- .howto ol{margin:10px 0 8px;padding-left:20px;line-height:1.7}
239
- .howto .ok{background:#5B4BF0;border:0;color:#fff;border-radius:8px;padding:6px 12px;font-weight:700;cursor:pointer}
240
- .scene{position:relative;height:96px;border-radius:9px;background:#151B2B;overflow:hidden}
241
- .scene .page{position:absolute;inset:12px 14px}
242
- .scene .page i{display:block;height:8px;border-radius:4px;background:#232c40;margin-bottom:8px;width:70%}
243
- .scene .page i+i{width:45%}
244
- .scene .btn{position:absolute;right:10px;bottom:6px;background:#2E86F0;color:#fff;font-size:11px;padding:5px 14px;border-radius:6px}
245
- .scene .cur{position:absolute;left:30px;top:20px;width:18px;height:18px;margin:-9px;border-radius:50%;border:2px solid #94A3B8;animation:sp-move 8s infinite}
246
- .scene .pinh{position:absolute;right:62px;bottom:20px;width:18px;height:18px;border-radius:50%;background:#F43F5E;color:#fff;font:700 10px/18px ui-sans-serif,system-ui;text-align:center;opacity:0;animation:sp-pin 8s infinite}
247
- .scene .wave{position:absolute;left:20px;bottom:16px;width:40px;height:10px;border-radius:5px;background:linear-gradient(90deg,#5B4BF0,#2E86F0);opacity:0;animation:sp-wave 8s infinite}
248
- @keyframes sp-move{0%,8%{transform:translate(0,0);border-color:#94A3B8}30%,100%{transform:translate(250px,52px);border-color:#5B4BF0}}
249
- @keyframes sp-pin{0%,34%{opacity:0;transform:scale(.4)}40%,100%{opacity:1;transform:scale(1)}}
250
- @keyframes sp-wave{0%,48%{opacity:0;transform:scaleX(.3)}55%,60%{opacity:1;transform:scaleX(1)}65%,70%{opacity:1;transform:scaleX(.5)}75%,85%{opacity:1;transform:scaleX(1)}92%,100%{opacity:0}}
251
- @media (prefers-reduced-motion:reduce){.scene .cur,.scene .pinh,.scene .wave{animation:none}.scene .pinh,.scene .wave{opacity:1}.scene .cur{transform:translate(250px,52px)}}
252
- `;exports.FLAGS=be,exports.mountEntry=q,exports.openPoint=Z,exports.showFixed=ye;