blocfeed 0.7.1 → 0.7.3

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,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.7.3 — 2026-02-23
4
+
5
+ ### Improvements
6
+
7
+ - **Network diagnostics noise filter** — Analytics, tracking, and third-party service URLs are now automatically excluded from network capture. Built-in blocklist covers 50+ domains including Google Analytics, Facebook Pixel, Mixpanel, Amplitude, Segment, Hotjar, PostHog, Sentry, Intercom, HubSpot, Grammarly, reCAPTCHA, Stripe.js, cookie consent tools, and more.
8
+ - New `config.diagnostics.ignoreUrls` option to customize URL exclusions. Set to `[]` to disable the built-in blocklist and capture everything.
9
+
10
+ ---
11
+
3
12
  ## 0.7.1 — 2026-02-21
4
13
 
5
14
  ### New features
package/README.md CHANGED
@@ -129,6 +129,7 @@ All configuration is passed via the `config` prop on `<BlocFeedWidget>` or `<Blo
129
129
  diagnostics: {
130
130
  console: true,
131
131
  network: true, // captures both fetch and XMLHttpRequest
132
+ // ignoreUrls: [], // override default blocked domains (see docs below)
132
133
  },
133
134
 
134
135
  // Screenshot defaults
@@ -399,10 +400,77 @@ config={{
399
400
  }}
400
401
  ```
401
402
 
402
- Captured data is attached to `metadata._consoleLogs` and `metadata._networkErrors` in the payload. BlocFeed's own API calls are excluded. Messages and stacks are truncated at 2KB.
403
+ Captured data is attached to `metadata._consoleLogs` and `metadata._networkErrors` in the payload. Messages and stacks are truncated at 2KB.
403
404
 
404
405
  Both `fetch` and `XMLHttpRequest` are intercepted, so apps using axios, jQuery, or other XHR-based libraries get full network error capture.
405
406
 
407
+ ### Network URL filtering (`ignoreUrls`)
408
+
409
+ By default, BlocFeed automatically filters out requests to analytics, tracking, and third-party service domains to keep diagnostics focused on relevant errors. The built-in blocklist includes 50+ domains:
410
+
411
+ | Category | Blocked domains |
412
+ |----------|----------------|
413
+ | **BlocFeed** | `blocfeed.com` |
414
+ | **Google Analytics / Ads** | `google-analytics.com`, `googletagmanager.com`, `analytics.google.com`, `googleads.g.doubleclick.net`, `googlesyndication.com`, `googleadservices.com`, `google.com/pagead`, `google.com/ads` |
415
+ | **Facebook / Meta** | `facebook.net`, `facebook.com/tr`, `connect.facebook.net`, `graph.facebook.com` |
416
+ | **Mixpanel** | `api.mixpanel.com`, `api-js.mixpanel.com` |
417
+ | **Amplitude** | `api.amplitude.com`, `api2.amplitude.com` |
418
+ | **Segment** | `api.segment.io`, `cdn.segment.com` |
419
+ | **Hotjar** | `vars.hotjar.com`, `in.hotjar.com`, `script.hotjar.com` |
420
+ | **Heap** | `heapanalytics.com` |
421
+ | **FullStory** | `fullstory.com/s/fs.js`, `rs.fullstory.com` |
422
+ | **PostHog** | `app.posthog.com`, `us.posthog.com`, `eu.posthog.com` |
423
+ | **Intercom** | `api-iam.intercom.io`, `widget.intercom.io` |
424
+ | **Sentry** | `sentry.io/api`, `browser.sentry-cdn.com` |
425
+ | **Datadog** | `browser-intake-datadoghq.com` |
426
+ | **Microsoft Clarity** | `clarity.ms` |
427
+ | **HubSpot** | `js.hs-analytics.net`, `api.hubapi.com`, `forms.hubspot.com` |
428
+ | **Plausible** | `plausible.io/api` |
429
+ | **Crisp** | `client.crisp.chat` |
430
+ | **Drift** | `js.driftt.com` |
431
+ | **LogRocket** | `r.logrocket.com` |
432
+ | **Pendo** | `app.pendo.io` |
433
+ | **LaunchDarkly** | `events.launchdarkly.com`, `app.launchdarkly.com` |
434
+ | **Grammarly** | `grammarly.com`, `gnar.grammarly.com`, `capi.grammarly.com` |
435
+ | **LanguageTool** | `api.languagetool.org`, `api.languagetoolplus.com` |
436
+ | **Google Fonts** | `fonts.googleapis.com`, `fonts.gstatic.com` |
437
+ | **Cookie consent** | `cdn.cookielaw.org`, `consent.cookiebot.com` |
438
+ | **Stripe.js** | `js.stripe.com`, `api.stripe.com/v1/tokens` |
439
+ | **CAPTCHA** | `google.com/recaptcha`, `hcaptcha.com` |
440
+ | **New Relic** | `bam.nr-data.net` |
441
+ | **Smartlook** | `rec.smartlook.com` |
442
+ | **Mouseflow** | `o2.mouseflow.com` |
443
+ | **Lucky Orange** | `api.luckyorange.com` |
444
+ | **Zendesk** | `static.zdassets.com`, `ekr.zdassets.com` |
445
+
446
+ Each pattern is matched as a **substring** against the request URL (case-insensitive).
447
+
448
+ #### Add extra domains
449
+
450
+ Pass additional patterns alongside the built-in blocklist:
451
+
452
+ ```tsx
453
+ config={{
454
+ diagnostics: {
455
+ network: true,
456
+ ignoreUrls: ["my-internal-analytics.com", "custom-tracker.io"],
457
+ },
458
+ }}
459
+ ```
460
+
461
+ > **Note**: When you provide `ignoreUrls`, it **replaces** the built-in blocklist entirely. To keep the defaults and add your own patterns, you would need to include them manually — or simply omit `ignoreUrls` to use the built-in list as-is.
462
+
463
+ #### Capture everything (disable blocklist)
464
+
465
+ ```tsx
466
+ config={{
467
+ diagnostics: {
468
+ network: true,
469
+ ignoreUrls: [], // empty array disables all filtering
470
+ },
471
+ }}
472
+ ```
473
+
406
474
  ### Headless diagnostics
407
475
 
