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