blocfeed 0.11.2 → 0.11.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.cjs CHANGED
@@ -842,5 +842,5 @@
842
842
  animation: none;
843
843
  }
844
844
  }
845
- `;function Fe(){if(!chunkFM72GX3J_cjs.a()||document.getElementById(Ne))return;let t=document.createElement("style");t.id=Ne,t.textContent=Rt,document.head.appendChild(t);}var Re={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 Me(t){return t?{...Re,...t}:Re}function ie(){let t=react.useContext(Y);if(!t)throw new Error("useBlocFeed must be used within a <BlocFeedProvider />");return {state:t.state,controller:t.controller,start:t.controller.start,stop:t.controller.stop,clearSelection:t.controller.clearSelection,submit:t.controller.submit,startRecording:t.controller.startRecording,stopRecording:t.controller.stopRecording,removeVideo:t.controller.removeVideo}}function w(t){switch(t){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 g({size:t=14}){return jsxRuntime.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function ze({size:t=14}){return jsxRuntime.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:jsxRuntime.jsx("path",{d:"M21 11.5a8.38 8.38 0 01-.9 3.8 8.5 8.5 0 01-7.6 4.7 8.38 8.38 0 01-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 01-.9-3.8 8.5 8.5 0 014.7-7.6 8.38 8.38 0 013.8-.9h.5a8.48 8.48 0 018 8v.5z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Le({size:t=16}){return jsxRuntime.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[jsxRuntime.jsx("path",{d:"M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M22 6l-10 7L2 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ie({position:t,onClick:e,isVisible:a,label:r,queueCount:i,showSuccess:p}){return a?jsxRuntime.jsxs("button",{className:w(t),type:"button",onClick:e,"aria-label":r,children:[p?jsxRuntime.jsx("span",{style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsxRuntime.jsx(g,{size:14})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"bf-dot","aria-hidden":"true"}),r]}),i>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${i} queued`,children:i})]}):null}function m(){let[t,e]=react.useState(()=>typeof window>"u"?false:window.matchMedia("(prefers-reduced-motion: reduce)").matches);return react.useEffect(()=>{let a=window.matchMedia("(prefers-reduced-motion: reduce)"),r=i=>e(i.matches);return a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[]),t}var _t={duration:.18,ease:"easeOut"},Ht={duration:0};function _e({position:t,onClick:e,isVisible:a,label:r,queueCount:i,showSuccess:p}){let[n,l]=react.useState(false),o=m(),s=o?Ht:_t;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:a&&jsxRuntime.jsx(framerMotion.motion.button,{className:w(t),type:"button",onClick:e,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":r,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:s,whileTap:{scale:.92},style:{overflow:"hidden"},children:p?jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:s,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsxRuntime.jsx(g,{size:14})},"success"):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.span,{className:"bf-dot","aria-hidden":"true",animate:o?{}:{scale:n?1:[1,1.2,1],boxShadow:n?"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:n||o?s:{duration:2,repeat:1/0,ease:"easeInOut"}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:n&&jsxRuntime.jsx(framerMotion.motion.span,{initial:{opacity:0,x:o?0:-6},animate:{opacity:1,x:0},exit:{opacity:0,x:o?0:-6},transition:s,style:{whiteSpace:"nowrap"},children:r},"label")}),i>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${i} queued`,children:i})]})},"dot")})}var $t={duration:.18,ease:"easeOut"},Oe={duration:0};function Ve({position:t,onClick:e,isVisible:a,label:r,queueCount:i,showSuccess:p}){let[n,l]=react.useState(false),o=m(),s=o?Oe:$t;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:a&&jsxRuntime.jsxs(framerMotion.motion.div,{className:w(t),initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{y:8,opacity:0},transition:s,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),style:{background:"transparent",border:"none",boxShadow:"none",padding:0},children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:n&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:o?0:4},animate:{opacity:1,y:0},exit:{opacity:0,y:o?0:4},transition:s,style:{position:"absolute",bottom:"calc(100% + 8px)",left:"50%",transform:"translateX(-50%)",padding:"6px 12px",borderRadius:"8px",background:"var(--bf-panel-bg)",border:"1px solid var(--bf-border)",boxShadow:"var(--bf-shadow)",whiteSpace:"nowrap",fontSize:"12px",color:"var(--bf-panel-fg)",pointerEvents:"none"},children:r},"tooltip")}),jsxRuntime.jsxs(framerMotion.motion.button,{type:"button",onClick:e,"aria-label":r,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:o?{}:{y:[0,-3,0]},transition:o?Oe:{y:{duration:3,repeat:1/0,ease:"easeInOut"}},whileHover:{scale:1.1,borderColor:"var(--bf-accent)"},whileTap:{scale:.9},children:[p?jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:s,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsxRuntime.jsx(g,{size:16})},"success"):jsxRuntime.jsx(ze,{size:16}),i>0&&jsxRuntime.jsx("span",{className:"bf-badge bf-badge-float","aria-label":`${i} queued`,children:i})]})]},"bubble")})}var Xt={duration:.2,ease:"easeOut"},Yt={duration:0};function Ke(t){return t==="bottom-left"||t==="top-left"}function Gt(t){return `bf-trigger-edge ${Ke(t)?"bf-trigger-edge-left":"bf-trigger-edge-right"}`}function Ue({position:t,onClick:e,isVisible:a,label:r,queueCount:i,showSuccess:p}){let[n,l]=react.useState(false),o=Ke(t),s=m(),h=s?Yt:Xt;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:a&&jsxRuntime.jsx(framerMotion.motion.button,{className:Gt(t),type:"button",onClick:e,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":r,initial:{opacity:0,width:0},animate:{opacity:1,width:n?140:22,height:n?40:90},exit:{width:0,opacity:0},transition:h,whileTap:{scale:.97},style:{top:"50%",translateY:"-50%"},children:p?jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:h,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsxRuntime.jsx(g,{size:14})},"success"):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.span,{animate:{rotate:s||n?0:o?-90:90,opacity:n?1:.6},transition:h,style:{display:"flex",alignItems:"center",gap:"8px",whiteSpace:"nowrap",fontSize:"12px",letterSpacing:"0.5px",textTransform:"uppercase"},children:[n&&jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:{duration:.12},style:{width:"6px",height:"6px",borderRadius:"50%",background:"var(--bf-accent)",flexShrink:0}}),r]}),jsxRuntime.jsx(framerMotion.motion.span,{"aria-hidden":"true",animate:{opacity:n?1:0},transition:{duration:.12},style:{position:"absolute",top:0,bottom:0,[o?"left":"right"]:0,width:"2px",background:"var(--bf-accent)"}}),i>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${i} queued`,children:i})]})},"edge-tab")})}var qt={duration:.18,ease:"easeOut"},Jt={duration:0};function Ye({delay:t,hovered:e,reduced:a}){return a?null:jsxRuntime.jsx(framerMotion.motion.span,{"aria-hidden":"true",style:{position:"absolute",width:"10px",height:"10px",borderRadius:"50%",border:"2px solid var(--bf-accent)",pointerEvents:"none"},animate:e?{scale:1,opacity:0}:{scale:[1,1.8],opacity:[.5,0]},transition:e?{duration:.15}:{duration:2,repeat:1/0,delay:t,ease:"easeOut"}})}function je({position:t,onClick:e,isVisible:a,label:r,queueCount:i,showSuccess:p}){let[n,l]=react.useState(false),o=m(),s=o?Jt:qt;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:a&&jsxRuntime.jsx(framerMotion.motion.button,{className:w(t),type:"button",onClick:e,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":r,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:s,whileTap:{scale:.92},style:{overflow:"hidden"},children:p?jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:s,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsxRuntime.jsx(g,{size:14})},"success"):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("span",{style:{position:"relative",display:"flex",alignItems:"center",justifyContent:"center",width:"10px",height:"10px",flexShrink:0},children:[jsxRuntime.jsx(Ye,{delay:0,hovered:n,reduced:o}),jsxRuntime.jsx(Ye,{delay:.7,hovered:n,reduced:o}),jsxRuntime.jsx(framerMotion.motion.span,{className:"bf-dot","aria-hidden":"true",style:{position:"relative",zIndex:1}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:n&&jsxRuntime.jsx(framerMotion.motion.span,{initial:{opacity:0,x:o?0:-6},animate:{opacity:1,x:0},exit:{opacity:0,x:o?0:-6},transition:s,style:{whiteSpace:"nowrap"},children:r},"label")}),i>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${i} queued`,children:i})]})},"pulse-ring")})}var oo={duration:.18,ease:"easeOut"},ro={duration:0};function io(t){switch(t){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 Je({position:t,onClick:e,isVisible:a,label:r,queueCount:i,showSuccess:p}){let[n,l]=react.useState(false),o=m(),s=o?ro:oo;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:a&&jsxRuntime.jsxs(framerMotion.motion.button,{className:io(t),type:"button",onClick:e,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":r,initial:{opacity:0,y:o?0:5},animate:{opacity:n?1:.65,y:0},exit:{opacity:0,y:o?0:5},transition:s,whileTap:{scale:.95},children:[p?jsxRuntime.jsx("span",{style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsxRuntime.jsx(g,{size:14})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{children:r}),i>0&&jsxRuntime.jsx("span",{className:"bf-badge",style:{marginLeft:"4px"},"aria-label":`${i} queued`,children:i})]}),!o&&jsxRuntime.jsx(framerMotion.motion.span,{"aria-hidden":"true",style:{position:"absolute",bottom:4,left:4,right:4,height:"2px",background:"var(--bf-accent)",borderRadius:"1px",transformOrigin:"left"},initial:false,animate:{scaleX:n?1:0},transition:s})]},"minimal")})}var so={duration:.18,ease:"easeOut"},co={duration:0};function et({position:t,onClick:e,isVisible:a,label:r,queueCount:i,showSuccess:p}){let[n,l]=react.useState(false),o=m(),s=o?co:so;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:a&&jsxRuntime.jsx(framerMotion.motion.button,{className:w(t),type:"button",onClick:e,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":r,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:s,whileTap:{scale:.9},style:{overflow:"hidden"},children:p?jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:s,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsxRuntime.jsx(g,{size:14})},"success"):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.span,{style:{display:"inline-flex",flexShrink:0},animate:o?{}:n?{scale:1.2,rotate:0}:{rotate:[-5,5,-5]},transition:n||o?s:{duration:3,repeat:1/0,ease:"easeInOut"},children:jsxRuntime.jsx(Le,{size:16})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:n&&jsxRuntime.jsx(framerMotion.motion.span,{initial:{opacity:0,x:o?0:-8},animate:{opacity:1,x:0},exit:{opacity:0,x:o?0:-8},transition:s,style:{whiteSpace:"nowrap"},children:r},"label")}),i>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${i} queued`,children:i})]})},"icon-pop")})}var uo={duration:.18,ease:"easeOut"},bo={duration:0};function rt({position:t,onClick:e,isVisible:a,label:r,queueCount:i,showSuccess:p}){let[n,l]=react.useState(false),o=m(),s=o?bo:uo;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:a&&jsxRuntime.jsx(framerMotion.motion.button,{className:w(t),type:"button",onClick:e,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":r,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:s,whileTap:{scale:.92},style:{overflow:"hidden"},children:p?jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:s,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsxRuntime.jsx(g,{size:14})},"success"):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("span",{style:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:"10px",height:"10px",flexShrink:0},children:[jsxRuntime.jsx(framerMotion.motion.span,{"aria-hidden":"true",style:{width:"10px",height:"10px",borderRadius:"50%",background:"var(--bf-accent)",position:"relative",zIndex:1},animate:o?{}:{opacity:n?1:[.5,1,.5],boxShadow:n?"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:n||o?s:{duration:2,repeat:1/0,ease:"easeInOut"}}),!n&&!o&&jsxRuntime.jsx(framerMotion.motion.span,{"aria-hidden":"true",style:{position:"absolute",width:"18px",height:"2px",background:"linear-gradient(90deg, var(--bf-accent), transparent)",transformOrigin:"left center",left:"5px",top:"4px"},animate:{rotate:[0,360]},transition:{duration:4,repeat:1/0,ease:"linear"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:n&&jsxRuntime.jsx(framerMotion.motion.span,{initial:{opacity:0,x:o?0:-6},animate:{opacity:1,x:0},exit:{opacity:0,x:o?0:-6},transition:s,style:{whiteSpace:"nowrap"},children:r},"label")}),i>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${i} queued`,children:i})]})},"beacon")})}var vo={duration:.18,ease:"easeOut"},yo={duration:0};function st({position:t,onClick:e,isVisible:a,label:r,queueCount:i,showSuccess:p}){let[n,l]=react.useState(false),[o,s]=react.useState(0),h=m(),z=h?yo:vo,f=react.useRef(null);react.useEffect(()=>{if(f.current&&(clearInterval(f.current),f.current=null),!a||n||h){s(n||h?r.length:0);return}let b=8,B=r.length*2+b*2,v=0;return f.current=setInterval(()=>{v=(v+1)%B,v<=r.length?s(v):v<=r.length+b?s(r.length):v<=r.length*2+b?s(r.length*2+b-v):s(0);},100),()=>{f.current&&(clearInterval(f.current),f.current=null);}},[a,n,h,r]);let S=r.slice(0,o);return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:a&&jsxRuntime.jsx(framerMotion.motion.button,{className:w(t),type:"button",onClick:e,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":r,initial:{opacity:0,y:h?0:5},animate:{opacity:1,y:0},exit:{opacity:0,y:h?0:5},transition:z,whileTap:{scale:.95},style:{minWidth:"44px"},children:p?jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:z,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsxRuntime.jsx(g,{size:14})},"success"):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"bf-dot","aria-hidden":"true"}),jsxRuntime.jsxs("span",{style:{whiteSpace:"nowrap",minWidth:"1ch"},children:[S,jsxRuntime.jsx("span",{className:"bf-cursor","aria-hidden":"true"})]}),i>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${i} queued`,children:i})]})},"typewriter")})}function ct(t){switch(t){case "dot":return _e;case "bubble":return Ve;case "edge-tab":return Ue;case "pulse-ring":return je;case "minimal":return Je;case "icon-pop":return et;case "beacon":return rt;case "typewriter":return st;default:return Ie}}function lt(t,e,a){return Math.max(e,Math.min(a,t))}function Eo(t,e,a="bottom-right"){let i=window.innerWidth,p=window.innerHeight,n;n=lt(t.x,12,Math.max(12,i-e-12));let l=t.y+t.height+12,o=Math.max(12,t.y-240);return {top:l+240<=p?l:o,left:n}}function Co(t){let{rect:e}=t,a={left:`${e.x}px`,top:`${e.y}px`,width:`${Math.max(0,e.width)}px`,height:`${Math.max(0,e.height)}px`};return jsxRuntime.jsx("div",{className:"bf-highlight",style:a,"aria-hidden":"true"})}function Po(t){let e=react.useRef(null);return react.useEffect(()=>{if(!t||!e.current)return;e.current.querySelector(".bf-textarea")?.focus();let r=i=>{if(i.key!=="Tab"||!e.current)return;let p=e.current.querySelectorAll('button:not([disabled]), textarea:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])');if(p.length===0)return;let n=p[0],l=p[p.length-1];i.shiftKey&&document.activeElement===n?(i.preventDefault(),l.focus()):!i.shiftKey&&document.activeElement===l&&(i.preventDefault(),n.focus());};return document.addEventListener("keydown",r,{capture:true}),()=>document.removeEventListener("keydown",r,{capture:true})},[t]),e}function Bo(t,e){return t?typeof t=="function"?t(e):t.some(a=>a.endsWith("*")?e.startsWith(a.slice(0,-1)):e===a):true}function No(t){let[e,a]=react.useState(()=>typeof window<"u"?window.location.pathname:"/");return react.useEffect(()=>{if(typeof window>"u")return;let r=()=>a(window.location.pathname);window.addEventListener("popstate",r);let i=history.pushState,p=history.replaceState;return history.pushState=function(...n){i.apply(this,n),r();},history.replaceState=function(...n){p.apply(this,n),r();},()=>{window.removeEventListener("popstate",r),history.pushState=i,history.replaceState=p;}},[]),Bo(t,e)}function Fo(t){let[e,a]=react.useState(()=>!t||t==="dark"?"dark":t==="light"?"light":typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");return react.useEffect(()=>{if(t!=="auto"){a(t==="light"?"light":"dark");return}let r=window.matchMedia("(prefers-color-scheme: dark)"),i=p=>a(p.matches?"dark":"light");return a(r.matches?"dark":"light"),r.addEventListener("change",i),()=>r.removeEventListener("change",i)},[t]),e}var Ro=["bug","feature","ux","general"],Mo={bug:"categoryBug",feature:"categoryFeature",ux:"categoryUx",general:"categoryGeneral"};function X(t){let e=Math.floor(t/1e3),a=Math.floor(e/60),r=e%60;return `${a}:${String(r).padStart(2,"0")}`}function zo(t){return t<1024*1024?`${Math.round(t/1024)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function Lo(t){let{state:e,controller:a,start:r,stop:i,clearSelection:p,submit:n}=ie(),l=t.config.ui?.position,o=Me(t.config.ui?.strings),s=t.config.ui?.branding!==false,[h,z]=react.useState(null),[f,S]=react.useState(""),[b,B]=react.useState(t.config.capture?.element??true),[v,O]=react.useState(t.config.capture?.fullPage??false),[pt,ce]=react.useState(null),[D,le]=react.useState(void 0),de=t.config.ui?.categories??Ro,ft=t.config.recording?.enabled===true&&chunkFM72GX3J_cjs.l(),ut=t.config.recording?.maxDurationMs??3e4,pe=a.getConfig().voice,bt=pe?.enabled===true&&chunkFM72GX3J_cjs.n(),gt=pe?.maxDurationMs??6e4,[mt,ht]=react.useState(false),[J,xt]=react.useState(0);react.useEffect(()=>{let d=window.setTimeout(()=>{let y=chunkFM72GX3J_cjs.w();xt(y.findings.length);},500);return ()=>window.clearTimeout(d)},[]),react.useImperativeHandle(t.handleRef,()=>({open:r,close:i,submit:d=>n(d),startRecording:()=>a.startRecording(),stopRecording:()=>a.stopRecording(),get isOpen(){return e.phase!=="idle"}}),[r,i,n,a,e.phase]);let fe=e.phase==="review"||e.phase==="capturing"||e.phase==="submitting"||e.phase==="error"||e.phase==="success",vt=Po(fe),[yt,wt]=react.useState(0);react.useEffect(()=>{e.phase==="idle"&&wt(chunkFM72GX3J_cjs.i());},[e.phase]);let[kt,ue]=react.useState(false),be=react.useRef(e.phase);react.useEffect(()=>{if(be.current==="success"&&e.phase==="idle"){ue(true);let d=window.setTimeout(()=>ue(false),1500);return ()=>window.clearTimeout(d)}be.current=e.phase;},[e.phase]),react.useEffect(()=>{let d=t.config.ui?.shortcut;if(!d)return;let y=d.toLowerCase().split("+").map(P=>P.trim()),C=y[y.length-1]||"",L=new Set(y.slice(0,-1)),he=P=>{let Ct=/Mac|iPod|iPhone|iPad/.test(navigator.platform);if(L.has("mod")){if(Ct?!P.metaKey:!P.ctrlKey)return}else if(L.has("ctrl")&&!P.ctrlKey||(L.has("meta")||L.has("cmd"))&&!P.metaKey)return;L.has("shift")&&!P.shiftKey||(L.has("alt")||L.has("option"))&&!P.altKey||P.key.toLowerCase()===C&&(P.preventDefault(),e.phase==="idle"?r():i());};return document.addEventListener("keydown",he),()=>document.removeEventListener("keydown",he)},[t.config.ui?.shortcut,e.phase,r,i]),react.useEffect(()=>a.subscribeHover(z),[a]),react.useEffect(()=>{let d=a.__unsafeGetSelectedElement();if(!d||e.phase==="idle"||e.phase==="picking"){ce(null);return}let y=()=>{ce(chunkFM72GX3J_cjs.b(d.getBoundingClientRect()));};y();let C=()=>y();return window.addEventListener("scroll",C,{capture:true,passive:true}),window.addEventListener("resize",C,{passive:true}),()=>{window.removeEventListener("scroll",C,{capture:true}),window.removeEventListener("resize",C);}},[a,e.phase,e.selection?.selector]),react.useEffect(()=>{e.phase==="review"&&(S(""),B(t.config.capture?.element??true),O(t.config.capture?.fullPage??false),le(void 0),V(null));},[e.phase,e.selection?.selector,t.config.capture?.element,t.config.capture?.fullPage]),react.useEffect(()=>{if(e.phase!=="success")return;let d=window.setTimeout(()=>i(),1200);return ()=>window.clearTimeout(d)},[e.phase,i]);let T=e.phase==="capturing"||e.phase==="submitting",R=e.phase==="picking"?h?.rect??null:pt??e.selection?.rect??null,Z=react.useMemo(()=>R?Eo(R,360,l):null,[R?.x,R?.y,R?.width,R?.height,l]),ge=e.lastError?.message,ee=react.useCallback(()=>{let d={capture:{element:b,fullPage:v}};D&&(d.category=D),n(f,d);},[n,f,b,v,D]),Tt=react.useCallback(d=>{(d.metaKey||d.ctrlKey)&&d.key==="Enter"&&f.trim().length>0&&!T&&(d.preventDefault(),ee());},[ee,f,T]),[me,V]=react.useState(null),St=react.useCallback(async()=>{if(e.voiceRecording){a.stopVoice();return}V(null);let d=await a.startVoice();if(d?.text)S(y=>y?y+" "+d.text:d.text);else if(d?.warning)V(o.voiceEmptyText);else if(!d){let y=a.getState().lastError;if(y){let C=y.message?.toLowerCase()??"";C.includes("denied")||C.includes("permission")||C.includes("not allowed")?V(o.voiceDeniedText):V(o.voiceErrorText);}}},[e.voiceRecording,a,o]),Et=ct(t.config.ui?.triggerStyle);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Et,{position:l,onClick:()=>r(),isVisible:e.phase==="idle",label:t.config.ui?.triggerLabel??o.triggerLabel,queueCount:yt,showSuccess:kt}),e.phase!=="idle"&&e.phase!=="recording"&&jsxRuntime.jsxs("div",{className:"bf-overlay",role:"presentation",children:[e.phase!=="picking"&&jsxRuntime.jsx("div",{className:"bf-blocker",role:"presentation",onClick:()=>i()}),R&&jsxRuntime.jsx(Co,{rect:R}),e.phase==="picking"&&jsxRuntime.jsxs("div",{className:"bf-hint",role:"status","aria-live":"polite",children:[jsxRuntime.jsx("p",{id:"bf-hint-text",children:o.hintText}),jsxRuntime.jsx("button",{type:"button",className:"bf-btn",onClick:()=>i(),"aria-label":o.cancelButton,children:o.cancelButton})]}),fe&&Z&&jsxRuntime.jsxs("div",{ref:vt,className:"bf-panel",style:{left:Z.left,top:Z.top},role:"dialog","aria-modal":"true","aria-label":"Feedback form",children:[jsxRuntime.jsxs("div",{className:"bf-panelHeader",children:[jsxRuntime.jsx("div",{className:"bf-title",id:"bf-panel-title",children:o.panelTitle}),jsxRuntime.jsxs("div",{className:"bf-row",style:{justifyContent:"flex-end"},children:[jsxRuntime.jsx("button",{type:"button",className:"bf-btn",onClick:()=>p(),disabled:T,"aria-label":o.rePickButton,children:o.rePickButton}),jsxRuntime.jsx("button",{type:"button",className:"bf-btn",onClick:()=>i(),disabled:T,"aria-label":o.closeButton,children:o.closeButton})]})]}),jsxRuntime.jsxs("div",{className:"bf-panelBody",children:[jsxRuntime.jsx("textarea",{className:"bf-textarea",placeholder:o.textareaPlaceholder,value:f,onChange:d=>S(d.target.value),onKeyDown:Tt,disabled:T,"aria-label":o.panelTitle}),de.length>0&&jsxRuntime.jsx("div",{className:"bf-pills",role:"group","aria-label":"Feedback category",children:de.map(d=>jsxRuntime.jsx("button",{type:"button",className:`bf-pill${D===d?" bf-pill-active":""}`,onClick:()=>le(D===d?void 0:d),disabled:T,children:o[Mo[d]]},d))}),jsxRuntime.jsxs("div",{className:"bf-row",role:"group","aria-label":o.screenshotElement,children:[jsxRuntime.jsxs("label",{children:[jsxRuntime.jsx("input",{type:"checkbox",checked:b,onChange:d=>B(d.target.checked),disabled:T}),o.screenshotElement]}),jsxRuntime.jsxs("label",{children:[jsxRuntime.jsx("input",{type:"checkbox",checked:v,onChange:d=>O(d.target.checked),disabled:T}),o.screenshotFullPage]})]}),bt&&e.phase==="review"&&!e.voiceTranscribing&&jsxRuntime.jsx("button",{type:"button",className:`bf-voice-btn${e.voiceRecording?" bf-voice-btn-active":""}`,onClick:St,disabled:T,"aria-label":e.voiceRecording?o.voiceStopButton:o.voiceButton,children:e.voiceRecording?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"bf-rec-dot bf-rec-dot-pulse","aria-hidden":"true"}),o.voiceRecordingText," ",X(e.voiceElapsedMs??0)," / ",X(gt)," \u2014 ",o.voiceStopButton]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.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:[jsxRuntime.jsx("rect",{x:"9",y:"1",width:"6",height:"11",rx:"3"}),jsxRuntime.jsx("path",{d:"M19 10v1a7 7 0 0 1-14 0v-1"}),jsxRuntime.jsx("line",{x1:"12",y1:"19",x2:"12",y2:"23"}),jsxRuntime.jsx("line",{x1:"8",y1:"23",x2:"16",y2:"23"})]}),o.voiceButton]})}),e.voiceTranscribing&&jsxRuntime.jsxs("div",{className:"bf-status",role:"status","aria-live":"polite",children:[jsxRuntime.jsx("span",{className:"bf-spinner","aria-hidden":"true"}),o.voiceTranscribingText]}),me&&!e.voiceRecording&&!e.voiceTranscribing&&jsxRuntime.jsx("div",{className:"bf-error",role:"alert",children:me}),ft&&e.phase==="review"&&!e.video&&jsxRuntime.jsxs("button",{type:"button",className:"bf-record-btn",onClick:()=>a.startRecording(),disabled:T,"aria-label":o.recordButton,children:[jsxRuntime.jsx("span",{className:"bf-rec-dot","aria-hidden":"true"}),o.recordButton]}),e.video&&e.phase==="review"&&jsxRuntime.jsxs("div",{className:"bf-video-preview",children:[jsxRuntime.jsx("video",{src:e.video.blobUrl,controls:true,muted:true,playsInline:true}),jsxRuntime.jsx("button",{type:"button",className:"bf-video-remove",onClick:()=>a.removeVideo(),"aria-label":o.removeVideoButton,children:"\xD7"}),jsxRuntime.jsxs("div",{className:"bf-video-meta",children:[o.videoPreviewLabel," (",X(e.video.durationMs),", ",zo(e.video.sizeBytes),")"]})]}),e.phase==="capturing"&&jsxRuntime.jsxs("div",{className:"bf-status",role:"status","aria-live":"polite",children:[jsxRuntime.jsx("span",{className:"bf-spinner","aria-hidden":"true"}),o.capturingText]}),e.phase==="submitting"&&jsxRuntime.jsxs("div",{className:"bf-status",role:"status","aria-live":"polite",children:[jsxRuntime.jsx("span",{className:"bf-spinner","aria-hidden":"true"}),o.submittingText]}),e.phase==="success"&&jsxRuntime.jsx("div",{className:"bf-status",role:"status","aria-live":"polite",children:o.successText}),e.phase==="error"&&ge&&jsxRuntime.jsx("div",{className:"bf-error",role:"alert",children:ge}),jsxRuntime.jsxs("div",{className:"bf-actions",children:[jsxRuntime.jsx("button",{type:"button",className:"bf-btn",onClick:()=>i(),disabled:T,"aria-label":o.cancelButton,children:o.cancelButton}),jsxRuntime.jsx("button",{type:"button",className:"bf-btn bf-btnPrimary",onClick:ee,disabled:T||f.trim().length===0,"aria-label":o.sendButton,children:o.sendButton})]})]}),s&&jsxRuntime.jsx("div",{className:"bf-watermark",children:jsxRuntime.jsx("a",{href:"https://blocfeed.com",target:"_blank",rel:"noopener noreferrer",children:"Powered by BlocFeed"})})]})]}),e.phase==="recording"&&jsxRuntime.jsxs("div",{className:`bf-recording-bar bf-pos-${l}`,role:"status","aria-live":"polite","data-blocfeed-ui":"true",children:[jsxRuntime.jsx("span",{className:"bf-rec-dot bf-rec-dot-pulse","aria-hidden":"true"}),jsxRuntime.jsxs("span",{className:"bf-recording-bar-timer",children:[o.recordingText," ",X(e.recordingElapsedMs??0)," / ",X(ut)]}),jsxRuntime.jsx("button",{type:"button",className:"bf-recording-bar-stop",onClick:()=>a.stopRecording(),"aria-label":o.stopRecordButton,children:o.stopRecordButton})]}),e.phase==="success"&&jsxRuntime.jsx("div",{className:"bf-toast",role:"status","aria-live":"polite",children:o.toastText}),J>0&&!mt&&jsxRuntime.jsxs("div",{className:"bf-security-banner",role:"alert",children:[jsxRuntime.jsx("button",{type:"button",className:"bf-security-banner-dismiss",onClick:()=>ht(true),"aria-label":"Dismiss",children:"\xD7"}),jsxRuntime.jsx("strong",{children:"Security Warning"}),J," potential secret",J>1?"s":""," exposed in client code. Check your environment variables."]})]})}var Ao=react.forwardRef(function(e,a){let r={...e.config??{},blocfeed_id:e.blocfeed_id},[i,p]=react.useState(null),n=No(r.ui?.showOn),l=Fo(r.ui?.theme?.mode),o=!!r.diagnostics;react.useEffect(()=>{if(o)return chunkFM72GX3J_cjs.r(r.diagnostics),()=>chunkFM72GX3J_cjs.s()},[o]);let s=!!r.security;react.useEffect(()=>{s&&chunkFM72GX3J_cjs.v(r.security);},[s]);let h=react.useRef(e.config?.metadata?.enrich);h.current=e.config?.metadata?.enrich;let z=react.useMemo(()=>{if(e.config)return {...e.config,metadata:{...e.config.metadata,enrich:async f=>{let S=h.current,b=S?await S(f):{},B=chunkFM72GX3J_cjs.t(),v=chunkFM72GX3J_cjs.w(),O=chunkFM72GX3J_cjs.j();return {...b,...B.consoleLogs.length>0?{_consoleLogs:B.consoleLogs}:{},...B.networkErrors.length>0?{_networkErrors:B.networkErrors}:{},...v.findings.length>0?{_securityFindings:v.findings}:{},...O.length>0?{_clickEvents:O}:{}}}}}},[]);return react.useEffect(()=>{Fe();let f=document.createElement("div");f.setAttribute("data-blocfeed-ui-root","true"),f.setAttribute("data-blocfeed-ui","true"),f.setAttribute("data-bf-theme",l);let S=r.ui?.zIndex;typeof S=="number"&&f.style.setProperty("--bf-z",String(S));let b=r.ui?.theme;return b&&(b.accentColor&&f.style.setProperty("--bf-accent",b.accentColor),b.panelBackground&&f.style.setProperty("--bf-panel-bg",b.panelBackground),b.panelForeground&&f.style.setProperty("--bf-panel-fg",b.panelForeground),b.fontFamily&&f.style.setProperty("--bf-font",b.fontFamily)),document.body.appendChild(f),p(f),()=>{f.remove(),p(null);}},[r.ui?.zIndex,r.ui?.theme?.accentColor,r.ui?.theme?.panelBackground,r.ui?.theme?.panelForeground,r.ui?.theme?.fontFamily,l]),react.useEffect(()=>{i&&i.setAttribute("data-bf-theme",l);},[i,l]),!n||!i?null:reactDom.createPortal(jsxRuntime.jsx(re,{blocfeed_id:r.blocfeed_id,...z?{config:z}:{},children:jsxRuntime.jsx(Lo,{config:r,handleRef:a})}),i)});
845
+ `;function Fe(){if(!chunkFM72GX3J_cjs.a()||document.getElementById(Ne))return;let t=document.createElement("style");t.id=Ne,t.textContent=Rt,document.head.appendChild(t);}var Re={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 Me(t){return t?{...Re,...t}:Re}function ie(){let t=react.useContext(Y);if(!t)throw new Error("useBlocFeed must be used within a <BlocFeedProvider />");return {state:t.state,controller:t.controller,start:t.controller.start,stop:t.controller.stop,clearSelection:t.controller.clearSelection,submit:t.controller.submit,startRecording:t.controller.startRecording,stopRecording:t.controller.stopRecording,removeVideo:t.controller.removeVideo}}function w(t){switch(t){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 g({size:t=14}){return jsxRuntime.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function ze({size:t=14}){return jsxRuntime.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:jsxRuntime.jsx("path",{d:"M21 11.5a8.38 8.38 0 01-.9 3.8 8.5 8.5 0 01-7.6 4.7 8.38 8.38 0 01-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 01-.9-3.8 8.5 8.5 0 014.7-7.6 8.38 8.38 0 013.8-.9h.5a8.48 8.48 0 018 8v.5z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Le({size:t=16}){return jsxRuntime.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[jsxRuntime.jsx("path",{d:"M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M22 6l-10 7L2 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ie({position:t,onClick:e,isVisible:a,label:r,queueCount:i,showSuccess:p}){return a?jsxRuntime.jsxs("button",{className:w(t),type:"button",onClick:e,"aria-label":r,children:[p?jsxRuntime.jsx("span",{style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsxRuntime.jsx(g,{size:14})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"bf-dot","aria-hidden":"true"}),r]}),i>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${i} queued`,children:i})]}):null}function m(){let[t,e]=react.useState(()=>typeof window>"u"?false:window.matchMedia("(prefers-reduced-motion: reduce)").matches);return react.useEffect(()=>{let a=window.matchMedia("(prefers-reduced-motion: reduce)"),r=i=>e(i.matches);return a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[]),t}var _t={duration:.18,ease:"easeOut"},Ht={duration:0};function _e({position:t,onClick:e,isVisible:a,label:r,queueCount:i,showSuccess:p}){let[n,l]=react.useState(false),o=m(),s=o?Ht:_t;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:a&&jsxRuntime.jsx(framerMotion.motion.button,{className:w(t),type:"button",onClick:e,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":r,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:s,whileTap:{scale:.92},style:{overflow:"hidden"},children:p?jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:s,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsxRuntime.jsx(g,{size:14})},"success"):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.span,{className:"bf-dot","aria-hidden":"true",animate:o?{}:{scale:n?1:[1,1.2,1],boxShadow:n?"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:n||o?s:{duration:2,repeat:1/0,ease:"easeInOut"}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:n&&jsxRuntime.jsx(framerMotion.motion.span,{initial:{opacity:0,x:o?0:-6},animate:{opacity:1,x:0},exit:{opacity:0,x:o?0:-6},transition:s,style:{whiteSpace:"nowrap"},children:r},"label")}),i>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${i} queued`,children:i})]})},"dot")})}var $t={duration:.18,ease:"easeOut"},Oe={duration:0};function Ve({position:t,onClick:e,isVisible:a,label:r,queueCount:i,showSuccess:p}){let[n,l]=react.useState(false),o=m(),s=o?Oe:$t;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:a&&jsxRuntime.jsxs(framerMotion.motion.div,{className:w(t),initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{y:8,opacity:0},transition:s,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),style:{background:"transparent",border:"none",boxShadow:"none",padding:0},children:[jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:n&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,y:o?0:4},animate:{opacity:1,y:0},exit:{opacity:0,y:o?0:4},transition:s,style:{position:"absolute",bottom:"calc(100% + 8px)",left:"50%",transform:"translateX(-50%)",padding:"6px 12px",borderRadius:"8px",background:"var(--bf-panel-bg)",border:"1px solid var(--bf-border)",boxShadow:"var(--bf-shadow)",whiteSpace:"nowrap",fontSize:"12px",color:"var(--bf-panel-fg)",pointerEvents:"none"},children:r},"tooltip")}),jsxRuntime.jsxs(framerMotion.motion.button,{type:"button",onClick:e,"aria-label":r,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:o?{}:{y:[0,-3,0]},transition:o?Oe:{y:{duration:3,repeat:1/0,ease:"easeInOut"}},whileHover:{scale:1.1,borderColor:"var(--bf-accent)"},whileTap:{scale:.9},children:[p?jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:s,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsxRuntime.jsx(g,{size:16})},"success"):jsxRuntime.jsx(ze,{size:16}),i>0&&jsxRuntime.jsx("span",{className:"bf-badge bf-badge-float","aria-label":`${i} queued`,children:i})]})]},"bubble")})}var Xt={duration:.2,ease:"easeOut"},Yt={duration:0};function Ke(t){return t==="bottom-left"||t==="top-left"}function Gt(t){return `bf-trigger-edge ${Ke(t)?"bf-trigger-edge-left":"bf-trigger-edge-right"}`}function Ue({position:t,onClick:e,isVisible:a,label:r,queueCount:i,showSuccess:p}){let[n,l]=react.useState(false),o=Ke(t),s=m(),h=s?Yt:Xt;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:a&&jsxRuntime.jsx(framerMotion.motion.button,{className:Gt(t),type:"button",onClick:e,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":r,initial:{opacity:0,width:0},animate:{opacity:1,width:n?140:22,height:n?40:90},exit:{width:0,opacity:0},transition:h,whileTap:{scale:.97},style:{top:"50%",translateY:"-50%"},children:p?jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:h,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsxRuntime.jsx(g,{size:14})},"success"):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(framerMotion.motion.span,{animate:{rotate:s||n?0:o?-90:90,opacity:n?1:.6},transition:h,style:{display:"flex",alignItems:"center",gap:"8px",whiteSpace:"nowrap",fontSize:"12px",letterSpacing:"0.5px",textTransform:"uppercase"},children:[n&&jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:{duration:.12},style:{width:"6px",height:"6px",borderRadius:"50%",background:"var(--bf-accent)",flexShrink:0}}),r]}),jsxRuntime.jsx(framerMotion.motion.span,{"aria-hidden":"true",animate:{opacity:n?1:0},transition:{duration:.12},style:{position:"absolute",top:0,bottom:0,[o?"left":"right"]:0,width:"2px",background:"var(--bf-accent)"}}),i>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${i} queued`,children:i})]})},"edge-tab")})}var qt={duration:.18,ease:"easeOut"},Jt={duration:0};function Ye({delay:t,hovered:e,reduced:a}){return a?null:jsxRuntime.jsx(framerMotion.motion.span,{"aria-hidden":"true",style:{position:"absolute",width:"10px",height:"10px",borderRadius:"50%",border:"2px solid var(--bf-accent)",pointerEvents:"none"},animate:e?{scale:1,opacity:0}:{scale:[1,1.8],opacity:[.5,0]},transition:e?{duration:.15}:{duration:2,repeat:1/0,delay:t,ease:"easeOut"}})}function je({position:t,onClick:e,isVisible:a,label:r,queueCount:i,showSuccess:p}){let[n,l]=react.useState(false),o=m(),s=o?Jt:qt;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:a&&jsxRuntime.jsx(framerMotion.motion.button,{className:w(t),type:"button",onClick:e,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":r,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:s,whileTap:{scale:.92},style:{overflow:"hidden"},children:p?jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:s,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsxRuntime.jsx(g,{size:14})},"success"):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("span",{style:{position:"relative",display:"flex",alignItems:"center",justifyContent:"center",width:"10px",height:"10px",flexShrink:0},children:[jsxRuntime.jsx(Ye,{delay:0,hovered:n,reduced:o}),jsxRuntime.jsx(Ye,{delay:.7,hovered:n,reduced:o}),jsxRuntime.jsx(framerMotion.motion.span,{className:"bf-dot","aria-hidden":"true",style:{position:"relative",zIndex:1}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:n&&jsxRuntime.jsx(framerMotion.motion.span,{initial:{opacity:0,x:o?0:-6},animate:{opacity:1,x:0},exit:{opacity:0,x:o?0:-6},transition:s,style:{whiteSpace:"nowrap"},children:r},"label")}),i>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${i} queued`,children:i})]})},"pulse-ring")})}var oo={duration:.18,ease:"easeOut"},ro={duration:0};function io(t){switch(t){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 Je({position:t,onClick:e,isVisible:a,label:r,queueCount:i,showSuccess:p}){let[n,l]=react.useState(false),o=m(),s=o?ro:oo;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:a&&jsxRuntime.jsxs(framerMotion.motion.button,{className:io(t),type:"button",onClick:e,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":r,initial:{opacity:0,y:o?0:5},animate:{opacity:n?1:.65,y:0},exit:{opacity:0,y:o?0:5},transition:s,whileTap:{scale:.95},children:[p?jsxRuntime.jsx("span",{style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsxRuntime.jsx(g,{size:14})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{children:r}),i>0&&jsxRuntime.jsx("span",{className:"bf-badge",style:{marginLeft:"4px"},"aria-label":`${i} queued`,children:i})]}),!o&&jsxRuntime.jsx(framerMotion.motion.span,{"aria-hidden":"true",style:{position:"absolute",bottom:4,left:4,right:4,height:"2px",background:"var(--bf-accent)",borderRadius:"1px",transformOrigin:"left"},initial:false,animate:{scaleX:n?1:0},transition:s})]},"minimal")})}var so={duration:.18,ease:"easeOut"},co={duration:0};function et({position:t,onClick:e,isVisible:a,label:r,queueCount:i,showSuccess:p}){let[n,l]=react.useState(false),o=m(),s=o?co:so;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:a&&jsxRuntime.jsx(framerMotion.motion.button,{className:w(t),type:"button",onClick:e,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":r,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:s,whileTap:{scale:.9},style:{overflow:"hidden"},children:p?jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:s,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsxRuntime.jsx(g,{size:14})},"success"):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.span,{style:{display:"inline-flex",flexShrink:0},animate:o?{}:n?{scale:1.2,rotate:0}:{rotate:[-5,5,-5]},transition:n||o?s:{duration:3,repeat:1/0,ease:"easeInOut"},children:jsxRuntime.jsx(Le,{size:16})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:n&&jsxRuntime.jsx(framerMotion.motion.span,{initial:{opacity:0,x:o?0:-8},animate:{opacity:1,x:0},exit:{opacity:0,x:o?0:-8},transition:s,style:{whiteSpace:"nowrap"},children:r},"label")}),i>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${i} queued`,children:i})]})},"icon-pop")})}var uo={duration:.18,ease:"easeOut"},bo={duration:0};function rt({position:t,onClick:e,isVisible:a,label:r,queueCount:i,showSuccess:p}){let[n,l]=react.useState(false),o=m(),s=o?bo:uo;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:a&&jsxRuntime.jsx(framerMotion.motion.button,{className:w(t),type:"button",onClick:e,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":r,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:s,whileTap:{scale:.92},style:{overflow:"hidden"},children:p?jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:s,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsxRuntime.jsx(g,{size:14})},"success"):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("span",{style:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",width:"10px",height:"10px",flexShrink:0},children:[jsxRuntime.jsx(framerMotion.motion.span,{"aria-hidden":"true",style:{width:"10px",height:"10px",borderRadius:"50%",background:"var(--bf-accent)",position:"relative",zIndex:1},animate:o?{}:{opacity:n?1:[.5,1,.5],boxShadow:n?"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:n||o?s:{duration:2,repeat:1/0,ease:"easeInOut"}}),!n&&!o&&jsxRuntime.jsx(framerMotion.motion.span,{"aria-hidden":"true",style:{position:"absolute",width:"18px",height:"2px",background:"linear-gradient(90deg, var(--bf-accent), transparent)",transformOrigin:"left center",left:"5px",top:"4px"},animate:{rotate:[0,360]},transition:{duration:4,repeat:1/0,ease:"linear"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:n&&jsxRuntime.jsx(framerMotion.motion.span,{initial:{opacity:0,x:o?0:-6},animate:{opacity:1,x:0},exit:{opacity:0,x:o?0:-6},transition:s,style:{whiteSpace:"nowrap"},children:r},"label")}),i>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${i} queued`,children:i})]})},"beacon")})}var vo={duration:.18,ease:"easeOut"},yo={duration:0};function st({position:t,onClick:e,isVisible:a,label:r,queueCount:i,showSuccess:p}){let[n,l]=react.useState(false),[o,s]=react.useState(0),h=m(),z=h?yo:vo,f=react.useRef(null);react.useEffect(()=>{if(f.current&&(clearInterval(f.current),f.current=null),!a||n||h){s(n||h?r.length:0);return}let b=8,B=r.length*2+b*2,v=0;return f.current=setInterval(()=>{v=(v+1)%B,v<=r.length?s(v):v<=r.length+b?s(r.length):v<=r.length*2+b?s(r.length*2+b-v):s(0);},100),()=>{f.current&&(clearInterval(f.current),f.current=null);}},[a,n,h,r]);let S=r.slice(0,o);return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:a&&jsxRuntime.jsx(framerMotion.motion.button,{className:w(t),type:"button",onClick:e,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":r,initial:{opacity:0,y:h?0:5},animate:{opacity:1,y:0},exit:{opacity:0,y:h?0:5},transition:z,whileTap:{scale:.95},style:{minWidth:"44px"},children:p?jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:z,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsxRuntime.jsx(g,{size:14})},"success"):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"bf-dot","aria-hidden":"true"}),jsxRuntime.jsxs("span",{style:{whiteSpace:"nowrap",minWidth:"1ch"},children:[S,jsxRuntime.jsx("span",{className:"bf-cursor","aria-hidden":"true"})]}),i>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${i} queued`,children:i})]})},"typewriter")})}function ct(t){switch(t){case "dot":return _e;case "bubble":return Ve;case "edge-tab":return Ue;case "pulse-ring":return je;case "minimal":return Je;case "icon-pop":return et;case "beacon":return rt;case "typewriter":return st;default:return Ie}}function lt(t,e,a){return Math.max(e,Math.min(a,t))}function Eo(t,e,a="bottom-right"){let i=window.innerWidth,p=window.innerHeight,n;n=lt(t.x,12,Math.max(12,i-e-12));let l=t.y+t.height+12,o=Math.max(12,t.y-240);return {top:l+240<=p?l:o,left:n}}function Co(t){let{rect:e}=t,a={left:`${e.x}px`,top:`${e.y}px`,width:`${Math.max(0,e.width)}px`,height:`${Math.max(0,e.height)}px`};return jsxRuntime.jsx("div",{className:"bf-highlight",style:a,"aria-hidden":"true"})}function Po(t){let e=react.useRef(null);return react.useEffect(()=>{if(!t||!e.current)return;e.current.querySelector(".bf-textarea")?.focus();let r=i=>{if(i.key!=="Tab"||!e.current)return;let p=e.current.querySelectorAll('button:not([disabled]), textarea:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])');if(p.length===0)return;let n=p[0],l=p[p.length-1];i.shiftKey&&document.activeElement===n?(i.preventDefault(),l.focus()):!i.shiftKey&&document.activeElement===l&&(i.preventDefault(),n.focus());};return document.addEventListener("keydown",r,{capture:true}),()=>document.removeEventListener("keydown",r,{capture:true})},[t]),e}function Bo(t,e){return t?typeof t=="function"?t(e):t.some(a=>a.endsWith("*")?e.startsWith(a.slice(0,-1)):e===a):true}function No(t){let[e,a]=react.useState(()=>typeof window<"u"?window.location.pathname:"/");return react.useEffect(()=>{if(typeof window>"u")return;let r=()=>a(window.location.pathname);window.addEventListener("popstate",r);let i=history.pushState,p=history.replaceState;return history.pushState=function(...n){i.apply(this,n),setTimeout(r,0);},history.replaceState=function(...n){p.apply(this,n),setTimeout(r,0);},()=>{window.removeEventListener("popstate",r),history.pushState=i,history.replaceState=p;}},[]),Bo(t,e)}function Fo(t){let[e,a]=react.useState(()=>!t||t==="dark"?"dark":t==="light"?"light":typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");return react.useEffect(()=>{if(t!=="auto"){a(t==="light"?"light":"dark");return}let r=window.matchMedia("(prefers-color-scheme: dark)"),i=p=>a(p.matches?"dark":"light");return a(r.matches?"dark":"light"),r.addEventListener("change",i),()=>r.removeEventListener("change",i)},[t]),e}var Ro=["bug","feature","ux","general"],Mo={bug:"categoryBug",feature:"categoryFeature",ux:"categoryUx",general:"categoryGeneral"};function X(t){let e=Math.floor(t/1e3),a=Math.floor(e/60),r=e%60;return `${a}:${String(r).padStart(2,"0")}`}function zo(t){return t<1024*1024?`${Math.round(t/1024)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function Lo(t){let{state:e,controller:a,start:r,stop:i,clearSelection:p,submit:n}=ie(),l=t.config.ui?.position,o=Me(t.config.ui?.strings),s=t.config.ui?.branding!==false,[h,z]=react.useState(null),[f,S]=react.useState(""),[b,B]=react.useState(t.config.capture?.element??true),[v,O]=react.useState(t.config.capture?.fullPage??false),[pt,ce]=react.useState(null),[D,le]=react.useState(void 0),de=t.config.ui?.categories??Ro,ft=t.config.recording?.enabled===true&&chunkFM72GX3J_cjs.l(),ut=t.config.recording?.maxDurationMs??3e4,pe=a.getConfig().voice,bt=pe?.enabled===true&&chunkFM72GX3J_cjs.n(),gt=pe?.maxDurationMs??6e4,[mt,ht]=react.useState(false),[J,xt]=react.useState(0);react.useEffect(()=>{let d=window.setTimeout(()=>{let y=chunkFM72GX3J_cjs.w();xt(y.findings.length);},500);return ()=>window.clearTimeout(d)},[]),react.useImperativeHandle(t.handleRef,()=>({open:r,close:i,submit:d=>n(d),startRecording:()=>a.startRecording(),stopRecording:()=>a.stopRecording(),get isOpen(){return e.phase!=="idle"}}),[r,i,n,a,e.phase]);let fe=e.phase==="review"||e.phase==="capturing"||e.phase==="submitting"||e.phase==="error"||e.phase==="success",vt=Po(fe),[yt,wt]=react.useState(0);react.useEffect(()=>{e.phase==="idle"&&wt(chunkFM72GX3J_cjs.i());},[e.phase]);let[kt,ue]=react.useState(false),be=react.useRef(e.phase);react.useEffect(()=>{if(be.current==="success"&&e.phase==="idle"){ue(true);let d=window.setTimeout(()=>ue(false),1500);return ()=>window.clearTimeout(d)}be.current=e.phase;},[e.phase]),react.useEffect(()=>{let d=t.config.ui?.shortcut;if(!d)return;let y=d.toLowerCase().split("+").map(P=>P.trim()),C=y[y.length-1]||"",L=new Set(y.slice(0,-1)),he=P=>{let Ct=/Mac|iPod|iPhone|iPad/.test(navigator.platform);if(L.has("mod")){if(Ct?!P.metaKey:!P.ctrlKey)return}else if(L.has("ctrl")&&!P.ctrlKey||(L.has("meta")||L.has("cmd"))&&!P.metaKey)return;L.has("shift")&&!P.shiftKey||(L.has("alt")||L.has("option"))&&!P.altKey||P.key.toLowerCase()===C&&(P.preventDefault(),e.phase==="idle"?r():i());};return document.addEventListener("keydown",he),()=>document.removeEventListener("keydown",he)},[t.config.ui?.shortcut,e.phase,r,i]),react.useEffect(()=>a.subscribeHover(z),[a]),react.useEffect(()=>{let d=a.__unsafeGetSelectedElement();if(!d||e.phase==="idle"||e.phase==="picking"){ce(null);return}let y=()=>{ce(chunkFM72GX3J_cjs.b(d.getBoundingClientRect()));};y();let C=()=>y();return window.addEventListener("scroll",C,{capture:true,passive:true}),window.addEventListener("resize",C,{passive:true}),()=>{window.removeEventListener("scroll",C,{capture:true}),window.removeEventListener("resize",C);}},[a,e.phase,e.selection?.selector]),react.useEffect(()=>{e.phase==="review"&&(S(""),B(t.config.capture?.element??true),O(t.config.capture?.fullPage??false),le(void 0),V(null));},[e.phase,e.selection?.selector,t.config.capture?.element,t.config.capture?.fullPage]),react.useEffect(()=>{if(e.phase!=="success")return;let d=window.setTimeout(()=>i(),1200);return ()=>window.clearTimeout(d)},[e.phase,i]);let T=e.phase==="capturing"||e.phase==="submitting",R=e.phase==="picking"?h?.rect??null:pt??e.selection?.rect??null,Z=react.useMemo(()=>R?Eo(R,360,l):null,[R?.x,R?.y,R?.width,R?.height,l]),ge=e.lastError?.message,ee=react.useCallback(()=>{let d={capture:{element:b,fullPage:v}};D&&(d.category=D),n(f,d);},[n,f,b,v,D]),Tt=react.useCallback(d=>{(d.metaKey||d.ctrlKey)&&d.key==="Enter"&&f.trim().length>0&&!T&&(d.preventDefault(),ee());},[ee,f,T]),[me,V]=react.useState(null),St=react.useCallback(async()=>{if(e.voiceRecording){a.stopVoice();return}V(null);let d=await a.startVoice();if(d?.text)S(y=>y?y+" "+d.text:d.text);else if(d?.warning)V(o.voiceEmptyText);else if(!d){let y=a.getState().lastError;if(y){let C=y.message?.toLowerCase()??"";C.includes("denied")||C.includes("permission")||C.includes("not allowed")?V(o.voiceDeniedText):V(o.voiceErrorText);}}},[e.voiceRecording,a,o]),Et=ct(t.config.ui?.triggerStyle);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Et,{position:l,onClick:()=>r(),isVisible:e.phase==="idle",label:t.config.ui?.triggerLabel??o.triggerLabel,queueCount:yt,showSuccess:kt}),e.phase!=="idle"&&e.phase!=="recording"&&jsxRuntime.jsxs("div",{className:"bf-overlay",role:"presentation",children:[e.phase!=="picking"&&jsxRuntime.jsx("div",{className:"bf-blocker",role:"presentation",onClick:()=>i()}),R&&jsxRuntime.jsx(Co,{rect:R}),e.phase==="picking"&&jsxRuntime.jsxs("div",{className:"bf-hint",role:"status","aria-live":"polite",children:[jsxRuntime.jsx("p",{id:"bf-hint-text",children:o.hintText}),jsxRuntime.jsx("button",{type:"button",className:"bf-btn",onClick:()=>i(),"aria-label":o.cancelButton,children:o.cancelButton})]}),fe&&Z&&jsxRuntime.jsxs("div",{ref:vt,className:"bf-panel",style:{left:Z.left,top:Z.top},role:"dialog","aria-modal":"true","aria-label":"Feedback form",children:[jsxRuntime.jsxs("div",{className:"bf-panelHeader",children:[jsxRuntime.jsx("div",{className:"bf-title",id:"bf-panel-title",children:o.panelTitle}),jsxRuntime.jsxs("div",{className:"bf-row",style:{justifyContent:"flex-end"},children:[jsxRuntime.jsx("button",{type:"button",className:"bf-btn",onClick:()=>p(),disabled:T,"aria-label":o.rePickButton,children:o.rePickButton}),jsxRuntime.jsx("button",{type:"button",className:"bf-btn",onClick:()=>i(),disabled:T,"aria-label":o.closeButton,children:o.closeButton})]})]}),jsxRuntime.jsxs("div",{className:"bf-panelBody",children:[jsxRuntime.jsx("textarea",{className:"bf-textarea",placeholder:o.textareaPlaceholder,value:f,onChange:d=>S(d.target.value),onKeyDown:Tt,disabled:T,"aria-label":o.panelTitle}),de.length>0&&jsxRuntime.jsx("div",{className:"bf-pills",role:"group","aria-label":"Feedback category",children:de.map(d=>jsxRuntime.jsx("button",{type:"button",className:`bf-pill${D===d?" bf-pill-active":""}`,onClick:()=>le(D===d?void 0:d),disabled:T,children:o[Mo[d]]},d))}),jsxRuntime.jsxs("div",{className:"bf-row",role:"group","aria-label":o.screenshotElement,children:[jsxRuntime.jsxs("label",{children:[jsxRuntime.jsx("input",{type:"checkbox",checked:b,onChange:d=>B(d.target.checked),disabled:T}),o.screenshotElement]}),jsxRuntime.jsxs("label",{children:[jsxRuntime.jsx("input",{type:"checkbox",checked:v,onChange:d=>O(d.target.checked),disabled:T}),o.screenshotFullPage]})]}),bt&&e.phase==="review"&&!e.voiceTranscribing&&jsxRuntime.jsx("button",{type:"button",className:`bf-voice-btn${e.voiceRecording?" bf-voice-btn-active":""}`,onClick:St,disabled:T,"aria-label":e.voiceRecording?o.voiceStopButton:o.voiceButton,children:e.voiceRecording?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"bf-rec-dot bf-rec-dot-pulse","aria-hidden":"true"}),o.voiceRecordingText," ",X(e.voiceElapsedMs??0)," / ",X(gt)," \u2014 ",o.voiceStopButton]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.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:[jsxRuntime.jsx("rect",{x:"9",y:"1",width:"6",height:"11",rx:"3"}),jsxRuntime.jsx("path",{d:"M19 10v1a7 7 0 0 1-14 0v-1"}),jsxRuntime.jsx("line",{x1:"12",y1:"19",x2:"12",y2:"23"}),jsxRuntime.jsx("line",{x1:"8",y1:"23",x2:"16",y2:"23"})]}),o.voiceButton]})}),e.voiceTranscribing&&jsxRuntime.jsxs("div",{className:"bf-status",role:"status","aria-live":"polite",children:[jsxRuntime.jsx("span",{className:"bf-spinner","aria-hidden":"true"}),o.voiceTranscribingText]}),me&&!e.voiceRecording&&!e.voiceTranscribing&&jsxRuntime.jsx("div",{className:"bf-error",role:"alert",children:me}),ft&&e.phase==="review"&&!e.video&&jsxRuntime.jsxs("button",{type:"button",className:"bf-record-btn",onClick:()=>a.startRecording(),disabled:T,"aria-label":o.recordButton,children:[jsxRuntime.jsx("span",{className:"bf-rec-dot","aria-hidden":"true"}),o.recordButton]}),e.video&&e.phase==="review"&&jsxRuntime.jsxs("div",{className:"bf-video-preview",children:[jsxRuntime.jsx("video",{src:e.video.blobUrl,controls:true,muted:true,playsInline:true}),jsxRuntime.jsx("button",{type:"button",className:"bf-video-remove",onClick:()=>a.removeVideo(),"aria-label":o.removeVideoButton,children:"\xD7"}),jsxRuntime.jsxs("div",{className:"bf-video-meta",children:[o.videoPreviewLabel," (",X(e.video.durationMs),", ",zo(e.video.sizeBytes),")"]})]}),e.phase==="capturing"&&jsxRuntime.jsxs("div",{className:"bf-status",role:"status","aria-live":"polite",children:[jsxRuntime.jsx("span",{className:"bf-spinner","aria-hidden":"true"}),o.capturingText]}),e.phase==="submitting"&&jsxRuntime.jsxs("div",{className:"bf-status",role:"status","aria-live":"polite",children:[jsxRuntime.jsx("span",{className:"bf-spinner","aria-hidden":"true"}),o.submittingText]}),e.phase==="success"&&jsxRuntime.jsx("div",{className:"bf-status",role:"status","aria-live":"polite",children:o.successText}),e.phase==="error"&&ge&&jsxRuntime.jsx("div",{className:"bf-error",role:"alert",children:ge}),jsxRuntime.jsxs("div",{className:"bf-actions",children:[jsxRuntime.jsx("button",{type:"button",className:"bf-btn",onClick:()=>i(),disabled:T,"aria-label":o.cancelButton,children:o.cancelButton}),jsxRuntime.jsx("button",{type:"button",className:"bf-btn bf-btnPrimary",onClick:ee,disabled:T||f.trim().length===0,"aria-label":o.sendButton,children:o.sendButton})]})]}),s&&jsxRuntime.jsx("div",{className:"bf-watermark",children:jsxRuntime.jsx("a",{href:"https://blocfeed.com",target:"_blank",rel:"noopener noreferrer",children:"Powered by BlocFeed"})})]})]}),e.phase==="recording"&&jsxRuntime.jsxs("div",{className:`bf-recording-bar bf-pos-${l}`,role:"status","aria-live":"polite","data-blocfeed-ui":"true",children:[jsxRuntime.jsx("span",{className:"bf-rec-dot bf-rec-dot-pulse","aria-hidden":"true"}),jsxRuntime.jsxs("span",{className:"bf-recording-bar-timer",children:[o.recordingText," ",X(e.recordingElapsedMs??0)," / ",X(ut)]}),jsxRuntime.jsx("button",{type:"button",className:"bf-recording-bar-stop",onClick:()=>a.stopRecording(),"aria-label":o.stopRecordButton,children:o.stopRecordButton})]}),e.phase==="success"&&jsxRuntime.jsx("div",{className:"bf-toast",role:"status","aria-live":"polite",children:o.toastText}),J>0&&!mt&&jsxRuntime.jsxs("div",{className:"bf-security-banner",role:"alert",children:[jsxRuntime.jsx("button",{type:"button",className:"bf-security-banner-dismiss",onClick:()=>ht(true),"aria-label":"Dismiss",children:"\xD7"}),jsxRuntime.jsx("strong",{children:"Security Warning"}),J," potential secret",J>1?"s":""," exposed in client code. Check your environment variables."]})]})}var Ao=react.forwardRef(function(e,a){let r={...e.config??{},blocfeed_id:e.blocfeed_id},[i,p]=react.useState(null),n=No(r.ui?.showOn),l=Fo(r.ui?.theme?.mode),o=!!r.diagnostics;react.useEffect(()=>{if(o)return chunkFM72GX3J_cjs.r(r.diagnostics),()=>chunkFM72GX3J_cjs.s()},[o]);let s=!!r.security;react.useEffect(()=>{s&&chunkFM72GX3J_cjs.v(r.security);},[s]);let h=react.useRef(e.config?.metadata?.enrich);h.current=e.config?.metadata?.enrich;let z=react.useMemo(()=>{if(e.config)return {...e.config,metadata:{...e.config.metadata,enrich:async f=>{let S=h.current,b=S?await S(f):{},B=chunkFM72GX3J_cjs.t(),v=chunkFM72GX3J_cjs.w(),O=chunkFM72GX3J_cjs.j();return {...b,...B.consoleLogs.length>0?{_consoleLogs:B.consoleLogs}:{},...B.networkErrors.length>0?{_networkErrors:B.networkErrors}:{},...v.findings.length>0?{_securityFindings:v.findings}:{},...O.length>0?{_clickEvents:O}:{}}}}}},[]);return react.useEffect(()=>{Fe();let f=document.createElement("div");f.setAttribute("data-blocfeed-ui-root","true"),f.setAttribute("data-blocfeed-ui","true"),f.setAttribute("data-bf-theme",l);let S=r.ui?.zIndex;typeof S=="number"&&f.style.setProperty("--bf-z",String(S));let b=r.ui?.theme;return b&&(b.accentColor&&f.style.setProperty("--bf-accent",b.accentColor),b.panelBackground&&f.style.setProperty("--bf-panel-bg",b.panelBackground),b.panelForeground&&f.style.setProperty("--bf-panel-fg",b.panelForeground),b.fontFamily&&f.style.setProperty("--bf-font",b.fontFamily)),document.body.appendChild(f),p(f),()=>{f.remove(),p(null);}},[r.ui?.zIndex,r.ui?.theme?.accentColor,r.ui?.theme?.panelBackground,r.ui?.theme?.panelForeground,r.ui?.theme?.fontFamily,l]),react.useEffect(()=>{i&&i.setAttribute("data-bf-theme",l);},[i,l]),!n||!i?null:reactDom.createPortal(jsxRuntime.jsx(re,{blocfeed_id:r.blocfeed_id,...z?{config:z}:{},children:jsxRuntime.jsx(Lo,{config:r,handleRef:a})}),i)});
846
846
  exports.BlocFeedProvider=re;exports.BlocFeedWidget=Ao;exports.useBlocFeed=ie;
package/dist/main.js CHANGED
@@ -842,5 +842,5 @@ import {r,s,v,t,w as w$1,j,a,q,l,n,i,b}from'./chunk-A6OH75KK.js';import {createC
842
842
  animation: none;
843
843
  }
844
844
  }
845
- `;function Fe(){if(!a()||document.getElementById(Ne))return;let t=document.createElement("style");t.id=Ne,t.textContent=Rt,document.head.appendChild(t);}var Re={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 Me(t){return t?{...Re,...t}:Re}function ie(){let t=useContext(Y);if(!t)throw new Error("useBlocFeed must be used within a <BlocFeedProvider />");return {state:t.state,controller:t.controller,start:t.controller.start,stop:t.controller.stop,clearSelection:t.controller.clearSelection,submit:t.controller.submit,startRecording:t.controller.startRecording,stopRecording:t.controller.stopRecording,removeVideo:t.controller.removeVideo}}function w(t){switch(t){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 g({size:t=14}){return jsx("svg",{width:t,height:t,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 ze({size:t=14}){return jsx("svg",{width:t,height:t,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 Le({size:t=16}){return jsxs("svg",{width:t,height:t,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 Ie({position:t,onClick:e,isVisible:a,label:r,queueCount:i,showSuccess:p}){return a?jsxs("button",{className:w(t),type:"button",onClick:e,"aria-label":r,children:[p?jsx("span",{style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsx(g,{size:14})}):jsxs(Fragment,{children:[jsx("span",{className:"bf-dot","aria-hidden":"true"}),r]}),i>0&&jsx("span",{className:"bf-badge","aria-label":`${i} queued`,children:i})]}):null}function m(){let[t,e]=useState(()=>typeof window>"u"?false:window.matchMedia("(prefers-reduced-motion: reduce)").matches);return useEffect(()=>{let a=window.matchMedia("(prefers-reduced-motion: reduce)"),r=i=>e(i.matches);return a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[]),t}var _t={duration:.18,ease:"easeOut"},Ht={duration:0};function _e({position:t,onClick:e,isVisible:a,label:r,queueCount:i,showSuccess:p}){let[n,l]=useState(false),o=m(),s=o?Ht:_t;return jsx(AnimatePresence,{mode:"wait",children:a&&jsx(motion.button,{className:w(t),type:"button",onClick:e,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":r,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:s,whileTap:{scale:.92},style:{overflow:"hidden"},children:p?jsx(motion.span,{initial:{scale:0},animate:{scale:1},transition:s,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsx(g,{size:14})},"success"):jsxs(Fragment,{children:[jsx(motion.span,{className:"bf-dot","aria-hidden":"true",animate:o?{}:{scale:n?1:[1,1.2,1],boxShadow:n?"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:n||o?s:{duration:2,repeat:1/0,ease:"easeInOut"}}),jsx(AnimatePresence,{mode:"wait",children:n&&jsx(motion.span,{initial:{opacity:0,x:o?0:-6},animate:{opacity:1,x:0},exit:{opacity:0,x:o?0:-6},transition:s,style:{whiteSpace:"nowrap"},children:r},"label")}),i>0&&jsx("span",{className:"bf-badge","aria-label":`${i} queued`,children:i})]})},"dot")})}var $t={duration:.18,ease:"easeOut"},Oe={duration:0};function Ve({position:t,onClick:e,isVisible:a,label:r,queueCount:i,showSuccess:p}){let[n,l]=useState(false),o=m(),s=o?Oe:$t;return jsx(AnimatePresence,{mode:"wait",children:a&&jsxs(motion.div,{className:w(t),initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{y:8,opacity:0},transition:s,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),style:{background:"transparent",border:"none",boxShadow:"none",padding:0},children:[jsx(AnimatePresence,{mode:"wait",children:n&&jsx(motion.div,{initial:{opacity:0,y:o?0:4},animate:{opacity:1,y:0},exit:{opacity:0,y:o?0:4},transition:s,style:{position:"absolute",bottom:"calc(100% + 8px)",left:"50%",transform:"translateX(-50%)",padding:"6px 12px",borderRadius:"8px",background:"var(--bf-panel-bg)",border:"1px solid var(--bf-border)",boxShadow:"var(--bf-shadow)",whiteSpace:"nowrap",fontSize:"12px",color:"var(--bf-panel-fg)",pointerEvents:"none"},children:r},"tooltip")}),jsxs(motion.button,{type:"button",onClick:e,"aria-label":r,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:o?{}:{y:[0,-3,0]},transition:o?Oe:{y:{duration:3,repeat:1/0,ease:"easeInOut"}},whileHover:{scale:1.1,borderColor:"var(--bf-accent)"},whileTap:{scale:.9},children:[p?jsx(motion.span,{initial:{scale:0},animate:{scale:1},transition:s,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsx(g,{size:16})},"success"):jsx(ze,{size:16}),i>0&&jsx("span",{className:"bf-badge bf-badge-float","aria-label":`${i} queued`,children:i})]})]},"bubble")})}var Xt={duration:.2,ease:"easeOut"},Yt={duration:0};function Ke(t){return t==="bottom-left"||t==="top-left"}function Gt(t){return `bf-trigger-edge ${Ke(t)?"bf-trigger-edge-left":"bf-trigger-edge-right"}`}function Ue({position:t,onClick:e,isVisible:a,label:r,queueCount:i,showSuccess:p}){let[n,l]=useState(false),o=Ke(t),s=m(),h=s?Yt:Xt;return jsx(AnimatePresence,{mode:"wait",children:a&&jsx(motion.button,{className:Gt(t),type:"button",onClick:e,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":r,initial:{opacity:0,width:0},animate:{opacity:1,width:n?140:22,height:n?40:90},exit:{width:0,opacity:0},transition:h,whileTap:{scale:.97},style:{top:"50%",translateY:"-50%"},children:p?jsx(motion.span,{initial:{scale:0},animate:{scale:1},transition:h,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsx(g,{size:14})},"success"):jsxs(Fragment,{children:[jsxs(motion.span,{animate:{rotate:s||n?0:o?-90:90,opacity:n?1:.6},transition:h,style:{display:"flex",alignItems:"center",gap:"8px",whiteSpace:"nowrap",fontSize:"12px",letterSpacing:"0.5px",textTransform:"uppercase"},children:[n&&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}}),r]}),jsx(motion.span,{"aria-hidden":"true",animate:{opacity:n?1:0},transition:{duration:.12},style:{position:"absolute",top:0,bottom:0,[o?"left":"right"]:0,width:"2px",background:"var(--bf-accent)"}}),i>0&&jsx("span",{className:"bf-badge","aria-label":`${i} queued`,children:i})]})},"edge-tab")})}var qt={duration:.18,ease:"easeOut"},Jt={duration:0};function Ye({delay:t,hovered:e,reduced:a}){return a?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:e?{scale:1,opacity:0}:{scale:[1,1.8],opacity:[.5,0]},transition:e?{duration:.15}:{duration:2,repeat:1/0,delay:t,ease:"easeOut"}})}function je({position:t,onClick:e,isVisible:a,label:r,queueCount:i,showSuccess:p}){let[n,l]=useState(false),o=m(),s=o?Jt:qt;return jsx(AnimatePresence,{mode:"wait",children:a&&jsx(motion.button,{className:w(t),type:"button",onClick:e,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":r,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:s,whileTap:{scale:.92},style:{overflow:"hidden"},children:p?jsx(motion.span,{initial:{scale:0},animate:{scale:1},transition:s,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsx(g,{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(Ye,{delay:0,hovered:n,reduced:o}),jsx(Ye,{delay:.7,hovered:n,reduced:o}),jsx(motion.span,{className:"bf-dot","aria-hidden":"true",style:{position:"relative",zIndex:1}})]}),jsx(AnimatePresence,{mode:"wait",children:n&&jsx(motion.span,{initial:{opacity:0,x:o?0:-6},animate:{opacity:1,x:0},exit:{opacity:0,x:o?0:-6},transition:s,style:{whiteSpace:"nowrap"},children:r},"label")}),i>0&&jsx("span",{className:"bf-badge","aria-label":`${i} queued`,children:i})]})},"pulse-ring")})}var oo={duration:.18,ease:"easeOut"},ro={duration:0};function io(t){switch(t){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 Je({position:t,onClick:e,isVisible:a,label:r,queueCount:i,showSuccess:p}){let[n,l]=useState(false),o=m(),s=o?ro:oo;return jsx(AnimatePresence,{mode:"wait",children:a&&jsxs(motion.button,{className:io(t),type:"button",onClick:e,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":r,initial:{opacity:0,y:o?0:5},animate:{opacity:n?1:.65,y:0},exit:{opacity:0,y:o?0:5},transition:s,whileTap:{scale:.95},children:[p?jsx("span",{style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsx(g,{size:14})}):jsxs(Fragment,{children:[jsx("span",{children:r}),i>0&&jsx("span",{className:"bf-badge",style:{marginLeft:"4px"},"aria-label":`${i} queued`,children:i})]}),!o&&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:n?1:0},transition:s})]},"minimal")})}var so={duration:.18,ease:"easeOut"},co={duration:0};function et({position:t,onClick:e,isVisible:a,label:r,queueCount:i,showSuccess:p}){let[n,l]=useState(false),o=m(),s=o?co:so;return jsx(AnimatePresence,{mode:"wait",children:a&&jsx(motion.button,{className:w(t),type:"button",onClick:e,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":r,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:s,whileTap:{scale:.9},style:{overflow:"hidden"},children:p?jsx(motion.span,{initial:{scale:0},animate:{scale:1},transition:s,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsx(g,{size:14})},"success"):jsxs(Fragment,{children:[jsx(motion.span,{style:{display:"inline-flex",flexShrink:0},animate:o?{}:n?{scale:1.2,rotate:0}:{rotate:[-5,5,-5]},transition:n||o?s:{duration:3,repeat:1/0,ease:"easeInOut"},children:jsx(Le,{size:16})}),jsx(AnimatePresence,{mode:"wait",children:n&&jsx(motion.span,{initial:{opacity:0,x:o?0:-8},animate:{opacity:1,x:0},exit:{opacity:0,x:o?0:-8},transition:s,style:{whiteSpace:"nowrap"},children:r},"label")}),i>0&&jsx("span",{className:"bf-badge","aria-label":`${i} queued`,children:i})]})},"icon-pop")})}var uo={duration:.18,ease:"easeOut"},bo={duration:0};function rt({position:t,onClick:e,isVisible:a,label:r,queueCount:i,showSuccess:p}){let[n,l]=useState(false),o=m(),s=o?bo:uo;return jsx(AnimatePresence,{mode:"wait",children:a&&jsx(motion.button,{className:w(t),type:"button",onClick:e,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":r,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:s,whileTap:{scale:.92},style:{overflow:"hidden"},children:p?jsx(motion.span,{initial:{scale:0},animate:{scale:1},transition:s,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsx(g,{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:o?{}:{opacity:n?1:[.5,1,.5],boxShadow:n?"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:n||o?s:{duration:2,repeat:1/0,ease:"easeInOut"}}),!n&&!o&&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:n&&jsx(motion.span,{initial:{opacity:0,x:o?0:-6},animate:{opacity:1,x:0},exit:{opacity:0,x:o?0:-6},transition:s,style:{whiteSpace:"nowrap"},children:r},"label")}),i>0&&jsx("span",{className:"bf-badge","aria-label":`${i} queued`,children:i})]})},"beacon")})}var vo={duration:.18,ease:"easeOut"},yo={duration:0};function st({position:t,onClick:e,isVisible:a,label:r,queueCount:i,showSuccess:p}){let[n,l]=useState(false),[o,s]=useState(0),h=m(),z=h?yo:vo,f=useRef(null);useEffect(()=>{if(f.current&&(clearInterval(f.current),f.current=null),!a||n||h){s(n||h?r.length:0);return}let b=8,B=r.length*2+b*2,v=0;return f.current=setInterval(()=>{v=(v+1)%B,v<=r.length?s(v):v<=r.length+b?s(r.length):v<=r.length*2+b?s(r.length*2+b-v):s(0);},100),()=>{f.current&&(clearInterval(f.current),f.current=null);}},[a,n,h,r]);let S=r.slice(0,o);return jsx(AnimatePresence,{mode:"wait",children:a&&jsx(motion.button,{className:w(t),type:"button",onClick:e,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":r,initial:{opacity:0,y:h?0:5},animate:{opacity:1,y:0},exit:{opacity:0,y:h?0:5},transition:z,whileTap:{scale:.95},style:{minWidth:"44px"},children:p?jsx(motion.span,{initial:{scale:0},animate:{scale:1},transition:z,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsx(g,{size:14})},"success"):jsxs(Fragment,{children:[jsx("span",{className:"bf-dot","aria-hidden":"true"}),jsxs("span",{style:{whiteSpace:"nowrap",minWidth:"1ch"},children:[S,jsx("span",{className:"bf-cursor","aria-hidden":"true"})]}),i>0&&jsx("span",{className:"bf-badge","aria-label":`${i} queued`,children:i})]})},"typewriter")})}function ct(t){switch(t){case "dot":return _e;case "bubble":return Ve;case "edge-tab":return Ue;case "pulse-ring":return je;case "minimal":return Je;case "icon-pop":return et;case "beacon":return rt;case "typewriter":return st;default:return Ie}}function lt(t,e,a){return Math.max(e,Math.min(a,t))}function Eo(t,e,a="bottom-right"){let i=window.innerWidth,p=window.innerHeight,n;n=lt(t.x,12,Math.max(12,i-e-12));let l=t.y+t.height+12,o=Math.max(12,t.y-240);return {top:l+240<=p?l:o,left:n}}function Co(t){let{rect:e}=t,a={left:`${e.x}px`,top:`${e.y}px`,width:`${Math.max(0,e.width)}px`,height:`${Math.max(0,e.height)}px`};return jsx("div",{className:"bf-highlight",style:a,"aria-hidden":"true"})}function Po(t){let e=useRef(null);return useEffect(()=>{if(!t||!e.current)return;e.current.querySelector(".bf-textarea")?.focus();let r=i=>{if(i.key!=="Tab"||!e.current)return;let p=e.current.querySelectorAll('button:not([disabled]), textarea:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])');if(p.length===0)return;let n=p[0],l=p[p.length-1];i.shiftKey&&document.activeElement===n?(i.preventDefault(),l.focus()):!i.shiftKey&&document.activeElement===l&&(i.preventDefault(),n.focus());};return document.addEventListener("keydown",r,{capture:true}),()=>document.removeEventListener("keydown",r,{capture:true})},[t]),e}function Bo(t,e){return t?typeof t=="function"?t(e):t.some(a=>a.endsWith("*")?e.startsWith(a.slice(0,-1)):e===a):true}function No(t){let[e,a]=useState(()=>typeof window<"u"?window.location.pathname:"/");return useEffect(()=>{if(typeof window>"u")return;let r=()=>a(window.location.pathname);window.addEventListener("popstate",r);let i=history.pushState,p=history.replaceState;return history.pushState=function(...n){i.apply(this,n),r();},history.replaceState=function(...n){p.apply(this,n),r();},()=>{window.removeEventListener("popstate",r),history.pushState=i,history.replaceState=p;}},[]),Bo(t,e)}function Fo(t){let[e,a]=useState(()=>!t||t==="dark"?"dark":t==="light"?"light":typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");return useEffect(()=>{if(t!=="auto"){a(t==="light"?"light":"dark");return}let r=window.matchMedia("(prefers-color-scheme: dark)"),i=p=>a(p.matches?"dark":"light");return a(r.matches?"dark":"light"),r.addEventListener("change",i),()=>r.removeEventListener("change",i)},[t]),e}var Ro=["bug","feature","ux","general"],Mo={bug:"categoryBug",feature:"categoryFeature",ux:"categoryUx",general:"categoryGeneral"};function X(t){let e=Math.floor(t/1e3),a=Math.floor(e/60),r=e%60;return `${a}:${String(r).padStart(2,"0")}`}function zo(t){return t<1024*1024?`${Math.round(t/1024)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function Lo(t){let{state:e,controller:a,start:r,stop:i$1,clearSelection:p,submit:n$1}=ie(),l$1=t.config.ui?.position,o=Me(t.config.ui?.strings),s=t.config.ui?.branding!==false,[h,z]=useState(null),[f,S]=useState(""),[b$1,B]=useState(t.config.capture?.element??true),[v,O]=useState(t.config.capture?.fullPage??false),[pt,ce]=useState(null),[D,le]=useState(void 0),de=t.config.ui?.categories??Ro,ft=t.config.recording?.enabled===true&&l(),ut=t.config.recording?.maxDurationMs??3e4,pe=a.getConfig().voice,bt=pe?.enabled===true&&n(),gt=pe?.maxDurationMs??6e4,[mt,ht]=useState(false),[J,xt]=useState(0);useEffect(()=>{let d=window.setTimeout(()=>{let y=w$1();xt(y.findings.length);},500);return ()=>window.clearTimeout(d)},[]),useImperativeHandle(t.handleRef,()=>({open:r,close:i$1,submit:d=>n$1(d),startRecording:()=>a.startRecording(),stopRecording:()=>a.stopRecording(),get isOpen(){return e.phase!=="idle"}}),[r,i$1,n$1,a,e.phase]);let fe=e.phase==="review"||e.phase==="capturing"||e.phase==="submitting"||e.phase==="error"||e.phase==="success",vt=Po(fe),[yt,wt]=useState(0);useEffect(()=>{e.phase==="idle"&&wt(i());},[e.phase]);let[kt,ue]=useState(false),be=useRef(e.phase);useEffect(()=>{if(be.current==="success"&&e.phase==="idle"){ue(true);let d=window.setTimeout(()=>ue(false),1500);return ()=>window.clearTimeout(d)}be.current=e.phase;},[e.phase]),useEffect(()=>{let d=t.config.ui?.shortcut;if(!d)return;let y=d.toLowerCase().split("+").map(P=>P.trim()),C=y[y.length-1]||"",L=new Set(y.slice(0,-1)),he=P=>{let Ct=/Mac|iPod|iPhone|iPad/.test(navigator.platform);if(L.has("mod")){if(Ct?!P.metaKey:!P.ctrlKey)return}else if(L.has("ctrl")&&!P.ctrlKey||(L.has("meta")||L.has("cmd"))&&!P.metaKey)return;L.has("shift")&&!P.shiftKey||(L.has("alt")||L.has("option"))&&!P.altKey||P.key.toLowerCase()===C&&(P.preventDefault(),e.phase==="idle"?r():i$1());};return document.addEventListener("keydown",he),()=>document.removeEventListener("keydown",he)},[t.config.ui?.shortcut,e.phase,r,i$1]),useEffect(()=>a.subscribeHover(z),[a]),useEffect(()=>{let d=a.__unsafeGetSelectedElement();if(!d||e.phase==="idle"||e.phase==="picking"){ce(null);return}let y=()=>{ce(b(d.getBoundingClientRect()));};y();let C=()=>y();return window.addEventListener("scroll",C,{capture:true,passive:true}),window.addEventListener("resize",C,{passive:true}),()=>{window.removeEventListener("scroll",C,{capture:true}),window.removeEventListener("resize",C);}},[a,e.phase,e.selection?.selector]),useEffect(()=>{e.phase==="review"&&(S(""),B(t.config.capture?.element??true),O(t.config.capture?.fullPage??false),le(void 0),V(null));},[e.phase,e.selection?.selector,t.config.capture?.element,t.config.capture?.fullPage]),useEffect(()=>{if(e.phase!=="success")return;let d=window.setTimeout(()=>i$1(),1200);return ()=>window.clearTimeout(d)},[e.phase,i$1]);let T=e.phase==="capturing"||e.phase==="submitting",R=e.phase==="picking"?h?.rect??null:pt??e.selection?.rect??null,Z=useMemo(()=>R?Eo(R,360,l$1):null,[R?.x,R?.y,R?.width,R?.height,l$1]),ge=e.lastError?.message,ee=useCallback(()=>{let d={capture:{element:b$1,fullPage:v}};D&&(d.category=D),n$1(f,d);},[n$1,f,b$1,v,D]),Tt=useCallback(d=>{(d.metaKey||d.ctrlKey)&&d.key==="Enter"&&f.trim().length>0&&!T&&(d.preventDefault(),ee());},[ee,f,T]),[me,V]=useState(null),St=useCallback(async()=>{if(e.voiceRecording){a.stopVoice();return}V(null);let d=await a.startVoice();if(d?.text)S(y=>y?y+" "+d.text:d.text);else if(d?.warning)V(o.voiceEmptyText);else if(!d){let y=a.getState().lastError;if(y){let C=y.message?.toLowerCase()??"";C.includes("denied")||C.includes("permission")||C.includes("not allowed")?V(o.voiceDeniedText):V(o.voiceErrorText);}}},[e.voiceRecording,a,o]),Et=ct(t.config.ui?.triggerStyle);return jsxs(Fragment,{children:[jsx(Et,{position:l$1,onClick:()=>r(),isVisible:e.phase==="idle",label:t.config.ui?.triggerLabel??o.triggerLabel,queueCount:yt,showSuccess:kt}),e.phase!=="idle"&&e.phase!=="recording"&&jsxs("div",{className:"bf-overlay",role:"presentation",children:[e.phase!=="picking"&&jsx("div",{className:"bf-blocker",role:"presentation",onClick:()=>i$1()}),R&&jsx(Co,{rect:R}),e.phase==="picking"&&jsxs("div",{className:"bf-hint",role:"status","aria-live":"polite",children:[jsx("p",{id:"bf-hint-text",children:o.hintText}),jsx("button",{type:"button",className:"bf-btn",onClick:()=>i$1(),"aria-label":o.cancelButton,children:o.cancelButton})]}),fe&&Z&&jsxs("div",{ref:vt,className:"bf-panel",style:{left:Z.left,top:Z.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:o.panelTitle}),jsxs("div",{className:"bf-row",style:{justifyContent:"flex-end"},children:[jsx("button",{type:"button",className:"bf-btn",onClick:()=>p(),disabled:T,"aria-label":o.rePickButton,children:o.rePickButton}),jsx("button",{type:"button",className:"bf-btn",onClick:()=>i$1(),disabled:T,"aria-label":o.closeButton,children:o.closeButton})]})]}),jsxs("div",{className:"bf-panelBody",children:[jsx("textarea",{className:"bf-textarea",placeholder:o.textareaPlaceholder,value:f,onChange:d=>S(d.target.value),onKeyDown:Tt,disabled:T,"aria-label":o.panelTitle}),de.length>0&&jsx("div",{className:"bf-pills",role:"group","aria-label":"Feedback category",children:de.map(d=>jsx("button",{type:"button",className:`bf-pill${D===d?" bf-pill-active":""}`,onClick:()=>le(D===d?void 0:d),disabled:T,children:o[Mo[d]]},d))}),jsxs("div",{className:"bf-row",role:"group","aria-label":o.screenshotElement,children:[jsxs("label",{children:[jsx("input",{type:"checkbox",checked:b$1,onChange:d=>B(d.target.checked),disabled:T}),o.screenshotElement]}),jsxs("label",{children:[jsx("input",{type:"checkbox",checked:v,onChange:d=>O(d.target.checked),disabled:T}),o.screenshotFullPage]})]}),bt&&e.phase==="review"&&!e.voiceTranscribing&&jsx("button",{type:"button",className:`bf-voice-btn${e.voiceRecording?" bf-voice-btn-active":""}`,onClick:St,disabled:T,"aria-label":e.voiceRecording?o.voiceStopButton:o.voiceButton,children:e.voiceRecording?jsxs(Fragment,{children:[jsx("span",{className:"bf-rec-dot bf-rec-dot-pulse","aria-hidden":"true"}),o.voiceRecordingText," ",X(e.voiceElapsedMs??0)," / ",X(gt)," \u2014 ",o.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"})]}),o.voiceButton]})}),e.voiceTranscribing&&jsxs("div",{className:"bf-status",role:"status","aria-live":"polite",children:[jsx("span",{className:"bf-spinner","aria-hidden":"true"}),o.voiceTranscribingText]}),me&&!e.voiceRecording&&!e.voiceTranscribing&&jsx("div",{className:"bf-error",role:"alert",children:me}),ft&&e.phase==="review"&&!e.video&&jsxs("button",{type:"button",className:"bf-record-btn",onClick:()=>a.startRecording(),disabled:T,"aria-label":o.recordButton,children:[jsx("span",{className:"bf-rec-dot","aria-hidden":"true"}),o.recordButton]}),e.video&&e.phase==="review"&&jsxs("div",{className:"bf-video-preview",children:[jsx("video",{src:e.video.blobUrl,controls:true,muted:true,playsInline:true}),jsx("button",{type:"button",className:"bf-video-remove",onClick:()=>a.removeVideo(),"aria-label":o.removeVideoButton,children:"\xD7"}),jsxs("div",{className:"bf-video-meta",children:[o.videoPreviewLabel," (",X(e.video.durationMs),", ",zo(e.video.sizeBytes),")"]})]}),e.phase==="capturing"&&jsxs("div",{className:"bf-status",role:"status","aria-live":"polite",children:[jsx("span",{className:"bf-spinner","aria-hidden":"true"}),o.capturingText]}),e.phase==="submitting"&&jsxs("div",{className:"bf-status",role:"status","aria-live":"polite",children:[jsx("span",{className:"bf-spinner","aria-hidden":"true"}),o.submittingText]}),e.phase==="success"&&jsx("div",{className:"bf-status",role:"status","aria-live":"polite",children:o.successText}),e.phase==="error"&&ge&&jsx("div",{className:"bf-error",role:"alert",children:ge}),jsxs("div",{className:"bf-actions",children:[jsx("button",{type:"button",className:"bf-btn",onClick:()=>i$1(),disabled:T,"aria-label":o.cancelButton,children:o.cancelButton}),jsx("button",{type:"button",className:"bf-btn bf-btnPrimary",onClick:ee,disabled:T||f.trim().length===0,"aria-label":o.sendButton,children:o.sendButton})]})]}),s&&jsx("div",{className:"bf-watermark",children:jsx("a",{href:"https://blocfeed.com",target:"_blank",rel:"noopener noreferrer",children:"Powered by BlocFeed"})})]})]}),e.phase==="recording"&&jsxs("div",{className:`bf-recording-bar bf-pos-${l$1}`,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:[o.recordingText," ",X(e.recordingElapsedMs??0)," / ",X(ut)]}),jsx("button",{type:"button",className:"bf-recording-bar-stop",onClick:()=>a.stopRecording(),"aria-label":o.stopRecordButton,children:o.stopRecordButton})]}),e.phase==="success"&&jsx("div",{className:"bf-toast",role:"status","aria-live":"polite",children:o.toastText}),J>0&&!mt&&jsxs("div",{className:"bf-security-banner",role:"alert",children:[jsx("button",{type:"button",className:"bf-security-banner-dismiss",onClick:()=>ht(true),"aria-label":"Dismiss",children:"\xD7"}),jsx("strong",{children:"Security Warning"}),J," potential secret",J>1?"s":""," exposed in client code. Check your environment variables."]})]})}var Ao=forwardRef(function(e,a){let r$1={...e.config??{},blocfeed_id:e.blocfeed_id},[i,p]=useState(null),n=No(r$1.ui?.showOn),l=Fo(r$1.ui?.theme?.mode),o=!!r$1.diagnostics;useEffect(()=>{if(o)return r(r$1.diagnostics),()=>s()},[o]);let s$1=!!r$1.security;useEffect(()=>{s$1&&v(r$1.security);},[s$1]);let h=useRef(e.config?.metadata?.enrich);h.current=e.config?.metadata?.enrich;let z=useMemo(()=>{if(e.config)return {...e.config,metadata:{...e.config.metadata,enrich:async f=>{let S=h.current,b=S?await S(f):{},B=t(),v=w$1(),O=j();return {...b,...B.consoleLogs.length>0?{_consoleLogs:B.consoleLogs}:{},...B.networkErrors.length>0?{_networkErrors:B.networkErrors}:{},...v.findings.length>0?{_securityFindings:v.findings}:{},...O.length>0?{_clickEvents:O}:{}}}}}},[]);return useEffect(()=>{Fe();let f=document.createElement("div");f.setAttribute("data-blocfeed-ui-root","true"),f.setAttribute("data-blocfeed-ui","true"),f.setAttribute("data-bf-theme",l);let S=r$1.ui?.zIndex;typeof S=="number"&&f.style.setProperty("--bf-z",String(S));let b=r$1.ui?.theme;return b&&(b.accentColor&&f.style.setProperty("--bf-accent",b.accentColor),b.panelBackground&&f.style.setProperty("--bf-panel-bg",b.panelBackground),b.panelForeground&&f.style.setProperty("--bf-panel-fg",b.panelForeground),b.fontFamily&&f.style.setProperty("--bf-font",b.fontFamily)),document.body.appendChild(f),p(f),()=>{f.remove(),p(null);}},[r$1.ui?.zIndex,r$1.ui?.theme?.accentColor,r$1.ui?.theme?.panelBackground,r$1.ui?.theme?.panelForeground,r$1.ui?.theme?.fontFamily,l]),useEffect(()=>{i&&i.setAttribute("data-bf-theme",l);},[i,l]),!n||!i?null:createPortal(jsx(re,{blocfeed_id:r$1.blocfeed_id,...z?{config:z}:{},children:jsx(Lo,{config:r$1,handleRef:a})}),i)});
845
+ `;function Fe(){if(!a()||document.getElementById(Ne))return;let t=document.createElement("style");t.id=Ne,t.textContent=Rt,document.head.appendChild(t);}var Re={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 Me(t){return t?{...Re,...t}:Re}function ie(){let t=useContext(Y);if(!t)throw new Error("useBlocFeed must be used within a <BlocFeedProvider />");return {state:t.state,controller:t.controller,start:t.controller.start,stop:t.controller.stop,clearSelection:t.controller.clearSelection,submit:t.controller.submit,startRecording:t.controller.startRecording,stopRecording:t.controller.stopRecording,removeVideo:t.controller.removeVideo}}function w(t){switch(t){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 g({size:t=14}){return jsx("svg",{width:t,height:t,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 ze({size:t=14}){return jsx("svg",{width:t,height:t,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 Le({size:t=16}){return jsxs("svg",{width:t,height:t,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 Ie({position:t,onClick:e,isVisible:a,label:r,queueCount:i,showSuccess:p}){return a?jsxs("button",{className:w(t),type:"button",onClick:e,"aria-label":r,children:[p?jsx("span",{style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsx(g,{size:14})}):jsxs(Fragment,{children:[jsx("span",{className:"bf-dot","aria-hidden":"true"}),r]}),i>0&&jsx("span",{className:"bf-badge","aria-label":`${i} queued`,children:i})]}):null}function m(){let[t,e]=useState(()=>typeof window>"u"?false:window.matchMedia("(prefers-reduced-motion: reduce)").matches);return useEffect(()=>{let a=window.matchMedia("(prefers-reduced-motion: reduce)"),r=i=>e(i.matches);return a.addEventListener("change",r),()=>a.removeEventListener("change",r)},[]),t}var _t={duration:.18,ease:"easeOut"},Ht={duration:0};function _e({position:t,onClick:e,isVisible:a,label:r,queueCount:i,showSuccess:p}){let[n,l]=useState(false),o=m(),s=o?Ht:_t;return jsx(AnimatePresence,{mode:"wait",children:a&&jsx(motion.button,{className:w(t),type:"button",onClick:e,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":r,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:s,whileTap:{scale:.92},style:{overflow:"hidden"},children:p?jsx(motion.span,{initial:{scale:0},animate:{scale:1},transition:s,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsx(g,{size:14})},"success"):jsxs(Fragment,{children:[jsx(motion.span,{className:"bf-dot","aria-hidden":"true",animate:o?{}:{scale:n?1:[1,1.2,1],boxShadow:n?"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:n||o?s:{duration:2,repeat:1/0,ease:"easeInOut"}}),jsx(AnimatePresence,{mode:"wait",children:n&&jsx(motion.span,{initial:{opacity:0,x:o?0:-6},animate:{opacity:1,x:0},exit:{opacity:0,x:o?0:-6},transition:s,style:{whiteSpace:"nowrap"},children:r},"label")}),i>0&&jsx("span",{className:"bf-badge","aria-label":`${i} queued`,children:i})]})},"dot")})}var $t={duration:.18,ease:"easeOut"},Oe={duration:0};function Ve({position:t,onClick:e,isVisible:a,label:r,queueCount:i,showSuccess:p}){let[n,l]=useState(false),o=m(),s=o?Oe:$t;return jsx(AnimatePresence,{mode:"wait",children:a&&jsxs(motion.div,{className:w(t),initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{y:8,opacity:0},transition:s,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),style:{background:"transparent",border:"none",boxShadow:"none",padding:0},children:[jsx(AnimatePresence,{mode:"wait",children:n&&jsx(motion.div,{initial:{opacity:0,y:o?0:4},animate:{opacity:1,y:0},exit:{opacity:0,y:o?0:4},transition:s,style:{position:"absolute",bottom:"calc(100% + 8px)",left:"50%",transform:"translateX(-50%)",padding:"6px 12px",borderRadius:"8px",background:"var(--bf-panel-bg)",border:"1px solid var(--bf-border)",boxShadow:"var(--bf-shadow)",whiteSpace:"nowrap",fontSize:"12px",color:"var(--bf-panel-fg)",pointerEvents:"none"},children:r},"tooltip")}),jsxs(motion.button,{type:"button",onClick:e,"aria-label":r,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:o?{}:{y:[0,-3,0]},transition:o?Oe:{y:{duration:3,repeat:1/0,ease:"easeInOut"}},whileHover:{scale:1.1,borderColor:"var(--bf-accent)"},whileTap:{scale:.9},children:[p?jsx(motion.span,{initial:{scale:0},animate:{scale:1},transition:s,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsx(g,{size:16})},"success"):jsx(ze,{size:16}),i>0&&jsx("span",{className:"bf-badge bf-badge-float","aria-label":`${i} queued`,children:i})]})]},"bubble")})}var Xt={duration:.2,ease:"easeOut"},Yt={duration:0};function Ke(t){return t==="bottom-left"||t==="top-left"}function Gt(t){return `bf-trigger-edge ${Ke(t)?"bf-trigger-edge-left":"bf-trigger-edge-right"}`}function Ue({position:t,onClick:e,isVisible:a,label:r,queueCount:i,showSuccess:p}){let[n,l]=useState(false),o=Ke(t),s=m(),h=s?Yt:Xt;return jsx(AnimatePresence,{mode:"wait",children:a&&jsx(motion.button,{className:Gt(t),type:"button",onClick:e,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":r,initial:{opacity:0,width:0},animate:{opacity:1,width:n?140:22,height:n?40:90},exit:{width:0,opacity:0},transition:h,whileTap:{scale:.97},style:{top:"50%",translateY:"-50%"},children:p?jsx(motion.span,{initial:{scale:0},animate:{scale:1},transition:h,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsx(g,{size:14})},"success"):jsxs(Fragment,{children:[jsxs(motion.span,{animate:{rotate:s||n?0:o?-90:90,opacity:n?1:.6},transition:h,style:{display:"flex",alignItems:"center",gap:"8px",whiteSpace:"nowrap",fontSize:"12px",letterSpacing:"0.5px",textTransform:"uppercase"},children:[n&&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}}),r]}),jsx(motion.span,{"aria-hidden":"true",animate:{opacity:n?1:0},transition:{duration:.12},style:{position:"absolute",top:0,bottom:0,[o?"left":"right"]:0,width:"2px",background:"var(--bf-accent)"}}),i>0&&jsx("span",{className:"bf-badge","aria-label":`${i} queued`,children:i})]})},"edge-tab")})}var qt={duration:.18,ease:"easeOut"},Jt={duration:0};function Ye({delay:t,hovered:e,reduced:a}){return a?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:e?{scale:1,opacity:0}:{scale:[1,1.8],opacity:[.5,0]},transition:e?{duration:.15}:{duration:2,repeat:1/0,delay:t,ease:"easeOut"}})}function je({position:t,onClick:e,isVisible:a,label:r,queueCount:i,showSuccess:p}){let[n,l]=useState(false),o=m(),s=o?Jt:qt;return jsx(AnimatePresence,{mode:"wait",children:a&&jsx(motion.button,{className:w(t),type:"button",onClick:e,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":r,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:s,whileTap:{scale:.92},style:{overflow:"hidden"},children:p?jsx(motion.span,{initial:{scale:0},animate:{scale:1},transition:s,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsx(g,{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(Ye,{delay:0,hovered:n,reduced:o}),jsx(Ye,{delay:.7,hovered:n,reduced:o}),jsx(motion.span,{className:"bf-dot","aria-hidden":"true",style:{position:"relative",zIndex:1}})]}),jsx(AnimatePresence,{mode:"wait",children:n&&jsx(motion.span,{initial:{opacity:0,x:o?0:-6},animate:{opacity:1,x:0},exit:{opacity:0,x:o?0:-6},transition:s,style:{whiteSpace:"nowrap"},children:r},"label")}),i>0&&jsx("span",{className:"bf-badge","aria-label":`${i} queued`,children:i})]})},"pulse-ring")})}var oo={duration:.18,ease:"easeOut"},ro={duration:0};function io(t){switch(t){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 Je({position:t,onClick:e,isVisible:a,label:r,queueCount:i,showSuccess:p}){let[n,l]=useState(false),o=m(),s=o?ro:oo;return jsx(AnimatePresence,{mode:"wait",children:a&&jsxs(motion.button,{className:io(t),type:"button",onClick:e,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":r,initial:{opacity:0,y:o?0:5},animate:{opacity:n?1:.65,y:0},exit:{opacity:0,y:o?0:5},transition:s,whileTap:{scale:.95},children:[p?jsx("span",{style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsx(g,{size:14})}):jsxs(Fragment,{children:[jsx("span",{children:r}),i>0&&jsx("span",{className:"bf-badge",style:{marginLeft:"4px"},"aria-label":`${i} queued`,children:i})]}),!o&&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:n?1:0},transition:s})]},"minimal")})}var so={duration:.18,ease:"easeOut"},co={duration:0};function et({position:t,onClick:e,isVisible:a,label:r,queueCount:i,showSuccess:p}){let[n,l]=useState(false),o=m(),s=o?co:so;return jsx(AnimatePresence,{mode:"wait",children:a&&jsx(motion.button,{className:w(t),type:"button",onClick:e,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":r,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:s,whileTap:{scale:.9},style:{overflow:"hidden"},children:p?jsx(motion.span,{initial:{scale:0},animate:{scale:1},transition:s,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsx(g,{size:14})},"success"):jsxs(Fragment,{children:[jsx(motion.span,{style:{display:"inline-flex",flexShrink:0},animate:o?{}:n?{scale:1.2,rotate:0}:{rotate:[-5,5,-5]},transition:n||o?s:{duration:3,repeat:1/0,ease:"easeInOut"},children:jsx(Le,{size:16})}),jsx(AnimatePresence,{mode:"wait",children:n&&jsx(motion.span,{initial:{opacity:0,x:o?0:-8},animate:{opacity:1,x:0},exit:{opacity:0,x:o?0:-8},transition:s,style:{whiteSpace:"nowrap"},children:r},"label")}),i>0&&jsx("span",{className:"bf-badge","aria-label":`${i} queued`,children:i})]})},"icon-pop")})}var uo={duration:.18,ease:"easeOut"},bo={duration:0};function rt({position:t,onClick:e,isVisible:a,label:r,queueCount:i,showSuccess:p}){let[n,l]=useState(false),o=m(),s=o?bo:uo;return jsx(AnimatePresence,{mode:"wait",children:a&&jsx(motion.button,{className:w(t),type:"button",onClick:e,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":r,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:s,whileTap:{scale:.92},style:{overflow:"hidden"},children:p?jsx(motion.span,{initial:{scale:0},animate:{scale:1},transition:s,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsx(g,{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:o?{}:{opacity:n?1:[.5,1,.5],boxShadow:n?"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:n||o?s:{duration:2,repeat:1/0,ease:"easeInOut"}}),!n&&!o&&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:n&&jsx(motion.span,{initial:{opacity:0,x:o?0:-6},animate:{opacity:1,x:0},exit:{opacity:0,x:o?0:-6},transition:s,style:{whiteSpace:"nowrap"},children:r},"label")}),i>0&&jsx("span",{className:"bf-badge","aria-label":`${i} queued`,children:i})]})},"beacon")})}var vo={duration:.18,ease:"easeOut"},yo={duration:0};function st({position:t,onClick:e,isVisible:a,label:r,queueCount:i,showSuccess:p}){let[n,l]=useState(false),[o,s]=useState(0),h=m(),z=h?yo:vo,f=useRef(null);useEffect(()=>{if(f.current&&(clearInterval(f.current),f.current=null),!a||n||h){s(n||h?r.length:0);return}let b=8,B=r.length*2+b*2,v=0;return f.current=setInterval(()=>{v=(v+1)%B,v<=r.length?s(v):v<=r.length+b?s(r.length):v<=r.length*2+b?s(r.length*2+b-v):s(0);},100),()=>{f.current&&(clearInterval(f.current),f.current=null);}},[a,n,h,r]);let S=r.slice(0,o);return jsx(AnimatePresence,{mode:"wait",children:a&&jsx(motion.button,{className:w(t),type:"button",onClick:e,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":r,initial:{opacity:0,y:h?0:5},animate:{opacity:1,y:0},exit:{opacity:0,y:h?0:5},transition:z,whileTap:{scale:.95},style:{minWidth:"44px"},children:p?jsx(motion.span,{initial:{scale:0},animate:{scale:1},transition:z,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsx(g,{size:14})},"success"):jsxs(Fragment,{children:[jsx("span",{className:"bf-dot","aria-hidden":"true"}),jsxs("span",{style:{whiteSpace:"nowrap",minWidth:"1ch"},children:[S,jsx("span",{className:"bf-cursor","aria-hidden":"true"})]}),i>0&&jsx("span",{className:"bf-badge","aria-label":`${i} queued`,children:i})]})},"typewriter")})}function ct(t){switch(t){case "dot":return _e;case "bubble":return Ve;case "edge-tab":return Ue;case "pulse-ring":return je;case "minimal":return Je;case "icon-pop":return et;case "beacon":return rt;case "typewriter":return st;default:return Ie}}function lt(t,e,a){return Math.max(e,Math.min(a,t))}function Eo(t,e,a="bottom-right"){let i=window.innerWidth,p=window.innerHeight,n;n=lt(t.x,12,Math.max(12,i-e-12));let l=t.y+t.height+12,o=Math.max(12,t.y-240);return {top:l+240<=p?l:o,left:n}}function Co(t){let{rect:e}=t,a={left:`${e.x}px`,top:`${e.y}px`,width:`${Math.max(0,e.width)}px`,height:`${Math.max(0,e.height)}px`};return jsx("div",{className:"bf-highlight",style:a,"aria-hidden":"true"})}function Po(t){let e=useRef(null);return useEffect(()=>{if(!t||!e.current)return;e.current.querySelector(".bf-textarea")?.focus();let r=i=>{if(i.key!=="Tab"||!e.current)return;let p=e.current.querySelectorAll('button:not([disabled]), textarea:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])');if(p.length===0)return;let n=p[0],l=p[p.length-1];i.shiftKey&&document.activeElement===n?(i.preventDefault(),l.focus()):!i.shiftKey&&document.activeElement===l&&(i.preventDefault(),n.focus());};return document.addEventListener("keydown",r,{capture:true}),()=>document.removeEventListener("keydown",r,{capture:true})},[t]),e}function Bo(t,e){return t?typeof t=="function"?t(e):t.some(a=>a.endsWith("*")?e.startsWith(a.slice(0,-1)):e===a):true}function No(t){let[e,a]=useState(()=>typeof window<"u"?window.location.pathname:"/");return useEffect(()=>{if(typeof window>"u")return;let r=()=>a(window.location.pathname);window.addEventListener("popstate",r);let i=history.pushState,p=history.replaceState;return history.pushState=function(...n){i.apply(this,n),setTimeout(r,0);},history.replaceState=function(...n){p.apply(this,n),setTimeout(r,0);},()=>{window.removeEventListener("popstate",r),history.pushState=i,history.replaceState=p;}},[]),Bo(t,e)}function Fo(t){let[e,a]=useState(()=>!t||t==="dark"?"dark":t==="light"?"light":typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");return useEffect(()=>{if(t!=="auto"){a(t==="light"?"light":"dark");return}let r=window.matchMedia("(prefers-color-scheme: dark)"),i=p=>a(p.matches?"dark":"light");return a(r.matches?"dark":"light"),r.addEventListener("change",i),()=>r.removeEventListener("change",i)},[t]),e}var Ro=["bug","feature","ux","general"],Mo={bug:"categoryBug",feature:"categoryFeature",ux:"categoryUx",general:"categoryGeneral"};function X(t){let e=Math.floor(t/1e3),a=Math.floor(e/60),r=e%60;return `${a}:${String(r).padStart(2,"0")}`}function zo(t){return t<1024*1024?`${Math.round(t/1024)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function Lo(t){let{state:e,controller:a,start:r,stop:i$1,clearSelection:p,submit:n$1}=ie(),l$1=t.config.ui?.position,o=Me(t.config.ui?.strings),s=t.config.ui?.branding!==false,[h,z]=useState(null),[f,S]=useState(""),[b$1,B]=useState(t.config.capture?.element??true),[v,O]=useState(t.config.capture?.fullPage??false),[pt,ce]=useState(null),[D,le]=useState(void 0),de=t.config.ui?.categories??Ro,ft=t.config.recording?.enabled===true&&l(),ut=t.config.recording?.maxDurationMs??3e4,pe=a.getConfig().voice,bt=pe?.enabled===true&&n(),gt=pe?.maxDurationMs??6e4,[mt,ht]=useState(false),[J,xt]=useState(0);useEffect(()=>{let d=window.setTimeout(()=>{let y=w$1();xt(y.findings.length);},500);return ()=>window.clearTimeout(d)},[]),useImperativeHandle(t.handleRef,()=>({open:r,close:i$1,submit:d=>n$1(d),startRecording:()=>a.startRecording(),stopRecording:()=>a.stopRecording(),get isOpen(){return e.phase!=="idle"}}),[r,i$1,n$1,a,e.phase]);let fe=e.phase==="review"||e.phase==="capturing"||e.phase==="submitting"||e.phase==="error"||e.phase==="success",vt=Po(fe),[yt,wt]=useState(0);useEffect(()=>{e.phase==="idle"&&wt(i());},[e.phase]);let[kt,ue]=useState(false),be=useRef(e.phase);useEffect(()=>{if(be.current==="success"&&e.phase==="idle"){ue(true);let d=window.setTimeout(()=>ue(false),1500);return ()=>window.clearTimeout(d)}be.current=e.phase;},[e.phase]),useEffect(()=>{let d=t.config.ui?.shortcut;if(!d)return;let y=d.toLowerCase().split("+").map(P=>P.trim()),C=y[y.length-1]||"",L=new Set(y.slice(0,-1)),he=P=>{let Ct=/Mac|iPod|iPhone|iPad/.test(navigator.platform);if(L.has("mod")){if(Ct?!P.metaKey:!P.ctrlKey)return}else if(L.has("ctrl")&&!P.ctrlKey||(L.has("meta")||L.has("cmd"))&&!P.metaKey)return;L.has("shift")&&!P.shiftKey||(L.has("alt")||L.has("option"))&&!P.altKey||P.key.toLowerCase()===C&&(P.preventDefault(),e.phase==="idle"?r():i$1());};return document.addEventListener("keydown",he),()=>document.removeEventListener("keydown",he)},[t.config.ui?.shortcut,e.phase,r,i$1]),useEffect(()=>a.subscribeHover(z),[a]),useEffect(()=>{let d=a.__unsafeGetSelectedElement();if(!d||e.phase==="idle"||e.phase==="picking"){ce(null);return}let y=()=>{ce(b(d.getBoundingClientRect()));};y();let C=()=>y();return window.addEventListener("scroll",C,{capture:true,passive:true}),window.addEventListener("resize",C,{passive:true}),()=>{window.removeEventListener("scroll",C,{capture:true}),window.removeEventListener("resize",C);}},[a,e.phase,e.selection?.selector]),useEffect(()=>{e.phase==="review"&&(S(""),B(t.config.capture?.element??true),O(t.config.capture?.fullPage??false),le(void 0),V(null));},[e.phase,e.selection?.selector,t.config.capture?.element,t.config.capture?.fullPage]),useEffect(()=>{if(e.phase!=="success")return;let d=window.setTimeout(()=>i$1(),1200);return ()=>window.clearTimeout(d)},[e.phase,i$1]);let T=e.phase==="capturing"||e.phase==="submitting",R=e.phase==="picking"?h?.rect??null:pt??e.selection?.rect??null,Z=useMemo(()=>R?Eo(R,360,l$1):null,[R?.x,R?.y,R?.width,R?.height,l$1]),ge=e.lastError?.message,ee=useCallback(()=>{let d={capture:{element:b$1,fullPage:v}};D&&(d.category=D),n$1(f,d);},[n$1,f,b$1,v,D]),Tt=useCallback(d=>{(d.metaKey||d.ctrlKey)&&d.key==="Enter"&&f.trim().length>0&&!T&&(d.preventDefault(),ee());},[ee,f,T]),[me,V]=useState(null),St=useCallback(async()=>{if(e.voiceRecording){a.stopVoice();return}V(null);let d=await a.startVoice();if(d?.text)S(y=>y?y+" "+d.text:d.text);else if(d?.warning)V(o.voiceEmptyText);else if(!d){let y=a.getState().lastError;if(y){let C=y.message?.toLowerCase()??"";C.includes("denied")||C.includes("permission")||C.includes("not allowed")?V(o.voiceDeniedText):V(o.voiceErrorText);}}},[e.voiceRecording,a,o]),Et=ct(t.config.ui?.triggerStyle);return jsxs(Fragment,{children:[jsx(Et,{position:l$1,onClick:()=>r(),isVisible:e.phase==="idle",label:t.config.ui?.triggerLabel??o.triggerLabel,queueCount:yt,showSuccess:kt}),e.phase!=="idle"&&e.phase!=="recording"&&jsxs("div",{className:"bf-overlay",role:"presentation",children:[e.phase!=="picking"&&jsx("div",{className:"bf-blocker",role:"presentation",onClick:()=>i$1()}),R&&jsx(Co,{rect:R}),e.phase==="picking"&&jsxs("div",{className:"bf-hint",role:"status","aria-live":"polite",children:[jsx("p",{id:"bf-hint-text",children:o.hintText}),jsx("button",{type:"button",className:"bf-btn",onClick:()=>i$1(),"aria-label":o.cancelButton,children:o.cancelButton})]}),fe&&Z&&jsxs("div",{ref:vt,className:"bf-panel",style:{left:Z.left,top:Z.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:o.panelTitle}),jsxs("div",{className:"bf-row",style:{justifyContent:"flex-end"},children:[jsx("button",{type:"button",className:"bf-btn",onClick:()=>p(),disabled:T,"aria-label":o.rePickButton,children:o.rePickButton}),jsx("button",{type:"button",className:"bf-btn",onClick:()=>i$1(),disabled:T,"aria-label":o.closeButton,children:o.closeButton})]})]}),jsxs("div",{className:"bf-panelBody",children:[jsx("textarea",{className:"bf-textarea",placeholder:o.textareaPlaceholder,value:f,onChange:d=>S(d.target.value),onKeyDown:Tt,disabled:T,"aria-label":o.panelTitle}),de.length>0&&jsx("div",{className:"bf-pills",role:"group","aria-label":"Feedback category",children:de.map(d=>jsx("button",{type:"button",className:`bf-pill${D===d?" bf-pill-active":""}`,onClick:()=>le(D===d?void 0:d),disabled:T,children:o[Mo[d]]},d))}),jsxs("div",{className:"bf-row",role:"group","aria-label":o.screenshotElement,children:[jsxs("label",{children:[jsx("input",{type:"checkbox",checked:b$1,onChange:d=>B(d.target.checked),disabled:T}),o.screenshotElement]}),jsxs("label",{children:[jsx("input",{type:"checkbox",checked:v,onChange:d=>O(d.target.checked),disabled:T}),o.screenshotFullPage]})]}),bt&&e.phase==="review"&&!e.voiceTranscribing&&jsx("button",{type:"button",className:`bf-voice-btn${e.voiceRecording?" bf-voice-btn-active":""}`,onClick:St,disabled:T,"aria-label":e.voiceRecording?o.voiceStopButton:o.voiceButton,children:e.voiceRecording?jsxs(Fragment,{children:[jsx("span",{className:"bf-rec-dot bf-rec-dot-pulse","aria-hidden":"true"}),o.voiceRecordingText," ",X(e.voiceElapsedMs??0)," / ",X(gt)," \u2014 ",o.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"})]}),o.voiceButton]})}),e.voiceTranscribing&&jsxs("div",{className:"bf-status",role:"status","aria-live":"polite",children:[jsx("span",{className:"bf-spinner","aria-hidden":"true"}),o.voiceTranscribingText]}),me&&!e.voiceRecording&&!e.voiceTranscribing&&jsx("div",{className:"bf-error",role:"alert",children:me}),ft&&e.phase==="review"&&!e.video&&jsxs("button",{type:"button",className:"bf-record-btn",onClick:()=>a.startRecording(),disabled:T,"aria-label":o.recordButton,children:[jsx("span",{className:"bf-rec-dot","aria-hidden":"true"}),o.recordButton]}),e.video&&e.phase==="review"&&jsxs("div",{className:"bf-video-preview",children:[jsx("video",{src:e.video.blobUrl,controls:true,muted:true,playsInline:true}),jsx("button",{type:"button",className:"bf-video-remove",onClick:()=>a.removeVideo(),"aria-label":o.removeVideoButton,children:"\xD7"}),jsxs("div",{className:"bf-video-meta",children:[o.videoPreviewLabel," (",X(e.video.durationMs),", ",zo(e.video.sizeBytes),")"]})]}),e.phase==="capturing"&&jsxs("div",{className:"bf-status",role:"status","aria-live":"polite",children:[jsx("span",{className:"bf-spinner","aria-hidden":"true"}),o.capturingText]}),e.phase==="submitting"&&jsxs("div",{className:"bf-status",role:"status","aria-live":"polite",children:[jsx("span",{className:"bf-spinner","aria-hidden":"true"}),o.submittingText]}),e.phase==="success"&&jsx("div",{className:"bf-status",role:"status","aria-live":"polite",children:o.successText}),e.phase==="error"&&ge&&jsx("div",{className:"bf-error",role:"alert",children:ge}),jsxs("div",{className:"bf-actions",children:[jsx("button",{type:"button",className:"bf-btn",onClick:()=>i$1(),disabled:T,"aria-label":o.cancelButton,children:o.cancelButton}),jsx("button",{type:"button",className:"bf-btn bf-btnPrimary",onClick:ee,disabled:T||f.trim().length===0,"aria-label":o.sendButton,children:o.sendButton})]})]}),s&&jsx("div",{className:"bf-watermark",children:jsx("a",{href:"https://blocfeed.com",target:"_blank",rel:"noopener noreferrer",children:"Powered by BlocFeed"})})]})]}),e.phase==="recording"&&jsxs("div",{className:`bf-recording-bar bf-pos-${l$1}`,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:[o.recordingText," ",X(e.recordingElapsedMs??0)," / ",X(ut)]}),jsx("button",{type:"button",className:"bf-recording-bar-stop",onClick:()=>a.stopRecording(),"aria-label":o.stopRecordButton,children:o.stopRecordButton})]}),e.phase==="success"&&jsx("div",{className:"bf-toast",role:"status","aria-live":"polite",children:o.toastText}),J>0&&!mt&&jsxs("div",{className:"bf-security-banner",role:"alert",children:[jsx("button",{type:"button",className:"bf-security-banner-dismiss",onClick:()=>ht(true),"aria-label":"Dismiss",children:"\xD7"}),jsx("strong",{children:"Security Warning"}),J," potential secret",J>1?"s":""," exposed in client code. Check your environment variables."]})]})}var Ao=forwardRef(function(e,a){let r$1={...e.config??{},blocfeed_id:e.blocfeed_id},[i,p]=useState(null),n=No(r$1.ui?.showOn),l=Fo(r$1.ui?.theme?.mode),o=!!r$1.diagnostics;useEffect(()=>{if(o)return r(r$1.diagnostics),()=>s()},[o]);let s$1=!!r$1.security;useEffect(()=>{s$1&&v(r$1.security);},[s$1]);let h=useRef(e.config?.metadata?.enrich);h.current=e.config?.metadata?.enrich;let z=useMemo(()=>{if(e.config)return {...e.config,metadata:{...e.config.metadata,enrich:async f=>{let S=h.current,b=S?await S(f):{},B=t(),v=w$1(),O=j();return {...b,...B.consoleLogs.length>0?{_consoleLogs:B.consoleLogs}:{},...B.networkErrors.length>0?{_networkErrors:B.networkErrors}:{},...v.findings.length>0?{_securityFindings:v.findings}:{},...O.length>0?{_clickEvents:O}:{}}}}}},[]);return useEffect(()=>{Fe();let f=document.createElement("div");f.setAttribute("data-blocfeed-ui-root","true"),f.setAttribute("data-blocfeed-ui","true"),f.setAttribute("data-bf-theme",l);let S=r$1.ui?.zIndex;typeof S=="number"&&f.style.setProperty("--bf-z",String(S));let b=r$1.ui?.theme;return b&&(b.accentColor&&f.style.setProperty("--bf-accent",b.accentColor),b.panelBackground&&f.style.setProperty("--bf-panel-bg",b.panelBackground),b.panelForeground&&f.style.setProperty("--bf-panel-fg",b.panelForeground),b.fontFamily&&f.style.setProperty("--bf-font",b.fontFamily)),document.body.appendChild(f),p(f),()=>{f.remove(),p(null);}},[r$1.ui?.zIndex,r$1.ui?.theme?.accentColor,r$1.ui?.theme?.panelBackground,r$1.ui?.theme?.panelForeground,r$1.ui?.theme?.fontFamily,l]),useEffect(()=>{i&&i.setAttribute("data-bf-theme",l);},[i,l]),!n||!i?null:createPortal(jsx(re,{blocfeed_id:r$1.blocfeed_id,...z?{config:z}:{},children:jsx(Lo,{config:r$1,handleRef:a})}),i)});
846
846
  export{re as BlocFeedProvider,Ao as BlocFeedWidget,ie as useBlocFeed};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blocfeed",
3
- "version": "0.11.2",
3
+ "version": "0.11.3",
4
4
  "description": "Drop-in feedback widget for React — element picking, screenshots, video recording, and voice feedback.",
5
5
  "license": "MIT",
6
6
  "type": "module",