408
476
  ```ts
@@ -0,0 +1,2 @@
1
+ function w(){return typeof window<"u"&&typeof document<"u"}function de(e){let t=globalThis.CSS;return typeof t?.escape=="function"?t.escape(e):e.replace(/[^a-zA-Z0-9_-]/g,n=>{let r=n.codePointAt(0);return r===void 0?"":`\\${r.toString(16)} `})}function G(e){return {x:e.x,y:e.y,width:e.width,height:e.height}}function De(e){return {x:e.x+window.scrollX,y:e.y+window.scrollY,width:e.width,height:e.height}}function Oe(e){return e.replace(/\s+/g," ").trim()}function Ue(e,t=140){let n=e.textContent;if(!n)return;let r=Oe(n);if(r)return r.length<=t?r:`${r.slice(0,t-1)}\u2026`}function He(e){let t=1;for(let n=e.previousElementSibling;n;n=n.previousElementSibling)n.tagName===e.tagName&&(t+=1);return t}var ge=["data-testid","data-test-id","data-test","data-qa","data-cy"],fe="data-blocfeed-component";function qe(e){let t=e.closest(`[${fe}]`);if(!t)return;let r=t.getAttribute(fe)?.trim();return r||void 0}function ze(e){for(let t of ge){let n=e.closest(`[${t}]`);if(!n)continue;let o=n.getAttribute(t)?.trim();if(o)return o}}function me(e){try{let t=e,n=Object.getOwnPropertyNames(t);for(let r of n)if(r.startsWith("__reactFiber$")||r.startsWith("__reactInternalInstance$")){let o=t[r];if(o&&typeof o=="object")return o}}catch{}return null}function T(e){if(e.length<=1||e.length===2&&e[0]===e[0].toLowerCase())return true;let t=e[0];return t>="a"&&t<="z"}function I(e){if(e){for(let t of e)if(typeof t.name=="string"&&t.name&&!T(t.name))return t.name}}function S(e){if(e&&typeof e!="string"){if(typeof e=="function"){let t=e;return typeof t.displayName=="string"&&t.displayName?t.displayName:typeof t.name=="string"&&t.name?t.name:void 0}if(typeof e=="object"){let t=e,n=t.displayName;if(typeof n=="string"&&n)return n;let r=t.render;if(typeof r=="function"){let i=r;if(typeof i.displayName=="string"&&i.displayName)return i.displayName;if(typeof i.name=="string"&&i.name)return i.name}let o=t.type;return S(o)}}}function $e(e){let t=me(e);if(!t)return;let n=I(t._debugInfo);if(n)return n;let r=t._debugOwner!==void 0;if(r){let s=t._debugOwner;for(let a=0;s&&a<50;a+=1){let d=I(s._debugInfo);if(d)return d;let g=S(s.type)??S(s.elementType);if(g&&!T(g))return g;s=s._debugOwner;}}if(t._owner!==void 0&&t._owner!==t._debugOwner){let s=t._owner;for(let a=0;s&&a<50;a+=1){let d=I(s._debugInfo);if(d)return d;let g=S(s.type)??S(s.elementType);if(g&&!T(g))return g;s=s._owner;}}let i=t,c=r?80:25;for(let s=0;i&&s<c;s+=1){let a=I(i._debugInfo);if(a)return a;let d=S(i.type)??S(i.elementType);if(d&&!T(d))return d;i=i.return;}let l=e.parentElement;for(let s=0;l&&s<15;s+=1){let a=me(l);if(a){let d=I(a._debugInfo);if(d)return d;let g=S(a.type)??S(a.elementType);if(g&&!T(g))return g;if(a._debugOwner){let h=S(a._debugOwner.type)??S(a._debugOwner.elementType);if(h&&!T(h))return h}if(a._owner&&a._owner!==a._debugOwner){let h=S(a._owner.type)??S(a._owner.elementType);if(h&&!T(h))return h}}l=l.parentElement;}}function je(e){let t=e.tagName.toLowerCase(),n=e.getAttribute("id");if(n)return `#${de(n)}`;for(let r of ge){let o=e.getAttribute(r);if(o)return `${t}[${r}="${de(o)}"]`}return `${t}:nth-of-type(${He(e)})`}function Xe(e,t=10){let n=[],r=e;for(;r&&n.length<t;){let o=je(r);if(n.unshift(o),o.startsWith("#"))break;r=r.parentElement;}return n.join(" > ")}function pe(e,t){if(!t||t.length===0)return false;for(let n of t)if(e.closest(n))return true;return false}function J(e,t){if(!e||pe(e,t.ignoreSelectors))return null;let n=e;for(;n;){if(pe(n,t.ignoreSelectors))return null;if(t.isSelectable?.(n)??Ze(n))return n;n=n.parentElement;}return null}function Ze(e){let t=e.tagName;return !(t==="HTML"||t==="BODY")}function he(e){let t=e.getBoundingClientRect(),n={selector:Xe(e),tagName:e.tagName.toLowerCase(),rect:G(t),pageRect:De(t)},r=e.getAttribute("id");r&&(n.id=r);let o=e.className;typeof o=="string"&&o.trim()&&(n.className=o);let i=Ue(e);i&&(n.textSnippet=i);let c=qe(e)??$e(e);c&&(n.componentName=c);let l=ze(e);return l&&(n.testId=l),n}var V=null;async function we(){return V||(V=import('html-to-image')),V}async function We(e){return await new Promise((t,n)=>{let r=new Image;r.onload=()=>t({width:r.naturalWidth,height:r.naturalHeight}),r.onerror=()=>n(new Error("Failed to load generated screenshot")),r.src=e;})}async function ye(e,t){let{width:n,height:r}=await We(e);return {dataUrl:e,mime:t,width:n,height:r}}function L(e){if(e?.aborted)throw new Error("Aborted")}function be(){return {async captureElement(e,t){if(!w())throw new Error("captureElement can only run in the browser");L(t.signal);let n=await we();L(t.signal);let r=t.mime==="image/jpeg"?await n.toJpeg(e,{quality:t.quality??.92,pixelRatio:t.pixelRatio}):await n.toPng(e,{pixelRatio:t.pixelRatio});return L(t.signal),await ye(r,t.mime)},async captureFullPage(e){if(!w())throw new Error("captureFullPage can only run in the browser");L(e.signal);let t=document.documentElement,n=Math.max(t.scrollWidth,t.clientWidth),r=Math.max(t.scrollHeight,t.clientHeight),o=Math.min(1,e.maxDimension/Math.max(n,r)),i=Math.max(1,Math.round(n*o)),c=Math.max(1,Math.round(r*o)),l=await we();L(e.signal);let s=e.mime==="image/jpeg"?await l.toJpeg(t,{width:i,height:c,quality:e.quality??.92,pixelRatio:e.pixelRatio}):await l.toPng(t,{width:i,height:c,pixelRatio:e.pixelRatio});return L(e.signal),await ye(s,e.mime)}}}function Ke(e){if(e instanceof Error)return e.message;if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return "Unknown error"}}function y(e,t,n){let r={kind:e,message:Ke(t)};return n&&(r.detail=n),r}var Qe=12e3,Ye=2048,Ge=.92;function Ee(){return Date.now()}function Je(e){return new Promise((t,n)=>{let r=()=>n(new Error("Aborted"));if(e.aborted){r();return}e.addEventListener("abort",r,{once:true});})}async function ke(e,t,n){let r=new Promise((i,c)=>{let l=setTimeout(()=>c(new Error("Timeout")),t);typeof l.unref=="function"&&l.unref();}),o=[e,r];return n&&o.push(Je(n)),await Promise.race(o)}function Ve(e){if(!w())return 1;let t=window.devicePixelRatio||1,n=e?.pixelRatio??Math.min(t,2);return Math.max(.1,n)}function et(e){return !!(e?.element||e?.fullPage)}function _e(e){let t={mime:e.mime,pixelRatio:e.pixelRatio,maxDimension:e.maxDimension};return e.includeQuality&&(t.quality=e.quality),e.signal&&(t.signal=e.signal),t}async function Se(e){let{selectionElement:t,capture:n,signal:r}=e;if(!w()||!et(n))return;let o=Ee(),i=[],c=n?.timeoutMs??Qe,l=n?.maxDimension??Ye,s=n?.mime??"image/png",a=n?.quality??Ge,d=n?.adapter??be(),g={},h=Ve(n);if(n?.element&&t)try{let f=t.getBoundingClientRect(),m=Math.min(1,l/Math.max(f.width,f.height)),v=Math.min(h,h*m),A=await ke(Promise.resolve(d.captureElement(t,{..._e({mime:s,quality:a,pixelRatio:v,maxDimension:l,includeQuality:s==="image/jpeg",...r?{signal:r}:{}})})),c,r);g.element=A;}catch(f){if(r?.aborted)throw f;i.push(y("capture_failed",f,{target:"element"}));}if(n?.fullPage)try{let f=await ke(Promise.resolve(d.captureFullPage(_e({mime:s,quality:a,pixelRatio:h,maxDimension:l,includeQuality:s==="image/jpeg",...r?{signal:r}:{}}))),c,r);g.fullPage=f;}catch(f){if(r?.aborted)throw f;i.push(y("capture_failed",f,{target:"fullPage"}));}let b=Ee(),u={startedAt:o,finishedAt:b,durationMs:Math.max(0,b-o)};return i.length>0&&(u.errors=i),{...g,diagnostics:u}}function tt(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function nt(){return w()?{url:window.location.href,title:document.title,referrer:document.referrer||void 0,userAgent:navigator.userAgent,language:navigator.language,platform:navigator.platform,viewport:{width:window.innerWidth,height:window.innerHeight},screen:{width:window.screen.width,height:window.screen.height},scroll:{x:window.scrollX,y:window.scrollY},devicePixelRatio:window.devicePixelRatio||1,timezone:tt()}:{}}function rt(e){if(!e)return {};let t={};return e.id&&(t.userId=e.id),e.email&&(t.userEmail=e.email),e.name&&(t.userName=e.name),t}async function ve(e){let{config:t,context:n,user:r}=e;if(t?.enabled===false)return {};let o={...nt(),...rt(r)},i=t?.enrich;if(!i)return o;try{let c=await i(n);return {...o,...c}}catch(c){let l=y("unknown",c);return {...o,blocfeedMetadataError:l.message}}}var ee="blocfeed-queue",ot=50;function te(){if(!w())return [];try{let e=localStorage.getItem(ee);if(!e)return [];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return []}}function ne(e){if(w())try{e.length===0?localStorage.removeItem(ee):localStorage.setItem(ee,JSON.stringify(e));}catch{}}function it(e){let t={...e};if(t.screenshots){let n={...t.screenshots};n.element&&(n.element={...n.element,dataUrl:""}),n.fullPage&&(n.fullPage={...n.fullPage,dataUrl:""}),t.screenshots=n;}return t}function re(e){let t=te(),n=it(e);for(n.metadata={...n.metadata,_queued:true},t.push({payload:n,timestamp:Date.now()});t.length>ot;)t.shift();ne(t);}function Pe(){let e=te();return e.length===0?[]:(ne([]),e.map(t=>t.payload))}function Ht(){ne([]);}function qt(){return te().length}function oe(e){let t=null,n=null,r=(...o)=>{n=o,t===null&&(t=requestAnimationFrame(()=>{if(t=null,!n)return;let i=n;n=null,e(...i);}));};return r.cancel=()=>{t!==null&&cancelAnimationFrame(t),t=null,n=null;},r}function j(e){return e instanceof Element?!!e.closest("[data-blocfeed-ui]"):false}function X(e){e.stopPropagation(),e.stopImmediatePropagation?.();}function Ae(e,t){if(!w())throw new Error("BlocFeed picker can only run in a browser environment.");let n=e.ignoreSelectors,r=e.isSelectable,o={};n&&n.length>0&&(o.ignoreSelectors=n),r&&(o.isSelectable=r);let i=null,c=null,l=(u,f=false)=>{if(!u){i=null,c=null,t.onHover(null);return}let m=G(u.getBoundingClientRect()),v=`${Math.round(m.x)}:${Math.round(m.y)}:${Math.round(m.width)}:${Math.round(m.height)}`;!f&&u===i&&v===c||(i=u,c=v,t.onHover({element:u,rect:m}));},s=oe(u=>{if(j(u.target))return;let f=document.elementFromPoint(u.clientX,u.clientY),m=J(f,o);l(m);}),a=oe(()=>{i&&l(i,true);}),d=u=>{j(u.target)||(X(u),u.pointerType==="mouse"&&u.preventDefault());},g=u=>{j(u.target)||(X(u),u.pointerType==="mouse"&&u.preventDefault());},h=u=>{if(j(u.target))return;X(u),u.preventDefault();let f=document.elementFromPoint(u.clientX,u.clientY),m=J(f,o);m&&t.onSelect({element:m,descriptor:he(m)});},b=u=>{u.key==="Escape"&&(X(u),u.preventDefault(),t.onCancel());};return window.addEventListener("pointermove",s,{capture:true,passive:true}),window.addEventListener("pointerdown",d,{capture:true}),window.addEventListener("pointerup",g,{capture:true}),window.addEventListener("click",h,{capture:true}),window.addEventListener("keydown",b,{capture:true}),window.addEventListener("scroll",a,{capture:true,passive:true}),window.addEventListener("resize",a,{passive:true}),{stop(){window.removeEventListener("pointermove",s,{capture:true}),window.removeEventListener("pointerdown",d,{capture:true}),window.removeEventListener("pointerup",g,{capture:true}),window.removeEventListener("click",h,{capture:true}),window.removeEventListener("keydown",b,{capture:true}),window.removeEventListener("scroll",a,{capture:true}),window.removeEventListener("resize",a),s.cancel(),a.cancel(),t.onHover(null);}}}var at=12e3,st=2,ct=500,lt=2e3,Fe="https://blocfeed.com/api/feedback",xe=0;function Te(e,t){return new Promise((n,r)=>{if(t?.aborted){r(new Error("Aborted"));return}let o=setTimeout(n,e),i=()=>{clearTimeout(o),r(new Error("Aborted"));};t?.addEventListener("abort",i,{once:true});})}function ut(e){return e>=500&&e<=599}function dt(e){let[t,n]=e.split(",",2);if(!t||!n)throw new Error("Invalid data URL");let o=/data:(.*?);base64/.exec(t)?.[1]||"application/octet-stream",i=atob(n),c=new Uint8Array(i.length);for(let l=0;l<i.length;l+=1)c[l]=i.charCodeAt(l);return new Blob([c],{type:o})}function ft(e){let t={},n={...e};if(n.screenshots){let r={},o={...n.screenshots};o.element&&(t.element=o.element.dataUrl,r.element={mime:o.element.mime,width:o.element.width,height:o.element.height},o.element={...o.element,dataUrl:""}),o.fullPage&&(t.fullPage=o.fullPage.dataUrl,r.fullPage={mime:o.fullPage.mime,width:o.fullPage.width,height:o.fullPage.height},o.fullPage={...o.fullPage,dataUrl:""}),n.screenshots=o,(r.element||r.fullPage)&&(n.screenshot_intent=r);}return {lean:n,extracted:t}}async function Re(e,t,n){let r=dt(t);await fetch(e,{method:"PUT",body:r,headers:{"content-type":r.type},...n?{signal:n}:{}});}async function mt(e){let{feedbackId:t,extracted:n,screenshots:r,signal:o}=e,i={};n.element&&r?.element&&(i.element={dataUrl:n.element,mime:r.element.mime,width:r.element.width,height:r.element.height}),n.fullPage&&r?.fullPage&&(i.fullPage={dataUrl:n.fullPage,mime:r.fullPage.mime,width:r.fullPage.width,height:r.fullPage.height}),Object.keys(i).length!==0&&await fetch(`${Fe}/${t}/screenshots`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(i),...o?{signal:o}:{}});}async function Ce(e){let{signal:t,transport:n}=e;if(Date.now()-xe<lt)return {ok:false,error:y("configuration",new Error("Please wait before submitting again"))};let o=n?.timeoutMs??at,i=n?.maxAttempts??st,c=n?.backoffMs??ct,l=!!(e.payload.screenshots?.element?.dataUrl||e.payload.screenshots?.fullPage?.dataUrl),{lean:s,extracted:a}=l?ft(e.payload):{lean:e.payload,extracted:{}},d={...a,...e.screenshotDataUrls};for(let g=1;g<=i;g+=1){let h=new AbortController,b=setTimeout(()=>h.abort(),o),u=()=>h.abort();t&&t.addEventListener("abort",u,{once:true});try{let f=await fetch(Fe,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(s),signal:h.signal});if(f.ok){xe=Date.now();let m;try{m=await f.json();}catch{}if((d.element||d.fullPage)&&m){let p=m.upload_urls;if(p){let k=[];d.element&&p.element&&k.push(Re(p.element,d.element,t)),d.fullPage&&p.fullPage&&k.push(Re(p.fullPage,d.fullPage,t));try{await Promise.all(k);}catch{}}else if(m.feedback_id)try{await mt({feedbackId:m.feedback_id,extracted:d,screenshots:e.payload.screenshots,...t?{signal:t}:{}});}catch{}}let A={ok:!0,status:f.status};return m&&(A.apiResponse=m),A}if(g<i&&ut(f.status)){let m=.85+Math.random()*.3,v=Math.round(c*2**(g-1)*m);await Te(v,t);continue}return {ok:!1,status:f.status,error:y("api_failed",new Error(`HTTP ${f.status}`))}}catch(f){if(h.signal.aborted||t?.aborted)return {ok:false,error:y("aborted",f)};if(g<i){let m=.85+Math.random()*.3,v=Math.round(c*2**(g-1)*m);await Te(v,t);continue}return {ok:false,error:y("api_failed",f)}}finally{clearTimeout(b),t&&t.removeEventListener("abort",u);}}return {ok:false,error:y("api_failed",new Error("Failed"))}}async function ie(e){let{signal:t,transport:n}=e,r={ok:false};try{let o={payload:e.payload,...t?{signal:t}:{},...n?{transport:n}:{}};r.api=await Ce(o),r.ok=!!r.api?.ok;}catch(o){r.api={ok:false,error:y("api_failed",o)},r.ok=false;}return {payload:e.payload,result:r}}var pt=["[data-blocfeed-ui]","[data-blocfeed-ignore]"];function gt(e){let t=[...pt,...e?.ignoreSelectors??[]],n=Array.from(new Set(t));return {...e,ignoreSelectors:n}}function Me(){return {phase:"idle"}}function ht(e){if(e.ok)return false;let t=e.api;return t?t.status&&t.status>=400&&t.status<500||t.error?.kind==="aborted"||t.error?.kind==="configuration"?false:!t.ok:true}function an(e){let t=e,n=Me(),r=new Set,o=new Set,i=null,c=null,l=null,s=null,a=0,d=null,g=()=>{for(let p of r)p(n);},h=p=>{for(let k of o)k(p);},b=p=>{n=p,g();},u=()=>{a+=1,s?.abort(),s=null;},f=()=>{i?.stop(),i=null,h(null),l!==null&&w()&&(document.documentElement.style.cursor=l,l=null);},m=()=>{u(),f(),c=null,b(Me());},v=()=>{if(!w())return;f(),c=null;let p=gt(t.picker);l=document.documentElement.style.cursor,document.documentElement.style.cursor="crosshair",b({phase:"picking"}),i=Ae(p,{onHover:h,onSelect:({element:k,descriptor:$})=>{c=k,f(),b({phase:"review",selection:$});},onCancel:()=>{m();}});},A=()=>{let p=Pe();if(p.length!==0)for(let k of p)ie({payload:k,...t.transport?{transport:t.transport}:{}}).catch(()=>{re(k);});};if(w()){setTimeout(A,1e3);let p=()=>A();window.addEventListener("online",p),d=()=>window.removeEventListener("online",p);}return {getState:()=>n,subscribe(p){return r.add(p),()=>r.delete(p)},subscribeHover(p){return o.add(p),()=>o.delete(p)},start(){n.phase==="capturing"||n.phase==="submitting"||n.phase!=="picking"&&v();},stop(){m();},clearSelection(){n.phase==="capturing"||n.phase==="submitting"||v();},setConfig(p){t=p;},async submit(p,k){if(!w()){let E=y("configuration",new Error("BlocFeed submit can only run in the browser"));return b({phase:"error",lastError:E}),{ok:false}}let $=t.blocfeed_id?.trim?.()??"";if(!$){let x={phase:"error",lastError:y("configuration",new Error("Missing blocfeed_id. Create a project in BlocFeed and pass its blocfeed_id."))};return n.selection&&(x.selection=n.selection),b(x),{ok:false}}if(n.phase==="capturing"||n.phase==="submitting")return {ok:false};let N=a+1;a=N,s?.abort(),s=new AbortController;let F=s.signal,_=n.selection,K=k?.capture?{...t.capture,...k.capture}:t.capture,le=!!(K?.element||K?.fullPage),ue={phase:le?"capturing":"submitting"};_&&(ue.selection=_),b(ue);try{let E=le?await Se({selectionElement:c,capture:K,signal:F}):void 0;if(F.aborted||a!==N)return {ok:!1};let x={phase:"submitting"};_&&(x.selection=_),E&&(x.capture=E),b(x);let C={};_&&(C.selection=_),E&&(C.capture=E);let Ie=await ve({config:t.metadata,context:C,...t.user?{user:t.user}:{}}),M={version:1,createdAt:new Date().toISOString(),blocfeed_id:$,message:p,metadata:Ie};k?.category&&(M.category=k.category),t.user&&(M.user=t.user),_&&(M.selection=_),E&&(M.screenshots=E);let{result:P}=await ie({payload:M,signal:F,...t.transport?{transport:t.transport}:{}});if(F.aborted||a!==N)return P;if(P.ok){let Y={phase:"success",lastSubmit:P};return _&&(Y.selection=_),E&&(Y.capture=E),b(Y),P}ht(P)&&re(M);let Be=P.api?.error??y("unknown",new Error("Submission failed")),Q={phase:"error",lastSubmit:P,lastError:Be};return _&&(Q.selection=_),E&&(Q.capture=E),b(Q),P}catch(E){if(F.aborted||a!==N)return {ok:false};let C={phase:"error",lastError:F.aborted?y("aborted",E):y("unknown",E)};return _&&(C.selection=_),b(C),{ok:false}}finally{a===N&&(s=null);}},__unsafeGetSelectedElement(){return c},destroy(){m(),r.clear(),o.clear(),d?.(),d=null;}}}var B=[],D=[],Le=20,Ne=15,Z=[],O={},U=null,H=null,q=null,W=false,wt=["blocfeed.com","google-analytics.com","googletagmanager.com","analytics.google.com","googleads.g.doubleclick.net","googlesyndication.com","googleadservices.com","google.com/pagead","google.com/ads","facebook.net","facebook.com/tr","connect.facebook.net","graph.facebook.com","api.mixpanel.com","api-js.mixpanel.com","api.amplitude.com","api2.amplitude.com","api.segment.io","cdn.segment.com","vars.hotjar.com","in.hotjar.com","script.hotjar.com","heapanalytics.com","fullstory.com/s/fs.js","rs.fullstory.com","app.posthog.com","us.posthog.com","eu.posthog.com","api-iam.intercom.io","widget.intercom.io","sentry.io/api","browser.sentry-cdn.com","browser-intake-datadoghq.com","clarity.ms","js.hs-analytics.net","api.hubapi.com","forms.hubspot.com","plausible.io/api","client.crisp.chat","js.driftt.com","r.logrocket.com","app.pendo.io","events.launchdarkly.com","app.launchdarkly.com","grammarly.com","gnar.grammarly.com","capi.grammarly.com","api.languagetool.org","api.languagetoolplus.com","fonts.googleapis.com","fonts.gstatic.com","cdn.cookielaw.org","consent.cookiebot.com","js.stripe.com","api.stripe.com/v1/tokens","google.com/recaptcha","hcaptcha.com","bam.nr-data.net","rec.smartlook.com","o2.mouseflow.com","api.luckyorange.com","static.zdassets.com","ekr.zdassets.com"];function yt(e){if(e instanceof Error)return e.message;if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function bt(e,t){let n=t.map(yt).join(" "),r=t.find(i=>i instanceof Error),o={level:e,message:n.slice(0,2e3),timestamp:Date.now()};for(r?.stack&&(o.stack=r.stack.slice(0,2e3)),B.push(o);B.length>Le;)B.shift();}function ae(e){let t=e.url.toLowerCase();for(let n of Z)if(t.includes(n))return;for(D.push(e);D.length>Ne;)D.shift();}function ln(e={}){if(W||!w())return;W=true,Le=e.consoleLimit??20,Ne=e.networkLimit??15;let t=e.ignoreUrls;if(t!==void 0?Z=t.map(n=>n.toLowerCase()):Z=[...wt],e.console!==false){let n=e.consoleLevels??["error","warn"];for(let r of n)O[r]=console[r],console[r]=(...o)=>{bt(r,o),O[r]?.apply(console,o);};}if(e.network!==false&&typeof window.fetch=="function"){U=window.fetch;let n=U;window.fetch=async function(o,i){let c=typeof o=="string"?o:o instanceof URL?o.toString():o.url,l=(i?.method??"GET").toUpperCase(),s=Date.now();try{let a=await n.call(window,o,i);return a.ok||ae({url:c.slice(0,500),method:l,status:a.status,statusText:a.statusText,timestamp:s,durationMs:Date.now()-s}),a}catch(a){throw ae({url:c.slice(0,500),method:l,status:0,statusText:a instanceof Error?a.message:"Network error",timestamp:s,durationMs:Date.now()-s}),a}};}if(e.network!==false&&typeof XMLHttpRequest<"u"){H=XMLHttpRequest.prototype.open,q=XMLHttpRequest.prototype.send;let n=H,r=q;XMLHttpRequest.prototype.open=function(o,i,...c){return this.__bf_method=o.toUpperCase(),this.__bf_url=String(i),n.apply(this,[o,i,...c])},XMLHttpRequest.prototype.send=function(...o){let i=this.__bf_method||"GET",c=this.__bf_url||"",l=Date.now();return this.addEventListener("loadend",function(){if(this.status>=400||this.status===0){let s={url:c.slice(0,500),method:i,status:this.status,timestamp:l,durationMs:Date.now()-l};this.statusText&&(s.statusText=this.statusText),ae(s);}}),r.apply(this,o)};}}function un(){if(W){for(let[e,t]of Object.entries(O))console[e]=t;for(let e of Object.keys(O))delete O[e];U&&(window.fetch=U,U=null),H&&(XMLHttpRequest.prototype.open=H,H=null),q&&(XMLHttpRequest.prototype.send=q,q=null),Z=[],W=false;}}function dn(){return {consoleLogs:[...B],networkErrors:[...D]}}function fn(){B=[],D=[];}var Et=[{name:"supabase_service_role_key",pattern:/SUPABASE_SERVICE_ROLE_KEY["'=:\s]+[A-Za-z0-9_.=-]{30,}/},{name:"supabase_db_password",pattern:/SUPABASE_DB_PASSWORD["'=:\s]+[^\s"']{6,}/},{name:"postgres_password",pattern:/POSTGRES_PASSWORD["'=:\s]+[^\s"']{6,}/},{name:"database_url_with_creds",pattern:/(?:postgres|postgresql|mysql|mongodb|redis|amqp):\/\/[^:]+:[^@\s"']+@/},{name:"aws_access_key",pattern:/AKIA[0-9A-Z]{16}/},{name:"aws_secret_key",pattern:/AWS_SECRET_ACCESS_KEY["'=:\s]+[A-Za-z0-9/+=]{30,}/},{name:"aws_session_token",pattern:/AWS_SESSION_TOKEN["'=:\s]+[A-Za-z0-9/+=]{30,}/},{name:"stripe_secret_key",pattern:/sk_live_[a-zA-Z0-9]{10,}/},{name:"stripe_secret_key_test",pattern:/sk_test_[a-zA-Z0-9]{10,}/},{name:"stripe_restricted_key",pattern:/rk_(?:live|test)_[a-zA-Z0-9]{10,}/},{name:"github_pat",pattern:/ghp_[A-Za-z0-9_]{36,}/},{name:"github_oauth",pattern:/gho_[A-Za-z0-9_]{36,}/},{name:"github_user_token",pattern:/ghu_[A-Za-z0-9_]{36,}/},{name:"github_server_token",pattern:/ghs_[A-Za-z0-9_]{36,}/},{name:"github_fine_grained",pattern:/github_pat_[A-Za-z0-9_]{22,}/},{name:"openai_api_key",pattern:/sk-[a-zA-Z0-9]{20,}(?![a-zA-Z0-9_])/},{name:"anthropic_api_key",pattern:/sk-ant-[a-zA-Z0-9\-_]{20,}/},{name:"private_key",pattern:/-----BEGIN (?:RSA |EC |DSA |OPENSSH |PGP )?PRIVATE KEY-----/},{name:"sendgrid_api_key",pattern:/SG\.[a-zA-Z0-9_-]{22,}\.[a-zA-Z0-9_-]{22,}/},{name:"twilio_auth_token",pattern:/TWILIO_AUTH_TOKEN["'=:\s]+[a-f0-9]{32}/},{name:"generic_secret_key",pattern:/[A-Z_]{2,}_SECRET_KEY["'=:\s]+[^\s"']{8,}/},{name:"generic_secret",pattern:/[A-Z_]{2,}_SECRET["'=:\s]+[^\s"']{8,}/},{name:"generic_password",pattern:/[A-Z_]{2,}_PASSWORD["'=:\s]+[^\s"']{6,}/},{name:"generic_private_key_var",pattern:/[A-Z_]{2,}_PRIVATE_KEY["'=:\s]+[^\s"']{8,}/}],R=[],ce=0,se=false;function kt(e){let t=e.slice(0,80);return t.length<=6?"***":t.slice(0,6)+"***"}function _t(e,t,n,r){if(R.some(c=>c.rule===e&&c.source===t))return;let i={rule:e,source:t,hint:kt(n),timestamp:Date.now()};r&&(i.location=r),R.push(i);}function z(e,t,n,r){for(let{name:o,pattern:i}of n){let c=i.exec(e);c&&_t(o,t,c[0],r);}}function St(e){try{let t=window;if(t.__NEXT_DATA__){let n=JSON.stringify(t.__NEXT_DATA__);z(n,"hydration",e,"__NEXT_DATA__");}if(t.__NUXT__){let n=JSON.stringify(t.__NUXT__);z(n,"hydration",e,"__NUXT__");}}catch{}}function vt(e){try{document.querySelectorAll("script:not([src])").forEach((n,r)=>{let o=n.textContent;o&&o.length>0&&z(o,"scripts",e,`inline-script[${r}]`);});}catch{}}function Pt(e){try{document.querySelectorAll("meta[content]").forEach(n=>{let r=n.getAttribute("content"),o=n.getAttribute("name")||n.getAttribute("property")||"";r&&r.length>10&&z(r,"meta",e,o?`meta[${o}]`:void 0);});}catch{}}function At(e){try{document.querySelectorAll("[data-api-key], [data-secret], [data-token], [data-password]").forEach(n=>{let r=n.attributes;for(let o=0;o<r.length;o++){let i=r[o];i.name.startsWith("data-")&&i.value.length>10&&z(i.value,"dom",e,`${n.tagName.toLowerCase()}[${i.name}]`);}});}catch{}}function gn(e={}){if(se||!w()||(se=true,e.secretScan===false))return;let t=[...Et,...e.customPatterns??[]],n=e.scanTargets??["hydration","scripts","meta","dom"];setTimeout(()=>{ce=Date.now(),n.includes("hydration")&&St(t),n.includes("scripts")&&vt(t),n.includes("meta")&&Pt(t),n.includes("dom")&&At(t);let r=e.notify??"both";R.length>0&&(r==="console"||r==="both")&&console.warn(`[BlocFeed Security] Found ${R.length} potential secret(s) exposed in client code:`,R.map(o=>`${o.rule} (${o.source}${o.location?`: ${o.location}`:""})`));},100);}function hn(){return {findings:[...R],scannedAt:ce}}function wn(){R=[],ce=0,se=false;}
2
+ export{w as a,G as b,be as c,Se as d,ve as e,re as f,Pe as g,Ht as h,qt as i,an as j,ln as k,un as l,dn as m,fn as n,gn as o,hn as p,wn as q};
@@ -0,0 +1,2 @@
1
+ 'use strict';function w(){return typeof window<"u"&&typeof document<"u"}function de(e){let t=globalThis.CSS;return typeof t?.escape=="function"?t.escape(e):e.replace(/[^a-zA-Z0-9_-]/g,n=>{let r=n.codePointAt(0);return r===void 0?"":`\\${r.toString(16)} `})}function G(e){return {x:e.x,y:e.y,width:e.width,height:e.height}}function De(e){return {x:e.x+window.scrollX,y:e.y+window.scrollY,width:e.width,height:e.height}}function Oe(e){return e.replace(/\s+/g," ").trim()}function Ue(e,t=140){let n=e.textContent;if(!n)return;let r=Oe(n);if(r)return r.length<=t?r:`${r.slice(0,t-1)}\u2026`}function He(e){let t=1;for(let n=e.previousElementSibling;n;n=n.previousElementSibling)n.tagName===e.tagName&&(t+=1);return t}var ge=["data-testid","data-test-id","data-test","data-qa","data-cy"],fe="data-blocfeed-component";function qe(e){let t=e.closest(`[${fe}]`);if(!t)return;let r=t.getAttribute(fe)?.trim();return r||void 0}function ze(e){for(let t of ge){let n=e.closest(`[${t}]`);if(!n)continue;let o=n.getAttribute(t)?.trim();if(o)return o}}function me(e){try{let t=e,n=Object.getOwnPropertyNames(t);for(let r of n)if(r.startsWith("__reactFiber$")||r.startsWith("__reactInternalInstance$")){let o=t[r];if(o&&typeof o=="object")return o}}catch{}return null}function T(e){if(e.length<=1||e.length===2&&e[0]===e[0].toLowerCase())return true;let t=e[0];return t>="a"&&t<="z"}function I(e){if(e){for(let t of e)if(typeof t.name=="string"&&t.name&&!T(t.name))return t.name}}function S(e){if(e&&typeof e!="string"){if(typeof e=="function"){let t=e;return typeof t.displayName=="string"&&t.displayName?t.displayName:typeof t.name=="string"&&t.name?t.name:void 0}if(typeof e=="object"){let t=e,n=t.displayName;if(typeof n=="string"&&n)return n;let r=t.render;if(typeof r=="function"){let i=r;if(typeof i.displayName=="string"&&i.displayName)return i.displayName;if(typeof i.name=="string"&&i.name)return i.name}let o=t.type;return S(o)}}}function $e(e){let t=me(e);if(!t)return;let n=I(t._debugInfo);if(n)return n;let r=t._debugOwner!==void 0;if(r){let s=t._debugOwner;for(let a=0;s&&a<50;a+=1){let d=I(s._debugInfo);if(d)return d;let g=S(s.type)??S(s.elementType);if(g&&!T(g))return g;s=s._debugOwner;}}if(t._owner!==void 0&&t._owner!==t._debugOwner){let s=t._owner;for(let a=0;s&&a<50;a+=1){let d=I(s._debugInfo);if(d)return d;let g=S(s.type)??S(s.elementType);if(g&&!T(g))return g;s=s._owner;}}let i=t,c=r?80:25;for(let s=0;i&&s<c;s+=1){let a=I(i._debugInfo);if(a)return a;let d=S(i.type)??S(i.elementType);if(d&&!T(d))return d;i=i.return;}let l=e.parentElement;for(let s=0;l&&s<15;s+=1){let a=me(l);if(a){let d=I(a._debugInfo);if(d)return d;let g=S(a.type)??S(a.elementType);if(g&&!T(g))return g;if(a._debugOwner){let h=S(a._debugOwner.type)??S(a._debugOwner.elementType);if(h&&!T(h))return h}if(a._owner&&a._owner!==a._debugOwner){let h=S(a._owner.type)??S(a._owner.elementType);if(h&&!T(h))return h}}l=l.parentElement;}}function je(e){let t=e.tagName.toLowerCase(),n=e.getAttribute("id");if(n)return `#${de(n)}`;for(let r of ge){let o=e.getAttribute(r);if(o)return `${t}[${r}="${de(o)}"]`}return `${t}:nth-of-type(${He(e)})`}function Xe(e,t=10){let n=[],r=e;for(;r&&n.length<t;){let o=je(r);if(n.unshift(o),o.startsWith("#"))break;r=r.parentElement;}return n.join(" > ")}function pe(e,t){if(!t||t.length===0)return false;for(let n of t)if(e.closest(n))return true;return false}function J(e,t){if(!e||pe(e,t.ignoreSelectors))return null;let n=e;for(;n;){if(pe(n,t.ignoreSelectors))return null;if(t.isSelectable?.(n)??Ze(n))return n;n=n.parentElement;}return null}function Ze(e){let t=e.tagName;return !(t==="HTML"||t==="BODY")}function he(e){let t=e.getBoundingClientRect(),n={selector:Xe(e),tagName:e.tagName.toLowerCase(),rect:G(t),pageRect:De(t)},r=e.getAttribute("id");r&&(n.id=r);let o=e.className;typeof o=="string"&&o.trim()&&(n.className=o);let i=Ue(e);i&&(n.textSnippet=i);let c=qe(e)??$e(e);c&&(n.componentName=c);let l=ze(e);return l&&(n.testId=l),n}var V=null;async function we(){return V||(V=import('html-to-image')),V}async function We(e){return await new Promise((t,n)=>{let r=new Image;r.onload=()=>t({width:r.naturalWidth,height:r.naturalHeight}),r.onerror=()=>n(new Error("Failed to load generated screenshot")),r.src=e;})}async function ye(e,t){let{width:n,height:r}=await We(e);return {dataUrl:e,mime:t,width:n,height:r}}function L(e){if(e?.aborted)throw new Error("Aborted")}function be(){return {async captureElement(e,t){if(!w())throw new Error("captureElement can only run in the browser");L(t.signal);let n=await we();L(t.signal);let r=t.mime==="image/jpeg"?await n.toJpeg(e,{quality:t.quality??.92,pixelRatio:t.pixelRatio}):await n.toPng(e,{pixelRatio:t.pixelRatio});return L(t.signal),await ye(r,t.mime)},async captureFullPage(e){if(!w())throw new Error("captureFullPage can only run in the browser");L(e.signal);let t=document.documentElement,n=Math.max(t.scrollWidth,t.clientWidth),r=Math.max(t.scrollHeight,t.clientHeight),o=Math.min(1,e.maxDimension/Math.max(n,r)),i=Math.max(1,Math.round(n*o)),c=Math.max(1,Math.round(r*o)),l=await we();L(e.signal);let s=e.mime==="image/jpeg"?await l.toJpeg(t,{width:i,height:c,quality:e.quality??.92,pixelRatio:e.pixelRatio}):await l.toPng(t,{width:i,height:c,pixelRatio:e.pixelRatio});return L(e.signal),await ye(s,e.mime)}}}function Ke(e){if(e instanceof Error)return e.message;if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return "Unknown error"}}function y(e,t,n){let r={kind:e,message:Ke(t)};return n&&(r.detail=n),r}var Qe=12e3,Ye=2048,Ge=.92;function Ee(){return Date.now()}function Je(e){return new Promise((t,n)=>{let r=()=>n(new Error("Aborted"));if(e.aborted){r();return}e.addEventListener("abort",r,{once:true});})}async function ke(e,t,n){let r=new Promise((i,c)=>{let l=setTimeout(()=>c(new Error("Timeout")),t);typeof l.unref=="function"&&l.unref();}),o=[e,r];return n&&o.push(Je(n)),await Promise.race(o)}function Ve(e){if(!w())return 1;let t=window.devicePixelRatio||1,n=e?.pixelRatio??Math.min(t,2);return Math.max(.1,n)}function et(e){return !!(e?.element||e?.fullPage)}function _e(e){let t={mime:e.mime,pixelRatio:e.pixelRatio,maxDimension:e.maxDimension};return e.includeQuality&&(t.quality=e.quality),e.signal&&(t.signal=e.signal),t}async function Se(e){let{selectionElement:t,capture:n,signal:r}=e;if(!w()||!et(n))return;let o=Ee(),i=[],c=n?.timeoutMs??Qe,l=n?.maxDimension??Ye,s=n?.mime??"image/png",a=n?.quality??Ge,d=n?.adapter??be(),g={},h=Ve(n);if(n?.element&&t)try{let f=t.getBoundingClientRect(),m=Math.min(1,l/Math.max(f.width,f.height)),v=Math.min(h,h*m),A=await ke(Promise.resolve(d.captureElement(t,{..._e({mime:s,quality:a,pixelRatio:v,maxDimension:l,includeQuality:s==="image/jpeg",...r?{signal:r}:{}})})),c,r);g.element=A;}catch(f){if(r?.aborted)throw f;i.push(y("capture_failed",f,{target:"element"}));}if(n?.fullPage)try{let f=await ke(Promise.resolve(d.captureFullPage(_e({mime:s,quality:a,pixelRatio:h,maxDimension:l,includeQuality:s==="image/jpeg",...r?{signal:r}:{}}))),c,r);g.fullPage=f;}catch(f){if(r?.aborted)throw f;i.push(y("capture_failed",f,{target:"fullPage"}));}let b=Ee(),u={startedAt:o,finishedAt:b,durationMs:Math.max(0,b-o)};return i.length>0&&(u.errors=i),{...g,diagnostics:u}}function tt(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function nt(){return w()?{url:window.location.href,title:document.title,referrer:document.referrer||void 0,userAgent:navigator.userAgent,language:navigator.language,platform:navigator.platform,viewport:{width:window.innerWidth,height:window.innerHeight},screen:{width:window.screen.width,height:window.screen.height},scroll:{x:window.scrollX,y:window.scrollY},devicePixelRatio:window.devicePixelRatio||1,timezone:tt()}:{}}function rt(e){if(!e)return {};let t={};return e.id&&(t.userId=e.id),e.email&&(t.userEmail=e.email),e.name&&(t.userName=e.name),t}async function ve(e){let{config:t,context:n,user:r}=e;if(t?.enabled===false)return {};let o={...nt(),...rt(r)},i=t?.enrich;if(!i)return o;try{let c=await i(n);return {...o,...c}}catch(c){let l=y("unknown",c);return {...o,blocfeedMetadataError:l.message}}}var ee="blocfeed-queue",ot=50;function te(){if(!w())return [];try{let e=localStorage.getItem(ee);if(!e)return [];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return []}}function ne(e){if(w())try{e.length===0?localStorage.removeItem(ee):localStorage.setItem(ee,JSON.stringify(e));}catch{}}function it(e){let t={...e};if(t.screenshots){let n={...t.screenshots};n.element&&(n.element={...n.element,dataUrl:""}),n.fullPage&&(n.fullPage={...n.fullPage,dataUrl:""}),t.screenshots=n;}return t}function re(e){let t=te(),n=it(e);for(n.metadata={...n.metadata,_queued:true},t.push({payload:n,timestamp:Date.now()});t.length>ot;)t.shift();ne(t);}function Pe(){let e=te();return e.length===0?[]:(ne([]),e.map(t=>t.payload))}function Ht(){ne([]);}function qt(){return te().length}function oe(e){let t=null,n=null,r=(...o)=>{n=o,t===null&&(t=requestAnimationFrame(()=>{if(t=null,!n)return;let i=n;n=null,e(...i);}));};return r.cancel=()=>{t!==null&&cancelAnimationFrame(t),t=null,n=null;},r}function j(e){return e instanceof Element?!!e.closest("[data-blocfeed-ui]"):false}function X(e){e.stopPropagation(),e.stopImmediatePropagation?.();}function Ae(e,t){if(!w())throw new Error("BlocFeed picker can only run in a browser environment.");let n=e.ignoreSelectors,r=e.isSelectable,o={};n&&n.length>0&&(o.ignoreSelectors=n),r&&(o.isSelectable=r);let i=null,c=null,l=(u,f=false)=>{if(!u){i=null,c=null,t.onHover(null);return}let m=G(u.getBoundingClientRect()),v=`${Math.round(m.x)}:${Math.round(m.y)}:${Math.round(m.width)}:${Math.round(m.height)}`;!f&&u===i&&v===c||(i=u,c=v,t.onHover({element:u,rect:m}));},s=oe(u=>{if(j(u.target))return;let f=document.elementFromPoint(u.clientX,u.clientY),m=J(f,o);l(m);}),a=oe(()=>{i&&l(i,true);}),d=u=>{j(u.target)||(X(u),u.pointerType==="mouse"&&u.preventDefault());},g=u=>{j(u.target)||(X(u),u.pointerType==="mouse"&&u.preventDefault());},h=u=>{if(j(u.target))return;X(u),u.preventDefault();let f=document.elementFromPoint(u.clientX,u.clientY),m=J(f,o);m&&t.onSelect({element:m,descriptor:he(m)});},b=u=>{u.key==="Escape"&&(X(u),u.preventDefault(),t.onCancel());};return window.addEventListener("pointermove",s,{capture:true,passive:true}),window.addEventListener("pointerdown",d,{capture:true}),window.addEventListener("pointerup",g,{capture:true}),window.addEventListener("click",h,{capture:true}),window.addEventListener("keydown",b,{capture:true}),window.addEventListener("scroll",a,{capture:true,passive:true}),window.addEventListener("resize",a,{passive:true}),{stop(){window.removeEventListener("pointermove",s,{capture:true}),window.removeEventListener("pointerdown",d,{capture:true}),window.removeEventListener("pointerup",g,{capture:true}),window.removeEventListener("click",h,{capture:true}),window.removeEventListener("keydown",b,{capture:true}),window.removeEventListener("scroll",a,{capture:true}),window.removeEventListener("resize",a),s.cancel(),a.cancel(),t.onHover(null);}}}var at=12e3,st=2,ct=500,lt=2e3,Fe="https://blocfeed.com/api/feedback",xe=0;function Te(e,t){return new Promise((n,r)=>{if(t?.aborted){r(new Error("Aborted"));return}let o=setTimeout(n,e),i=()=>{clearTimeout(o),r(new Error("Aborted"));};t?.addEventListener("abort",i,{once:true});})}function ut(e){return e>=500&&e<=599}function dt(e){let[t,n]=e.split(",",2);if(!t||!n)throw new Error("Invalid data URL");let o=/data:(.*?);base64/.exec(t)?.[1]||"application/octet-stream",i=atob(n),c=new Uint8Array(i.length);for(let l=0;l<i.length;l+=1)c[l]=i.charCodeAt(l);return new Blob([c],{type:o})}function ft(e){let t={},n={...e};if(n.screenshots){let r={},o={...n.screenshots};o.element&&(t.element=o.element.dataUrl,r.element={mime:o.element.mime,width:o.element.width,height:o.element.height},o.element={...o.element,dataUrl:""}),o.fullPage&&(t.fullPage=o.fullPage.dataUrl,r.fullPage={mime:o.fullPage.mime,width:o.fullPage.width,height:o.fullPage.height},o.fullPage={...o.fullPage,dataUrl:""}),n.screenshots=o,(r.element||r.fullPage)&&(n.screenshot_intent=r);}return {lean:n,extracted:t}}async function Re(e,t,n){let r=dt(t);await fetch(e,{method:"PUT",body:r,headers:{"content-type":r.type},...n?{signal:n}:{}});}async function mt(e){let{feedbackId:t,extracted:n,screenshots:r,signal:o}=e,i={};n.element&&r?.element&&(i.element={dataUrl:n.element,mime:r.element.mime,width:r.element.width,height:r.element.height}),n.fullPage&&r?.fullPage&&(i.fullPage={dataUrl:n.fullPage,mime:r.fullPage.mime,width:r.fullPage.width,height:r.fullPage.height}),Object.keys(i).length!==0&&await fetch(`${Fe}/${t}/screenshots`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(i),...o?{signal:o}:{}});}async function Ce(e){let{signal:t,transport:n}=e;if(Date.now()-xe<lt)return {ok:false,error:y("configuration",new Error("Please wait before submitting again"))};let o=n?.timeoutMs??at,i=n?.maxAttempts??st,c=n?.backoffMs??ct,l=!!(e.payload.screenshots?.element?.dataUrl||e.payload.screenshots?.fullPage?.dataUrl),{lean:s,extracted:a}=l?ft(e.payload):{lean:e.payload,extracted:{}},d={...a,...e.screenshotDataUrls};for(let g=1;g<=i;g+=1){let h=new AbortController,b=setTimeout(()=>h.abort(),o),u=()=>h.abort();t&&t.addEventListener("abort",u,{once:true});try{let f=await fetch(Fe,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(s),signal:h.signal});if(f.ok){xe=Date.now();let m;try{m=await f.json();}catch{}if((d.element||d.fullPage)&&m){let p=m.upload_urls;if(p){let k=[];d.element&&p.element&&k.push(Re(p.element,d.element,t)),d.fullPage&&p.fullPage&&k.push(Re(p.fullPage,d.fullPage,t));try{await Promise.all(k);}catch{}}else if(m.feedback_id)try{await mt({feedbackId:m.feedback_id,extracted:d,screenshots:e.payload.screenshots,...t?{signal:t}:{}});}catch{}}let A={ok:!0,status:f.status};return m&&(A.apiResponse=m),A}if(g<i&&ut(f.status)){let m=.85+Math.random()*.3,v=Math.round(c*2**(g-1)*m);await Te(v,t);continue}return {ok:!1,status:f.status,error:y("api_failed",new Error(`HTTP ${f.status}`))}}catch(f){if(h.signal.aborted||t?.aborted)return {ok:false,error:y("aborted",f)};if(g<i){let m=.85+Math.random()*.3,v=Math.round(c*2**(g-1)*m);await Te(v,t);continue}return {ok:false,error:y("api_failed",f)}}finally{clearTimeout(b),t&&t.removeEventListener("abort",u);}}return {ok:false,error:y("api_failed",new Error("Failed"))}}async function ie(e){let{signal:t,transport:n}=e,r={ok:false};try{let o={payload:e.payload,...t?{signal:t}:{},...n?{transport:n}:{}};r.api=await Ce(o),r.ok=!!r.api?.ok;}catch(o){r.api={ok:false,error:y("api_failed",o)},r.ok=false;}return {payload:e.payload,result:r}}var pt=["[data-blocfeed-ui]","[data-blocfeed-ignore]"];function gt(e){let t=[...pt,...e?.ignoreSelectors??[]],n=Array.from(new Set(t));return {...e,ignoreSelectors:n}}function Me(){return {phase:"idle"}}function ht(e){if(e.ok)return false;let t=e.api;return t?t.status&&t.status>=400&&t.status<500||t.error?.kind==="aborted"||t.error?.kind==="configuration"?false:!t.ok:true}function an(e){let t=e,n=Me(),r=new Set,o=new Set,i=null,c=null,l=null,s=null,a=0,d=null,g=()=>{for(let p of r)p(n);},h=p=>{for(let k of o)k(p);},b=p=>{n=p,g();},u=()=>{a+=1,s?.abort(),s=null;},f=()=>{i?.stop(),i=null,h(null),l!==null&&w()&&(document.documentElement.style.cursor=l,l=null);},m=()=>{u(),f(),c=null,b(Me());},v=()=>{if(!w())return;f(),c=null;let p=gt(t.picker);l=document.documentElement.style.cursor,document.documentElement.style.cursor="crosshair",b({phase:"picking"}),i=Ae(p,{onHover:h,onSelect:({element:k,descriptor:$})=>{c=k,f(),b({phase:"review",selection:$});},onCancel:()=>{m();}});},A=()=>{let p=Pe();if(p.length!==0)for(let k of p)ie({payload:k,...t.transport?{transport:t.transport}:{}}).catch(()=>{re(k);});};if(w()){setTimeout(A,1e3);let p=()=>A();window.addEventListener("online",p),d=()=>window.removeEventListener("online",p);}return {getState:()=>n,subscribe(p){return r.add(p),()=>r.delete(p)},subscribeHover(p){return o.add(p),()=>o.delete(p)},start(){n.phase==="capturing"||n.phase==="submitting"||n.phase!=="picking"&&v();},stop(){m();},clearSelection(){n.phase==="capturing"||n.phase==="submitting"||v();},setConfig(p){t=p;},async submit(p,k){if(!w()){let E=y("configuration",new Error("BlocFeed submit can only run in the browser"));return b({phase:"error",lastError:E}),{ok:false}}let $=t.blocfeed_id?.trim?.()??"";if(!$){let x={phase:"error",lastError:y("configuration",new Error("Missing blocfeed_id. Create a project in BlocFeed and pass its blocfeed_id."))};return n.selection&&(x.selection=n.selection),b(x),{ok:false}}if(n.phase==="capturing"||n.phase==="submitting")return {ok:false};let N=a+1;a=N,s?.abort(),s=new AbortController;let F=s.signal,_=n.selection,K=k?.capture?{...t.capture,...k.capture}:t.capture,le=!!(K?.element||K?.fullPage),ue={phase:le?"capturing":"submitting"};_&&(ue.selection=_),b(ue);try{let E=le?await Se({selectionElement:c,capture:K,signal:F}):void 0;if(F.aborted||a!==N)return {ok:!1};let x={phase:"submitting"};_&&(x.selection=_),E&&(x.capture=E),b(x);let C={};_&&(C.selection=_),E&&(C.capture=E);let Ie=await ve({config:t.metadata,context:C,...t.user?{user:t.user}:{}}),M={version:1,createdAt:new Date().toISOString(),blocfeed_id:$,message:p,metadata:Ie};k?.category&&(M.category=k.category),t.user&&(M.user=t.user),_&&(M.selection=_),E&&(M.screenshots=E);let{result:P}=await ie({payload:M,signal:F,...t.transport?{transport:t.transport}:{}});if(F.aborted||a!==N)return P;if(P.ok){let Y={phase:"success",lastSubmit:P};return _&&(Y.selection=_),E&&(Y.capture=E),b(Y),P}ht(P)&&re(M);let Be=P.api?.error??y("unknown",new Error("Submission failed")),Q={phase:"error",lastSubmit:P,lastError:Be};return _&&(Q.selection=_),E&&(Q.capture=E),b(Q),P}catch(E){if(F.aborted||a!==N)return {ok:false};let C={phase:"error",lastError:F.aborted?y("aborted",E):y("unknown",E)};return _&&(C.selection=_),b(C),{ok:false}}finally{a===N&&(s=null);}},__unsafeGetSelectedElement(){return c},destroy(){m(),r.clear(),o.clear(),d?.(),d=null;}}}var B=[],D=[],Le=20,Ne=15,Z=[],O={},U=null,H=null,q=null,W=false,wt=["blocfeed.com","google-analytics.com","googletagmanager.com","analytics.google.com","googleads.g.doubleclick.net","googlesyndication.com","googleadservices.com","google.com/pagead","google.com/ads","facebook.net","facebook.com/tr","connect.facebook.net","graph.facebook.com","api.mixpanel.com","api-js.mixpanel.com","api.amplitude.com","api2.amplitude.com","api.segment.io","cdn.segment.com","vars.hotjar.com","in.hotjar.com","script.hotjar.com","heapanalytics.com","fullstory.com/s/fs.js","rs.fullstory.com","app.posthog.com","us.posthog.com","eu.posthog.com","api-iam.intercom.io","widget.intercom.io","sentry.io/api","browser.sentry-cdn.com","browser-intake-datadoghq.com","clarity.ms","js.hs-analytics.net","api.hubapi.com","forms.hubspot.com","plausible.io/api","client.crisp.chat","js.driftt.com","r.logrocket.com","app.pendo.io","events.launchdarkly.com","app.launchdarkly.com","grammarly.com","gnar.grammarly.com","capi.grammarly.com","api.languagetool.org","api.languagetoolplus.com","fonts.googleapis.com","fonts.gstatic.com","cdn.cookielaw.org","consent.cookiebot.com","js.stripe.com","api.stripe.com/v1/tokens","google.com/recaptcha","hcaptcha.com","bam.nr-data.net","rec.smartlook.com","o2.mouseflow.com","api.luckyorange.com","static.zdassets.com","ekr.zdassets.com"];function yt(e){if(e instanceof Error)return e.message;if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function bt(e,t){let n=t.map(yt).join(" "),r=t.find(i=>i instanceof Error),o={level:e,message:n.slice(0,2e3),timestamp:Date.now()};for(r?.stack&&(o.stack=r.stack.slice(0,2e3)),B.push(o);B.length>Le;)B.shift();}function ae(e){let t=e.url.toLowerCase();for(let n of Z)if(t.includes(n))return;for(D.push(e);D.length>Ne;)D.shift();}function ln(e={}){if(W||!w())return;W=true,Le=e.consoleLimit??20,Ne=e.networkLimit??15;let t=e.ignoreUrls;if(t!==void 0?Z=t.map(n=>n.toLowerCase()):Z=[...wt],e.console!==false){let n=e.consoleLevels??["error","warn"];for(let r of n)O[r]=console[r],console[r]=(...o)=>{bt(r,o),O[r]?.apply(console,o);};}if(e.network!==false&&typeof window.fetch=="function"){U=window.fetch;let n=U;window.fetch=async function(o,i){let c=typeof o=="string"?o:o instanceof URL?o.toString():o.url,l=(i?.method??"GET").toUpperCase(),s=Date.now();try{let a=await n.call(window,o,i);return a.ok||ae({url:c.slice(0,500),method:l,status:a.status,statusText:a.statusText,timestamp:s,durationMs:Date.now()-s}),a}catch(a){throw ae({url:c.slice(0,500),method:l,status:0,statusText:a instanceof Error?a.message:"Network error",timestamp:s,durationMs:Date.now()-s}),a}};}if(e.network!==false&&typeof XMLHttpRequest<"u"){H=XMLHttpRequest.prototype.open,q=XMLHttpRequest.prototype.send;let n=H,r=q;XMLHttpRequest.prototype.open=function(o,i,...c){return this.__bf_method=o.toUpperCase(),this.__bf_url=String(i),n.apply(this,[o,i,...c])},XMLHttpRequest.prototype.send=function(...o){let i=this.__bf_method||"GET",c=this.__bf_url||"",l=Date.now();return this.addEventListener("loadend",function(){if(this.status>=400||this.status===0){let s={url:c.slice(0,500),method:i,status:this.status,timestamp:l,durationMs:Date.now()-l};this.statusText&&(s.statusText=this.statusText),ae(s);}}),r.apply(this,o)};}}function un(){if(W){for(let[e,t]of Object.entries(O))console[e]=t;for(let e of Object.keys(O))delete O[e];U&&(window.fetch=U,U=null),H&&(XMLHttpRequest.prototype.open=H,H=null),q&&(XMLHttpRequest.prototype.send=q,q=null),Z=[],W=false;}}function dn(){return {consoleLogs:[...B],networkErrors:[...D]}}function fn(){B=[],D=[];}var Et=[{name:"supabase_service_role_key",pattern:/SUPABASE_SERVICE_ROLE_KEY["'=:\s]+[A-Za-z0-9_.=-]{30,}/},{name:"supabase_db_password",pattern:/SUPABASE_DB_PASSWORD["'=:\s]+[^\s"']{6,}/},{name:"postgres_password",pattern:/POSTGRES_PASSWORD["'=:\s]+[^\s"']{6,}/},{name:"database_url_with_creds",pattern:/(?:postgres|postgresql|mysql|mongodb|redis|amqp):\/\/[^:]+:[^@\s"']+@/},{name:"aws_access_key",pattern:/AKIA[0-9A-Z]{16}/},{name:"aws_secret_key",pattern:/AWS_SECRET_ACCESS_KEY["'=:\s]+[A-Za-z0-9/+=]{30,}/},{name:"aws_session_token",pattern:/AWS_SESSION_TOKEN["'=:\s]+[A-Za-z0-9/+=]{30,}/},{name:"stripe_secret_key",pattern:/sk_live_[a-zA-Z0-9]{10,}/},{name:"stripe_secret_key_test",pattern:/sk_test_[a-zA-Z0-9]{10,}/},{name:"stripe_restricted_key",pattern:/rk_(?:live|test)_[a-zA-Z0-9]{10,}/},{name:"github_pat",pattern:/ghp_[A-Za-z0-9_]{36,}/},{name:"github_oauth",pattern:/gho_[A-Za-z0-9_]{36,}/},{name:"github_user_token",pattern:/ghu_[A-Za-z0-9_]{36,}/},{name:"github_server_token",pattern:/ghs_[A-Za-z0-9_]{36,}/},{name:"github_fine_grained",pattern:/github_pat_[A-Za-z0-9_]{22,}/},{name:"openai_api_key",pattern:/sk-[a-zA-Z0-9]{20,}(?![a-zA-Z0-9_])/},{name:"anthropic_api_key",pattern:/sk-ant-[a-zA-Z0-9\-_]{20,}/},{name:"private_key",pattern:/-----BEGIN (?:RSA |EC |DSA |OPENSSH |PGP )?PRIVATE KEY-----/},{name:"sendgrid_api_key",pattern:/SG\.[a-zA-Z0-9_-]{22,}\.[a-zA-Z0-9_-]{22,}/},{name:"twilio_auth_token",pattern:/TWILIO_AUTH_TOKEN["'=:\s]+[a-f0-9]{32}/},{name:"generic_secret_key",pattern:/[A-Z_]{2,}_SECRET_KEY["'=:\s]+[^\s"']{8,}/},{name:"generic_secret",pattern:/[A-Z_]{2,}_SECRET["'=:\s]+[^\s"']{8,}/},{name:"generic_password",pattern:/[A-Z_]{2,}_PASSWORD["'=:\s]+[^\s"']{6,}/},{name:"generic_private_key_var",pattern:/[A-Z_]{2,}_PRIVATE_KEY["'=:\s]+[^\s"']{8,}/}],R=[],ce=0,se=false;function kt(e){let t=e.slice(0,80);return t.length<=6?"***":t.slice(0,6)+"***"}function _t(e,t,n,r){if(R.some(c=>c.rule===e&&c.source===t))return;let i={rule:e,source:t,hint:kt(n),timestamp:Date.now()};r&&(i.location=r),R.push(i);}function z(e,t,n,r){for(let{name:o,pattern:i}of n){let c=i.exec(e);c&&_t(o,t,c[0],r);}}function St(e){try{let t=window;if(t.__NEXT_DATA__){let n=JSON.stringify(t.__NEXT_DATA__);z(n,"hydration",e,"__NEXT_DATA__");}if(t.__NUXT__){let n=JSON.stringify(t.__NUXT__);z(n,"hydration",e,"__NUXT__");}}catch{}}function vt(e){try{document.querySelectorAll("script:not([src])").forEach((n,r)=>{let o=n.textContent;o&&o.length>0&&z(o,"scripts",e,`inline-script[${r}]`);});}catch{}}function Pt(e){try{document.querySelectorAll("meta[content]").forEach(n=>{let r=n.getAttribute("content"),o=n.getAttribute("name")||n.getAttribute("property")||"";r&&r.length>10&&z(r,"meta",e,o?`meta[${o}]`:void 0);});}catch{}}function At(e){try{document.querySelectorAll("[data-api-key], [data-secret], [data-token], [data-password]").forEach(n=>{let r=n.attributes;for(let o=0;o<r.length;o++){let i=r[o];i.name.startsWith("data-")&&i.value.length>10&&z(i.value,"dom",e,`${n.tagName.toLowerCase()}[${i.name}]`);}});}catch{}}function gn(e={}){if(se||!w()||(se=true,e.secretScan===false))return;let t=[...Et,...e.customPatterns??[]],n=e.scanTargets??["hydration","scripts","meta","dom"];setTimeout(()=>{ce=Date.now(),n.includes("hydration")&&St(t),n.includes("scripts")&&vt(t),n.includes("meta")&&Pt(t),n.includes("dom")&&At(t);let r=e.notify??"both";R.length>0&&(r==="console"||r==="both")&&console.warn(`[BlocFeed Security] Found ${R.length} potential secret(s) exposed in client code:`,R.map(o=>`${o.rule} (${o.source}${o.location?`: ${o.location}`:""})`));},100);}function hn(){return {findings:[...R],scannedAt:ce}}function wn(){R=[],ce=0,se=false;}
2
+ exports.a=w;exports.b=G;exports.c=be;exports.d=Se;exports.e=ve;exports.f=re;exports.g=Pe;exports.h=Ht;exports.i=qt;exports.j=an;exports.k=ln;exports.l=un;exports.m=dn;exports.n=fn;exports.o=gn;exports.p=hn;exports.q=wn;
@@ -85,6 +85,13 @@ interface DiagnosticsConfig {
85
85
  network?: boolean;
86
86
  /** Max network entries to retain. Default: 15 */
87
87
  networkLimit?: number;
88
+ /**
89
+ * URL patterns to exclude from network capture.
90
+ * Each entry is matched as a substring against the request URL.
91
+ * Common analytics/tracking domains are excluded by default.
92
+ * Set to `[]` to disable the built-in blocklist and capture everything.
93
+ */
94
+ ignoreUrls?: string[];
88
95
  }
89
96
  type SecurityScanTarget = "hydration" | "scripts" | "meta" | "dom";
90
97
  interface SecurityConfig {
@@ -85,6 +85,13 @@ interface DiagnosticsConfig {
85
85
  network?: boolean;
86
86
  /** Max network entries to retain. Default: 15 */
87
87
  networkLimit?: number;
88
+ /**
89
+ * URL patterns to exclude from network capture.
90
+ * Each entry is matched as a substring against the request URL.
91
+ * Common analytics/tracking domains are excluded by default.
92
+ * Set to `[]` to disable the built-in blocklist and capture everything.
93
+ */
94
+ ignoreUrls?: string[];
88
95
  }
89
96
  type SecurityScanTarget = "hydration" | "scripts" | "meta" | "dom";
90
97
  interface SecurityConfig {
package/dist/engine.cjs CHANGED
@@ -1 +1 @@
1
- 'use strict';var chunkJVY6JTXP_cjs=require('./chunk-JVY6JTXP.cjs');function c(o){if(o?.aborted)throw new Error("Aborted")}async function P(o){return await new Promise((t,e)=>{let r=new Image;r.onload=()=>t({width:r.naturalWidth,height:r.naturalHeight}),r.onerror=()=>e(new Error("Failed to load generated screenshot")),r.src=o;})}async function l(o,t){let{width:e,height:r}=await P(o);return {dataUrl:o,mime:t,width:e,height:r}}function B(o){return {async captureElement(t,e){if(!chunkJVY6JTXP_cjs.a())throw new Error("captureElement can only run in the browser");c(e.signal);let r={scale:e.pixelRatio},n=e.mime==="image/jpeg"?await o.domToJpeg(t,{...r,quality:e.quality??.92}):await o.domToPng(t,r);return c(e.signal),await l(n,e.mime)},async captureFullPage(t){if(!chunkJVY6JTXP_cjs.a())throw new Error("captureFullPage can only run in the browser");c(t.signal);let e=document.documentElement,r=Math.max(e.scrollWidth,e.clientWidth),n=Math.max(e.scrollHeight,e.clientHeight),a=Math.min(1,t.maxDimension/Math.max(r,n)),s={width:Math.max(1,Math.round(r*a)),height:Math.max(1,Math.round(n*a)),scale:t.pixelRatio},i=t.mime==="image/jpeg"?await o.domToJpeg(e,{...s,quality:t.quality??.92}):await o.domToPng(e,s);return c(t.signal),await l(i,t.mime)}}}function T(o){let[t,e]=o.split(",",2);if(!t||!e)throw new Error("Invalid data URL");let n=/data:(.*?);base64/.exec(t)?.[1]||"application/octet-stream",a=atob(e),s=new Uint8Array(a.length);for(let i=0;i<a.length;i+=1)s[i]=a.charCodeAt(i);return new Blob([s],{type:n})}Object.defineProperty(exports,"clearDiagnostics",{enumerable:true,get:function(){return chunkJVY6JTXP_cjs.n}});Object.defineProperty(exports,"clearQueue",{enumerable:true,get:function(){return chunkJVY6JTXP_cjs.h}});Object.defineProperty(exports,"clearSecurityFindings",{enumerable:true,get:function(){return chunkJVY6JTXP_cjs.q}});Object.defineProperty(exports,"collectMetadata",{enumerable:true,get:function(){return chunkJVY6JTXP_cjs.e}});Object.defineProperty(exports,"createBlocFeedController",{enumerable:true,get:function(){return chunkJVY6JTXP_cjs.j}});Object.defineProperty(exports,"createHtmlToImageAdapter",{enumerable:true,get:function(){return chunkJVY6JTXP_cjs.c}});Object.defineProperty(exports,"dequeueAll",{enumerable:true,get:function(){return chunkJVY6JTXP_cjs.g}});Object.defineProperty(exports,"drainDiagnostics",{enumerable:true,get:function(){return chunkJVY6JTXP_cjs.m}});Object.defineProperty(exports,"enqueue",{enumerable:true,get:function(){return chunkJVY6JTXP_cjs.f}});Object.defineProperty(exports,"getQueueSize",{enumerable:true,get:function(){return chunkJVY6JTXP_cjs.i}});Object.defineProperty(exports,"getSecurityFindings",{enumerable:true,get:function(){return chunkJVY6JTXP_cjs.p}});Object.defineProperty(exports,"installDiagnostics",{enumerable:true,get:function(){return chunkJVY6JTXP_cjs.k}});Object.defineProperty(exports,"runCapture",{enumerable:true,get:function(){return chunkJVY6JTXP_cjs.d}});Object.defineProperty(exports,"runSecretScan",{enumerable:true,get:function(){return chunkJVY6JTXP_cjs.o}});Object.defineProperty(exports,"uninstallDiagnostics",{enumerable:true,get:function(){return chunkJVY6JTXP_cjs.l}});exports.createModernScreenshotAdapter=B;exports.dataUrlToBlob=T;
1
+ 'use strict';var chunkFOZ6KYBJ_cjs=require('./chunk-FOZ6KYBJ.cjs');function c(o){if(o?.aborted)throw new Error("Aborted")}async function P(o){return await new Promise((t,e)=>{let r=new Image;r.onload=()=>t({width:r.naturalWidth,height:r.naturalHeight}),r.onerror=()=>e(new Error("Failed to load generated screenshot")),r.src=o;})}async function l(o,t){let{width:e,height:r}=await P(o);return {dataUrl:o,mime:t,width:e,height:r}}function B(o){return {async captureElement(t,e){if(!chunkFOZ6KYBJ_cjs.a())throw new Error("captureElement can only run in the browser");c(e.signal);let r={scale:e.pixelRatio},n=e.mime==="image/jpeg"?await o.domToJpeg(t,{...r,quality:e.quality??.92}):await o.domToPng(t,r);return c(e.signal),await l(n,e.mime)},async captureFullPage(t){if(!chunkFOZ6KYBJ_cjs.a())throw new Error("captureFullPage can only run in the browser");c(t.signal);let e=document.documentElement,r=Math.max(e.scrollWidth,e.clientWidth),n=Math.max(e.scrollHeight,e.clientHeight),a=Math.min(1,t.maxDimension/Math.max(r,n)),s={width:Math.max(1,Math.round(r*a)),height:Math.max(1,Math.round(n*a)),scale:t.pixelRatio},i=t.mime==="image/jpeg"?await o.domToJpeg(e,{...s,quality:t.quality??.92}):await o.domToPng(e,s);return c(t.signal),await l(i,t.mime)}}}function T(o){let[t,e]=o.split(",",2);if(!t||!e)throw new Error("Invalid data URL");let n=/data:(.*?);base64/.exec(t)?.[1]||"application/octet-stream",a=atob(e),s=new Uint8Array(a.length);for(let i=0;i<a.length;i+=1)s[i]=a.charCodeAt(i);return new Blob([s],{type:n})}Object.defineProperty(exports,"clearDiagnostics",{enumerable:true,get:function(){return chunkFOZ6KYBJ_cjs.n}});Object.defineProperty(exports,"clearQueue",{enumerable:true,get:function(){return chunkFOZ6KYBJ_cjs.h}});Object.defineProperty(exports,"clearSecurityFindings",{enumerable:true,get:function(){return chunkFOZ6KYBJ_cjs.q}});Object.defineProperty(exports,"collectMetadata",{enumerable:true,get:function(){return chunkFOZ6KYBJ_cjs.e}});Object.defineProperty(exports,"createBlocFeedController",{enumerable:true,get:function(){return chunkFOZ6KYBJ_cjs.j}});Object.defineProperty(exports,"createHtmlToImageAdapter",{enumerable:true,get:function(){return chunkFOZ6KYBJ_cjs.c}});Object.defineProperty(exports,"dequeueAll",{enumerable:true,get:function(){return chunkFOZ6KYBJ_cjs.g}});Object.defineProperty(exports,"drainDiagnostics",{enumerable:true,get:function(){return chunkFOZ6KYBJ_cjs.m}});Object.defineProperty(exports,"enqueue",{enumerable:true,get:function(){return chunkFOZ6KYBJ_cjs.f}});Object.defineProperty(exports,"getQueueSize",{enumerable:true,get:function(){return chunkFOZ6KYBJ_cjs.i}});Object.defineProperty(exports,"getSecurityFindings",{enumerable:true,get:function(){return chunkFOZ6KYBJ_cjs.p}});Object.defineProperty(exports,"installDiagnostics",{enumerable:true,get:function(){return chunkFOZ6KYBJ_cjs.k}});Object.defineProperty(exports,"runCapture",{enumerable:true,get:function(){return chunkFOZ6KYBJ_cjs.d}});Object.defineProperty(exports,"runSecretScan",{enumerable:true,get:function(){return chunkFOZ6KYBJ_cjs.o}});Object.defineProperty(exports,"uninstallDiagnostics",{enumerable:true,get:function(){return chunkFOZ6KYBJ_cjs.l}});exports.createModernScreenshotAdapter=B;exports.dataUrlToBlob=T;
package/dist/engine.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { n as ScreenshotAdapter, C as CaptureConfig, h as CaptureResult, l as MetadataConfig, m as MetadataContext, f as BlocFeedUser, k as FeedbackPayload, t as SecuritySnapshot, r as SecurityConfig } from './controller-BPsU7cuY.cjs';
2
- export { B as BlocFeedConfig, c as BlocFeedController, d as BlocFeedError, a as BlocFeedHandle, b as BlocFeedState, e as BlocFeedStrings, i as ConsoleEntry, D as DiagnosticsConfig, E as ElementDescriptor, j as FeedbackApiResponse, F as FeedbackCategory, H as HoverListener, I as ImageAsset, N as NetworkEntry, R as Rect, o as ScreenshotAdapterOptions, p as ScreenshotIntent, q as ScreenshotMime, s as SecurityFinding, u as SessionPhase, y as StateListener, S as SubmitResult, T as ThemeConfig, v as TransportConfig, x as TriggerStyle, W as WidgetPosition, z as createBlocFeedController } from './controller-BPsU7cuY.cjs';
1
+ import { n as ScreenshotAdapter, C as CaptureConfig, h as CaptureResult, l as MetadataConfig, m as MetadataContext, f as BlocFeedUser, k as FeedbackPayload, t as SecuritySnapshot, r as SecurityConfig } from './controller-D0bplVji.cjs';
2
+ export { B as BlocFeedConfig, c as BlocFeedController, d as BlocFeedError, a as BlocFeedHandle, b as BlocFeedState, e as BlocFeedStrings, i as ConsoleEntry, D as DiagnosticsConfig, E as ElementDescriptor, j as FeedbackApiResponse, F as FeedbackCategory, H as HoverListener, I as ImageAsset, N as NetworkEntry, R as Rect, o as ScreenshotAdapterOptions, p as ScreenshotIntent, q as ScreenshotMime, s as SecurityFinding, u as SessionPhase, y as StateListener, S as SubmitResult, T as ThemeConfig, v as TransportConfig, x as TriggerStyle, W as WidgetPosition, z as createBlocFeedController } from './controller-D0bplVji.cjs';
3
3
 
4
4
  declare function createHtmlToImageAdapter(): ScreenshotAdapter;
5
5
 
@@ -87,6 +87,13 @@ interface DiagnosticsConfig {
87
87
  network?: boolean;
88
88
  /** Max network entries to retain. Default: 15 */
89
89
  networkLimit?: number;
90
+ /**
91
+ * URL patterns to exclude from network capture.
92
+ * Each entry is matched as a substring against the request URL.
93
+ * Common analytics/tracking domains are excluded by default.
94
+ * Set to `[]` to disable the built-in blocklist and capture everything.
95
+ */
96
+ ignoreUrls?: string[];
90
97
  }
91
98
  interface DiagnosticsSnapshot {
92
99
  consoleLogs: ConsoleEntry[];
package/dist/engine.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { n as ScreenshotAdapter, C as CaptureConfig, h as CaptureResult, l as MetadataConfig, m as MetadataContext, f as BlocFeedUser, k as FeedbackPayload, t as SecuritySnapshot, r as SecurityConfig } from './controller-BPsU7cuY.js';
2
- export { B as BlocFeedConfig, c as BlocFeedController, d as BlocFeedError, a as BlocFeedHandle, b as BlocFeedState, e as BlocFeedStrings, i as ConsoleEntry, D as DiagnosticsConfig, E as ElementDescriptor, j as FeedbackApiResponse, F as FeedbackCategory, H as HoverListener, I as ImageAsset, N as NetworkEntry, R as Rect, o as ScreenshotAdapterOptions, p as ScreenshotIntent, q as ScreenshotMime, s as SecurityFinding, u as SessionPhase, y as StateListener, S as SubmitResult, T as ThemeConfig, v as TransportConfig, x as TriggerStyle, W as WidgetPosition, z as createBlocFeedController } from './controller-BPsU7cuY.js';
1
+ import { n as ScreenshotAdapter, C as CaptureConfig, h as CaptureResult, l as MetadataConfig, m as MetadataContext, f as BlocFeedUser, k as FeedbackPayload, t as SecuritySnapshot, r as SecurityConfig } from './controller-D0bplVji.js';
2
+ export { B as BlocFeedConfig, c as BlocFeedController, d as BlocFeedError, a as BlocFeedHandle, b as BlocFeedState, e as BlocFeedStrings, i as ConsoleEntry, D as DiagnosticsConfig, E as ElementDescriptor, j as FeedbackApiResponse, F as FeedbackCategory, H as HoverListener, I as ImageAsset, N as NetworkEntry, R as Rect, o as ScreenshotAdapterOptions, p as ScreenshotIntent, q as ScreenshotMime, s as SecurityFinding, u as SessionPhase, y as StateListener, S as SubmitResult, T as ThemeConfig, v as TransportConfig, x as TriggerStyle, W as WidgetPosition, z as createBlocFeedController } from './controller-D0bplVji.js';
3
3
 
4
4
  declare function createHtmlToImageAdapter(): ScreenshotAdapter;
5
5
 
@@ -87,6 +87,13 @@ interface DiagnosticsConfig {
87
87
  network?: boolean;
88
88
  /** Max network entries to retain. Default: 15 */
89
89
  networkLimit?: number;
90
+ /**
91
+ * URL patterns to exclude from network capture.
92
+ * Each entry is matched as a substring against the request URL.
93
+ * Common analytics/tracking domains are excluded by default.
94
+ * Set to `[]` to disable the built-in blocklist and capture everything.
95
+ */
96
+ ignoreUrls?: string[];
90
97
  }
91
98
  interface DiagnosticsSnapshot {
92
99
  consoleLogs: ConsoleEntry[];
package/dist/engine.js CHANGED
@@ -1 +1 @@
1
- import {a}from'./chunk-LAK7UUTC.js';export{n as clearDiagnostics,h as clearQueue,q as clearSecurityFindings,e as collectMetadata,j as createBlocFeedController,c as createHtmlToImageAdapter,g as dequeueAll,m as drainDiagnostics,f as enqueue,i as getQueueSize,p as getSecurityFindings,k as installDiagnostics,d as runCapture,o as runSecretScan,l as uninstallDiagnostics}from'./chunk-LAK7UUTC.js';function c(o){if(o?.aborted)throw new Error("Aborted")}async function P(o){return await new Promise((t,e)=>{let r=new Image;r.onload=()=>t({width:r.naturalWidth,height:r.naturalHeight}),r.onerror=()=>e(new Error("Failed to load generated screenshot")),r.src=o;})}async function l(o,t){let{width:e,height:r}=await P(o);return {dataUrl:o,mime:t,width:e,height:r}}function B(o){return {async captureElement(t,e){if(!a())throw new Error("captureElement can only run in the browser");c(e.signal);let r={scale:e.pixelRatio},n=e.mime==="image/jpeg"?await o.domToJpeg(t,{...r,quality:e.quality??.92}):await o.domToPng(t,r);return c(e.signal),await l(n,e.mime)},async captureFullPage(t){if(!a())throw new Error("captureFullPage can only run in the browser");c(t.signal);let e=document.documentElement,r=Math.max(e.scrollWidth,e.clientWidth),n=Math.max(e.scrollHeight,e.clientHeight),a$1=Math.min(1,t.maxDimension/Math.max(r,n)),s={width:Math.max(1,Math.round(r*a$1)),height:Math.max(1,Math.round(n*a$1)),scale:t.pixelRatio},i=t.mime==="image/jpeg"?await o.domToJpeg(e,{...s,quality:t.quality??.92}):await o.domToPng(e,s);return c(t.signal),await l(i,t.mime)}}}function T(o){let[t,e]=o.split(",",2);if(!t||!e)throw new Error("Invalid data URL");let n=/data:(.*?);base64/.exec(t)?.[1]||"application/octet-stream",a=atob(e),s=new Uint8Array(a.length);for(let i=0;i<a.length;i+=1)s[i]=a.charCodeAt(i);return new Blob([s],{type:n})}export{B as createModernScreenshotAdapter,T as dataUrlToBlob};
1
+ import {a}from'./chunk-2BPYL6WQ.js';export{n as clearDiagnostics,h as clearQueue,q as clearSecurityFindings,e as collectMetadata,j as createBlocFeedController,c as createHtmlToImageAdapter,g as dequeueAll,m as drainDiagnostics,f as enqueue,i as getQueueSize,p as getSecurityFindings,k as installDiagnostics,d as runCapture,o as runSecretScan,l as uninstallDiagnostics}from'./chunk-2BPYL6WQ.js';function c(o){if(o?.aborted)throw new Error("Aborted")}async function P(o){return await new Promise((t,e)=>{let r=new Image;r.onload=()=>t({width:r.naturalWidth,height:r.naturalHeight}),r.onerror=()=>e(new Error("Failed to load generated screenshot")),r.src=o;})}async function l(o,t){let{width:e,height:r}=await P(o);return {dataUrl:o,mime:t,width:e,height:r}}function B(o){return {async captureElement(t,e){if(!a())throw new Error("captureElement can only run in the browser");c(e.signal);let r={scale:e.pixelRatio},n=e.mime==="image/jpeg"?await o.domToJpeg(t,{...r,quality:e.quality??.92}):await o.domToPng(t,r);return c(e.signal),await l(n,e.mime)},async captureFullPage(t){if(!a())throw new Error("captureFullPage can only run in the browser");c(t.signal);let e=document.documentElement,r=Math.max(e.scrollWidth,e.clientWidth),n=Math.max(e.scrollHeight,e.clientHeight),a$1=Math.min(1,t.maxDimension/Math.max(r,n)),s={width:Math.max(1,Math.round(r*a$1)),height:Math.max(1,Math.round(n*a$1)),scale:t.pixelRatio},i=t.mime==="image/jpeg"?await o.domToJpeg(e,{...s,quality:t.quality??.92}):await o.domToPng(e,s);return c(t.signal),await l(i,t.mime)}}}function T(o){let[t,e]=o.split(",",2);if(!t||!e)throw new Error("Invalid data URL");let n=/data:(.*?);base64/.exec(t)?.[1]||"application/octet-stream",a=atob(e),s=new Uint8Array(a.length);for(let i=0;i<a.length;i+=1)s[i]=a.charCodeAt(i);return new Blob([s],{type:n})}export{B as createModernScreenshotAdapter,T as dataUrlToBlob};
package/dist/main.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- 'use strict';var chunkJVY6JTXP_cjs=require('./chunk-JVY6JTXP.cjs'),react=require('react'),jsxRuntime=require('react/jsx-runtime'),reactDom=require('react-dom'),framerMotion=require('framer-motion');var U=react.createContext(null);function ee(e){let t=react.useMemo(()=>chunkJVY6JTXP_cjs.j({...e.config??{},blocfeed_id:e.blocfeed_id}),[]),[n,o]=react.useState(()=>t.getState());return react.useEffect(()=>t.subscribe(o),[t]),react.useEffect(()=>t.setConfig({...e.config??{},blocfeed_id:e.blocfeed_id}),[t,e.config,e.blocfeed_id]),react.useEffect(()=>()=>t.destroy(),[t]),jsxRuntime.jsx(U.Provider,{value:{controller:t,state:n},children:e.children})}var we="blocfeed-styles-v1",xt=`
2
+ 'use strict';var chunkFOZ6KYBJ_cjs=require('./chunk-FOZ6KYBJ.cjs'),react=require('react'),jsxRuntime=require('react/jsx-runtime'),reactDom=require('react-dom'),framerMotion=require('framer-motion');var U=react.createContext(null);function ee(e){let t=react.useMemo(()=>chunkFOZ6KYBJ_cjs.j({...e.config??{},blocfeed_id:e.blocfeed_id}),[]),[n,o]=react.useState(()=>t.getState());return react.useEffect(()=>t.subscribe(o),[t]),react.useEffect(()=>t.setConfig({...e.config??{},blocfeed_id:e.blocfeed_id}),[t,e.config,e.blocfeed_id]),react.useEffect(()=>()=>t.destroy(),[t]),jsxRuntime.jsx(U.Provider,{value:{controller:t,state:n},children:e.children})}var we="blocfeed-styles-v1",xt=`
3
3
  :where([data-blocfeed-ui-root]),
4
4
  :where([data-blocfeed-ui-root]) * {
5
5
  box-sizing: border-box;
@@ -635,5 +635,5 @@
635
635
  animation: none;
636
636
  }
637
637
  }
638
- `;function ve(){if(!chunkJVY6JTXP_cjs.a()||document.getElementById(we))return;let e=document.createElement("style");e.id=we,e.textContent=xt,document.head.appendChild(e);}var ke={triggerLabel:"Feedback",panelTitle:"Feedback",hintText:"Click an element to attach your feedback. Press Esc to cancel.",cancelButton:"Cancel",rePickButton:"Re-pick",closeButton:"Close",textareaPlaceholder:"What's happening? What did you expect?",screenshotElement:"Screenshot element",screenshotFullPage:"Full page",capturingText:"Capturing screenshots\u2026",submittingText:"Submitting\u2026",successText:"Sent. Thank you!",toastText:"Feedback sent",sendButton:"Send",categoryBug:"Bug",categoryFeature:"Feature",categoryUx:"UX",categoryGeneral:"General"};function Te(e){return e?{...ke,...e}:ke}function te(){let e=react.useContext(U);if(!e)throw new Error("useBlocFeed must be used within a <BlocFeedProvider />");return {state:e.state,controller:e.controller,start:e.controller.start,stop:e.controller.stop,clearSelection:e.controller.clearSelection,submit:e.controller.submit}}function y(e){switch(e){case "bottom-left":return "bf-trigger bf-trigger-bl";case "top-right":return "bf-trigger bf-trigger-tr";case "top-left":return "bf-trigger bf-trigger-tl";default:return "bf-trigger"}}function b({size:e=14}){return jsxRuntime.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Se({size:e=14}){return jsxRuntime.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:jsxRuntime.jsx("path",{d:"M21 11.5a8.38 8.38 0 01-.9 3.8 8.5 8.5 0 01-7.6 4.7 8.38 8.38 0 01-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 01-.9-3.8 8.5 8.5 0 014.7-7.6 8.38 8.38 0 013.8-.9h.5a8.48 8.48 0 018 8v.5z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Pe({size:e=16}){return jsxRuntime.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[jsxRuntime.jsx("path",{d:"M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M22 6l-10 7L2 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ce({position:e,onClick:t,isVisible:n,label:o,queueCount:r,showSuccess:c}){return n?jsxRuntime.jsxs("button",{className:y(e),type:"button",onClick:t,"aria-label":o,children:[c?jsxRuntime.jsx("span",{style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsxRuntime.jsx(b,{size:14})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"bf-dot","aria-hidden":"true"}),o]}),r>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${r} queued`,children:r})]}):null}function g(){let[e,t]=react.useState(()=>typeof window>"u"?false:window.matchMedia("(prefers-reduced-motion: reduce)").matches);return react.useEffect(()=>{let n=window.matchMedia("(prefers-reduced-motion: reduce)"),o=r=>t(r.matches);return n.addEventListener("change",o),()=>n.removeEventListener("change",o)},[]),e}var Pt={duration:.18,ease:"easeOut"},Et={duration:0};function Be({position:e,onClick:t,isVisible:n,label:o,queueCount:r,showSuccess:c}){let[i,l]=react.useState(false),a=g(),s=a?Et:Pt;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:n&&jsxRuntime.jsx(framerMotion.motion.button,{className:y(e),type:"button",onClick:t,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":o,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:s,whileTap:{scale:.92},style:{overflow:"hidden"},children:c?jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:s,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsxRuntime.jsx(b,{size:14})},"success"):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.span,{className:"bf-dot","aria-hidden":"true",animate:a?{}:{scale:i?1:[1,1.2,1],boxShadow:i?"0 0 0 4px rgba(99, 102, 241, 0.18)":["0 0 0 4px rgba(99, 102, 241, 0.18)","0 0 0 8px rgba(99, 102, 241, 0.28)","0 0 0 4px rgba(99, 102, 241, 0.18)"]},transition:i||a?s:{duration:2,repeat:1/0,ease:"easeInOut"}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:i&&jsxRuntime.jsx(framerMotion.motion.span,{initial:{opacity:0,x:a?0:-6},animate:{opacity:1,x:0},exit:{opacity:0,x:a?0:-6},transition:s,style:{whiteSpace:"nowrap"},children:o},"label")}),r>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${r} queued`,children:r})]})},"dot")})}var Nt={duration:.18,ease:"easeOut"},Re={duration:0};function Le({position:e,onClick:t,isVisible:n,label:o,queueCount:r,showSuccess:c}){let[i,l]=react.useState(false),a=g(),s=a?Re:Nt;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:n&&jsxRuntime.jsxs(framerMotion.motion.div,{className:y(e),initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{y:8,opacity:0},transition:s,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),style:{background:"transparent",border:"none",boxShadow:"none",padding:0},children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:i&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:a?0:4},animate:{opacity:1,y:0},exit:{opacity:0,y:a?0:4},transition:s,style:{position:"absolute",bottom:"calc(100% + 8px)",left:"50%",transform:"translateX(-50%)",padding:"6px 12px",borderRadius:"8px",background:"var(--bf-panel-bg)",border:"1px solid var(--bf-border)",boxShadow:"var(--bf-shadow)",whiteSpace:"nowrap",fontSize:"12px",color:"var(--bf-panel-fg)",pointerEvents:"none"},children:o},"tooltip")}),jsxRuntime.jsxs(framerMotion.motion.button,{type:"button",onClick:t,"aria-label":o,style:{position:"relative",display:"flex",alignItems:"center",justifyContent:"center",width:"40px",height:"40px",borderRadius:"50%",border:"1px solid var(--bf-border)",background:"var(--bf-panel-bg)",color:"var(--bf-panel-fg)",boxShadow:"var(--bf-shadow)",cursor:"pointer",padding:0},animate:a?{}:{y:[0,-3,0]},transition:a?Re:{y:{duration:3,repeat:1/0,ease:"easeInOut"}},whileHover:{scale:1.1,borderColor:"var(--bf-accent)"},whileTap:{scale:.9},children:[c?jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:s,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsxRuntime.jsx(b,{size:16})},"success"):jsxRuntime.jsx(Se,{size:16}),r>0&&jsxRuntime.jsx("span",{className:"bf-badge bf-badge-float","aria-label":`${r} queued`,children:r})]})]},"bubble")})}var Lt={duration:.2,ease:"easeOut"},zt={duration:0};function Ae(e){return e==="bottom-left"||e==="top-left"}function At(e){return `bf-trigger-edge ${Ae(e)?"bf-trigger-edge-left":"bf-trigger-edge-right"}`}function Ie({position:e,onClick:t,isVisible:n,label:o,queueCount:r,showSuccess:c}){let[i,l]=react.useState(false),a=Ae(e),s=g(),m=s?zt:Lt;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:n&&jsxRuntime.jsx(framerMotion.motion.button,{className:At(e),type:"button",onClick:t,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":o,initial:{opacity:0,width:0},animate:{opacity:1,width:i?140:22,height:i?40:90},exit:{width:0,opacity:0},transition:m,whileTap:{scale:.97},style:{top:"50%",translateY:"-50%"},children:c?jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:m,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsxRuntime.jsx(b,{size:14})},"success"):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.span,{animate:{rotate:s||i?0:a?-90:90,opacity:i?1:.6},transition:m,style:{display:"flex",alignItems:"center",gap:"8px",whiteSpace:"nowrap",fontSize:"12px",letterSpacing:"0.5px",textTransform:"uppercase"},children:[i&&jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:{duration:.12},style:{width:"6px",height:"6px",borderRadius:"50%",background:"var(--bf-accent)",flexShrink:0}}),o]}),jsxRuntime.jsx(framerMotion.motion.span,{"aria-hidden":"true",animate:{opacity:i?1:0},transition:{duration:.12},style:{position:"absolute",top:0,bottom:0,[a?"left":"right"]:0,width:"2px",background:"var(--bf-accent)"}}),r>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${r} queued`,children:r})]})},"edge-tab")})}var _t={duration:.18,ease:"easeOut"},Ht={duration:0};function _e({delay:e,hovered:t,reduced:n}){return n?null:jsxRuntime.jsx(framerMotion.motion.span,{"aria-hidden":"true",style:{position:"absolute",width:"10px",height:"10px",borderRadius:"50%",border:"2px solid var(--bf-accent)",pointerEvents:"none"},animate:t?{scale:1,opacity:0}:{scale:[1,1.8],opacity:[.5,0]},transition:t?{duration:.15}:{duration:2,repeat:1/0,delay:e,ease:"easeOut"}})}function Oe({position:e,onClick:t,isVisible:n,label:o,queueCount:r,showSuccess:c}){let[i,l]=react.useState(false),a=g(),s=a?Ht:_t;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:n&&jsxRuntime.jsx(framerMotion.motion.button,{className:y(e),type:"button",onClick:t,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":o,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:s,whileTap:{scale:.92},style:{overflow:"hidden"},children:c?jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:s,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsxRuntime.jsx(b,{size:14})},"success"):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("span",{style:{position:"relative",display:"flex",alignItems:"center",justifyContent:"center",width:"10px",height:"10px",flexShrink:0},children:[jsxRuntime.jsx(_e,{delay:0,hovered:i,reduced:a}),jsxRuntime.jsx(_e,{delay:.7,hovered:i,reduced:a}),jsxRuntime.jsx(framerMotion.motion.span,{className:"bf-dot","aria-hidden":"true",style:{position:"relative",zIndex:1}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:i&&jsxRuntime.jsx(framerMotion.motion.span,{initial:{opacity:0,x:a?0:-6},animate:{opacity:1,x:0},exit:{opacity:0,x:a?0:-6},transition:s,style:{whiteSpace:"nowrap"},children:o},"label")}),r>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${r} queued`,children:r})]})},"pulse-ring")})}var $t={duration:.18,ease:"easeOut"},Ut={duration:0};function Xt(e){switch(e){case "bottom-left":return "bf-trigger-minimal bf-trigger-bl";case "top-right":return "bf-trigger-minimal bf-trigger-tr";case "top-left":return "bf-trigger-minimal bf-trigger-tl";default:return "bf-trigger-minimal"}}function $e({position:e,onClick:t,isVisible:n,label:o,queueCount:r,showSuccess:c}){let[i,l]=react.useState(false),a=g(),s=a?Ut:$t;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:n&&jsxRuntime.jsxs(framerMotion.motion.button,{className:Xt(e),type:"button",onClick:t,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":o,initial:{opacity:0,y:a?0:5},animate:{opacity:i?1:.65,y:0},exit:{opacity:0,y:a?0:5},transition:s,whileTap:{scale:.95},children:[c?jsxRuntime.jsx("span",{style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsxRuntime.jsx(b,{size:14})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{children:o}),r>0&&jsxRuntime.jsx("span",{className:"bf-badge",style:{marginLeft:"4px"},"aria-label":`${r} queued`,children:r})]}),!a&&jsxRuntime.jsx(framerMotion.motion.span,{"aria-hidden":"true",style:{position:"absolute",bottom:4,left:4,right:4,height:"2px",background:"var(--bf-accent)",borderRadius:"1px",transformOrigin:"left"},initial:false,animate:{scaleX:i?1:0},transition:s})]},"minimal")})}var Qt={duration:.18,ease:"easeOut"},jt={duration:0};function Xe({position:e,onClick:t,isVisible:n,label:o,queueCount:r,showSuccess:c}){let[i,l]=react.useState(false),a=g(),s=a?jt:Qt;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:n&&jsxRuntime.jsx(framerMotion.motion.button,{className:y(e),type:"button",onClick:t,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":o,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:s,whileTap:{scale:.9},style:{overflow:"hidden"},children:c?jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:s,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsxRuntime.jsx(b,{size:14})},"success"):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.span,{style:{display:"inline-flex",flexShrink:0},animate:a?{}:i?{scale:1.2,rotate:0}:{rotate:[-5,5,-5]},transition:i||a?s:{duration:3,repeat:1/0,ease:"easeInOut"},children:jsxRuntime.jsx(Pe,{size:16})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:i&&jsxRuntime.jsx(framerMotion.motion.span,{initial:{opacity:0,x:a?0:-8},animate:{opacity:1,x:0},exit:{opacity:0,x:a?0:-8},transition:s,style:{whiteSpace:"nowrap"},children:o},"label")}),r>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${r} queued`,children:r})]})},"icon-pop")})}var Zt={duration:.18,ease:"easeOut"},eo={duration:0};function Qe({position:e,onClick:t,isVisible:n,label:o,queueCount:r,showSuccess:c}){let[i,l]=react.useState(false),a=g(),s=a?eo:Zt;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:n&&jsxRuntime.jsx(framerMotion.motion.button,{className:y(e),type:"button",onClick:t,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":o,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:s,whileTap:{scale:.92},style:{overflow:"hidden"},children:c?jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:s,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsxRuntime.jsx(b,{size:14})},"success"):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("span",{style:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:"10px",height:"10px",flexShrink:0},children:[jsxRuntime.jsx(framerMotion.motion.span,{"aria-hidden":"true",style:{width:"10px",height:"10px",borderRadius:"50%",background:"var(--bf-accent)",position:"relative",zIndex:1},animate:a?{}:{opacity:i?1:[.5,1,.5],boxShadow:i?"0 0 8px 2px var(--bf-accent)":["0 0 4px 1px var(--bf-accent)","0 0 12px 4px var(--bf-accent)","0 0 4px 1px var(--bf-accent)"]},transition:i||a?s:{duration:2,repeat:1/0,ease:"easeInOut"}}),!i&&!a&&jsxRuntime.jsx(framerMotion.motion.span,{"aria-hidden":"true",style:{position:"absolute",width:"18px",height:"2px",background:"linear-gradient(90deg, var(--bf-accent), transparent)",transformOrigin:"left center",left:"5px",top:"4px"},animate:{rotate:[0,360]},transition:{duration:4,repeat:1/0,ease:"linear"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:i&&jsxRuntime.jsx(framerMotion.motion.span,{initial:{opacity:0,x:a?0:-6},animate:{opacity:1,x:0},exit:{opacity:0,x:a?0:-6},transition:s,style:{whiteSpace:"nowrap"},children:o},"label")}),r>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${r} queued`,children:r})]})},"beacon")})}var io={duration:.18,ease:"easeOut"},no={duration:0};function Je({position:e,onClick:t,isVisible:n,label:o,queueCount:r,showSuccess:c}){let[i,l]=react.useState(false),[a,s]=react.useState(0),m=g(),M=m?no:io,p=react.useRef(null);react.useEffect(()=>{if(p.current&&(clearInterval(p.current),p.current=null),!n||i||m){s(i||m?o.length:0);return}let u=8,E=o.length*2+u*2,x=0;return p.current=setInterval(()=>{x=(x+1)%E,x<=o.length?s(x):x<=o.length+u?s(o.length):x<=o.length*2+u?s(o.length*2+u-x):s(0);},100),()=>{p.current&&(clearInterval(p.current),p.current=null);}},[n,i,m,o]);let T=o.slice(0,a);return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:n&&jsxRuntime.jsx(framerMotion.motion.button,{className:y(e),type:"button",onClick:t,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":o,initial:{opacity:0,y:m?0:5},animate:{opacity:1,y:0},exit:{opacity:0,y:m?0:5},transition:M,whileTap:{scale:.95},style:{minWidth:"44px"},children:c?jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:M,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsxRuntime.jsx(b,{size:14})},"success"):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"bf-dot","aria-hidden":"true"}),jsxRuntime.jsxs("span",{style:{whiteSpace:"nowrap",minWidth:"1ch"},children:[T,jsxRuntime.jsx("span",{className:"bf-cursor","aria-hidden":"true"})]}),r>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${r} queued`,children:r})]})},"typewriter")})}function Ze(e){switch(e){case "dot":return Be;case "bubble":return Le;case "edge-tab":return Ie;case "pulse-ring":return Oe;case "minimal":return $e;case "icon-pop":return Xe;case "beacon":return Qe;case "typewriter":return Je;default:return Ce}}function tt(e,t,n){return Math.max(t,Math.min(n,e))}function fo(e,t,n="bottom-right"){let r=window.innerWidth,c=window.innerHeight,i;i=tt(e.x,12,Math.max(12,r-t-12));let l=e.y+e.height+12,a=Math.max(12,e.y-240);return {top:l+240<=c?l:a,left:i}}function uo(e){let{rect:t}=e,n={left:`${t.x}px`,top:`${t.y}px`,width:`${Math.max(0,t.width)}px`,height:`${Math.max(0,t.height)}px`};return jsxRuntime.jsx("div",{className:"bf-highlight",style:n,"aria-hidden":"true"})}function bo(e){let t=react.useRef(null);return react.useEffect(()=>{if(!e||!t.current)return;t.current.querySelector(".bf-textarea")?.focus();let o=r=>{if(r.key!=="Tab"||!t.current)return;let c=t.current.querySelectorAll('button:not([disabled]), textarea:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])');if(c.length===0)return;let i=c[0],l=c[c.length-1];r.shiftKey&&document.activeElement===i?(r.preventDefault(),l.focus()):!r.shiftKey&&document.activeElement===l&&(r.preventDefault(),i.focus());};return document.addEventListener("keydown",o,{capture:true}),()=>document.removeEventListener("keydown",o,{capture:true})},[e]),t}function go(e,t){return e?typeof e=="function"?e(t):e.some(n=>n.endsWith("*")?t.startsWith(n.slice(0,-1)):t===n):true}function mo(e){let[t,n]=react.useState(()=>typeof window<"u"?window.location.pathname:"/");return react.useEffect(()=>{if(typeof window>"u")return;let o=()=>n(window.location.pathname);window.addEventListener("popstate",o);let r=history.pushState,c=history.replaceState;return history.pushState=function(...i){r.apply(this,i),o();},history.replaceState=function(...i){c.apply(this,i),o();},()=>{window.removeEventListener("popstate",o),history.pushState=r,history.replaceState=c;}},[]),go(e,t)}function ho(e){let[t,n]=react.useState(()=>!e||e==="dark"?"dark":e==="light"?"light":typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");return react.useEffect(()=>{if(e!=="auto"){n(e==="light"?"light":"dark");return}let o=window.matchMedia("(prefers-color-scheme: dark)"),r=c=>n(c.matches?"dark":"light");return n(o.matches?"dark":"light"),o.addEventListener("change",r),()=>o.removeEventListener("change",r)},[e]),t}var xo=["bug","feature","ux","general"],yo={bug:"categoryBug",feature:"categoryFeature",ux:"categoryUx",general:"categoryGeneral"};function wo(e){let{state:t,controller:n,start:o,stop:r,clearSelection:c,submit:i}=te(),l=e.config.ui?.position,a=Te(e.config.ui?.strings),s=e.config.ui?.branding!==false,[m,M]=react.useState(null),[p,T]=react.useState(""),[u,E]=react.useState(e.config.capture?.element??true),[x,re]=react.useState(e.config.capture?.fullPage??false),[rt,ae]=react.useState(null),[O,ie]=react.useState(void 0),ne=e.config.ui?.categories??xo,[at,it]=react.useState(false),[j,nt]=react.useState(0);react.useEffect(()=>{let d=window.setTimeout(()=>{let N=chunkJVY6JTXP_cjs.p();nt(N.findings.length);},500);return ()=>window.clearTimeout(d)},[]),react.useImperativeHandle(e.handleRef,()=>({open:o,close:r,submit:d=>i(d),get isOpen(){return t.phase!=="idle"}}),[o,r,i,t.phase]);let se=t.phase==="review"||t.phase==="capturing"||t.phase==="submitting"||t.phase==="error"||t.phase==="success",st=bo(se),[lt,ct]=react.useState(0);react.useEffect(()=>{t.phase==="idle"&&ct(chunkJVY6JTXP_cjs.i());},[t.phase]);let[dt,le]=react.useState(false),ce=react.useRef(t.phase);react.useEffect(()=>{if(ce.current==="success"&&t.phase==="idle"){le(true);let d=window.setTimeout(()=>le(false),1500);return ()=>window.clearTimeout(d)}ce.current=t.phase;},[t.phase]),react.useEffect(()=>{let d=e.config.ui?.shortcut;if(!d)return;let N=d.toLowerCase().split("+").map(P=>P.trim()),W=N[N.length-1]||"",L=new Set(N.slice(0,-1)),pe=P=>{let ut=/Mac|iPod|iPhone|iPad/.test(navigator.platform);if(L.has("mod")){if(ut?!P.metaKey:!P.ctrlKey)return}else if(L.has("ctrl")&&!P.ctrlKey||(L.has("meta")||L.has("cmd"))&&!P.metaKey)return;L.has("shift")&&!P.shiftKey||(L.has("alt")||L.has("option"))&&!P.altKey||P.key.toLowerCase()===W&&(P.preventDefault(),t.phase==="idle"?o():r());};return document.addEventListener("keydown",pe),()=>document.removeEventListener("keydown",pe)},[e.config.ui?.shortcut,t.phase,o,r]),react.useEffect(()=>n.subscribeHover(M),[n]),react.useEffect(()=>{let d=n.__unsafeGetSelectedElement();if(!d||t.phase==="idle"||t.phase==="picking"){ae(null);return}let N=()=>{ae(chunkJVY6JTXP_cjs.b(d.getBoundingClientRect()));};N();let W=()=>N();return window.addEventListener("scroll",W,{capture:true,passive:true}),window.addEventListener("resize",W,{passive:true}),()=>{window.removeEventListener("scroll",W,{capture:true}),window.removeEventListener("resize",W);}},[n,t.phase,t.selection?.selector]),react.useEffect(()=>{t.phase==="review"&&(T(""),E(e.config.capture?.element??true),re(e.config.capture?.fullPage??false),ie(void 0));},[t.phase,t.selection?.selector,e.config.capture?.element,e.config.capture?.fullPage]),react.useEffect(()=>{if(t.phase!=="success")return;let d=window.setTimeout(()=>r(),1200);return ()=>window.clearTimeout(d)},[t.phase,r]);let S=t.phase==="capturing"||t.phase==="submitting",B=t.phase==="picking"?m?.rect??null:rt??t.selection?.rect??null,V=react.useMemo(()=>B?fo(B,360,l):null,[B?.x,B?.y,B?.width,B?.height,l]),de=t.lastError?.message,q=react.useCallback(()=>{let d={capture:{element:u,fullPage:x}};O&&(d.category=O),i(p,d);},[i,p,u,x,O]),pt=react.useCallback(d=>{(d.metaKey||d.ctrlKey)&&d.key==="Enter"&&p.trim().length>0&&!S&&(d.preventDefault(),q());},[q,p,S]),ft=Ze(e.config.ui?.triggerStyle);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ft,{position:l,onClick:()=>o(),isVisible:t.phase==="idle",label:e.config.ui?.triggerLabel??a.triggerLabel,queueCount:lt,showSuccess:dt}),t.phase!=="idle"&&jsxRuntime.jsxs("div",{className:"bf-overlay",role:"presentation",children:[t.phase!=="picking"&&jsxRuntime.jsx("div",{className:"bf-blocker",role:"presentation",onClick:()=>r()}),B&&jsxRuntime.jsx(uo,{rect:B}),t.phase==="picking"&&jsxRuntime.jsxs("div",{className:"bf-hint",role:"status","aria-live":"polite",children:[jsxRuntime.jsx("p",{id:"bf-hint-text",children:a.hintText}),jsxRuntime.jsx("button",{type:"button",className:"bf-btn",onClick:()=>r(),"aria-label":a.cancelButton,children:a.cancelButton})]}),se&&V&&jsxRuntime.jsxs("div",{ref:st,className:"bf-panel",style:{left:V.left,top:V.top},role:"dialog","aria-modal":"true","aria-label":"Feedback form",children:[jsxRuntime.jsxs("div",{className:"bf-panelHeader",children:[jsxRuntime.jsx("div",{className:"bf-title",id:"bf-panel-title",children:a.panelTitle}),jsxRuntime.jsxs("div",{className:"bf-row",style:{justifyContent:"flex-end"},children:[jsxRuntime.jsx("button",{type:"button",className:"bf-btn",onClick:()=>c(),disabled:S,"aria-label":a.rePickButton,children:a.rePickButton}),jsxRuntime.jsx("button",{type:"button",className:"bf-btn",onClick:()=>r(),disabled:S,"aria-label":a.closeButton,children:a.closeButton})]})]}),jsxRuntime.jsxs("div",{className:"bf-panelBody",children:[jsxRuntime.jsx("textarea",{className:"bf-textarea",placeholder:a.textareaPlaceholder,value:p,onChange:d=>T(d.target.value),onKeyDown:pt,disabled:S,"aria-label":a.panelTitle}),ne.length>0&&jsxRuntime.jsx("div",{className:"bf-pills",role:"group","aria-label":"Feedback category",children:ne.map(d=>jsxRuntime.jsx("button",{type:"button",className:`bf-pill${O===d?" bf-pill-active":""}`,onClick:()=>ie(O===d?void 0:d),disabled:S,children:a[yo[d]]},d))}),jsxRuntime.jsxs("div",{className:"bf-row",role:"group","aria-label":a.screenshotElement,children:[jsxRuntime.jsxs("label",{children:[jsxRuntime.jsx("input",{type:"checkbox",checked:u,onChange:d=>E(d.target.checked),disabled:S}),a.screenshotElement]}),jsxRuntime.jsxs("label",{children:[jsxRuntime.jsx("input",{type:"checkbox",checked:x,onChange:d=>re(d.target.checked),disabled:S}),a.screenshotFullPage]})]}),t.phase==="capturing"&&jsxRuntime.jsxs("div",{className:"bf-status",role:"status","aria-live":"polite",children:[jsxRuntime.jsx("span",{className:"bf-spinner","aria-hidden":"true"}),a.capturingText]}),t.phase==="submitting"&&jsxRuntime.jsxs("div",{className:"bf-status",role:"status","aria-live":"polite",children:[jsxRuntime.jsx("span",{className:"bf-spinner","aria-hidden":"true"}),a.submittingText]}),t.phase==="success"&&jsxRuntime.jsx("div",{className:"bf-status",role:"status","aria-live":"polite",children:a.successText}),t.phase==="error"&&de&&jsxRuntime.jsx("div",{className:"bf-error",role:"alert",children:de}),jsxRuntime.jsxs("div",{className:"bf-actions",children:[jsxRuntime.jsx("button",{type:"button",className:"bf-btn",onClick:()=>r(),disabled:S,"aria-label":a.cancelButton,children:a.cancelButton}),jsxRuntime.jsx("button",{type:"button",className:"bf-btn bf-btnPrimary",onClick:q,disabled:S||p.trim().length===0,"aria-label":a.sendButton,children:a.sendButton})]})]}),s&&jsxRuntime.jsx("div",{className:"bf-watermark",children:jsxRuntime.jsx("a",{href:"https://blocfeed.com",target:"_blank",rel:"noopener noreferrer",children:"Powered by BlocFeed"})})]})]}),t.phase==="success"&&jsxRuntime.jsx("div",{className:"bf-toast",role:"status","aria-live":"polite",children:a.toastText}),j>0&&!at&&jsxRuntime.jsxs("div",{className:"bf-security-banner",role:"alert",children:[jsxRuntime.jsx("button",{type:"button",className:"bf-security-banner-dismiss",onClick:()=>it(true),"aria-label":"Dismiss",children:"\xD7"}),jsxRuntime.jsx("strong",{children:"Security Warning"}),j," potential secret",j>1?"s":""," exposed in client code. Check your environment variables."]})]})}var vo=react.forwardRef(function(t,n){let o={...t.config??{},blocfeed_id:t.blocfeed_id},[r,c]=react.useState(null),i=mo(o.ui?.showOn),l=ho(o.ui?.theme?.mode),a=!!o.diagnostics;react.useEffect(()=>{if(a)return chunkJVY6JTXP_cjs.k(o.diagnostics),()=>chunkJVY6JTXP_cjs.l()},[a]);let s=!!o.security;react.useEffect(()=>{s&&chunkJVY6JTXP_cjs.o(o.security);},[s]);let m=react.useRef(t.config?.metadata?.enrich);m.current=t.config?.metadata?.enrich;let M=react.useMemo(()=>{if(t.config)return {...t.config,metadata:{...t.config.metadata,enrich:async p=>{let T=m.current,u=T?await T(p):{},E=chunkJVY6JTXP_cjs.m(),x=chunkJVY6JTXP_cjs.p();return {...u,...E.consoleLogs.length>0?{_consoleLogs:E.consoleLogs}:{},...E.networkErrors.length>0?{_networkErrors:E.networkErrors}:{},...x.findings.length>0?{_securityFindings:x.findings}:{}}}}}},[]);return react.useEffect(()=>{ve();let p=document.createElement("div");p.setAttribute("data-blocfeed-ui-root","true"),p.setAttribute("data-blocfeed-ui","true"),p.setAttribute("data-bf-theme",l);let T=o.ui?.zIndex;typeof T=="number"&&p.style.setProperty("--bf-z",String(T));let u=o.ui?.theme;return u&&(u.accentColor&&p.style.setProperty("--bf-accent",u.accentColor),u.panelBackground&&p.style.setProperty("--bf-panel-bg",u.panelBackground),u.panelForeground&&p.style.setProperty("--bf-panel-fg",u.panelForeground),u.fontFamily&&p.style.setProperty("--bf-font",u.fontFamily)),document.body.appendChild(p),c(p),()=>{p.remove(),c(null);}},[o.ui?.zIndex,o.ui?.theme?.accentColor,o.ui?.theme?.panelBackground,o.ui?.theme?.panelForeground,o.ui?.theme?.fontFamily,l]),react.useEffect(()=>{r&&r.setAttribute("data-bf-theme",l);},[r,l]),!i||!r?null:reactDom.createPortal(jsxRuntime.jsx(ee,{blocfeed_id:o.blocfeed_id,...M?{config:M}:{},children:jsxRuntime.jsx(wo,{config:o,handleRef:n})}),r)});
638
+ `;function ve(){if(!chunkFOZ6KYBJ_cjs.a()||document.getElementById(we))return;let e=document.createElement("style");e.id=we,e.textContent=xt,document.head.appendChild(e);}var ke={triggerLabel:"Feedback",panelTitle:"Feedback",hintText:"Click an element to attach your feedback. Press Esc to cancel.",cancelButton:"Cancel",rePickButton:"Re-pick",closeButton:"Close",textareaPlaceholder:"What's happening? What did you expect?",screenshotElement:"Screenshot element",screenshotFullPage:"Full page",capturingText:"Capturing screenshots\u2026",submittingText:"Submitting\u2026",successText:"Sent. Thank you!",toastText:"Feedback sent",sendButton:"Send",categoryBug:"Bug",categoryFeature:"Feature",categoryUx:"UX",categoryGeneral:"General"};function Te(e){return e?{...ke,...e}:ke}function te(){let e=react.useContext(U);if(!e)throw new Error("useBlocFeed must be used within a <BlocFeedProvider />");return {state:e.state,controller:e.controller,start:e.controller.start,stop:e.controller.stop,clearSelection:e.controller.clearSelection,submit:e.controller.submit}}function y(e){switch(e){case "bottom-left":return "bf-trigger bf-trigger-bl";case "top-right":return "bf-trigger bf-trigger-tr";case "top-left":return "bf-trigger bf-trigger-tl";default:return "bf-trigger"}}function b({size:e=14}){return jsxRuntime.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Se({size:e=14}){return jsxRuntime.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:jsxRuntime.jsx("path",{d:"M21 11.5a8.38 8.38 0 01-.9 3.8 8.5 8.5 0 01-7.6 4.7 8.38 8.38 0 01-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 01-.9-3.8 8.5 8.5 0 014.7-7.6 8.38 8.38 0 013.8-.9h.5a8.48 8.48 0 018 8v.5z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Pe({size:e=16}){return jsxRuntime.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[jsxRuntime.jsx("path",{d:"M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M22 6l-10 7L2 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ce({position:e,onClick:t,isVisible:n,label:o,queueCount:r,showSuccess:c}){return n?jsxRuntime.jsxs("button",{className:y(e),type:"button",onClick:t,"aria-label":o,children:[c?jsxRuntime.jsx("span",{style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsxRuntime.jsx(b,{size:14})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"bf-dot","aria-hidden":"true"}),o]}),r>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${r} queued`,children:r})]}):null}function g(){let[e,t]=react.useState(()=>typeof window>"u"?false:window.matchMedia("(prefers-reduced-motion: reduce)").matches);return react.useEffect(()=>{let n=window.matchMedia("(prefers-reduced-motion: reduce)"),o=r=>t(r.matches);return n.addEventListener("change",o),()=>n.removeEventListener("change",o)},[]),e}var Pt={duration:.18,ease:"easeOut"},Et={duration:0};function Be({position:e,onClick:t,isVisible:n,label:o,queueCount:r,showSuccess:c}){let[i,l]=react.useState(false),a=g(),s=a?Et:Pt;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:n&&jsxRuntime.jsx(framerMotion.motion.button,{className:y(e),type:"button",onClick:t,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":o,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:s,whileTap:{scale:.92},style:{overflow:"hidden"},children:c?jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:s,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsxRuntime.jsx(b,{size:14})},"success"):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.span,{className:"bf-dot","aria-hidden":"true",animate:a?{}:{scale:i?1:[1,1.2,1],boxShadow:i?"0 0 0 4px rgba(99, 102, 241, 0.18)":["0 0 0 4px rgba(99, 102, 241, 0.18)","0 0 0 8px rgba(99, 102, 241, 0.28)","0 0 0 4px rgba(99, 102, 241, 0.18)"]},transition:i||a?s:{duration:2,repeat:1/0,ease:"easeInOut"}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:i&&jsxRuntime.jsx(framerMotion.motion.span,{initial:{opacity:0,x:a?0:-6},animate:{opacity:1,x:0},exit:{opacity:0,x:a?0:-6},transition:s,style:{whiteSpace:"nowrap"},children:o},"label")}),r>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${r} queued`,children:r})]})},"dot")})}var Nt={duration:.18,ease:"easeOut"},Re={duration:0};function Le({position:e,onClick:t,isVisible:n,label:o,queueCount:r,showSuccess:c}){let[i,l]=react.useState(false),a=g(),s=a?Re:Nt;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:n&&jsxRuntime.jsxs(framerMotion.motion.div,{className:y(e),initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{y:8,opacity:0},transition:s,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),style:{background:"transparent",border:"none",boxShadow:"none",padding:0},children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:i&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:a?0:4},animate:{opacity:1,y:0},exit:{opacity:0,y:a?0:4},transition:s,style:{position:"absolute",bottom:"calc(100% + 8px)",left:"50%",transform:"translateX(-50%)",padding:"6px 12px",borderRadius:"8px",background:"var(--bf-panel-bg)",border:"1px solid var(--bf-border)",boxShadow:"var(--bf-shadow)",whiteSpace:"nowrap",fontSize:"12px",color:"var(--bf-panel-fg)",pointerEvents:"none"},children:o},"tooltip")}),jsxRuntime.jsxs(framerMotion.motion.button,{type:"button",onClick:t,"aria-label":o,style:{position:"relative",display:"flex",alignItems:"center",justifyContent:"center",width:"40px",height:"40px",borderRadius:"50%",border:"1px solid var(--bf-border)",background:"var(--bf-panel-bg)",color:"var(--bf-panel-fg)",boxShadow:"var(--bf-shadow)",cursor:"pointer",padding:0},animate:a?{}:{y:[0,-3,0]},transition:a?Re:{y:{duration:3,repeat:1/0,ease:"easeInOut"}},whileHover:{scale:1.1,borderColor:"var(--bf-accent)"},whileTap:{scale:.9},children:[c?jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:s,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsxRuntime.jsx(b,{size:16})},"success"):jsxRuntime.jsx(Se,{size:16}),r>0&&jsxRuntime.jsx("span",{className:"bf-badge bf-badge-float","aria-label":`${r} queued`,children:r})]})]},"bubble")})}var Lt={duration:.2,ease:"easeOut"},zt={duration:0};function Ae(e){return e==="bottom-left"||e==="top-left"}function At(e){return `bf-trigger-edge ${Ae(e)?"bf-trigger-edge-left":"bf-trigger-edge-right"}`}function Ie({position:e,onClick:t,isVisible:n,label:o,queueCount:r,showSuccess:c}){let[i,l]=react.useState(false),a=Ae(e),s=g(),m=s?zt:Lt;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:n&&jsxRuntime.jsx(framerMotion.motion.button,{className:At(e),type:"button",onClick:t,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":o,initial:{opacity:0,width:0},animate:{opacity:1,width:i?140:22,height:i?40:90},exit:{width:0,opacity:0},transition:m,whileTap:{scale:.97},style:{top:"50%",translateY:"-50%"},children:c?jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:m,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsxRuntime.jsx(b,{size:14})},"success"):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.span,{animate:{rotate:s||i?0:a?-90:90,opacity:i?1:.6},transition:m,style:{display:"flex",alignItems:"center",gap:"8px",whiteSpace:"nowrap",fontSize:"12px",letterSpacing:"0.5px",textTransform:"uppercase"},children:[i&&jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:{duration:.12},style:{width:"6px",height:"6px",borderRadius:"50%",background:"var(--bf-accent)",flexShrink:0}}),o]}),jsxRuntime.jsx(framerMotion.motion.span,{"aria-hidden":"true",animate:{opacity:i?1:0},transition:{duration:.12},style:{position:"absolute",top:0,bottom:0,[a?"left":"right"]:0,width:"2px",background:"var(--bf-accent)"}}),r>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${r} queued`,children:r})]})},"edge-tab")})}var _t={duration:.18,ease:"easeOut"},Ht={duration:0};function _e({delay:e,hovered:t,reduced:n}){return n?null:jsxRuntime.jsx(framerMotion.motion.span,{"aria-hidden":"true",style:{position:"absolute",width:"10px",height:"10px",borderRadius:"50%",border:"2px solid var(--bf-accent)",pointerEvents:"none"},animate:t?{scale:1,opacity:0}:{scale:[1,1.8],opacity:[.5,0]},transition:t?{duration:.15}:{duration:2,repeat:1/0,delay:e,ease:"easeOut"}})}function Oe({position:e,onClick:t,isVisible:n,label:o,queueCount:r,showSuccess:c}){let[i,l]=react.useState(false),a=g(),s=a?Ht:_t;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:n&&jsxRuntime.jsx(framerMotion.motion.button,{className:y(e),type:"button",onClick:t,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":o,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:s,whileTap:{scale:.92},style:{overflow:"hidden"},children:c?jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:s,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsxRuntime.jsx(b,{size:14})},"success"):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("span",{style:{position:"relative",display:"flex",alignItems:"center",justifyContent:"center",width:"10px",height:"10px",flexShrink:0},children:[jsxRuntime.jsx(_e,{delay:0,hovered:i,reduced:a}),jsxRuntime.jsx(_e,{delay:.7,hovered:i,reduced:a}),jsxRuntime.jsx(framerMotion.motion.span,{className:"bf-dot","aria-hidden":"true",style:{position:"relative",zIndex:1}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:i&&jsxRuntime.jsx(framerMotion.motion.span,{initial:{opacity:0,x:a?0:-6},animate:{opacity:1,x:0},exit:{opacity:0,x:a?0:-6},transition:s,style:{whiteSpace:"nowrap"},children:o},"label")}),r>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${r} queued`,children:r})]})},"pulse-ring")})}var $t={duration:.18,ease:"easeOut"},Ut={duration:0};function Xt(e){switch(e){case "bottom-left":return "bf-trigger-minimal bf-trigger-bl";case "top-right":return "bf-trigger-minimal bf-trigger-tr";case "top-left":return "bf-trigger-minimal bf-trigger-tl";default:return "bf-trigger-minimal"}}function $e({position:e,onClick:t,isVisible:n,label:o,queueCount:r,showSuccess:c}){let[i,l]=react.useState(false),a=g(),s=a?Ut:$t;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:n&&jsxRuntime.jsxs(framerMotion.motion.button,{className:Xt(e),type:"button",onClick:t,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":o,initial:{opacity:0,y:a?0:5},animate:{opacity:i?1:.65,y:0},exit:{opacity:0,y:a?0:5},transition:s,whileTap:{scale:.95},children:[c?jsxRuntime.jsx("span",{style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsxRuntime.jsx(b,{size:14})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{children:o}),r>0&&jsxRuntime.jsx("span",{className:"bf-badge",style:{marginLeft:"4px"},"aria-label":`${r} queued`,children:r})]}),!a&&jsxRuntime.jsx(framerMotion.motion.span,{"aria-hidden":"true",style:{position:"absolute",bottom:4,left:4,right:4,height:"2px",background:"var(--bf-accent)",borderRadius:"1px",transformOrigin:"left"},initial:false,animate:{scaleX:i?1:0},transition:s})]},"minimal")})}var Qt={duration:.18,ease:"easeOut"},jt={duration:0};function Xe({position:e,onClick:t,isVisible:n,label:o,queueCount:r,showSuccess:c}){let[i,l]=react.useState(false),a=g(),s=a?jt:Qt;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:n&&jsxRuntime.jsx(framerMotion.motion.button,{className:y(e),type:"button",onClick:t,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":o,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:s,whileTap:{scale:.9},style:{overflow:"hidden"},children:c?jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:s,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsxRuntime.jsx(b,{size:14})},"success"):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.span,{style:{display:"inline-flex",flexShrink:0},animate:a?{}:i?{scale:1.2,rotate:0}:{rotate:[-5,5,-5]},transition:i||a?s:{duration:3,repeat:1/0,ease:"easeInOut"},children:jsxRuntime.jsx(Pe,{size:16})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:i&&jsxRuntime.jsx(framerMotion.motion.span,{initial:{opacity:0,x:a?0:-8},animate:{opacity:1,x:0},exit:{opacity:0,x:a?0:-8},transition:s,style:{whiteSpace:"nowrap"},children:o},"label")}),r>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${r} queued`,children:r})]})},"icon-pop")})}var Zt={duration:.18,ease:"easeOut"},eo={duration:0};function Qe({position:e,onClick:t,isVisible:n,label:o,queueCount:r,showSuccess:c}){let[i,l]=react.useState(false),a=g(),s=a?eo:Zt;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:n&&jsxRuntime.jsx(framerMotion.motion.button,{className:y(e),type:"button",onClick:t,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":o,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:s,whileTap:{scale:.92},style:{overflow:"hidden"},children:c?jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:s,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsxRuntime.jsx(b,{size:14})},"success"):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("span",{style:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:"10px",height:"10px",flexShrink:0},children:[jsxRuntime.jsx(framerMotion.motion.span,{"aria-hidden":"true",style:{width:"10px",height:"10px",borderRadius:"50%",background:"var(--bf-accent)",position:"relative",zIndex:1},animate:a?{}:{opacity:i?1:[.5,1,.5],boxShadow:i?"0 0 8px 2px var(--bf-accent)":["0 0 4px 1px var(--bf-accent)","0 0 12px 4px var(--bf-accent)","0 0 4px 1px var(--bf-accent)"]},transition:i||a?s:{duration:2,repeat:1/0,ease:"easeInOut"}}),!i&&!a&&jsxRuntime.jsx(framerMotion.motion.span,{"aria-hidden":"true",style:{position:"absolute",width:"18px",height:"2px",background:"linear-gradient(90deg, var(--bf-accent), transparent)",transformOrigin:"left center",left:"5px",top:"4px"},animate:{rotate:[0,360]},transition:{duration:4,repeat:1/0,ease:"linear"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:i&&jsxRuntime.jsx(framerMotion.motion.span,{initial:{opacity:0,x:a?0:-6},animate:{opacity:1,x:0},exit:{opacity:0,x:a?0:-6},transition:s,style:{whiteSpace:"nowrap"},children:o},"label")}),r>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${r} queued`,children:r})]})},"beacon")})}var io={duration:.18,ease:"easeOut"},no={duration:0};function Je({position:e,onClick:t,isVisible:n,label:o,queueCount:r,showSuccess:c}){let[i,l]=react.useState(false),[a,s]=react.useState(0),m=g(),M=m?no:io,p=react.useRef(null);react.useEffect(()=>{if(p.current&&(clearInterval(p.current),p.current=null),!n||i||m){s(i||m?o.length:0);return}let u=8,E=o.length*2+u*2,x=0;return p.current=setInterval(()=>{x=(x+1)%E,x<=o.length?s(x):x<=o.length+u?s(o.length):x<=o.length*2+u?s(o.length*2+u-x):s(0);},100),()=>{p.current&&(clearInterval(p.current),p.current=null);}},[n,i,m,o]);let T=o.slice(0,a);return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:n&&jsxRuntime.jsx(framerMotion.motion.button,{className:y(e),type:"button",onClick:t,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":o,initial:{opacity:0,y:m?0:5},animate:{opacity:1,y:0},exit:{opacity:0,y:m?0:5},transition:M,whileTap:{scale:.95},style:{minWidth:"44px"},children:c?jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:M,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsxRuntime.jsx(b,{size:14})},"success"):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"bf-dot","aria-hidden":"true"}),jsxRuntime.jsxs("span",{style:{whiteSpace:"nowrap",minWidth:"1ch"},children:[T,jsxRuntime.jsx("span",{className:"bf-cursor","aria-hidden":"true"})]}),r>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${r} queued`,children:r})]})},"typewriter")})}function Ze(e){switch(e){case "dot":return Be;case "bubble":return Le;case "edge-tab":return Ie;case "pulse-ring":return Oe;case "minimal":return $e;case "icon-pop":return Xe;case "beacon":return Qe;case "typewriter":return Je;default:return Ce}}function tt(e,t,n){return Math.max(t,Math.min(n,e))}function fo(e,t,n="bottom-right"){let r=window.innerWidth,c=window.innerHeight,i;i=tt(e.x,12,Math.max(12,r-t-12));let l=e.y+e.height+12,a=Math.max(12,e.y-240);return {top:l+240<=c?l:a,left:i}}function uo(e){let{rect:t}=e,n={left:`${t.x}px`,top:`${t.y}px`,width:`${Math.max(0,t.width)}px`,height:`${Math.max(0,t.height)}px`};return jsxRuntime.jsx("div",{className:"bf-highlight",style:n,"aria-hidden":"true"})}function bo(e){let t=react.useRef(null);return react.useEffect(()=>{if(!e||!t.current)return;t.current.querySelector(".bf-textarea")?.focus();let o=r=>{if(r.key!=="Tab"||!t.current)return;let c=t.current.querySelectorAll('button:not([disabled]), textarea:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])');if(c.length===0)return;let i=c[0],l=c[c.length-1];r.shiftKey&&document.activeElement===i?(r.preventDefault(),l.focus()):!r.shiftKey&&document.activeElement===l&&(r.preventDefault(),i.focus());};return document.addEventListener("keydown",o,{capture:true}),()=>document.removeEventListener("keydown",o,{capture:true})},[e]),t}function go(e,t){return e?typeof e=="function"?e(t):e.some(n=>n.endsWith("*")?t.startsWith(n.slice(0,-1)):t===n):true}function mo(e){let[t,n]=react.useState(()=>typeof window<"u"?window.location.pathname:"/");return react.useEffect(()=>{if(typeof window>"u")return;let o=()=>n(window.location.pathname);window.addEventListener("popstate",o);let r=history.pushState,c=history.replaceState;return history.pushState=function(...i){r.apply(this,i),o();},history.replaceState=function(...i){c.apply(this,i),o();},()=>{window.removeEventListener("popstate",o),history.pushState=r,history.replaceState=c;}},[]),go(e,t)}function ho(e){let[t,n]=react.useState(()=>!e||e==="dark"?"dark":e==="light"?"light":typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");return react.useEffect(()=>{if(e!=="auto"){n(e==="light"?"light":"dark");return}let o=window.matchMedia("(prefers-color-scheme: dark)"),r=c=>n(c.matches?"dark":"light");return n(o.matches?"dark":"light"),o.addEventListener("change",r),()=>o.removeEventListener("change",r)},[e]),t}var xo=["bug","feature","ux","general"],yo={bug:"categoryBug",feature:"categoryFeature",ux:"categoryUx",general:"categoryGeneral"};function wo(e){let{state:t,controller:n,start:o,stop:r,clearSelection:c,submit:i}=te(),l=e.config.ui?.position,a=Te(e.config.ui?.strings),s=e.config.ui?.branding!==false,[m,M]=react.useState(null),[p,T]=react.useState(""),[u,E]=react.useState(e.config.capture?.element??true),[x,re]=react.useState(e.config.capture?.fullPage??false),[rt,ae]=react.useState(null),[O,ie]=react.useState(void 0),ne=e.config.ui?.categories??xo,[at,it]=react.useState(false),[j,nt]=react.useState(0);react.useEffect(()=>{let d=window.setTimeout(()=>{let N=chunkFOZ6KYBJ_cjs.p();nt(N.findings.length);},500);return ()=>window.clearTimeout(d)},[]),react.useImperativeHandle(e.handleRef,()=>({open:o,close:r,submit:d=>i(d),get isOpen(){return t.phase!=="idle"}}),[o,r,i,t.phase]);let se=t.phase==="review"||t.phase==="capturing"||t.phase==="submitting"||t.phase==="error"||t.phase==="success",st=bo(se),[lt,ct]=react.useState(0);react.useEffect(()=>{t.phase==="idle"&&ct(chunkFOZ6KYBJ_cjs.i());},[t.phase]);let[dt,le]=react.useState(false),ce=react.useRef(t.phase);react.useEffect(()=>{if(ce.current==="success"&&t.phase==="idle"){le(true);let d=window.setTimeout(()=>le(false),1500);return ()=>window.clearTimeout(d)}ce.current=t.phase;},[t.phase]),react.useEffect(()=>{let d=e.config.ui?.shortcut;if(!d)return;let N=d.toLowerCase().split("+").map(P=>P.trim()),W=N[N.length-1]||"",L=new Set(N.slice(0,-1)),pe=P=>{let ut=/Mac|iPod|iPhone|iPad/.test(navigator.platform);if(L.has("mod")){if(ut?!P.metaKey:!P.ctrlKey)return}else if(L.has("ctrl")&&!P.ctrlKey||(L.has("meta")||L.has("cmd"))&&!P.metaKey)return;L.has("shift")&&!P.shiftKey||(L.has("alt")||L.has("option"))&&!P.altKey||P.key.toLowerCase()===W&&(P.preventDefault(),t.phase==="idle"?o():r());};return document.addEventListener("keydown",pe),()=>document.removeEventListener("keydown",pe)},[e.config.ui?.shortcut,t.phase,o,r]),react.useEffect(()=>n.subscribeHover(M),[n]),react.useEffect(()=>{let d=n.__unsafeGetSelectedElement();if(!d||t.phase==="idle"||t.phase==="picking"){ae(null);return}let N=()=>{ae(chunkFOZ6KYBJ_cjs.b(d.getBoundingClientRect()));};N();let W=()=>N();return window.addEventListener("scroll",W,{capture:true,passive:true}),window.addEventListener("resize",W,{passive:true}),()=>{window.removeEventListener("scroll",W,{capture:true}),window.removeEventListener("resize",W);}},[n,t.phase,t.selection?.selector]),react.useEffect(()=>{t.phase==="review"&&(T(""),E(e.config.capture?.element??true),re(e.config.capture?.fullPage??false),ie(void 0));},[t.phase,t.selection?.selector,e.config.capture?.element,e.config.capture?.fullPage]),react.useEffect(()=>{if(t.phase!=="success")return;let d=window.setTimeout(()=>r(),1200);return ()=>window.clearTimeout(d)},[t.phase,r]);let S=t.phase==="capturing"||t.phase==="submitting",B=t.phase==="picking"?m?.rect??null:rt??t.selection?.rect??null,V=react.useMemo(()=>B?fo(B,360,l):null,[B?.x,B?.y,B?.width,B?.height,l]),de=t.lastError?.message,q=react.useCallback(()=>{let d={capture:{element:u,fullPage:x}};O&&(d.category=O),i(p,d);},[i,p,u,x,O]),pt=react.useCallback(d=>{(d.metaKey||d.ctrlKey)&&d.key==="Enter"&&p.trim().length>0&&!S&&(d.preventDefault(),q());},[q,p,S]),ft=Ze(e.config.ui?.triggerStyle);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ft,{position:l,onClick:()=>o(),isVisible:t.phase==="idle",label:e.config.ui?.triggerLabel??a.triggerLabel,queueCount:lt,showSuccess:dt}),t.phase!=="idle"&&jsxRuntime.jsxs("div",{className:"bf-overlay",role:"presentation",children:[t.phase!=="picking"&&jsxRuntime.jsx("div",{className:"bf-blocker",role:"presentation",onClick:()=>r()}),B&&jsxRuntime.jsx(uo,{rect:B}),t.phase==="picking"&&jsxRuntime.jsxs("div",{className:"bf-hint",role:"status","aria-live":"polite",children:[jsxRuntime.jsx("p",{id:"bf-hint-text",children:a.hintText}),jsxRuntime.jsx("button",{type:"button",className:"bf-btn",onClick:()=>r(),"aria-label":a.cancelButton,children:a.cancelButton})]}),se&&V&&jsxRuntime.jsxs("div",{ref:st,className:"bf-panel",style:{left:V.left,top:V.top},role:"dialog","aria-modal":"true","aria-label":"Feedback form",children:[jsxRuntime.jsxs("div",{className:"bf-panelHeader",children:[jsxRuntime.jsx("div",{className:"bf-title",id:"bf-panel-title",children:a.panelTitle}),jsxRuntime.jsxs("div",{className:"bf-row",style:{justifyContent:"flex-end"},children:[jsxRuntime.jsx("button",{type:"button",className:"bf-btn",onClick:()=>c(),disabled:S,"aria-label":a.rePickButton,children:a.rePickButton}),jsxRuntime.jsx("button",{type:"button",className:"bf-btn",onClick:()=>r(),disabled:S,"aria-label":a.closeButton,children:a.closeButton})]})]}),jsxRuntime.jsxs("div",{className:"bf-panelBody",children:[jsxRuntime.jsx("textarea",{className:"bf-textarea",placeholder:a.textareaPlaceholder,value:p,onChange:d=>T(d.target.value),onKeyDown:pt,disabled:S,"aria-label":a.panelTitle}),ne.length>0&&jsxRuntime.jsx("div",{className:"bf-pills",role:"group","aria-label":"Feedback category",children:ne.map(d=>jsxRuntime.jsx("button",{type:"button",className:`bf-pill${O===d?" bf-pill-active":""}`,onClick:()=>ie(O===d?void 0:d),disabled:S,children:a[yo[d]]},d))}),jsxRuntime.jsxs("div",{className:"bf-row",role:"group","aria-label":a.screenshotElement,children:[jsxRuntime.jsxs("label",{children:[jsxRuntime.jsx("input",{type:"checkbox",checked:u,onChange:d=>E(d.target.checked),disabled:S}),a.screenshotElement]}),jsxRuntime.jsxs("label",{children:[jsxRuntime.jsx("input",{type:"checkbox",checked:x,onChange:d=>re(d.target.checked),disabled:S}),a.screenshotFullPage]})]}),t.phase==="capturing"&&jsxRuntime.jsxs("div",{className:"bf-status",role:"status","aria-live":"polite",children:[jsxRuntime.jsx("span",{className:"bf-spinner","aria-hidden":"true"}),a.capturingText]}),t.phase==="submitting"&&jsxRuntime.jsxs("div",{className:"bf-status",role:"status","aria-live":"polite",children:[jsxRuntime.jsx("span",{className:"bf-spinner","aria-hidden":"true"}),a.submittingText]}),t.phase==="success"&&jsxRuntime.jsx("div",{className:"bf-status",role:"status","aria-live":"polite",children:a.successText}),t.phase==="error"&&de&&jsxRuntime.jsx("div",{className:"bf-error",role:"alert",children:de}),jsxRuntime.jsxs("div",{className:"bf-actions",children:[jsxRuntime.jsx("button",{type:"button",className:"bf-btn",onClick:()=>r(),disabled:S,"aria-label":a.cancelButton,children:a.cancelButton}),jsxRuntime.jsx("button",{type:"button",className:"bf-btn bf-btnPrimary",onClick:q,disabled:S||p.trim().length===0,"aria-label":a.sendButton,children:a.sendButton})]})]}),s&&jsxRuntime.jsx("div",{className:"bf-watermark",children:jsxRuntime.jsx("a",{href:"https://blocfeed.com",target:"_blank",rel:"noopener noreferrer",children:"Powered by BlocFeed"})})]})]}),t.phase==="success"&&jsxRuntime.jsx("div",{className:"bf-toast",role:"status","aria-live":"polite",children:a.toastText}),j>0&&!at&&jsxRuntime.jsxs("div",{className:"bf-security-banner",role:"alert",children:[jsxRuntime.jsx("button",{type:"button",className:"bf-security-banner-dismiss",onClick:()=>it(true),"aria-label":"Dismiss",children:"\xD7"}),jsxRuntime.jsx("strong",{children:"Security Warning"}),j," potential secret",j>1?"s":""," exposed in client code. Check your environment variables."]})]})}var vo=react.forwardRef(function(t,n){let o={...t.config??{},blocfeed_id:t.blocfeed_id},[r,c]=react.useState(null),i=mo(o.ui?.showOn),l=ho(o.ui?.theme?.mode),a=!!o.diagnostics;react.useEffect(()=>{if(a)return chunkFOZ6KYBJ_cjs.k(o.diagnostics),()=>chunkFOZ6KYBJ_cjs.l()},[a]);let s=!!o.security;react.useEffect(()=>{s&&chunkFOZ6KYBJ_cjs.o(o.security);},[s]);let m=react.useRef(t.config?.metadata?.enrich);m.current=t.config?.metadata?.enrich;let M=react.useMemo(()=>{if(t.config)return {...t.config,metadata:{...t.config.metadata,enrich:async p=>{let T=m.current,u=T?await T(p):{},E=chunkFOZ6KYBJ_cjs.m(),x=chunkFOZ6KYBJ_cjs.p();return {...u,...E.consoleLogs.length>0?{_consoleLogs:E.consoleLogs}:{},...E.networkErrors.length>0?{_networkErrors:E.networkErrors}:{},...x.findings.length>0?{_securityFindings:x.findings}:{}}}}}},[]);return react.useEffect(()=>{ve();let p=document.createElement("div");p.setAttribute("data-blocfeed-ui-root","true"),p.setAttribute("data-blocfeed-ui","true"),p.setAttribute("data-bf-theme",l);let T=o.ui?.zIndex;typeof T=="number"&&p.style.setProperty("--bf-z",String(T));let u=o.ui?.theme;return u&&(u.accentColor&&p.style.setProperty("--bf-accent",u.accentColor),u.panelBackground&&p.style.setProperty("--bf-panel-bg",u.panelBackground),u.panelForeground&&p.style.setProperty("--bf-panel-fg",u.panelForeground),u.fontFamily&&p.style.setProperty("--bf-font",u.fontFamily)),document.body.appendChild(p),c(p),()=>{p.remove(),c(null);}},[o.ui?.zIndex,o.ui?.theme?.accentColor,o.ui?.theme?.panelBackground,o.ui?.theme?.panelForeground,o.ui?.theme?.fontFamily,l]),react.useEffect(()=>{r&&r.setAttribute("data-bf-theme",l);},[r,l]),!i||!r?null:reactDom.createPortal(jsxRuntime.jsx(ee,{blocfeed_id:o.blocfeed_id,...M?{config:M}:{},children:jsxRuntime.jsx(wo,{config:o,handleRef:n})}),r)});
639
639
  exports.BlocFeedProvider=ee;exports.BlocFeedWidget=vo;exports.useBlocFeed=te;
