blocfeed 0.14.0 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +43 -0
- package/README.md +39 -0
- package/dist/chunk-CYITSKBK.js +2 -0
- package/dist/chunk-NLL5DECC.cjs +2 -0
- package/dist/{controller-JCtPYbzs.d.cts → controller-6fm9oK63.d.cts} +48 -1
- package/dist/{controller-JCtPYbzs.d.ts → controller-6fm9oK63.d.ts} +48 -1
- package/dist/engine.cjs +1 -1
- package/dist/engine.d.cts +2 -2
- package/dist/engine.d.ts +2 -2
- package/dist/engine.js +1 -1
- package/dist/main.cjs +3 -3
- package/dist/main.d.cts +30 -3
- package/dist/main.d.ts +30 -3
- package/dist/main.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-EZWTVVJ5.cjs +0 -2
- package/dist/chunk-PUVKSWVE.js +0 -2
package/dist/main.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
'use strict';var
|
|
2
|
+
'use strict';var chunkNLL5DECC_cjs=require('./chunk-NLL5DECC.cjs'),react=require('react'),jsxRuntime=require('react/jsx-runtime'),reactDom=require('react-dom'),framerMotion=require('framer-motion');var Y=react.createContext(null);function ie(t){let e=react.useMemo(()=>chunkNLL5DECC_cjs.t({...t.config??{},blocfeed_id:t.blocfeed_id}),[]),[i,r]=react.useState(()=>e.getState());return react.useEffect(()=>e.subscribe(r),[e]),react.useEffect(()=>e.setConfig({...t.config??{},blocfeed_id:t.blocfeed_id}),[e,t.config,t.blocfeed_id]),react.useEffect(()=>()=>e.destroy(),[e]),jsxRuntime.jsx(Y.Provider,{value:{controller:e,state:i},children:t.children})}var Re="blocfeed-styles-v1",It=`
|
|
3
3
|
:where([data-blocfeed-ui-root]),
|
|
4
4
|
:where([data-blocfeed-ui-root]) * {
|
|
5
5
|
box-sizing: border-box;
|
|
@@ -881,5 +881,5 @@
|
|
|
881
881
|
animation: none;
|
|
882
882
|
}
|
|
883
883
|
}
|
|
884
|
-
`;function Me(){if(!chunkEZWTVVJ5_cjs.a()||document.getElementById(Re))return;let t=document.createElement("style");t.id=Re,t.textContent=zt,document.head.appendChild(t);}var Le={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 ze(t){return t?{...Le,...t}:Le}function ae(){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 y(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 Ie({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 Ae({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 _e({position:t,onClick:e,isVisible:i,label:r,queueCount:a,showSuccess:p}){return i?jsxRuntime.jsxs("button",{className:y(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]}),a>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${a} queued`,children:a})]}):null}function h(){let[t,e]=react.useState(()=>typeof window>"u"?false:window.matchMedia("(prefers-reduced-motion: reduce)").matches);return react.useEffect(()=>{let i=window.matchMedia("(prefers-reduced-motion: reduce)"),r=a=>e(a.matches);return i.addEventListener("change",r),()=>i.removeEventListener("change",r)},[]),t}var Dt={duration:.18,ease:"easeOut"},Vt={duration:0};function Oe({position:t,onClick:e,isVisible:i,label:r,queueCount:a,showSuccess:p}){let[n,l]=react.useState(false),o=h(),c=o?Vt:Dt;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:i&&jsxRuntime.jsx(framerMotion.motion.button,{className:y(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:c,whileTap:{scale:.92},style:{overflow:"hidden"},children:p?jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:c,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?c:{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:c,style:{whiteSpace:"nowrap"},children:r},"label")}),a>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${a} queued`,children:a})]})},"dot")})}var Xt={duration:.18,ease:"easeOut"},Ve={duration:0};function Ke({position:t,onClick:e,isVisible:i,label:r,queueCount:a,showSuccess:p}){let[n,l]=react.useState(false),o=h(),c=o?Ve:Xt;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:i&&jsxRuntime.jsxs(framerMotion.motion.div,{className:y(t),initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{y:8,opacity:0},transition:c,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:c,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?Ve:{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:c,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsxRuntime.jsx(g,{size:16})},"success"):jsxRuntime.jsx(Ie,{size:16}),a>0&&jsxRuntime.jsx("span",{className:"bf-badge bf-badge-float","aria-label":`${a} queued`,children:a})]})]},"bubble")})}var jt={duration:.2,ease:"easeOut"},Qt={duration:0};function Xe(t){return t==="bottom-left"||t==="top-left"}function qt(t){return `bf-trigger-edge ${Xe(t)?"bf-trigger-edge-left":"bf-trigger-edge-right"}`}function Ye({position:t,onClick:e,isVisible:i,label:r,queueCount:a,showSuccess:p}){let[n,l]=react.useState(false),o=Xe(t),c=h(),x=c?Qt:jt;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:i&&jsxRuntime.jsx(framerMotion.motion.button,{className:qt(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:x,whileTap:{scale:.97},style:{top:"50%",translateY:"-50%"},children:p?jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:x,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:c||n?0:o?-90:90,opacity:n?1:.6},transition:x,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)"}}),a>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${a} queued`,children:a})]})},"edge-tab")})}var eo={duration:.18,ease:"easeOut"},to={duration:0};function je({delay:t,hovered:e,reduced:i}){return i?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 qe({position:t,onClick:e,isVisible:i,label:r,queueCount:a,showSuccess:p}){let[n,l]=react.useState(false),o=h(),c=o?to:eo;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:i&&jsxRuntime.jsx(framerMotion.motion.button,{className:y(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:c,whileTap:{scale:.92},style:{overflow:"hidden"},children:p?jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:c,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(je,{delay:0,hovered:n,reduced:o}),jsxRuntime.jsx(je,{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:c,style:{whiteSpace:"nowrap"},children:r},"label")}),a>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${a} queued`,children:a})]})},"pulse-ring")})}var ao={duration:.18,ease:"easeOut"},no={duration:0};function so(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 et({position:t,onClick:e,isVisible:i,label:r,queueCount:a,showSuccess:p}){let[n,l]=react.useState(false),o=h(),c=o?no:ao;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:i&&jsxRuntime.jsxs(framerMotion.motion.button,{className:so(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:c,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}),a>0&&jsxRuntime.jsx("span",{className:"bf-badge",style:{marginLeft:"4px"},"aria-label":`${a} queued`,children:a})]}),!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:c})]},"minimal")})}var fo={duration:.18,ease:"easeOut"},po={duration:0};function ot({position:t,onClick:e,isVisible:i,label:r,queueCount:a,showSuccess:p}){let[n,l]=react.useState(false),o=h(),c=o?po:fo;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:i&&jsxRuntime.jsx(framerMotion.motion.button,{className:y(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:c,whileTap:{scale:.9},style:{overflow:"hidden"},children:p?jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:c,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?c:{duration:3,repeat:1/0,ease:"easeInOut"},children:jsxRuntime.jsx(Ae,{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:c,style:{whiteSpace:"nowrap"},children:r},"label")}),a>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${a} queued`,children:a})]})},"icon-pop")})}var mo={duration:.18,ease:"easeOut"},ho={duration:0};function at({position:t,onClick:e,isVisible:i,label:r,queueCount:a,showSuccess:p}){let[n,l]=react.useState(false),o=h(),c=o?ho:mo;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:i&&jsxRuntime.jsx(framerMotion.motion.button,{className:y(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:c,whileTap:{scale:.92},style:{overflow:"hidden"},children:p?jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:c,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?c:{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:c,style:{whiteSpace:"nowrap"},children:r},"label")}),a>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${a} queued`,children:a})]})},"beacon")})}var ko={duration:.18,ease:"easeOut"},To={duration:0};function lt({position:t,onClick:e,isVisible:i,label:r,queueCount:a,showSuccess:p}){let[n,l]=react.useState(false),[o,c]=react.useState(0),x=h(),z=x?To:ko,f=react.useRef(null);react.useEffect(()=>{if(f.current&&(clearInterval(f.current),f.current=null),!i||n||x){c(n||x?r.length:0);return}let b=8,T=r.length*2+b*2,m=0;return f.current=setInterval(()=>{m=(m+1)%T,m<=r.length?c(m):m<=r.length+b?c(r.length):m<=r.length*2+b?c(r.length*2+b-m):c(0);},100),()=>{f.current&&(clearInterval(f.current),f.current=null);}},[i,n,x,r]);let S=r.slice(0,o);return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:i&&jsxRuntime.jsx(framerMotion.motion.button,{className:y(t),type:"button",onClick:e,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":r,initial:{opacity:0,y:x?0:5},animate:{opacity:1,y:0},exit:{opacity:0,y:x?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"})]}),a>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${a} queued`,children:a})]})},"typewriter")})}function dt(t){switch(t){case "dot":return Oe;case "bubble":return Ke;case "edge-tab":return Ye;case "pulse-ring":return qe;case "minimal":return et;case "icon-pop":return ot;case "beacon":return at;case "typewriter":return lt;default:return _e}}function ft(t,e,i){return Math.max(e,Math.min(i,t))}function Bo(t,e,i="bottom-right"){let a=window.innerWidth,p=window.innerHeight,n;n=ft(t.x,12,Math.max(12,a-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 No(t){let{rect:e}=t,i={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:i,"aria-hidden":"true"})}function Fo(t){let e=react.useRef(null);return react.useEffect(()=>{if(!t||!e.current)return;let i=e.current,r=i.querySelector(".bf-textarea");r?.focus();let a=n=>{if(n.key!=="Tab")return;let l=i.querySelectorAll('button:not([disabled]), textarea:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])');if(l.length===0)return;let o=l[0],c=l[l.length-1];n.shiftKey&&document.activeElement===o?(n.preventDefault(),c.focus()):!n.shiftKey&&document.activeElement===c&&(n.preventDefault(),o.focus());},p=n=>{let l=n.target;l&&(i.contains(l)||(n.stopImmediatePropagation(),r?.focus()));};return document.addEventListener("keydown",a,{capture:true}),document.addEventListener("focusin",p,{capture:true}),()=>{document.removeEventListener("keydown",a,{capture:true}),document.removeEventListener("focusin",p,{capture:true});}},[t]),e}function Ro(t,e){return t?typeof t=="function"?t(e):t.some(i=>i.endsWith("*")?e.startsWith(i.slice(0,-1)):e===i):true}var ce=new Set,pt=false;function Mo(){if(pt||typeof window>"u")return;pt=true;let t=history.pushState,e=history.replaceState,i=()=>{for(let r of ce)r();};history.pushState=function(...r){t.apply(this,r),setTimeout(i,0);},history.replaceState=function(...r){e.apply(this,r),setTimeout(i,0);};}function Lo(t){let[e,i]=react.useState(()=>typeof window<"u"?window.location.pathname:"/");return react.useEffect(()=>{if(typeof window>"u")return;let r=()=>i(window.location.pathname);return window.addEventListener("popstate",r),Mo(),ce.add(r),()=>{window.removeEventListener("popstate",r),ce.delete(r);}},[]),Ro(t,e)}function zo(t){let[e,i]=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"){i(t==="light"?"light":"dark");return}let r=window.matchMedia("(prefers-color-scheme: dark)"),a=p=>i(p.matches?"dark":"light");return i(r.matches?"dark":"light"),r.addEventListener("change",a),()=>r.removeEventListener("change",a)},[t]),e}var Io=["bug","feature","ux","general"],Ao={bug:"categoryBug",feature:"categoryFeature",ux:"categoryUx",general:"categoryGeneral"};function X(t){let e=Math.floor(t/1e3),i=Math.floor(e/60),r=e%60;return `${i}:${String(r).padStart(2,"0")}`}function Wo(t){return t<1024*1024?`${Math.round(t/1024)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function _o(t){let{state:e,controller:i,start:r,stop:a,clearSelection:p,submit:n}=ae(),l=t.config.ui?.position,o=ze(t.config.ui?.strings),c=t.config.ui?.branding!==false,[x,z]=react.useState(null),[f,S]=react.useState(""),[b,T]=react.useState(t.config.capture?.element??true),[m,C]=react.useState(t.config.capture?.fullPage??false),[bt,de]=react.useState(null),[D,fe]=react.useState(void 0),pe=t.config.ui?.categories??Io,gt=t.config.recording?.enabled===true&&chunkEZWTVVJ5_cjs.l(),mt=t.config.recording?.maxDurationMs??3e4,ue=i.getConfig().voice,ht=ue?.enabled===true&&chunkEZWTVVJ5_cjs.n(),xt=ue?.maxDurationMs??6e4,[vt,yt]=react.useState(false),[J,wt]=react.useState(0);react.useEffect(()=>{let s=window.setTimeout(()=>{let v=chunkEZWTVVJ5_cjs.y();wt(v.findings.length);},500);return ()=>window.clearTimeout(s)},[]),react.useImperativeHandle(t.handleRef,()=>({open:r,close:a,submit:s=>n(s),startRecording:()=>i.startRecording(),stopRecording:()=>i.stopRecording(),get isOpen(){return e.phase!=="idle"}}),[r,a,n,i,e.phase]);let be=e.phase==="review"||e.phase==="capturing"||e.phase==="submitting"||e.phase==="error"||e.phase==="success",kt=Fo(be),[Tt,Et]=react.useState(0);react.useEffect(()=>{e.phase==="idle"&&Et(chunkEZWTVVJ5_cjs.i());},[e.phase]);let[St,ge]=react.useState(false),me=react.useRef(e.phase);react.useEffect(()=>{if(me.current==="success"&&e.phase==="idle"){ge(true);let s=window.setTimeout(()=>ge(false),1500);return ()=>window.clearTimeout(s)}me.current=e.phase;},[e.phase]),react.useEffect(()=>{let s=t.config.ui?.shortcut;if(!s)return;let v=s.toLowerCase().split("+").map(N=>N.trim()),B=v[v.length-1]||"",I=new Set(v.slice(0,-1)),ve=N=>{let Nt=/Mac|iPod|iPhone|iPad/.test(navigator.platform);if(I.has("mod")){if(Nt?!N.metaKey:!N.ctrlKey)return}else if(I.has("ctrl")&&!N.ctrlKey||(I.has("meta")||I.has("cmd"))&&!N.metaKey)return;I.has("shift")&&!N.shiftKey||(I.has("alt")||I.has("option"))&&!N.altKey||N.key.toLowerCase()===B&&(N.preventDefault(),e.phase==="idle"?r():a());};return document.addEventListener("keydown",ve),()=>document.removeEventListener("keydown",ve)},[t.config.ui?.shortcut,e.phase,r,a]),react.useEffect(()=>i.subscribeHover(z),[i]),react.useEffect(()=>{let s=i.__unsafeGetSelectedElement();if(!s||e.phase==="idle"||e.phase==="picking"){de(null);return}let v=()=>{de(chunkEZWTVVJ5_cjs.b(s.getBoundingClientRect()));};v();let B=()=>v();return window.addEventListener("scroll",B,{capture:true,passive:true}),window.addEventListener("resize",B,{passive:true}),()=>{window.removeEventListener("scroll",B,{capture:true}),window.removeEventListener("resize",B);}},[i,e.phase,e.selection?.selector]),react.useEffect(()=>{e.phase==="review"&&(S(""),T(t.config.capture?.element??true),C(t.config.capture?.fullPage??false),fe(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 s=window.setTimeout(()=>a(),1200);return ()=>window.clearTimeout(s)},[e.phase,a]);let E=e.phase==="capturing"||e.phase==="submitting",M=e.phase==="picking"?x?.rect??null:bt??e.selection?.rect??null,Z=react.useMemo(()=>M?Bo(M,360,l):null,[M?.x,M?.y,M?.width,M?.height,l]),he=e.lastError?.message,ee=react.useCallback(()=>{let s={capture:{element:b,fullPage:m}};D&&(s.category=D),n(f,s);},[n,f,b,m,D]),Ct=react.useCallback(s=>{(s.metaKey||s.ctrlKey)&&s.key==="Enter"&&f.trim().length>0&&!E&&(s.preventDefault(),ee());},[ee,f,E]),[xe,V]=react.useState(null),Pt=react.useCallback(async()=>{if(e.voiceRecording){i.stopVoice();return}V(null);let s=await i.startVoice();if(s?.text)S(v=>v?v+" "+s.text:s.text);else if(s?.warning)V(o.voiceEmptyText);else if(!s){let v=i.getState().lastError;if(v){let B=v.message?.toLowerCase()??"";B.includes("denied")||B.includes("permission")||B.includes("not allowed")?V(o.voiceDeniedText):V(o.voiceErrorText);}}},[e.voiceRecording,i,o]),Bt=dt(t.config.ui?.triggerStyle);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Bt,{position:l,onClick:()=>r(),isVisible:e.phase==="idle",label:t.config.ui?.triggerLabel??o.triggerLabel,queueCount:Tt,showSuccess:St}),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:()=>a()}),M&&jsxRuntime.jsx(No,{rect:M}),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:()=>a(),"aria-label":o.cancelButton,children:o.cancelButton})]}),be&&Z&&jsxRuntime.jsxs("div",{ref:kt,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:E,"aria-label":o.rePickButton,children:o.rePickButton}),jsxRuntime.jsx("button",{type:"button",className:"bf-btn",onClick:()=>a(),disabled:E,"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:s=>S(s.target.value),onKeyDown:Ct,disabled:E,"aria-label":o.panelTitle}),pe.length>0&&jsxRuntime.jsx("div",{className:"bf-pills",role:"group","aria-label":"Feedback category",children:pe.map(s=>jsxRuntime.jsx("button",{type:"button",className:`bf-pill${D===s?" bf-pill-active":""}`,onClick:()=>fe(D===s?void 0:s),disabled:E,children:o[Ao[s]]},s))}),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:s=>T(s.target.checked),disabled:E}),o.screenshotElement]}),jsxRuntime.jsxs("label",{children:[jsxRuntime.jsx("input",{type:"checkbox",checked:m,onChange:s=>C(s.target.checked),disabled:E}),o.screenshotFullPage]})]}),ht&&e.phase==="review"&&!e.voiceTranscribing&&jsxRuntime.jsx("button",{type:"button",className:`bf-voice-btn${e.voiceRecording?" bf-voice-btn-active":""}`,onClick:Pt,disabled:E,"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(xt)," \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]}),xe&&!e.voiceRecording&&!e.voiceTranscribing&&jsxRuntime.jsx("div",{className:"bf-error",role:"alert",children:xe}),gt&&e.phase==="review"&&!e.video&&jsxRuntime.jsxs("button",{type:"button",className:"bf-record-btn",onClick:()=>i.startRecording(),disabled:E,"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:()=>i.removeVideo(),"aria-label":o.removeVideoButton,children:"\xD7"}),jsxRuntime.jsxs("div",{className:"bf-video-meta",children:[o.videoPreviewLabel," (",X(e.video.durationMs),", ",Wo(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"&&he&&jsxRuntime.jsx("div",{className:"bf-error",role:"alert",children:he}),jsxRuntime.jsxs("div",{className:"bf-actions",children:[jsxRuntime.jsx("button",{type:"button",className:"bf-btn",onClick:()=>a(),disabled:E,"aria-label":o.cancelButton,children:o.cancelButton}),jsxRuntime.jsx("button",{type:"button",className:"bf-btn bf-btnPrimary",onClick:ee,disabled:E||f.trim().length===0,"aria-label":o.sendButton,children:o.sendButton})]})]}),c&&jsxRuntime.jsxs("div",{className:"bf-watermark",children:[(()=>{let s=chunkEZWTVVJ5_cjs.q();return s?jsxRuntime.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"bf-my-feedback-link",children:"View my feedback"}):null})(),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(mt)]}),jsxRuntime.jsx("button",{type:"button",className:"bf-recording-bar-stop",onClick:()=>i.stopRecording(),"aria-label":o.stopRecordButton,children:o.stopRecordButton})]}),e.phase==="success"&&jsxRuntime.jsxs("div",{className:"bf-toast",role:"status","aria-live":"polite",children:[o.toastText,(()=>{let s=chunkEZWTVVJ5_cjs.q();return s?jsxRuntime.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"bf-toast-link",children:"View my feedback"}):null})()]}),J>0&&!vt&&jsxRuntime.jsxs("div",{className:"bf-security-banner",role:"alert",children:[jsxRuntime.jsx("button",{type:"button",className:"bf-security-banner-dismiss",onClick:()=>yt(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 Ho=react.forwardRef(function(e,i){let r={...e.config??{},blocfeed_id:e.blocfeed_id},[a,p]=react.useState(null),n=Lo(r.ui?.showOn),l=zo(r.ui?.theme?.mode),o=!!r.diagnostics;react.useEffect(()=>{if(o)return chunkEZWTVVJ5_cjs.t(r.diagnostics),()=>chunkEZWTVVJ5_cjs.u()},[o]);let c=!!r.security;react.useEffect(()=>{c&&chunkEZWTVVJ5_cjs.x(r.security);},[c]);let x=react.useRef(e.config?.metadata?.enrich);x.current=e.config?.metadata?.enrich;let z=react.useMemo(()=>{if(e.config)return {...e.config,metadata:{...e.config.metadata,enrich:async f=>{let S=x.current,b=S?await S(f):{},T=chunkEZWTVVJ5_cjs.v(),m=chunkEZWTVVJ5_cjs.y(),C=chunkEZWTVVJ5_cjs.j();return {...b,...T.consoleLogs.length>0?{_consoleLogs:T.consoleLogs}:{},...T.networkErrors.length>0?{_networkErrors:T.networkErrors}:{},...m.findings.length>0?{_securityFindings:m.findings}:{},...C.length>0?{_clickEvents:C}:{}}}}}},[]);return react.useEffect(()=>{Me();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;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));let T=C=>C.stopPropagation(),m=["pointerdown","pointerup","mousedown","mouseup","click","touchstart","touchend"];for(let C of m)f.addEventListener(C,T);try{document.body.appendChild(f);}catch{return}return p(f),()=>{for(let C of m)f.removeEventListener(C,T);f.remove(),p(null);}},[r.ui?.zIndex,r.ui?.theme?.accentColor,r.ui?.theme?.panelBackground,r.ui?.theme?.panelForeground,r.ui?.theme?.fontFamily,l]),!n||!a?null:reactDom.createPortal(jsxRuntime.jsx(ie,{blocfeed_id:r.blocfeed_id,...z?{config:z}:{},children:jsxRuntime.jsx(_o,{config:r,handleRef:i})}),a)});
|
|
885
|
-
exports.BlocFeedProvider=ie;exports.BlocFeedWidget=
|
|
884
|
+
`;function Me(){if(!chunkNLL5DECC_cjs.a()||document.getElementById(Re))return;let t=document.createElement("style");t.id=Re,t.textContent=It,document.head.appendChild(t);}var Le={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 ze(t){return t?{...Le,...t}:Le}function ae(){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 y(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 Ie({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 Ae({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 _e({position:t,onClick:e,isVisible:i,label:r,queueCount:a,showSuccess:p}){return i?jsxRuntime.jsxs("button",{className:y(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]}),a>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${a} queued`,children:a})]}):null}function h(){let[t,e]=react.useState(()=>typeof window>"u"?false:window.matchMedia("(prefers-reduced-motion: reduce)").matches);return react.useEffect(()=>{let i=window.matchMedia("(prefers-reduced-motion: reduce)"),r=a=>e(a.matches);return i.addEventListener("change",r),()=>i.removeEventListener("change",r)},[]),t}var Vt={duration:.18,ease:"easeOut"},$t={duration:0};function Oe({position:t,onClick:e,isVisible:i,label:r,queueCount:a,showSuccess:p}){let[n,l]=react.useState(false),o=h(),c=o?$t:Vt;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:i&&jsxRuntime.jsx(framerMotion.motion.button,{className:y(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:c,whileTap:{scale:.92},style:{overflow:"hidden"},children:p?jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:c,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?c:{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:c,style:{whiteSpace:"nowrap"},children:r},"label")}),a>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${a} queued`,children:a})]})},"dot")})}var Yt={duration:.18,ease:"easeOut"},Ve={duration:0};function Ke({position:t,onClick:e,isVisible:i,label:r,queueCount:a,showSuccess:p}){let[n,l]=react.useState(false),o=h(),c=o?Ve:Yt;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:i&&jsxRuntime.jsxs(framerMotion.motion.div,{className:y(t),initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{y:8,opacity:0},transition:c,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:c,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?Ve:{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:c,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsxRuntime.jsx(g,{size:16})},"success"):jsxRuntime.jsx(Ie,{size:16}),a>0&&jsxRuntime.jsx("span",{className:"bf-badge bf-badge-float","aria-label":`${a} queued`,children:a})]})]},"bubble")})}var Qt={duration:.2,ease:"easeOut"},qt={duration:0};function Xe(t){return t==="bottom-left"||t==="top-left"}function Jt(t){return `bf-trigger-edge ${Xe(t)?"bf-trigger-edge-left":"bf-trigger-edge-right"}`}function Ye({position:t,onClick:e,isVisible:i,label:r,queueCount:a,showSuccess:p}){let[n,l]=react.useState(false),o=Xe(t),c=h(),x=c?qt:Qt;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:i&&jsxRuntime.jsx(framerMotion.motion.button,{className:Jt(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:x,whileTap:{scale:.97},style:{top:"50%",translateY:"-50%"},children:p?jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:x,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:c||n?0:o?-90:90,opacity:n?1:.6},transition:x,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)"}}),a>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${a} queued`,children:a})]})},"edge-tab")})}var to={duration:.18,ease:"easeOut"},oo={duration:0};function je({delay:t,hovered:e,reduced:i}){return i?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 qe({position:t,onClick:e,isVisible:i,label:r,queueCount:a,showSuccess:p}){let[n,l]=react.useState(false),o=h(),c=o?oo:to;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:i&&jsxRuntime.jsx(framerMotion.motion.button,{className:y(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:c,whileTap:{scale:.92},style:{overflow:"hidden"},children:p?jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:c,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(je,{delay:0,hovered:n,reduced:o}),jsxRuntime.jsx(je,{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:c,style:{whiteSpace:"nowrap"},children:r},"label")}),a>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${a} queued`,children:a})]})},"pulse-ring")})}var no={duration:.18,ease:"easeOut"},so={duration:0};function co(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 et({position:t,onClick:e,isVisible:i,label:r,queueCount:a,showSuccess:p}){let[n,l]=react.useState(false),o=h(),c=o?so:no;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:i&&jsxRuntime.jsxs(framerMotion.motion.button,{className:co(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:c,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}),a>0&&jsxRuntime.jsx("span",{className:"bf-badge",style:{marginLeft:"4px"},"aria-label":`${a} queued`,children:a})]}),!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:c})]},"minimal")})}var po={duration:.18,ease:"easeOut"},uo={duration:0};function ot({position:t,onClick:e,isVisible:i,label:r,queueCount:a,showSuccess:p}){let[n,l]=react.useState(false),o=h(),c=o?uo:po;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:i&&jsxRuntime.jsx(framerMotion.motion.button,{className:y(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:c,whileTap:{scale:.9},style:{overflow:"hidden"},children:p?jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:c,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?c:{duration:3,repeat:1/0,ease:"easeInOut"},children:jsxRuntime.jsx(Ae,{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:c,style:{whiteSpace:"nowrap"},children:r},"label")}),a>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${a} queued`,children:a})]})},"icon-pop")})}var ho={duration:.18,ease:"easeOut"},xo={duration:0};function at({position:t,onClick:e,isVisible:i,label:r,queueCount:a,showSuccess:p}){let[n,l]=react.useState(false),o=h(),c=o?xo:ho;return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:i&&jsxRuntime.jsx(framerMotion.motion.button,{className:y(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:c,whileTap:{scale:.92},style:{overflow:"hidden"},children:p?jsxRuntime.jsx(framerMotion.motion.span,{initial:{scale:0},animate:{scale:1},transition:c,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?c:{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:c,style:{whiteSpace:"nowrap"},children:r},"label")}),a>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${a} queued`,children:a})]})},"beacon")})}var To={duration:.18,ease:"easeOut"},Eo={duration:0};function lt({position:t,onClick:e,isVisible:i,label:r,queueCount:a,showSuccess:p}){let[n,l]=react.useState(false),[o,c]=react.useState(0),x=h(),z=x?Eo:To,f=react.useRef(null);react.useEffect(()=>{if(f.current&&(clearInterval(f.current),f.current=null),!i||n||x){c(n||x?r.length:0);return}let b=8,T=r.length*2+b*2,m=0;return f.current=setInterval(()=>{m=(m+1)%T,m<=r.length?c(m):m<=r.length+b?c(r.length):m<=r.length*2+b?c(r.length*2+b-m):c(0);},100),()=>{f.current&&(clearInterval(f.current),f.current=null);}},[i,n,x,r]);let S=r.slice(0,o);return jsxRuntime.jsx(framerMotion.AnimatePresence,{mode:"wait",children:i&&jsxRuntime.jsx(framerMotion.motion.button,{className:y(t),type:"button",onClick:e,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":r,initial:{opacity:0,y:x?0:5},animate:{opacity:1,y:0},exit:{opacity:0,y:x?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"})]}),a>0&&jsxRuntime.jsx("span",{className:"bf-badge","aria-label":`${a} queued`,children:a})]})},"typewriter")})}function dt(t){switch(t){case "dot":return Oe;case "bubble":return Ke;case "edge-tab":return Ye;case "pulse-ring":return qe;case "minimal":return et;case "icon-pop":return ot;case "beacon":return at;case "typewriter":return lt;default:return _e}}function ft(t,e,i){return Math.max(e,Math.min(i,t))}function No(t,e,i="bottom-right"){let a=window.innerWidth,p=window.innerHeight,n;n=ft(t.x,12,Math.max(12,a-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 Fo(t){let{rect:e}=t,i={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:i,"aria-hidden":"true"})}function Ro(t){let e=react.useRef(null);return react.useEffect(()=>{if(!t||!e.current)return;let i=e.current,r=i.querySelector(".bf-textarea");r?.focus();let a=n=>{if(n.key!=="Tab")return;let l=i.querySelectorAll('button:not([disabled]), textarea:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])');if(l.length===0)return;let o=l[0],c=l[l.length-1];n.shiftKey&&document.activeElement===o?(n.preventDefault(),c.focus()):!n.shiftKey&&document.activeElement===c&&(n.preventDefault(),o.focus());},p=n=>{let l=n.target;l&&(i.contains(l)||(n.stopImmediatePropagation(),r?.focus()));};return document.addEventListener("keydown",a,{capture:true}),document.addEventListener("focusin",p,{capture:true}),()=>{document.removeEventListener("keydown",a,{capture:true}),document.removeEventListener("focusin",p,{capture:true});}},[t]),e}function Mo(t,e){return t?typeof t=="function"?t(e):t.some(i=>i.endsWith("*")?e.startsWith(i.slice(0,-1)):e===i):true}var ce=new Set,pt=false;function Lo(){if(pt||typeof window>"u")return;pt=true;let t=history.pushState,e=history.replaceState,i=()=>{for(let r of ce)r();};history.pushState=function(...r){t.apply(this,r),setTimeout(i,0);},history.replaceState=function(...r){e.apply(this,r),setTimeout(i,0);};}function zo(t){let[e,i]=react.useState(()=>typeof window<"u"?window.location.pathname:"/");return react.useEffect(()=>{if(typeof window>"u")return;let r=()=>i(window.location.pathname);return window.addEventListener("popstate",r),Lo(),ce.add(r),()=>{window.removeEventListener("popstate",r),ce.delete(r);}},[]),Mo(t,e)}function Io(t){let[e,i]=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"){i(t==="light"?"light":"dark");return}let r=window.matchMedia("(prefers-color-scheme: dark)"),a=p=>i(p.matches?"dark":"light");return i(r.matches?"dark":"light"),r.addEventListener("change",a),()=>r.removeEventListener("change",a)},[t]),e}var Ao=["bug","feature","ux","general"],Wo={bug:"categoryBug",feature:"categoryFeature",ux:"categoryUx",general:"categoryGeneral"};function X(t){let e=Math.floor(t/1e3),i=Math.floor(e/60),r=e%60;return `${i}:${String(r).padStart(2,"0")}`}function _o(t){return t<1024*1024?`${Math.round(t/1024)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function Ho(t){let{state:e,controller:i,start:r,stop:a,clearSelection:p,submit:n}=ae(),l=t.config.ui?.position,o=ze(t.config.ui?.strings),c=t.config.ui?.branding!==false,[x,z]=react.useState(null),[f,S]=react.useState(""),[b,T]=react.useState(t.config.capture?.element??true),[m,C]=react.useState(t.config.capture?.fullPage??false),[bt,de]=react.useState(null),[D,fe]=react.useState(void 0),pe=t.config.ui?.categories??Ao,gt=t.config.recording?.enabled===true&&chunkNLL5DECC_cjs.l(),mt=t.config.recording?.maxDurationMs??3e4,ue=i.getConfig().voice,ht=ue?.enabled===true&&chunkNLL5DECC_cjs.n(),xt=ue?.maxDurationMs??6e4,[vt,yt]=react.useState(false),[J,wt]=react.useState(0);react.useEffect(()=>{let s=window.setTimeout(()=>{let v=chunkNLL5DECC_cjs.z();wt(v.findings.length);},500);return ()=>window.clearTimeout(s)},[]),react.useImperativeHandle(t.handleRef,()=>({open:r,close:a,submit:s=>n(s),startRecording:()=>i.startRecording(),stopRecording:()=>i.stopRecording(),get isOpen(){return e.phase!=="idle"}}),[r,a,n,i,e.phase]);let be=e.phase==="review"||e.phase==="capturing"||e.phase==="submitting"||e.phase==="error"||e.phase==="success",kt=Ro(be),[Tt,Et]=react.useState(0);react.useEffect(()=>{e.phase==="idle"&&Et(chunkNLL5DECC_cjs.i());},[e.phase]);let[St,ge]=react.useState(false),me=react.useRef(e.phase);react.useEffect(()=>{if(me.current==="success"&&e.phase==="idle"){ge(true);let s=window.setTimeout(()=>ge(false),1500);return ()=>window.clearTimeout(s)}me.current=e.phase;},[e.phase]),react.useEffect(()=>{let s=t.config.ui?.shortcut;if(!s)return;let v=s.toLowerCase().split("+").map(N=>N.trim()),B=v[v.length-1]||"",I=new Set(v.slice(0,-1)),ve=N=>{let Nt=/Mac|iPod|iPhone|iPad/.test(navigator.platform);if(I.has("mod")){if(Nt?!N.metaKey:!N.ctrlKey)return}else if(I.has("ctrl")&&!N.ctrlKey||(I.has("meta")||I.has("cmd"))&&!N.metaKey)return;I.has("shift")&&!N.shiftKey||(I.has("alt")||I.has("option"))&&!N.altKey||N.key.toLowerCase()===B&&(N.preventDefault(),e.phase==="idle"?r():a());};return document.addEventListener("keydown",ve),()=>document.removeEventListener("keydown",ve)},[t.config.ui?.shortcut,e.phase,r,a]),react.useEffect(()=>i.subscribeHover(z),[i]),react.useEffect(()=>{let s=i.__unsafeGetSelectedElement();if(!s||e.phase==="idle"||e.phase==="picking"){de(null);return}let v=()=>{de(chunkNLL5DECC_cjs.b(s.getBoundingClientRect()));};v();let B=()=>v();return window.addEventListener("scroll",B,{capture:true,passive:true}),window.addEventListener("resize",B,{passive:true}),()=>{window.removeEventListener("scroll",B,{capture:true}),window.removeEventListener("resize",B);}},[i,e.phase,e.selection?.selector]),react.useEffect(()=>{e.phase==="review"&&(S(""),T(t.config.capture?.element??true),C(t.config.capture?.fullPage??false),fe(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 s=window.setTimeout(()=>a(),1200);return ()=>window.clearTimeout(s)},[e.phase,a]);let E=e.phase==="capturing"||e.phase==="submitting",M=e.phase==="picking"?x?.rect??null:bt??e.selection?.rect??null,Z=react.useMemo(()=>M?No(M,360,l):null,[M?.x,M?.y,M?.width,M?.height,l]),he=e.lastError?.message,ee=react.useCallback(()=>{let s={capture:{element:b,fullPage:m}};D&&(s.category=D),n(f,s);},[n,f,b,m,D]),Ct=react.useCallback(s=>{(s.metaKey||s.ctrlKey)&&s.key==="Enter"&&f.trim().length>0&&!E&&(s.preventDefault(),ee());},[ee,f,E]),[xe,V]=react.useState(null),Pt=react.useCallback(async()=>{if(e.voiceRecording){i.stopVoice();return}V(null);let s=await i.startVoice();if(s?.text)S(v=>v?v+" "+s.text:s.text);else if(s?.warning)V(o.voiceEmptyText);else if(!s){let v=i.getState().lastError;if(v){let B=v.message?.toLowerCase()??"";B.includes("denied")||B.includes("permission")||B.includes("not allowed")?V(o.voiceDeniedText):V(o.voiceErrorText);}}},[e.voiceRecording,i,o]),Bt=dt(t.config.ui?.triggerStyle);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Bt,{position:l,onClick:()=>r(),isVisible:e.phase==="idle",label:t.config.ui?.triggerLabel??o.triggerLabel,queueCount:Tt,showSuccess:St}),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:()=>a()}),M&&jsxRuntime.jsx(Fo,{rect:M}),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:()=>a(),"aria-label":o.cancelButton,children:o.cancelButton})]}),be&&Z&&jsxRuntime.jsxs("div",{ref:kt,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:E,"aria-label":o.rePickButton,children:o.rePickButton}),jsxRuntime.jsx("button",{type:"button",className:"bf-btn",onClick:()=>a(),disabled:E,"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:s=>S(s.target.value),onKeyDown:Ct,disabled:E,"aria-label":o.panelTitle}),pe.length>0&&jsxRuntime.jsx("div",{className:"bf-pills",role:"group","aria-label":"Feedback category",children:pe.map(s=>jsxRuntime.jsx("button",{type:"button",className:`bf-pill${D===s?" bf-pill-active":""}`,onClick:()=>fe(D===s?void 0:s),disabled:E,children:o[Wo[s]]},s))}),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:s=>T(s.target.checked),disabled:E}),o.screenshotElement]}),jsxRuntime.jsxs("label",{children:[jsxRuntime.jsx("input",{type:"checkbox",checked:m,onChange:s=>C(s.target.checked),disabled:E}),o.screenshotFullPage]})]}),ht&&e.phase==="review"&&!e.voiceTranscribing&&jsxRuntime.jsx("button",{type:"button",className:`bf-voice-btn${e.voiceRecording?" bf-voice-btn-active":""}`,onClick:Pt,disabled:E,"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(xt)," \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]}),xe&&!e.voiceRecording&&!e.voiceTranscribing&&jsxRuntime.jsx("div",{className:"bf-error",role:"alert",children:xe}),gt&&e.phase==="review"&&!e.video&&jsxRuntime.jsxs("button",{type:"button",className:"bf-record-btn",onClick:()=>i.startRecording(),disabled:E,"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:()=>i.removeVideo(),"aria-label":o.removeVideoButton,children:"\xD7"}),jsxRuntime.jsxs("div",{className:"bf-video-meta",children:[o.videoPreviewLabel," (",X(e.video.durationMs),", ",_o(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"&&he&&jsxRuntime.jsx("div",{className:"bf-error",role:"alert",children:he}),jsxRuntime.jsxs("div",{className:"bf-actions",children:[jsxRuntime.jsx("button",{type:"button",className:"bf-btn",onClick:()=>a(),disabled:E,"aria-label":o.cancelButton,children:o.cancelButton}),jsxRuntime.jsx("button",{type:"button",className:"bf-btn bf-btnPrimary",onClick:ee,disabled:E||f.trim().length===0,"aria-label":o.sendButton,children:o.sendButton})]})]}),c&&jsxRuntime.jsxs("div",{className:"bf-watermark",children:[(()=>{let s=chunkNLL5DECC_cjs.q();return s?jsxRuntime.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"bf-my-feedback-link",children:"View my feedback"}):null})(),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(mt)]}),jsxRuntime.jsx("button",{type:"button",className:"bf-recording-bar-stop",onClick:()=>i.stopRecording(),"aria-label":o.stopRecordButton,children:o.stopRecordButton})]}),e.phase==="success"&&jsxRuntime.jsxs("div",{className:"bf-toast",role:"status","aria-live":"polite",children:[o.toastText,(()=>{let s=chunkNLL5DECC_cjs.q();return s?jsxRuntime.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"bf-toast-link",children:"View my feedback"}):null})()]}),J>0&&!vt&&jsxRuntime.jsxs("div",{className:"bf-security-banner",role:"alert",children:[jsxRuntime.jsx("button",{type:"button",className:"bf-security-banner-dismiss",onClick:()=>yt(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 Oo=react.forwardRef(function(e,i){let r={...e.config??{},blocfeed_id:e.blocfeed_id},[a,p]=react.useState(null),n=zo(r.ui?.showOn),l=Io(r.ui?.theme?.mode),o=!!r.diagnostics;react.useEffect(()=>{if(o)return chunkNLL5DECC_cjs.u(r.diagnostics),()=>chunkNLL5DECC_cjs.v()},[o]);let c=!!r.security;react.useEffect(()=>{c&&chunkNLL5DECC_cjs.y(r.security);},[c]);let x=react.useRef(e.config?.metadata?.enrich);x.current=e.config?.metadata?.enrich;let z=react.useMemo(()=>{if(e.config)return {...e.config,metadata:{...e.config.metadata,enrich:async f=>{let S=x.current,b=S?await S(f):{},T=chunkNLL5DECC_cjs.w(),m=chunkNLL5DECC_cjs.z(),C=chunkNLL5DECC_cjs.j();return {...b,...T.consoleLogs.length>0?{_consoleLogs:T.consoleLogs}:{},...T.networkErrors.length>0?{_networkErrors:T.networkErrors}:{},...m.findings.length>0?{_securityFindings:m.findings}:{},...C.length>0?{_clickEvents:C}:{}}}}}},[]);return react.useEffect(()=>{Me();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;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));let T=C=>C.stopPropagation(),m=["pointerdown","pointerup","mousedown","mouseup","click","touchstart","touchend"];for(let C of m)f.addEventListener(C,T);try{document.body.appendChild(f);}catch{return}return p(f),()=>{for(let C of m)f.removeEventListener(C,T);f.remove(),p(null);}},[r.ui?.zIndex,r.ui?.theme?.accentColor,r.ui?.theme?.panelBackground,r.ui?.theme?.panelForeground,r.ui?.theme?.fontFamily,l]),!n||!a?null:reactDom.createPortal(jsxRuntime.jsx(ie,{blocfeed_id:r.blocfeed_id,...z?{config:z}:{},children:jsxRuntime.jsx(Ho,{config:r,handleRef:i})}),a)});
|
|
885
|
+
Object.defineProperty(exports,"BehavioralTracker",{enumerable:true,get:function(){return chunkNLL5DECC_cjs.s}});exports.BlocFeedProvider=ie;exports.BlocFeedWidget=Oo;exports.useBlocFeed=ae;
|
package/dist/main.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as BlocFeedConfig, a as BlocFeedHandle, b as BlocFeedState, c as BlocFeedController, C as CaptureConfig, F as FeedbackCategory, S as SubmitResult } from './controller-
|
|
2
|
-
export {
|
|
1
|
+
import { B as BlocFeedConfig, a as BlocFeedHandle, b as BlocFeedState, c as BlocFeedController, C as CaptureConfig, F as FeedbackCategory, S as SubmitResult, d as BehavioralEvent, e as BehavioralConfig } from './controller-6fm9oK63.cjs';
|
|
2
|
+
export { f as BehavioralEventType, g as BlocFeedError, h as BlocFeedStrings, i as BlocFeedUser, j as CaptureDiagnostics, k as CaptureResult, l as ConsoleEntry, D as DiagnosticsConfig, E as ElementDescriptor, m as FeedbackApiResponse, n as FeedbackPayload, I as ImageAsset, M as MaybePromise, o as MetadataConfig, p as MetadataContext, N as NetworkEntry, P as PickerConfig, R as RecordingConfig, q as Rect, r as ScreenshotAdapter, s as ScreenshotAdapterOptions, t as ScreenshotIntent, u as ScreenshotMime, v as SecurityConfig, w as SecurityFinding, x as SecuritySnapshot, y as SessionPhase, T as ThemeConfig, z as TransportConfig, A as TransportResult, G as TriggerStyle, V as VideoAsset, H as VideoIntent, J as VideoMime, K as VoiceConfig, W as WidgetPosition } from './controller-6fm9oK63.cjs';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import * as react from 'react';
|
|
5
5
|
import { ReactNode } from 'react';
|
|
@@ -33,4 +33,31 @@ type BlocFeedApi = {
|
|
|
33
33
|
};
|
|
34
34
|
declare function useBlocFeed(): BlocFeedApi;
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
interface Submitter {
|
|
37
|
+
enqueue(event: BehavioralEvent): void;
|
|
38
|
+
flush(): Promise<void>;
|
|
39
|
+
flushBeacon(): void;
|
|
40
|
+
size(): number;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface TrackerOpts {
|
|
44
|
+
blocfeedId: string;
|
|
45
|
+
endpoint?: string;
|
|
46
|
+
config?: BehavioralConfig;
|
|
47
|
+
submitter?: Submitter;
|
|
48
|
+
passiveSampler?: () => boolean;
|
|
49
|
+
}
|
|
50
|
+
declare class BehavioralTracker {
|
|
51
|
+
private readonly opts;
|
|
52
|
+
private readonly resolved;
|
|
53
|
+
private submitter;
|
|
54
|
+
private detectorUninstallers;
|
|
55
|
+
private flushTimer;
|
|
56
|
+
private pageHideHandler;
|
|
57
|
+
private installed;
|
|
58
|
+
constructor(opts: TrackerOpts);
|
|
59
|
+
install(): void;
|
|
60
|
+
uninstall(): void;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export { BehavioralConfig, BehavioralEvent, BehavioralTracker, type BlocFeedApi, BlocFeedConfig, BlocFeedHandle, BlocFeedProvider, BlocFeedState, BlocFeedWidget, CaptureConfig, FeedbackCategory, SubmitResult, useBlocFeed };
|
package/dist/main.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as BlocFeedConfig, a as BlocFeedHandle, b as BlocFeedState, c as BlocFeedController, C as CaptureConfig, F as FeedbackCategory, S as SubmitResult } from './controller-
|
|
2
|
-
export {
|
|
1
|
+
import { B as BlocFeedConfig, a as BlocFeedHandle, b as BlocFeedState, c as BlocFeedController, C as CaptureConfig, F as FeedbackCategory, S as SubmitResult, d as BehavioralEvent, e as BehavioralConfig } from './controller-6fm9oK63.js';
|
|
2
|
+
export { f as BehavioralEventType, g as BlocFeedError, h as BlocFeedStrings, i as BlocFeedUser, j as CaptureDiagnostics, k as CaptureResult, l as ConsoleEntry, D as DiagnosticsConfig, E as ElementDescriptor, m as FeedbackApiResponse, n as FeedbackPayload, I as ImageAsset, M as MaybePromise, o as MetadataConfig, p as MetadataContext, N as NetworkEntry, P as PickerConfig, R as RecordingConfig, q as Rect, r as ScreenshotAdapter, s as ScreenshotAdapterOptions, t as ScreenshotIntent, u as ScreenshotMime, v as SecurityConfig, w as SecurityFinding, x as SecuritySnapshot, y as SessionPhase, T as ThemeConfig, z as TransportConfig, A as TransportResult, G as TriggerStyle, V as VideoAsset, H as VideoIntent, J as VideoMime, K as VoiceConfig, W as WidgetPosition } from './controller-6fm9oK63.js';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import * as react from 'react';
|
|
5
5
|
import { ReactNode } from 'react';
|
|
@@ -33,4 +33,31 @@ type BlocFeedApi = {
|
|
|
33
33
|
};
|
|
34
34
|
declare function useBlocFeed(): BlocFeedApi;
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
interface Submitter {
|
|
37
|
+
enqueue(event: BehavioralEvent): void;
|
|
38
|
+
flush(): Promise<void>;
|
|
39
|
+
flushBeacon(): void;
|
|
40
|
+
size(): number;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface TrackerOpts {
|
|
44
|
+
blocfeedId: string;
|
|
45
|
+
endpoint?: string;
|
|
46
|
+
config?: BehavioralConfig;
|
|
47
|
+
submitter?: Submitter;
|
|
48
|
+
passiveSampler?: () => boolean;
|
|
49
|
+
}
|
|
50
|
+
declare class BehavioralTracker {
|
|
51
|
+
private readonly opts;
|
|
52
|
+
private readonly resolved;
|
|
53
|
+
private submitter;
|
|
54
|
+
private detectorUninstallers;
|
|
55
|
+
private flushTimer;
|
|
56
|
+
private pageHideHandler;
|
|
57
|
+
private installed;
|
|
58
|
+
constructor(opts: TrackerOpts);
|
|
59
|
+
install(): void;
|
|
60
|
+
uninstall(): void;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export { BehavioralConfig, BehavioralEvent, BehavioralTracker, type BlocFeedApi, BlocFeedConfig, BlocFeedHandle, BlocFeedProvider, BlocFeedState, BlocFeedWidget, CaptureConfig, FeedbackCategory, SubmitResult, useBlocFeed };
|
package/dist/main.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import {u,v,y as y$1,w,z,j,a,t,l,n,i,q,b}from'./chunk-CYITSKBK.js';export{s as BehavioralTracker}from'./chunk-CYITSKBK.js';import {createContext,forwardRef,useState,useEffect,useRef,useMemo,useImperativeHandle,useCallback,useContext}from'react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {createPortal}from'react-dom';import {AnimatePresence,motion}from'framer-motion';var Y=createContext(null);function ie(t$1){let e=useMemo(()=>t({...t$1.config??{},blocfeed_id:t$1.blocfeed_id}),[]),[i,r]=useState(()=>e.getState());return useEffect(()=>e.subscribe(r),[e]),useEffect(()=>e.setConfig({...t$1.config??{},blocfeed_id:t$1.blocfeed_id}),[e,t$1.config,t$1.blocfeed_id]),useEffect(()=>()=>e.destroy(),[e]),jsx(Y.Provider,{value:{controller:e,state:i},children:t$1.children})}var Re="blocfeed-styles-v1",It=`
|
|
3
3
|
:where([data-blocfeed-ui-root]),
|
|
4
4
|
:where([data-blocfeed-ui-root]) * {
|
|
5
5
|
box-sizing: border-box;
|
|
@@ -881,5 +881,5 @@ import {t,u,x,v,y as y$1,j,a,s,l,n,i,q,b}from'./chunk-PUVKSWVE.js';import {creat
|
|
|
881
881
|
animation: none;
|
|
882
882
|
}
|
|
883
883
|
}
|
|
884
|
-
`;function Me(){if(!a()||document.getElementById(Re))return;let t=document.createElement("style");t.id=Re,t.textContent=zt,document.head.appendChild(t);}var Le={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 ze(t){return t?{...Le,...t}:Le}function ae(){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 y(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 Ie({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 Ae({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 _e({position:t,onClick:e,isVisible:i,label:r,queueCount:a,showSuccess:p}){return i?jsxs("button",{className:y(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]}),a>0&&jsx("span",{className:"bf-badge","aria-label":`${a} queued`,children:a})]}):null}function h(){let[t,e]=useState(()=>typeof window>"u"?false:window.matchMedia("(prefers-reduced-motion: reduce)").matches);return useEffect(()=>{let i=window.matchMedia("(prefers-reduced-motion: reduce)"),r=a=>e(a.matches);return i.addEventListener("change",r),()=>i.removeEventListener("change",r)},[]),t}var Dt={duration:.18,ease:"easeOut"},Vt={duration:0};function Oe({position:t,onClick:e,isVisible:i,label:r,queueCount:a,showSuccess:p}){let[n,l]=useState(false),o=h(),c=o?Vt:Dt;return jsx(AnimatePresence,{mode:"wait",children:i&&jsx(motion.button,{className:y(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:c,whileTap:{scale:.92},style:{overflow:"hidden"},children:p?jsx(motion.span,{initial:{scale:0},animate:{scale:1},transition:c,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?c:{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:c,style:{whiteSpace:"nowrap"},children:r},"label")}),a>0&&jsx("span",{className:"bf-badge","aria-label":`${a} queued`,children:a})]})},"dot")})}var Xt={duration:.18,ease:"easeOut"},Ve={duration:0};function Ke({position:t,onClick:e,isVisible:i,label:r,queueCount:a,showSuccess:p}){let[n,l]=useState(false),o=h(),c=o?Ve:Xt;return jsx(AnimatePresence,{mode:"wait",children:i&&jsxs(motion.div,{className:y(t),initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{y:8,opacity:0},transition:c,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:c,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?Ve:{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:c,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsx(g,{size:16})},"success"):jsx(Ie,{size:16}),a>0&&jsx("span",{className:"bf-badge bf-badge-float","aria-label":`${a} queued`,children:a})]})]},"bubble")})}var jt={duration:.2,ease:"easeOut"},Qt={duration:0};function Xe(t){return t==="bottom-left"||t==="top-left"}function qt(t){return `bf-trigger-edge ${Xe(t)?"bf-trigger-edge-left":"bf-trigger-edge-right"}`}function Ye({position:t,onClick:e,isVisible:i,label:r,queueCount:a,showSuccess:p}){let[n,l]=useState(false),o=Xe(t),c=h(),x=c?Qt:jt;return jsx(AnimatePresence,{mode:"wait",children:i&&jsx(motion.button,{className:qt(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:x,whileTap:{scale:.97},style:{top:"50%",translateY:"-50%"},children:p?jsx(motion.span,{initial:{scale:0},animate:{scale:1},transition:x,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsx(g,{size:14})},"success"):jsxs(Fragment,{children:[jsxs(motion.span,{animate:{rotate:c||n?0:o?-90:90,opacity:n?1:.6},transition:x,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)"}}),a>0&&jsx("span",{className:"bf-badge","aria-label":`${a} queued`,children:a})]})},"edge-tab")})}var eo={duration:.18,ease:"easeOut"},to={duration:0};function je({delay:t,hovered:e,reduced:i}){return i?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 qe({position:t,onClick:e,isVisible:i,label:r,queueCount:a,showSuccess:p}){let[n,l]=useState(false),o=h(),c=o?to:eo;return jsx(AnimatePresence,{mode:"wait",children:i&&jsx(motion.button,{className:y(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:c,whileTap:{scale:.92},style:{overflow:"hidden"},children:p?jsx(motion.span,{initial:{scale:0},animate:{scale:1},transition:c,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(je,{delay:0,hovered:n,reduced:o}),jsx(je,{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:c,style:{whiteSpace:"nowrap"},children:r},"label")}),a>0&&jsx("span",{className:"bf-badge","aria-label":`${a} queued`,children:a})]})},"pulse-ring")})}var ao={duration:.18,ease:"easeOut"},no={duration:0};function so(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 et({position:t,onClick:e,isVisible:i,label:r,queueCount:a,showSuccess:p}){let[n,l]=useState(false),o=h(),c=o?no:ao;return jsx(AnimatePresence,{mode:"wait",children:i&&jsxs(motion.button,{className:so(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:c,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}),a>0&&jsx("span",{className:"bf-badge",style:{marginLeft:"4px"},"aria-label":`${a} queued`,children:a})]}),!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:c})]},"minimal")})}var fo={duration:.18,ease:"easeOut"},po={duration:0};function ot({position:t,onClick:e,isVisible:i,label:r,queueCount:a,showSuccess:p}){let[n,l]=useState(false),o=h(),c=o?po:fo;return jsx(AnimatePresence,{mode:"wait",children:i&&jsx(motion.button,{className:y(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:c,whileTap:{scale:.9},style:{overflow:"hidden"},children:p?jsx(motion.span,{initial:{scale:0},animate:{scale:1},transition:c,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?c:{duration:3,repeat:1/0,ease:"easeInOut"},children:jsx(Ae,{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:c,style:{whiteSpace:"nowrap"},children:r},"label")}),a>0&&jsx("span",{className:"bf-badge","aria-label":`${a} queued`,children:a})]})},"icon-pop")})}var mo={duration:.18,ease:"easeOut"},ho={duration:0};function at({position:t,onClick:e,isVisible:i,label:r,queueCount:a,showSuccess:p}){let[n,l]=useState(false),o=h(),c=o?ho:mo;return jsx(AnimatePresence,{mode:"wait",children:i&&jsx(motion.button,{className:y(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:c,whileTap:{scale:.92},style:{overflow:"hidden"},children:p?jsx(motion.span,{initial:{scale:0},animate:{scale:1},transition:c,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?c:{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:c,style:{whiteSpace:"nowrap"},children:r},"label")}),a>0&&jsx("span",{className:"bf-badge","aria-label":`${a} queued`,children:a})]})},"beacon")})}var ko={duration:.18,ease:"easeOut"},To={duration:0};function lt({position:t,onClick:e,isVisible:i,label:r,queueCount:a,showSuccess:p}){let[n,l]=useState(false),[o,c]=useState(0),x=h(),z=x?To:ko,f=useRef(null);useEffect(()=>{if(f.current&&(clearInterval(f.current),f.current=null),!i||n||x){c(n||x?r.length:0);return}let b=8,T=r.length*2+b*2,m=0;return f.current=setInterval(()=>{m=(m+1)%T,m<=r.length?c(m):m<=r.length+b?c(r.length):m<=r.length*2+b?c(r.length*2+b-m):c(0);},100),()=>{f.current&&(clearInterval(f.current),f.current=null);}},[i,n,x,r]);let S=r.slice(0,o);return jsx(AnimatePresence,{mode:"wait",children:i&&jsx(motion.button,{className:y(t),type:"button",onClick:e,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":r,initial:{opacity:0,y:x?0:5},animate:{opacity:1,y:0},exit:{opacity:0,y:x?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"})]}),a>0&&jsx("span",{className:"bf-badge","aria-label":`${a} queued`,children:a})]})},"typewriter")})}function dt(t){switch(t){case "dot":return Oe;case "bubble":return Ke;case "edge-tab":return Ye;case "pulse-ring":return qe;case "minimal":return et;case "icon-pop":return ot;case "beacon":return at;case "typewriter":return lt;default:return _e}}function ft(t,e,i){return Math.max(e,Math.min(i,t))}function Bo(t,e,i="bottom-right"){let a=window.innerWidth,p=window.innerHeight,n;n=ft(t.x,12,Math.max(12,a-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 No(t){let{rect:e}=t,i={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:i,"aria-hidden":"true"})}function Fo(t){let e=useRef(null);return useEffect(()=>{if(!t||!e.current)return;let i=e.current,r=i.querySelector(".bf-textarea");r?.focus();let a=n=>{if(n.key!=="Tab")return;let l=i.querySelectorAll('button:not([disabled]), textarea:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])');if(l.length===0)return;let o=l[0],c=l[l.length-1];n.shiftKey&&document.activeElement===o?(n.preventDefault(),c.focus()):!n.shiftKey&&document.activeElement===c&&(n.preventDefault(),o.focus());},p=n=>{let l=n.target;l&&(i.contains(l)||(n.stopImmediatePropagation(),r?.focus()));};return document.addEventListener("keydown",a,{capture:true}),document.addEventListener("focusin",p,{capture:true}),()=>{document.removeEventListener("keydown",a,{capture:true}),document.removeEventListener("focusin",p,{capture:true});}},[t]),e}function Ro(t,e){return t?typeof t=="function"?t(e):t.some(i=>i.endsWith("*")?e.startsWith(i.slice(0,-1)):e===i):true}var ce=new Set,pt=false;function Mo(){if(pt||typeof window>"u")return;pt=true;let t=history.pushState,e=history.replaceState,i=()=>{for(let r of ce)r();};history.pushState=function(...r){t.apply(this,r),setTimeout(i,0);},history.replaceState=function(...r){e.apply(this,r),setTimeout(i,0);};}function Lo(t){let[e,i]=useState(()=>typeof window<"u"?window.location.pathname:"/");return useEffect(()=>{if(typeof window>"u")return;let r=()=>i(window.location.pathname);return window.addEventListener("popstate",r),Mo(),ce.add(r),()=>{window.removeEventListener("popstate",r),ce.delete(r);}},[]),Ro(t,e)}function zo(t){let[e,i]=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"){i(t==="light"?"light":"dark");return}let r=window.matchMedia("(prefers-color-scheme: dark)"),a=p=>i(p.matches?"dark":"light");return i(r.matches?"dark":"light"),r.addEventListener("change",a),()=>r.removeEventListener("change",a)},[t]),e}var Io=["bug","feature","ux","general"],Ao={bug:"categoryBug",feature:"categoryFeature",ux:"categoryUx",general:"categoryGeneral"};function X(t){let e=Math.floor(t/1e3),i=Math.floor(e/60),r=e%60;return `${i}:${String(r).padStart(2,"0")}`}function Wo(t){return t<1024*1024?`${Math.round(t/1024)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function _o(t){let{state:e,controller:i$1,start:r,stop:a,clearSelection:p,submit:n$1}=ae(),l$1=t.config.ui?.position,o=ze(t.config.ui?.strings),c=t.config.ui?.branding!==false,[x,z]=useState(null),[f,S]=useState(""),[b$1,T]=useState(t.config.capture?.element??true),[m,C]=useState(t.config.capture?.fullPage??false),[bt,de]=useState(null),[D,fe]=useState(void 0),pe=t.config.ui?.categories??Io,gt=t.config.recording?.enabled===true&&l(),mt=t.config.recording?.maxDurationMs??3e4,ue=i$1.getConfig().voice,ht=ue?.enabled===true&&n(),xt=ue?.maxDurationMs??6e4,[vt,yt]=useState(false),[J,wt]=useState(0);useEffect(()=>{let s=window.setTimeout(()=>{let v=y$1();wt(v.findings.length);},500);return ()=>window.clearTimeout(s)},[]),useImperativeHandle(t.handleRef,()=>({open:r,close:a,submit:s=>n$1(s),startRecording:()=>i$1.startRecording(),stopRecording:()=>i$1.stopRecording(),get isOpen(){return e.phase!=="idle"}}),[r,a,n$1,i$1,e.phase]);let be=e.phase==="review"||e.phase==="capturing"||e.phase==="submitting"||e.phase==="error"||e.phase==="success",kt=Fo(be),[Tt,Et]=useState(0);useEffect(()=>{e.phase==="idle"&&Et(i());},[e.phase]);let[St,ge]=useState(false),me=useRef(e.phase);useEffect(()=>{if(me.current==="success"&&e.phase==="idle"){ge(true);let s=window.setTimeout(()=>ge(false),1500);return ()=>window.clearTimeout(s)}me.current=e.phase;},[e.phase]),useEffect(()=>{let s=t.config.ui?.shortcut;if(!s)return;let v=s.toLowerCase().split("+").map(N=>N.trim()),B=v[v.length-1]||"",I=new Set(v.slice(0,-1)),ve=N=>{let Nt=/Mac|iPod|iPhone|iPad/.test(navigator.platform);if(I.has("mod")){if(Nt?!N.metaKey:!N.ctrlKey)return}else if(I.has("ctrl")&&!N.ctrlKey||(I.has("meta")||I.has("cmd"))&&!N.metaKey)return;I.has("shift")&&!N.shiftKey||(I.has("alt")||I.has("option"))&&!N.altKey||N.key.toLowerCase()===B&&(N.preventDefault(),e.phase==="idle"?r():a());};return document.addEventListener("keydown",ve),()=>document.removeEventListener("keydown",ve)},[t.config.ui?.shortcut,e.phase,r,a]),useEffect(()=>i$1.subscribeHover(z),[i$1]),useEffect(()=>{let s=i$1.__unsafeGetSelectedElement();if(!s||e.phase==="idle"||e.phase==="picking"){de(null);return}let v=()=>{de(b(s.getBoundingClientRect()));};v();let B=()=>v();return window.addEventListener("scroll",B,{capture:true,passive:true}),window.addEventListener("resize",B,{passive:true}),()=>{window.removeEventListener("scroll",B,{capture:true}),window.removeEventListener("resize",B);}},[i$1,e.phase,e.selection?.selector]),useEffect(()=>{e.phase==="review"&&(S(""),T(t.config.capture?.element??true),C(t.config.capture?.fullPage??false),fe(void 0),V(null));},[e.phase,e.selection?.selector,t.config.capture?.element,t.config.capture?.fullPage]),useEffect(()=>{if(e.phase!=="success")return;let s=window.setTimeout(()=>a(),1200);return ()=>window.clearTimeout(s)},[e.phase,a]);let E=e.phase==="capturing"||e.phase==="submitting",M=e.phase==="picking"?x?.rect??null:bt??e.selection?.rect??null,Z=useMemo(()=>M?Bo(M,360,l$1):null,[M?.x,M?.y,M?.width,M?.height,l$1]),he=e.lastError?.message,ee=useCallback(()=>{let s={capture:{element:b$1,fullPage:m}};D&&(s.category=D),n$1(f,s);},[n$1,f,b$1,m,D]),Ct=useCallback(s=>{(s.metaKey||s.ctrlKey)&&s.key==="Enter"&&f.trim().length>0&&!E&&(s.preventDefault(),ee());},[ee,f,E]),[xe,V]=useState(null),Pt=useCallback(async()=>{if(e.voiceRecording){i$1.stopVoice();return}V(null);let s=await i$1.startVoice();if(s?.text)S(v=>v?v+" "+s.text:s.text);else if(s?.warning)V(o.voiceEmptyText);else if(!s){let v=i$1.getState().lastError;if(v){let B=v.message?.toLowerCase()??"";B.includes("denied")||B.includes("permission")||B.includes("not allowed")?V(o.voiceDeniedText):V(o.voiceErrorText);}}},[e.voiceRecording,i$1,o]),Bt=dt(t.config.ui?.triggerStyle);return jsxs(Fragment,{children:[jsx(Bt,{position:l$1,onClick:()=>r(),isVisible:e.phase==="idle",label:t.config.ui?.triggerLabel??o.triggerLabel,queueCount:Tt,showSuccess:St}),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:()=>a()}),M&&jsx(No,{rect:M}),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:()=>a(),"aria-label":o.cancelButton,children:o.cancelButton})]}),be&&Z&&jsxs("div",{ref:kt,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:E,"aria-label":o.rePickButton,children:o.rePickButton}),jsx("button",{type:"button",className:"bf-btn",onClick:()=>a(),disabled:E,"aria-label":o.closeButton,children:o.closeButton})]})]}),jsxs("div",{className:"bf-panelBody",children:[jsx("textarea",{className:"bf-textarea",placeholder:o.textareaPlaceholder,value:f,onChange:s=>S(s.target.value),onKeyDown:Ct,disabled:E,"aria-label":o.panelTitle}),pe.length>0&&jsx("div",{className:"bf-pills",role:"group","aria-label":"Feedback category",children:pe.map(s=>jsx("button",{type:"button",className:`bf-pill${D===s?" bf-pill-active":""}`,onClick:()=>fe(D===s?void 0:s),disabled:E,children:o[Ao[s]]},s))}),jsxs("div",{className:"bf-row",role:"group","aria-label":o.screenshotElement,children:[jsxs("label",{children:[jsx("input",{type:"checkbox",checked:b$1,onChange:s=>T(s.target.checked),disabled:E}),o.screenshotElement]}),jsxs("label",{children:[jsx("input",{type:"checkbox",checked:m,onChange:s=>C(s.target.checked),disabled:E}),o.screenshotFullPage]})]}),ht&&e.phase==="review"&&!e.voiceTranscribing&&jsx("button",{type:"button",className:`bf-voice-btn${e.voiceRecording?" bf-voice-btn-active":""}`,onClick:Pt,disabled:E,"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(xt)," \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]}),xe&&!e.voiceRecording&&!e.voiceTranscribing&&jsx("div",{className:"bf-error",role:"alert",children:xe}),gt&&e.phase==="review"&&!e.video&&jsxs("button",{type:"button",className:"bf-record-btn",onClick:()=>i$1.startRecording(),disabled:E,"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:()=>i$1.removeVideo(),"aria-label":o.removeVideoButton,children:"\xD7"}),jsxs("div",{className:"bf-video-meta",children:[o.videoPreviewLabel," (",X(e.video.durationMs),", ",Wo(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"&&he&&jsx("div",{className:"bf-error",role:"alert",children:he}),jsxs("div",{className:"bf-actions",children:[jsx("button",{type:"button",className:"bf-btn",onClick:()=>a(),disabled:E,"aria-label":o.cancelButton,children:o.cancelButton}),jsx("button",{type:"button",className:"bf-btn bf-btnPrimary",onClick:ee,disabled:E||f.trim().length===0,"aria-label":o.sendButton,children:o.sendButton})]})]}),c&&jsxs("div",{className:"bf-watermark",children:[(()=>{let s=q();return s?jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"bf-my-feedback-link",children:"View my feedback"}):null})(),jsx("a",{href:"https://blocfeed.com",target:"_blank",rel:"noopener noreferrer",children:"Powered by BlocFeed"})]})]})]}),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(mt)]}),jsx("button",{type:"button",className:"bf-recording-bar-stop",onClick:()=>i$1.stopRecording(),"aria-label":o.stopRecordButton,children:o.stopRecordButton})]}),e.phase==="success"&&jsxs("div",{className:"bf-toast",role:"status","aria-live":"polite",children:[o.toastText,(()=>{let s=q();return s?jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"bf-toast-link",children:"View my feedback"}):null})()]}),J>0&&!vt&&jsxs("div",{className:"bf-security-banner",role:"alert",children:[jsx("button",{type:"button",className:"bf-security-banner-dismiss",onClick:()=>yt(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 Ho=forwardRef(function(e,i){let r={...e.config??{},blocfeed_id:e.blocfeed_id},[a,p]=useState(null),n=Lo(r.ui?.showOn),l=zo(r.ui?.theme?.mode),o=!!r.diagnostics;useEffect(()=>{if(o)return t(r.diagnostics),()=>u()},[o]);let c=!!r.security;useEffect(()=>{c&&x(r.security);},[c]);let x$1=useRef(e.config?.metadata?.enrich);x$1.current=e.config?.metadata?.enrich;let z=useMemo(()=>{if(e.config)return {...e.config,metadata:{...e.config.metadata,enrich:async f=>{let S=x$1.current,b=S?await S(f):{},T=v(),m=y$1(),C=j();return {...b,...T.consoleLogs.length>0?{_consoleLogs:T.consoleLogs}:{},...T.networkErrors.length>0?{_networkErrors:T.networkErrors}:{},...m.findings.length>0?{_securityFindings:m.findings}:{},...C.length>0?{_clickEvents:C}:{}}}}}},[]);return useEffect(()=>{Me();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;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));let T=C=>C.stopPropagation(),m=["pointerdown","pointerup","mousedown","mouseup","click","touchstart","touchend"];for(let C of m)f.addEventListener(C,T);try{document.body.appendChild(f);}catch{return}return p(f),()=>{for(let C of m)f.removeEventListener(C,T);f.remove(),p(null);}},[r.ui?.zIndex,r.ui?.theme?.accentColor,r.ui?.theme?.panelBackground,r.ui?.theme?.panelForeground,r.ui?.theme?.fontFamily,l]),!n||!a?null:createPortal(jsx(ie,{blocfeed_id:r.blocfeed_id,...z?{config:z}:{},children:jsx(_o,{config:r,handleRef:i})}),a)});
|
|
885
|
-
export{ie as BlocFeedProvider,
|
|
884
|
+
`;function Me(){if(!a()||document.getElementById(Re))return;let t=document.createElement("style");t.id=Re,t.textContent=It,document.head.appendChild(t);}var Le={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 ze(t){return t?{...Le,...t}:Le}function ae(){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 y(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 Ie({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 Ae({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 _e({position:t,onClick:e,isVisible:i,label:r,queueCount:a,showSuccess:p}){return i?jsxs("button",{className:y(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]}),a>0&&jsx("span",{className:"bf-badge","aria-label":`${a} queued`,children:a})]}):null}function h(){let[t,e]=useState(()=>typeof window>"u"?false:window.matchMedia("(prefers-reduced-motion: reduce)").matches);return useEffect(()=>{let i=window.matchMedia("(prefers-reduced-motion: reduce)"),r=a=>e(a.matches);return i.addEventListener("change",r),()=>i.removeEventListener("change",r)},[]),t}var Vt={duration:.18,ease:"easeOut"},$t={duration:0};function Oe({position:t,onClick:e,isVisible:i,label:r,queueCount:a,showSuccess:p}){let[n,l]=useState(false),o=h(),c=o?$t:Vt;return jsx(AnimatePresence,{mode:"wait",children:i&&jsx(motion.button,{className:y(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:c,whileTap:{scale:.92},style:{overflow:"hidden"},children:p?jsx(motion.span,{initial:{scale:0},animate:{scale:1},transition:c,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?c:{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:c,style:{whiteSpace:"nowrap"},children:r},"label")}),a>0&&jsx("span",{className:"bf-badge","aria-label":`${a} queued`,children:a})]})},"dot")})}var Yt={duration:.18,ease:"easeOut"},Ve={duration:0};function Ke({position:t,onClick:e,isVisible:i,label:r,queueCount:a,showSuccess:p}){let[n,l]=useState(false),o=h(),c=o?Ve:Yt;return jsx(AnimatePresence,{mode:"wait",children:i&&jsxs(motion.div,{className:y(t),initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{y:8,opacity:0},transition:c,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:c,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?Ve:{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:c,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsx(g,{size:16})},"success"):jsx(Ie,{size:16}),a>0&&jsx("span",{className:"bf-badge bf-badge-float","aria-label":`${a} queued`,children:a})]})]},"bubble")})}var Qt={duration:.2,ease:"easeOut"},qt={duration:0};function Xe(t){return t==="bottom-left"||t==="top-left"}function Jt(t){return `bf-trigger-edge ${Xe(t)?"bf-trigger-edge-left":"bf-trigger-edge-right"}`}function Ye({position:t,onClick:e,isVisible:i,label:r,queueCount:a,showSuccess:p}){let[n,l]=useState(false),o=Xe(t),c=h(),x=c?qt:Qt;return jsx(AnimatePresence,{mode:"wait",children:i&&jsx(motion.button,{className:Jt(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:x,whileTap:{scale:.97},style:{top:"50%",translateY:"-50%"},children:p?jsx(motion.span,{initial:{scale:0},animate:{scale:1},transition:x,style:{display:"inline-flex",color:"var(--bf-accent)"},children:jsx(g,{size:14})},"success"):jsxs(Fragment,{children:[jsxs(motion.span,{animate:{rotate:c||n?0:o?-90:90,opacity:n?1:.6},transition:x,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)"}}),a>0&&jsx("span",{className:"bf-badge","aria-label":`${a} queued`,children:a})]})},"edge-tab")})}var to={duration:.18,ease:"easeOut"},oo={duration:0};function je({delay:t,hovered:e,reduced:i}){return i?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 qe({position:t,onClick:e,isVisible:i,label:r,queueCount:a,showSuccess:p}){let[n,l]=useState(false),o=h(),c=o?oo:to;return jsx(AnimatePresence,{mode:"wait",children:i&&jsx(motion.button,{className:y(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:c,whileTap:{scale:.92},style:{overflow:"hidden"},children:p?jsx(motion.span,{initial:{scale:0},animate:{scale:1},transition:c,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(je,{delay:0,hovered:n,reduced:o}),jsx(je,{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:c,style:{whiteSpace:"nowrap"},children:r},"label")}),a>0&&jsx("span",{className:"bf-badge","aria-label":`${a} queued`,children:a})]})},"pulse-ring")})}var no={duration:.18,ease:"easeOut"},so={duration:0};function co(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 et({position:t,onClick:e,isVisible:i,label:r,queueCount:a,showSuccess:p}){let[n,l]=useState(false),o=h(),c=o?so:no;return jsx(AnimatePresence,{mode:"wait",children:i&&jsxs(motion.button,{className:co(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:c,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}),a>0&&jsx("span",{className:"bf-badge",style:{marginLeft:"4px"},"aria-label":`${a} queued`,children:a})]}),!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:c})]},"minimal")})}var po={duration:.18,ease:"easeOut"},uo={duration:0};function ot({position:t,onClick:e,isVisible:i,label:r,queueCount:a,showSuccess:p}){let[n,l]=useState(false),o=h(),c=o?uo:po;return jsx(AnimatePresence,{mode:"wait",children:i&&jsx(motion.button,{className:y(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:c,whileTap:{scale:.9},style:{overflow:"hidden"},children:p?jsx(motion.span,{initial:{scale:0},animate:{scale:1},transition:c,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?c:{duration:3,repeat:1/0,ease:"easeInOut"},children:jsx(Ae,{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:c,style:{whiteSpace:"nowrap"},children:r},"label")}),a>0&&jsx("span",{className:"bf-badge","aria-label":`${a} queued`,children:a})]})},"icon-pop")})}var ho={duration:.18,ease:"easeOut"},xo={duration:0};function at({position:t,onClick:e,isVisible:i,label:r,queueCount:a,showSuccess:p}){let[n,l]=useState(false),o=h(),c=o?xo:ho;return jsx(AnimatePresence,{mode:"wait",children:i&&jsx(motion.button,{className:y(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:c,whileTap:{scale:.92},style:{overflow:"hidden"},children:p?jsx(motion.span,{initial:{scale:0},animate:{scale:1},transition:c,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?c:{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:c,style:{whiteSpace:"nowrap"},children:r},"label")}),a>0&&jsx("span",{className:"bf-badge","aria-label":`${a} queued`,children:a})]})},"beacon")})}var To={duration:.18,ease:"easeOut"},Eo={duration:0};function lt({position:t,onClick:e,isVisible:i,label:r,queueCount:a,showSuccess:p}){let[n,l]=useState(false),[o,c]=useState(0),x=h(),z=x?Eo:To,f=useRef(null);useEffect(()=>{if(f.current&&(clearInterval(f.current),f.current=null),!i||n||x){c(n||x?r.length:0);return}let b=8,T=r.length*2+b*2,m=0;return f.current=setInterval(()=>{m=(m+1)%T,m<=r.length?c(m):m<=r.length+b?c(r.length):m<=r.length*2+b?c(r.length*2+b-m):c(0);},100),()=>{f.current&&(clearInterval(f.current),f.current=null);}},[i,n,x,r]);let S=r.slice(0,o);return jsx(AnimatePresence,{mode:"wait",children:i&&jsx(motion.button,{className:y(t),type:"button",onClick:e,onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),"aria-label":r,initial:{opacity:0,y:x?0:5},animate:{opacity:1,y:0},exit:{opacity:0,y:x?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"})]}),a>0&&jsx("span",{className:"bf-badge","aria-label":`${a} queued`,children:a})]})},"typewriter")})}function dt(t){switch(t){case "dot":return Oe;case "bubble":return Ke;case "edge-tab":return Ye;case "pulse-ring":return qe;case "minimal":return et;case "icon-pop":return ot;case "beacon":return at;case "typewriter":return lt;default:return _e}}function ft(t,e,i){return Math.max(e,Math.min(i,t))}function No(t,e,i="bottom-right"){let a=window.innerWidth,p=window.innerHeight,n;n=ft(t.x,12,Math.max(12,a-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 Fo(t){let{rect:e}=t,i={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:i,"aria-hidden":"true"})}function Ro(t){let e=useRef(null);return useEffect(()=>{if(!t||!e.current)return;let i=e.current,r=i.querySelector(".bf-textarea");r?.focus();let a=n=>{if(n.key!=="Tab")return;let l=i.querySelectorAll('button:not([disabled]), textarea:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])');if(l.length===0)return;let o=l[0],c=l[l.length-1];n.shiftKey&&document.activeElement===o?(n.preventDefault(),c.focus()):!n.shiftKey&&document.activeElement===c&&(n.preventDefault(),o.focus());},p=n=>{let l=n.target;l&&(i.contains(l)||(n.stopImmediatePropagation(),r?.focus()));};return document.addEventListener("keydown",a,{capture:true}),document.addEventListener("focusin",p,{capture:true}),()=>{document.removeEventListener("keydown",a,{capture:true}),document.removeEventListener("focusin",p,{capture:true});}},[t]),e}function Mo(t,e){return t?typeof t=="function"?t(e):t.some(i=>i.endsWith("*")?e.startsWith(i.slice(0,-1)):e===i):true}var ce=new Set,pt=false;function Lo(){if(pt||typeof window>"u")return;pt=true;let t=history.pushState,e=history.replaceState,i=()=>{for(let r of ce)r();};history.pushState=function(...r){t.apply(this,r),setTimeout(i,0);},history.replaceState=function(...r){e.apply(this,r),setTimeout(i,0);};}function zo(t){let[e,i]=useState(()=>typeof window<"u"?window.location.pathname:"/");return useEffect(()=>{if(typeof window>"u")return;let r=()=>i(window.location.pathname);return window.addEventListener("popstate",r),Lo(),ce.add(r),()=>{window.removeEventListener("popstate",r),ce.delete(r);}},[]),Mo(t,e)}function Io(t){let[e,i]=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"){i(t==="light"?"light":"dark");return}let r=window.matchMedia("(prefers-color-scheme: dark)"),a=p=>i(p.matches?"dark":"light");return i(r.matches?"dark":"light"),r.addEventListener("change",a),()=>r.removeEventListener("change",a)},[t]),e}var Ao=["bug","feature","ux","general"],Wo={bug:"categoryBug",feature:"categoryFeature",ux:"categoryUx",general:"categoryGeneral"};function X(t){let e=Math.floor(t/1e3),i=Math.floor(e/60),r=e%60;return `${i}:${String(r).padStart(2,"0")}`}function _o(t){return t<1024*1024?`${Math.round(t/1024)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function Ho(t){let{state:e,controller:i$1,start:r,stop:a,clearSelection:p,submit:n$1}=ae(),l$1=t.config.ui?.position,o=ze(t.config.ui?.strings),c=t.config.ui?.branding!==false,[x,z$1]=useState(null),[f,S]=useState(""),[b$1,T]=useState(t.config.capture?.element??true),[m,C]=useState(t.config.capture?.fullPage??false),[bt,de]=useState(null),[D,fe]=useState(void 0),pe=t.config.ui?.categories??Ao,gt=t.config.recording?.enabled===true&&l(),mt=t.config.recording?.maxDurationMs??3e4,ue=i$1.getConfig().voice,ht=ue?.enabled===true&&n(),xt=ue?.maxDurationMs??6e4,[vt,yt]=useState(false),[J,wt]=useState(0);useEffect(()=>{let s=window.setTimeout(()=>{let v=z();wt(v.findings.length);},500);return ()=>window.clearTimeout(s)},[]),useImperativeHandle(t.handleRef,()=>({open:r,close:a,submit:s=>n$1(s),startRecording:()=>i$1.startRecording(),stopRecording:()=>i$1.stopRecording(),get isOpen(){return e.phase!=="idle"}}),[r,a,n$1,i$1,e.phase]);let be=e.phase==="review"||e.phase==="capturing"||e.phase==="submitting"||e.phase==="error"||e.phase==="success",kt=Ro(be),[Tt,Et]=useState(0);useEffect(()=>{e.phase==="idle"&&Et(i());},[e.phase]);let[St,ge]=useState(false),me=useRef(e.phase);useEffect(()=>{if(me.current==="success"&&e.phase==="idle"){ge(true);let s=window.setTimeout(()=>ge(false),1500);return ()=>window.clearTimeout(s)}me.current=e.phase;},[e.phase]),useEffect(()=>{let s=t.config.ui?.shortcut;if(!s)return;let v=s.toLowerCase().split("+").map(N=>N.trim()),B=v[v.length-1]||"",I=new Set(v.slice(0,-1)),ve=N=>{let Nt=/Mac|iPod|iPhone|iPad/.test(navigator.platform);if(I.has("mod")){if(Nt?!N.metaKey:!N.ctrlKey)return}else if(I.has("ctrl")&&!N.ctrlKey||(I.has("meta")||I.has("cmd"))&&!N.metaKey)return;I.has("shift")&&!N.shiftKey||(I.has("alt")||I.has("option"))&&!N.altKey||N.key.toLowerCase()===B&&(N.preventDefault(),e.phase==="idle"?r():a());};return document.addEventListener("keydown",ve),()=>document.removeEventListener("keydown",ve)},[t.config.ui?.shortcut,e.phase,r,a]),useEffect(()=>i$1.subscribeHover(z$1),[i$1]),useEffect(()=>{let s=i$1.__unsafeGetSelectedElement();if(!s||e.phase==="idle"||e.phase==="picking"){de(null);return}let v=()=>{de(b(s.getBoundingClientRect()));};v();let B=()=>v();return window.addEventListener("scroll",B,{capture:true,passive:true}),window.addEventListener("resize",B,{passive:true}),()=>{window.removeEventListener("scroll",B,{capture:true}),window.removeEventListener("resize",B);}},[i$1,e.phase,e.selection?.selector]),useEffect(()=>{e.phase==="review"&&(S(""),T(t.config.capture?.element??true),C(t.config.capture?.fullPage??false),fe(void 0),V(null));},[e.phase,e.selection?.selector,t.config.capture?.element,t.config.capture?.fullPage]),useEffect(()=>{if(e.phase!=="success")return;let s=window.setTimeout(()=>a(),1200);return ()=>window.clearTimeout(s)},[e.phase,a]);let E=e.phase==="capturing"||e.phase==="submitting",M=e.phase==="picking"?x?.rect??null:bt??e.selection?.rect??null,Z=useMemo(()=>M?No(M,360,l$1):null,[M?.x,M?.y,M?.width,M?.height,l$1]),he=e.lastError?.message,ee=useCallback(()=>{let s={capture:{element:b$1,fullPage:m}};D&&(s.category=D),n$1(f,s);},[n$1,f,b$1,m,D]),Ct=useCallback(s=>{(s.metaKey||s.ctrlKey)&&s.key==="Enter"&&f.trim().length>0&&!E&&(s.preventDefault(),ee());},[ee,f,E]),[xe,V]=useState(null),Pt=useCallback(async()=>{if(e.voiceRecording){i$1.stopVoice();return}V(null);let s=await i$1.startVoice();if(s?.text)S(v=>v?v+" "+s.text:s.text);else if(s?.warning)V(o.voiceEmptyText);else if(!s){let v=i$1.getState().lastError;if(v){let B=v.message?.toLowerCase()??"";B.includes("denied")||B.includes("permission")||B.includes("not allowed")?V(o.voiceDeniedText):V(o.voiceErrorText);}}},[e.voiceRecording,i$1,o]),Bt=dt(t.config.ui?.triggerStyle);return jsxs(Fragment,{children:[jsx(Bt,{position:l$1,onClick:()=>r(),isVisible:e.phase==="idle",label:t.config.ui?.triggerLabel??o.triggerLabel,queueCount:Tt,showSuccess:St}),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:()=>a()}),M&&jsx(Fo,{rect:M}),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:()=>a(),"aria-label":o.cancelButton,children:o.cancelButton})]}),be&&Z&&jsxs("div",{ref:kt,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:E,"aria-label":o.rePickButton,children:o.rePickButton}),jsx("button",{type:"button",className:"bf-btn",onClick:()=>a(),disabled:E,"aria-label":o.closeButton,children:o.closeButton})]})]}),jsxs("div",{className:"bf-panelBody",children:[jsx("textarea",{className:"bf-textarea",placeholder:o.textareaPlaceholder,value:f,onChange:s=>S(s.target.value),onKeyDown:Ct,disabled:E,"aria-label":o.panelTitle}),pe.length>0&&jsx("div",{className:"bf-pills",role:"group","aria-label":"Feedback category",children:pe.map(s=>jsx("button",{type:"button",className:`bf-pill${D===s?" bf-pill-active":""}`,onClick:()=>fe(D===s?void 0:s),disabled:E,children:o[Wo[s]]},s))}),jsxs("div",{className:"bf-row",role:"group","aria-label":o.screenshotElement,children:[jsxs("label",{children:[jsx("input",{type:"checkbox",checked:b$1,onChange:s=>T(s.target.checked),disabled:E}),o.screenshotElement]}),jsxs("label",{children:[jsx("input",{type:"checkbox",checked:m,onChange:s=>C(s.target.checked),disabled:E}),o.screenshotFullPage]})]}),ht&&e.phase==="review"&&!e.voiceTranscribing&&jsx("button",{type:"button",className:`bf-voice-btn${e.voiceRecording?" bf-voice-btn-active":""}`,onClick:Pt,disabled:E,"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(xt)," \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]}),xe&&!e.voiceRecording&&!e.voiceTranscribing&&jsx("div",{className:"bf-error",role:"alert",children:xe}),gt&&e.phase==="review"&&!e.video&&jsxs("button",{type:"button",className:"bf-record-btn",onClick:()=>i$1.startRecording(),disabled:E,"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:()=>i$1.removeVideo(),"aria-label":o.removeVideoButton,children:"\xD7"}),jsxs("div",{className:"bf-video-meta",children:[o.videoPreviewLabel," (",X(e.video.durationMs),", ",_o(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"&&he&&jsx("div",{className:"bf-error",role:"alert",children:he}),jsxs("div",{className:"bf-actions",children:[jsx("button",{type:"button",className:"bf-btn",onClick:()=>a(),disabled:E,"aria-label":o.cancelButton,children:o.cancelButton}),jsx("button",{type:"button",className:"bf-btn bf-btnPrimary",onClick:ee,disabled:E||f.trim().length===0,"aria-label":o.sendButton,children:o.sendButton})]})]}),c&&jsxs("div",{className:"bf-watermark",children:[(()=>{let s=q();return s?jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"bf-my-feedback-link",children:"View my feedback"}):null})(),jsx("a",{href:"https://blocfeed.com",target:"_blank",rel:"noopener noreferrer",children:"Powered by BlocFeed"})]})]})]}),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(mt)]}),jsx("button",{type:"button",className:"bf-recording-bar-stop",onClick:()=>i$1.stopRecording(),"aria-label":o.stopRecordButton,children:o.stopRecordButton})]}),e.phase==="success"&&jsxs("div",{className:"bf-toast",role:"status","aria-live":"polite",children:[o.toastText,(()=>{let s=q();return s?jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"bf-toast-link",children:"View my feedback"}):null})()]}),J>0&&!vt&&jsxs("div",{className:"bf-security-banner",role:"alert",children:[jsx("button",{type:"button",className:"bf-security-banner-dismiss",onClick:()=>yt(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 Oo=forwardRef(function(e,i){let r={...e.config??{},blocfeed_id:e.blocfeed_id},[a,p]=useState(null),n=zo(r.ui?.showOn),l=Io(r.ui?.theme?.mode),o=!!r.diagnostics;useEffect(()=>{if(o)return u(r.diagnostics),()=>v()},[o]);let c=!!r.security;useEffect(()=>{c&&y$1(r.security);},[c]);let x=useRef(e.config?.metadata?.enrich);x.current=e.config?.metadata?.enrich;let z$1=useMemo(()=>{if(e.config)return {...e.config,metadata:{...e.config.metadata,enrich:async f=>{let S=x.current,b=S?await S(f):{},T=w(),m=z(),C=j();return {...b,...T.consoleLogs.length>0?{_consoleLogs:T.consoleLogs}:{},...T.networkErrors.length>0?{_networkErrors:T.networkErrors}:{},...m.findings.length>0?{_securityFindings:m.findings}:{},...C.length>0?{_clickEvents:C}:{}}}}}},[]);return useEffect(()=>{Me();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;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));let T=C=>C.stopPropagation(),m=["pointerdown","pointerup","mousedown","mouseup","click","touchstart","touchend"];for(let C of m)f.addEventListener(C,T);try{document.body.appendChild(f);}catch{return}return p(f),()=>{for(let C of m)f.removeEventListener(C,T);f.remove(),p(null);}},[r.ui?.zIndex,r.ui?.theme?.accentColor,r.ui?.theme?.panelBackground,r.ui?.theme?.panelForeground,r.ui?.theme?.fontFamily,l]),!n||!a?null:createPortal(jsx(ie,{blocfeed_id:r.blocfeed_id,...z$1?{config:z$1}:{},children:jsx(Ho,{config:r,handleRef:i})}),a)});
|
|
885
|
+
export{ie as BlocFeedProvider,Oo as BlocFeedWidget,ae as useBlocFeed};
|
package/package.json
CHANGED
package/dist/chunk-EZWTVVJ5.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
'use strict';function E(){return typeof window<"u"&&typeof document<"u"}function Fe(e){let t=globalThis.CSS;return typeof t?.escape=="function"?t.escape(e):e.replace(/[^a-zA-Z0-9_-]/g,n=>{let o=n.codePointAt(0);return o===void 0?"":`\\${o.toString(16)} `})}function le(e){return {x:e.x,y:e.y,width:e.width,height:e.height}}function pt(e){return {x:e.x+window.scrollX,y:e.y+window.scrollY,width:e.width,height:e.height}}function gt(e){return e.replace(/\s+/g," ").trim()}function de(e,t=140){let n=e.textContent;if(!n)return;let o=gt(n);if(o)return o.length<=t?o:`${o.slice(0,t-1)}\u2026`}function ht(e){let t=1;for(let n=e.previousElementSibling;n;n=n.previousElementSibling)n.tagName===e.tagName&&(t+=1);return t}var De=["data-testid","data-test-id","data-test","data-qa","data-cy"],Me="data-blocfeed-component";function ue(e){let t=e.closest(`[${Me}]`);if(!t)return;let o=t.getAttribute(Me)?.trim();return o||void 0}function wt(e){for(let t of De){let n=e.closest(`[${t}]`);if(!n)continue;let r=n.getAttribute(t)?.trim();if(r)return r}}function Ie(e){try{let t=e,n=Object.getOwnPropertyNames(t);for(let o of n)if(o.startsWith("__reactFiber$")||o.startsWith("__reactInternalInstance$")){let r=t[o];if(r&&typeof r=="object")return r}}catch{}return null}function V(e){if(e.length<=1||e.length===2&&e[0]===e[0].toLowerCase()||e.startsWith("__")&&e.endsWith("__"))return true;let t=e[0];return t>="a"&&t<="z"}function Z(e){if(e){for(let t of e)if(typeof t.name=="string"&&t.name&&!V(t.name))return t.name}}function P(e){if(e&&typeof e!="string"){if(typeof e=="function"){let t=e;return typeof t.displayName=="string"&&t.displayName?t.displayName:typeof t.name=="string"&&t.name?t.name:void 0}if(typeof e=="object"){let t=e,n=t.displayName;if(typeof n=="string"&&n)return n;let o=t.render;if(typeof o=="function"){let i=o;if(typeof i.displayName=="string"&&i.displayName)return i.displayName;if(typeof i.name=="string"&&i.name)return i.name}let r=t.type;return P(r)}}}function fe(e){let t=Ie(e);if(!t)return;let n=Z(t._debugInfo);if(n)return n;let o=t._debugOwner!==void 0;if(o){let c=t._debugOwner;for(let l=0;c&&l<50;l+=1){let b=Z(c._debugInfo);if(b)return b;let f=P(c.type)??P(c.elementType);if(f&&!V(f))return f;c=c._debugOwner;}}if(t._owner!==void 0&&t._owner!==t._debugOwner){let c=t._owner;for(let l=0;c&&l<50;l+=1){let b=Z(c._debugInfo);if(b)return b;let f=P(c.type)??P(c.elementType);if(f&&!V(f))return f;c=c._owner;}}let i=t,s=o?80:25;for(let c=0;i&&c<s;c+=1){let l=Z(i._debugInfo);if(l)return l;let b=P(i.type)??P(i.elementType);if(b&&!V(b))return b;i=i.return;}let a=e.parentElement;for(let c=0;a&&c<15;c+=1){let l=Ie(a);if(l){let b=Z(l._debugInfo);if(b)return b;let f=P(l.type)??P(l.elementType);if(f&&!V(f))return f;if(l._debugOwner){let d=P(l._debugOwner.type)??P(l._debugOwner.elementType);if(d&&!V(d))return d}if(l._owner&&l._owner!==l._debugOwner){let d=P(l._owner.type)??P(l._owner.elementType);if(d&&!V(d))return d}}a=a.parentElement;}}function bt(e){let t=e.tagName.toLowerCase(),n=e.getAttribute("id");if(n)return `#${Fe(n)}`;for(let o of De){let r=e.getAttribute(o);if(r)return `${t}[${o}="${Fe(r)}"]`}return `${t}:nth-of-type(${ht(e)})`}function yt(e,t=10){let n=[],o=e;for(;o&&n.length<t;){let r=bt(o);if(n.unshift(r),r.startsWith("#"))break;o=o.parentElement;}return n.join(" > ")}function Be(e,t){if(!t||t.length===0)return false;for(let n of t)if(e.closest(n))return true;return false}function me(e,t){if(!e||Be(e,t.ignoreSelectors))return null;let n=e;for(;n;){if(Be(n,t.ignoreSelectors))return null;if(t.isSelectable?t.isSelectable(n):Et(n))return n;n=n.parentElement;}return null}function Et(e){let t=e.tagName;return !(t==="HTML"||t==="BODY")}function Le(e){let t=e.getBoundingClientRect(),n={selector:yt(e),tagName:e.tagName.toLowerCase(),rect:le(t),pageRect:pt(t)},o=e.getAttribute("id");o&&(n.id=o);let r=e.className;typeof r=="string"&&r.trim()&&(n.className=r);let i=de(e);i&&(n.textSnippet=i);let s=ue(e)??fe(e);s&&(n.componentName=s);let a=wt(e);return a&&(n.testId=a),n}var pe=null;async function Ne(){return pe||(pe=import('html-to-image')),pe}async function vt(e){return await new Promise((t,n)=>{let o=new Image;o.onload=()=>t({width:o.naturalWidth,height:o.naturalHeight}),o.onerror=()=>n(new Error("Failed to load generated screenshot")),o.src=e;})}async function Oe(e,t){let{width:n,height:o}=await vt(e);return {dataUrl:e,mime:t,width:n,height:o}}function z(e){if(e?.aborted)throw new Error("Aborted")}function Ue(){return {async captureElement(e,t){if(!E())throw new Error("captureElement can only run in the browser");z(t.signal);let n=await Ne();z(t.signal);let o=t.mime==="image/jpeg"?await n.toJpeg(e,{quality:t.quality??.92,pixelRatio:t.pixelRatio}):await n.toPng(e,{pixelRatio:t.pixelRatio});return z(t.signal),await Oe(o,t.mime)},async captureFullPage(e){if(!E())throw new Error("captureFullPage can only run in the browser");z(e.signal);let t=document.documentElement,n=Math.max(t.scrollWidth,t.clientWidth),o=Math.max(t.scrollHeight,t.clientHeight),r=Math.min(1,e.maxDimension/Math.max(n,o)),i=Math.max(1,Math.round(n*r)),s=Math.max(1,Math.round(o*r)),a=await Ne();z(e.signal);let c=e.mime==="image/jpeg"?await a.toJpeg(t,{width:i,height:s,quality:e.quality??.92,pixelRatio:e.pixelRatio}):await a.toPng(t,{width:i,height:s,pixelRatio:e.pixelRatio});return z(e.signal),await Oe(c,e.mime)}}}function St(e){if(e instanceof Error)return e.message;if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return "Unknown error"}}function w(e,t,n){let o={kind:e,message:St(t)};return n&&(o.detail=n),o}var kt=12e3,_t=2048,Tt=.92;function Ve(){return Date.now()}function At(e){return new Promise((t,n)=>{let o=()=>n(new Error("Aborted"));if(e.aborted){o();return}e.addEventListener("abort",o,{once:true});})}async function He(e,t,n){let o=new Promise((i,s)=>{let a=setTimeout(()=>s(new Error("Timeout")),t);typeof a.unref=="function"&&a.unref();}),r=[e,o];return n&&r.push(At(n)),await Promise.race(r)}function Rt(e){if(!E())return 1;let t=window.devicePixelRatio||1,n=e?.pixelRatio??Math.min(t,2);return Math.max(.1,n)}function xt(e){return !!(e?.element||e?.fullPage)}function qe(e){let t={mime:e.mime,pixelRatio:e.pixelRatio,maxDimension:e.maxDimension};return e.includeQuality&&(t.quality=e.quality),e.signal&&(t.signal=e.signal),t}async function $e(e){let{selectionElement:t,capture:n,signal:o}=e;if(!E()||!xt(n))return;let r=Ve(),i=[],s=n?.timeoutMs??kt,a=n?.maxDimension??_t,c=n?.mime??"image/png",l=n?.quality??Tt,b=n?.adapter??Ue(),f={},d=Rt(n);if(n?.element&&t)try{let g=t.getBoundingClientRect(),m=Math.min(1,a/Math.max(g.width,g.height)),p=Math.min(d,d*m),M=await He(Promise.resolve(b.captureElement(t,{...qe({mime:c,quality:l,pixelRatio:p,maxDimension:a,includeQuality:c==="image/jpeg",...o?{signal:o}:{}})})),s,o);f.element=M;}catch(g){if(o?.aborted)throw g;i.push(w("capture_failed",g,{target:"element"}));}if(n?.fullPage)try{let g=await He(Promise.resolve(b.captureFullPage(qe({mime:c,quality:l,pixelRatio:d,maxDimension:a,includeQuality:c==="image/jpeg",...o?{signal:o}:{}}))),s,o);f.fullPage=g;}catch(g){if(o?.aborted)throw g;i.push(w("capture_failed",g,{target:"fullPage"}));}let y=Ve(),u={startedAt:r,finishedAt:y,durationMs:Math.max(0,y-r)};return i.length>0&&(u.errors=i),{...f,diagnostics:u}}function Pt(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function Ct(){return E()?{url:window.location.href,title:document.title,referrer:document.referrer||void 0,userAgent:navigator.userAgent,language:navigator.language,platform:navigator.platform,viewport:{width:window.innerWidth,height:window.innerHeight},screen:{width:window.screen.width,height:window.screen.height},scroll:{x:window.scrollX,y:window.scrollY},devicePixelRatio:window.devicePixelRatio||1,timezone:Pt()}:{}}function Ft(e){if(!e)return {};let t={};return e.id&&(t.userId=e.id),e.email&&(t.userEmail=e.email),e.name&&(t.userName=e.name),t}async function ze(e){let{config:t,context:n,user:o}=e;if(t?.enabled===false)return {};let r={...Ct(),...Ft(o)},i=t?.enrich;if(!i)return r;try{let s=await i(n);return {...r,...s}}catch(s){let a=w("unknown",s);return {...r,blocfeedMetadataError:a.message}}}var K="blocfeed-queue",Mt=50;function ge(){if(!E())return [];try{let e=localStorage.getItem(K);if(!e)return [];let t=JSON.parse(e);if(Array.isArray(t))return t;console.warn("[BlocFeed] offline queue was corrupt (non-array) \u2014 resetting");try{localStorage.removeItem(K);}catch{}return []}catch(e){console.warn("[BlocFeed] offline queue could not be read \u2014 resetting",e);try{localStorage.removeItem(K);}catch{}return []}}function he(e){if(E())try{e.length===0?localStorage.removeItem(K):localStorage.setItem(K,JSON.stringify(e));}catch(t){let n=t instanceof DOMException?t.name:"";console.warn(`[BlocFeed] failed to persist offline queue${n?` (${n})`:""} \u2014 feedback may be lost if page is closed`);}}function It(e){let t={...e};if(t.screenshots){let n={...t.screenshots};n.element&&(n.element={...n.element,dataUrl:""}),n.fullPage&&(n.fullPage={...n.fullPage,dataUrl:""}),t.screenshots=n;}return delete t.video,t}function we(e){let t=ge(),n=It(e);for(n.metadata={...n.metadata,_queued:true},t.push({payload:n,timestamp:Date.now()});t.length>Mt;)t.shift();he(t);}function Xe(){let e=ge();return e.length===0?[]:(he([]),e.map(t=>t.payload))}function Fn(){he([]);}function Mn(){return ge().length}var Bt=200,W=[],je=0,J=false;function Ze(e){let t=e.target;if(!(t instanceof Element)||t.closest("[data-blocfeed-ui]"))return;let n={timestampMs:Date.now()-je,path:window.location.pathname,tagName:t.tagName.toLowerCase()},o=de(t,100);o&&(n.textSnippet=o);let r=ue(t)??fe(t);r&&(n.componentName=r),W.length<Bt&&W.push(n);}var Ke={capture:true,passive:true};function We(){J||!E()||(J=true,W=[],je=Date.now(),document.addEventListener("click",Ze,Ke));}function Qe(){J&&(J=false,document.removeEventListener("click",Ze,Ke));}function Dt(){return [...W]}function Lt(){W=[];}var Nt=3e4,Ot=25e5,Ye="video/webm",Ut=250,Vt=1e3,Ht=["video/webm;codecs=vp9","video/webm;codecs=vp8","video/webm"];function Ge(){if(typeof MediaRecorder>"u")return null;for(let e of Ht)if(MediaRecorder.isTypeSupported(e))return e;return null}function qt(){return !E()||typeof navigator?.mediaDevices?.getDisplayMedia!="function"?false:Ge()!==null}async function be(e){let{config:t,signal:n}=e;if(!E()||typeof navigator?.mediaDevices?.getDisplayMedia!="function")throw w("recording_failed",new Error("Screen recording is not supported in this browser"));let o=Ge();if(!o)throw w("recording_failed",new Error("No supported video codec found (WebM required)"));if(n?.aborted)throw w("aborted",new Error("Recording aborted before start"));let r;try{r=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:"browser"},audio:!1});}catch(m){let p=m instanceof DOMException&&m.name==="NotAllowedError"?"Screen share permission denied":"Failed to start screen share";throw w("recording_failed",new Error(p))}if(n?.aborted)throw r.getTracks().forEach(m=>m.stop()),w("aborted",new Error("Recording aborted after permission"));let i=t?.maxDurationMs??Nt,s=t?.videoBitsPerSecond??Ot,a=new MediaRecorder(r,{mimeType:o,videoBitsPerSecond:s}),c=[],l=[],b=0,f=null,d=null,y=false,u=()=>{Qe(),f!==null&&(clearInterval(f),f=null),d!==null&&(clearTimeout(d),d=null),r.getTracks().forEach(m=>m.stop());},g=new Promise((m,p)=>{a.ondataavailable=_=>{_.data.size>0&&c.push(_.data);},a.onstop=()=>{if(y)return;y=true,u();let _=Date.now()-b,C=new Blob(c,{type:Ye}),S=URL.createObjectURL(C);m({mime:Ye,blobUrl:S,blob:C,durationMs:_,sizeBytes:C.size});},a.onerror=()=>{y||(y=true,u(),p(w("recording_failed",new Error("MediaRecorder error"))));};let M=r.getVideoTracks()[0];if(M&&M.addEventListener("ended",()=>{a.state!=="inactive"&&a.stop();}),n){let _=()=>{y||(y=true,a.state!=="inactive"&&a.stop(),u(),p(w("aborted",new Error("Recording aborted"))));};n.addEventListener("abort",_,{once:true});}});return a.start(Vt),We(),b=Date.now(),f=setInterval(()=>{let m=Date.now()-b;for(let p of l)p(m);},Ut),d=setTimeout(()=>{!y&&a.state!=="inactive"&&a.stop();},i),{result:g,stop(){!y&&a.state!=="inactive"&&a.stop();},onTick(m){l.push(m);},abort(){y||(y=true,a.state!=="inactive"&&a.stop(),u());}}}var $t=6e4,Je="audio/webm",zt=250,Xt=["audio/webm;codecs=opus","audio/webm","audio/ogg;codecs=opus"];function et(){if(typeof MediaRecorder>"u")return null;for(let e of Xt)if(MediaRecorder.isTypeSupported(e))return e;return null}function jt(){return !E()||typeof navigator?.mediaDevices?.getUserMedia!="function"?false:et()!==null}async function ye(e){let{config:t,signal:n}=e;if(!E()||typeof navigator?.mediaDevices?.getUserMedia!="function")throw w("recording_failed",new Error("Microphone recording is not supported in this browser"));let o=et();if(!o)throw w("recording_failed",new Error("No supported audio codec found"));if(n?.aborted)throw w("aborted",new Error("Voice recording aborted before start"));let r;try{r=await navigator.mediaDevices.getUserMedia({audio:!0});}catch(g){let m=g instanceof DOMException&&g.name==="NotAllowedError"?"Microphone permission denied":"Failed to access microphone";throw w("recording_failed",new Error(m))}if(n?.aborted)throw r.getTracks().forEach(g=>g.stop()),w("aborted",new Error("Voice recording aborted after permission"));let i=t?.maxDurationMs??$t,s=new MediaRecorder(r,{mimeType:o}),a=[],c=[],l=0,b=null,f=null,d=false,y=()=>{b!==null&&(clearInterval(b),b=null),f!==null&&(clearTimeout(f),f=null),r.getTracks().forEach(g=>g.stop());},u=new Promise((g,m)=>{if(s.ondataavailable=p=>{p.data.size>0&&a.push(p.data);},s.onstop=()=>{if(d)return;d=true,y();let p=Date.now()-l,M=new Blob(a,{type:Je});g({blob:M,mime:Je,durationMs:p});},s.onerror=()=>{d||(d=true,y(),m(w("recording_failed",new Error("MediaRecorder error"))));},n){let p=()=>{d||(d=true,s.state!=="inactive"&&s.stop(),y(),m(w("aborted",new Error("Voice recording aborted"))));};n.addEventListener("abort",p,{once:true});}});return s.start(1e3),l=Date.now(),b=setInterval(()=>{let g=Date.now()-l;for(let m of c)m(g);},zt),f=setTimeout(()=>{f=null,!d&&s.state!=="inactive"&&s.stop();},i),{result:u,stop(){!d&&s.state!=="inactive"&&s.stop();},onTick(g){c.push(g);},abort(){d||(d=true,s.state!=="inactive"&&s.stop(),y());}}}var Zt=12e3,Kt=2,Wt=500,Qt=2e3,Ee="https://blocfeed.com/api/feedback",Yt="https://blocfeed.com/api/feedback/voice",tt=0,rt="blocfeed-viewer-token",it="blocfeed-my-feedback-url";function Gt(){try{return localStorage.getItem(rt)}catch{return null}}function Wn(){try{return localStorage.getItem(it)}catch{return null}}function Jt(e,t){try{localStorage.setItem(rt,e),t&&localStorage.setItem(it,t);}catch{}}function nt(e,t){return new Promise((n,o)=>{if(t?.aborted){o(new Error("Aborted"));return}let r=setTimeout(n,e),i=()=>{clearTimeout(r),o(new Error("Aborted"));};t?.addEventListener("abort",i,{once:true});})}function en(e){return e>=500&&e<=599}function tn(e){let[t,n]=e.split(",",2);if(!t||!n)throw new Error("Invalid data URL");let r=/data:(.*?);base64/.exec(t)?.[1]||"application/octet-stream",i=atob(n),s=new Uint8Array(i.length);for(let a=0;a<i.length;a+=1)s[a]=i.charCodeAt(a);return new Blob([s],{type:r})}function nn(e){let t={},n={},o={...e};if(o.screenshots){let r={},i={...o.screenshots};i.element&&(t.element=i.element.dataUrl,r.element={mime:i.element.mime,width:i.element.width,height:i.element.height},i.element={...i.element,dataUrl:""}),i.fullPage&&(t.fullPage=i.fullPage.dataUrl,r.fullPage={mime:i.fullPage.mime,width:i.fullPage.width,height:i.fullPage.height},i.fullPage={...i.fullPage,dataUrl:""}),o.screenshots=i,(r.element||r.fullPage)&&(o.screenshot_intent=r);}return o.video&&(n.blob=o.video.blob,o.video_intent={mime:o.video.mime,durationMs:o.video.durationMs,sizeBytes:o.video.sizeBytes},delete o.video),{lean:o,extracted:t,extractedVideo:n}}async function ot(e,t,n){let o=tn(t);await fetch(e,{method:"PUT",body:o,headers:{"content-type":o.type},...n?{signal:n}:{}});}async function on(e){let{feedbackId:t,extracted:n,screenshots:o,signal:r}=e,i={};n.element&&o?.element&&(i.element={dataUrl:n.element,mime:o.element.mime,width:o.element.width,height:o.element.height}),n.fullPage&&o?.fullPage&&(i.fullPage={dataUrl:n.fullPage,mime:o.fullPage.mime,width:o.fullPage.width,height:o.fullPage.height}),Object.keys(i).length!==0&&await fetch(`${Ee}/${t}/screenshots`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(i),...r?{signal:r}:{}});}async function rn(e){await fetch(`${Ee}/${e.feedbackId}/video`,{method:"POST",body:e.blob,headers:{"content-type":e.blob.type},...e.signal?{signal:e.signal}:{}});}async function st(e){let{signal:t,transport:n}=e;if(Date.now()-tt<Qt)return {ok:false,error:w("configuration",new Error("Please wait before submitting again"))};let r=n?.timeoutMs??Zt,i=n?.maxAttempts??Kt,s=n?.backoffMs??Wt,a=!!(e.payload.screenshots?.element?.dataUrl||e.payload.screenshots?.fullPage?.dataUrl),c=!!e.payload.video?.blob,l=a||c,{lean:b,extracted:f,extractedVideo:d}=l?nn(e.payload):{lean:e.payload,extracted:{},extractedVideo:{}},y=Gt();y&&(b.viewer_token=y);let u={...f,...e.screenshotDataUrls};for(let g=1;g<=i;g+=1){let m=new AbortController,p=setTimeout(()=>m.abort(),r),M=()=>m.abort();t&&t.addEventListener("abort",M,{once:true});try{let _=await fetch(Ee,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(b),signal:m.signal});if(_.ok){tt=Date.now();let S;try{S=await _.json();}catch{}if(S?.viewer_token&&Jt(S.viewer_token,S.my_feedback_url),(u.element||u.fullPage)&&S){let F=S.upload_urls;if(F){let $=[];u.element&&F.element&&$.push(ot(F.element,u.element,t)),u.fullPage&&F.fullPage&&$.push(ot(F.fullPage,u.fullPage,t));try{await Promise.all($);}catch{}}else if(S.feedback_id)try{await on({feedbackId:S.feedback_id,extracted:u,screenshots:e.payload.screenshots,...t?{signal:t}:{}});}catch{}}if(d.blob&&S){let F=S.upload_urls;if(F?.video)try{await fetch(F.video,{method:"PUT",body:d.blob,headers:{"content-type":d.blob.type},...t?{signal:t}:{}});}catch{}else if(S.feedback_id)try{await rn({feedbackId:S.feedback_id,blob:d.blob,...t?{signal:t}:{}});}catch{}}let q={ok:!0,status:_.status};return S&&(q.apiResponse=S),q}if(g<i&&en(_.status)){let S=.85+Math.random()*.3,B=Math.round(s*2**(g-1)*S);await nt(B,t);continue}let C=`HTTP ${_.status}`;try{let S=await _.json();S?.error&&(C=S.error);}catch{}return {ok:!1,status:_.status,error:w("api_failed",new Error(C))}}catch(_){if(m.signal.aborted||t?.aborted)return {ok:false,error:w("aborted",_)};if(g<i){let C=.85+Math.random()*.3,S=Math.round(s*2**(g-1)*C);await nt(S,t);continue}return {ok:false,error:w("api_failed",_)}}finally{clearTimeout(p),t&&t.removeEventListener("abort",M);}}return {ok:false,error:w("api_failed",new Error("Failed"))}}async function at(e){let{blob:t,mime:n,blocfeedId:o,signal:r}=e,i=await fetch(Yt,{method:"POST",headers:{"Content-Type":n,"X-Blocfeed-Id":o},body:t,...r?{signal:r}:{}});if(!i.ok){let a=await i.json().catch(()=>({error:"Unknown error"}));throw w("api_failed",new Error(a?.error??`Voice API returned ${i.status}`))}let s=await i.json();return {text:s.text??"",warning:s.warning}}function ve(e){let t=null,n=null,o=(...r)=>{n=r,t===null&&(t=requestAnimationFrame(()=>{if(t=null,!n)return;let i=n;n=null,e(...i);}));};return o.cancel=()=>{t!==null&&cancelAnimationFrame(t),t=null,n=null;},o}function ee(e){return e instanceof Element?!!e.closest("[data-blocfeed-ui]"):false}function te(e){e.stopPropagation(),e.stopImmediatePropagation?.();}function ct(e,t){if(!E())throw new Error("BlocFeed picker can only run in a browser environment.");let n=e.ignoreSelectors,o=e.isSelectable,r={};n&&n.length>0&&(r.ignoreSelectors=n),o&&(r.isSelectable=o);let i=null,s=null,a=(u,g=false)=>{if(!u){i=null,s=null,t.onHover(null);return}let m=le(u.getBoundingClientRect()),p=`${Math.round(m.x)}:${Math.round(m.y)}:${Math.round(m.width)}:${Math.round(m.height)}`;!g&&u===i&&p===s||(i=u,s=p,t.onHover({element:u,rect:m}));},c=ve(u=>{if(ee(u.target))return;let g=document.elementFromPoint(u.clientX,u.clientY),m=me(g,r);a(m);}),l=ve(()=>{i&&a(i,true);}),b=u=>{ee(u.target)||(te(u),u.pointerType==="mouse"&&u.preventDefault());},f=u=>{ee(u.target)||(te(u),u.pointerType==="mouse"&&u.preventDefault());},d=u=>{if(ee(u.target))return;te(u),u.preventDefault();let g=document.elementFromPoint(u.clientX,u.clientY),m=me(g,r);m&&t.onSelect({element:m,descriptor:Le(m)});},y=u=>{u.key==="Escape"&&(te(u),u.preventDefault(),t.onCancel());};return window.addEventListener("pointermove",c,{capture:true,passive:true}),window.addEventListener("pointerdown",b,{capture:true}),window.addEventListener("pointerup",f,{capture:true}),window.addEventListener("click",d,{capture:true}),window.addEventListener("keydown",y,{capture:true}),window.addEventListener("scroll",l,{capture:true,passive:true}),window.addEventListener("resize",l,{passive:true}),{stop(){window.removeEventListener("pointermove",c,{capture:true}),window.removeEventListener("pointerdown",b,{capture:true}),window.removeEventListener("pointerup",f,{capture:true}),window.removeEventListener("click",d,{capture:true}),window.removeEventListener("keydown",y,{capture:true}),window.removeEventListener("scroll",l,{capture:true}),window.removeEventListener("resize",l),c.cancel(),l.cancel(),t.onHover(null);}}}async function Se(e){let{signal:t,transport:n}=e,o={ok:false};try{let r={payload:e.payload,...t?{signal:t}:{},...n?{transport:n}:{}};o.api=await st(r),o.ok=!!o.api?.ok;}catch(r){o.api={ok:false,error:w("api_failed",r)},o.ok=false;}return {payload:e.payload,result:o}}var sn=["[data-blocfeed-ui]","[data-blocfeed-ignore]"];function an(e){let t=[...sn,...e?.ignoreSelectors??[]],n=Array.from(new Set(t));return {...e,ignoreSelectors:n}}function lt(){return {phase:"idle"}}function cn(e){if(e.ok)return false;let t=e.api;return t?t.status&&t.status>=400&&t.status<500||t.error?.kind==="aborted"||t.error?.kind==="configuration"?false:!t.ok:true}function go(e){let t=e,n=lt(),o=new Set,r=new Set,i=null,s=null,a=null,c=null,l=0,b=null,f=null,d=null,y=null,u=false,g=()=>{for(let h of o)h(n);},m=h=>{for(let v of r)v(h);},p=h=>{n=h,g();},M=()=>{l+=1,c?.abort(),c=null;},_=()=>{i?.stop(),i=null,m(null),a!==null&&E()&&(document.documentElement.style.cursor=a,a=null);},C=()=>{if(d){try{URL.revokeObjectURL(d.blobUrl);}catch{}d=null;}},S=()=>{f&&(f.abort(),f=null),C();},B=null,q=()=>{y&&(y.abort(),y=null),B&&(B.abort(),B=null);},F=()=>{M(),_(),S(),q(),s=null,p(lt());},$=()=>{if(!E())return;_(),s=null;let h=an(t.picker);a=document.documentElement.style.cursor,document.documentElement.style.cursor="crosshair",p({phase:"picking"}),i=ct(h,{onHover:m,onSelect:({element:v,descriptor:x})=>{s=v,_(),p({phase:"review",selection:x});},onCancel:()=>{F();}});},Pe=()=>{let h=Xe();if(h.length!==0)for(let v of h)Se({payload:v,...t.transport?{transport:t.transport}:{}}).catch(()=>{we(v);});};if(E()){setTimeout(Pe,1e3);let h=()=>Pe();window.addEventListener("online",h),b=()=>window.removeEventListener("online",h);}return {getState:()=>n,getConfig:()=>t,subscribe(h){return o.add(h),()=>o.delete(h)},subscribeHover(h){return r.add(h),()=>r.delete(h)},start(){n.phase==="capturing"||n.phase==="submitting"||n.phase==="recording"||n.phase!=="picking"&&$();},stop(){F();},clearSelection(){n.phase==="capturing"||n.phase==="submitting"||n.phase==="recording"||$();},setConfig(h){t=h;},async submit(h,v){if(!E()){let T=w("configuration",new Error("BlocFeed submit can only run in the browser"));return p({phase:"error",lastError:T}),{ok:false}}let x=t.blocfeed_id?.trim?.()??"";if(!x){let I={phase:"error",lastError:w("configuration",new Error("Missing blocfeed_id. Create a project in BlocFeed and pass its blocfeed_id."))};return n.selection&&(I.selection=n.selection),p(I),{ok:false}}if(u)return {ok:false};if(n.phase==="capturing"||n.phase==="submitting"||n.phase==="recording")return {ok:false};u=true;let R=l+1;l=R,c?.abort(),c=new AbortController;let A=c.signal,k=n.selection,D=v?.capture?{...t.capture,...v.capture}:t.capture,O=!!(D?.element||D?.fullPage),X={phase:O?"capturing":"submitting"};k&&(X.selection=k),p(X);try{let T=O?await $e({selectionElement:s,capture:D,signal:A}):void 0;if(A.aborted||l!==R)return {ok:!1};let I={phase:"submitting"};k&&(I.selection=k),T&&(I.capture=T),p(I);let L={};k&&(L.selection=k),T&&(L.capture=T);let j=await ze({config:t.metadata,context:L,...t.user?{user:t.user}:{}}),U={version:1,createdAt:new Date().toISOString(),blocfeed_id:x,message:h,metadata:j};v?.category&&(U.category=v.category),t.user&&(U.user=t.user),k&&(U.selection=k),T&&(U.screenshots=T),d&&(U.video=d);let{result:N}=await Se({payload:U,signal:A,...t.transport?{transport:t.transport}:{}});if(A.aborted||l!==R)return N;if(N.ok){C(),s=null;let ce={phase:"success",lastSubmit:N};return k&&(ce.selection=k),T&&(ce.capture=T),p(ce),N}cn(N)&&we(U);let mt=N.api?.error??w("unknown",new Error("Submission failed")),ae={phase:"error",lastSubmit:N,lastError:mt};return k&&(ae.selection=k),T&&(ae.capture=T),p(ae),N}catch(T){if(A.aborted||l!==R)return {ok:false};let L={phase:"error",lastError:A.aborted?w("aborted",T):w("unknown",T)};return k&&(L.selection=k),p(L),{ok:false}}finally{u=false,l===R&&(c=null);}},async startRecording(){if(n.phase!=="review"||!t.recording?.enabled||y||f)return;let h=n.selection,v={phase:"recording",recordingElapsedMs:0};h&&(v.selection=h),p(v);try{let x={config:t.recording};c&&(x.signal=c.signal);let R=await be(x);f=R,R.onTick(D=>{if(n.phase==="recording"){let O={phase:"recording",recordingElapsedMs:D};h&&(O.selection=h),p(O);}});let A=await R.result;f=null,d=A;let k={phase:"review",video:A};h&&(k.selection=h),p(k);}catch(x){f=null;let A={phase:"review",lastError:x?.kind?x:w("recording_failed",x)};h&&(A.selection=h),p(A);}},stopRecording(){n.phase!=="recording"||!f||f.stop();},removeVideo(){C();let h=n.selection,v={phase:"review"};h&&(v.selection=h),p(v);},async startVoice(){if(n.phase!=="review"){console.warn("[BlocFeed] startVoice: ignored \u2014 phase is",n.phase,'(expected "review")');return}let h=t.voice;if(!h?.enabled){console.warn("[BlocFeed] startVoice: ignored \u2014 voice is not enabled in config");return}if(f){console.warn("[BlocFeed] startVoice: ignored \u2014 a screen recording is already in progress");return}q();let v=n.selection,x={phase:"review",voiceRecording:true,voiceElapsedMs:0};v&&(x.selection=v),d&&(x.video=d),p(x);try{let R={config:h};c&&(R.signal=c.signal);let A=await ye(R);y=A,A.onTick(L=>{let j={phase:"review",voiceRecording:!0,voiceElapsedMs:L};v&&(j.selection=v),d&&(j.video=d),p(j);});let k=await A.result;y=null;let D={phase:"review",voiceRecording:!1,voiceTranscribing:!0};v&&(D.selection=v),d&&(D.video=d),p(D),B=new AbortController;let O={blob:k.blob,mime:k.mime,blocfeedId:t.blocfeed_id,signal:B.signal},{text:Ce,warning:X}=await at(O);B=null;let T={phase:"review",voiceRecording:!1,voiceTranscribing:!1};v&&(T.selection=v),d&&(T.video=d),p(T);let I={text:Ce};return X&&(I.warning=X),I}catch(R){q();let A=R?.kind?R:w("recording_failed",R);console.warn("[BlocFeed] Voice error:",A.message);let k={phase:"review",voiceRecording:false,voiceTranscribing:false,lastError:A};v&&(k.selection=v),d&&(k.video=d),p(k);return}},stopVoice(){y&&y.stop();},__unsafeGetSelectedElement(){return s},destroy(){F(),o.clear(),r.clear(),b?.(),b=null;}}}var Q=[],Y=[],dt=20,ut=15,ne=[],ft=typeof console<"u"?{log:console.log?.bind(console),warn:console.warn?.bind(console),error:console.error?.bind(console),info:console.info?.bind(console),debug:console.debug?.bind(console)}:{},oe=typeof globalThis<"u"&&typeof globalThis.fetch=="function"?globalThis.fetch:void 0,re=typeof XMLHttpRequest<"u"?XMLHttpRequest.prototype.open:void 0,ie=typeof XMLHttpRequest<"u"?XMLHttpRequest.prototype.send:void 0,_e=new Set,Te=false,Ae=false,se=false,ln=["blocfeed.com","google-analytics.com","googletagmanager.com","analytics.google.com","googleads.g.doubleclick.net","googlesyndication.com","googleadservices.com","google.com/pagead","google.com/ads","facebook.net","facebook.com/tr","connect.facebook.net","graph.facebook.com","api.mixpanel.com","api-js.mixpanel.com","api.amplitude.com","api2.amplitude.com","api.segment.io","cdn.segment.com","vars.hotjar.com","in.hotjar.com","script.hotjar.com","heapanalytics.com","fullstory.com/s/fs.js","rs.fullstory.com","app.posthog.com","us.posthog.com","eu.posthog.com","api-iam.intercom.io","widget.intercom.io","sentry.io/api","browser.sentry-cdn.com","browser-intake-datadoghq.com","clarity.ms","js.hs-analytics.net","api.hubapi.com","forms.hubspot.com","plausible.io/api","client.crisp.chat","js.driftt.com","r.logrocket.com","app.pendo.io","events.launchdarkly.com","app.launchdarkly.com","grammarly.com","gnar.grammarly.com","capi.grammarly.com","api.languagetool.org","api.languagetoolplus.com","fonts.googleapis.com","fonts.gstatic.com","cdn.cookielaw.org","consent.cookiebot.com","js.stripe.com","api.stripe.com/v1/tokens","google.com/recaptcha","hcaptcha.com","bam.nr-data.net","rec.smartlook.com","o2.mouseflow.com","api.luckyorange.com","static.zdassets.com","ekr.zdassets.com"];function dn(e){if(e instanceof Error)return e.name&&e.name!=="Error"?`${e.name}: ${e.message}`:e.message||String(e);if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function un(e,t){let n=t.map(dn).join(" "),o=t.find(i=>i instanceof Error),r={level:e,message:n.slice(0,2e3),timestamp:Date.now()};for(o?.stack&&(r.stack=o.stack.slice(0,2e3)),Q.push(r);Q.length>dt;)Q.shift();}function ke(e){let t=e.url.toLowerCase();for(let n of ne)if(t.includes(n))return;for(Y.push(e);Y.length>ut;)Y.shift();}function bo(e={}){if(se||!E())return;se=true,dt=e.consoleLimit??20,ut=e.networkLimit??15;let t=e.ignoreUrls;if(t!==void 0?ne=t.map(n=>n.toLowerCase()):ne=[...ln],e.console!==false){let n=e.consoleLevels??["error","warn"];for(let o of n){let r=ft[o];r&&(_e.add(o),console[o]=(...i)=>{un(o,i),r.apply(console,i);});}}if(e.network!==false&&oe){let n=oe;Te=true,window.fetch=async function(r,i){let s=typeof r=="string"?r:r instanceof URL?r.toString():r.url,a=(i?.method??"GET").toUpperCase(),c=Date.now();try{let l=await n.call(window,r,i);return l.ok||ke({url:s.slice(0,500),method:a,status:l.status,statusText:l.statusText,timestamp:c,durationMs:Date.now()-c}),l}catch(l){throw ke({url:s.slice(0,500),method:a,status:0,statusText:l instanceof Error?l.message:"Network error",timestamp:c,durationMs:Date.now()-c}),l}};}if(e.network!==false&&re&&ie){let n=re,o=ie;Ae=true,XMLHttpRequest.prototype.open=function(r,i,...s){return this.__bf_method=r.toUpperCase(),this.__bf_url=String(i),n.apply(this,[r,i,...s])},XMLHttpRequest.prototype.send=function(...r){let i=this.__bf_method||"GET",s=this.__bf_url||"",a=Date.now();return this.addEventListener("loadend",function(){if(this.status>=400||this.status===0){let c={url:s.slice(0,500),method:i,status:this.status,timestamp:a,durationMs:Date.now()-a};this.statusText&&(c.statusText=this.statusText),ke(c);}},{once:true}),o.apply(this,r)};}}function yo(){if(se){for(let e of _e){let t=ft[e];t&&(console[e]=t);}_e.clear(),Te&&oe&&(window.fetch=oe,Te=false),Ae&&re&&ie&&(XMLHttpRequest.prototype.open=re,XMLHttpRequest.prototype.send=ie,Ae=false),ne=[],se=false;}}function Eo(){return {consoleLogs:[...Q],networkErrors:[...Y]}}function vo(){Q=[],Y=[];}var fn=[{name:"supabase_service_role_key",pattern:/SUPABASE_SERVICE_ROLE_KEY["'=:\s]{1,8}[A-Za-z0-9_.=-]{30,400}/},{name:"supabase_db_password",pattern:/SUPABASE_DB_PASSWORD["'=:\s]{1,8}[^\s"']{6,200}/},{name:"postgres_password",pattern:/POSTGRES_PASSWORD["'=:\s]{1,8}[^\s"']{6,200}/},{name:"database_url_with_creds",pattern:/(?:postgres|postgresql|mysql|mongodb|redis|amqp):\/\/[^:\s"']{1,100}:[^@\s"']{1,200}@/},{name:"aws_access_key",pattern:/AKIA[0-9A-Z]{16}/},{name:"aws_secret_key",pattern:/AWS_SECRET_ACCESS_KEY["'=:\s]{1,8}[A-Za-z0-9/+=]{30,200}/},{name:"aws_session_token",pattern:/AWS_SESSION_TOKEN["'=:\s]{1,8}[A-Za-z0-9/+=]{30,600}/},{name:"stripe_secret_key",pattern:/sk_live_[a-zA-Z0-9]{10,200}/},{name:"stripe_secret_key_test",pattern:/sk_test_[a-zA-Z0-9]{10,200}/},{name:"stripe_restricted_key",pattern:/rk_(?:live|test)_[a-zA-Z0-9]{10,200}/},{name:"github_pat",pattern:/ghp_[A-Za-z0-9_]{36,100}/},{name:"github_oauth",pattern:/gho_[A-Za-z0-9_]{36,100}/},{name:"github_user_token",pattern:/ghu_[A-Za-z0-9_]{36,100}/},{name:"github_server_token",pattern:/ghs_[A-Za-z0-9_]{36,100}/},{name:"github_fine_grained",pattern:/github_pat_[A-Za-z0-9_]{22,200}/},{name:"openai_api_key",pattern:/sk-[a-zA-Z0-9]{20,200}(?![a-zA-Z0-9_])/},{name:"anthropic_api_key",pattern:/sk-ant-[a-zA-Z0-9\-_]{20,200}/},{name:"private_key",pattern:/-----BEGIN (?:RSA |EC |DSA |OPENSSH |PGP )?PRIVATE KEY-----/},{name:"sendgrid_api_key",pattern:/SG\.[a-zA-Z0-9_-]{22,100}\.[a-zA-Z0-9_-]{22,100}/},{name:"twilio_auth_token",pattern:/TWILIO_AUTH_TOKEN["'=:\s]{1,8}[a-f0-9]{32}/},{name:"generic_secret_key",pattern:/[A-Z_]{2,60}_SECRET_KEY["'=:\s]{1,8}[^\s"']{8,200}/},{name:"generic_secret",pattern:/[A-Z_]{2,60}_SECRET["'=:\s]{1,8}[^\s"']{8,200}/},{name:"generic_password",pattern:/[A-Z_]{2,60}_PASSWORD["'=:\s]{1,8}[^\s"']{6,200}/},{name:"generic_private_key_var",pattern:/[A-Z_]{2,60}_PRIVATE_KEY["'=:\s]{1,8}[^\s"']{8,400}/}],H=[],xe=0,Re=false;function mn(e){let t=e.slice(0,80);return t.length<=6?"***":t.slice(0,6)+"***"}function pn(e,t,n,o){if(H.some(s=>s.rule===e&&s.source===t))return;let i={rule:e,source:t,hint:mn(n),timestamp:Date.now()};o&&(i.location=o),H.push(i);}function G(e,t,n,o){for(let{name:r,pattern:i}of n){let s=i.exec(e);s&&pn(r,t,s[0],o);}}function gn(e){try{let t=window;if(t.__NEXT_DATA__){let n=JSON.stringify(t.__NEXT_DATA__);G(n,"hydration",e,"__NEXT_DATA__");}if(t.__NUXT__){let n=JSON.stringify(t.__NUXT__);G(n,"hydration",e,"__NUXT__");}}catch{}}function hn(e){try{document.querySelectorAll("script:not([src])").forEach((n,o)=>{let r=n.textContent;r&&r.length>0&&G(r,"scripts",e,`inline-script[${o}]`);});}catch{}}function wn(e){try{document.querySelectorAll("meta[content]").forEach(n=>{let o=n.getAttribute("content"),r=n.getAttribute("name")||n.getAttribute("property")||"";o&&o.length>10&&G(o,"meta",e,r?`meta[${r}]`:void 0);});}catch{}}function bn(e){try{document.querySelectorAll("[data-api-key], [data-secret], [data-token], [data-password]").forEach(n=>{let o=n.attributes;for(let r=0;r<o.length;r++){let i=o[r];i.name.startsWith("data-")&&i.value.length>10&&G(i.value,"dom",e,`${n.tagName.toLowerCase()}[${i.name}]`);}});}catch{}}function _o(e={}){if(Re||!E()||(Re=true,e.secretScan===false))return;let t=[...fn,...e.customPatterns??[]],n=e.scanTargets??["hydration","scripts","meta","dom"];setTimeout(()=>{xe=Date.now(),n.includes("hydration")&&gn(t),n.includes("scripts")&&hn(t),n.includes("meta")&&wn(t),n.includes("dom")&&bn(t);let o=e.notify??"both";H.length>0&&(o==="console"||o==="both")&&console.warn(`[BlocFeed Security] Found ${H.length} potential secret(s) exposed in client code:`,H.map(r=>`${r.rule} (${r.source}${r.location?`: ${r.location}`:""})`));},100);}function To(){return {findings:[...H],scannedAt:xe}}function Ao(){H=[],xe=0,Re=false;}
|
|
2
|
-
exports.a=E;exports.b=le;exports.c=Ue;exports.d=$e;exports.e=ze;exports.f=we;exports.g=Xe;exports.h=Fn;exports.i=Mn;exports.j=Dt;exports.k=Lt;exports.l=qt;exports.m=be;exports.n=jt;exports.o=ye;exports.p=Gt;exports.q=Wn;exports.r=at;exports.s=go;exports.t=bo;exports.u=yo;exports.v=Eo;exports.w=vo;exports.x=_o;exports.y=To;exports.z=Ao;
|