blocfeed 0.25.0 → 0.26.0

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.
@@ -0,0 +1,885 @@
1
+ import {createContext,forwardRef,useState,useEffect,useRef,useMemo,useImperativeHandle,useCallback,useContext}from'react';import {record}from'rrweb';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {createPortal}from'react-dom';import {AnimatePresence,motion}from'framer-motion';function C(){return typeof window<"u"&&typeof document<"u"}function Xt(e){let t=globalThis.CSS;return typeof t?.escape=="function"?t.escape(e):e.replace(/[^a-zA-Z0-9_-]/g,n=>{let o=n.codePointAt(0);return o===void 0?"":`\\${o.toString(16)} `})}function Me(e){return {x:e.x,y:e.y,width:e.width,height:e.height}}function Zo(e){return {x:e.x+window.scrollX,y:e.y+window.scrollY,width:e.width,height:e.height}}function Qo(e){return e.replace(/\s+/g," ").trim()}function re(e,t=140){let n=e.textContent;if(!n)return;let o=Qo(n);if(o)return o.length<=t?o:`${o.slice(0,t-1)}\u2026`}function er(e){let t=1;for(let n=e.previousElementSibling;n;n=n.previousElementSibling)n.tagName===e.tagName&&(t+=1);return t}var pt=["data-testid","data-test-id","data-test","data-qa","data-cy"],ft="data-blocfeed-component";function de(e){let t=e.closest(`[${ft}]`);if(!t)return;let o=t.getAttribute(ft)?.trim();return o||void 0}function Ee(e,t=5){let n=[],o=e,r=0;for(;o&&r<t*4;){let a=de(o);if(a&&n[n.length-1]!==a&&(n.push(a),n.length>=t))break;o=o.parentElement,r++;}return n}function Se(e,t=4){let n=e,o=0;for(;n&&o<t;){let a=n.getAttribute(ft)?.trim();if(a)return `bf:component:${a}`;for(let i of pt){let g=n.getAttribute(i)?.trim();if(g)return `bf:testid:${g}`}let c=n.getAttribute("id")?.trim();if(c&&!/^\d/.test(c))return `bf:id:${c}`;n=n.parentElement,o+=1;}return null}function tr(e){for(let t of pt){let n=e.closest(`[${t}]`);if(!n)continue;let r=n.getAttribute(t)?.trim();if(r)return r}}function Yt(e){try{let t=e,n=Object.getOwnPropertyNames(t);for(let o of n)if(o.startsWith("__reactFiber$")||o.startsWith("__reactInternalInstance$")){let r=t[o];if(r&&typeof r=="object")return r}}catch{}return null}function ge(e){if(e.length<=1||e.length===2&&e[0]===e[0].toLowerCase()||e.startsWith("__")&&e.endsWith("__"))return true;let t=e[0];return t>="a"&&t<="z"}function Pe(e){if(e){for(let t of e)if(typeof t.name=="string"&&t.name&&!ge(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 o=t.render;if(typeof o=="function"){let a=o;if(typeof a.displayName=="string"&&a.displayName)return a.displayName;if(typeof a.name=="string"&&a.name)return a.name}let r=t.type;return K(r)}}}function mt(e){let t=Yt(e);if(!t)return;let n=Pe(t._debugInfo);if(n)return n;let o=t._debugOwner!==void 0;if(o){let i=t._debugOwner;for(let l=0;i&&l<50;l+=1){let g=Pe(i._debugInfo);if(g)return g;let m=K(i.type)??K(i.elementType);if(m&&!ge(m))return m;i=i._debugOwner;}}if(t._owner!==void 0&&t._owner!==t._debugOwner){let i=t._owner;for(let l=0;i&&l<50;l+=1){let g=Pe(i._debugInfo);if(g)return g;let m=K(i.type)??K(i.elementType);if(m&&!ge(m))return m;i=i._owner;}}let a=t,s=o?80:25;for(let i=0;a&&i<s;i+=1){let l=Pe(a._debugInfo);if(l)return l;let g=K(a.type)??K(a.elementType);if(g&&!ge(g))return g;a=a.return;}let c=e.parentElement;for(let i=0;c&&i<15;i+=1){let l=Yt(c);if(l){let g=Pe(l._debugInfo);if(g)return g;let m=K(l.type)??K(l.elementType);if(m&&!ge(m))return m;if(l._debugOwner){let d=K(l._debugOwner.type)??K(l._debugOwner.elementType);if(d&&!ge(d))return d}if(l._owner&&l._owner!==l._debugOwner){let d=K(l._owner.type)??K(l._owner.elementType);if(d&&!ge(d))return d}}c=c.parentElement;}}function nr(e){let t=e.tagName.toLowerCase(),n=e.getAttribute("id");if(n)return `#${Xt(n)}`;for(let o of pt){let r=e.getAttribute(o);if(r)return `${t}[${o}="${Xt(r)}"]`}return `${t}:nth-of-type(${er(e)})`}function be(e,t=10){let n=[],o=e;for(;o&&n.length<t;){let r=nr(o);if(n.unshift(r),r.startsWith("#"))break;o=o.parentElement;}return n.join(" > ")}var or=new Set(["button","link","tab","menuitem"]);function Jt(e){if(e.tagName==="BUTTON")return e.disabled?null:"button";if(e.tagName==="A"||e.tagName==="a"){let n=e.getAttribute("href")?.trim();return !n||n==="#"||n.toLowerCase().startsWith("javascript:")?null:"link"}let t=e.getAttribute("role");if(t&&or.has(t))return "role";try{if(window.getComputedStyle(e).cursor==="pointer")return "cursor_pointer"}catch{}return null}function Gt(e,t){if(!t||t.length===0)return false;for(let n of t)if(e.closest(n))return true;return false}function gt(e,t){if(!e||Gt(e,t.ignoreSelectors))return null;let n=e;for(;n;){if(Gt(n,t.ignoreSelectors))return null;if(t.isSelectable?t.isSelectable(n):rr(n))return n;n=n.parentElement;}return null}function We(e,t){if(t.length===0)return false;for(let n of t)try{if(e.matches(n)||e.closest(n))return !0}catch{}return false}function rr(e){let t=e.tagName;return !(t==="HTML"||t==="BODY")}function Zt(e){let t=e.getBoundingClientRect(),n={selector:be(e),tagName:e.tagName.toLowerCase(),rect:Me(t),pageRect:Zo(t)},o=e.getAttribute("id");o&&(n.id=o);let r=e.className;typeof r=="string"&&r.trim()&&(n.className=r);let a=re(e);a&&(n.textSnippet=a);let s=de(e)??mt(e);s&&(n.componentName=s);let c=tr(e);return c&&(n.testId=c),n}function ir(e){if(e instanceof Error)return e.message;if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return "Unknown error"}}function S(e,t,n){let o={kind:e,message:ir(t)};return n&&(o.detail=n),o}var bt=null;async function Qt(){return bt||(bt=import('html-to-image')),bt}async function ar(e){return await new Promise((t,n)=>{let o=new Image;o.onload=()=>t({width:o.naturalWidth,height:o.naturalHeight}),o.onerror=()=>n(new Error("Failed to load generated screenshot")),o.src=e;})}async function en(e,t){let{width:n,height:o}=await ar(e);return {dataUrl:e,mime:t,width:n,height:o}}function ke(e){if(e?.aborted)throw new Error("Aborted")}function tn(){return {async captureElement(e,t){if(!C())throw new Error("captureElement can only run in the browser");ke(t.signal);let n=await Qt();ke(t.signal);let o=t.mime==="image/jpeg"?await n.toJpeg(e,{quality:t.quality??.92,pixelRatio:t.pixelRatio}):await n.toPng(e,{pixelRatio:t.pixelRatio});return ke(t.signal),await en(o,t.mime)},async captureFullPage(e){if(!C())throw new Error("captureFullPage can only run in the browser");ke(e.signal);let t=document.documentElement,n=Math.max(t.scrollWidth,t.clientWidth),o=Math.max(t.scrollHeight,t.clientHeight),r=Math.min(1,e.maxDimension/Math.max(n,o)),a=Math.max(1,Math.round(n*r)),s=Math.max(1,Math.round(o*r)),c=await Qt();ke(e.signal);let i=e.mime==="image/jpeg"?await c.toJpeg(t,{width:a,height:s,quality:e.quality??.92,pixelRatio:e.pixelRatio}):await c.toPng(t,{width:a,height:s,pixelRatio:e.pixelRatio});return ke(e.signal),await en(i,e.mime)}}}var sr=12e3,cr=2048,lr=.92;function nn(){return Date.now()}function dr(e){return new Promise((t,n)=>{let o=()=>n(new Error("Aborted"));if(e.aborted){o();return}e.addEventListener("abort",o,{once:true});})}async function on(e,t,n){let o=new Promise((a,s)=>{let c=setTimeout(()=>s(new Error("Timeout")),t);typeof c.unref=="function"&&c.unref();}),r=[e,o];return n&&r.push(dr(n)),await Promise.race(r)}function ur(e){if(!C())return 1;let t=window.devicePixelRatio||1,n=e?.pixelRatio??Math.min(t,2);return Math.max(.1,n)}function fr(e){return !!(e?.element||e?.fullPage)}function rn(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 an(e){let{selectionElement:t,capture:n,signal:o}=e;if(!C()||!fr(n))return;let r=nn(),a=[],s=n?.timeoutMs??sr,c=n?.maxDimension??cr,i=n?.mime??"image/png",l=n?.quality??lr,g=n?.adapter??tn(),m={},d=ur(n);if(n?.element&&t)try{let p=t.getBoundingClientRect(),f=Math.min(1,c/Math.max(p.width,p.height)),b=Math.min(d,d*f),v=await on(Promise.resolve(g.captureElement(t,{...rn({mime:i,quality:l,pixelRatio:b,maxDimension:c,includeQuality:i==="image/jpeg",...o?{signal:o}:{}})})),s,o);m.element=v;}catch(p){if(o?.aborted)throw p;a.push(S("capture_failed",p,{target:"element"}));}if(n?.fullPage)try{let p=await on(Promise.resolve(g.captureFullPage(rn({mime:i,quality:l,pixelRatio:d,maxDimension:c,includeQuality:i==="image/jpeg",...o?{signal:o}:{}}))),s,o);m.fullPage=p;}catch(p){if(o?.aborted)throw p;a.push(S("capture_failed",p,{target:"fullPage"}));}let h=nn(),u={startedAt:r,finishedAt:h,durationMs:Math.max(0,h-r)};return a.length>0&&(u.errors=a),{...m,diagnostics:u}}function pr(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function mr(){return C()?{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:pr()}:{}}function gr(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 sn(e){let{config:t,context:n,user:o}=e;if(t?.enabled===false)return {};let r={...mr(),...gr(o)},a=t?.enrich;if(!a)return r;try{let s=await a(n);return {...r,...s}}catch(s){let c=S("unknown",s);return {...r,blocfeedMetadataError:c.message}}}var Ae="blocfeed-queue",br=50;function ht(){if(!C())return [];try{let e=localStorage.getItem(Ae);if(!e)return [];let t=JSON.parse(e);if(Array.isArray(t))return t;console.warn("[BlocFeed] offline queue was corrupt (non-array) \u2014 resetting");try{localStorage.removeItem(Ae);}catch{}return []}catch(e){console.warn("[BlocFeed] offline queue could not be read \u2014 resetting",e);try{localStorage.removeItem(Ae);}catch{}return []}}function vt(e){if(C())try{e.length===0?localStorage.removeItem(Ae):localStorage.setItem(Ae,JSON.stringify(e));}catch(t){let n=t instanceof DOMException?t.name:"";console.warn(`[BlocFeed] failed to persist offline queue${n?` (${n})`:""} \u2014 feedback may be lost if page is closed`);}}function hr(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 delete t.video,t}function yt(e){let t=ht(),n=hr(e);for(n.metadata={...n.metadata,_queued:true},t.push({payload:n,timestamp:Date.now()});t.length>br;)t.shift();vt(t);}function cn(){let e=ht();return e.length===0?[]:(vt([]),e.map(t=>t.payload))}function ls(){vt([]);}function ln(){return ht().length}function wt(e){let t=null,n=null,o=(...r)=>{n=r,t===null&&(t=requestAnimationFrame(()=>{if(t=null,!n)return;let a=n;n=null,e(...a);}));};return o.cancel=()=>{t!==null&&cancelAnimationFrame(t),t=null,n=null;},o}function $e(e){return e instanceof Element?!!e.closest("[data-blocfeed-ui]"):false}function qe(e){e.stopPropagation(),e.stopImmediatePropagation?.();}function dn(e,t){if(!C())throw new Error("BlocFeed picker can only run in a browser environment.");let n=e.ignoreSelectors,o=e.isSelectable,r={};n&&n.length>0&&(r.ignoreSelectors=n),o&&(r.isSelectable=o);let a=null,s=null,c=(u,p=false)=>{if(!u){a=null,s=null,t.onHover(null);return}let f=Me(u.getBoundingClientRect()),b=`${Math.round(f.x)}:${Math.round(f.y)}:${Math.round(f.width)}:${Math.round(f.height)}`;!p&&u===a&&b===s||(a=u,s=b,t.onHover({element:u,rect:f}));},i=wt(u=>{if($e(u.target))return;let p=document.elementFromPoint(u.clientX,u.clientY),f=gt(p,r);c(f);}),l=wt(()=>{a&&c(a,true);}),g=u=>{$e(u.target)||(qe(u),u.pointerType==="mouse"&&u.preventDefault());},m=u=>{$e(u.target)||(qe(u),u.pointerType==="mouse"&&u.preventDefault());},d=u=>{if($e(u.target))return;qe(u),u.preventDefault();let p=document.elementFromPoint(u.clientX,u.clientY),f=gt(p,r);f&&t.onSelect({element:f,descriptor:Zt(f)});},h=u=>{u.key==="Escape"&&(qe(u),u.preventDefault(),t.onCancel());};return window.addEventListener("pointermove",i,{capture:true,passive:true}),window.addEventListener("pointerdown",g,{capture:true}),window.addEventListener("pointerup",m,{capture:true}),window.addEventListener("click",d,{capture:true}),window.addEventListener("keydown",h,{capture:true}),window.addEventListener("scroll",l,{capture:true,passive:true}),window.addEventListener("resize",l,{passive:true}),{stop(){window.removeEventListener("pointermove",i,{capture:true}),window.removeEventListener("pointerdown",g,{capture:true}),window.removeEventListener("pointerup",m,{capture:true}),window.removeEventListener("click",d,{capture:true}),window.removeEventListener("keydown",h,{capture:true}),window.removeEventListener("scroll",l,{capture:true}),window.removeEventListener("resize",l),i.cancel(),l.cancel(),t.onHover(null);}}}var vr=200,Fe=[],un=0,je=false;function fn(e){let t=e.target;if(!(t instanceof Element)||t.closest("[data-blocfeed-ui]"))return;let n={timestampMs:Date.now()-un,path:window.location.pathname,tagName:t.tagName.toLowerCase()},o=re(t,100);o&&(n.textSnippet=o);let r=de(t)??mt(t);r&&(n.componentName=r),Fe.length<vr&&Fe.push(n);}var pn={capture:true,passive:true};function mn(){je||!C()||(je=true,Fe=[],un=Date.now(),document.addEventListener("click",fn,pn));}function gn(){je&&(je=false,document.removeEventListener("click",fn,pn));}function xt(){return [...Fe]}function yr(){Fe=[];}var wr=3e4,xr=25e5,bn="video/webm",Er=250,Sr=1e3,kr=["video/webm;codecs=vp9","video/webm;codecs=vp8","video/webm"];function hn(){if(typeof MediaRecorder>"u")return null;for(let e of kr)if(MediaRecorder.isTypeSupported(e))return e;return null}function Et(){return !C()||typeof navigator?.mediaDevices?.getDisplayMedia!="function"?false:hn()!==null}async function St(e){let{config:t,signal:n}=e;if(!C()||typeof navigator?.mediaDevices?.getDisplayMedia!="function")throw S("recording_failed",new Error("Screen recording is not supported in this browser"));let o=hn();if(!o)throw S("recording_failed",new Error("No supported video codec found (WebM required)"));if(n?.aborted)throw S("aborted",new Error("Recording aborted before start"));let r;try{r=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:"browser"},audio:!1});}catch(f){let b=f instanceof DOMException&&f.name==="NotAllowedError"?"Screen share permission denied":"Failed to start screen share";throw S("recording_failed",new Error(b))}if(n?.aborted)throw r.getTracks().forEach(f=>f.stop()),S("aborted",new Error("Recording aborted after permission"));let a=t?.maxDurationMs??wr,s=t?.videoBitsPerSecond??xr,c=new MediaRecorder(r,{mimeType:o,videoBitsPerSecond:s}),i=[],l=[],g=0,m=null,d=null,h=false,u=()=>{gn(),m!==null&&(clearInterval(m),m=null),d!==null&&(clearTimeout(d),d=null),r.getTracks().forEach(f=>f.stop());},p=new Promise((f,b)=>{c.ondataavailable=T=>{T.data.size>0&&i.push(T.data);},c.onstop=()=>{if(h)return;h=true,u();let T=Date.now()-g,k=new Blob(i,{type:bn}),x=URL.createObjectURL(k);f({mime:bn,blobUrl:x,blob:k,durationMs:T,sizeBytes:k.size});},c.onerror=()=>{h||(h=true,u(),b(S("recording_failed",new Error("MediaRecorder error"))));};let v=r.getVideoTracks()[0];if(v&&v.addEventListener("ended",()=>{c.state!=="inactive"&&c.stop();}),n){let T=()=>{h||(h=true,c.state!=="inactive"&&c.stop(),u(),b(S("aborted",new Error("Recording aborted"))));};n.addEventListener("abort",T,{once:true});}});return c.start(Sr),mn(),g=Date.now(),m=setInterval(()=>{let f=Date.now()-g;for(let b of l)b(f);},Er),d=setTimeout(()=>{!h&&c.state!=="inactive"&&c.stop();},a),{result:p,stop(){!h&&c.state!=="inactive"&&c.stop();},onTick(f){l.push(f);},abort(){h||(h=true,c.state!=="inactive"&&c.stop(),u());}}}var _r=6e4,vn="audio/webm",Tr=250,Cr=["audio/webm;codecs=opus","audio/webm","audio/ogg;codecs=opus"];function yn(){if(typeof MediaRecorder>"u")return null;for(let e of Cr)if(MediaRecorder.isTypeSupported(e))return e;return null}function kt(){return !C()||typeof navigator?.mediaDevices?.getUserMedia!="function"?false:yn()!==null}async function _t(e){let{config:t,signal:n}=e;if(!C()||typeof navigator?.mediaDevices?.getUserMedia!="function")throw S("recording_failed",new Error("Microphone recording is not supported in this browser"));let o=yn();if(!o)throw S("recording_failed",new Error("No supported audio codec found"));if(n?.aborted)throw S("aborted",new Error("Voice recording aborted before start"));let r;try{r=await navigator.mediaDevices.getUserMedia({audio:!0});}catch(p){let f=p instanceof DOMException&&p.name==="NotAllowedError"?"Microphone permission denied":"Failed to access microphone";throw S("recording_failed",new Error(f))}if(n?.aborted)throw r.getTracks().forEach(p=>p.stop()),S("aborted",new Error("Voice recording aborted after permission"));let a=t?.maxDurationMs??_r,s=new MediaRecorder(r,{mimeType:o}),c=[],i=[],l=0,g=null,m=null,d=false,h=()=>{g!==null&&(clearInterval(g),g=null),m!==null&&(clearTimeout(m),m=null),r.getTracks().forEach(p=>p.stop());},u=new Promise((p,f)=>{if(s.ondataavailable=b=>{b.data.size>0&&c.push(b.data);},s.onstop=()=>{if(d)return;d=true,h();let b=Date.now()-l,v=new Blob(c,{type:vn});p({blob:v,mime:vn,durationMs:b});},s.onerror=()=>{d||(d=true,h(),f(S("recording_failed",new Error("MediaRecorder error"))));},n){let b=()=>{d||(d=true,s.state!=="inactive"&&s.stop(),h(),f(S("aborted",new Error("Voice recording aborted"))));};n.addEventListener("abort",b,{once:true});}});return s.start(1e3),l=Date.now(),g=setInterval(()=>{let p=Date.now()-l;for(let f of i)f(p);},Tr),m=setTimeout(()=>{m=null,!d&&s.state!=="inactive"&&s.stop();},a),{result:u,stop(){!d&&s.state!=="inactive"&&s.stop();},onTick(p){i.push(p);},abort(){d||(d=true,s.state!=="inactive"&&s.stop(),h());}}}var Rr=12e3,Pr=2,Mr=500,Ar=2e3,Tt="https://blocfeed.com/api/feedback",Fr="https://blocfeed.com/api/feedback/voice",wn=0,Sn="blocfeed-viewer-token",kn="blocfeed-my-feedback-url";function Br(){try{return localStorage.getItem(Sn)}catch{return null}}function Ct(){try{return localStorage.getItem(kn)}catch{return null}}function Ir(e,t){try{localStorage.setItem(Sn,e),t&&localStorage.setItem(kn,t);}catch{}}function xn(e,t){return new Promise((n,o)=>{if(t?.aborted){o(new Error("Aborted"));return}let r=setTimeout(n,e),a=()=>{clearTimeout(r),o(new Error("Aborted"));};t?.addEventListener("abort",a,{once:true});})}function Lr(e){return e>=500&&e<=599}function Nr(e){let[t,n]=e.split(",",2);if(!t||!n)throw new Error("Invalid data URL");let r=/data:(.*?);base64/.exec(t)?.[1]||"application/octet-stream",a=atob(n),s=new Uint8Array(a.length);for(let c=0;c<a.length;c+=1)s[c]=a.charCodeAt(c);return new Blob([s],{type:r})}function Dr(e){let t={},n={},o={...e};if(o.screenshots){let r={},a={...o.screenshots};a.element&&(t.element=a.element.dataUrl,r.element={mime:a.element.mime,width:a.element.width,height:a.element.height},a.element={...a.element,dataUrl:""}),a.fullPage&&(t.fullPage=a.fullPage.dataUrl,r.fullPage={mime:a.fullPage.mime,width:a.fullPage.width,height:a.fullPage.height},a.fullPage={...a.fullPage,dataUrl:""}),o.screenshots=a,(r.element||r.fullPage)&&(o.screenshot_intent=r);}return o.video&&(n.blob=o.video.blob,o.video_intent={mime:o.video.mime,durationMs:o.video.durationMs,sizeBytes:o.video.sizeBytes},delete o.video),{lean:o,extracted:t,extractedVideo:n}}async function En(e,t,n){let o=Nr(t);await fetch(e,{method:"PUT",body:o,headers:{"content-type":o.type},...n?{signal:n}:{}});}async function Or(e){let{feedbackId:t,extracted:n,screenshots:o,signal:r}=e,a={};n.element&&o?.element&&(a.element={dataUrl:n.element,mime:o.element.mime,width:o.element.width,height:o.element.height}),n.fullPage&&o?.fullPage&&(a.fullPage={dataUrl:n.fullPage,mime:o.fullPage.mime,width:o.fullPage.width,height:o.fullPage.height}),Object.keys(a).length!==0&&await fetch(`${Tt}/${t}/screenshots`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(a),...r?{signal:r}:{}});}async function Hr(e){await fetch(`${Tt}/${e.feedbackId}/video`,{method:"POST",body:e.blob,headers:{"content-type":e.blob.type},...e.signal?{signal:e.signal}:{}});}async function _n(e){let{signal:t,transport:n}=e;if(Date.now()-wn<Ar)return {ok:false,error:S("configuration",new Error("Please wait before submitting again"))};let r=n?.timeoutMs??Rr,a=n?.maxAttempts??Pr,s=n?.backoffMs??Mr,c=!!(e.payload.screenshots?.element?.dataUrl||e.payload.screenshots?.fullPage?.dataUrl),i=!!e.payload.video?.blob,l=c||i,{lean:g,extracted:m,extractedVideo:d}=l?Dr(e.payload):{lean:e.payload,extracted:{},extractedVideo:{}},h=Br();h&&(g.viewer_token=h);let u={...m,...e.screenshotDataUrls};for(let p=1;p<=a;p+=1){let f=new AbortController,b=setTimeout(()=>f.abort(),r),v=()=>f.abort();t&&t.addEventListener("abort",v,{once:true});try{let T=await fetch(Tt,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(g),signal:f.signal});if(T.ok){wn=Date.now();let x;try{x=await T.json();}catch{}if(x?.viewer_token&&Ir(x.viewer_token,x.my_feedback_url),(u.element||u.fullPage)&&x){let P=x.upload_urls;if(P){let A=[];u.element&&P.element&&A.push(En(P.element,u.element,t)),u.fullPage&&P.fullPage&&A.push(En(P.fullPage,u.fullPage,t));try{await Promise.all(A);}catch{}}else if(x.feedback_id)try{await Or({feedbackId:x.feedback_id,extracted:u,screenshots:e.payload.screenshots,...t?{signal:t}:{}});}catch{}}if(d.blob&&x){let P=x.upload_urls;if(P?.video)try{await fetch(P.video,{method:"PUT",body:d.blob,headers:{"content-type":d.blob.type},...t?{signal:t}:{}});}catch{}else if(x.feedback_id)try{await Hr({feedbackId:x.feedback_id,blob:d.blob,...t?{signal:t}:{}});}catch{}}let O={ok:!0,status:T.status};return x&&(O.apiResponse=x),O}if(p<a&&Lr(T.status)){let x=.85+Math.random()*.3,L=Math.round(s*2**(p-1)*x);await xn(L,t);continue}let k=`HTTP ${T.status}`;try{let x=await T.json();x?.error&&(k=x.error);}catch{}return {ok:!1,status:T.status,error:S("api_failed",new Error(k))}}catch(T){if(f.signal.aborted||t?.aborted)return {ok:false,error:S("aborted",T)};if(p<a){let k=.85+Math.random()*.3,x=Math.round(s*2**(p-1)*k);await xn(x,t);continue}return {ok:false,error:S("api_failed",T)}}finally{clearTimeout(b),t&&t.removeEventListener("abort",v);}}return {ok:false,error:S("api_failed",new Error("Failed"))}}async function Tn(e){let{blob:t,mime:n,blocfeedId:o,signal:r}=e,a=await fetch(Fr,{method:"POST",headers:{"Content-Type":n,"X-Blocfeed-Id":o},body:t,...r?{signal:r}:{}});if(!a.ok){let c=await a.json().catch(()=>({error:"Unknown error"}));throw S("api_failed",new Error(c?.error??`Voice API returned ${a.status}`))}let s=await a.json();return {text:s.text??"",warning:s.warning}}async function Rt(e){let{signal:t,transport:n}=e,o={ok:false};try{let r={payload:e.payload,...t?{signal:t}:{},...n?{transport:n}:{}};o.api=await _n(r),o.ok=!!o.api?.ok;}catch(r){o.api={ok:false,error:S("api_failed",r)},o.ok=false;}return {payload:e.payload,result:o}}var Ur={enabled:true,sampling:1,ignoreSelectors:["[data-blocfeed-ui]","[data-blocfeed-ignore]"],rageClick:{enabled:true,threshold:3,windowMs:1e3,streakIdleMs:1500},httpFail:{enabled:true,statusCodes:[400,401,403,404,408,409,422,429,500,502,503,504],ignoreUrls:["/api/behavioral-events","/api/feedback"],treatJsonErrorAsFail:false},redirectLoop:{enabled:true,threshold:3,windowMs:2e3},formDataLoss:{enabled:true},deadClick:{enabled:true,observationWindowMs:300,rateLimitPerSelector:5},jsError:{enabled:true,sampling:1,ignorePatterns:[],rateLimitPerFingerprint:5,rateLimitWindowMs:6e4},sessionTimeout:{enabled:true,idleMs:18e5,maxMs:144e5},piiScrub:"default"};function Cn(e){let t=Ur;return {enabled:e?.enabled??t.enabled,sampling:e?.sampling??t.sampling,ignoreSelectors:e?.ignoreSelectors??t.ignoreSelectors,rageClick:{...t.rageClick,...e?.rageClick??{}},httpFail:{...t.httpFail,...e?.httpFail??{}},redirectLoop:{...t.redirectLoop,...e?.redirectLoop??{}},formDataLoss:{...t.formDataLoss,...e?.formDataLoss??{}},deadClick:{...t.deadClick,...e?.deadClick??{}},jsError:{...t.jsError,...e?.jsError??{}},sessionTimeout:{...t.sessionTimeout,...e?.sessionTimeout??{}},piiScrub:e?.piiScrub??t.piiScrub}}function Rn(e){let t=[];async function n(){if(t.length===0)return;let r=t.splice(0,50);try{await fetch(e.endpoint,{method:"POST",headers:{"Content-Type":"application/json","x-blocfeed-id":e.blocfeedId},body:JSON.stringify({events:r}),keepalive:!0});}catch{}}function o(){if(t.length===0)return;if(typeof navigator>"u"||typeof navigator.sendBeacon!="function"){n();return}let r=t.splice(0,50),a=new Blob([JSON.stringify({events:r})],{type:"application/json"}),s=`${e.endpoint}?_bfid=${encodeURIComponent(e.blocfeedId)}`;try{navigator.sendBeacon(s,a);}catch{}}return {enqueue(r){t.push(r);},flush:n,flushBeacon:o,size(){return t.length}}}var Pn="bf_behavioral_session",Mn="bf_behavioral_session_started",Ke="bf_behavioral_session_last_activity";var Fn=18e5,Bn=144e5,In=true,ie=null;function Ln(e){typeof e.enabled=="boolean"&&(In=e.enabled),typeof e.idleMs=="number"&&e.idleMs>0&&(Fn=e.idleMs),typeof e.maxMs=="number"&&e.maxMs>0&&(Bn=e.maxMs);}function D(e){let t=Fn,n=Bn,o=In,r=Date.now();try{let a=sessionStorage.getItem(Pn),s=sessionStorage.getItem(Mn),c=sessionStorage.getItem(Ke);if(a&&s&&c){let l=Number(s),g=Number(c);if(!(o&&(!Number.isFinite(l)||!Number.isFinite(g)||r-g>t||r-l>n)))return a}let i=An();return sessionStorage.setItem(Pn,i),sessionStorage.setItem(Mn,String(r)),sessionStorage.setItem(Ke,String(r)),i}catch{return ie&&!(o&&(r-ie.lastActivityAt>t||r-ie.startedAt>n))||(ie={id:An(),startedAt:r,lastActivityAt:r}),ie.id}}function Pt(){let e=Date.now();try{let t=sessionStorage.getItem(Ke);if(t){let n=Number(t);if(Number.isFinite(n)&&e-n<1e4)return}sessionStorage.setItem(Ke,String(e));}catch{if(ie){if(e-ie.lastActivityAt<1e4)return;ie.lastActivityAt=e;}}}function An(){let e=Math.random().toString(36).slice(2,10).padEnd(8,"0");return `bf_${Date.now()}_${e}`}function _e(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)|0;return Math.abs(t)}function Nn(e,t){if(!e.rageClick.enabled)return ()=>{};let{threshold:n,windowMs:o,streakIdleMs:r}=e.rageClick,a=new Map;function s(m){let d=m.target,h=d?zr(d):false,u=d?re(d,200)??null:null,p=d?d.tagName.toLowerCase():"",f=d&&d.id||null,b=d?de(d)??null:null,v=d?Ee(d,5):[];return {session_id:D(),event_type:"rage_click",page_url:typeof window>"u"?"":window.location.href,selector:m.selector,element_text:u,event_data:{click_count:m.timestamps.length,window_ms:o,final:true,...h?{disabled:true}:{},tag_name:p,...f?{element_id:f}:{},...b?{component_name:b}:{},...v.length>0?{parent_components:v}:{}},created_at:new Date().toISOString(),stable_key:m.stableKey}}function c(m){let d=a.get(m);d&&(d.idleTimer&&(clearTimeout(d.idleTimer),d.idleTimer=null),d.reached&&t(s(d)),a.delete(m));}function i(m){let d=a.get(m);d&&(d.idleTimer&&clearTimeout(d.idleTimer),d.idleTimer=setTimeout(()=>{c(m);},r));}function l(m){try{let d=m.target;if(!d||!(d instanceof Element)||We(d,e.ignoreSelectors))return;let h=be(d,4);if(!h)return;let u=Se(d),p=u??h,f=Date.now(),b=a.get(p);b?(b.target=d,b.selector=h):(b={selector:h,stableKey:u,timestamps:[],reached:!1,idleTimer:null,target:d},a.set(p,b)),b.reached||(b.timestamps=b.timestamps.filter(v=>f-v<=o)),b.timestamps.push(f),i(p),!b.reached&&b.timestamps.length>=n&&(b.reached=!0);}catch{}}function g(){for(let m of Array.from(a.keys()))c(m);}return document.addEventListener("click",l,{capture:true,passive:true}),typeof window<"u"&&window.addEventListener("pagehide",g),()=>{document.removeEventListener("click",l,{capture:true}),typeof window<"u"&&window.removeEventListener("pagehide",g);for(let m of a.values())m.idleTimer&&clearTimeout(m.idleTimer);a.clear();}}function zr(e){if(e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true")return true;try{if(window.getComputedStyle(e).pointerEvents==="none")return !0}catch{}return false}var Dn=0,On=null,Ye=null,Ge=[],Vr=1500;function Wr(){function e(t){try{let n=t.target;if(!n)return;let o=n.closest('button[type="submit"], input[type="submit"], [data-blocfeed-submit]');if(!o)return;Dn=Date.now();let r=o.closest("form");On=(r?be(r,3):"")||null,Ye=re(o,100)??null,Ge=Ee(o,5);}catch{}}return document.addEventListener("click",e,{capture:true,passive:true}),()=>document.removeEventListener("click",e,{capture:true})}function Hn(e,t){if(!e.httpFail.enabled)return ()=>{};let{statusCodes:n,ignoreUrls:o,treatJsonErrorAsFail:r}=e.httpFail,a=new Set(n),s=Wr(),c=globalThis.fetch,i=async(d,h)=>{let u=typeof d=="string"?d:d instanceof URL?d.toString():d.url,p=(h?.method??d.method??"GET").toUpperCase(),f;try{f=await c.call(globalThis,d,h);}catch(b){try{if(!Xe(u,o)){let v=b&&typeof b=="object"&&b.name==="AbortError"?"abort":"network";t(m(0,u,p,v));}}catch{}throw b}try{if(!Xe(u,o)&&a.has(f.status))t(m(f.status,u,p));else if(r&&!Xe(u,o)&&f.status>=200&&f.status<300){let b=f.headers.get("content-type")??"";(b.includes("application/json")||b.includes("+json"))&&f.clone().json().then(v=>{if($r(v))try{t(m(f.status,u,p,"json_error"));}catch{}}).catch(()=>{});}}catch{}return f};globalThis.fetch=i;let l=XMLHttpRequest.prototype.open,g=XMLHttpRequest.prototype.send;return XMLHttpRequest.prototype.open=function(d,h,...u){return this.__bf_url=h,this.__bf_method=d.toUpperCase(),l.call(this,d,h,...u)},XMLHttpRequest.prototype.send=function(d){let h=()=>{try{let u=this.__bf_url??"",p=this.__bf_method??"GET";!Xe(u,o)&&a.has(this.status)&&t(m(this.status,u,p));}catch{}};return this.__bf_handler=h,this.addEventListener("loadend",h),g.call(this,d??null)},()=>{globalThis.fetch=c,XMLHttpRequest.prototype.open=l,XMLHttpRequest.prototype.send=g,s(),Ye=null,Ge=[];};function m(d,h,u,p){let b=Date.now()-Dn<Vr;return {session_id:D(),event_type:"error",page_url:typeof window>"u"?"":window.location.href,selector:null,element_text:null,event_data:{http_status:d,request_url:h,method:u,...p?{error_kind:p}:{},form_selector:b?On:null,...b&&Ye?{button_text:Ye}:{},...b&&Ge.length>0?{parent_components:Ge}:{}},created_at:new Date().toISOString(),stable_key:null}}}function $r(e){if(!e||typeof e!="object")return false;let t=e;return t.ok===false||t.success===false||"error"in t&&t.error!=null&&t.error!==false}function Xe(e,t){if(t.length===0)return false;for(let n of t)if(e.includes(n))return true;return false}var qr=3e4;function Un(e,t){if(!e.redirectLoop.enabled)return ()=>{};if(typeof window>"u")return ()=>{};let{threshold:n,windowMs:o}=e.redirectLoop,r=new Map,a=new Map,s=history.pushState,c=history.replaceState;function i(g){try{let m=Date.now(),d=a.get(g)??0;if(m<d)return;let u=(r.get(g)??[]).filter(p=>m-p<=o);if(u.push(m),r.set(g,u),u.length>=n){let p={session_id:D(),event_type:"thrashing",page_url:window.location.href,selector:null,element_text:null,event_data:{count:u.length,url:g,window_ms:o},created_at:new Date().toISOString(),stable_key:null};t(p),a.set(g,m+qr),r.set(g,[]);}}catch{}}function l(){let g=window.location.pathname+window.location.search;i(g);}return history.pushState=function(...g){let m=s.apply(this,g);return l(),m},history.replaceState=function(...g){let m=c.apply(this,g);return l(),m},window.addEventListener("popstate",l),()=>{history.pushState=s,history.replaceState=c,window.removeEventListener("popstate",l);}}var jr=6e4;function zn(e,t){if(!e.formDataLoss.enabled)return ()=>{};if(typeof window>"u")return ()=>{};let n=new Set,o=new Map,r=new Map,a=new Map;function s(p){let f=p.closest("form");return f?f.id?`#${f.id}`:"form":null}function c(){let p=0;for(let f of o.values())p+=f;return p}function i(p){n.delete(p),o.delete(p),a.delete(p);}function l(p){try{let f=p.target;if(!f||!(f instanceof HTMLInputElement||f instanceof HTMLTextAreaElement||f instanceof HTMLSelectElement))return;let b=s(f);if(!b)return;n.add(b),o.set(b,(o.get(b)??0)+1);let v=f.closest("form");v&&a.set(b,v);}catch{}}function g(p){try{let f=p.target;if(!f||!(f instanceof HTMLFormElement))return;let b=f.id?`#${f.id}`:"form";r.set(b,Date.now()),i(b);}catch{}}function m(p){try{let f=p.target;if(!f||!(f instanceof HTMLFormElement))return;let b=f.id?`#${f.id}`:"form";i(b);}catch{}}function d(p){if(n.size===0)return;let f=Array.from(n),b=f[0]??null,v=b?a.get(b)??null:null,T=v?Se(v):null,k={session_id:D(),event_type:"form_abandonment",page_url:window.location.href,selector:b,element_text:null,event_data:{cause:p,field_count:c(),forms:f},created_at:new Date().toISOString(),stable_key:T};t(k);}function h(p){if(!p.persisted||n.size===0)return;let f=Date.now();for(let[,b]of r)if(f-b<jr)return;d("bfcache_restore");}function u(){d("beforeunload_after_edit");}return document.addEventListener("input",l,{capture:true,passive:true}),document.addEventListener("submit",g,{capture:true}),document.addEventListener("reset",m,{capture:true}),window.addEventListener("pageshow",h),window.addEventListener("beforeunload",u),()=>{document.removeEventListener("input",l,{capture:true}),document.removeEventListener("submit",g,{capture:true}),document.removeEventListener("reset",m,{capture:true}),window.removeEventListener("pageshow",h),window.removeEventListener("beforeunload",u);}}function Kr(){let e={urlChangeCount:0,networkCount:0,filePickerCount:0,uninstall:()=>{}},t=history.pushState,n=history.replaceState;history.pushState=function(...c){return e.urlChangeCount+=1,t.apply(this,c)},history.replaceState=function(...c){return e.urlChangeCount+=1,n.apply(this,c)};let o=()=>{e.urlChangeCount+=1;};window.addEventListener("popstate",o);let r=globalThis.fetch;if(r){let c=(i,l)=>(e.networkCount+=1,r.call(globalThis,i,l));globalThis.fetch=c;}let a=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(c,i,...l){return e.networkCount+=1,a.call(this,c,i,...l)};let s=HTMLInputElement.prototype.click;return HTMLInputElement.prototype.click=function(){return this.type==="file"&&(e.filePickerCount+=1),s.call(this)},e.uninstall=()=>{history.pushState=t,history.replaceState=n,window.removeEventListener("popstate",o),r&&(globalThis.fetch=r),XMLHttpRequest.prototype.open=a,HTMLInputElement.prototype.click=s;},e}function Vn(e,t){if(!e.deadClick.enabled)return ()=>{};if(typeof window>"u")return ()=>{};let{observationWindowMs:n,rateLimitPerSelector:o}=e.deadClick,r=new Map,a=Kr();function s(c){try{let i=c.target;if(!i||!(i instanceof Element)||c.button!==0||c.metaKey||c.ctrlKey||c.altKey||c.shiftKey||We(i,e.ignoreSelectors)||i.closest("label"))return;if(i instanceof HTMLInputElement){let A=i.type;if(A==="checkbox"||A==="radio"||A==="file")return}if(i instanceof HTMLSelectElement||i.closest("a[target='_blank'], a[download]")||i.closest('[contenteditable="true"]'))return;try{let A=window.getSelection();if(A&&A.toString().length>0)return}catch{}let l=Jt(i);if(!l)return;let g=be(i,4);if(!g)return;let m=Se(i),d=m??g,h=a.urlChangeCount,u=a.networkCount,p=a.filePickerCount,f=new Date().toISOString(),b=re(i,200)??null,v=i.tagName.toLowerCase(),T=i.id||null,k=de(i)??null,x=Ee(i,5),L=Xr(i),O=0,P=null;if(L){P=new MutationObserver(()=>{O+=1;});try{P.observe(L,{childList:!0,attributes:!0,characterData:!0,subtree:!0});}catch{P=null;}}setTimeout(()=>{if(P)try{P.disconnect();}catch{}if(O>0||a.urlChangeCount!==h||a.networkCount!==u||a.filePickerCount!==p)return;let A=r.get(d)??0;if(A>=o)return;r.set(d,A+1);let ce={session_id:D(),event_type:"dead_click",page_url:typeof window>"u"?"":window.location.href,selector:g,element_text:b,event_data:{tag_name:v,...T?{element_id:T}:{},...k?{component_name:k}:{},...x.length>0?{parent_components:x}:{},clickable_reason:l},created_at:f,stable_key:m};t(ce);},n);}catch{}}return document.addEventListener("click",s,{capture:true,passive:true}),()=>{document.removeEventListener("click",s,{capture:true}),a.uninstall();}}function Xr(e){let t=e.closest('button, a, form, [role="button"]');return t||e.parentElement}var Wn=[{name:"email",regex:/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g,replacement:"[email]"},{name:"credit_card",regex:/\b(?:\d[ -]?){13,19}\b/g,replacement:"[card]"},{name:"ssn",regex:/\b\d{3}-\d{2}-\d{4}\b/g,replacement:"[ssn]"},{name:"phone",regex:/(?:\+?\d{1,3}[\s.-]?)?\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4}/g,replacement:"[phone]"}],Yr=[...Wn,{name:"ipv4",regex:/\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/g,replacement:"[ip]"},{name:"iban",regex:/\b[A-Z]{2}\d{2}[A-Z0-9]{11,30}\b/g,replacement:"[iban]"}],Gr=10;function Jr(e){return e==="strict"?Yr:e==="default"?Wn:[]}function Zr(e,t){let n=e;for(let o of t)n=n.replace(o.regex,o.replacement);return n}function Mt(e,t,n){if(n>Gr||e==null)return e;if(typeof e=="string")return Zr(e,t);if(typeof e=="number"||typeof e=="boolean")return e;if(Array.isArray(e))return e.map(o=>Mt(o,t,n+1));if(typeof e=="object"){let o={};for(let r of Object.keys(e))o[r]=Mt(e[r],t,n+1);return o}return e}function ue(e,t){if(t==="off")return e;let n=Jr(t);return n.length===0?e:Mt(e,n,0)}var Qr=[/^Script error\.?$/,/^ResizeObserver loop/,/^Non-Error promise rejection captured/];function ei(e){let t=e.trim();if(!t)return "";let n="",o=t,r=t.indexOf("@"),a=/^\s*at\s+(?:(.+?)\s+\()?(.+?)\)?$/.exec(t);r>-1&&!t.startsWith("at ")?(n=t.slice(0,r),o=t.slice(r+1)):a&&(n=a[1]??"",o=a[2]??""),o=o.replace(/^https?:\/\/[^/]+/,""),o=o.replace(/\?[^:]*(?=:\d|$)/,"");let s=o.split(":");return s.length>=3&&(o=s.slice(0,s.length-1).join(":")),n?`${n}@${o}`:o}function ti(e,t,n){let o=t.slice(0,120),r=[];if(n){let s=n.split(`
2
+ `);for(let c of s){let i=ei(c);if(i&&(r.push(i),r.length>=3))break}}let a=`${e}:${o}:${r.join("|")}`;return _e(a).toString(16).padStart(8,"0").slice(0,8)}function ni(e,t){for(let n of t)if(n.test(e))return true;return false}function $n(e,t){if(!e.jsError.enabled)return ()=>{};if(typeof window>"u")return ()=>{};let{sampling:n,ignorePatterns:o,rateLimitPerFingerprint:r,rateLimitWindowMs:a}=e.jsError,s=[];for(let h of o)try{s.push(new RegExp(h));}catch{}let c=[...Qr,...s],i=e.piiScrub,l=new Map;function g(h,u,p,f,b,v,T){try{if(ni(u,c))return;let k=ti(h,u,p),x=Date.now(),L=l.get(k);if(L&&x-L.windowStart<a){if(L.count>=r)return;L.count+=1;}else l.set(k,{count:1,windowStart:x});if(n<1&&Math.random()>=n)return;let O=i==="off"?u:ue(u,i),P=p==null?null:i==="off"?p:ue(p,i),A={session_id:D(),event_type:"error",page_url:window.location.href,selector:null,element_text:null,event_data:{name:h,message:O,filename:f,lineno:b,colno:v,stack:P,fingerprint:k,source:T,error_kind:"js_error"},created_at:new Date().toISOString(),stable_key:null};t(A);}catch{}}function m(h){let u=h.error,p=u?.name??"Error",f=h.message??u?.message??"Error",b=u?.stack??null;g(p,f,b,h.filename||null,typeof h.lineno=="number"?h.lineno:null,typeof h.colno=="number"?h.colno:null,"window.onerror");}function d(h){let u=h.reason,p="UnhandledRejection",f,b=null;if(u instanceof Error)p=u.name||"UnhandledRejection",f=u.message||String(u),b=u.stack??null;else if(u&&typeof u=="object"){let v=u;typeof v.name=="string"&&(p=v.name),f=typeof v.message=="string"?v.message:oi(u),b=typeof v.stack=="string"?v.stack:null;}else f=String(u);g(p,f,b,null,null,null,"unhandledrejection");}return window.addEventListener("error",m,true),window.addEventListener("unhandledrejection",d),()=>{window.removeEventListener("error",m,true),window.removeEventListener("unhandledrejection",d),l.clear();}}function oi(e){try{return JSON.stringify(e)}catch{return String(e)}}var ii="https://blocfeed.com/api/replay-events";function qn(e){if(!e.config.enabled)return ()=>{};if(typeof window>"u")return ()=>{};if(typeof globalThis.matchMedia>"u")return ()=>{};let t=D();if(_e(t)%100/100>=e.config.sampling)return ()=>{};let o=Date.now(),r=e.config.endpoint??ii,a=[],s=0,c=false,i=false,l=null,g=`bf_replay_chunkseq_${t}`,m=`bf_replay_pauses_${t}`,d=0,h=0;try{let y=sessionStorage.getItem(g);y&&(d=parseInt(y,10)||0);let _=sessionStorage.getItem(m);_&&(h=parseInt(_,10)||0);}catch{}let u=(y=false)=>{if(a.length===0)return;let _=y?si(a):a;a=[],s=0;let N=d++;try{sessionStorage.setItem(g,String(d));}catch{}ci({blocfeedId:e.blocfeedId,sessionId:t,sessionStartedAtMs:o,chunkSeq:N,events:_,endpoint:r,useBeacon:y,pauseCount:h});},p=setInterval(()=>{c||u();},e.config.flushIntervalMs),f=setTimeout(()=>{u(),pe();},e.config.maxDurationMs),b=null,v=()=>{b&&clearTimeout(b),b=setTimeout(()=>{A();},e.config.inactivityTimeoutMs);},T=()=>{u(true);};window.addEventListener("pagehide",T);let k=e.config.masking,x={emit(y){c||(a.push(y),s+=ai(y),v(),s>=e.config.flushSizeBytes&&u());},recordCanvas:false,sampling:{mousemove:50}};k.maskAllInputs!==void 0&&(x.maskAllInputs=k.maskAllInputs),k.maskTextSelector!==void 0&&(x.maskTextSelector=k.maskTextSelector),k.maskTextClass!==void 0&&(x.maskTextClass=k.maskTextClass),k.blockSelector!==void 0&&(x.blockSelector=k.blockSelector);let L=null,O=()=>{L&&(document.removeEventListener("pointerdown",L,true),document.removeEventListener("keydown",L,true),L=null);};function P(){l=record(x)??null;}function A(){if(c||i)return;i=true,h++;try{sessionStorage.setItem(m,String(h));}catch{}if(u(),l){try{l();}catch{}l=null;}b&&(clearTimeout(b),b=null);let y=()=>{O(),ce();};L=y,document.addEventListener("pointerdown",y,{capture:true,once:true}),document.addEventListener("keydown",y,{capture:true,once:true});}function ce(){c||!i||(i=false,P(),v());}v(),P();function pe(){if(!c&&(c=true,clearInterval(p),clearTimeout(f),b&&clearTimeout(b),O(),window.removeEventListener("pagehide",T),l)){try{l();}catch{}l=null;}}return pe}function ai(e){try{return JSON.stringify(e).length}catch{return 1024}}function si(e){let n=JSON.stringify(e);if(n.length<=6e4)return e;let o=[...e];for(;o.length>1;)if(o.shift(),n=JSON.stringify(o),n.length<=6e4)return o;return o}async function ci(e){let t=JSON.stringify({blocfeed_id:e.blocfeedId,session_id:e.sessionId,session_started_at_ms:e.sessionStartedAtMs,chunk_seq:e.chunkSeq,pause_count:e.pauseCount,events:e.events,page_url:typeof window<"u"?window.location.href:"",user_agent:typeof navigator<"u"?navigator.userAgent:""});if(e.useBeacon&&typeof navigator<"u"&&typeof navigator.sendBeacon=="function")try{let o=new Blob([t],{type:"application/json"});navigator.sendBeacon(e.endpoint,o);return}catch{}let n=!!e.useBeacon;try{await fetch(e.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:t,...n?{keepalive:!0}:{}});}catch{}}var li={enabled:true,endpoint:null,maxDurationMs:144e5,flushIntervalMs:3e4,flushSizeBytes:1048576,inactivityTimeoutMs:18e5,sampling:1,masking:{maskAllInputs:true,maskTextSelector:"[data-blocfeed-mask]",maskTextClass:"blocfeed-mask",blockSelector:"[data-blocfeed-block]"}};function jn(e){let t=li;return {enabled:e?.enabled??t.enabled,endpoint:e?.endpoint??t.endpoint,maxDurationMs:e?.maxDurationMs??t.maxDurationMs,flushIntervalMs:e?.flushIntervalMs??t.flushIntervalMs,flushSizeBytes:e?.flushSizeBytes??t.flushSizeBytes,inactivityTimeoutMs:e?.inactivityTimeoutMs??t.inactivityTimeoutMs,sampling:e?.sampling??t.sampling,masking:{...t.masking,...e?.masking??{}}}}var di="https://blocfeed.com/api/events/track",ui=5e3,fi=50,pi=1024,Qe="blocfeed-events-queue",Kn=500,Xn=100,mi=/^[a-z][a-z0-9_]{0,127}$/,Yn=50,Gn=1024,Jn,At="default";function Zn(e){Jn=e;}function Qn(e){At=e;}function gi(e){if(typeof e!="string"||!mi.test(e))throw new Error(`[BlocFeed] track(): event_name "${e}" must match /^[a-z][a-z0-9_]{0,127}$/ (lowercase, start with a letter, only [a-z0-9_], \u2264128 chars).`)}function bi(e){if(e===void 0)return {};if(e===null||typeof e!="object"||Array.isArray(e))throw new Error("[BlocFeed] track(): properties must be a plain object.");let t=Object.keys(e);if(t.length>Yn)throw new Error(`[BlocFeed] track(): properties has ${t.length} keys, max ${Yn}.`);for(let o of t){let r=e[o];if(r!==null&&typeof r!="string"&&typeof r!="number"&&typeof r!="boolean")throw new Error(`[BlocFeed] track(): property "${o}" has unsupported type "${typeof r}". Allowed: string | number | boolean | null.`)}let n;try{n=JSON.stringify(e);}catch(o){throw new Error(`[BlocFeed] track(): properties is not JSON-serializable (${o.message}).`)}if(n.length>Gn)throw new Error(`[BlocFeed] track(): properties serialized to ${n.length} bytes, max ${Gn}. Server allows 8192 bytes \u2014 the client cap is defensive; trim down or split the event.`);return e}function Ft(){if(typeof localStorage>"u")return [];try{let e=localStorage.getItem(Qe);if(!e)return [];let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{try{localStorage.removeItem(Qe);}catch{}return []}}function Bt(e){if(!(typeof localStorage>"u"))try{if(e.length===0)localStorage.removeItem(Qe);else {let t=e.length>Kn?e.slice(e.length-Kn):e;localStorage.setItem(Qe,JSON.stringify(t));}}catch{}}var Y=null;function hi(){if(Y)return Y;if(typeof window>"u")return null;let e=vi();return e?(Y={blocfeedId:e,endpoint:di,events:[],bytes:0,flushTimer:null,pageHideHandler:null,visibilityHandler:null},Y.flushTimer=setInterval(()=>{Ze(false);},ui),Y.pageHideHandler=()=>{Ze(true);},Y.visibilityHandler=()=>{document.visibilityState==="hidden"&&Ze(true);},window.addEventListener("pagehide",Y.pageHideHandler),document.addEventListener("visibilitychange",Y.visibilityHandler),Y):null}function vi(){try{let t=window.__blocfeed_id__;return typeof t=="string"&&t.length>0?t:null}catch{return null}}function Te(e){try{window.__blocfeed_id__=e;}catch{}Y&&(Y.blocfeedId=e);}function Be(e,t,n){gi(e);let o=bi(t),r=At==="off"?o:ue(o,At),a=n?.occurredAt?Si(n.occurredAt):new Date().toISOString(),s={event_name:e,properties:r,occurred_at:a},c=n?.sessionId??wi();c&&(s.session_id=c);let i=n?.userId??Jn;i&&(s.user_id=i);let l=n?.pageUrl??xi();l&&(s.page_url=l);let g=Ei();g&&(s.user_agent=g);let m=hi();if(!m){let d=Ft();d.push(s),Bt(d);return}m.events.push(s),m.bytes+=yi(s),(m.events.length>=fi||m.bytes>=pi)&&Ze(false);}async function Ze(e){let t=Y;if(!t)return;let o=Ft().concat(t.events);if(t.events=[],t.bytes=0,Bt([]),o.length!==0)for(let r=0;r<o.length;r+=Xn){let a=o.slice(r,r+Xn),s=JSON.stringify({blocfeed_id:t.blocfeedId,events:a});if(e&&ki())try{let c=new Blob([s],{type:"application/json"});navigator.sendBeacon(t.endpoint,c)||Je(a);continue}catch{Je(a);continue}try{(await fetch(t.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:s})).ok||Je(a);}catch{Je(a);}}}function Je(e){let t=Ft();Bt(t.concat(e));}function yi(e){try{return JSON.stringify(e).length}catch{return 256}}function wi(){try{return D()}catch{return}}function xi(){try{return typeof window<"u"?window.location.href:void 0}catch{return}}function Ei(){try{return typeof navigator<"u"?navigator.userAgent:void 0}catch{return}}function Si(e){return e instanceof Date?e.toISOString():new Date(e).toISOString()}function ki(){return typeof navigator<"u"&&typeof navigator.sendBeacon=="function"}var _i="https://blocfeed.com/api/heartbeat",Ti=300*1e3;function eo(e){if(typeof window>"u")return ()=>{};if(typeof globalThis.matchMedia>"u")return ()=>{};let t=e.endpoint??_i,n=e.intervalMs??Ti,o=e.features??["replay","behavioral","customEvents"],r=c=>{try{let i=JSON.stringify({blocfeed_id:e.blocfeedId,session_id:Ci(),version:e.version,page_url:typeof window<"u"?window.location.href:"",user_agent:typeof navigator<"u"?navigator.userAgent:"",sdk_features:o}),l={method:"POST",headers:{"Content-Type":"application/json"},body:i};c&&(l.keepalive=!0),fetch(t,l).catch(()=>{});}catch{}};try{r(!1);}catch{}let a=null;try{a=setInterval(()=>{try{r(!1);}catch{}},n);}catch{a=null;}let s=()=>{try{r(!0);}catch{}};try{window.addEventListener("pagehide",s);}catch{}return function(){try{a&&clearInterval(a);}catch{}a=null;try{window.removeEventListener("pagehide",s);}catch{}}}function Ci(){try{return D()}catch{return ""}}var Ri=5e3,Ie=class{constructor(t){this.submitter=null;this.detectorUninstallers=[];this.flushTimer=null;this.pageHideHandler=null;this.installed=false;this.opts=t,this.resolved=Cn(t.config);}install(){if(this.installed||!this.resolved.enabled)return;Ln({enabled:this.resolved.sessionTimeout.enabled,idleMs:this.resolved.sessionTimeout.idleMs,maxMs:this.resolved.sessionTimeout.maxMs});let t=()=>{try{let i=D();return _e(i)%100/100<this.resolved.sampling}catch{return false}};if(!(this.opts.passiveSampler??t)())return;Te(this.opts.blocfeedId),Qn(this.resolved.piiScrub);let o=this.opts.endpoint??"https://blocfeed.com/api/behavioral-events";this.submitter=this.opts.submitter??Rn({endpoint:o,blocfeedId:this.opts.blocfeedId});let r=this.resolved.piiScrub,a=i=>{let l=r==="off"?i:{...i,element_text:i.element_text==null?i.element_text:ue(i.element_text,r),event_data:i.event_data==null?i.event_data:ue(i.event_data,r)};this.submitter?.enqueue(l);};if(this.resolved.sessionTimeout.enabled&&typeof window<"u"){let i=()=>{Pt();},l=()=>{typeof document<"u"&&document.visibilityState==="visible"&&Pt();},g={capture:true},m={capture:true,passive:true};window.addEventListener("mousedown",i,g),window.addEventListener("keydown",i,g),window.addEventListener("touchstart",i,m),window.addEventListener("scroll",i,m),window.addEventListener("mousemove",i,m),typeof document<"u"&&document.addEventListener("visibilitychange",l),this.detectorUninstallers.push(()=>{window.removeEventListener("mousedown",i,g),window.removeEventListener("keydown",i,g),window.removeEventListener("touchstart",i,m),window.removeEventListener("scroll",i,m),window.removeEventListener("mousemove",i,m),typeof document<"u"&&document.removeEventListener("visibilitychange",l);});}this.detectorUninstallers.push(Nn(this.resolved,a)),this.detectorUninstallers.push(Hn(this.resolved,a)),this.detectorUninstallers.push(Un(this.resolved,a)),this.detectorUninstallers.push(zn(this.resolved,a)),this.detectorUninstallers.push(Vn(this.resolved,a)),this.detectorUninstallers.push($n(this.resolved,a));let s=jn(this.opts.config?.sessionReplay);this.detectorUninstallers.push(qn({blocfeedId:this.opts.blocfeedId,config:s}));let c=["behavioral","customEvents"];if(s.enabled&&c.unshift("replay"),this.opts.extraSdkFeatures)for(let i of this.opts.extraSdkFeatures)c.push(i);this.detectorUninstallers.push(eo({blocfeedId:this.opts.blocfeedId,version:to,features:c})),this.flushTimer=setInterval(()=>{this.submitter?.flush();},Ri),this.pageHideHandler=()=>{this.submitter?.flushBeacon();},typeof window<"u"&&window.addEventListener("pagehide",this.pageHideHandler),this.installed=true;}uninstall(){if(this.installed){for(let t of [...this.detectorUninstallers].reverse())try{t();}catch{}this.detectorUninstallers=[],this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=null),this.pageHideHandler&&typeof window<"u"&&(window.removeEventListener("pagehide",this.pageHideHandler),this.pageHideHandler=null);try{this.submitter?.flush();}catch{}this.submitter=null,this.installed=false;}}};var Pi=["[data-blocfeed-ui]","[data-blocfeed-ignore]"];function Mi(e){let t=[...Pi,...e?.ignoreSelectors??[]],n=Array.from(new Set(t));return {...e,ignoreSelectors:n}}function no(){return {phase:"idle"}}function Ai(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 oo(e){let t=e,n=new Ie({blocfeedId:t.blocfeed_id??"",...t.behavioral!==void 0?{config:t.behavioral}:{}});n.install();let o=no(),r=new Set,a=new Set,s=null,c=null,i=null,l=null,g=0,m=null,d=null,h=null,u=null,p=false,f=()=>{for(let y of r)y(o);},b=y=>{for(let _ of a)_(y);},v=y=>{o=y,f();},T=()=>{g+=1,l?.abort(),l=null;},k=()=>{s?.stop(),s=null,b(null),i!==null&&C()&&(document.documentElement.style.cursor=i,i=null);},x=()=>{if(h){try{URL.revokeObjectURL(h.blobUrl);}catch{}h=null;}},L=()=>{d&&(d.abort(),d=null),x();},O=null,P=()=>{u&&(u.abort(),u=null),O&&(O.abort(),O=null);},A=()=>{T(),k(),L(),P(),c=null,v(no());},ce=()=>{if(!C())return;k(),c=null;let y=Mi(t.picker);i=document.documentElement.style.cursor,document.documentElement.style.cursor="crosshair",v({phase:"picking"}),s=dn(y,{onHover:b,onSelect:({element:_,descriptor:N})=>{c=_,k(),v({phase:"review",selection:N});},onCancel:()=>{A();}});},pe=()=>{let y=cn();if(y.length!==0)for(let _ of y)Rt({payload:_,...t.transport?{transport:t.transport}:{}}).catch(()=>{yt(_);});};if(C()){setTimeout(pe,1e3);let y=()=>pe();window.addEventListener("online",y),m=()=>window.removeEventListener("online",y);}return {getState:()=>o,getConfig:()=>t,subscribe(y){return r.add(y),()=>r.delete(y)},subscribeHover(y){return a.add(y),()=>a.delete(y)},start(){o.phase==="capturing"||o.phase==="submitting"||o.phase==="recording"||o.phase!=="picking"&&ce();},stop(){A();},clearSelection(){o.phase==="capturing"||o.phase==="submitting"||o.phase==="recording"||ce();},setConfig(y){t=y;},async submit(y,_){if(!C()){let F=S("configuration",new Error("BlocFeed submit can only run in the browser"));return v({phase:"error",lastError:F}),{ok:false}}let N=t.blocfeed_id?.trim?.()??"";if(!N){let B={phase:"error",lastError:S("configuration",new Error("Missing blocfeed_id. Create a project in BlocFeed and pass its blocfeed_id."))};return o.selection&&(B.selection=o.selection),v(B),{ok:false}}if(p)return {ok:false};if(o.phase==="capturing"||o.phase==="submitting"||o.phase==="recording")return {ok:false};p=true;let H=g+1;g=H,l?.abort(),l=new AbortController;let I=l.signal,R=o.selection,G=_?.capture?{...t.capture,..._.capture}:t.capture,te=!!(G?.element||G?.fullPage),le={phase:te?"capturing":"submitting"};R&&(le.selection=R),v(le);try{let F=te?await an({selectionElement:c,capture:G,signal:I}):void 0;if(I.aborted||g!==H)return {ok:!1};let B={phase:"submitting"};R&&(B.selection=R),F&&(B.capture=F),v(B);let z={};R&&(z.selection=R),F&&(z.capture=F);let ne=await sn({config:t.metadata,context:z,...t.user?{user:t.user}:{}}),Z={version:1,createdAt:new Date().toISOString(),blocfeed_id:N,message:y,metadata:ne};_?.category&&(Z.category=_.category),t.user&&(Z.user=t.user),R&&(Z.selection=R),F&&(Z.screenshots=F),h&&(Z.video=h);let{result:X}=await Rt({payload:Z,signal:I,...t.transport?{transport:t.transport}:{}});if(I.aborted||g!==H)return X;if(X.ok){x(),c=null;let oe={phase:"success",lastSubmit:X};return R&&(oe.selection=R),F&&(oe.capture=F),v(oe),X}Ai(X)&&yt(Z);let ut=X.api?.error??S("unknown",new Error("Submission failed")),xe={phase:"error",lastSubmit:X,lastError:ut};return R&&(xe.selection=R),F&&(xe.capture=F),v(xe),X}catch(F){if(I.aborted||g!==H)return {ok:false};let z={phase:"error",lastError:I.aborted?S("aborted",F):S("unknown",F)};return R&&(z.selection=R),v(z),{ok:false}}finally{p=false,g===H&&(l=null);}},async startRecording(){if(o.phase!=="review"||!t.recording?.enabled||u||d)return;let y=o.selection,_={phase:"recording",recordingElapsedMs:0};y&&(_.selection=y),v(_);try{let N={config:t.recording};l&&(N.signal=l.signal);let H=await St(N);d=H,H.onTick(G=>{if(o.phase==="recording"){let te={phase:"recording",recordingElapsedMs:G};y&&(te.selection=y),v(te);}});let I=await H.result;d=null,h=I;let R={phase:"review",video:I};y&&(R.selection=y),v(R);}catch(N){d=null;let I={phase:"review",lastError:N?.kind?N:S("recording_failed",N)};y&&(I.selection=y),v(I);}},stopRecording(){o.phase!=="recording"||!d||d.stop();},removeVideo(){x();let y=o.selection,_={phase:"review"};y&&(_.selection=y),v(_);},async startVoice(){if(o.phase!=="review"){console.warn("[BlocFeed] startVoice: ignored \u2014 phase is",o.phase,'(expected "review")');return}let y=t.voice;if(!y?.enabled){console.warn("[BlocFeed] startVoice: ignored \u2014 voice is not enabled in config");return}if(d){console.warn("[BlocFeed] startVoice: ignored \u2014 a screen recording is already in progress");return}P();let _=o.selection,N={phase:"review",voiceRecording:true,voiceElapsedMs:0};_&&(N.selection=_),h&&(N.video=h),v(N);try{let H={config:y};l&&(H.signal=l.signal);let I=await _t(H);u=I,I.onTick(z=>{let ne={phase:"review",voiceRecording:!0,voiceElapsedMs:z};_&&(ne.selection=_),h&&(ne.video=h),v(ne);});let R=await I.result;u=null;let G={phase:"review",voiceRecording:!1,voiceTranscribing:!0};_&&(G.selection=_),h&&(G.video=h),v(G),O=new AbortController;let te={blob:R.blob,mime:R.mime,blocfeedId:t.blocfeed_id,signal:O.signal},{text:Ve,warning:le}=await Tn(te);O=null;let F={phase:"review",voiceRecording:!1,voiceTranscribing:!1};_&&(F.selection=_),h&&(F.video=h),v(F);let B={text:Ve};return le&&(B.warning=le),B}catch(H){P();let I=H?.kind?H:S("recording_failed",H);console.warn("[BlocFeed] Voice error:",I.message);let R={phase:"review",voiceRecording:false,voiceTranscribing:false,lastError:I};_&&(R.selection=_),h&&(R.video=h),v(R);return}},stopVoice(){u&&u.stop();},__unsafeGetSelectedElement(){return c},destroy(){n.uninstall(),A(),r.clear(),a.clear(),m?.(),m=null;}}}var et=createContext(null);function It(e){let t=useMemo(()=>oo({...e.config??{},blocfeed_id:e.blocfeed_id}),[]);useEffect(()=>{Te(e.blocfeed_id);},[e.blocfeed_id]);let[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(et.Provider,{value:{controller:t,state:n},children:e.children})}var ro="blocfeed-styles-v1",Ni=`
3
+ :where([data-blocfeed-ui-root]),
4
+ :where([data-blocfeed-ui-root]) * {
5
+ box-sizing: border-box;
6
+ }
7
+
8
+ :where([data-blocfeed-ui-root]) {
9
+ --bf-z: 2147483647;
10
+ --bf-font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
11
+ --bf-panel-bg: rgba(17, 24, 39, 0.98);
12
+ --bf-panel-fg: rgb(243, 244, 246);
13
+ --bf-muted: rgba(243, 244, 246, 0.72);
14
+ --bf-border: rgba(255, 255, 255, 0.14);
15
+ --bf-accent: rgb(99, 102, 241);
16
+ --bf-danger: rgb(239, 68, 68);
17
+ --bf-shadow: 0 18px 55px rgba(0, 0, 0, 0.45);
18
+
19
+ /* Ensure widget always floats above customer modals/sidepanels/overlays */
20
+ position: fixed;
21
+ top: 0;
22
+ left: 0;
23
+ width: 0;
24
+ height: 0;
25
+ overflow: visible;
26
+ z-index: var(--bf-z);
27
+ isolation: isolate;
28
+ pointer-events: none;
29
+
30
+ font-family: var(--bf-font);
31
+ color: var(--bf-panel-fg);
32
+ }
33
+
34
+ /* ------------------------------------------------------------------ */
35
+ /* Light theme */
36
+ /* ------------------------------------------------------------------ */
37
+
38
+ :where([data-blocfeed-ui-root][data-bf-theme="light"]) {
39
+ --bf-panel-bg: rgba(255, 255, 255, 0.98);
40
+ --bf-panel-fg: rgb(17, 24, 39);
41
+ --bf-muted: rgba(17, 24, 39, 0.6);
42
+ --bf-border: rgba(0, 0, 0, 0.12);
43
+ --bf-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
44
+ }
45
+
46
+ :where([data-blocfeed-ui-root][data-bf-theme="light"]) .bf-textarea {
47
+ border-color: rgba(0, 0, 0, 0.14);
48
+ background: rgba(0, 0, 0, 0.04);
49
+ color: var(--bf-panel-fg);
50
+ }
51
+
52
+ :where([data-blocfeed-ui-root][data-bf-theme="light"]) .bf-panelHeader {
53
+ border-bottom-color: rgba(0, 0, 0, 0.08);
54
+ }
55
+
56
+ :where([data-blocfeed-ui-root][data-bf-theme="light"]) .bf-title {
57
+ color: rgba(17, 24, 39, 0.85);
58
+ }
59
+
60
+ :where([data-blocfeed-ui-root][data-bf-theme="light"]) .bf-error {
61
+ color: rgb(185, 28, 28);
62
+ }
63
+
64
+ :where([data-blocfeed-ui-root][data-bf-theme="light"]) .bf-watermark a {
65
+ color: rgba(17, 24, 39, 0.35);
66
+ }
67
+
68
+ :where([data-blocfeed-ui-root][data-bf-theme="light"]) .bf-watermark {
69
+ border-top-color: rgba(0, 0, 0, 0.06);
70
+ }
71
+
72
+ :where([data-blocfeed-ui-root][data-bf-theme="light"]) .bf-highlight {
73
+ box-shadow: 0 0 0 9999px rgba(255, 255, 255, 0.42);
74
+ }
75
+
76
+ :where([data-blocfeed-ui-root][data-bf-theme="light"]) .bf-blocker {
77
+ background: rgba(255, 255, 255, 0.35);
78
+ }
79
+
80
+ /* ------------------------------------------------------------------ */
81
+ /* Trigger button \u2014 default bottom-right */
82
+ /* ------------------------------------------------------------------ */
83
+
84
+ :where([data-blocfeed-ui-root]) .bf-trigger {
85
+ position: fixed;
86
+ right: 18px;
87
+ bottom: 18px;
88
+ z-index: var(--bf-z);
89
+ pointer-events: auto;
90
+
91
+ display: inline-flex;
92
+ align-items: center;
93
+ gap: 10px;
94
+ padding: 10px 12px;
95
+ border-radius: 999px;
96
+ border: 1px solid var(--bf-border);
97
+ background: var(--bf-panel-bg);
98
+ color: var(--bf-panel-fg);
99
+ box-shadow: var(--bf-shadow);
100
+ cursor: pointer;
101
+ user-select: none;
102
+ -webkit-tap-highlight-color: transparent;
103
+ }
104
+
105
+ :where([data-blocfeed-ui-root]) .bf-trigger:hover {
106
+ border-color: var(--bf-accent);
107
+ }
108
+
109
+ :where([data-blocfeed-ui-root]) .bf-trigger:focus-visible {
110
+ outline: 2px solid var(--bf-accent);
111
+ outline-offset: 2px;
112
+ }
113
+
114
+ /* Position variants (item 9) */
115
+ :where([data-blocfeed-ui-root]) .bf-trigger-bl {
116
+ left: 18px; bottom: 18px; right: auto; top: auto;
117
+ }
118
+ :where([data-blocfeed-ui-root]) .bf-trigger-tr {
119
+ right: 18px; top: 18px; bottom: auto; left: auto;
120
+ }
121
+ :where([data-blocfeed-ui-root]) .bf-trigger-tl {
122
+ left: 18px; top: 18px; right: auto; bottom: auto;
123
+ }
124
+
125
+ :where([data-blocfeed-ui-root]) .bf-dot {
126
+ width: 10px;
127
+ height: 10px;
128
+ border-radius: 999px;
129
+ background: var(--bf-accent);
130
+ box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18);
131
+ }
132
+
133
+ /* ------------------------------------------------------------------ */
134
+ /* Overlay, blocker, highlight */
135
+ /* ------------------------------------------------------------------ */
136
+
137
+ :where([data-blocfeed-ui-root]) .bf-overlay {
138
+ position: fixed;
139
+ inset: 0;
140
+ z-index: var(--bf-z);
141
+ pointer-events: none;
142
+ }
143
+
144
+ :where([data-blocfeed-ui-root]) .bf-blocker {
145
+ position: fixed;
146
+ inset: 0;
147
+ background: rgba(0, 0, 0, 0.35);
148
+ pointer-events: auto;
149
+ }
150
+
151
+ :where([data-blocfeed-ui-root]) .bf-highlight {
152
+ position: fixed;
153
+ border: 2px solid var(--bf-accent);
154
+ border-radius: 10px;
155
+ box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.42);
156
+ pointer-events: none;
157
+ }
158
+
159
+ /* ------------------------------------------------------------------ */
160
+ /* Hint bar */
161
+ /* ------------------------------------------------------------------ */
162
+
163
+ :where([data-blocfeed-ui-root]) .bf-hint {
164
+ position: fixed;
165
+ top: 16px;
166
+ left: 50%;
167
+ transform: translateX(-50%);
168
+ max-width: min(640px, calc(100vw - 24px));
169
+ padding: 10px 12px;
170
+ border-radius: 12px;
171
+ border: 1px solid var(--bf-border);
172
+ background: var(--bf-panel-bg);
173
+ box-shadow: var(--bf-shadow);
174
+ pointer-events: auto;
175
+ display: flex;
176
+ align-items: center;
177
+ justify-content: space-between;
178
+ gap: 12px;
179
+ }
180
+
181
+ :where([data-blocfeed-ui-root]) .bf-hint p {
182
+ margin: 0;
183
+ font-size: 13px;
184
+ color: var(--bf-muted);
185
+ }
186
+
187
+ /* ------------------------------------------------------------------ */
188
+ /* Buttons */
189
+ /* ------------------------------------------------------------------ */
190
+
191
+ :where([data-blocfeed-ui-root]) .bf-btn {
192
+ border: 1px solid var(--bf-border);
193
+ background: transparent;
194
+ color: var(--bf-panel-fg);
195
+ padding: 8px 10px;
196
+ border-radius: 10px;
197
+ cursor: pointer;
198
+ user-select: none;
199
+ }
200
+
201
+ :where([data-blocfeed-ui-root]) .bf-btn:focus-visible {
202
+ outline: 2px solid var(--bf-accent);
203
+ outline-offset: 2px;
204
+ }
205
+
206
+ :where([data-blocfeed-ui-root]) .bf-btn[disabled] {
207
+ opacity: 0.6;
208
+ cursor: not-allowed;
209
+ }
210
+
211
+ :where([data-blocfeed-ui-root]) .bf-btnPrimary {
212
+ background: var(--bf-accent);
213
+ border-color: rgba(99, 102, 241, 0.6);
214
+ color: white;
215
+ }
216
+
217
+ /* ------------------------------------------------------------------ */
218
+ /* Panel */
219
+ /* ------------------------------------------------------------------ */
220
+
221
+ :where([data-blocfeed-ui-root]) .bf-panel {
222
+ position: fixed;
223
+ width: 360px;
224
+ max-width: calc(100vw - 24px);
225
+ border-radius: 14px;
226
+ border: 1px solid var(--bf-border);
227
+ background: var(--bf-panel-bg);
228
+ box-shadow: var(--bf-shadow);
229
+ pointer-events: auto;
230
+ overflow: hidden;
231
+ }
232
+
233
+ :where([data-blocfeed-ui-root]) .bf-panelHeader {
234
+ display: flex;
235
+ align-items: center;
236
+ justify-content: space-between;
237
+ gap: 8px;
238
+ padding: 12px 12px 10px;
239
+ border-bottom: 1px solid rgba(255, 255, 255, 0.08);
240
+ }
241
+
242
+ :where([data-blocfeed-ui-root]) .bf-title {
243
+ font-size: 13px;
244
+ letter-spacing: 0.3px;
245
+ text-transform: uppercase;
246
+ color: rgba(243, 244, 246, 0.85);
247
+ }
248
+
249
+ :where([data-blocfeed-ui-root]) .bf-panelBody {
250
+ padding: 12px;
251
+ display: grid;
252
+ gap: 10px;
253
+ }
254
+
255
+ /* ------------------------------------------------------------------ */
256
+ /* Form elements */
257
+ /* ------------------------------------------------------------------ */
258
+
259
+ :where([data-blocfeed-ui-root]) .bf-textarea {
260
+ width: 100%;
261
+ min-height: 96px;
262
+ resize: vertical;
263
+ padding: 10px 10px;
264
+ border-radius: 12px;
265
+ border: 1px solid rgba(255, 255, 255, 0.14);
266
+ background: rgba(0, 0, 0, 0.18);
267
+ color: var(--bf-panel-fg);
268
+ font-size: 14px;
269
+ line-height: 1.4;
270
+ }
271
+
272
+ :where([data-blocfeed-ui-root]) .bf-textarea:focus-visible {
273
+ outline: 2px solid rgba(99, 102, 241, 0.9);
274
+ outline-offset: 2px;
275
+ }
276
+
277
+ :where([data-blocfeed-ui-root]) .bf-row {
278
+ display: flex;
279
+ align-items: center;
280
+ justify-content: space-between;
281
+ gap: 10px;
282
+ }
283
+
284
+ :where([data-blocfeed-ui-root]) .bf-row label {
285
+ font-size: 13px;
286
+ color: var(--bf-muted);
287
+ display: inline-flex;
288
+ align-items: center;
289
+ gap: 8px;
290
+ user-select: none;
291
+ }
292
+
293
+ :where([data-blocfeed-ui-root]) .bf-actions {
294
+ display: flex;
295
+ gap: 10px;
296
+ justify-content: flex-end;
297
+ padding-top: 4px;
298
+ }
299
+
300
+ /* ------------------------------------------------------------------ */
301
+ /* Status, errors, toast */
302
+ /* ------------------------------------------------------------------ */
303
+
304
+ :where([data-blocfeed-ui-root]) .bf-status {
305
+ font-size: 12px;
306
+ color: var(--bf-muted);
307
+ display: flex;
308
+ align-items: center;
309
+ gap: 8px;
310
+ }
311
+
312
+ :where([data-blocfeed-ui-root]) .bf-error {
313
+ font-size: 12px;
314
+ color: rgb(254, 202, 202);
315
+ }
316
+
317
+ :where([data-blocfeed-ui-root]) .bf-toast {
318
+ position: fixed;
319
+ left: 50%;
320
+ bottom: 18px;
321
+ transform: translateX(-50%);
322
+ z-index: var(--bf-z);
323
+ padding: 10px 12px;
324
+ border-radius: 12px;
325
+ border: 1px solid var(--bf-border);
326
+ background: var(--bf-panel-bg);
327
+ box-shadow: var(--bf-shadow);
328
+ pointer-events: none;
329
+ font-size: 13px;
330
+ color: rgba(243, 244, 246, 0.9);
331
+ }
332
+
333
+ /* ------------------------------------------------------------------ */
334
+ /* Category pills */
335
+ /* ------------------------------------------------------------------ */
336
+
337
+ :where([data-blocfeed-ui-root]) .bf-pills {
338
+ display: flex;
339
+ flex-wrap: wrap;
340
+ gap: 6px;
341
+ }
342
+
343
+ :where([data-blocfeed-ui-root]) .bf-pill {
344
+ padding: 4px 10px;
345
+ border-radius: 999px;
346
+ border: 1px solid var(--bf-border);
347
+ background: transparent;
348
+ color: var(--bf-muted);
349
+ font-size: 12px;
350
+ font-family: var(--bf-font);
351
+ cursor: pointer;
352
+ user-select: none;
353
+ transition: border-color 0.15s, color 0.15s, background 0.15s;
354
+ }
355
+
356
+ :where([data-blocfeed-ui-root]) .bf-pill:hover {
357
+ border-color: var(--bf-accent);
358
+ color: var(--bf-panel-fg);
359
+ }
360
+
361
+ :where([data-blocfeed-ui-root]) .bf-pill-active {
362
+ border-color: var(--bf-accent);
363
+ background: var(--bf-accent);
364
+ color: white;
365
+ }
366
+
367
+ :where([data-blocfeed-ui-root]) .bf-pill[disabled] {
368
+ opacity: 0.6;
369
+ cursor: not-allowed;
370
+ }
371
+
372
+ /* ------------------------------------------------------------------ */
373
+ /* Capture spinner (item 12) */
374
+ /* ------------------------------------------------------------------ */
375
+
376
+ :where([data-blocfeed-ui-root]) .bf-spinner {
377
+ display: inline-block;
378
+ width: 10px;
379
+ height: 10px;
380
+ border-radius: 50%;
381
+ background: var(--bf-accent);
382
+ animation: bf-pulse 1s ease-in-out infinite;
383
+ }
384
+
385
+ @keyframes bf-pulse {
386
+ 0%, 100% { opacity: 0.4; transform: scale(0.8); }
387
+ 50% { opacity: 1; transform: scale(1.2); }
388
+ }
389
+
390
+ /* ------------------------------------------------------------------ */
391
+ /* Trigger variant: edge-tab */
392
+ /* ------------------------------------------------------------------ */
393
+
394
+ :where([data-blocfeed-ui-root]) .bf-trigger-edge {
395
+ position: fixed;
396
+ z-index: var(--bf-z);
397
+ pointer-events: auto;
398
+ display: flex;
399
+ align-items: center;
400
+ justify-content: center;
401
+ border: 1px solid var(--bf-border);
402
+ background: var(--bf-panel-bg);
403
+ color: var(--bf-panel-fg);
404
+ box-shadow: var(--bf-shadow);
405
+ cursor: pointer;
406
+ user-select: none;
407
+ -webkit-tap-highlight-color: transparent;
408
+ overflow: hidden;
409
+ padding: 0;
410
+ font-family: var(--bf-font);
411
+ font-size: 12px;
412
+ letter-spacing: 0.5px;
413
+ }
414
+
415
+ :where([data-blocfeed-ui-root]) .bf-trigger-edge:focus-visible {
416
+ outline: 2px solid var(--bf-accent);
417
+ outline-offset: 2px;
418
+ }
419
+
420
+ :where([data-blocfeed-ui-root]) .bf-trigger-edge-left {
421
+ left: 0;
422
+ right: auto;
423
+ border-radius: 0 6px 6px 0;
424
+ border-left: none;
425
+ }
426
+
427
+ :where([data-blocfeed-ui-root]) .bf-trigger-edge-right {
428
+ right: 0;
429
+ left: auto;
430
+ border-radius: 6px 0 0 6px;
431
+ border-right: none;
432
+ }
433
+
434
+ /* ------------------------------------------------------------------ */
435
+ /* Trigger variant: minimal */
436
+ /* ------------------------------------------------------------------ */
437
+
438
+ :where([data-blocfeed-ui-root]) .bf-trigger-minimal {
439
+ position: fixed;
440
+ right: 18px;
441
+ bottom: 18px;
442
+ z-index: var(--bf-z);
443
+ pointer-events: auto;
444
+ display: inline-flex;
445
+ align-items: center;
446
+ background: transparent;
447
+ border: none;
448
+ box-shadow: none;
449
+ padding: 8px 4px;
450
+ font-family: var(--bf-font);
451
+ font-size: 13px;
452
+ color: var(--bf-panel-fg);
453
+ cursor: pointer;
454
+ user-select: none;
455
+ -webkit-tap-highlight-color: transparent;
456
+ }
457
+
458
+ :where([data-blocfeed-ui-root]) .bf-trigger-minimal.bf-trigger-bl {
459
+ left: 18px; bottom: 18px; right: auto; top: auto;
460
+ }
461
+ :where([data-blocfeed-ui-root]) .bf-trigger-minimal.bf-trigger-tr {
462
+ right: 18px; top: 18px; bottom: auto; left: auto;
463
+ }
464
+ :where([data-blocfeed-ui-root]) .bf-trigger-minimal.bf-trigger-tl {
465
+ left: 18px; top: 18px; right: auto; bottom: auto;
466
+ }
467
+
468
+ :where([data-blocfeed-ui-root]) .bf-trigger-minimal:focus-visible {
469
+ outline: 2px solid var(--bf-accent);
470
+ outline-offset: 2px;
471
+ }
472
+
473
+ /* ------------------------------------------------------------------ */
474
+ /* Screen reader only */
475
+ /* ------------------------------------------------------------------ */
476
+
477
+ :where([data-blocfeed-ui-root]) .bf-sr-only {
478
+ position: absolute;
479
+ width: 1px;
480
+ height: 1px;
481
+ padding: 0;
482
+ margin: -1px;
483
+ overflow: hidden;
484
+ clip: rect(0, 0, 0, 0);
485
+ white-space: nowrap;
486
+ border: 0;
487
+ }
488
+
489
+ /* ------------------------------------------------------------------ */
490
+ /* Queue badge */
491
+ /* ------------------------------------------------------------------ */
492
+
493
+ :where([data-blocfeed-ui-root]) .bf-badge {
494
+ display: inline-flex;
495
+ align-items: center;
496
+ justify-content: center;
497
+ min-width: 16px;
498
+ height: 16px;
499
+ padding: 0 4px;
500
+ border-radius: 999px;
501
+ background: var(--bf-danger);
502
+ color: white;
503
+ font-size: 10px;
504
+ font-weight: 600;
505
+ line-height: 1;
506
+ flex-shrink: 0;
507
+ }
508
+
509
+ :where([data-blocfeed-ui-root]) .bf-badge-float {
510
+ position: absolute;
511
+ top: -4px;
512
+ right: -4px;
513
+ }
514
+
515
+ /* ------------------------------------------------------------------ */
516
+ /* Typewriter cursor */
517
+ /* ------------------------------------------------------------------ */
518
+
519
+ :where([data-blocfeed-ui-root]) .bf-cursor {
520
+ display: inline-block;
521
+ width: 1px;
522
+ height: 1em;
523
+ background: var(--bf-panel-fg);
524
+ margin-left: 1px;
525
+ vertical-align: text-bottom;
526
+ animation: bf-blink 1s steps(2) infinite;
527
+ }
528
+
529
+ @keyframes bf-blink {
530
+ 0% { opacity: 1; }
531
+ 50% { opacity: 0; }
532
+ }
533
+
534
+ /* ------------------------------------------------------------------ */
535
+ /* Panel / toast / hint entrance animations */
536
+ /* ------------------------------------------------------------------ */
537
+
538
+ :where([data-blocfeed-ui-root]) .bf-panel {
539
+ animation: bf-panel-in 0.2s ease-out;
540
+ }
541
+
542
+ @keyframes bf-panel-in {
543
+ from { opacity: 0; transform: translateY(8px); }
544
+ to { opacity: 1; transform: translateY(0); }
545
+ }
546
+
547
+ :where([data-blocfeed-ui-root]) .bf-toast {
548
+ animation: bf-toast-in 0.25s ease-out;
549
+ }
550
+
551
+ @keyframes bf-toast-in {
552
+ from { opacity: 0; transform: translateX(-50%) translateY(12px); }
553
+ to { opacity: 1; transform: translateX(-50%) translateY(0); }
554
+ }
555
+
556
+ :where([data-blocfeed-ui-root]) .bf-hint {
557
+ animation: bf-hint-in 0.2s ease-out;
558
+ }
559
+
560
+ @keyframes bf-hint-in {
561
+ from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
562
+ to { opacity: 1; transform: translateX(-50%) translateY(0); }
563
+ }
564
+
565
+ /* ------------------------------------------------------------------ */
566
+ /* Security warning banner */
567
+ /* ------------------------------------------------------------------ */
568
+
569
+ :where([data-blocfeed-ui-root]) .bf-security-banner {
570
+ position: fixed;
571
+ top: 8px;
572
+ right: 8px;
573
+ z-index: var(--bf-z);
574
+ max-width: 360px;
575
+ padding: 10px 14px;
576
+ border-radius: 10px;
577
+ border-left: 3px solid var(--bf-danger);
578
+ background: rgba(239, 68, 68, 0.12);
579
+ color: rgb(254, 202, 202);
580
+ font-family: var(--bf-font);
581
+ font-size: 12px;
582
+ line-height: 1.5;
583
+ pointer-events: auto;
584
+ animation: bf-panel-in 0.2s ease-out;
585
+ }
586
+
587
+ :where([data-blocfeed-ui-root][data-bf-theme="light"]) .bf-security-banner {
588
+ background: rgba(239, 68, 68, 0.08);
589
+ color: rgb(185, 28, 28);
590
+ }
591
+
592
+ :where([data-blocfeed-ui-root]) .bf-security-banner strong {
593
+ display: block;
594
+ margin-bottom: 4px;
595
+ font-size: 13px;
596
+ }
597
+
598
+ :where([data-blocfeed-ui-root]) .bf-security-banner-dismiss {
599
+ position: absolute;
600
+ top: 6px;
601
+ right: 6px;
602
+ background: none;
603
+ border: none;
604
+ color: inherit;
605
+ opacity: 0.6;
606
+ cursor: pointer;
607
+ padding: 2px 4px;
608
+ font-size: 14px;
609
+ line-height: 1;
610
+ }
611
+
612
+ :where([data-blocfeed-ui-root]) .bf-security-banner-dismiss:hover {
613
+ opacity: 1;
614
+ }
615
+
616
+ /* ------------------------------------------------------------------ */
617
+ /* Reduced motion */
618
+ /* ------------------------------------------------------------------ */
619
+
620
+ /* ------------------------------------------------------------------ */
621
+ /* Video recording */
622
+ /* ------------------------------------------------------------------ */
623
+
624
+ :where([data-blocfeed-ui-root]) .bf-record-btn {
625
+ display: inline-flex;
626
+ align-items: center;
627
+ gap: 6px;
628
+ padding: 6px 10px;
629
+ border-radius: 10px;
630
+ border: 1px solid var(--bf-border);
631
+ background: transparent;
632
+ color: var(--bf-panel-fg);
633
+ font-size: 13px;
634
+ font-family: var(--bf-font);
635
+ cursor: pointer;
636
+ user-select: none;
637
+ }
638
+
639
+ :where([data-blocfeed-ui-root]) .bf-record-btn:hover {
640
+ border-color: var(--bf-danger);
641
+ color: var(--bf-danger);
642
+ }
643
+
644
+ :where([data-blocfeed-ui-root]) .bf-record-btn:focus-visible {
645
+ outline: 2px solid var(--bf-accent);
646
+ outline-offset: 2px;
647
+ }
648
+
649
+ :where([data-blocfeed-ui-root]) .bf-record-btn[disabled] {
650
+ opacity: 0.6;
651
+ cursor: not-allowed;
652
+ }
653
+
654
+ /* ---- Voice feedback button ---- */
655
+
656
+ :where([data-blocfeed-ui-root]) .bf-voice-btn {
657
+ display: inline-flex;
658
+ align-items: center;
659
+ gap: 6px;
660
+ padding: 6px 12px;
661
+ border-radius: 6px;
662
+ border: 1px solid var(--bf-border);
663
+ background: transparent;
664
+ color: var(--bf-panel-fg);
665
+ font-size: 13px;
666
+ cursor: pointer;
667
+ transition: background 0.15s, border-color 0.15s;
668
+ }
669
+
670
+ :where([data-blocfeed-ui-root]) .bf-voice-btn:hover {
671
+ background: rgba(128,128,128,0.1);
672
+ }
673
+
674
+ :where([data-blocfeed-ui-root]) .bf-voice-btn:focus-visible {
675
+ outline: 2px solid var(--bf-accent);
676
+ outline-offset: 2px;
677
+ }
678
+
679
+ :where([data-blocfeed-ui-root]) .bf-voice-btn[disabled] {
680
+ opacity: 0.6;
681
+ cursor: not-allowed;
682
+ }
683
+
684
+ :where([data-blocfeed-ui-root]) .bf-voice-btn-active {
685
+ border-color: var(--bf-danger);
686
+ color: var(--bf-danger);
687
+ }
688
+
689
+ :where([data-blocfeed-ui-root]) .bf-mic-icon {
690
+ flex-shrink: 0;
691
+ }
692
+
693
+ :where([data-blocfeed-ui-root]) .bf-recording-indicator {
694
+ display: flex;
695
+ align-items: center;
696
+ gap: 8px;
697
+ font-size: 12px;
698
+ color: var(--bf-danger);
699
+ }
700
+
701
+ :where([data-blocfeed-ui-root]) .bf-rec-dot {
702
+ width: 8px;
703
+ height: 8px;
704
+ border-radius: 50%;
705
+ background: var(--bf-danger);
706
+ flex-shrink: 0;
707
+ }
708
+
709
+ :where([data-blocfeed-ui-root]) .bf-rec-dot-pulse {
710
+ animation: bf-rec-pulse 1s ease-in-out infinite;
711
+ }
712
+
713
+ @keyframes bf-rec-pulse {
714
+ 0%, 100% { opacity: 1; }
715
+ 50% { opacity: 0.3; }
716
+ }
717
+
718
+ :where([data-blocfeed-ui-root]) .bf-video-preview {
719
+ position: relative;
720
+ border-radius: 8px;
721
+ overflow: hidden;
722
+ border: 1px solid var(--bf-border);
723
+ }
724
+
725
+ :where([data-blocfeed-ui-root]) .bf-video-preview video {
726
+ width: 100%;
727
+ max-height: 120px;
728
+ object-fit: contain;
729
+ display: block;
730
+ background: black;
731
+ }
732
+
733
+ :where([data-blocfeed-ui-root]) .bf-video-remove {
734
+ position: absolute;
735
+ top: 4px;
736
+ right: 4px;
737
+ background: rgba(0, 0, 0, 0.7);
738
+ border: none;
739
+ color: white;
740
+ border-radius: 50%;
741
+ width: 20px;
742
+ height: 20px;
743
+ font-size: 12px;
744
+ cursor: pointer;
745
+ display: flex;
746
+ align-items: center;
747
+ justify-content: center;
748
+ line-height: 1;
749
+ }
750
+
751
+ :where([data-blocfeed-ui-root]) .bf-video-remove:hover {
752
+ background: rgba(0, 0, 0, 0.9);
753
+ }
754
+
755
+ :where([data-blocfeed-ui-root]) .bf-video-meta {
756
+ font-size: 11px;
757
+ color: var(--bf-muted);
758
+ padding: 4px 8px;
759
+ }
760
+
761
+ /* ------------------------------------------------------------------ */
762
+ /* Floating recording bar (shown during active recording) */
763
+ /* ------------------------------------------------------------------ */
764
+
765
+ :where([data-blocfeed-ui-root]) .bf-recording-bar {
766
+ position: fixed;
767
+ z-index: var(--bf-z);
768
+ display: flex;
769
+ align-items: center;
770
+ gap: 10px;
771
+ padding: 8px 14px;
772
+ border-radius: 20px;
773
+ background: var(--bf-bg);
774
+ border: 1px solid var(--bf-danger);
775
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(239, 68, 68, 0.25);
776
+ font-size: 13px;
777
+ color: var(--bf-fg);
778
+ pointer-events: auto;
779
+ animation: bf-slideUp 0.2s ease-out;
780
+ }
781
+
782
+ :where([data-blocfeed-ui-root]) .bf-recording-bar.bf-pos-bottom-right {
783
+ bottom: 24px;
784
+ right: 24px;
785
+ }
786
+
787
+ :where([data-blocfeed-ui-root]) .bf-recording-bar.bf-pos-bottom-left {
788
+ bottom: 24px;
789
+ left: 24px;
790
+ }
791
+
792
+ :where([data-blocfeed-ui-root]) .bf-recording-bar.bf-pos-top-right {
793
+ top: 24px;
794
+ right: 24px;
795
+ }
796
+
797
+ :where([data-blocfeed-ui-root]) .bf-recording-bar.bf-pos-top-left {
798
+ top: 24px;
799
+ left: 24px;
800
+ }
801
+
802
+ :where([data-blocfeed-ui-root]) .bf-recording-bar-timer {
803
+ color: var(--bf-danger);
804
+ font-weight: 500;
805
+ font-variant-numeric: tabular-nums;
806
+ }
807
+
808
+ :where([data-blocfeed-ui-root]) .bf-recording-bar-stop {
809
+ padding: 4px 12px;
810
+ border-radius: 12px;
811
+ border: 1px solid var(--bf-danger);
812
+ background: transparent;
813
+ color: var(--bf-danger);
814
+ font-size: 12px;
815
+ font-weight: 600;
816
+ cursor: pointer;
817
+ transition: background 0.15s, color 0.15s;
818
+ }
819
+
820
+ :where([data-blocfeed-ui-root]) .bf-recording-bar-stop:hover {
821
+ background: var(--bf-danger);
822
+ color: #fff;
823
+ }
824
+
825
+ /* ------------------------------------------------------------------ */
826
+ /* Watermark */
827
+ /* ------------------------------------------------------------------ */
828
+
829
+ :where([data-blocfeed-ui-root]) .bf-watermark {
830
+ padding: 6px 12px;
831
+ border-top: 1px solid rgba(255, 255, 255, 0.06);
832
+ text-align: center;
833
+ }
834
+
835
+ :where([data-blocfeed-ui-root]) .bf-watermark a {
836
+ font-size: 10px;
837
+ color: rgba(243, 244, 246, 0.35);
838
+ text-decoration: none;
839
+ }
840
+
841
+ :where([data-blocfeed-ui-root]) .bf-watermark a:hover {
842
+ color: var(--bf-accent);
843
+ }
844
+
845
+ :where([data-blocfeed-ui-root]) .bf-watermark .bf-my-feedback-link {
846
+ display: block;
847
+ margin-bottom: 2px;
848
+ font-size: 10px;
849
+ color: var(--bf-accent);
850
+ opacity: 0.7;
851
+ }
852
+
853
+ :where([data-blocfeed-ui-root]) .bf-watermark .bf-my-feedback-link:hover {
854
+ opacity: 1;
855
+ }
856
+
857
+ :where([data-blocfeed-ui-root]) .bf-toast-link {
858
+ display: block;
859
+ margin-top: 4px;
860
+ font-size: 11px;
861
+ color: var(--bf-accent);
862
+ pointer-events: auto;
863
+ text-decoration: none;
864
+ }
865
+
866
+ :where([data-blocfeed-ui-root]) .bf-toast-link:hover {
867
+ text-decoration: underline;
868
+ }
869
+
870
+ /* ------------------------------------------------------------------ */
871
+ /* Reduced motion */
872
+ /* ------------------------------------------------------------------ */
873
+
874
+ @media (prefers-reduced-motion: reduce) {
875
+ :where([data-blocfeed-ui-root]) .bf-panel,
876
+ :where([data-blocfeed-ui-root]) .bf-toast,
877
+ :where([data-blocfeed-ui-root]) .bf-hint,
878
+ :where([data-blocfeed-ui-root]) .bf-cursor,
879
+ :where([data-blocfeed-ui-root]) .bf-rec-dot-pulse,
880
+ :where([data-blocfeed-ui-root]) .bf-recording-bar {
881
+ animation: none;
882
+ }
883
+ }
884
+ `;function io(){if(!C()||document.getElementById(ro))return;let e=document.createElement("style");e.id=ro,e.textContent=Ni,document.head.appendChild(e);}var Le=[],Ne=[],ao=20,so=15,nt=[],co=typeof console<"u"?{log:console.log?.bind(console),warn:console.warn?.bind(console),error:console.error?.bind(console),info:console.info?.bind(console),debug:console.debug?.bind(console)}:{},ot=typeof globalThis<"u"&&typeof globalThis.fetch=="function"?globalThis.fetch:void 0,rt=typeof XMLHttpRequest<"u"?XMLHttpRequest.prototype.open:void 0,it=typeof XMLHttpRequest<"u"?XMLHttpRequest.prototype.send:void 0,Nt=new Set,Dt=false,Ot=false,at=false,Di=["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 Oi(e){if(e instanceof Error)return e.name&&e.name!=="Error"?`${e.name}: ${e.message}`:e.message||String(e);if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function Hi(e,t){let n=t.map(Oi).join(" "),o=t.find(a=>a instanceof Error),r={level:e,message:n.slice(0,2e3),timestamp:Date.now()};for(o?.stack&&(r.stack=o.stack.slice(0,2e3)),Le.push(r);Le.length>ao;)Le.shift();}function Lt(e){let t=e.url.toLowerCase();for(let n of nt)if(t.includes(n))return;for(Ne.push(e);Ne.length>so;)Ne.shift();}function lo(e={}){if(at||!C())return;at=true,ao=e.consoleLimit??20,so=e.networkLimit??15;let t=e.ignoreUrls;if(t!==void 0?nt=t.map(n=>n.toLowerCase()):nt=[...Di],e.console!==false){let n=e.consoleLevels??["error","warn"];for(let o of n){let r=co[o];r&&(Nt.add(o),console[o]=(...a)=>{Hi(o,a),r.apply(console,a);});}}if(e.network!==false&&ot){let n=ot;Dt=true,window.fetch=async function(r,a){let s=typeof r=="string"?r:r instanceof URL?r.toString():r.url,c=(a?.method??"GET").toUpperCase(),i=Date.now();try{let l=await n.call(window,r,a);return l.ok||Lt({url:s.slice(0,500),method:c,status:l.status,statusText:l.statusText,timestamp:i,durationMs:Date.now()-i}),l}catch(l){throw Lt({url:s.slice(0,500),method:c,status:0,statusText:l instanceof Error?l.message:"Network error",timestamp:i,durationMs:Date.now()-i}),l}};}if(e.network!==false&&rt&&it){let n=rt,o=it;Ot=true,XMLHttpRequest.prototype.open=function(r,a,...s){return this.__bf_method=r.toUpperCase(),this.__bf_url=String(a),n.apply(this,[r,a,...s])},XMLHttpRequest.prototype.send=function(...r){let a=this.__bf_method||"GET",s=this.__bf_url||"",c=Date.now();return this.addEventListener("loadend",function(){if(this.status>=400||this.status===0){let i={url:s.slice(0,500),method:a,status:this.status,timestamp:c,durationMs:Date.now()-c};this.statusText&&(i.statusText=this.statusText),Lt(i);}},{once:true}),o.apply(this,r)};}}function uo(){if(at){for(let e of Nt){let t=co[e];t&&(console[e]=t);}Nt.clear(),Dt&&ot&&(window.fetch=ot,Dt=false),Ot&&rt&&it&&(XMLHttpRequest.prototype.open=rt,XMLHttpRequest.prototype.send=it,Ot=false),nt=[],at=false;}}function fo(){return {consoleLogs:[...Le],networkErrors:[...Ne]}}function Gc(){Le=[],Ne=[];}var Ui=[{name:"supabase_service_role_key",pattern:/SUPABASE_SERVICE_ROLE_KEY["'=:\s]{1,8}[A-Za-z0-9_.=-]{30,400}/},{name:"supabase_db_password",pattern:/SUPABASE_DB_PASSWORD["'=:\s]{1,8}[^\s"']{6,200}/},{name:"postgres_password",pattern:/POSTGRES_PASSWORD["'=:\s]{1,8}[^\s"']{6,200}/},{name:"database_url_with_creds",pattern:/(?:postgres|postgresql|mysql|mongodb|redis|amqp):\/\/[^:\s"']{1,100}:[^@\s"']{1,200}@/},{name:"aws_access_key",pattern:/AKIA[0-9A-Z]{16}/},{name:"aws_secret_key",pattern:/AWS_SECRET_ACCESS_KEY["'=:\s]{1,8}[A-Za-z0-9/+=]{30,200}/},{name:"aws_session_token",pattern:/AWS_SESSION_TOKEN["'=:\s]{1,8}[A-Za-z0-9/+=]{30,600}/},{name:"stripe_secret_key",pattern:/sk_live_[a-zA-Z0-9]{10,200}/},{name:"stripe_secret_key_test",pattern:/sk_test_[a-zA-Z0-9]{10,200}/},{name:"stripe_restricted_key",pattern:/rk_(?:live|test)_[a-zA-Z0-9]{10,200}/},{name:"github_pat",pattern:/ghp_[A-Za-z0-9_]{36,100}/},{name:"github_oauth",pattern:/gho_[A-Za-z0-9_]{36,100}/},{name:"github_user_token",pattern:/ghu_[A-Za-z0-9_]{36,100}/},{name:"github_server_token",pattern:/ghs_[A-Za-z0-9_]{36,100}/},{name:"github_fine_grained",pattern:/github_pat_[A-Za-z0-9_]{22,200}/},{name:"openai_api_key",pattern:/sk-[a-zA-Z0-9]{20,200}(?![a-zA-Z0-9_])/},{name:"anthropic_api_key",pattern:/sk-ant-[a-zA-Z0-9\-_]{20,200}/},{name:"private_key",pattern:/-----BEGIN (?:RSA |EC |DSA |OPENSSH |PGP )?PRIVATE KEY-----/},{name:"sendgrid_api_key",pattern:/SG\.[a-zA-Z0-9_-]{22,100}\.[a-zA-Z0-9_-]{22,100}/},{name:"twilio_auth_token",pattern:/TWILIO_AUTH_TOKEN["'=:\s]{1,8}[a-f0-9]{32}/},{name:"generic_secret_key",pattern:/[A-Z_]{2,60}_SECRET_KEY["'=:\s]{1,8}[^\s"']{8,200}/},{name:"generic_secret",pattern:/[A-Z_]{2,60}_SECRET["'=:\s]{1,8}[^\s"']{8,200}/},{name:"generic_password",pattern:/[A-Z_]{2,60}_PASSWORD["'=:\s]{1,8}[^\s"']{6,200}/},{name:"generic_private_key_var",pattern:/[A-Z_]{2,60}_PRIVATE_KEY["'=:\s]{1,8}[^\s"']{8,400}/}],he=[],Ut=0,Ht=false;function zi(e){let t=e.slice(0,80);return t.length<=6?"***":t.slice(0,6)+"***"}function Vi(e,t,n,o){if(he.some(s=>s.rule===e&&s.source===t))return;let a={rule:e,source:t,hint:zi(n),timestamp:Date.now()};o&&(a.location=o),he.push(a);}function De(e,t,n,o){for(let{name:r,pattern:a}of n){let s=a.exec(e);s&&Vi(r,t,s[0],o);}}function Wi(e){try{let t=window;if(t.__NEXT_DATA__){let n=JSON.stringify(t.__NEXT_DATA__);De(n,"hydration",e,"__NEXT_DATA__");}if(t.__NUXT__){let n=JSON.stringify(t.__NUXT__);De(n,"hydration",e,"__NUXT__");}}catch{}}function $i(e){try{document.querySelectorAll("script:not([src])").forEach((n,o)=>{let r=n.textContent;r&&r.length>0&&De(r,"scripts",e,`inline-script[${o}]`);});}catch{}}function qi(e){try{document.querySelectorAll("meta[content]").forEach(n=>{let o=n.getAttribute("content"),r=n.getAttribute("name")||n.getAttribute("property")||"";o&&o.length>10&&De(o,"meta",e,r?`meta[${r}]`:void 0);});}catch{}}function ji(e){try{document.querySelectorAll("[data-api-key], [data-secret], [data-token], [data-password]").forEach(n=>{let o=n.attributes;for(let r=0;r<o.length;r++){let a=o[r];a.name.startsWith("data-")&&a.value.length>10&&De(a.value,"dom",e,`${n.tagName.toLowerCase()}[${a.name}]`);}});}catch{}}function po(e={}){if(Ht||!C()||(Ht=true,e.secretScan===false))return;let t=[...Ui,...e.customPatterns??[]],n=e.scanTargets??["hydration","scripts","meta","dom"];setTimeout(()=>{Ut=Date.now(),n.includes("hydration")&&Wi(t),n.includes("scripts")&&$i(t),n.includes("meta")&&qi(t),n.includes("dom")&&ji(t);let o=e.notify??"both";he.length>0&&(o==="console"||o==="both")&&console.warn(`[BlocFeed Security] Found ${he.length} potential secret(s) exposed in client code:`,he.map(r=>`${r.rule} (${r.source}${r.location?`: ${r.location}`:""})`));},100);}function zt(){return {findings:[...he],scannedAt:Ut}}function Qc(){he=[],Ut=0,Ht=false;}var mo={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",recordButton:"Record",stopRecordButton:"Stop",recordingText:"Recording\u2026",recordingDeniedText:"Screen share was denied",videoPreviewLabel:"Video attached",removeVideoButton:"Remove",voiceButton:"Voice",voiceStopButton:"Stop",voiceRecordingText:"Recording\u2026",voiceTranscribingText:"Transcribing\u2026",voiceDeniedText:"Microphone access was denied",voiceErrorText:"Voice transcription failed. Please type instead.",voiceEmptyText:"No speech detected. Try again or type instead."};function go(e){return e?{...mo,...e}:mo}function Vt(){let e=useContext(et);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,startRecording:e.controller.startRecording,stopRecording:e.controller.stopRecording,removeVideo:e.controller.removeVideo,track:Be}}function $(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 U({size:e=14}){return jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function bo({size:e=14}){return jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children: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 ho({size:e=16}){return jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[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"}),jsx("path",{d:"M22 6l-10 7L2 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function yo({position:e,onClick:t,isVisible:n,label:o,queueCount:r,showSuccess:a}){return n?jsxs("button",{className:$(e),type:"button",onClick:t,"aria-label":o,children:[a?jsx("span",{style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsx(U,{size:14})}):jsxs(Fragment,{children:[jsx("span",{className:"bf-dot","aria-hidden":"true"}),o]}),r>0&&jsx("span",{className:"bf-badge","aria-label":`${r} queued`,children:r})]}):null}function V(){let[e,t]=useState(()=>typeof window>"u"?false:window.matchMedia("(prefers-reduced-motion: reduce)").matches);return 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 Qi={duration:.18,ease:"easeOut"},ea={duration:0};function xo({position:e,onClick:t,isVisible:n,label:o,queueCount:r,showSuccess:a}){let[s,c]=useState(false),i=V(),l=i?ea:Qi;return jsx(AnimatePresence,{mode:"wait",children:n&&jsx(motion.button,{className:$(e),type:"button",onClick:t,onMouseEnter:()=>c(true),onMouseLeave:()=>c(false),"aria-label":o,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:l,whileTap:{scale:.92},style:{overflow:"hidden"},children:a?jsx(motion.span,{initial:{scale:0},animate:{scale:1},transition:l,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsx(U,{size:14})},"success"):jsxs(Fragment,{children:[jsx(motion.span,{className:"bf-dot","aria-hidden":"true",animate:i?{}:{scale:s?1:[1,1.2,1],boxShadow:s?"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:s||i?l:{duration:2,repeat:1/0,ease:"easeInOut"}}),jsx(AnimatePresence,{mode:"wait",children:s&&jsx(motion.span,{initial:{opacity:0,x:i?0:-6},animate:{opacity:1,x:0},exit:{opacity:0,x:i?0:-6},transition:l,style:{whiteSpace:"nowrap"},children:o},"label")}),r>0&&jsx("span",{className:"bf-badge","aria-label":`${r} queued`,children:r})]})},"dot")})}var ra={duration:.18,ease:"easeOut"},So={duration:0};function _o({position:e,onClick:t,isVisible:n,label:o,queueCount:r,showSuccess:a}){let[s,c]=useState(false),i=V(),l=i?So:ra;return jsx(AnimatePresence,{mode:"wait",children:n&&jsxs(motion.div,{className:$(e),initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{y:8,opacity:0},transition:l,onMouseEnter:()=>c(true),onMouseLeave:()=>c(false),style:{background:"transparent",border:"none",boxShadow:"none",padding:0},children:[jsx(AnimatePresence,{mode:"wait",children:s&&jsx(motion.div,{initial:{opacity:0,y:i?0:4},animate:{opacity:1,y:0},exit:{opacity:0,y:i?0:4},transition:l,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")}),jsxs(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:i?{}:{y:[0,-3,0]},transition:i?So:{y:{duration:3,repeat:1/0,ease:"easeInOut"}},whileHover:{scale:1.1,borderColor:"var(--bf-accent)"},whileTap:{scale:.9},children:[a?jsx(motion.span,{initial:{scale:0},animate:{scale:1},transition:l,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsx(U,{size:16})},"success"):jsx(bo,{size:16}),r>0&&jsx("span",{className:"bf-badge bf-badge-float","aria-label":`${r} queued`,children:r})]})]},"bubble")})}var sa={duration:.2,ease:"easeOut"},ca={duration:0};function Co(e){return e==="bottom-left"||e==="top-left"}function la(e){return `bf-trigger-edge ${Co(e)?"bf-trigger-edge-left":"bf-trigger-edge-right"}`}function Ro({position:e,onClick:t,isVisible:n,label:o,queueCount:r,showSuccess:a}){let[s,c]=useState(false),i=Co(e),l=V(),g=l?ca:sa;return jsx(AnimatePresence,{mode:"wait",children:n&&jsx(motion.button,{className:la(e),type:"button",onClick:t,onMouseEnter:()=>c(true),onMouseLeave:()=>c(false),"aria-label":o,initial:{opacity:0,width:0},animate:{opacity:1,width:s?140:22,height:s?40:90},exit:{width:0,opacity:0},transition:g,whileTap:{scale:.97},style:{top:"50%",translateY:"-50%"},children:a?jsx(motion.span,{initial:{scale:0},animate:{scale:1},transition:g,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsx(U,{size:14})},"success"):jsxs(Fragment,{children:[jsxs(motion.span,{animate:{rotate:l||s?0:i?-90:90,opacity:s?1:.6},transition:g,style:{display:"flex",alignItems:"center",gap:"8px",whiteSpace:"nowrap",fontSize:"12px",letterSpacing:"0.5px",textTransform:"uppercase"},children:[s&&jsx(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]}),jsx(motion.span,{"aria-hidden":"true",animate:{opacity:s?1:0},transition:{duration:.12},style:{position:"absolute",top:0,bottom:0,[i?"left":"right"]:0,width:"2px",background:"var(--bf-accent)"}}),r>0&&jsx("span",{className:"bf-badge","aria-label":`${r} queued`,children:r})]})},"edge-tab")})}var fa={duration:.18,ease:"easeOut"},pa={duration:0};function Mo({delay:e,hovered:t,reduced:n}){return n?null:jsx(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 Fo({position:e,onClick:t,isVisible:n,label:o,queueCount:r,showSuccess:a}){let[s,c]=useState(false),i=V(),l=i?pa:fa;return jsx(AnimatePresence,{mode:"wait",children:n&&jsx(motion.button,{className:$(e),type:"button",onClick:t,onMouseEnter:()=>c(true),onMouseLeave:()=>c(false),"aria-label":o,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:l,whileTap:{scale:.92},style:{overflow:"hidden"},children:a?jsx(motion.span,{initial:{scale:0},animate:{scale:1},transition:l,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsx(U,{size:14})},"success"):jsxs(Fragment,{children:[jsxs("span",{style:{position:"relative",display:"flex",alignItems:"center",justifyContent:"center",width:"10px",height:"10px",flexShrink:0},children:[jsx(Mo,{delay:0,hovered:s,reduced:i}),jsx(Mo,{delay:.7,hovered:s,reduced:i}),jsx(motion.span,{className:"bf-dot","aria-hidden":"true",style:{position:"relative",zIndex:1}})]}),jsx(AnimatePresence,{mode:"wait",children:s&&jsx(motion.span,{initial:{opacity:0,x:i?0:-6},animate:{opacity:1,x:0},exit:{opacity:0,x:i?0:-6},transition:l,style:{whiteSpace:"nowrap"},children:o},"label")}),r>0&&jsx("span",{className:"bf-badge","aria-label":`${r} queued`,children:r})]})},"pulse-ring")})}var ha={duration:.18,ease:"easeOut"},va={duration:0};function ya(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 Lo({position:e,onClick:t,isVisible:n,label:o,queueCount:r,showSuccess:a}){let[s,c]=useState(false),i=V(),l=i?va:ha;return jsx(AnimatePresence,{mode:"wait",children:n&&jsxs(motion.button,{className:ya(e),type:"button",onClick:t,onMouseEnter:()=>c(true),onMouseLeave:()=>c(false),"aria-label":o,initial:{opacity:0,y:i?0:5},animate:{opacity:s?1:.65,y:0},exit:{opacity:0,y:i?0:5},transition:l,whileTap:{scale:.95},children:[a?jsx("span",{style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsx(U,{size:14})}):jsxs(Fragment,{children:[jsx("span",{children:o}),r>0&&jsx("span",{className:"bf-badge",style:{marginLeft:"4px"},"aria-label":`${r} queued`,children:r})]}),!i&&jsx(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:s?1:0},transition:l})]},"minimal")})}var Ea={duration:.18,ease:"easeOut"},Sa={duration:0};function Do({position:e,onClick:t,isVisible:n,label:o,queueCount:r,showSuccess:a}){let[s,c]=useState(false),i=V(),l=i?Sa:Ea;return jsx(AnimatePresence,{mode:"wait",children:n&&jsx(motion.button,{className:$(e),type:"button",onClick:t,onMouseEnter:()=>c(true),onMouseLeave:()=>c(false),"aria-label":o,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:l,whileTap:{scale:.9},style:{overflow:"hidden"},children:a?jsx(motion.span,{initial:{scale:0},animate:{scale:1},transition:l,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsx(U,{size:14})},"success"):jsxs(Fragment,{children:[jsx(motion.span,{style:{display:"inline-flex",flexShrink:0},animate:i?{}:s?{scale:1.2,rotate:0}:{rotate:[-5,5,-5]},transition:s||i?l:{duration:3,repeat:1/0,ease:"easeInOut"},children:jsx(ho,{size:16})}),jsx(AnimatePresence,{mode:"wait",children:s&&jsx(motion.span,{initial:{opacity:0,x:i?0:-8},animate:{opacity:1,x:0},exit:{opacity:0,x:i?0:-8},transition:l,style:{whiteSpace:"nowrap"},children:o},"label")}),r>0&&jsx("span",{className:"bf-badge","aria-label":`${r} queued`,children:r})]})},"icon-pop")})}var Ca={duration:.18,ease:"easeOut"},Ra={duration:0};function Uo({position:e,onClick:t,isVisible:n,label:o,queueCount:r,showSuccess:a}){let[s,c]=useState(false),i=V(),l=i?Ra:Ca;return jsx(AnimatePresence,{mode:"wait",children:n&&jsx(motion.button,{className:$(e),type:"button",onClick:t,onMouseEnter:()=>c(true),onMouseLeave:()=>c(false),"aria-label":o,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:l,whileTap:{scale:.92},style:{overflow:"hidden"},children:a?jsx(motion.span,{initial:{scale:0},animate:{scale:1},transition:l,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsx(U,{size:14})},"success"):jsxs(Fragment,{children:[jsxs("span",{style:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:"10px",height:"10px",flexShrink:0},children:[jsx(motion.span,{"aria-hidden":"true",style:{width:"10px",height:"10px",borderRadius:"50%",background:"var(--bf-accent)",position:"relative",zIndex:1},animate:i?{}:{opacity:s?1:[.5,1,.5],boxShadow:s?"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:s||i?l:{duration:2,repeat:1/0,ease:"easeInOut"}}),!s&&!i&&jsx(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"}})]}),jsx(AnimatePresence,{mode:"wait",children:s&&jsx(motion.span,{initial:{opacity:0,x:i?0:-6},animate:{opacity:1,x:0},exit:{opacity:0,x:i?0:-6},transition:l,style:{whiteSpace:"nowrap"},children:o},"label")}),r>0&&jsx("span",{className:"bf-badge","aria-label":`${r} queued`,children:r})]})},"beacon")})}var Ba={duration:.18,ease:"easeOut"},Ia={duration:0};function $o({position:e,onClick:t,isVisible:n,label:o,queueCount:r,showSuccess:a}){let[s,c]=useState(false),[i,l]=useState(0),g=V(),m=g?Ia:Ba,d=useRef(null);useEffect(()=>{if(d.current&&(clearInterval(d.current),d.current=null),!n||s||g){l(s||g?o.length:0);return}let u=8,p=o.length*2+u*2,f=0;return d.current=setInterval(()=>{f=(f+1)%p,f<=o.length?l(f):f<=o.length+u?l(o.length):f<=o.length*2+u?l(o.length*2+u-f):l(0);},100),()=>{d.current&&(clearInterval(d.current),d.current=null);}},[n,s,g,o]);let h=o.slice(0,i);return jsx(AnimatePresence,{mode:"wait",children:n&&jsx(motion.button,{className:$(e),type:"button",onClick:t,onMouseEnter:()=>c(true),onMouseLeave:()=>c(false),"aria-label":o,initial:{opacity:0,y:g?0:5},animate:{opacity:1,y:0},exit:{opacity:0,y:g?0:5},transition:m,whileTap:{scale:.95},style:{minWidth:"44px"},children:a?jsx(motion.span,{initial:{scale:0},animate:{scale:1},transition:m,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsx(U,{size:14})},"success"):jsxs(Fragment,{children:[jsx("span",{className:"bf-dot","aria-hidden":"true"}),jsxs("span",{style:{whiteSpace:"nowrap",minWidth:"1ch"},children:[h,jsx("span",{className:"bf-cursor","aria-hidden":"true"})]}),r>0&&jsx("span",{className:"bf-badge","aria-label":`${r} queued`,children:r})]})},"typewriter")})}function qo(e){switch(e){case "dot":return xo;case "bubble":return _o;case "edge-tab":return Ro;case "pulse-ring":return Fo;case "minimal":return Lo;case "icon-pop":return Do;case "beacon":return Uo;case "typewriter":return $o;default:return yo}}function jo(e,t,n){return Math.max(t,Math.min(n,e))}function Ha(e,t,n="bottom-right"){let r=window.innerWidth,a=window.innerHeight,s;s=jo(e.x,12,Math.max(12,r-t-12));let c=e.y+e.height+12,i=Math.max(12,e.y-240);return {top:c+240<=a?c:i,left:s}}function Ua(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 jsx("div",{className:"bf-highlight",style:n,"aria-hidden":"true"})}function za(e){let t=useRef(null);return useEffect(()=>{if(!e||!t.current)return;let n=t.current,o=n.querySelector(".bf-textarea");o?.focus();let r=s=>{if(s.key!=="Tab")return;let c=n.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];s.shiftKey&&document.activeElement===i?(s.preventDefault(),l.focus()):!s.shiftKey&&document.activeElement===l&&(s.preventDefault(),i.focus());},a=s=>{let c=s.target;c&&(n.contains(c)||(s.stopImmediatePropagation(),o?.focus()));};return document.addEventListener("keydown",r,{capture:true}),document.addEventListener("focusin",a,{capture:true}),()=>{document.removeEventListener("keydown",r,{capture:true}),document.removeEventListener("focusin",a,{capture:true});}},[e]),t}function Va(e,t){return e?typeof e=="function"?e(t):e.some(n=>n.endsWith("*")?t.startsWith(n.slice(0,-1)):t===n):true}var qt=new Set,Ko=false;function Wa(){if(Ko||typeof window>"u")return;Ko=true;let e=history.pushState,t=history.replaceState,n=()=>{for(let o of qt)o();};history.pushState=function(...o){e.apply(this,o),setTimeout(n,0);},history.replaceState=function(...o){t.apply(this,o),setTimeout(n,0);};}function $a(e){let[t,n]=useState(()=>typeof window<"u"?window.location.pathname:"/");return useEffect(()=>{if(typeof window>"u")return;let o=()=>n(window.location.pathname);return window.addEventListener("popstate",o),Wa(),qt.add(o),()=>{window.removeEventListener("popstate",o),qt.delete(o);}},[]),Va(e,t)}function qa(e){let[t,n]=useState(()=>!e||e==="dark"?"dark":e==="light"?"light":typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");return useEffect(()=>{if(e!=="auto"){n(e==="light"?"light":"dark");return}let o=window.matchMedia("(prefers-color-scheme: dark)"),r=a=>n(a.matches?"dark":"light");return n(o.matches?"dark":"light"),o.addEventListener("change",r),()=>o.removeEventListener("change",r)},[e]),t}var ja=["bug","feature","ux","general"],Ka={bug:"categoryBug",feature:"categoryFeature",ux:"categoryUx",general:"categoryGeneral"};function ze(e){let t=Math.floor(e/1e3),n=Math.floor(t/60),o=t%60;return `${n}:${String(o).padStart(2,"0")}`}function Xa(e){return e<1024*1024?`${Math.round(e/1024)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Ya(e){let{state:t,controller:n,start:o,stop:r,clearSelection:a,submit:s}=Vt(),c=e.config.ui?.position,i=go(e.config.ui?.strings),l=e.config.ui?.branding!==false,[g,m]=useState(null),[d,h]=useState(""),[u,p]=useState(e.config.capture?.element??true),[f,b]=useState(e.config.capture?.fullPage??false),[v,T]=useState(null),[k,x]=useState(void 0),L=e.config.ui?.categories??ja,O=e.config.recording?.enabled===true&&Et(),P=e.config.recording?.maxDurationMs??3e4,A=n.getConfig().voice,ce=A?.enabled===true&&kt(),pe=A?.maxDurationMs??6e4,[y,_]=useState(false),[N,H]=useState(0);useEffect(()=>{let w=window.setTimeout(()=>{let W=zt();H(W.findings.length);},500);return ()=>window.clearTimeout(w)},[]),useImperativeHandle(e.handleRef,()=>({open:o,close:r,submit:w=>s(w),startRecording:()=>n.startRecording(),stopRecording:()=>n.stopRecording(),get isOpen(){return t.phase!=="idle"}}),[o,r,s,n,t.phase]);let I=t.phase==="review"||t.phase==="capturing"||t.phase==="submitting"||t.phase==="error"||t.phase==="success",R=za(I),[G,te]=useState(0);useEffect(()=>{t.phase==="idle"&&te(ln());},[t.phase]);let[Ve,le]=useState(false),F=useRef(t.phase);useEffect(()=>{if(F.current==="success"&&t.phase==="idle"){le(true);let w=window.setTimeout(()=>le(false),1500);return ()=>window.clearTimeout(w)}F.current=t.phase;},[t.phase]),useEffect(()=>{let w=e.config.ui?.shortcut;if(!w)return;let W=w.toLowerCase().split("+").map(ee=>ee.trim()),Q=W[W.length-1]||"",me=new Set(W.slice(0,-1)),Kt=ee=>{let Jo=/Mac|iPod|iPhone|iPad/.test(navigator.platform);if(me.has("mod")){if(Jo?!ee.metaKey:!ee.ctrlKey)return}else if(me.has("ctrl")&&!ee.ctrlKey||(me.has("meta")||me.has("cmd"))&&!ee.metaKey)return;me.has("shift")&&!ee.shiftKey||(me.has("alt")||me.has("option"))&&!ee.altKey||ee.key.toLowerCase()===Q&&(ee.preventDefault(),t.phase==="idle"?o():r());};return document.addEventListener("keydown",Kt),()=>document.removeEventListener("keydown",Kt)},[e.config.ui?.shortcut,t.phase,o,r]),useEffect(()=>n.subscribeHover(m),[n]),useEffect(()=>{let w=n.__unsafeGetSelectedElement();if(!w||t.phase==="idle"||t.phase==="picking"){T(null);return}let W=()=>{T(Me(w.getBoundingClientRect()));};W();let Q=()=>W();return window.addEventListener("scroll",Q,{capture:true,passive:true}),window.addEventListener("resize",Q,{passive:true}),()=>{window.removeEventListener("scroll",Q,{capture:true}),window.removeEventListener("resize",Q);}},[n,t.phase,t.selection?.selector]),useEffect(()=>{t.phase==="review"&&(h(""),p(e.config.capture?.element??true),b(e.config.capture?.fullPage??false),x(void 0),oe(null));},[t.phase,t.selection?.selector,e.config.capture?.element,e.config.capture?.fullPage]),useEffect(()=>{if(t.phase!=="success")return;let w=window.setTimeout(()=>r(),1200);return ()=>window.clearTimeout(w)},[t.phase,r]);let B=t.phase==="capturing"||t.phase==="submitting",z=t.phase==="picking"?g?.rect??null:v??t.selection?.rect??null,ne=useMemo(()=>z?Ha(z,360,c):null,[z?.x,z?.y,z?.width,z?.height,c]),Z=t.lastError?.message,X=useCallback(()=>{let w={capture:{element:u,fullPage:f}};k&&(w.category=k),s(d,w);},[s,d,u,f,k]),ut=useCallback(w=>{(w.metaKey||w.ctrlKey)&&w.key==="Enter"&&d.trim().length>0&&!B&&(w.preventDefault(),X());},[X,d,B]),[xe,oe]=useState(null),Yo=useCallback(async()=>{if(t.voiceRecording){n.stopVoice();return}oe(null);let w=await n.startVoice();if(w?.text)h(W=>W?W+" "+w.text:w.text);else if(w?.warning)oe(i.voiceEmptyText);else if(!w){let W=n.getState().lastError;if(W){let Q=W.message?.toLowerCase()??"";Q.includes("denied")||Q.includes("permission")||Q.includes("not allowed")?oe(i.voiceDeniedText):oe(i.voiceErrorText);}}},[t.voiceRecording,n,i]),Go=qo(e.config.ui?.triggerStyle);return jsxs(Fragment,{children:[jsx(Go,{position:c,onClick:()=>o(),isVisible:t.phase==="idle",label:e.config.ui?.triggerLabel??i.triggerLabel,queueCount:G,showSuccess:Ve}),t.phase!=="idle"&&t.phase!=="recording"&&jsxs("div",{className:"bf-overlay",role:"presentation",children:[t.phase!=="picking"&&jsx("div",{className:"bf-blocker",role:"presentation",onClick:()=>r()}),z&&jsx(Ua,{rect:z}),t.phase==="picking"&&jsxs("div",{className:"bf-hint",role:"status","aria-live":"polite",children:[jsx("p",{id:"bf-hint-text",children:i.hintText}),jsx("button",{type:"button",className:"bf-btn",onClick:()=>r(),"aria-label":i.cancelButton,children:i.cancelButton})]}),I&&ne&&jsxs("div",{ref:R,className:"bf-panel",style:{left:ne.left,top:ne.top},role:"dialog","aria-modal":"true","aria-label":"Feedback form",children:[jsxs("div",{className:"bf-panelHeader",children:[jsx("div",{className:"bf-title",id:"bf-panel-title",children:i.panelTitle}),jsxs("div",{className:"bf-row",style:{justifyContent:"flex-end"},children:[jsx("button",{type:"button",className:"bf-btn",onClick:()=>a(),disabled:B,"aria-label":i.rePickButton,children:i.rePickButton}),jsx("button",{type:"button",className:"bf-btn",onClick:()=>r(),disabled:B,"aria-label":i.closeButton,children:i.closeButton})]})]}),jsxs("div",{className:"bf-panelBody",children:[jsx("textarea",{className:"bf-textarea",placeholder:i.textareaPlaceholder,value:d,onChange:w=>h(w.target.value),onKeyDown:ut,disabled:B,"aria-label":i.panelTitle}),L.length>0&&jsx("div",{className:"bf-pills",role:"group","aria-label":"Feedback category",children:L.map(w=>jsx("button",{type:"button",className:`bf-pill${k===w?" bf-pill-active":""}`,onClick:()=>x(k===w?void 0:w),disabled:B,children:i[Ka[w]]},w))}),jsxs("div",{className:"bf-row",role:"group","aria-label":i.screenshotElement,children:[jsxs("label",{children:[jsx("input",{type:"checkbox",checked:u,onChange:w=>p(w.target.checked),disabled:B}),i.screenshotElement]}),jsxs("label",{children:[jsx("input",{type:"checkbox",checked:f,onChange:w=>b(w.target.checked),disabled:B}),i.screenshotFullPage]})]}),ce&&t.phase==="review"&&!t.voiceTranscribing&&jsx("button",{type:"button",className:`bf-voice-btn${t.voiceRecording?" bf-voice-btn-active":""}`,onClick:Yo,disabled:B,"aria-label":t.voiceRecording?i.voiceStopButton:i.voiceButton,children:t.voiceRecording?jsxs(Fragment,{children:[jsx("span",{className:"bf-rec-dot bf-rec-dot-pulse","aria-hidden":"true"}),i.voiceRecordingText," ",ze(t.voiceElapsedMs??0)," / ",ze(pe)," \u2014 ",i.voiceStopButton]}):jsxs(Fragment,{children:[jsxs("svg",{className:"bf-mic-icon",viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[jsx("rect",{x:"9",y:"1",width:"6",height:"11",rx:"3"}),jsx("path",{d:"M19 10v1a7 7 0 0 1-14 0v-1"}),jsx("line",{x1:"12",y1:"19",x2:"12",y2:"23"}),jsx("line",{x1:"8",y1:"23",x2:"16",y2:"23"})]}),i.voiceButton]})}),t.voiceTranscribing&&jsxs("div",{className:"bf-status",role:"status","aria-live":"polite",children:[jsx("span",{className:"bf-spinner","aria-hidden":"true"}),i.voiceTranscribingText]}),xe&&!t.voiceRecording&&!t.voiceTranscribing&&jsx("div",{className:"bf-error",role:"alert",children:xe}),O&&t.phase==="review"&&!t.video&&jsxs("button",{type:"button",className:"bf-record-btn",onClick:()=>n.startRecording(),disabled:B,"aria-label":i.recordButton,children:[jsx("span",{className:"bf-rec-dot","aria-hidden":"true"}),i.recordButton]}),t.video&&t.phase==="review"&&jsxs("div",{className:"bf-video-preview",children:[jsx("video",{src:t.video.blobUrl,controls:true,muted:true,playsInline:true}),jsx("button",{type:"button",className:"bf-video-remove",onClick:()=>n.removeVideo(),"aria-label":i.removeVideoButton,children:"\xD7"}),jsxs("div",{className:"bf-video-meta",children:[i.videoPreviewLabel," (",ze(t.video.durationMs),", ",Xa(t.video.sizeBytes),")"]})]}),t.phase==="capturing"&&jsxs("div",{className:"bf-status",role:"status","aria-live":"polite",children:[jsx("span",{className:"bf-spinner","aria-hidden":"true"}),i.capturingText]}),t.phase==="submitting"&&jsxs("div",{className:"bf-status",role:"status","aria-live":"polite",children:[jsx("span",{className:"bf-spinner","aria-hidden":"true"}),i.submittingText]}),t.phase==="success"&&jsx("div",{className:"bf-status",role:"status","aria-live":"polite",children:i.successText}),t.phase==="error"&&Z&&jsx("div",{className:"bf-error",role:"alert",children:Z}),jsxs("div",{className:"bf-actions",children:[jsx("button",{type:"button",className:"bf-btn",onClick:()=>r(),disabled:B,"aria-label":i.cancelButton,children:i.cancelButton}),jsx("button",{type:"button",className:"bf-btn bf-btnPrimary",onClick:X,disabled:B||d.trim().length===0,"aria-label":i.sendButton,children:i.sendButton})]})]}),l&&jsxs("div",{className:"bf-watermark",children:[(()=>{let w=Ct();return w?jsx("a",{href:w,target:"_blank",rel:"noopener noreferrer",className:"bf-my-feedback-link",children:"View my feedback"}):null})(),jsx("a",{href:"https://blocfeed.com",target:"_blank",rel:"noopener noreferrer",children:"Powered by BlocFeed"})]})]})]}),t.phase==="recording"&&jsxs("div",{className:`bf-recording-bar bf-pos-${c}`,role:"status","aria-live":"polite","data-blocfeed-ui":"true",children:[jsx("span",{className:"bf-rec-dot bf-rec-dot-pulse","aria-hidden":"true"}),jsxs("span",{className:"bf-recording-bar-timer",children:[i.recordingText," ",ze(t.recordingElapsedMs??0)," / ",ze(P)]}),jsx("button",{type:"button",className:"bf-recording-bar-stop",onClick:()=>n.stopRecording(),"aria-label":i.stopRecordButton,children:i.stopRecordButton})]}),t.phase==="success"&&jsxs("div",{className:"bf-toast",role:"status","aria-live":"polite",children:[i.toastText,(()=>{let w=Ct();return w?jsx("a",{href:w,target:"_blank",rel:"noopener noreferrer",className:"bf-toast-link",children:"View my feedback"}):null})()]}),N>0&&!y&&jsxs("div",{className:"bf-security-banner",role:"alert",children:[jsx("button",{type:"button",className:"bf-security-banner-dismiss",onClick:()=>_(true),"aria-label":"Dismiss",children:"\xD7"}),jsx("strong",{children:"Security Warning"}),N," potential secret",N>1?"s":""," exposed in client code. Check your environment variables."]})]})}var Ga=forwardRef(function(t,n){let o={...t.config??{},blocfeed_id:t.blocfeed_id},[r,a]=useState(null),s=$a(o.ui?.showOn),c=qa(o.ui?.theme?.mode),i=!!o.diagnostics;useEffect(()=>{if(i)return lo(o.diagnostics),()=>uo()},[i]);let l=!!o.security;useEffect(()=>{l&&po(o.security);},[l]);let g=useRef(t.config?.metadata?.enrich);g.current=t.config?.metadata?.enrich;let m=useMemo(()=>{if(t.config)return {...t.config,metadata:{...t.config.metadata,enrich:async d=>{let h=g.current,u=h?await h(d):{},p=fo(),f=zt(),b=xt();return {...u,...p.consoleLogs.length>0?{_consoleLogs:p.consoleLogs}:{},...p.networkErrors.length>0?{_networkErrors:p.networkErrors}:{},...f.findings.length>0?{_securityFindings:f.findings}:{},...b.length>0?{_clickEvents:b}:{}}}}}},[]);return useEffect(()=>{io();let d=document.createElement("div");d.setAttribute("data-blocfeed-ui-root","true"),d.setAttribute("data-blocfeed-ui","true"),d.setAttribute("data-bf-theme",c);let h=o.ui?.zIndex;typeof h=="number"&&d.style.setProperty("--bf-z",String(h));let u=o.ui?.theme;u&&(u.accentColor&&d.style.setProperty("--bf-accent",u.accentColor),u.panelBackground&&d.style.setProperty("--bf-panel-bg",u.panelBackground),u.panelForeground&&d.style.setProperty("--bf-panel-fg",u.panelForeground),u.fontFamily&&d.style.setProperty("--bf-font",u.fontFamily));let p=b=>b.stopPropagation(),f=["pointerdown","pointerup","mousedown","mouseup","click","touchstart","touchend"];for(let b of f)d.addEventListener(b,p);try{document.body.appendChild(d);}catch{return}return a(d),()=>{for(let b of f)d.removeEventListener(b,p);d.remove(),a(null);}},[o.ui?.zIndex,o.ui?.theme?.accentColor,o.ui?.theme?.panelBackground,o.ui?.theme?.panelForeground,o.ui?.theme?.fontFamily,c]),!s||!r?null:createPortal(jsx(It,{blocfeed_id:o.blocfeed_id,...m?{config:m}:{},children:jsx(Ya,{config:o,handleRef:n})}),r)});var to="0.26.0",Vd={init(e){Te(e);},identify(e){Zn(e);},track:Be};
885
+ export{po as A,zt as B,Qc as C,Vt as D,Ga as E,to as F,Vd as G,C as a,tn as b,an as c,sn as d,yt as e,cn as f,ls as g,ln as h,xt as i,yr as j,Et as k,St as l,kt as m,_t as n,Br as o,Ct as p,Tn as q,Zn as r,Be as s,Ie as t,oo as u,It as v,lo as w,uo as x,fo as y,Gc as z};