package/dist/main.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { B as BlocFeedConfig, a as BlocFeedHandle, b as BlocFeedState, c as BlocFeedController, C as CaptureConfig, F as FeedbackCategory, S as SubmitResult } from './controller-BPsU7cuY.cjs';
2
- export { d as BlocFeedError, e as BlocFeedStrings, f as BlocFeedUser, g as CaptureDiagnostics, h as CaptureResult, i as ConsoleEntry, D as DiagnosticsConfig, E as ElementDescriptor, j as FeedbackApiResponse, k as FeedbackPayload, I as ImageAsset, M as MaybePromise, l as MetadataConfig, m as MetadataContext, N as NetworkEntry, P as PickerConfig, R as Rect, n as ScreenshotAdapter, o as ScreenshotAdapterOptions, p as ScreenshotIntent, q as ScreenshotMime, r as SecurityConfig, s as SecurityFinding, t as SecuritySnapshot, u as SessionPhase, T as ThemeConfig, v as TransportConfig, w as TransportResult, x as TriggerStyle, W as WidgetPosition } from './controller-BPsU7cuY.cjs';
1
+ import { B as BlocFeedConfig, a as BlocFeedHandle, b as BlocFeedState, c as BlocFeedController, C as CaptureConfig, F as FeedbackCategory, S as SubmitResult } from './controller-D0bplVji.cjs';
2
+ export { d as BlocFeedError, e as BlocFeedStrings, f as BlocFeedUser, g as CaptureDiagnostics, h as CaptureResult, i as ConsoleEntry, D as DiagnosticsConfig, E as ElementDescriptor, j as FeedbackApiResponse, k as FeedbackPayload, I as ImageAsset, M as MaybePromise, l as MetadataConfig, m as MetadataContext, N as NetworkEntry, P as PickerConfig, R as Rect, n as ScreenshotAdapter, o as ScreenshotAdapterOptions, p as ScreenshotIntent, q as ScreenshotMime, r as SecurityConfig, s as SecurityFinding, t as SecuritySnapshot, u as SessionPhase, T as ThemeConfig, v as TransportConfig, w as TransportResult, x as TriggerStyle, W as WidgetPosition } from './controller-D0bplVji.cjs';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as react from 'react';
5
5
  import { ReactNode } from 'react';
package/dist/main.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { B as BlocFeedConfig, a as BlocFeedHandle, b as BlocFeedState, c as BlocFeedController, C as CaptureConfig, F as FeedbackCategory, S as SubmitResult } from './controller-BPsU7cuY.js';
2
- export { d as BlocFeedError, e as BlocFeedStrings, f as BlocFeedUser, g as CaptureDiagnostics, h as CaptureResult, i as ConsoleEntry, D as DiagnosticsConfig, E as ElementDescriptor, j as FeedbackApiResponse, k as FeedbackPayload, I as ImageAsset, M as MaybePromise, l as MetadataConfig, m as MetadataContext, N as NetworkEntry, P as PickerConfig, R as Rect, n as ScreenshotAdapter, o as ScreenshotAdapterOptions, p as ScreenshotIntent, q as ScreenshotMime, r as SecurityConfig, s as SecurityFinding, t as SecuritySnapshot, u as SessionPhase, T as ThemeConfig, v as TransportConfig, w as TransportResult, x as TriggerStyle, W as WidgetPosition } from './controller-BPsU7cuY.js';
1
+ import { B as BlocFeedConfig, a as BlocFeedHandle, b as BlocFeedState, c as BlocFeedController, C as CaptureConfig, F as FeedbackCategory, S as SubmitResult } from './controller-D0bplVji.js';
2
+ export { d as BlocFeedError, e as BlocFeedStrings, f as BlocFeedUser, g as CaptureDiagnostics, h as CaptureResult, i as ConsoleEntry, D as DiagnosticsConfig, E as ElementDescriptor, j as FeedbackApiResponse, k as FeedbackPayload, I as ImageAsset, M as MaybePromise, l as MetadataConfig, m as MetadataContext, N as NetworkEntry, P as PickerConfig, R as Rect, n as ScreenshotAdapter, o as ScreenshotAdapterOptions, p as ScreenshotIntent, q as ScreenshotMime, r as SecurityConfig, s as SecurityFinding, t as SecuritySnapshot, u as SessionPhase, T as ThemeConfig, v as TransportConfig, w as TransportResult, x as TriggerStyle, W as WidgetPosition } from './controller-D0bplVji.js';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as react from 'react';
5
5
  import { ReactNode } from 'react';
package/dist/main.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import {k,l,o,m,p,a,j,i,b as b$1}from'./chunk-LAK7UUTC.js';import {createContext,forwardRef,useState,useEffect,useRef,useMemo,useImperativeHandle,useCallback,useContext}from'react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {createPortal}from'react-dom';import {AnimatePresence,motion}from'framer-motion';var U=createContext(null);function ee(e){let t=useMemo(()=>j({...e.config??{},blocfeed_id:e.blocfeed_id}),[]),[n,o]=useState(()=>t.getState());return useEffect(()=>t.subscribe(o),[t]),useEffect(()=>t.setConfig({...e.config??{},blocfeed_id:e.blocfeed_id}),[t,e.config,e.blocfeed_id]),useEffect(()=>()=>t.destroy(),[t]),jsx(U.Provider,{value:{controller:t,state:n},children:e.children})}var we="blocfeed-styles-v1",xt=`
2
+ import {k,l,o,m,p,a,j,i,b as b$1}from'./chunk-2BPYL6WQ.js';import {createContext,forwardRef,useState,useEffect,useRef,useMemo,useImperativeHandle,useCallback,useContext}from'react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {createPortal}from'react-dom';import {AnimatePresence,motion}from'framer-motion';var U=createContext(null);function ee(e){let t=useMemo(()=>j({...e.config??{},blocfeed_id:e.blocfeed_id}),[]),[n,o]=useState(()=>t.getState());return useEffect(()=>t.subscribe(o),[t]),useEffect(()=>t.setConfig({...e.config??{},blocfeed_id:e.blocfeed_id}),[t,e.config,e.blocfeed_id]),useEffect(()=>()=>t.destroy(),[t]),jsx(U.Provider,{value:{controller:t,state:n},children:e.children})}var we="blocfeed-styles-v1",xt=`
3
3
  :where([data-blocfeed-ui-root]),
4
4
  :where([data-blocfeed-ui-root]) * {
5
5
  box-sizing: border-box;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blocfeed",
3
- "version": "0.7.1",
3
+ "version": "0.7.3",
4
4
  "description": "Drop-in feedback + screenshot widget for React.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,2 +0,0 @@
1
- 'use strict';function w(){return typeof window<"u"&&typeof document<"u"}function ue(e){let t=globalThis.CSS;return typeof t?.escape=="function"?t.escape(e):e.replace(/[^a-zA-Z0-9_-]/g,n=>{let r=n.codePointAt(0);return r===void 0?"":`\\${r.toString(16)} `})}function Y(e){return {x:e.x,y:e.y,width:e.width,height:e.height}}function Be(e){return {x:e.x+window.scrollX,y:e.y+window.scrollY,width:e.width,height:e.height}}function De(e){return e.replace(/\s+/g," ").trim()}function Oe(e,t=140){let n=e.textContent;if(!n)return;let r=De(n);if(r)return r.length<=t?r:`${r.slice(0,t-1)}\u2026`}function Ue(e){let t=1;for(let n=e.previousElementSibling;n;n=n.previousElementSibling)n.tagName===e.tagName&&(t+=1);return t}var pe=["data-testid","data-test-id","data-test","data-qa","data-cy"],de="data-blocfeed-component";function He(e){let t=e.closest(`[${de}]`);if(!t)return;let r=t.getAttribute(de)?.trim();return r||void 0}function qe(e){for(let t of pe){let n=e.closest(`[${t}]`);if(!n)continue;let o=n.getAttribute(t)?.trim();if(o)return o}}function fe(e){try{let t=e,n=Object.getOwnPropertyNames(t);for(let r of n)if(r.startsWith("__reactFiber$")||r.startsWith("__reactInternalInstance$")){let o=t[r];if(o&&typeof o=="object")return o}}catch{}return null}function T(e){if(e.length<=1||e.length===2&&e[0]===e[0].toLowerCase())return true;let t=e[0];return t>="a"&&t<="z"}function I(e){if(e){for(let t of e)if(typeof t.name=="string"&&t.name&&!T(t.name))return t.name}}function k(e){if(e&&typeof e!="string"){if(typeof e=="function"){let t=e;return typeof t.displayName=="string"&&t.displayName?t.displayName:typeof t.name=="string"&&t.name?t.name:void 0}if(typeof e=="object"){let t=e,n=t.displayName;if(typeof n=="string"&&n)return n;let r=t.render;if(typeof r=="function"){let i=r;if(typeof i.displayName=="string"&&i.displayName)return i.displayName;if(typeof i.name=="string"&&i.name)return i.name}let o=t.type;return k(o)}}}function $e(e){let t=fe(e);if(!t)return;let n=I(t._debugInfo);if(n)return n;let r=t._debugOwner!==void 0;if(r){let a=t._debugOwner;for(let l=0;a&&l<50;l+=1){let d=I(a._debugInfo);if(d)return d;let g=k(a.type)??k(a.elementType);if(g&&!T(g))return g;a=a._debugOwner;}}if(t._owner!==void 0&&t._owner!==t._debugOwner){let a=t._owner;for(let l=0;a&&l<50;l+=1){let d=I(a._debugInfo);if(d)return d;let g=k(a.type)??k(a.elementType);if(g&&!T(g))return g;a=a._owner;}}let i=t,s=r?80:25;for(let a=0;i&&a<s;a+=1){let l=I(i._debugInfo);if(l)return l;let d=k(i.type)??k(i.elementType);if(d&&!T(d))return d;i=i.return;}let c=e.parentElement;for(let a=0;c&&a<15;a+=1){let l=fe(c);if(l){let d=I(l._debugInfo);if(d)return d;let g=k(l.type)??k(l.elementType);if(g&&!T(g))return g;if(l._debugOwner){let h=k(l._debugOwner.type)??k(l._debugOwner.elementType);if(h&&!T(h))return h}if(l._owner&&l._owner!==l._debugOwner){let h=k(l._owner.type)??k(l._owner.elementType);if(h&&!T(h))return h}}c=c.parentElement;}}function ze(e){let t=e.tagName.toLowerCase(),n=e.getAttribute("id");if(n)return `#${ue(n)}`;for(let r of pe){let o=e.getAttribute(r);if(o)return `${t}[${r}="${ue(o)}"]`}return `${t}:nth-of-type(${Ue(e)})`}function Xe(e,t=10){let n=[],r=e;for(;r&&n.length<t;){let o=ze(r);if(n.unshift(o),o.startsWith("#"))break;r=r.parentElement;}return n.join(" > ")}function me(e,t){if(!t||t.length===0)return false;for(let n of t)if(e.closest(n))return true;return false}function J(e,t){if(!e||me(e,t.ignoreSelectors))return null;let n=e;for(;n;){if(me(n,t.ignoreSelectors))return null;if(t.isSelectable?.(n)??Ze(n))return n;n=n.parentElement;}return null}function Ze(e){let t=e.tagName;return !(t==="HTML"||t==="BODY")}function ge(e){let t=e.getBoundingClientRect(),n={selector:Xe(e),tagName:e.tagName.toLowerCase(),rect:Y(t),pageRect:Be(t)},r=e.getAttribute("id");r&&(n.id=r);let o=e.className;typeof o=="string"&&o.trim()&&(n.className=o);let i=Oe(e);i&&(n.textSnippet=i);let s=He(e)??$e(e);s&&(n.componentName=s);let c=qe(e);return c&&(n.testId=c),n}var G=null;async function he(){return G||(G=import('html-to-image')),G}async function je(e){return await new Promise((t,n)=>{let r=new Image;r.onload=()=>t({width:r.naturalWidth,height:r.naturalHeight}),r.onerror=()=>n(new Error("Failed to load generated screenshot")),r.src=e;})}async function we(e,t){let{width:n,height:r}=await je(e);return {dataUrl:e,mime:t,width:n,height:r}}function L(e){if(e?.aborted)throw new Error("Aborted")}function ye(){return {async captureElement(e,t){if(!w())throw new Error("captureElement can only run in the browser");L(t.signal);let n=await he();L(t.signal);let r=t.mime==="image/jpeg"?await n.toJpeg(e,{quality:t.quality??.92,pixelRatio:t.pixelRatio}):await n.toPng(e,{pixelRatio:t.pixelRatio});return L(t.signal),await we(r,t.mime)},async captureFullPage(e){if(!w())throw new Error("captureFullPage can only run in the browser");L(e.signal);let t=document.documentElement,n=Math.max(t.scrollWidth,t.clientWidth),r=Math.max(t.scrollHeight,t.clientHeight),o=Math.min(1,e.maxDimension/Math.max(n,r)),i=Math.max(1,Math.round(n*o)),s=Math.max(1,Math.round(r*o)),c=await he();L(e.signal);let a=e.mime==="image/jpeg"?await c.toJpeg(t,{width:i,height:s,quality:e.quality??.92,pixelRatio:e.pixelRatio}):await c.toPng(t,{width:i,height:s,pixelRatio:e.pixelRatio});return L(e.signal),await we(a,e.mime)}}}function We(e){if(e instanceof Error)return e.message;if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return "Unknown error"}}function y(e,t,n){let r={kind:e,message:We(t)};return n&&(r.detail=n),r}var Ke=12e3,Qe=2048,Ye=.92;function be(){return Date.now()}function Je(e){return new Promise((t,n)=>{let r=()=>n(new Error("Aborted"));if(e.aborted){r();return}e.addEventListener("abort",r,{once:true});})}async function Ee(e,t,n){let r=new Promise((i,s)=>{let c=setTimeout(()=>s(new Error("Timeout")),t);typeof c.unref=="function"&&c.unref();}),o=[e,r];return n&&o.push(Je(n)),await Promise.race(o)}function Ge(e){if(!w())return 1;let t=window.devicePixelRatio||1,n=e?.pixelRatio??Math.min(t,2);return Math.max(.1,n)}function Ve(e){return !!(e?.element||e?.fullPage)}function _e(e){let t={mime:e.mime,pixelRatio:e.pixelRatio,maxDimension:e.maxDimension};return e.includeQuality&&(t.quality=e.quality),e.signal&&(t.signal=e.signal),t}async function Se(e){let{selectionElement:t,capture:n,signal:r}=e;if(!w()||!Ve(n))return;let o=be(),i=[],s=n?.timeoutMs??Ke,c=n?.maxDimension??Qe,a=n?.mime??"image/png",l=n?.quality??Ye,d=n?.adapter??ye(),g={},h=Ge(n);if(n?.element&&t)try{let f=t.getBoundingClientRect(),m=Math.min(1,c/Math.max(f.width,f.height)),v=Math.min(h,h*m),A=await Ee(Promise.resolve(d.captureElement(t,{..._e({mime:a,quality:l,pixelRatio:v,maxDimension:c,includeQuality:a==="image/jpeg",...r?{signal:r}:{}})})),s,r);g.element=A;}catch(f){if(r?.aborted)throw f;i.push(y("capture_failed",f,{target:"element"}));}if(n?.fullPage)try{let f=await Ee(Promise.resolve(d.captureFullPage(_e({mime:a,quality:l,pixelRatio:h,maxDimension:c,includeQuality:a==="image/jpeg",...r?{signal:r}:{}}))),s,r);g.fullPage=f;}catch(f){if(r?.aborted)throw f;i.push(y("capture_failed",f,{target:"fullPage"}));}let b=be(),u={startedAt:o,finishedAt:b,durationMs:Math.max(0,b-o)};return i.length>0&&(u.errors=i),{...g,diagnostics:u}}function et(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function tt(){return w()?{url:window.location.href,title:document.title,referrer:document.referrer||void 0,userAgent:navigator.userAgent,language:navigator.language,platform:navigator.platform,viewport:{width:window.innerWidth,height:window.innerHeight},screen:{width:window.screen.width,height:window.screen.height},scroll:{x:window.scrollX,y:window.scrollY},devicePixelRatio:window.devicePixelRatio||1,timezone:et()}:{}}function nt(e){if(!e)return {};let t={};return e.id&&(t.userId=e.id),e.email&&(t.userEmail=e.email),e.name&&(t.userName=e.name),t}async function ke(e){let{config:t,context:n,user:r}=e;if(t?.enabled===false)return {};let o={...tt(),...nt(r)},i=t?.enrich;if(!i)return o;try{let s=await i(n);return {...o,...s}}catch(s){let c=y("unknown",s);return {...o,blocfeedMetadataError:c.message}}}var V="blocfeed-queue",rt=50;function ee(){if(!w())return [];try{let e=localStorage.getItem(V);if(!e)return [];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return []}}function te(e){if(w())try{e.length===0?localStorage.removeItem(V):localStorage.setItem(V,JSON.stringify(e));}catch{}}function ot(e){let t={...e};if(t.screenshots){let n={...t.screenshots};n.element&&(n.element={...n.element,dataUrl:""}),n.fullPage&&(n.fullPage={...n.fullPage,dataUrl:""}),t.screenshots=n;}return t}function ne(e){let t=ee(),n=ot(e);for(n.metadata={...n.metadata,_queued:true},t.push({payload:n,timestamp:Date.now()});t.length>rt;)t.shift();te(t);}function ve(){let e=ee();return e.length===0?[]:(te([]),e.map(t=>t.payload))}function Ot(){te([]);}function Ut(){return ee().length}function re(e){let t=null,n=null,r=(...o)=>{n=o,t===null&&(t=requestAnimationFrame(()=>{if(t=null,!n)return;let i=n;n=null,e(...i);}));};return r.cancel=()=>{t!==null&&cancelAnimationFrame(t),t=null,n=null;},r}function X(e){return e instanceof Element?!!e.closest("[data-blocfeed-ui]"):false}function Z(e){e.stopPropagation(),e.stopImmediatePropagation?.();}function Pe(e,t){if(!w())throw new Error("BlocFeed picker can only run in a browser environment.");let n=e.ignoreSelectors,r=e.isSelectable,o={};n&&n.length>0&&(o.ignoreSelectors=n),r&&(o.isSelectable=r);let i=null,s=null,c=(u,f=false)=>{if(!u){i=null,s=null,t.onHover(null);return}let m=Y(u.getBoundingClientRect()),v=`${Math.round(m.x)}:${Math.round(m.y)}:${Math.round(m.width)}:${Math.round(m.height)}`;!f&&u===i&&v===s||(i=u,s=v,t.onHover({element:u,rect:m}));},a=re(u=>{if(X(u.target))return;let f=document.elementFromPoint(u.clientX,u.clientY),m=J(f,o);c(m);}),l=re(()=>{i&&c(i,true);}),d=u=>{X(u.target)||(Z(u),u.pointerType==="mouse"&&u.preventDefault());},g=u=>{X(u.target)||(Z(u),u.pointerType==="mouse"&&u.preventDefault());},h=u=>{if(X(u.target))return;Z(u),u.preventDefault();let f=document.elementFromPoint(u.clientX,u.clientY),m=J(f,o);m&&t.onSelect({element:m,descriptor:ge(m)});},b=u=>{u.key==="Escape"&&(Z(u),u.preventDefault(),t.onCancel());};return window.addEventListener("pointermove",a,{capture:true,passive:true}),window.addEventListener("pointerdown",d,{capture:true}),window.addEventListener("pointerup",g,{capture:true}),window.addEventListener("click",h,{capture:true}),window.addEventListener("keydown",b,{capture:true}),window.addEventListener("scroll",l,{capture:true,passive:true}),window.addEventListener("resize",l,{passive:true}),{stop(){window.removeEventListener("pointermove",a,{capture:true}),window.removeEventListener("pointerdown",d,{capture:true}),window.removeEventListener("pointerup",g,{capture:true}),window.removeEventListener("click",h,{capture:true}),window.removeEventListener("keydown",b,{capture:true}),window.removeEventListener("scroll",l,{capture:true}),window.removeEventListener("resize",l),a.cancel(),l.cancel(),t.onHover(null);}}}var it=12e3,at=2,st=500,ct=2e3,Re="https://blocfeed.com/api/feedback",Ae=0;function xe(e,t){return new Promise((n,r)=>{if(t?.aborted){r(new Error("Aborted"));return}let o=setTimeout(n,e),i=()=>{clearTimeout(o),r(new Error("Aborted"));};t?.addEventListener("abort",i,{once:true});})}function lt(e){return e>=500&&e<=599}function ut(e){let[t,n]=e.split(",",2);if(!t||!n)throw new Error("Invalid data URL");let o=/data:(.*?);base64/.exec(t)?.[1]||"application/octet-stream",i=atob(n),s=new Uint8Array(i.length);for(let c=0;c<i.length;c+=1)s[c]=i.charCodeAt(c);return new Blob([s],{type:o})}function dt(e){let t={},n={...e};if(n.screenshots){let r={},o={...n.screenshots};o.element&&(t.element=o.element.dataUrl,r.element={mime:o.element.mime,width:o.element.width,height:o.element.height},o.element={...o.element,dataUrl:""}),o.fullPage&&(t.fullPage=o.fullPage.dataUrl,r.fullPage={mime:o.fullPage.mime,width:o.fullPage.width,height:o.fullPage.height},o.fullPage={...o.fullPage,dataUrl:""}),n.screenshots=o,(r.element||r.fullPage)&&(n.screenshot_intent=r);}return {lean:n,extracted:t}}async function Te(e,t,n){let r=ut(t);await fetch(e,{method:"PUT",body:r,headers:{"content-type":r.type},...n?{signal:n}:{}});}async function ft(e){let{feedbackId:t,extracted:n,screenshots:r,signal:o}=e,i={};n.element&&r?.element&&(i.element={dataUrl:n.element,mime:r.element.mime,width:r.element.width,height:r.element.height}),n.fullPage&&r?.fullPage&&(i.fullPage={dataUrl:n.fullPage,mime:r.fullPage.mime,width:r.fullPage.width,height:r.fullPage.height}),Object.keys(i).length!==0&&await fetch(`${Re}/${t}/screenshots`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(i),...o?{signal:o}:{}});}async function Fe(e){let{signal:t,transport:n}=e;if(Date.now()-Ae<ct)return {ok:false,error:y("configuration",new Error("Please wait before submitting again"))};let o=n?.timeoutMs??it,i=n?.maxAttempts??at,s=n?.backoffMs??st,c=!!(e.payload.screenshots?.element?.dataUrl||e.payload.screenshots?.fullPage?.dataUrl),{lean:a,extracted:l}=c?dt(e.payload):{lean:e.payload,extracted:{}},d={...l,...e.screenshotDataUrls};for(let g=1;g<=i;g+=1){let h=new AbortController,b=setTimeout(()=>h.abort(),o),u=()=>h.abort();t&&t.addEventListener("abort",u,{once:true});try{let f=await fetch(Re,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(a),signal:h.signal});if(f.ok){Ae=Date.now();let m;try{m=await f.json();}catch{}if((d.element||d.fullPage)&&m){let p=m.upload_urls;if(p){let _=[];d.element&&p.element&&_.push(Te(p.element,d.element,t)),d.fullPage&&p.fullPage&&_.push(Te(p.fullPage,d.fullPage,t));try{await Promise.all(_);}catch{}}else if(m.feedback_id)try{await ft({feedbackId:m.feedback_id,extracted:d,screenshots:e.payload.screenshots,...t?{signal:t}:{}});}catch{}}let A={ok:!0,status:f.status};return m&&(A.apiResponse=m),A}if(g<i&&lt(f.status)){let m=.85+Math.random()*.3,v=Math.round(s*2**(g-1)*m);await xe(v,t);continue}return {ok:!1,status:f.status,error:y("api_failed",new Error(`HTTP ${f.status}`))}}catch(f){if(h.signal.aborted||t?.aborted)return {ok:false,error:y("aborted",f)};if(g<i){let m=.85+Math.random()*.3,v=Math.round(s*2**(g-1)*m);await xe(v,t);continue}return {ok:false,error:y("api_failed",f)}}finally{clearTimeout(b),t&&t.removeEventListener("abort",u);}}return {ok:false,error:y("api_failed",new Error("Failed"))}}async function oe(e){let{signal:t,transport:n}=e,r={ok:false};try{let o={payload:e.payload,...t?{signal:t}:{},...n?{transport:n}:{}};r.api=await Fe(o),r.ok=!!r.api?.ok;}catch(o){r.api={ok:false,error:y("api_failed",o)},r.ok=false;}return {payload:e.payload,result:r}}var mt=["[data-blocfeed-ui]","[data-blocfeed-ignore]"];function pt(e){let t=[...mt,...e?.ignoreSelectors??[]],n=Array.from(new Set(t));return {...e,ignoreSelectors:n}}function Ce(){return {phase:"idle"}}function gt(e){if(e.ok)return false;let t=e.api;return t?t.status&&t.status>=400&&t.status<500||t.error?.kind==="aborted"||t.error?.kind==="configuration"?false:!t.ok:true}function rn(e){let t=e,n=Ce(),r=new Set,o=new Set,i=null,s=null,c=null,a=null,l=0,d=null,g=()=>{for(let p of r)p(n);},h=p=>{for(let _ of o)_(p);},b=p=>{n=p,g();},u=()=>{l+=1,a?.abort(),a=null;},f=()=>{i?.stop(),i=null,h(null),c!==null&&w()&&(document.documentElement.style.cursor=c,c=null);},m=()=>{u(),f(),s=null,b(Ce());},v=()=>{if(!w())return;f(),s=null;let p=pt(t.picker);c=document.documentElement.style.cursor,document.documentElement.style.cursor="crosshair",b({phase:"picking"}),i=Pe(p,{onHover:h,onSelect:({element:_,descriptor:z})=>{s=_,f(),b({phase:"review",selection:z});},onCancel:()=>{m();}});},A=()=>{let p=ve();if(p.length!==0)for(let _ of p)oe({payload:_,...t.transport?{transport:t.transport}:{}}).catch(()=>{ne(_);});};if(w()){setTimeout(A,1e3);let p=()=>A();window.addEventListener("online",p),d=()=>window.removeEventListener("online",p);}return {getState:()=>n,subscribe(p){return r.add(p),()=>r.delete(p)},subscribeHover(p){return o.add(p),()=>o.delete(p)},start(){n.phase==="capturing"||n.phase==="submitting"||n.phase!=="picking"&&v();},stop(){m();},clearSelection(){n.phase==="capturing"||n.phase==="submitting"||v();},setConfig(p){t=p;},async submit(p,_){if(!w()){let E=y("configuration",new Error("BlocFeed submit can only run in the browser"));return b({phase:"error",lastError:E}),{ok:false}}let z=t.blocfeed_id?.trim?.()??"";if(!z){let x={phase:"error",lastError:y("configuration",new Error("Missing blocfeed_id. Create a project in BlocFeed and pass its blocfeed_id."))};return n.selection&&(x.selection=n.selection),b(x),{ok:false}}if(n.phase==="capturing"||n.phase==="submitting")return {ok:false};let N=l+1;l=N,a?.abort(),a=new AbortController;let F=a.signal,S=n.selection,W=_?.capture?{...t.capture,..._.capture}:t.capture,ce=!!(W?.element||W?.fullPage),le={phase:ce?"capturing":"submitting"};S&&(le.selection=S),b(le);try{let E=ce?await Se({selectionElement:s,capture:W,signal:F}):void 0;if(F.aborted||l!==N)return {ok:!1};let x={phase:"submitting"};S&&(x.selection=S),E&&(x.capture=E),b(x);let C={};S&&(C.selection=S),E&&(C.capture=E);let Ne=await ke({config:t.metadata,context:C,...t.user?{user:t.user}:{}}),M={version:1,createdAt:new Date().toISOString(),blocfeed_id:z,message:p,metadata:Ne};_?.category&&(M.category=_.category),t.user&&(M.user=t.user),S&&(M.selection=S),E&&(M.screenshots=E);let{result:P}=await oe({payload:M,signal:F,...t.transport?{transport:t.transport}:{}});if(F.aborted||l!==N)return P;if(P.ok){let Q={phase:"success",lastSubmit:P};return S&&(Q.selection=S),E&&(Q.capture=E),b(Q),P}gt(P)&&ne(M);let Ie=P.api?.error??y("unknown",new Error("Submission failed")),K={phase:"error",lastSubmit:P,lastError:Ie};return S&&(K.selection=S),E&&(K.capture=E),b(K),P}catch(E){if(F.aborted||l!==N)return {ok:false};let C={phase:"error",lastError:F.aborted?y("aborted",E):y("unknown",E)};return S&&(C.selection=S),b(C),{ok:false}}finally{l===N&&(a=null);}},__unsafeGetSelectedElement(){return s},destroy(){m(),r.clear(),o.clear(),d?.(),d=null;}}}var B=[],D=[],Me=20,Le=15,O={},U=null,H=null,q=null,j=false;function ht(e){if(e instanceof Error)return e.message;if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function wt(e,t){let n=t.map(ht).join(" "),r=t.find(i=>i instanceof Error),o={level:e,message:n.slice(0,2e3),timestamp:Date.now()};for(r?.stack&&(o.stack=r.stack.slice(0,2e3)),B.push(o);B.length>Me;)B.shift();}function ie(e){if(!e.url.includes("blocfeed.com"))for(D.push(e);D.length>Le;)D.shift();}function sn(e={}){if(!(j||!w())){if(j=true,Me=e.consoleLimit??20,Le=e.networkLimit??15,e.console!==false){let t=e.consoleLevels??["error","warn"];for(let n of t)O[n]=console[n],console[n]=(...r)=>{wt(n,r),O[n]?.apply(console,r);};}if(e.network!==false&&typeof window.fetch=="function"){U=window.fetch;let t=U;window.fetch=async function(r,o){let i=typeof r=="string"?r:r instanceof URL?r.toString():r.url,s=(o?.method??"GET").toUpperCase(),c=Date.now();try{let a=await t.call(window,r,o);return a.ok||ie({url:i.slice(0,500),method:s,status:a.status,statusText:a.statusText,timestamp:c,durationMs:Date.now()-c}),a}catch(a){throw ie({url:i.slice(0,500),method:s,status:0,statusText:a instanceof Error?a.message:"Network error",timestamp:c,durationMs:Date.now()-c}),a}};}if(e.network!==false&&typeof XMLHttpRequest<"u"){H=XMLHttpRequest.prototype.open,q=XMLHttpRequest.prototype.send;let t=H,n=q;XMLHttpRequest.prototype.open=function(r,o,...i){return this.__bf_method=r.toUpperCase(),this.__bf_url=String(o),t.apply(this,[r,o,...i])},XMLHttpRequest.prototype.send=function(...r){let o=this.__bf_method||"GET",i=this.__bf_url||"",s=Date.now();return this.addEventListener("loadend",function(){if(this.status>=400||this.status===0){let c={url:i.slice(0,500),method:o,status:this.status,timestamp:s,durationMs:Date.now()-s};this.statusText&&(c.statusText=this.statusText),ie(c);}}),n.apply(this,r)};}}}function cn(){if(j){for(let[e,t]of Object.entries(O))console[e]=t;for(let e of Object.keys(O))delete O[e];U&&(window.fetch=U,U=null),H&&(XMLHttpRequest.prototype.open=H,H=null),q&&(XMLHttpRequest.prototype.send=q,q=null),j=false;}}function ln(){return {consoleLogs:[...B],networkErrors:[...D]}}function un(){B=[],D=[];}var yt=[{name:"supabase_service_role_key",pattern:/SUPABASE_SERVICE_ROLE_KEY["'=:\s]+[A-Za-z0-9_.=-]{30,}/},{name:"supabase_db_password",pattern:/SUPABASE_DB_PASSWORD["'=:\s]+[^\s"']{6,}/},{name:"postgres_password",pattern:/POSTGRES_PASSWORD["'=:\s]+[^\s"']{6,}/},{name:"database_url_with_creds",pattern:/(?:postgres|postgresql|mysql|mongodb|redis|amqp):\/\/[^:]+:[^@\s"']+@/},{name:"aws_access_key",pattern:/AKIA[0-9A-Z]{16}/},{name:"aws_secret_key",pattern:/AWS_SECRET_ACCESS_KEY["'=:\s]+[A-Za-z0-9/+=]{30,}/},{name:"aws_session_token",pattern:/AWS_SESSION_TOKEN["'=:\s]+[A-Za-z0-9/+=]{30,}/},{name:"stripe_secret_key",pattern:/sk_live_[a-zA-Z0-9]{10,}/},{name:"stripe_secret_key_test",pattern:/sk_test_[a-zA-Z0-9]{10,}/},{name:"stripe_restricted_key",pattern:/rk_(?:live|test)_[a-zA-Z0-9]{10,}/},{name:"github_pat",pattern:/ghp_[A-Za-z0-9_]{36,}/},{name:"github_oauth",pattern:/gho_[A-Za-z0-9_]{36,}/},{name:"github_user_token",pattern:/ghu_[A-Za-z0-9_]{36,}/},{name:"github_server_token",pattern:/ghs_[A-Za-z0-9_]{36,}/},{name:"github_fine_grained",pattern:/github_pat_[A-Za-z0-9_]{22,}/},{name:"openai_api_key",pattern:/sk-[a-zA-Z0-9]{20,}(?![a-zA-Z0-9_])/},{name:"anthropic_api_key",pattern:/sk-ant-[a-zA-Z0-9\-_]{20,}/},{name:"private_key",pattern:/-----BEGIN (?:RSA |EC |DSA |OPENSSH |PGP )?PRIVATE KEY-----/},{name:"sendgrid_api_key",pattern:/SG\.[a-zA-Z0-9_-]{22,}\.[a-zA-Z0-9_-]{22,}/},{name:"twilio_auth_token",pattern:/TWILIO_AUTH_TOKEN["'=:\s]+[a-f0-9]{32}/},{name:"generic_secret_key",pattern:/[A-Z_]{2,}_SECRET_KEY["'=:\s]+[^\s"']{8,}/},{name:"generic_secret",pattern:/[A-Z_]{2,}_SECRET["'=:\s]+[^\s"']{8,}/},{name:"generic_password",pattern:/[A-Z_]{2,}_PASSWORD["'=:\s]+[^\s"']{6,}/},{name:"generic_private_key_var",pattern:/[A-Z_]{2,}_PRIVATE_KEY["'=:\s]+[^\s"']{8,}/}],R=[],se=0,ae=false;function bt(e){let t=e.slice(0,80);return t.length<=6?"***":t.slice(0,6)+"***"}function Et(e,t,n,r){if(R.some(s=>s.rule===e&&s.source===t))return;let i={rule:e,source:t,hint:bt(n),timestamp:Date.now()};r&&(i.location=r),R.push(i);}function $(e,t,n,r){for(let{name:o,pattern:i}of n){let s=i.exec(e);s&&Et(o,t,s[0],r);}}function _t(e){try{let t=window;if(t.__NEXT_DATA__){let n=JSON.stringify(t.__NEXT_DATA__);$(n,"hydration",e,"__NEXT_DATA__");}if(t.__NUXT__){let n=JSON.stringify(t.__NUXT__);$(n,"hydration",e,"__NUXT__");}}catch{}}function St(e){try{document.querySelectorAll("script:not([src])").forEach((n,r)=>{let o=n.textContent;o&&o.length>0&&$(o,"scripts",e,`inline-script[${r}]`);});}catch{}}function kt(e){try{document.querySelectorAll("meta[content]").forEach(n=>{let r=n.getAttribute("content"),o=n.getAttribute("name")||n.getAttribute("property")||"";r&&r.length>10&&$(r,"meta",e,o?`meta[${o}]`:void 0);});}catch{}}function vt(e){try{document.querySelectorAll("[data-api-key], [data-secret], [data-token], [data-password]").forEach(n=>{let r=n.attributes;for(let o=0;o<r.length;o++){let i=r[o];i.name.startsWith("data-")&&i.value.length>10&&$(i.value,"dom",e,`${n.tagName.toLowerCase()}[${i.name}]`);}});}catch{}}function mn(e={}){if(ae||!w()||(ae=true,e.secretScan===false))return;let t=[...yt,...e.customPatterns??[]],n=e.scanTargets??["hydration","scripts","meta","dom"];setTimeout(()=>{se=Date.now(),n.includes("hydration")&&_t(t),n.includes("scripts")&&St(t),n.includes("meta")&&kt(t),n.includes("dom")&&vt(t);let r=e.notify??"both";R.length>0&&(r==="console"||r==="both")&&console.warn(`[BlocFeed Security] Found ${R.length} potential secret(s) exposed in client code:`,R.map(o=>`${o.rule} (${o.source}${o.location?`: ${o.location}`:""})`));},100);}function pn(){return {findings:[...R],scannedAt:se}}function gn(){R=[],se=0,ae=false;}
2
- exports.a=w;exports.b=Y;exports.c=ye;exports.d=Se;exports.e=ke;exports.f=ne;exports.g=ve;exports.h=Ot;exports.i=Ut;exports.j=rn;exports.k=sn;exports.l=cn;exports.m=ln;exports.n=un;exports.o=mn;exports.p=pn;exports.q=gn;
@@ -1,2 +0,0 @@
1
- function w(){return typeof window<"u"&&typeof document<"u"}function ue(e){let t=globalThis.CSS;return typeof t?.escape=="function"?t.escape(e):e.replace(/[^a-zA-Z0-9_-]/g,n=>{let r=n.codePointAt(0);return r===void 0?"":`\\${r.toString(16)} `})}function Y(e){return {x:e.x,y:e.y,width:e.width,height:e.height}}function Be(e){return {x:e.x+window.scrollX,y:e.y+window.scrollY,width:e.width,height:e.height}}function De(e){return e.replace(/\s+/g," ").trim()}function Oe(e,t=140){let n=e.textContent;if(!n)return;let r=De(n);if(r)return r.length<=t?r:`${r.slice(0,t-1)}\u2026`}function Ue(e){let t=1;for(let n=e.previousElementSibling;n;n=n.previousElementSibling)n.tagName===e.tagName&&(t+=1);return t}var pe=["data-testid","data-test-id","data-test","data-qa","data-cy"],de="data-blocfeed-component";function He(e){let t=e.closest(`[${de}]`);if(!t)return;let r=t.getAttribute(de)?.trim();return r||void 0}function qe(e){for(let t of pe){let n=e.closest(`[${t}]`);if(!n)continue;let o=n.getAttribute(t)?.trim();if(o)return o}}function fe(e){try{let t=e,n=Object.getOwnPropertyNames(t);for(let r of n)if(r.startsWith("__reactFiber$")||r.startsWith("__reactInternalInstance$")){let o=t[r];if(o&&typeof o=="object")return o}}catch{}return null}function T(e){if(e.length<=1||e.length===2&&e[0]===e[0].toLowerCase())return true;let t=e[0];return t>="a"&&t<="z"}function I(e){if(e){for(let t of e)if(typeof t.name=="string"&&t.name&&!T(t.name))return t.name}}function k(e){if(e&&typeof e!="string"){if(typeof e=="function"){let t=e;return typeof t.displayName=="string"&&t.displayName?t.displayName:typeof t.name=="string"&&t.name?t.name:void 0}if(typeof e=="object"){let t=e,n=t.displayName;if(typeof n=="string"&&n)return n;let r=t.render;if(typeof r=="function"){let i=r;if(typeof i.displayName=="string"&&i.displayName)return i.displayName;if(typeof i.name=="string"&&i.name)return i.name}let o=t.type;return k(o)}}}function $e(e){let t=fe(e);if(!t)return;let n=I(t._debugInfo);if(n)return n;let r=t._debugOwner!==void 0;if(r){let a=t._debugOwner;for(let l=0;a&&l<50;l+=1){let d=I(a._debugInfo);if(d)return d;let g=k(a.type)??k(a.elementType);if(g&&!T(g))return g;a=a._debugOwner;}}if(t._owner!==void 0&&t._owner!==t._debugOwner){let a=t._owner;for(let l=0;a&&l<50;l+=1){let d=I(a._debugInfo);if(d)return d;let g=k(a.type)??k(a.elementType);if(g&&!T(g))return g;a=a._owner;}}let i=t,s=r?80:25;for(let a=0;i&&a<s;a+=1){let l=I(i._debugInfo);if(l)return l;let d=k(i.type)??k(i.elementType);if(d&&!T(d))return d;i=i.return;}let c=e.parentElement;for(let a=0;c&&a<15;a+=1){let l=fe(c);if(l){let d=I(l._debugInfo);if(d)return d;let g=k(l.type)??k(l.elementType);if(g&&!T(g))return g;if(l._debugOwner){let h=k(l._debugOwner.type)??k(l._debugOwner.elementType);if(h&&!T(h))return h}if(l._owner&&l._owner!==l._debugOwner){let h=k(l._owner.type)??k(l._owner.elementType);if(h&&!T(h))return h}}c=c.parentElement;}}function ze(e){let t=e.tagName.toLowerCase(),n=e.getAttribute("id");if(n)return `#${ue(n)}`;for(let r of pe){let o=e.getAttribute(r);if(o)return `${t}[${r}="${ue(o)}"]`}return `${t}:nth-of-type(${Ue(e)})`}function Xe(e,t=10){let n=[],r=e;for(;r&&n.length<t;){let o=ze(r);if(n.unshift(o),o.startsWith("#"))break;r=r.parentElement;}return n.join(" > ")}function me(e,t){if(!t||t.length===0)return false;for(let n of t)if(e.closest(n))return true;return false}function J(e,t){if(!e||me(e,t.ignoreSelectors))return null;let n=e;for(;n;){if(me(n,t.ignoreSelectors))return null;if(t.isSelectable?.(n)??Ze(n))return n;n=n.parentElement;}return null}function Ze(e){let t=e.tagName;return !(t==="HTML"||t==="BODY")}function ge(e){let t=e.getBoundingClientRect(),n={selector:Xe(e),tagName:e.tagName.toLowerCase(),rect:Y(t),pageRect:Be(t)},r=e.getAttribute("id");r&&(n.id=r);let o=e.className;typeof o=="string"&&o.trim()&&(n.className=o);let i=Oe(e);i&&(n.textSnippet=i);let s=He(e)??$e(e);s&&(n.componentName=s);let c=qe(e);return c&&(n.testId=c),n}var G=null;async function he(){return G||(G=import('html-to-image')),G}async function je(e){return await new Promise((t,n)=>{let r=new Image;r.onload=()=>t({width:r.naturalWidth,height:r.naturalHeight}),r.onerror=()=>n(new Error("Failed to load generated screenshot")),r.src=e;})}async function we(e,t){let{width:n,height:r}=await je(e);return {dataUrl:e,mime:t,width:n,height:r}}function L(e){if(e?.aborted)throw new Error("Aborted")}function ye(){return {async captureElement(e,t){if(!w())throw new Error("captureElement can only run in the browser");L(t.signal);let n=await he();L(t.signal);let r=t.mime==="image/jpeg"?await n.toJpeg(e,{quality:t.quality??.92,pixelRatio:t.pixelRatio}):await n.toPng(e,{pixelRatio:t.pixelRatio});return L(t.signal),await we(r,t.mime)},async captureFullPage(e){if(!w())throw new Error("captureFullPage can only run in the browser");L(e.signal);let t=document.documentElement,n=Math.max(t.scrollWidth,t.clientWidth),r=Math.max(t.scrollHeight,t.clientHeight),o=Math.min(1,e.maxDimension/Math.max(n,r)),i=Math.max(1,Math.round(n*o)),s=Math.max(1,Math.round(r*o)),c=await he();L(e.signal);let a=e.mime==="image/jpeg"?await c.toJpeg(t,{width:i,height:s,quality:e.quality??.92,pixelRatio:e.pixelRatio}):await c.toPng(t,{width:i,height:s,pixelRatio:e.pixelRatio});return L(e.signal),await we(a,e.mime)}}}function We(e){if(e instanceof Error)return e.message;if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return "Unknown error"}}function y(e,t,n){let r={kind:e,message:We(t)};return n&&(r.detail=n),r}var Ke=12e3,Qe=2048,Ye=.92;function be(){return Date.now()}function Je(e){return new Promise((t,n)=>{let r=()=>n(new Error("Aborted"));if(e.aborted){r();return}e.addEventListener("abort",r,{once:true});})}async function Ee(e,t,n){let r=new Promise((i,s)=>{let c=setTimeout(()=>s(new Error("Timeout")),t);typeof c.unref=="function"&&c.unref();}),o=[e,r];return n&&o.push(Je(n)),await Promise.race(o)}function Ge(e){if(!w())return 1;let t=window.devicePixelRatio||1,n=e?.pixelRatio??Math.min(t,2);return Math.max(.1,n)}function Ve(e){return !!(e?.element||e?.fullPage)}function _e(e){let t={mime:e.mime,pixelRatio:e.pixelRatio,maxDimension:e.maxDimension};return e.includeQuality&&(t.quality=e.quality),e.signal&&(t.signal=e.signal),t}async function Se(e){let{selectionElement:t,capture:n,signal:r}=e;if(!w()||!Ve(n))return;let o=be(),i=[],s=n?.timeoutMs??Ke,c=n?.maxDimension??Qe,a=n?.mime??"image/png",l=n?.quality??Ye,d=n?.adapter??ye(),g={},h=Ge(n);if(n?.element&&t)try{let f=t.getBoundingClientRect(),m=Math.min(1,c/Math.max(f.width,f.height)),v=Math.min(h,h*m),A=await Ee(Promise.resolve(d.captureElement(t,{..._e({mime:a,quality:l,pixelRatio:v,maxDimension:c,includeQuality:a==="image/jpeg",...r?{signal:r}:{}})})),s,r);g.element=A;}catch(f){if(r?.aborted)throw f;i.push(y("capture_failed",f,{target:"element"}));}if(n?.fullPage)try{let f=await Ee(Promise.resolve(d.captureFullPage(_e({mime:a,quality:l,pixelRatio:h,maxDimension:c,includeQuality:a==="image/jpeg",...r?{signal:r}:{}}))),s,r);g.fullPage=f;}catch(f){if(r?.aborted)throw f;i.push(y("capture_failed",f,{target:"fullPage"}));}let b=be(),u={startedAt:o,finishedAt:b,durationMs:Math.max(0,b-o)};return i.length>0&&(u.errors=i),{...g,diagnostics:u}}function et(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function tt(){return w()?{url:window.location.href,title:document.title,referrer:document.referrer||void 0,userAgent:navigator.userAgent,language:navigator.language,platform:navigator.platform,viewport:{width:window.innerWidth,height:window.innerHeight},screen:{width:window.screen.width,height:window.screen.height},scroll:{x:window.scrollX,y:window.scrollY},devicePixelRatio:window.devicePixelRatio||1,timezone:et()}:{}}function nt(e){if(!e)return {};let t={};return e.id&&(t.userId=e.id),e.email&&(t.userEmail=e.email),e.name&&(t.userName=e.name),t}async function ke(e){let{config:t,context:n,user:r}=e;if(t?.enabled===false)return {};let o={...tt(),...nt(r)},i=t?.enrich;if(!i)return o;try{let s=await i(n);return {...o,...s}}catch(s){let c=y("unknown",s);return {...o,blocfeedMetadataError:c.message}}}var V="blocfeed-queue",rt=50;function ee(){if(!w())return [];try{let e=localStorage.getItem(V);if(!e)return [];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return []}}function te(e){if(w())try{e.length===0?localStorage.removeItem(V):localStorage.setItem(V,JSON.stringify(e));}catch{}}function ot(e){let t={...e};if(t.screenshots){let n={...t.screenshots};n.element&&(n.element={...n.element,dataUrl:""}),n.fullPage&&(n.fullPage={...n.fullPage,dataUrl:""}),t.screenshots=n;}return t}function ne(e){let t=ee(),n=ot(e);for(n.metadata={...n.metadata,_queued:true},t.push({payload:n,timestamp:Date.now()});t.length>rt;)t.shift();te(t);}function ve(){let e=ee();return e.length===0?[]:(te([]),e.map(t=>t.payload))}function Ot(){te([]);}function Ut(){return ee().length}function re(e){let t=null,n=null,r=(...o)=>{n=o,t===null&&(t=requestAnimationFrame(()=>{if(t=null,!n)return;let i=n;n=null,e(...i);}));};return r.cancel=()=>{t!==null&&cancelAnimationFrame(t),t=null,n=null;},r}function X(e){return e instanceof Element?!!e.closest("[data-blocfeed-ui]"):false}function Z(e){e.stopPropagation(),e.stopImmediatePropagation?.();}function Pe(e,t){if(!w())throw new Error("BlocFeed picker can only run in a browser environment.");let n=e.ignoreSelectors,r=e.isSelectable,o={};n&&n.length>0&&(o.ignoreSelectors=n),r&&(o.isSelectable=r);let i=null,s=null,c=(u,f=false)=>{if(!u){i=null,s=null,t.onHover(null);return}let m=Y(u.getBoundingClientRect()),v=`${Math.round(m.x)}:${Math.round(m.y)}:${Math.round(m.width)}:${Math.round(m.height)}`;!f&&u===i&&v===s||(i=u,s=v,t.onHover({element:u,rect:m}));},a=re(u=>{if(X(u.target))return;let f=document.elementFromPoint(u.clientX,u.clientY),m=J(f,o);c(m);}),l=re(()=>{i&&c(i,true);}),d=u=>{X(u.target)||(Z(u),u.pointerType==="mouse"&&u.preventDefault());},g=u=>{X(u.target)||(Z(u),u.pointerType==="mouse"&&u.preventDefault());},h=u=>{if(X(u.target))return;Z(u),u.preventDefault();let f=document.elementFromPoint(u.clientX,u.clientY),m=J(f,o);m&&t.onSelect({element:m,descriptor:ge(m)});},b=u=>{u.key==="Escape"&&(Z(u),u.preventDefault(),t.onCancel());};return window.addEventListener("pointermove",a,{capture:true,passive:true}),window.addEventListener("pointerdown",d,{capture:true}),window.addEventListener("pointerup",g,{capture:true}),window.addEventListener("click",h,{capture:true}),window.addEventListener("keydown",b,{capture:true}),window.addEventListener("scroll",l,{capture:true,passive:true}),window.addEventListener("resize",l,{passive:true}),{stop(){window.removeEventListener("pointermove",a,{capture:true}),window.removeEventListener("pointerdown",d,{capture:true}),window.removeEventListener("pointerup",g,{capture:true}),window.removeEventListener("click",h,{capture:true}),window.removeEventListener("keydown",b,{capture:true}),window.removeEventListener("scroll",l,{capture:true}),window.removeEventListener("resize",l),a.cancel(),l.cancel(),t.onHover(null);}}}var it=12e3,at=2,st=500,ct=2e3,Re="https://blocfeed.com/api/feedback",Ae=0;function xe(e,t){return new Promise((n,r)=>{if(t?.aborted){r(new Error("Aborted"));return}let o=setTimeout(n,e),i=()=>{clearTimeout(o),r(new Error("Aborted"));};t?.addEventListener("abort",i,{once:true});})}function lt(e){return e>=500&&e<=599}function ut(e){let[t,n]=e.split(",",2);if(!t||!n)throw new Error("Invalid data URL");let o=/data:(.*?);base64/.exec(t)?.[1]||"application/octet-stream",i=atob(n),s=new Uint8Array(i.length);for(let c=0;c<i.length;c+=1)s[c]=i.charCodeAt(c);return new Blob([s],{type:o})}function dt(e){let t={},n={...e};if(n.screenshots){let r={},o={...n.screenshots};o.element&&(t.element=o.element.dataUrl,r.element={mime:o.element.mime,width:o.element.width,height:o.element.height},o.element={...o.element,dataUrl:""}),o.fullPage&&(t.fullPage=o.fullPage.dataUrl,r.fullPage={mime:o.fullPage.mime,width:o.fullPage.width,height:o.fullPage.height},o.fullPage={...o.fullPage,dataUrl:""}),n.screenshots=o,(r.element||r.fullPage)&&(n.screenshot_intent=r);}return {lean:n,extracted:t}}async function Te(e,t,n){let r=ut(t);await fetch(e,{method:"PUT",body:r,headers:{"content-type":r.type},...n?{signal:n}:{}});}async function ft(e){let{feedbackId:t,extracted:n,screenshots:r,signal:o}=e,i={};n.element&&r?.element&&(i.element={dataUrl:n.element,mime:r.element.mime,width:r.element.width,height:r.element.height}),n.fullPage&&r?.fullPage&&(i.fullPage={dataUrl:n.fullPage,mime:r.fullPage.mime,width:r.fullPage.width,height:r.fullPage.height}),Object.keys(i).length!==0&&await fetch(`${Re}/${t}/screenshots`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(i),...o?{signal:o}:{}});}async function Fe(e){let{signal:t,transport:n}=e;if(Date.now()-Ae<ct)return {ok:false,error:y("configuration",new Error("Please wait before submitting again"))};let o=n?.timeoutMs??it,i=n?.maxAttempts??at,s=n?.backoffMs??st,c=!!(e.payload.screenshots?.element?.dataUrl||e.payload.screenshots?.fullPage?.dataUrl),{lean:a,extracted:l}=c?dt(e.payload):{lean:e.payload,extracted:{}},d={...l,...e.screenshotDataUrls};for(let g=1;g<=i;g+=1){let h=new AbortController,b=setTimeout(()=>h.abort(),o),u=()=>h.abort();t&&t.addEventListener("abort",u,{once:true});try{let f=await fetch(Re,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(a),signal:h.signal});if(f.ok){Ae=Date.now();let m;try{m=await f.json();}catch{}if((d.element||d.fullPage)&&m){let p=m.upload_urls;if(p){let _=[];d.element&&p.element&&_.push(Te(p.element,d.element,t)),d.fullPage&&p.fullPage&&_.push(Te(p.fullPage,d.fullPage,t));try{await Promise.all(_);}catch{}}else if(m.feedback_id)try{await ft({feedbackId:m.feedback_id,extracted:d,screenshots:e.payload.screenshots,...t?{signal:t}:{}});}catch{}}let A={ok:!0,status:f.status};return m&&(A.apiResponse=m),A}if(g<i&&lt(f.status)){let m=.85+Math.random()*.3,v=Math.round(s*2**(g-1)*m);await xe(v,t);continue}return {ok:!1,status:f.status,error:y("api_failed",new Error(`HTTP ${f.status}`))}}catch(f){if(h.signal.aborted||t?.aborted)return {ok:false,error:y("aborted",f)};if(g<i){let m=.85+Math.random()*.3,v=Math.round(s*2**(g-1)*m);await xe(v,t);continue}return {ok:false,error:y("api_failed",f)}}finally{clearTimeout(b),t&&t.removeEventListener("abort",u);}}return {ok:false,error:y("api_failed",new Error("Failed"))}}async function oe(e){let{signal:t,transport:n}=e,r={ok:false};try{let o={payload:e.payload,...t?{signal:t}:{},...n?{transport:n}:{}};r.api=await Fe(o),r.ok=!!r.api?.ok;}catch(o){r.api={ok:false,error:y("api_failed",o)},r.ok=false;}return {payload:e.payload,result:r}}var mt=["[data-blocfeed-ui]","[data-blocfeed-ignore]"];function pt(e){let t=[...mt,...e?.ignoreSelectors??[]],n=Array.from(new Set(t));return {...e,ignoreSelectors:n}}function Ce(){return {phase:"idle"}}function gt(e){if(e.ok)return false;let t=e.api;return t?t.status&&t.status>=400&&t.status<500||t.error?.kind==="aborted"||t.error?.kind==="configuration"?false:!t.ok:true}function rn(e){let t=e,n=Ce(),r=new Set,o=new Set,i=null,s=null,c=null,a=null,l=0,d=null,g=()=>{for(let p of r)p(n);},h=p=>{for(let _ of o)_(p);},b=p=>{n=p,g();},u=()=>{l+=1,a?.abort(),a=null;},f=()=>{i?.stop(),i=null,h(null),c!==null&&w()&&(document.documentElement.style.cursor=c,c=null);},m=()=>{u(),f(),s=null,b(Ce());},v=()=>{if(!w())return;f(),s=null;let p=pt(t.picker);c=document.documentElement.style.cursor,document.documentElement.style.cursor="crosshair",b({phase:"picking"}),i=Pe(p,{onHover:h,onSelect:({element:_,descriptor:z})=>{s=_,f(),b({phase:"review",selection:z});},onCancel:()=>{m();}});},A=()=>{let p=ve();if(p.length!==0)for(let _ of p)oe({payload:_,...t.transport?{transport:t.transport}:{}}).catch(()=>{ne(_);});};if(w()){setTimeout(A,1e3);let p=()=>A();window.addEventListener("online",p),d=()=>window.removeEventListener("online",p);}return {getState:()=>n,subscribe(p){return r.add(p),()=>r.delete(p)},subscribeHover(p){return o.add(p),()=>o.delete(p)},start(){n.phase==="capturing"||n.phase==="submitting"||n.phase!=="picking"&&v();},stop(){m();},clearSelection(){n.phase==="capturing"||n.phase==="submitting"||v();},setConfig(p){t=p;},async submit(p,_){if(!w()){let E=y("configuration",new Error("BlocFeed submit can only run in the browser"));return b({phase:"error",lastError:E}),{ok:false}}let z=t.blocfeed_id?.trim?.()??"";if(!z){let x={phase:"error",lastError:y("configuration",new Error("Missing blocfeed_id. Create a project in BlocFeed and pass its blocfeed_id."))};return n.selection&&(x.selection=n.selection),b(x),{ok:false}}if(n.phase==="capturing"||n.phase==="submitting")return {ok:false};let N=l+1;l=N,a?.abort(),a=new AbortController;let F=a.signal,S=n.selection,W=_?.capture?{...t.capture,..._.capture}:t.capture,ce=!!(W?.element||W?.fullPage),le={phase:ce?"capturing":"submitting"};S&&(le.selection=S),b(le);try{let E=ce?await Se({selectionElement:s,capture:W,signal:F}):void 0;if(F.aborted||l!==N)return {ok:!1};let x={phase:"submitting"};S&&(x.selection=S),E&&(x.capture=E),b(x);let C={};S&&(C.selection=S),E&&(C.capture=E);let Ne=await ke({config:t.metadata,context:C,...t.user?{user:t.user}:{}}),M={version:1,createdAt:new Date().toISOString(),blocfeed_id:z,message:p,metadata:Ne};_?.category&&(M.category=_.category),t.user&&(M.user=t.user),S&&(M.selection=S),E&&(M.screenshots=E);let{result:P}=await oe({payload:M,signal:F,...t.transport?{transport:t.transport}:{}});if(F.aborted||l!==N)return P;if(P.ok){let Q={phase:"success",lastSubmit:P};return S&&(Q.selection=S),E&&(Q.capture=E),b(Q),P}gt(P)&&ne(M);let Ie=P.api?.error??y("unknown",new Error("Submission failed")),K={phase:"error",lastSubmit:P,lastError:Ie};return S&&(K.selection=S),E&&(K.capture=E),b(K),P}catch(E){if(F.aborted||l!==N)return {ok:false};let C={phase:"error",lastError:F.aborted?y("aborted",E):y("unknown",E)};return S&&(C.selection=S),b(C),{ok:false}}finally{l===N&&(a=null);}},__unsafeGetSelectedElement(){return s},destroy(){m(),r.clear(),o.clear(),d?.(),d=null;}}}var B=[],D=[],Me=20,Le=15,O={},U=null,H=null,q=null,j=false;function ht(e){if(e instanceof Error)return e.message;if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function wt(e,t){let n=t.map(ht).join(" "),r=t.find(i=>i instanceof Error),o={level:e,message:n.slice(0,2e3),timestamp:Date.now()};for(r?.stack&&(o.stack=r.stack.slice(0,2e3)),B.push(o);B.length>Me;)B.shift();}function ie(e){if(!e.url.includes("blocfeed.com"))for(D.push(e);D.length>Le;)D.shift();}function sn(e={}){if(!(j||!w())){if(j=true,Me=e.consoleLimit??20,Le=e.networkLimit??15,e.console!==false){let t=e.consoleLevels??["error","warn"];for(let n of t)O[n]=console[n],console[n]=(...r)=>{wt(n,r),O[n]?.apply(console,r);};}if(e.network!==false&&typeof window.fetch=="function"){U=window.fetch;let t=U;window.fetch=async function(r,o){let i=typeof r=="string"?r:r instanceof URL?r.toString():r.url,s=(o?.method??"GET").toUpperCase(),c=Date.now();try{let a=await t.call(window,r,o);return a.ok||ie({url:i.slice(0,500),method:s,status:a.status,statusText:a.statusText,timestamp:c,durationMs:Date.now()-c}),a}catch(a){throw ie({url:i.slice(0,500),method:s,status:0,statusText:a instanceof Error?a.message:"Network error",timestamp:c,durationMs:Date.now()-c}),a}};}if(e.network!==false&&typeof XMLHttpRequest<"u"){H=XMLHttpRequest.prototype.open,q=XMLHttpRequest.prototype.send;let t=H,n=q;XMLHttpRequest.prototype.open=function(r,o,...i){return this.__bf_method=r.toUpperCase(),this.__bf_url=String(o),t.apply(this,[r,o,...i])},XMLHttpRequest.prototype.send=function(...r){let o=this.__bf_method||"GET",i=this.__bf_url||"",s=Date.now();return this.addEventListener("loadend",function(){if(this.status>=400||this.status===0){let c={url:i.slice(0,500),method:o,status:this.status,timestamp:s,durationMs:Date.now()-s};this.statusText&&(c.statusText=this.statusText),ie(c);}}),n.apply(this,r)};}}}function cn(){if(j){for(let[e,t]of Object.entries(O))console[e]=t;for(let e of Object.keys(O))delete O[e];U&&(window.fetch=U,U=null),H&&(XMLHttpRequest.prototype.open=H,H=null),q&&(XMLHttpRequest.prototype.send=q,q=null),j=false;}}function ln(){return {consoleLogs:[...B],networkErrors:[...D]}}function un(){B=[],D=[];}var yt=[{name:"supabase_service_role_key",pattern:/SUPABASE_SERVICE_ROLE_KEY["'=:\s]+[A-Za-z0-9_.=-]{30,}/},{name:"supabase_db_password",pattern:/SUPABASE_DB_PASSWORD["'=:\s]+[^\s"']{6,}/},{name:"postgres_password",pattern:/POSTGRES_PASSWORD["'=:\s]+[^\s"']{6,}/},{name:"database_url_with_creds",pattern:/(?:postgres|postgresql|mysql|mongodb|redis|amqp):\/\/[^:]+:[^@\s"']+@/},{name:"aws_access_key",pattern:/AKIA[0-9A-Z]{16}/},{name:"aws_secret_key",pattern:/AWS_SECRET_ACCESS_KEY["'=:\s]+[A-Za-z0-9/+=]{30,}/},{name:"aws_session_token",pattern:/AWS_SESSION_TOKEN["'=:\s]+[A-Za-z0-9/+=]{30,}/},{name:"stripe_secret_key",pattern:/sk_live_[a-zA-Z0-9]{10,}/},{name:"stripe_secret_key_test",pattern:/sk_test_[a-zA-Z0-9]{10,}/},{name:"stripe_restricted_key",pattern:/rk_(?:live|test)_[a-zA-Z0-9]{10,}/},{name:"github_pat",pattern:/ghp_[A-Za-z0-9_]{36,}/},{name:"github_oauth",pattern:/gho_[A-Za-z0-9_]{36,}/},{name:"github_user_token",pattern:/ghu_[A-Za-z0-9_]{36,}/},{name:"github_server_token",pattern:/ghs_[A-Za-z0-9_]{36,}/},{name:"github_fine_grained",pattern:/github_pat_[A-Za-z0-9_]{22,}/},{name:"openai_api_key",pattern:/sk-[a-zA-Z0-9]{20,}(?![a-zA-Z0-9_])/},{name:"anthropic_api_key",pattern:/sk-ant-[a-zA-Z0-9\-_]{20,}/},{name:"private_key",pattern:/-----BEGIN (?:RSA |EC |DSA |OPENSSH |PGP )?PRIVATE KEY-----/},{name:"sendgrid_api_key",pattern:/SG\.[a-zA-Z0-9_-]{22,}\.[a-zA-Z0-9_-]{22,}/},{name:"twilio_auth_token",pattern:/TWILIO_AUTH_TOKEN["'=:\s]+[a-f0-9]{32}/},{name:"generic_secret_key",pattern:/[A-Z_]{2,}_SECRET_KEY["'=:\s]+[^\s"']{8,}/},{name:"generic_secret",pattern:/[A-Z_]{2,}_SECRET["'=:\s]+[^\s"']{8,}/},{name:"generic_password",pattern:/[A-Z_]{2,}_PASSWORD["'=:\s]+[^\s"']{6,}/},{name:"generic_private_key_var",pattern:/[A-Z_]{2,}_PRIVATE_KEY["'=:\s]+[^\s"']{8,}/}],R=[],se=0,ae=false;function bt(e){let t=e.slice(0,80);return t.length<=6?"***":t.slice(0,6)+"***"}function Et(e,t,n,r){if(R.some(s=>s.rule===e&&s.source===t))return;let i={rule:e,source:t,hint:bt(n),timestamp:Date.now()};r&&(i.location=r),R.push(i);}function $(e,t,n,r){for(let{name:o,pattern:i}of n){let s=i.exec(e);s&&Et(o,t,s[0],r);}}function _t(e){try{let t=window;if(t.__NEXT_DATA__){let n=JSON.stringify(t.__NEXT_DATA__);$(n,"hydration",e,"__NEXT_DATA__");}if(t.__NUXT__){let n=JSON.stringify(t.__NUXT__);$(n,"hydration",e,"__NUXT__");}}catch{}}function St(e){try{document.querySelectorAll("script:not([src])").forEach((n,r)=>{let o=n.textContent;o&&o.length>0&&$(o,"scripts",e,`inline-script[${r}]`);});}catch{}}function kt(e){try{document.querySelectorAll("meta[content]").forEach(n=>{let r=n.getAttribute("content"),o=n.getAttribute("name")||n.getAttribute("property")||"";r&&r.length>10&&$(r,"meta",e,o?`meta[${o}]`:void 0);});}catch{}}function vt(e){try{document.querySelectorAll("[data-api-key], [data-secret], [data-token], [data-password]").forEach(n=>{let r=n.attributes;for(let o=0;o<r.length;o++){let i=r[o];i.name.startsWith("data-")&&i.value.length>10&&$(i.value,"dom",e,`${n.tagName.toLowerCase()}[${i.name}]`);}});}catch{}}function mn(e={}){if(ae||!w()||(ae=true,e.secretScan===false))return;let t=[...yt,...e.customPatterns??[]],n=e.scanTargets??["hydration","scripts","meta","dom"];setTimeout(()=>{se=Date.now(),n.includes("hydration")&&_t(t),n.includes("scripts")&&St(t),n.includes("meta")&&kt(t),n.includes("dom")&&vt(t);let r=e.notify??"both";R.length>0&&(r==="console"||r==="both")&&console.warn(`[BlocFeed Security] Found ${R.length} potential secret(s) exposed in client code:`,R.map(o=>`${o.rule} (${o.source}${o.location?`: ${o.location}`:""})`));},100);}function pn(){return {findings:[...R],scannedAt:se}}function gn(){R=[],se=0,ae=false;}
2
- export{w as a,Y as b,ye as c,Se as d,ke as e,ne as f,ve as g,Ot as h,Ut as i,rn as j,sn as k,cn as l,ln as m,un as n,mn as o,pn as p,gn as q};