gotcha-feedback 1.1.8 → 1.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -156,6 +156,6 @@ import {createContext,useState,useMemo,useEffect,useCallback,useRef,useContext}f
|
|
|
156
156
|
transition-duration: 0.01ms !important;
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
|
-
`.trim()}function He(e){if(typeof document>"u")return;if(!document.getElementById(Oo)){let o=document.createElement("link");o.rel="preconnect",o.href="https://fonts.googleapis.com",document.head.appendChild(o);let t=document.createElement("link");t.rel="preconnect",t.href="https://fonts.gstatic.com",t.crossOrigin="anonymous",document.head.appendChild(t);let n=document.createElement("link");n.id=Oo,n.rel="stylesheet",n.href="https://fonts.googleapis.com/css2?family=Carter+One&family=DM+Sans:wght@400;500;600;700&display=swap",document.head.appendChild(n);}let r=document.getElementById(Uo);r||(r=document.createElement("style"),r.id=Uo,document.head.appendChild(r)),r.textContent=Ft(e);}var No=createContext(null),Lt={};function $t({apiKey:e,children:r,baseUrl:o,debug:t=false,disabled:n=false,defaultUser:g,themeConfig:l}){let[u,p]=useState(null);o&&!o.startsWith("https://")&&!o.startsWith("/")&&!o.includes("localhost")&&console.warn("[Gotcha] baseUrl should use HTTPS in production:",o);let s=useMemo(()=>Lo({apiKey:e,baseUrl:o,debug:t}),[e,o,t]),a=useMemo(()=>g??Lt,[JSON.stringify(g)]);useEffect(()=>{let c=oe("light","light",l);He(c);},[l]),useEffect(()=>(Ao(),()=>Io()),[]),useEffect(()=>{s.flushQueue();let c=()=>s.flushQueue();return window.addEventListener("online",c),()=>window.removeEventListener("online",c)},[s]);let h=useCallback(c=>{p(c);},[]),d=useCallback(()=>{p(null);},[]),i=useMemo(()=>({client:s,disabled:n,defaultUser:a,debug:t,activeModalId:u,openModal:h,closeModal:d,themeConfig:l}),[s,n,a,t,u,h,d,l]);return jsx(No.Provider,{value:i,children:r})}function F(){let e=useContext(No);if(!e)throw new Error("useGotchaContext must be used within a GotchaProvider");return e}function _t(e,r){let o=new Date(e).getTime();if(isNaN(o))return true;let t=Date.now()-o,n=r*24*60*60*1e3;return t>=n}function Wo(e){let{client:r,defaultUser:o}=F(),[t,n]=useState(false),[g,l]=useState(false),[u,p]=useState(null),[s,a]=useState(null);return useEffect(()=>{process.env.NODE_ENV!=="production"&&e.cooldownDays&&!e.onePerUser&&console.warn("[Gotcha] cooldownDays has no effect without onePerUser=true");let d=e.user?.id||o?.id;if(!d||!e.onePerUser){a(null);return}let i=false;return (async()=>{l(true);try{let f=await r.checkExistingResponse(e.elementId,d);i||(f&&e.cooldownDays&&e.cooldownDays>0&&_t(f.createdAt,e.cooldownDays)?a(null):a(f));}catch{i||a(null);}finally{i||l(false);}})(),()=>{i=true;}},[r,e.elementId,e.user?.id,o?.id,e.onePerUser,e.cooldownDays]),{submit:useCallback(async d=>{n(true),p(null);try{let i=e.user?.id||o?.id,c;return e.onePerUser&&s&&i?c=await r.updateResponse(s.id,{content:d.content,title:d.title,rating:d.rating,vote:d.vote,pollSelected:d.pollSelected},i):c=await r.submitResponse({elementId:e.elementId,mode:e.mode,content:d.content,title:d.title,rating:d.rating,vote:d.vote,pollOptions:e.pollOptions,pollSelected:d.pollSelected,isBug:d.isBug,screenshot:d.screenshot,user:{...o,...e.user}}),e.onePerUser&&a({id:c.id,mode:e.mode,content:d.content??null,title:d.title??null,rating:d.rating??null,vote:d.vote??null,pollSelected:d.pollSelected??null,createdAt:c.createdAt}),e.onSuccess?.(c),c}catch(i){let c=i instanceof Error?i.message:"Something went wrong";throw p(c),e.onError?.(i instanceof Error?i:new Error(c)),i}finally{n(false);}},[r,o,e,s]),isLoading:t,isCheckingExisting:g,error:u,existingResponse:s,isEditing:!!s,clearError:()=>p(null)}}function Vo(e,r){return `${W.HIDDEN_UNTIL}_${e}_${r}`}function Yo(e,r,o){if(!o||o<=0)return false;let t=Vo(e,r),n=J(t);return n?new Date(n).getTime()>Date.now():false}function Ko(e){let{elementId:r,userId:o,hideAfterSubmitDays:t}=e,n=useMemo(()=>o||$e(),[o]),[g,l]=useState(()=>Yo(r,n,t));useEffect(()=>{l(Yo(r,n,t));},[r,n,t]);let u=useCallback(()=>{if(!t||t<=0)return;let p=Vo(r,n),s=new Date(Date.now()+t*24*60*60*1e3);Z(p,s.toISOString()),l(true);},[r,n,t]);return {isHidden:g,markHidden:u}}function Kt(e){return `${W.VISIT_COUNT}_${e}`}function jo(e){let{elementId:r,showAfterSeconds:o,showAfterScrollPercent:t,showAfterVisits:n}=e,g=o!=null||t!=null||n!=null,[l,u]=useState(!o),[p,s]=useState(!t),[a]=useState(()=>{if(!n)return true;let h=Kt(r),i=parseInt(J(h)||"0",10)+1;return Z(h,String(i)),i>=n});return useEffect(()=>{if(!o||o<=0)return;let h=Date.now(),d=o*1e3,i=()=>{Date.now()-h>=d?u(true):c=setTimeout(i,Math.min(1e3,d-(Date.now()-h)));},c=setTimeout(i,Math.min(1e3,d));return ()=>clearTimeout(c)},[o]),useEffect(()=>{if(!t||t<=0)return;let h=()=>{let d=document.documentElement.scrollHeight,i=window.innerHeight;if(d<=i){s(true);return}(window.scrollY+i)/d*100>=t&&s(true);};if(h(),!p)return window.addEventListener("scroll",h,{passive:true}),()=>window.removeEventListener("scroll",h)},[t,p]),{conditionsMet:!g||l&&p&&a}}function Ne(...e){return e.filter(Boolean).join(" ")}var O=()=>typeof window>"u"?false:"ontouchstart"in window||navigator.maxTouchPoints>0,Xo=(e,r)=>{let o={sm:{desktop:24,mobile:28},md:{desktop:32,mobile:34},lg:{desktop:40,mobile:40}};return r?o[e].mobile:o[e].desktop};function jt(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function qo({size:e,theme:r,customStyles:o,showOnHover:t,touchBehavior:n,onClick:g,isOpen:l,isParentHovered:u=false,animated:p=true,queuedCount:s=0}){let[a,h]=useState(false),[d,i]=useState(false),[c,f]=useState(jt),[S,x]=useState(false),[B,k]=useState(false),[A,D]=useState(false),{themeConfig:y}=F();useEffect(()=>{if(h(O()),typeof window>"u")return;let U=window.matchMedia("(prefers-color-scheme: dark)"),b=H=>f(H.matches?"dark":"light");return U.addEventListener("change",b),()=>U.removeEventListener("change",b)},[]);let w=l?true:!a&&t?u:a&&n==="tap-to-reveal"?d:true;useEffect(()=>{if(w&&!A){let U=setTimeout(()=>D(true),600);return ()=>clearTimeout(U)}},[w,A]);let E=()=>{if(a&&n==="tap-to-reveal"&&!d){i(true);return}g();},T=Xo(e,a),v=useMemo(()=>oe(r,c,y),[r,c,y]),z=()=>w?B?"scale(0.95)":S?"scale(1.08)":"scale(1)":"scale(0.6)",ne={width:T,height:T,borderRadius:"50%",border:v.colors.glassBorder,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",background:v.colors.glassBackground,backdropFilter:"blur(20px) saturate(180%)",WebkitBackdropFilter:"blur(20px) saturate(180%)",color:v.colors.glassColor,boxShadow:S?v.colors.glassHoverShadow:v.colors.glassShadow,transition:A?`all 0.3s ${v.animation.easing.spring}`:"none",opacity:w?1:0,transform:z(),filter:B?"brightness(0.95)":"brightness(1)",pointerEvents:w?"auto":"none",...p&&w&&!A?{animation:"gotcha-bubble-pop 500ms cubic-bezier(0.175, 0.885, 0.32, 1.275) both, gotcha-arrive-glow 1200ms ease-in-out 600ms both"}:{},...o?.button};return jsxs("button",{type:"button",onClick:E,onMouseEnter:()=>x(true),onMouseLeave:()=>{x(false),k(false);},onMouseDown:()=>k(true),onMouseUp:()=>k(false),onTouchStart:()=>k(true),onTouchEnd:()=>k(false),style:ne,className:Ne("gotcha-button",l&&"gotcha-button--open"),"aria-label":"Give feedback on this feature","aria-expanded":l,"aria-haspopup":"dialog",children:[jsx(Xt,{size:T*.65,animated:p}),s>0&&jsx("div",{"aria-label":`${s} queued`,style:{position:"absolute",top:-2,right:-2,width:8,height:8,borderRadius:"50%",backgroundColor:v.colors.warning,border:"1.5px solid rgba(255,255,255,0.9)"}})]})}function Xt({size:e,animated:r=true}){let[o,t]=useState(false);return useEffect(()=>{t(true);},[]),jsx("span",{"aria-hidden":"true",style:{fontFamily:"'Carter One', cursive",fontSize:e,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center",marginTop:e*.05,marginRight:e*.05,userSelect:"none",opacity:r?0:o?1:0,...r&&o?{animation:"gotcha-letter-in 350ms cubic-bezier(0.25, 0.46, 0.45, 0.94) 200ms both"}:{}},children:"G"})}function L({size:e=16,color:r="currentColor"}){return jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",style:{animation:"gotcha-spin 0.8s linear infinite"},children:[jsx("circle",{cx:"12",cy:"12",r:"10",stroke:r,strokeWidth:"2",strokeOpacity:"0.12"}),jsx("circle",{cx:"12",cy:"12",r:"10",stroke:r,strokeWidth:"2",strokeLinecap:"round",style:{animation:"gotcha-dash 1.2s ease-in-out infinite"}})]})}function Zo({src:e,onRemove:r,resolvedTheme:o}){return jsxs("div",{style:{position:"relative",marginTop:10,borderRadius:o.borders.radius.md,overflow:"hidden",border:`1px solid ${o.colors.border}`},children:[jsx("img",{src:e,alt:"Screenshot",style:{display:"block",width:"100%",maxHeight:120,objectFit:"cover"}}),jsx("button",{type:"button",onClick:r,"aria-label":"Remove screenshot",style:{position:"absolute",top:4,right:4,width:22,height:22,borderRadius:"50%",border:"none",backgroundColor:"rgba(0,0,0,0.6)",color:"#fff",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",fontSize:12,lineHeight:1},children:jsx("svg",{width:10,height:10,viewBox:"0 0 14 14",fill:"none",children:jsx("path",{d:"M1 1L13 13M1 13L13 1",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]})}function et({resolvedTheme:e,placeholder:r,submitText:o,isLoading:t,onSubmit:n,customStyles:g,initialValues:l,isEditing:u=false,showText:p=true,showRating:s=true,enableBugFlag:a=false,bugFlagLabel:h,enableScreenshot:d=false}){let[i,c]=useState(l?.content||""),[f,S]=useState(l?.rating??null),[x,B]=useState(false),[k,A]=useState(false),[D,y]=useState(null),[w,E]=useState(false);useEffect(()=>{A(O());},[]),useEffect(()=>{l?.content!==void 0&&c(l.content||""),l?.rating!==void 0&&S(l.rating??null);},[l?.content,l?.rating]);let T=p&&s?i.trim().length>0||f!==null:p?i.trim().length>0:s?f!==null:false,v=async()=>{E(true);try{let{captureScreenshot:b}=await import('./screenshot-CTLYS27H.mjs'),H=await b();H&&y(H);}catch{}finally{E(false);}},z=b=>{b.preventDefault(),T&&n({content:p&&i.trim()?i.trim():void 0,rating:s&&f!==null?f:void 0,isBug:x||void 0,screenshot:D||void 0});},ne={width:"100%",padding:k?"12px 14px":"10px 12px",border:`1px solid ${e.colors.inputBorder}`,borderRadius:e.borders.radius.md,backgroundColor:e.colors.inputBackground,color:e.colors.text,fontSize:k?e.typography.fontSize.lg:e.typography.fontSize.md,resize:"none",minHeight:k?100:80,fontFamily:e.typography.fontFamily,outline:"none",transition:`border-color ${e.animation.duration.fast} ${e.animation.easing.default}, box-shadow ${e.animation.duration.fast} ${e.animation.easing.default}`,lineHeight:1.5,boxShadow:"inset 0 1px 2px rgba(0,0,0,0.04)",...g?.input},U={width:"100%",padding:k?"14px 16px":"10px 16px",border:e.colors.buttonBorder,borderRadius:e.borders.radius.md,backgroundColor:e.colors.buttonBackground,color:e.colors.buttonColor,fontSize:k?e.typography.fontSize.lg:e.typography.fontSize.md,fontWeight:e.typography.fontWeight.medium,fontFamily:e.typography.fontFamily,cursor:t?"not-allowed":"pointer",transition:`all ${e.animation.duration.fast} ${e.animation.easing.default}`,letterSpacing:"0.01em",...g?.submitButton};return jsxs("form",{onSubmit:z,children:[s&&jsx("div",{style:{marginBottom:p?k?16:12:0,...p?{}:{display:"flex",justifyContent:"center",padding:"8px 0"}},children:jsx(or,{value:f,onChange:S,theme:e,isTouch:k,large:!p})}),p&&jsx("textarea",{value:i,onChange:b=>c(b.target.value),placeholder:r||"Share your thoughts...",maxLength:5e3,style:ne,disabled:t,"aria-label":"Your feedback",onFocus:b=>{b.currentTarget.style.borderColor=e.colors.inputBorderFocus,b.currentTarget.style.boxShadow=`0 0 0 3px ${e.colors.inputFocusRing}`,b.currentTarget.style.backgroundColor=e.colors.inputBackgroundFocus;},onBlur:b=>{b.currentTarget.style.borderColor=e.colors.inputBorder,b.currentTarget.style.boxShadow="inset 0 1px 2px rgba(0,0,0,0.04)",b.currentTarget.style.backgroundColor=e.colors.inputBackground;}}),a&&jsxs("button",{type:"button",role:"switch","aria-checked":x,onClick:()=>B(!x),style:{display:"flex",alignItems:"center",gap:7,width:"100%",marginTop:10,padding:"7px 10px",border:`1px solid ${x?e.colors.warningBorder:e.colors.border}`,borderRadius:7,backgroundColor:x?e.colors.warningSurface:"transparent",cursor:"pointer",transition:`all ${e.animation.duration.fast} ${e.animation.easing.default}`,fontFamily:e.typography.fontFamily,...g?.bugFlag},onMouseEnter:b=>{x||(b.currentTarget.style.backgroundColor=e.colors.surfaceHover===e.colors.inputBackgroundFocus?"rgba(0,0,0,0.02)":e.colors.surfaceHover);},onMouseLeave:b=>{x||(b.currentTarget.style.backgroundColor="transparent");},children:[jsx("svg",{width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:x?e.colors.warningActive:e.colors.textDisabled,strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,transition:`stroke ${e.animation.duration.fast}`},children:jsx("path",{d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"})}),jsx("span",{style:{fontSize:12,fontWeight:x?e.typography.fontWeight.medium:e.typography.fontWeight.normal,color:x?e.colors.warningActive:e.colors.textDisabled,transition:`color ${e.animation.duration.fast}`,letterSpacing:"0.01em"},children:x?"Issue reported":h||"Report an issue"}),jsx("div",{style:{marginLeft:"auto",width:28,height:16,borderRadius:8,backgroundColor:x?e.colors.warning:e.colors.border,position:"relative",transition:`background-color ${e.animation.duration.fast} ${e.animation.easing.default}`,flexShrink:0},children:jsx("div",{style:{position:"absolute",top:2,left:x?14:2,width:12,height:12,borderRadius:"50%",backgroundColor:x?"#ffffff":e.colors.textDisabled,transition:`left ${e.animation.duration.fast} ${e.animation.easing.default}, background-color ${e.animation.duration.fast}`,boxShadow:"0 1px 2px rgba(0,0,0,0.15)"}})})]}),a&&d&&x&&!D&&jsxs("button",{type:"button",onClick:v,disabled:w,style:{display:"flex",alignItems:"center",gap:6,width:"100%",marginTop:8,padding:"7px 10px",border:`1px solid ${e.colors.border}`,borderRadius:7,backgroundColor:"transparent",cursor:w?"not-allowed":"pointer",fontFamily:e.typography.fontFamily,fontSize:12,color:e.colors.textSecondary,transition:`all ${e.animation.duration.fast} ${e.animation.easing.default}`},onMouseEnter:b=>{b.currentTarget.style.backgroundColor=e.colors.surfaceHover;},onMouseLeave:b=>{b.currentTarget.style.backgroundColor="transparent";},children:[w?jsx(L,{size:14,color:e.colors.textSecondary}):jsxs("svg",{width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),jsx("circle",{cx:"12",cy:"10",r:"3"}),jsx("path",{d:"M2 17l4-4 3 3 4-4 9 9"})]}),w?"Capturing...":"Capture screenshot"]}),a&&d&&x&&D&&jsx(Zo,{src:D,onRemove:()=>y(null),resolvedTheme:e}),jsxs("button",{type:"submit",disabled:t||!T,style:{...U,marginTop:12,opacity:t?.8:1,backgroundColor:T?e.colors.buttonBackground:e.colors.buttonBackgroundDisabled,color:T?e.colors.buttonColor:e.colors.buttonColorDisabled,display:"flex",alignItems:"center",justifyContent:"center",gap:8,...t?{backgroundImage:"linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.1) 50%, transparent 100%)",backgroundSize:"200% 100%",animation:"gotcha-shimmer 1.5s ease infinite"}:{}},onMouseEnter:b=>{b.currentTarget.disabled||(b.currentTarget.style.backgroundColor=e.colors.buttonBackgroundHover,b.currentTarget.style.transform="translateY(-1px)",b.currentTarget.style.boxShadow=e.shadows.button);},onMouseLeave:b=>{b.currentTarget.disabled||(b.currentTarget.style.backgroundColor=e.colors.buttonBackground,b.currentTarget.style.transform="translateY(0)",b.currentTarget.style.boxShadow="none");},children:[t&&jsx(L,{size:k?18:16,color:e.colors.buttonColor}),t?u?"Updating...":"Submitting...":u?"Update":o]})]})}function or({value:e,onChange:r,theme:o,isTouch:t,large:n=false}){let[g,l]=useState(null),[u,p]=useState(null),s=useRef(),a=n?t?36:28:t?28:18,h=n?t?8:5:t?8:3;useEffect(()=>()=>{clearTimeout(s.current);},[]);let d=i=>{p(i),r(i),clearTimeout(s.current),s.current=setTimeout(()=>p(null),300);};return jsx("div",{style:{display:"flex",gap:n?t?8:6:t?6:2},role:"group","aria-label":"Rating",children:[1,2,3,4,5].map(i=>{let c=(g??e??0)>=i;return jsx("button",{type:"button",onClick:()=>d(i),onMouseEnter:()=>l(i),onMouseLeave:()=>l(null),"aria-label":`Rate ${i} out of 5`,"aria-pressed":e===i,style:{background:"none",border:"none",cursor:"pointer",padding:h,color:c?o.colors.starFilled:o.colors.starEmpty,transition:`color 0.15s ${o.animation.easing.default}`,transform:u===i?"scale(1)":g!==null&&g>=i?"scale(1.1)":"scale(1)",animation:u===i?`gotcha-star-pulse 0.3s ${o.animation.easing.spring}`:"none",filter:c?`drop-shadow(0 0 3px ${o.colors.starFilled}40)`:"none",transitionDelay:`${(i-1)*30}ms`},children:jsx("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"currentColor",children:jsx("path",{d:"M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"})})},i)})})}function ot({resolvedTheme:e,isLoading:r,onSubmit:o,initialVote:t,isEditing:n=false,labels:g}){let[l,u]=useState(false),[p,s]=useState(t||null),[a,h]=useState(t||null);useEffect(()=>{u(O());},[]),useEffect(()=>{t!==void 0&&(h(t),s(t));},[t]),useEffect(()=>{!r&&!n&&s(null);},[r,n]);let d=f=>{s(f),o({vote:f});},i=f=>{let S=a===f,x=f==="up"?e.colors.voteUp:e.colors.voteDown,B=f==="up"?e.colors.voteUpSurface:e.colors.voteDownSurface,k=f==="up"?e.colors.voteUpBorder:e.colors.voteDownBorder;return {flex:1,minWidth:0,overflow:"hidden",padding:l?"14px 18px":"10px 14px",border:S?`2px solid ${k}`:`1px solid ${e.colors.border}`,borderRadius:e.borders.radius.lg-2,background:S?`linear-gradient(135deg, ${B}, ${B})`:e.colors.surface,color:S?x:e.colors.textSecondary,fontSize:l?28:24,fontFamily:e.typography.fontFamily,cursor:r?"not-allowed":"pointer",transition:`all 0.2s ${e.animation.easing.default}`,display:"flex",alignItems:"center",justifyContent:"center",gap:l?10:8}},c=l?24:20;return jsxs("div",{style:{display:"flex",gap:l?12:10},role:"group","aria-label":"Vote",children:[jsx("button",{type:"button",onClick:()=>d("up"),disabled:r,style:i("up"),"aria-label":"Vote up - I like this","aria-pressed":a==="up",onMouseEnter:f=>{r||(f.currentTarget.style.transform="translateY(-2px) scale(1.02)",f.currentTarget.style.boxShadow=e.shadows.button);},onMouseLeave:f=>{f.currentTarget.style.transform="translateY(0) scale(1)",f.currentTarget.style.boxShadow="none";},children:r&&p==="up"?jsxs(Fragment,{children:[jsx(L,{size:c,color:e.colors.text}),jsx("span",{style:{fontSize:l?15:13,fontWeight:e.typography.fontWeight.medium,letterSpacing:"0.01em"},children:n?"Updating...":"Sending..."})]}):jsxs(Fragment,{children:[jsx(tr,{size:c}),jsx("span",{style:{fontSize:l?15:13,fontWeight:e.typography.fontWeight.medium,letterSpacing:"0.01em"},children:g?.up||(a==="up"?"Liked":"Like")})]})}),jsx("button",{type:"button",onClick:()=>d("down"),disabled:r,style:i("down"),"aria-label":"Vote down - I don't like this","aria-pressed":a==="down",onMouseEnter:f=>{r||(f.currentTarget.style.transform="translateY(-2px) scale(1.02)",f.currentTarget.style.boxShadow=e.shadows.button);},onMouseLeave:f=>{f.currentTarget.style.transform="translateY(0) scale(1)",f.currentTarget.style.boxShadow="none";},children:r&&p==="down"?jsxs(Fragment,{children:[jsx(L,{size:c,color:e.colors.text}),jsx("span",{style:{fontSize:l?15:13,fontWeight:e.typography.fontWeight.medium,letterSpacing:"0.01em"},children:n?"Updating...":"Sending..."})]}):jsxs(Fragment,{children:[jsx(rr,{size:c}),jsx("span",{style:{fontSize:l?15:13,fontWeight:e.typography.fontWeight.medium,letterSpacing:"0.01em"},children:g?.down||(a==="down"?"Disliked":"Dislike")})]})})]})}function tr({size:e=24}){return jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3"})})}function rr({size:e=24}){return jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17"})})}function nt({resolvedTheme:e,options:r,allowMultiple:o,isLoading:t,onSubmit:n,initialSelected:g,isEditing:l=false}){let[u,p]=useState(g||[]),[s,a]=useState(false);useEffect(()=>{a(O());},[]),useEffect(()=>{g&&p(g);},[g]);let h=c=>{p(o?f=>f.includes(c)?f.filter(S=>S!==c):[...f,c]:f=>f.includes(c)?[]:[c]);},d=()=>{u.length!==0&&n({pollSelected:u});},i=(c,f)=>{let S=u.includes(c);return {width:"100%",padding:s?"12px 14px":"9px 12px",border:`1px solid ${S?e.colors.pollSelectedBorder:e.colors.pollBorder}`,borderRadius:e.borders.radius.lg-2,backgroundColor:S?e.colors.pollSelectedBackground:e.colors.pollBackground,color:S?e.colors.pollSelectedColor:e.colors.pollColor,fontSize:s?15:e.typography.fontSize.sm,fontWeight:S?e.typography.fontWeight.semibold:e.typography.fontWeight.medium,fontFamily:e.typography.fontFamily,cursor:t?"not-allowed":"pointer",transition:`all 0.2s ${e.animation.easing.default}`,textAlign:"left",letterSpacing:"0.01em",display:"flex",alignItems:"center",gap:8,animation:`gotcha-fade-up ${e.animation.duration.normal} ${e.animation.easing.default} both`,animationDelay:`${f*.05}s`}};return jsxs("div",{children:[jsx("div",{style:{display:"flex",flexDirection:"column",gap:s?8:6},role:"group","aria-label":o?"Select one or more options":"Select an option",children:r.map((c,f)=>{let S=u.includes(c);return jsxs("button",{type:"button",onClick:()=>h(c),disabled:t,style:i(c,f),"aria-pressed":S,onMouseEnter:x=>{t||(x.currentTarget.style.transform="translateX(2px)");},onMouseLeave:x=>{x.currentTarget.style.transform="translateX(0)";},children:[jsx("span",{style:{width:16,height:16,borderRadius:o?4:"50%",border:`2px solid ${S?e.colors.pollCheckSelectedBorder:e.colors.pollCheckBorder}`,backgroundColor:S?e.colors.pollCheckSelectedBg:"transparent",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:`all ${e.animation.duration.fast}`},children:S&&jsx("svg",{width:10,height:10,viewBox:"0 0 12 12",fill:"none",children:jsx("path",{d:"M2 6l3 3 5-5",stroke:"#fff",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),c]},c)})}),jsxs("button",{type:"button",onClick:d,disabled:t||u.length===0,style:{width:"100%",marginTop:12,padding:s?"14px 16px":"10px 16px",border:e.colors.buttonBorder,borderRadius:e.borders.radius.md,backgroundColor:u.length===0?e.colors.buttonBackgroundDisabled:e.colors.buttonBackground,color:u.length===0?e.colors.buttonColorDisabled:e.colors.buttonColor,fontSize:s?e.typography.fontSize.lg:e.typography.fontSize.md,fontWeight:e.typography.fontWeight.medium,fontFamily:e.typography.fontFamily,cursor:t||u.length===0?"not-allowed":"pointer",transition:`all ${e.animation.duration.fast} ${e.animation.easing.default}`,letterSpacing:"0.01em",display:"flex",alignItems:"center",justifyContent:"center",gap:8,opacity:t?.8:1,...t?{backgroundImage:"linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.1) 50%, transparent 100%)",backgroundSize:"200% 100%",animation:"gotcha-shimmer 1.5s ease infinite"}:{}},onMouseEnter:c=>{c.currentTarget.disabled||(c.currentTarget.style.backgroundColor=e.colors.buttonBackgroundHover,c.currentTarget.style.transform="translateY(-1px)",c.currentTarget.style.boxShadow=e.shadows.button);},onMouseLeave:c=>{c.currentTarget.disabled||(c.currentTarget.style.backgroundColor=u.length===0?e.colors.buttonBackgroundDisabled:e.colors.buttonBackground,c.currentTarget.style.transform="translateY(0)",c.currentTarget.style.boxShadow="none");},children:[t&&jsx(L,{size:s?18:16,color:e.colors.buttonColor}),t?l?"Updating...":"Submitting...":l?"Update":"Submit"]})]})}function at({resolvedTheme:e,submitText:r,isLoading:o,onSubmit:t,customStyles:n,showFollowUp:g=true,followUpPlaceholder:l,lowLabel:u="Not likely",highLabel:p="Very likely",initialValues:s,isEditing:a=false}){let[h,d]=useState(s?.rating??null),[i,c]=useState(s?.content||""),[f,S]=useState(false),[x,B]=useState(null);useEffect(()=>{S(O());},[]),useEffect(()=>{s?.rating!==void 0&&d(s.rating??null),s?.content!==void 0&&c(s.content||"");},[s?.rating,s?.content]);let k=h!==null,A=e.colors.npsColors;return jsxs("form",{onSubmit:y=>{y.preventDefault(),k&&t({rating:h??void 0,content:g&&i.trim()?i.trim():void 0});},children:[jsxs("div",{children:[jsx("div",{style:{display:"flex",gap:f?4:6,justifyContent:"center"},role:"group","aria-label":"NPS Score",children:Array.from({length:11},(y,w)=>{let E=h===w,T=x===w,v=A[w];return jsx("button",{type:"button",onClick:()=>d(w),onMouseEnter:()=>B(w),onMouseLeave:()=>B(null),"aria-label":`Score ${w} out of 10`,"aria-pressed":E,style:{flex:1,minWidth:0,height:f?34:32,borderRadius:e.borders.radius.sm,border:E?`2px solid ${v}`:`1.5px solid ${v}25`,backgroundColor:E?v:T?`${v}25`:`${v}0c`,color:E?"#fff":T?v:`${v}bb`,fontSize:12,fontWeight:E?e.typography.fontWeight.bold:e.typography.fontWeight.semibold,fontFamily:e.typography.fontFamily,fontVariantNumeric:"tabular-nums",cursor:"pointer",padding:0,display:"flex",alignItems:"center",justifyContent:"center",transition:`all 0.2s ${e.animation.easing.spring}`,transform:E?"scale(1.08)":T?"scale(1.04)":"scale(1)",boxShadow:E?`0 0 12px ${v}40`:"none",...n?.npsButton,...E?n?.npsButtonSelected:{}},children:w},w)})}),jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:6,padding:"0 2px",...n?.npsLabels},children:[jsx("span",{style:{fontSize:e.typography.fontSize.xs,color:e.colors.textDisabled,fontWeight:e.typography.fontWeight.medium,letterSpacing:"0.02em"},children:u}),jsx("span",{style:{fontSize:e.typography.fontSize.xs,color:e.colors.textDisabled,fontWeight:e.typography.fontWeight.medium,letterSpacing:"0.02em"},children:p})]})]}),g&&h!==null&&jsx("textarea",{value:i,onChange:y=>c(y.target.value),placeholder:l||"What's the main reason for your score?",maxLength:5e3,style:{width:"100%",padding:f?"12px 14px":"10px 12px",border:`1px solid ${e.colors.inputBorder}`,borderRadius:e.borders.radius.md,backgroundColor:e.colors.inputBackground,color:e.colors.text,fontSize:f?e.typography.fontSize.lg:e.typography.fontSize.md,resize:"vertical",minHeight:f?80:60,fontFamily:e.typography.fontFamily,outline:"none",transition:`border-color ${e.animation.duration.fast} ${e.animation.easing.default}, box-shadow ${e.animation.duration.fast} ${e.animation.easing.default}`,lineHeight:1.5,animation:`gotcha-expand-in 0.3s ${e.animation.easing.default} both`,overflow:"hidden",...n?.input},disabled:o,"aria-label":"Follow-up feedback",onFocus:y=>{y.currentTarget.style.borderColor=e.colors.inputBorderFocus,y.currentTarget.style.boxShadow=`0 0 0 3px ${e.colors.inputFocusRing}`,y.currentTarget.style.backgroundColor=e.colors.inputBackgroundFocus;},onBlur:y=>{y.currentTarget.style.borderColor=e.colors.inputBorder,y.currentTarget.style.boxShadow="none",y.currentTarget.style.backgroundColor=e.colors.inputBackground;}}),jsxs("button",{type:"submit",disabled:o||!k,style:{width:"100%",padding:f?"14px 16px":"10px 16px",border:e.colors.buttonBorder,borderRadius:e.borders.radius.md,backgroundColor:k?e.colors.buttonBackground:e.colors.buttonBackgroundDisabled,color:k?e.colors.buttonColor:e.colors.buttonColorDisabled,fontSize:f?e.typography.fontSize.lg:e.typography.fontSize.md,fontWeight:e.typography.fontWeight.medium,fontFamily:e.typography.fontFamily,cursor:o?"not-allowed":"pointer",transition:`all ${e.animation.duration.fast} ${e.animation.easing.default}`,letterSpacing:"0.01em",opacity:o?.8:1,display:"flex",alignItems:"center",justifyContent:"center",gap:8,marginTop:12,...o?{backgroundImage:"linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.1) 50%, transparent 100%)",backgroundSize:"200% 100%",animation:"gotcha-shimmer 1.5s ease infinite"}:{},...n?.submitButton},onMouseEnter:y=>{y.currentTarget.disabled||(y.currentTarget.style.backgroundColor=e.colors.buttonBackgroundHover,y.currentTarget.style.transform="translateY(-1px)",y.currentTarget.style.boxShadow=e.shadows.button);},onMouseLeave:y=>{y.currentTarget.disabled||(y.currentTarget.style.backgroundColor=k?e.colors.buttonBackground:e.colors.buttonBackgroundDisabled,y.currentTarget.style.transform="translateY(0)",y.currentTarget.style.boxShadow="none");},children:[o&&jsx(L,{size:f?18:16,color:e.colors.buttonColor}),o?a?"Updating...":"Submitting...":a?"Update":r]})]})}function ct({resolvedTheme:e,promptText:r,placeholder:o,isLoading:t,onSubmit:n}){let[g,l]=useState(""),[u,p]=useState(false);return useEffect(()=>{p(O());},[]),jsxs("form",{onSubmit:a=>{a.preventDefault(),g.trim()&&n(g.trim());},children:[jsx("p",{style:{margin:"0 0 12px 0",fontSize:e.typography.fontSize.sm,color:e.colors.textSecondary,lineHeight:1.4,fontFamily:e.typography.fontFamily},children:r}),jsx("textarea",{value:g,onChange:a=>l(a.target.value),placeholder:o||"Tell us more...",maxLength:5e3,disabled:t,"aria-label":"Follow-up feedback",style:{width:"100%",padding:u?"12px 14px":"10px 12px",border:`1px solid ${e.colors.inputBorder}`,borderRadius:e.borders.radius.md,backgroundColor:e.colors.inputBackground,color:e.colors.text,fontSize:u?e.typography.fontSize.lg:e.typography.fontSize.md,resize:"none",minHeight:u?100:80,fontFamily:e.typography.fontFamily,outline:"none",transition:`border-color ${e.animation.duration.fast} ${e.animation.easing.default}, box-shadow ${e.animation.duration.fast} ${e.animation.easing.default}`,lineHeight:1.5,boxShadow:"inset 0 1px 2px rgba(0,0,0,0.04)"},onFocus:a=>{a.currentTarget.style.borderColor=e.colors.inputBorderFocus,a.currentTarget.style.boxShadow=`0 0 0 3px ${e.colors.inputFocusRing}`,a.currentTarget.style.backgroundColor=e.colors.inputBackgroundFocus;},onBlur:a=>{a.currentTarget.style.borderColor=e.colors.inputBorder,a.currentTarget.style.boxShadow="inset 0 1px 2px rgba(0,0,0,0.04)",a.currentTarget.style.backgroundColor=e.colors.inputBackground;}}),jsxs("button",{type:"submit",disabled:t||!g.trim(),style:{width:"100%",marginTop:12,padding:u?"14px 16px":"10px 16px",border:e.colors.buttonBorder,borderRadius:e.borders.radius.md,backgroundColor:g.trim()?e.colors.buttonBackground:e.colors.buttonBackgroundDisabled,color:g.trim()?e.colors.buttonColor:e.colors.buttonColorDisabled,fontSize:u?e.typography.fontSize.lg:e.typography.fontSize.md,fontWeight:e.typography.fontWeight.medium,fontFamily:e.typography.fontFamily,cursor:t?"not-allowed":"pointer",transition:`all ${e.animation.duration.fast} ${e.animation.easing.default}`,letterSpacing:"0.01em",display:"flex",alignItems:"center",justifyContent:"center",gap:8,opacity:t?.8:1},onMouseEnter:a=>{a.currentTarget.disabled||(a.currentTarget.style.backgroundColor=e.colors.buttonBackgroundHover,a.currentTarget.style.transform="translateY(-1px)",a.currentTarget.style.boxShadow=e.shadows.button);},onMouseLeave:a=>{a.currentTarget.disabled||(a.currentTarget.style.backgroundColor=e.colors.buttonBackground,a.currentTarget.style.transform="translateY(0)",a.currentTarget.style.boxShadow="none");},children:[t&&jsx(L,{size:u?18:16,color:e.colors.buttonColor}),t?"Sending...":"Submit"]})]})}function mo({mode:e,theme:r,customStyles:o,promptText:t,placeholder:n,submitText:g,thankYouMessage:l,isLoading:u,isCheckingExisting:p=false,isSubmitted:s,phase:a="form",followUpConfig:h,followUpLoading:d=false,onFollowUpSubmit:i,error:c,existingResponse:f,isEditing:S=false,showText:x=true,showRating:B=true,voteLabels:k,options:A,allowMultiple:D=false,npsQuestion:y,npsFollowUp:w=true,npsFollowUpPlaceholder:E,npsLowLabel:T,npsHighLabel:v,enableBugFlag:z=false,bugFlagLabel:ne,enableScreenshot:U=false,onSubmit:b,onClose:H,anchorRect:Y,useFixedPosition:je=false}){let Ge=useRef(null),Fe=useRef(null),ge=useRef(H);ge.current=H;let[P,Xe]=useState(false),[De,ze]=useState("light"),{themeConfig:fe}=F();useEffect(()=>{Xe(window.innerWidth<640);let G=window.matchMedia("(prefers-color-scheme: dark)");ze(G.matches?"dark":"light");let j=_=>ze(_.matches?"dark":"light");return G.addEventListener("change",j),()=>G.removeEventListener("change",j)},[]);let m=useMemo(()=>oe(r,De,fe),[r,De,fe]);useEffect(()=>{He(m);},[m]);let me=typeof window>"u"||!Y?false:window.innerHeight-Y.bottom<300;useEffect(()=>{let G=Ge.current;if(!G)return;Fe.current?.focus();let j=_=>{if(_.key==="Escape"){ge.current();return}if(_.key==="Tab"){let ce=G.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),Pe=ce[0],Se=ce[ce.length-1];_.shiftKey&&document.activeElement===Pe?(_.preventDefault(),Se?.focus()):!_.shiftKey&&document.activeElement===Se&&(_.preventDefault(),Pe?.focus());}};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[]);let se=e==="vote"?"What do you think?":e==="poll"?"Cast your vote":e==="nps"?y||"How likely are you to recommend us?":"What do you think of this feature?",he=P?24:20,be=e==="nps"?420:340,qe=P?"gotcha-modal-enter-center":me?"gotcha-modal-enter-above":"gotcha-modal-enter",ye=typeof window<"u"?window.innerHeight:0,V=P?{position:"fixed",left:"50%",top:"50%",transform:"translate(-50%, -50%)",width:"calc(100vw - 32px)",maxWidth:be,padding:he,borderRadius:m.borders.radius.lg+2,background:m.colors.backgroundGradient,color:m.colors.text,boxShadow:m.shadows.modal,border:`${m.borders.width}px solid ${m.colors.border}`,zIndex:9999,fontFamily:m.typography.fontFamily,...o?.modal,textAlign:"left"}:je&&Y&&ye?{position:"fixed",left:Y.left+Y.width/2,width:be,padding:he,borderRadius:m.borders.radius.lg,background:m.colors.backgroundGradient,color:m.colors.text,boxShadow:m.shadows.modal,border:`${m.borders.width}px solid ${m.colors.border}`,zIndex:99999,fontFamily:m.typography.fontFamily,...me?{bottom:ye-Y.top+8,transform:"translateX(-50%)"}:{top:Y.bottom+8,transform:"translateX(-50%)"},...o?.modal,textAlign:"left"}:{position:"absolute",left:"50%",width:be,padding:he,borderRadius:m.borders.radius.lg,background:m.colors.backgroundGradient,color:m.colors.text,boxShadow:m.shadows.modal,border:`${m.borders.width}px solid ${m.colors.border}`,zIndex:9999,fontFamily:m.typography.fontFamily,...me?{bottom:"100%",marginBottom:8,transform:"translateX(-50%)"}:{top:"100%",marginTop:8,transform:"translateX(-50%)"},...o?.modal,textAlign:"left"},K=G=>P?{}:{animation:`gotcha-fade-up ${m.animation.duration.normal} ${m.animation.easing.default} both`,animationDelay:`${G*.05}s`},ae=l==="Gotcha!"||l==="Thanks for your feedback!";return jsxs("div",{ref:Ge,role:"dialog","aria-modal":"true","aria-label":s?"Feedback submitted":void 0,"aria-labelledby":s?void 0:"gotcha-modal-title","data-gotcha":true,style:V,className:Ne("gotcha-modal",qe),children:[jsx("button",{ref:Fe,type:"button",onClick:H,"aria-label":"Close feedback form",style:{position:"absolute",top:P?10:6,right:P?10:6,width:P?40:36,height:P?40:36,border:"none",background:"transparent",outline:"none",cursor:"pointer",zIndex:10,color:m.colors.closeButton,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:m.borders.radius.sm,transition:`all ${m.animation.duration.fast} ${m.animation.easing.default}`,...o?.closeButton},onMouseEnter:G=>{G.currentTarget.style.backgroundColor=m.colors.closeButtonBg,G.currentTarget.style.color=m.colors.closeButtonHover;},onMouseLeave:G=>{G.currentTarget.style.backgroundColor="transparent",G.currentTarget.style.color=m.colors.closeButton;},children:jsx("svg",{width:P?16:14,height:P?16:14,viewBox:"0 0 14 14",fill:"none",children:jsx("path",{d:"M1 1L13 13M1 13L13 1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),!s&&jsx("h2",{id:"gotcha-modal-title",style:{margin:"0 0 16px 0",fontSize:P?m.typography.fontSize.lg:m.typography.fontSize.md,fontWeight:m.typography.fontWeight.semibold,paddingRight:P?44:38,letterSpacing:"-0.02em",lineHeight:1.4,textAlign:"left",fontFamily:m.typography.fontFamily,...K(0),...o?.title},children:t||se}),s&&jsxs("div",{style:{textAlign:"center",padding:"28px 0 20px"},children:[jsx("div",{style:{width:52,height:52,borderRadius:"50%",backgroundColor:m.colors.successSurface,display:"flex",alignItems:"center",justifyContent:"center",margin:"0 auto 16px",animation:`gotcha-success-pop 0.4s ${m.animation.easing.spring} both, gotcha-glow-pulse 0.8s ease 0.4s`,...o?.successIcon},children:jsx("svg",{width:"26",height:"26",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M20 6L9 17L4 12",stroke:m.colors.success,strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",style:{strokeDasharray:24,strokeDashoffset:0,animation:"gotcha-check-draw 0.4s ease 0.2s both"}})})}),jsx("p",{style:{margin:0,fontSize:ae?22:m.typography.fontSize.md,fontWeight:ae?m.typography.fontWeight.bold:m.typography.fontWeight.medium,color:m.colors.text,fontFamily:ae?"'Carter One', cursive":m.typography.fontFamily,animation:"gotcha-success-text 0.3s ease 0.3s both",...o?.successMessage},children:ae?"Gotcha!":l}),ae&&jsx("p",{style:{margin:"6px 0 0",fontSize:m.typography.fontSize.sm,fontWeight:m.typography.fontWeight.normal,color:m.colors.textSecondary,animation:"gotcha-success-text 0.3s ease 0.45s both"},children:"Thanks for your feedback!"})]}),c&&!s&&jsxs("div",{style:{padding:"8px 10px",marginBottom:12,borderRadius:m.borders.radius.sm,backgroundColor:m.colors.errorSurface,border:`1px solid ${m.colors.errorBorder}`,color:m.colors.error,fontSize:m.typography.fontSize.sm,lineHeight:1.4,display:"flex",alignItems:"center",gap:8,...K(1),...o?.errorMessage},children:[jsx("svg",{width:14,height:14,viewBox:"0 0 24 24",fill:"none",style:{flexShrink:0},children:jsx("path",{d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})}),c]}),a==="followUp"&&h&&i&&jsx("div",{style:K(1),children:jsx(ct,{resolvedTheme:m,promptText:h.promptText,placeholder:h.placeholder,isLoading:d,onSubmit:i})}),a==="form"&&p&&jsx("div",{style:{display:"flex",justifyContent:"center",padding:"24px 0",...K(1)},children:jsx(L,{size:24,color:m.colors.textSecondary})}),a==="form"&&!p&&jsxs("div",{style:K(1),children:[e==="feedback"&&jsx(et,{resolvedTheme:m,placeholder:n,submitText:g,isLoading:u,onSubmit:b,customStyles:o,initialValues:f?{content:f.content,rating:f.rating}:void 0,isEditing:S,showText:x,showRating:B,enableBugFlag:z,bugFlagLabel:ne,enableScreenshot:U}),e==="vote"&&jsx(ot,{resolvedTheme:m,isLoading:u,onSubmit:b,initialVote:f?.vote||void 0,isEditing:S,labels:k}),e==="nps"&&jsx(at,{resolvedTheme:m,submitText:g,isLoading:u,onSubmit:b,showFollowUp:w,followUpPlaceholder:E,lowLabel:T,highLabel:v,customStyles:o,initialValues:f?{rating:f.rating,content:f.content}:void 0,isEditing:S}),e==="poll"&&A&&A.length>0&&jsx(nt,{resolvedTheme:m,options:A,allowMultiple:D,isLoading:u,onSubmit:b,initialSelected:f?.pollSelected||void 0,isEditing:S})]}),jsxs("div",{"aria-live":"polite",className:"sr-only",style:{position:"absolute",left:-9999},children:[s&&"Thank you! Your feedback has been submitted.",c&&`Error: ${c}`]})]})}function ar({elementId:e,user:r,mode:o="feedback",showText:t=true,showRating:n=true,voteLabels:g,options:l,allowMultiple:u=false,npsQuestion:p,npsFollowUp:s=true,npsFollowUpPlaceholder:a,npsLowLabel:h,npsHighLabel:d,enableBugFlag:i=false,bugFlagLabel:c,enableScreenshot:f=false,onePerUser:S=false,cooldownDays:x,hideAfterSubmitDays:B,showAfterSeconds:k,showAfterScrollPercent:A,showAfterVisits:D,followUp:y,animated:w=true,position:E=q.POSITION,size:T=q.SIZE,theme:v=q.THEME,customStyles:z,visible:ne=true,showOnHover:U=q.SHOW_ON_HOVER,touchBehavior:b=q.TOUCH_BEHAVIOR,promptText:H,placeholder:Y,submitText:je=q.SUBMIT_TEXT,thankYouMessage:Ge=q.THANK_YOU_MESSAGE,onSubmit:Fe,onOpen:ge,onClose:P,onError:Xe}){let{disabled:De,activeModalId:ze,openModal:fe,closeModal:m,defaultUser:me,client:se}=F(),{conditionsMet:he}=jo({elementId:e,showAfterSeconds:k,showAfterScrollPercent:A,showAfterVisits:D}),{isHidden:be,markHidden:qe}=Ko({elementId:e,userId:r?.id||me?.id,hideAfterSubmitDays:B}),[ye,V]=useState("form"),[K,ae]=useState(null),[G,j]=useState(false),[_,ce]=useState(0),[Pe,Se]=useState(false),[ft,mt]=useState(null),[xe,ht]=useState(false),[yo,bt]=useState(false),ve=useRef(null),we=useRef(),ke=useRef(null);useEffect(()=>(bt(true),ht(window.innerWidth<640),()=>{clearTimeout(we.current);}),[]),useEffect(()=>{ce(se.getQueueLength());let C=()=>{setTimeout(()=>ce(se.getQueueLength()),2e3);};return window.addEventListener("online",C),()=>window.removeEventListener("online",C)},[se]);let X=ze===e;useEffect(()=>{X||(V("form"),clearTimeout(we.current));},[X]),useEffect(()=>{if(!X||!xe)return;let C=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=C;}},[X,xe]),useEffect(()=>{if(!U)return;let C=ve.current;if(!C)return;let N=C.parentElement;if(!N)return;let ko=()=>Se(true),To=()=>Se(false);return N.addEventListener("mouseenter",ko),N.addEventListener("mouseleave",To),()=>{N.removeEventListener("mouseenter",ko),N.removeEventListener("mouseleave",To);}},[U]);let{submit:So,isLoading:yt,isCheckingExisting:St,error:xt,existingResponse:vt,isEditing:xo}=Wo({elementId:e,mode:o,pollOptions:l,user:r,onePerUser:S,cooldownDays:x,onSuccess:C=>{ae(C.id),B&&qe(),Fe?.(C),y&&ke.current&&(y.ratingThreshold!=null&&ke.current.rating!=null&&ke.current.rating<=y.ratingThreshold||y.onNegativeVote&&ke.current.vote==="down")&&o!=="poll"?V("followUp"):(V("success"),we.current=setTimeout(()=>{m(),V("form");},3e3));},onError:C=>{console.warn("[Gotcha] Submission failed:",C instanceof Error?C.message:C),Xe?.(C);}}),wt=useCallback(()=>{if(ve.current){let C=ve.current.querySelector(".gotcha-button");mt((C||ve.current).getBoundingClientRect());}fe(e),ge?.();},[e,fe,ge]),vo=useCallback(()=>{clearTimeout(we.current),m(),V("form"),P?.();},[m,P]),kt=useCallback(C=>{ke.current={rating:C.rating,vote:C.vote},So(C);},[So]),Tt=useCallback(async C=>{if(K){j(true);try{await se.updateResponse(K,{content:C});}catch(N){console.warn("[Gotcha] Follow-up submission failed:",N instanceof Error?N.message:N);}finally{j(false),V("success"),we.current=setTimeout(()=>{m(),V("form");},3e3);}}},[K,m,se]),Ct=S&&xo?"Update":je;if(De||!ne||be||!he)return null;let Et={"top-right":{position:"absolute",top:0,right:0,transform:"translate(50%, -50%)"},"top-left":{position:"absolute",top:0,left:0,transform:"translate(-50%, -50%)"},"bottom-right":{position:"absolute",bottom:0,right:0,transform:"translate(50%, 50%)"},"bottom-left":{position:"absolute",bottom:0,left:0,transform:"translate(-50%, 50%)"},inline:{position:"relative",display:"inline-flex"}},wo={mode:o,theme:v,customStyles:z,promptText:H,placeholder:Y,submitText:Ct,thankYouMessage:Ge,isLoading:yt,isCheckingExisting:S&&St,isSubmitted:ye==="success",phase:ye,followUpConfig:y,followUpLoading:G,onFollowUpSubmit:Tt,error:xt,existingResponse:S?vt:null,isEditing:S&&xo,showText:t,showRating:n,voteLabels:g,options:l,allowMultiple:u,npsQuestion:p,npsFollowUp:s,npsFollowUpPlaceholder:a,npsLowLabel:h,npsHighLabel:d,enableBugFlag:i,bugFlagLabel:c,enableScreenshot:f,onSubmit:kt,onClose:vo,anchorRect:ft||void 0,useFixedPosition:!xe};return jsxs("div",{ref:ve,style:{...Et[E],zIndex:X?1e4:"auto"},className:"gotcha-container","data-gotcha-element":e,children:[jsx(qo,{size:T,theme:v,customStyles:z,showOnHover:U,touchBehavior:b,onClick:wt,isOpen:X,isParentHovered:Pe,animated:w,queuedCount:_}),X&&!xe&&yo&&createPortal(jsx(mo,{...wo}),document.body),X&&xe&&yo&&createPortal(jsx("div",{role:"presentation",style:{position:"fixed",inset:0,zIndex:99999,backgroundColor:"rgba(0,0,0,0.4)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},className:"gotcha-overlay-enter",onClick:vo,children:jsx("div",{onClick:C=>C.stopPropagation(),children:jsx(mo,{...wo})})}),document.body)]})}function pt({elementId:e,refreshInterval:r}){let{client:o}=F(),[t,n]=useState(null),[g,l]=useState(true),[u,p]=useState(null);return useEffect(()=>{let s=false,a=async()=>{try{let d=await o.getScore(e);s||(n(d),p(null));}catch(d){s||p(d instanceof Error?d.message:"Failed to load score");}finally{s||l(false);}};a();let h;return r&&r>0&&(h=setInterval(a,r)),()=>{s=true,h&&clearInterval(h);}},[o,e,r]),{score:t,isLoading:g,error:u}}var pr={sm:{fontSize:11,ratingFontSize:13,starSize:13,gap:5,pillPx:8,pillPy:4,barHeight:3,iconSize:12},md:{fontSize:12.5,ratingFontSize:15,starSize:15,gap:6,pillPx:10,pillPy:5,barHeight:4,iconSize:14},lg:{fontSize:14,ratingFontSize:18,starSize:18,gap:8,pillPx:12,pillPy:6,barHeight:5,iconSize:16}};function gr({rating:e,size:r,filledColor:o,emptyColor:t}){let n=`gotcha-star-clip-${Math.random().toString(36).slice(2,8)}`,g=[];for(let l=1;l<=5;l++){let u=Math.min(1,Math.max(0,e-(l-1))),p=`${n}-${l}`;g.push(jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",style:{display:"block"},children:[jsx("defs",{children:jsx("clipPath",{id:p,children:jsx("rect",{x:"0",y:"0",width:24*u,height:"24"})})}),jsx("path",{d:"M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z",fill:t}),jsx("path",{d:"M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z",fill:o,clipPath:`url(#${p})`})]},l));}return jsx("span",{style:{display:"inline-flex",gap:Math.max(1,r*.08),alignItems:"center"},children:g})}function fr({rate:e,height:r,filledColor:o,trackColor:t}){return jsx("span",{style:{display:"inline-block",width:48,height:r,borderRadius:r,backgroundColor:t,overflow:"hidden",verticalAlign:"middle"},children:jsx("span",{style:{display:"block",width:`${e}%`,height:"100%",borderRadius:r,background:o,transition:"width 0.6s cubic-bezier(0.4, 0, 0.2, 1)"}})})}function mr({size:e,color:r}){return jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:r,style:{display:"block"},children:jsx("path",{d:"M2 20h2c.55 0 1-.45 1-1v-9c0-.55-.45-1-1-1H2v11zm19.83-7.12c.11-.25.17-.52.17-.8V11c0-1.1-.9-2-2-2h-5.5l.92-4.65c.05-.22.02-.46-.08-.66a4.8 4.8 0 00-.88-1.12L14 2 7.59 8.41C7.21 8.79 7 9.3 7 9.83v7.84C7 18.95 8.05 20 9.34 20h8.11c.7 0 1.36-.37 1.72-.97l2.66-6.15z"})})}function hr({elementId:e,variant:r="stars",showCount:o=true,size:t="md",theme:n="auto",refreshInterval:g,style:l}){let{score:u,isLoading:p}=pt({elementId:e,refreshInterval:g}),[s,a]=useState("light");useEffect(()=>{if(typeof window>"u")return;let T=window.matchMedia("(prefers-color-scheme: dark)");a(T.matches?"dark":"light");let v=z=>a(z.matches?"dark":"light");return T.addEventListener("change",v),()=>T.removeEventListener("change",v)},[]);let{themeConfig:h}=F(),d=useMemo(()=>oe(n,s,h),[n,s,h]);if(p||!u)return null;let i=pr[t],c=d.colors.text,f=d.colors.textDisabled,S=d.colors.starFilled,x=d.colors.starEmpty,B=d.colors.voteUp,k=d.colors.starEmpty,A={display:"inline-flex",alignItems:"center",gap:i.gap,fontFamily:d.typography.fontFamily,lineHeight:1,letterSpacing:"-0.01em",WebkitFontSmoothing:"antialiased",...l},D=(T,v)=>{let z=T===1?v:`${v}s`;return `${T.toLocaleString()} ${z}`};if(r==="votes"){let{voteCount:T,positiveRate:v}=u,z=T.up+T.down;return z===0?null:jsxs("span",{style:A,children:[jsx(mr,{size:i.iconSize,color:B}),jsxs("span",{style:{fontSize:i.ratingFontSize,fontWeight:600,color:B,fontVariantNumeric:"tabular-nums"},children:[v,"%"]}),jsx(fr,{rate:v??0,height:i.barHeight,filledColor:B,trackColor:k}),o&&jsx("span",{style:{fontSize:i.fontSize,color:f,fontWeight:400},children:D(z,"vote")})]})}let{averageRating:y,totalResponses:w}=u;if(y===null||w===0)return null;let E=y.toFixed(1);return r==="compact"?jsxs("span",{style:A,children:[jsx("svg",{width:i.starSize,height:i.starSize,viewBox:"0 0 24 24",style:{display:"block",flexShrink:0},children:jsx("path",{d:"M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z",fill:S})}),jsx("span",{style:{fontSize:i.ratingFontSize,fontWeight:700,color:c,fontVariantNumeric:"tabular-nums"},children:E}),o&&jsxs("span",{style:{fontSize:i.fontSize,color:f,fontWeight:400},children:["(",w.toLocaleString(),")"]})]}):r==="number"?jsxs("span",{style:A,children:[jsx("span",{style:{fontSize:i.ratingFontSize,fontWeight:700,color:c,fontVariantNumeric:"tabular-nums"},children:E}),jsx("span",{style:{fontSize:i.fontSize,color:f,fontWeight:400},children:"/ 5"}),o&&jsxs("span",{style:{fontSize:i.fontSize,color:f,fontWeight:400,marginLeft:2},children:["(",D(w,"response"),")"]})]}):jsxs("span",{style:A,children:[jsx(gr,{rating:y,size:i.starSize,filledColor:S,emptyColor:x}),jsx("span",{style:{fontSize:i.ratingFontSize,fontWeight:700,color:c,fontVariantNumeric:"tabular-nums"},children:E}),o&&jsxs("span",{style:{fontSize:i.fontSize,color:f,fontWeight:400},children:["(",D(w,"response"),")"]})]})}function br(){let{client:e,disabled:r,defaultUser:o,debug:t,openModal:n,closeModal:g,activeModalId:l}=F();return {client:e,disabled:r,defaultUser:o,debug:t,submitFeedback:e.submitResponse.bind(e),openModal:n,closeModal:g,activeModalId:l}}function yr(e){let{activeModalId:r,openModal:o,closeModal:t}=F(),n=useCallback(()=>o(e),[o,e]),g=useCallback(()=>t(),[t]);return {open:n,close:g,isOpen:r===e}}
|
|
159
|
+
`.trim()}function He(e){if(typeof document>"u")return;if(!document.getElementById(Oo)){let o=document.createElement("link");o.rel="preconnect",o.href="https://fonts.googleapis.com",document.head.appendChild(o);let t=document.createElement("link");t.rel="preconnect",t.href="https://fonts.gstatic.com",t.crossOrigin="anonymous",document.head.appendChild(t);let n=document.createElement("link");n.id=Oo,n.rel="stylesheet",n.href="https://fonts.googleapis.com/css2?family=Carter+One&family=DM+Sans:wght@400;500;600;700&display=swap",document.head.appendChild(n);}let r=document.getElementById(Uo);r||(r=document.createElement("style"),r.id=Uo,document.head.appendChild(r)),r.textContent=Ft(e);}var No=createContext(null),Lt={};function $t({apiKey:e,children:r,baseUrl:o,debug:t=false,disabled:n=false,defaultUser:g,themeConfig:l}){let[u,p]=useState(null);o&&!o.startsWith("https://")&&!o.startsWith("/")&&!o.includes("localhost")&&console.warn("[Gotcha] baseUrl should use HTTPS in production:",o);let s=useMemo(()=>Lo({apiKey:e,baseUrl:o,debug:t}),[e,o,t]),a=useMemo(()=>g??Lt,[JSON.stringify(g)]);useEffect(()=>{let c=oe("light","light",l);He(c);},[l]),useEffect(()=>(Ao(),()=>Io()),[]),useEffect(()=>{s.flushQueue();let c=()=>s.flushQueue();return window.addEventListener("online",c),()=>window.removeEventListener("online",c)},[s]);let h=useCallback(c=>{p(c);},[]),d=useCallback(()=>{p(null);},[]),i=useMemo(()=>({client:s,disabled:n,defaultUser:a,debug:t,activeModalId:u,openModal:h,closeModal:d,themeConfig:l}),[s,n,a,t,u,h,d,l]);return jsx(No.Provider,{value:i,children:r})}function F(){let e=useContext(No);if(!e)throw new Error("useGotchaContext must be used within a GotchaProvider");return e}function _t(e,r){let o=new Date(e).getTime();if(isNaN(o))return true;let t=Date.now()-o,n=r*24*60*60*1e3;return t>=n}function Wo(e){let{client:r,defaultUser:o}=F(),[t,n]=useState(false),[g,l]=useState(false),[u,p]=useState(null),[s,a]=useState(null);return useEffect(()=>{process.env.NODE_ENV!=="production"&&e.cooldownDays&&!e.onePerUser&&console.warn("[Gotcha] cooldownDays has no effect without onePerUser=true");let d=e.user?.id||o?.id;if(!d||!e.onePerUser){a(null);return}let i=false;return (async()=>{l(true);try{let f=await r.checkExistingResponse(e.elementId,d);i||(f&&e.cooldownDays&&e.cooldownDays>0&&_t(f.createdAt,e.cooldownDays)?a(null):a(f));}catch{i||a(null);}finally{i||l(false);}})(),()=>{i=true;}},[r,e.elementId,e.user?.id,o?.id,e.onePerUser,e.cooldownDays]),{submit:useCallback(async d=>{n(true),p(null);try{let i=e.user?.id||o?.id,c;return e.onePerUser&&s&&i?c=await r.updateResponse(s.id,{content:d.content,title:d.title,rating:d.rating,vote:d.vote,pollSelected:d.pollSelected},i):c=await r.submitResponse({elementId:e.elementId,mode:e.mode,content:d.content,title:d.title,rating:d.rating,vote:d.vote,pollOptions:e.pollOptions,pollSelected:d.pollSelected,isBug:d.isBug,screenshot:d.screenshot,user:{...o,...e.user}}),e.onePerUser&&a({id:c.id,mode:e.mode,content:d.content??null,title:d.title??null,rating:d.rating??null,vote:d.vote??null,pollSelected:d.pollSelected??null,createdAt:c.createdAt}),e.onSuccess?.(c),c}catch(i){let c=i instanceof Error?i.message:"Something went wrong";throw p(c),e.onError?.(i instanceof Error?i:new Error(c)),i}finally{n(false);}},[r,o,e,s]),isLoading:t,isCheckingExisting:g,error:u,existingResponse:s,isEditing:!!s,clearError:()=>p(null)}}function Vo(e,r){return `${W.HIDDEN_UNTIL}_${e}_${r}`}function Yo(e,r,o){if(!o||o<=0)return false;let t=Vo(e,r),n=J(t);return n?new Date(n).getTime()>Date.now():false}function Ko(e){let{elementId:r,userId:o,hideAfterSubmitDays:t}=e,n=useMemo(()=>o||$e(),[o]),[g,l]=useState(()=>Yo(r,n,t));useEffect(()=>{l(Yo(r,n,t));},[r,n,t]);let u=useCallback(()=>{if(!t||t<=0)return;let p=Vo(r,n),s=new Date(Date.now()+t*24*60*60*1e3);Z(p,s.toISOString()),l(true);},[r,n,t]);return {isHidden:g,markHidden:u}}function Kt(e){return `${W.VISIT_COUNT}_${e}`}function jo(e){let{elementId:r,showAfterSeconds:o,showAfterScrollPercent:t,showAfterVisits:n}=e,g=o!=null||t!=null||n!=null,[l,u]=useState(!o),[p,s]=useState(!t),[a]=useState(()=>{if(!n)return true;let h=Kt(r),i=parseInt(J(h)||"0",10)+1;return Z(h,String(i)),i>=n});return useEffect(()=>{if(!o||o<=0)return;let h=Date.now(),d=o*1e3,i=()=>{Date.now()-h>=d?u(true):c=setTimeout(i,Math.min(1e3,d-(Date.now()-h)));},c=setTimeout(i,Math.min(1e3,d));return ()=>clearTimeout(c)},[o]),useEffect(()=>{if(!t||t<=0)return;let h=()=>{let d=document.documentElement.scrollHeight,i=window.innerHeight;if(d<=i){s(true);return}(window.scrollY+i)/d*100>=t&&s(true);};if(h(),!p)return window.addEventListener("scroll",h,{passive:true}),()=>window.removeEventListener("scroll",h)},[t,p]),{conditionsMet:!g||l&&p&&a}}function Ne(...e){return e.filter(Boolean).join(" ")}var O=()=>typeof window>"u"?false:"ontouchstart"in window||navigator.maxTouchPoints>0,Xo=(e,r)=>{let o={sm:{desktop:24,mobile:28},md:{desktop:32,mobile:34},lg:{desktop:40,mobile:40}};return r?o[e].mobile:o[e].desktop};function jt(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function qo({size:e,theme:r,customStyles:o,showOnHover:t,touchBehavior:n,onClick:g,isOpen:l,isParentHovered:u=false,animated:p=true,queuedCount:s=0}){let[a,h]=useState(false),[d,i]=useState(false),[c,f]=useState(jt),[S,x]=useState(false),[B,k]=useState(false),[A,D]=useState(false),{themeConfig:y}=F();useEffect(()=>{if(h(O()),typeof window>"u")return;let U=window.matchMedia("(prefers-color-scheme: dark)"),b=H=>f(H.matches?"dark":"light");return U.addEventListener("change",b),()=>U.removeEventListener("change",b)},[]);let w=l?true:!a&&t?u:a&&n==="tap-to-reveal"?d:true;useEffect(()=>{if(w&&!A){let U=setTimeout(()=>D(true),600);return ()=>clearTimeout(U)}},[w,A]);let E=()=>{if(a&&n==="tap-to-reveal"&&!d){i(true);return}g();},T=Xo(e,a),v=useMemo(()=>oe(r,c,y),[r,c,y]),z=()=>w?B?"scale(0.95)":S?"scale(1.08)":"scale(1)":"scale(0.6)",ne={width:T,height:T,borderRadius:"50%",border:v.colors.glassBorder,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",background:v.colors.glassBackground,backdropFilter:"blur(20px) saturate(180%)",WebkitBackdropFilter:"blur(20px) saturate(180%)",color:v.colors.glassColor,boxShadow:S?v.colors.glassHoverShadow:v.colors.glassShadow,transition:A?`all 0.3s ${v.animation.easing.spring}`:"none",opacity:w?1:0,transform:z(),filter:B?"brightness(0.95)":"brightness(1)",pointerEvents:w?"auto":"none",...p&&w&&!A?{animation:"gotcha-bubble-pop 500ms cubic-bezier(0.175, 0.885, 0.32, 1.275) both, gotcha-arrive-glow 1200ms ease-in-out 600ms both"}:{},...o?.button};return jsxs("button",{type:"button",onClick:E,onMouseEnter:()=>x(true),onMouseLeave:()=>{x(false),k(false);},onMouseDown:()=>k(true),onMouseUp:()=>k(false),onTouchStart:()=>k(true),onTouchEnd:()=>k(false),style:ne,className:Ne("gotcha-button",l&&"gotcha-button--open"),"aria-label":"Give feedback on this feature","aria-expanded":l,"aria-haspopup":"dialog",children:[jsx(Xt,{size:T*.65,animated:p}),s>0&&jsx("div",{"aria-label":`${s} queued`,style:{position:"absolute",top:-2,right:-2,width:8,height:8,borderRadius:"50%",backgroundColor:v.colors.warning,border:"1.5px solid rgba(255,255,255,0.9)"}})]})}function Xt({size:e,animated:r=true}){let[o,t]=useState(false);return useEffect(()=>{t(true);},[]),jsx("span",{"aria-hidden":"true",style:{fontFamily:"'Carter One', cursive",fontSize:e,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center",marginTop:e*.05,marginRight:e*.05,userSelect:"none",opacity:r?0:o?1:0,...r&&o?{animation:"gotcha-letter-in 350ms cubic-bezier(0.25, 0.46, 0.45, 0.94) 200ms both"}:{}},children:"G"})}function L({size:e=16,color:r="currentColor"}){return jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",style:{animation:"gotcha-spin 0.8s linear infinite"},children:[jsx("circle",{cx:"12",cy:"12",r:"10",stroke:r,strokeWidth:"2",strokeOpacity:"0.12"}),jsx("circle",{cx:"12",cy:"12",r:"10",stroke:r,strokeWidth:"2",strokeLinecap:"round",style:{animation:"gotcha-dash 1.2s ease-in-out infinite"}})]})}function Zo({src:e,onRemove:r,resolvedTheme:o}){return jsxs("div",{style:{position:"relative",marginTop:10,borderRadius:o.borders.radius.md,overflow:"hidden",border:`1px solid ${o.colors.border}`},children:[jsx("img",{src:e,alt:"Screenshot",style:{display:"block",width:"100%",maxHeight:120,objectFit:"cover"}}),jsx("button",{type:"button",onClick:r,"aria-label":"Remove screenshot",style:{position:"absolute",top:4,right:4,width:22,height:22,borderRadius:"50%",border:"none",backgroundColor:"rgba(0,0,0,0.6)",color:"#fff",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",fontSize:12,lineHeight:1},children:jsx("svg",{width:10,height:10,viewBox:"0 0 14 14",fill:"none",children:jsx("path",{d:"M1 1L13 13M1 13L13 1",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]})}function et({resolvedTheme:e,placeholder:r,submitText:o,isLoading:t,onSubmit:n,customStyles:g,initialValues:l,isEditing:u=false,showText:p=true,showRating:s=true,enableBugFlag:a=false,bugFlagLabel:h,enableScreenshot:d=false}){let[i,c]=useState(l?.content||""),[f,S]=useState(l?.rating??null),[x,B]=useState(false),[k,A]=useState(false),[D,y]=useState(null),[w,E]=useState(false);useEffect(()=>{A(O());},[]),useEffect(()=>{l?.content!==void 0&&c(l.content||""),l?.rating!==void 0&&S(l.rating??null);},[l?.content,l?.rating]);let T=p&&s?i.trim().length>0||f!==null:p?i.trim().length>0:s?f!==null:false,v=async()=>{E(true);try{let{captureScreenshot:b}=await import('./screenshot-CTLYS27H.mjs'),H=await b();H&&y(H);}catch{}finally{E(false);}},z=b=>{b.preventDefault(),T&&n({content:p&&i.trim()?i.trim():void 0,rating:s&&f!==null?f:void 0,isBug:x||void 0,screenshot:D||void 0});},ne={width:"100%",padding:k?"12px 14px":"10px 12px",border:`1px solid ${e.colors.inputBorder}`,borderRadius:e.borders.radius.md,backgroundColor:e.colors.inputBackground,color:e.colors.text,fontSize:k?e.typography.fontSize.lg:e.typography.fontSize.md,resize:"none",minHeight:k?100:80,fontFamily:e.typography.fontFamily,outline:"none",transition:`border-color ${e.animation.duration.fast} ${e.animation.easing.default}, box-shadow ${e.animation.duration.fast} ${e.animation.easing.default}`,lineHeight:1.5,boxShadow:"inset 0 1px 2px rgba(0,0,0,0.04)",...g?.input},U={width:"100%",padding:k?"14px 16px":"10px 16px",border:e.colors.buttonBorder,borderRadius:e.borders.radius.md,backgroundColor:e.colors.buttonBackground,color:e.colors.buttonColor,fontSize:k?e.typography.fontSize.lg:e.typography.fontSize.md,fontWeight:e.typography.fontWeight.medium,fontFamily:e.typography.fontFamily,cursor:t?"not-allowed":"pointer",transition:`all ${e.animation.duration.fast} ${e.animation.easing.default}`,letterSpacing:"0.01em",...g?.submitButton};return jsxs("form",{onSubmit:z,children:[s&&jsx("div",{style:{marginBottom:p?k?16:12:0,...p?{}:{display:"flex",justifyContent:"center",padding:"8px 0"}},children:jsx(or,{value:f,onChange:S,theme:e,isTouch:k,large:!p})}),p&&jsx("textarea",{value:i,onChange:b=>c(b.target.value),placeholder:r||"Share your thoughts...",maxLength:5e3,style:ne,disabled:t,"aria-label":"Your feedback",onFocus:b=>{b.currentTarget.style.borderColor=e.colors.inputBorderFocus,b.currentTarget.style.boxShadow=`0 0 0 3px ${e.colors.inputFocusRing}`,b.currentTarget.style.backgroundColor=e.colors.inputBackgroundFocus;},onBlur:b=>{b.currentTarget.style.borderColor=e.colors.inputBorder,b.currentTarget.style.boxShadow="inset 0 1px 2px rgba(0,0,0,0.04)",b.currentTarget.style.backgroundColor=e.colors.inputBackground;}}),a&&jsxs("button",{type:"button",role:"switch","aria-checked":x,onClick:()=>B(!x),style:{display:"flex",alignItems:"center",gap:7,width:"100%",marginTop:10,padding:"7px 10px",border:`1px solid ${x?e.colors.warningBorder:e.colors.border}`,borderRadius:7,backgroundColor:x?e.colors.warningSurface:"transparent",cursor:"pointer",transition:`all ${e.animation.duration.fast} ${e.animation.easing.default}`,fontFamily:e.typography.fontFamily,...g?.bugFlag},onMouseEnter:b=>{x||(b.currentTarget.style.backgroundColor=e.colors.surfaceHover===e.colors.inputBackgroundFocus?"rgba(0,0,0,0.02)":e.colors.surfaceHover);},onMouseLeave:b=>{x||(b.currentTarget.style.backgroundColor="transparent");},children:[jsx("svg",{width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:x?e.colors.warningActive:e.colors.textDisabled,strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0,transition:`stroke ${e.animation.duration.fast}`},children:jsx("path",{d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"})}),jsx("span",{style:{fontSize:12,fontWeight:x?e.typography.fontWeight.medium:e.typography.fontWeight.normal,color:x?e.colors.warningActive:e.colors.textDisabled,transition:`color ${e.animation.duration.fast}`,letterSpacing:"0.01em"},children:x?"Issue reported":h||"Report an issue"}),jsx("div",{style:{marginLeft:"auto",width:28,height:16,borderRadius:8,backgroundColor:x?e.colors.warning:e.colors.border,position:"relative",transition:`background-color ${e.animation.duration.fast} ${e.animation.easing.default}`,flexShrink:0},children:jsx("div",{style:{position:"absolute",top:2,left:x?14:2,width:12,height:12,borderRadius:"50%",backgroundColor:x?"#ffffff":e.colors.textDisabled,transition:`left ${e.animation.duration.fast} ${e.animation.easing.default}, background-color ${e.animation.duration.fast}`,boxShadow:"0 1px 2px rgba(0,0,0,0.15)"}})})]}),a&&d&&x&&!D&&jsxs("button",{type:"button",onClick:v,disabled:w,style:{display:"flex",alignItems:"center",gap:6,width:"100%",marginTop:8,padding:"7px 10px",border:`1px solid ${e.colors.border}`,borderRadius:7,backgroundColor:"transparent",cursor:w?"not-allowed":"pointer",fontFamily:e.typography.fontFamily,fontSize:12,color:e.colors.textSecondary,transition:`all ${e.animation.duration.fast} ${e.animation.easing.default}`},onMouseEnter:b=>{b.currentTarget.style.backgroundColor=e.colors.surfaceHover;},onMouseLeave:b=>{b.currentTarget.style.backgroundColor="transparent";},children:[w?jsx(L,{size:14,color:e.colors.textSecondary}):jsxs("svg",{width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),jsx("circle",{cx:"12",cy:"10",r:"3"}),jsx("path",{d:"M2 17l4-4 3 3 4-4 9 9"})]}),w?"Capturing...":"Capture screenshot"]}),a&&d&&x&&D&&jsx(Zo,{src:D,onRemove:()=>y(null),resolvedTheme:e}),jsxs("button",{type:"submit",disabled:t||!T,style:{...U,marginTop:12,opacity:t?.8:1,backgroundColor:T?e.colors.buttonBackground:e.colors.buttonBackgroundDisabled,color:T?e.colors.buttonColor:e.colors.buttonColorDisabled,display:"flex",alignItems:"center",justifyContent:"center",gap:8,...t?{backgroundImage:"linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.1) 50%, transparent 100%)",backgroundSize:"200% 100%",animation:"gotcha-shimmer 1.5s ease infinite"}:{}},onMouseEnter:b=>{b.currentTarget.disabled||(b.currentTarget.style.backgroundColor=e.colors.buttonBackgroundHover,b.currentTarget.style.transform="translateY(-1px)",b.currentTarget.style.boxShadow=e.shadows.button);},onMouseLeave:b=>{b.currentTarget.disabled||(b.currentTarget.style.backgroundColor=e.colors.buttonBackground,b.currentTarget.style.transform="translateY(0)",b.currentTarget.style.boxShadow="none");},children:[t&&jsx(L,{size:k?18:16,color:e.colors.buttonColor}),t?u?"Updating...":"Submitting...":u?"Update":o]})]})}function or({value:e,onChange:r,theme:o,isTouch:t,large:n=false}){let[g,l]=useState(null),[u,p]=useState(null),s=useRef(),a=n?t?36:28:t?28:18,h=n?t?8:5:t?8:3;useEffect(()=>()=>{clearTimeout(s.current);},[]);let d=i=>{p(i),r(i),clearTimeout(s.current),s.current=setTimeout(()=>p(null),300);};return jsx("div",{style:{display:"flex",gap:n?t?8:6:t?6:2},role:"group","aria-label":"Rating",children:[1,2,3,4,5].map(i=>{let c=(g??e??0)>=i;return jsx("button",{type:"button",onClick:()=>d(i),onMouseEnter:()=>l(i),onMouseLeave:()=>l(null),"aria-label":`Rate ${i} out of 5`,"aria-pressed":e===i,style:{background:"none",border:"none",cursor:"pointer",padding:h,color:c?o.colors.starFilled:o.colors.starEmpty,transition:`color 0.15s ${o.animation.easing.default}`,transform:u===i?"scale(1)":g!==null&&g>=i?"scale(1.1)":"scale(1)",animation:u===i?`gotcha-star-pulse 0.3s ${o.animation.easing.spring}`:"none",filter:c?`drop-shadow(0 0 3px ${o.colors.starFilled}40)`:"none",transitionDelay:`${(i-1)*30}ms`},children:jsx("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"currentColor",children:jsx("path",{d:"M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z"})})},i)})})}function ot({resolvedTheme:e,isLoading:r,onSubmit:o,initialVote:t,isEditing:n=false,labels:g}){let[l,u]=useState(false),[p,s]=useState(t||null),[a,h]=useState(t||null);useEffect(()=>{u(O());},[]),useEffect(()=>{t!==void 0&&(h(t),s(t));},[t]),useEffect(()=>{!r&&!n&&s(null);},[r,n]);let d=f=>{s(f),o({vote:f});},i=f=>{let S=a===f,x=f==="up"?e.colors.voteUp:e.colors.voteDown,B=f==="up"?e.colors.voteUpSurface:e.colors.voteDownSurface,k=f==="up"?e.colors.voteUpBorder:e.colors.voteDownBorder;return {flex:1,minWidth:0,overflow:"hidden",padding:l?"14px 18px":"10px 14px",border:S?`2px solid ${k}`:`1px solid ${e.colors.border}`,borderRadius:e.borders.radius.lg-2,background:S?`linear-gradient(135deg, ${B}, ${B})`:e.colors.surface,color:S?x:e.colors.textSecondary,fontSize:l?28:24,fontFamily:e.typography.fontFamily,cursor:r?"not-allowed":"pointer",transition:`all 0.2s ${e.animation.easing.default}`,display:"flex",alignItems:"center",justifyContent:"center",gap:l?10:8}},c=l?24:20;return jsxs("div",{style:{display:"flex",gap:l?12:10},role:"group","aria-label":"Vote",children:[jsx("button",{type:"button",onClick:()=>d("up"),disabled:r,style:i("up"),"aria-label":"Vote up - I like this","aria-pressed":a==="up",onMouseEnter:f=>{r||(f.currentTarget.style.transform="translateY(-2px) scale(1.02)",f.currentTarget.style.boxShadow=e.shadows.button);},onMouseLeave:f=>{f.currentTarget.style.transform="translateY(0) scale(1)",f.currentTarget.style.boxShadow="none";},children:r&&p==="up"?jsxs(Fragment,{children:[jsx(L,{size:c,color:e.colors.text}),jsx("span",{style:{fontSize:l?15:13,fontWeight:e.typography.fontWeight.medium,letterSpacing:"0.01em"},children:n?"Updating...":"Sending..."})]}):jsxs(Fragment,{children:[jsx(tr,{size:c}),jsx("span",{style:{fontSize:l?15:13,fontWeight:e.typography.fontWeight.medium,letterSpacing:"0.01em"},children:g?.up||(a==="up"?"Liked":"Like")})]})}),jsx("button",{type:"button",onClick:()=>d("down"),disabled:r,style:i("down"),"aria-label":"Vote down - I don't like this","aria-pressed":a==="down",onMouseEnter:f=>{r||(f.currentTarget.style.transform="translateY(-2px) scale(1.02)",f.currentTarget.style.boxShadow=e.shadows.button);},onMouseLeave:f=>{f.currentTarget.style.transform="translateY(0) scale(1)",f.currentTarget.style.boxShadow="none";},children:r&&p==="down"?jsxs(Fragment,{children:[jsx(L,{size:c,color:e.colors.text}),jsx("span",{style:{fontSize:l?15:13,fontWeight:e.typography.fontWeight.medium,letterSpacing:"0.01em"},children:n?"Updating...":"Sending..."})]}):jsxs(Fragment,{children:[jsx(rr,{size:c}),jsx("span",{style:{fontSize:l?15:13,fontWeight:e.typography.fontWeight.medium,letterSpacing:"0.01em"},children:g?.down||(a==="down"?"Disliked":"Dislike")})]})})]})}function tr({size:e=24}){return jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3"})})}function rr({size:e=24}){return jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17"})})}function nt({resolvedTheme:e,options:r,allowMultiple:o,isLoading:t,onSubmit:n,initialSelected:g,isEditing:l=false}){let[u,p]=useState(g||[]),[s,a]=useState(false);useEffect(()=>{a(O());},[]),useEffect(()=>{g&&p(g);},[g]);let h=c=>{p(o?f=>f.includes(c)?f.filter(S=>S!==c):[...f,c]:f=>f.includes(c)?[]:[c]);},d=()=>{u.length!==0&&n({pollSelected:u});},i=(c,f)=>{let S=u.includes(c);return {width:"100%",padding:s?"12px 14px":"9px 12px",border:`1px solid ${S?e.colors.pollSelectedBorder:e.colors.pollBorder}`,borderRadius:e.borders.radius.lg-2,backgroundColor:S?e.colors.pollSelectedBackground:e.colors.pollBackground,color:S?e.colors.pollSelectedColor:e.colors.pollColor,fontSize:s?15:e.typography.fontSize.sm,fontWeight:S?e.typography.fontWeight.semibold:e.typography.fontWeight.medium,fontFamily:e.typography.fontFamily,cursor:t?"not-allowed":"pointer",transition:`all 0.2s ${e.animation.easing.default}`,textAlign:"left",letterSpacing:"0.01em",display:"flex",alignItems:"center",gap:8,animation:`gotcha-fade-up ${e.animation.duration.normal} ${e.animation.easing.default} both`,animationDelay:`${f*.05}s`}};return jsxs("div",{children:[jsx("div",{style:{display:"flex",flexDirection:"column",gap:s?8:6},role:"group","aria-label":o?"Select one or more options":"Select an option",children:r.map((c,f)=>{let S=u.includes(c);return jsxs("button",{type:"button",onClick:()=>h(c),disabled:t,style:i(c,f),"aria-pressed":S,onMouseEnter:x=>{t||(x.currentTarget.style.transform="translateX(2px)");},onMouseLeave:x=>{x.currentTarget.style.transform="translateX(0)";},children:[jsx("span",{style:{width:16,height:16,borderRadius:o?4:"50%",border:`2px solid ${S?e.colors.pollCheckSelectedBorder:e.colors.pollCheckBorder}`,backgroundColor:S?e.colors.pollCheckSelectedBg:"transparent",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,transition:`all ${e.animation.duration.fast}`},children:S&&jsx("svg",{width:10,height:10,viewBox:"0 0 12 12",fill:"none",children:jsx("path",{d:"M2 6l3 3 5-5",stroke:"#fff",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),c]},c)})}),jsxs("button",{type:"button",onClick:d,disabled:t||u.length===0,style:{width:"100%",marginTop:12,padding:s?"14px 16px":"10px 16px",border:e.colors.buttonBorder,borderRadius:e.borders.radius.md,backgroundColor:u.length===0?e.colors.buttonBackgroundDisabled:e.colors.buttonBackground,color:u.length===0?e.colors.buttonColorDisabled:e.colors.buttonColor,fontSize:s?e.typography.fontSize.lg:e.typography.fontSize.md,fontWeight:e.typography.fontWeight.medium,fontFamily:e.typography.fontFamily,cursor:t||u.length===0?"not-allowed":"pointer",transition:`all ${e.animation.duration.fast} ${e.animation.easing.default}`,letterSpacing:"0.01em",display:"flex",alignItems:"center",justifyContent:"center",gap:8,opacity:t?.8:1,...t?{backgroundImage:"linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.1) 50%, transparent 100%)",backgroundSize:"200% 100%",animation:"gotcha-shimmer 1.5s ease infinite"}:{}},onMouseEnter:c=>{c.currentTarget.disabled||(c.currentTarget.style.backgroundColor=e.colors.buttonBackgroundHover,c.currentTarget.style.transform="translateY(-1px)",c.currentTarget.style.boxShadow=e.shadows.button);},onMouseLeave:c=>{c.currentTarget.disabled||(c.currentTarget.style.backgroundColor=u.length===0?e.colors.buttonBackgroundDisabled:e.colors.buttonBackground,c.currentTarget.style.transform="translateY(0)",c.currentTarget.style.boxShadow="none");},children:[t&&jsx(L,{size:s?18:16,color:e.colors.buttonColor}),t?l?"Updating...":"Submitting...":l?"Update":"Submit"]})]})}function at({resolvedTheme:e,submitText:r,isLoading:o,onSubmit:t,customStyles:n,showFollowUp:g=true,followUpPlaceholder:l,lowLabel:u="Not likely",highLabel:p="Very likely",initialValues:s,isEditing:a=false}){let[h,d]=useState(s?.rating??null),[i,c]=useState(s?.content||""),[f,S]=useState(false),[x,B]=useState(null);useEffect(()=>{S(O());},[]),useEffect(()=>{s?.rating!==void 0&&d(s.rating??null),s?.content!==void 0&&c(s.content||"");},[s?.rating,s?.content]);let k=h!==null,A=e.colors.npsColors;return jsxs("form",{onSubmit:y=>{y.preventDefault(),k&&t({rating:h??void 0,content:g&&i.trim()?i.trim():void 0});},children:[jsxs("div",{children:[jsx("div",{style:{display:"flex",gap:f?4:6,justifyContent:"center"},role:"group","aria-label":"NPS Score",children:Array.from({length:11},(y,w)=>{let E=h===w,T=x===w,v=A[w];return jsx("button",{type:"button",onClick:()=>d(w),onMouseEnter:()=>B(w),onMouseLeave:()=>B(null),"aria-label":`Score ${w} out of 10`,"aria-pressed":E,style:{flex:1,minWidth:0,height:f?34:32,borderRadius:e.borders.radius.sm,border:E?`2px solid ${v}`:`1.5px solid ${v}25`,backgroundColor:E?v:T?`${v}25`:`${v}0c`,color:E?"#fff":T?v:`${v}bb`,fontSize:12,fontWeight:E?e.typography.fontWeight.bold:e.typography.fontWeight.semibold,fontFamily:e.typography.fontFamily,fontVariantNumeric:"tabular-nums",cursor:"pointer",padding:0,display:"flex",alignItems:"center",justifyContent:"center",transition:`all 0.2s ${e.animation.easing.spring}`,transform:E?"scale(1.08)":T?"scale(1.04)":"scale(1)",boxShadow:E?`0 0 12px ${v}40`:"none",...n?.npsButton,...E?n?.npsButtonSelected:{}},children:w},w)})}),jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:6,padding:"0 2px",...n?.npsLabels},children:[jsx("span",{style:{fontSize:e.typography.fontSize.xs,color:e.colors.textDisabled,fontWeight:e.typography.fontWeight.medium,letterSpacing:"0.02em"},children:u}),jsx("span",{style:{fontSize:e.typography.fontSize.xs,color:e.colors.textDisabled,fontWeight:e.typography.fontWeight.medium,letterSpacing:"0.02em"},children:p})]})]}),g&&h!==null&&jsx("textarea",{value:i,onChange:y=>c(y.target.value),placeholder:l||"What's the main reason for your score?",maxLength:5e3,style:{width:"100%",padding:f?"12px 14px":"10px 12px",border:`1px solid ${e.colors.inputBorder}`,borderRadius:e.borders.radius.md,backgroundColor:e.colors.inputBackground,color:e.colors.text,fontSize:f?e.typography.fontSize.lg:e.typography.fontSize.md,resize:"vertical",minHeight:f?80:60,fontFamily:e.typography.fontFamily,outline:"none",transition:`border-color ${e.animation.duration.fast} ${e.animation.easing.default}, box-shadow ${e.animation.duration.fast} ${e.animation.easing.default}`,lineHeight:1.5,animation:`gotcha-expand-in 0.3s ${e.animation.easing.default} both`,overflow:"hidden",...n?.input},disabled:o,"aria-label":"Follow-up feedback",onFocus:y=>{y.currentTarget.style.borderColor=e.colors.inputBorderFocus,y.currentTarget.style.boxShadow=`0 0 0 3px ${e.colors.inputFocusRing}`,y.currentTarget.style.backgroundColor=e.colors.inputBackgroundFocus;},onBlur:y=>{y.currentTarget.style.borderColor=e.colors.inputBorder,y.currentTarget.style.boxShadow="none",y.currentTarget.style.backgroundColor=e.colors.inputBackground;}}),jsxs("button",{type:"submit",disabled:o||!k,style:{width:"100%",padding:f?"14px 16px":"10px 16px",border:e.colors.buttonBorder,borderRadius:e.borders.radius.md,backgroundColor:k?e.colors.buttonBackground:e.colors.buttonBackgroundDisabled,color:k?e.colors.buttonColor:e.colors.buttonColorDisabled,fontSize:f?e.typography.fontSize.lg:e.typography.fontSize.md,fontWeight:e.typography.fontWeight.medium,fontFamily:e.typography.fontFamily,cursor:o?"not-allowed":"pointer",transition:`all ${e.animation.duration.fast} ${e.animation.easing.default}`,letterSpacing:"0.01em",opacity:o?.8:1,display:"flex",alignItems:"center",justifyContent:"center",gap:8,marginTop:12,...o?{backgroundImage:"linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.1) 50%, transparent 100%)",backgroundSize:"200% 100%",animation:"gotcha-shimmer 1.5s ease infinite"}:{},...n?.submitButton},onMouseEnter:y=>{y.currentTarget.disabled||(y.currentTarget.style.backgroundColor=e.colors.buttonBackgroundHover,y.currentTarget.style.transform="translateY(-1px)",y.currentTarget.style.boxShadow=e.shadows.button);},onMouseLeave:y=>{y.currentTarget.disabled||(y.currentTarget.style.backgroundColor=k?e.colors.buttonBackground:e.colors.buttonBackgroundDisabled,y.currentTarget.style.transform="translateY(0)",y.currentTarget.style.boxShadow="none");},children:[o&&jsx(L,{size:f?18:16,color:e.colors.buttonColor}),o?a?"Updating...":"Submitting...":a?"Update":r]})]})}function ct({resolvedTheme:e,promptText:r,placeholder:o,isLoading:t,onSubmit:n}){let[g,l]=useState(""),[u,p]=useState(false);return useEffect(()=>{p(O());},[]),jsxs("form",{onSubmit:a=>{a.preventDefault(),g.trim()&&n(g.trim());},children:[jsx("p",{style:{margin:"0 0 12px 0",fontSize:e.typography.fontSize.sm,color:e.colors.textSecondary,lineHeight:1.4,fontFamily:e.typography.fontFamily},children:r}),jsx("textarea",{value:g,onChange:a=>l(a.target.value),placeholder:o||"Tell us more...",maxLength:5e3,disabled:t,"aria-label":"Follow-up feedback",style:{width:"100%",padding:u?"12px 14px":"10px 12px",border:`1px solid ${e.colors.inputBorder}`,borderRadius:e.borders.radius.md,backgroundColor:e.colors.inputBackground,color:e.colors.text,fontSize:u?e.typography.fontSize.lg:e.typography.fontSize.md,resize:"none",minHeight:u?100:80,fontFamily:e.typography.fontFamily,outline:"none",transition:`border-color ${e.animation.duration.fast} ${e.animation.easing.default}, box-shadow ${e.animation.duration.fast} ${e.animation.easing.default}`,lineHeight:1.5,boxShadow:"inset 0 1px 2px rgba(0,0,0,0.04)"},onFocus:a=>{a.currentTarget.style.borderColor=e.colors.inputBorderFocus,a.currentTarget.style.boxShadow=`0 0 0 3px ${e.colors.inputFocusRing}`,a.currentTarget.style.backgroundColor=e.colors.inputBackgroundFocus;},onBlur:a=>{a.currentTarget.style.borderColor=e.colors.inputBorder,a.currentTarget.style.boxShadow="inset 0 1px 2px rgba(0,0,0,0.04)",a.currentTarget.style.backgroundColor=e.colors.inputBackground;}}),jsxs("button",{type:"submit",disabled:t||!g.trim(),style:{width:"100%",marginTop:12,padding:u?"14px 16px":"10px 16px",border:e.colors.buttonBorder,borderRadius:e.borders.radius.md,backgroundColor:g.trim()?e.colors.buttonBackground:e.colors.buttonBackgroundDisabled,color:g.trim()?e.colors.buttonColor:e.colors.buttonColorDisabled,fontSize:u?e.typography.fontSize.lg:e.typography.fontSize.md,fontWeight:e.typography.fontWeight.medium,fontFamily:e.typography.fontFamily,cursor:t?"not-allowed":"pointer",transition:`all ${e.animation.duration.fast} ${e.animation.easing.default}`,letterSpacing:"0.01em",display:"flex",alignItems:"center",justifyContent:"center",gap:8,opacity:t?.8:1},onMouseEnter:a=>{a.currentTarget.disabled||(a.currentTarget.style.backgroundColor=e.colors.buttonBackgroundHover,a.currentTarget.style.transform="translateY(-1px)",a.currentTarget.style.boxShadow=e.shadows.button);},onMouseLeave:a=>{a.currentTarget.disabled||(a.currentTarget.style.backgroundColor=e.colors.buttonBackground,a.currentTarget.style.transform="translateY(0)",a.currentTarget.style.boxShadow="none");},children:[t&&jsx(L,{size:u?18:16,color:e.colors.buttonColor}),t?"Sending...":"Submit"]})]})}function mo({mode:e,theme:r,customStyles:o,promptText:t,placeholder:n,submitText:g,thankYouMessage:l,isLoading:u,isCheckingExisting:p=false,isSubmitted:s,phase:a="form",followUpConfig:h,followUpLoading:d=false,onFollowUpSubmit:i,error:c,existingResponse:f,isEditing:S=false,showText:x=true,showRating:B=true,voteLabels:k,options:A,allowMultiple:D=false,npsQuestion:y,npsFollowUp:w=true,npsFollowUpPlaceholder:E,npsLowLabel:T,npsHighLabel:v,enableBugFlag:z=false,bugFlagLabel:ne,enableScreenshot:U=false,onSubmit:b,onClose:H,anchorRect:Y,useFixedPosition:je=false}){let Ge=useRef(null),Fe=useRef(null),ge=useRef(H);ge.current=H;let[P,Xe]=useState(false),[De,ze]=useState("light"),{themeConfig:fe}=F();useEffect(()=>{Xe(window.innerWidth<640);let G=window.matchMedia("(prefers-color-scheme: dark)");ze(G.matches?"dark":"light");let j=_=>ze(_.matches?"dark":"light");return G.addEventListener("change",j),()=>G.removeEventListener("change",j)},[]);let m=useMemo(()=>oe(r,De,fe),[r,De,fe]);useEffect(()=>{He(m);},[m]);let me=typeof window>"u"||!Y?false:window.innerHeight-Y.bottom<300;useEffect(()=>{let G=Ge.current;if(!G)return;Fe.current?.focus();let j=_=>{if(_.key==="Escape"){ge.current();return}if(_.key==="Tab"){let ce=G.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),Pe=ce[0],Se=ce[ce.length-1];_.shiftKey&&document.activeElement===Pe?(_.preventDefault(),Se?.focus()):!_.shiftKey&&document.activeElement===Se&&(_.preventDefault(),Pe?.focus());}};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[]);let se=e==="vote"?"What do you think?":e==="poll"?"Cast your vote":e==="nps"?y||"How likely are you to recommend us?":"What do you think of this feature?",he=P?24:20,be=e==="nps"?420:340,qe=P?"gotcha-modal-enter-center":me?"gotcha-modal-enter-above":"gotcha-modal-enter",ye=typeof window<"u"?window.innerHeight:0,V=P?{position:"fixed",left:"50%",top:"50%",transform:"translate(-50%, -50%)",width:"calc(100vw - 32px)",maxWidth:be,padding:he,borderRadius:m.borders.radius.lg+2,background:m.colors.backgroundGradient,color:m.colors.text,boxShadow:m.shadows.modal,border:`${m.borders.width}px solid ${m.colors.border}`,zIndex:9999,fontFamily:m.typography.fontFamily,...o?.modal,textAlign:"left"}:je&&Y&&ye?{position:"fixed",left:Y.left+Y.width/2,width:be,padding:he,borderRadius:m.borders.radius.lg,background:m.colors.backgroundGradient,color:m.colors.text,boxShadow:m.shadows.modal,border:`${m.borders.width}px solid ${m.colors.border}`,zIndex:99999,fontFamily:m.typography.fontFamily,...me?{bottom:ye-Y.top+8,transform:"translateX(-50%)"}:{top:Y.bottom+8,transform:"translateX(-50%)"},...o?.modal,textAlign:"left"}:{position:"absolute",left:"50%",width:be,padding:he,borderRadius:m.borders.radius.lg,background:m.colors.backgroundGradient,color:m.colors.text,boxShadow:m.shadows.modal,border:`${m.borders.width}px solid ${m.colors.border}`,zIndex:9999,fontFamily:m.typography.fontFamily,...me?{bottom:"100%",marginBottom:8,transform:"translateX(-50%)"}:{top:"100%",marginTop:8,transform:"translateX(-50%)"},...o?.modal,textAlign:"left"},K=G=>P?{}:{animation:`gotcha-fade-up ${m.animation.duration.normal} ${m.animation.easing.default} both`,animationDelay:`${G*.05}s`},ae=l==="Gotcha!"||l==="Thanks for your feedback!";return jsxs("div",{ref:Ge,role:"dialog","aria-modal":"true","aria-label":s?"Feedback submitted":void 0,"aria-labelledby":s?void 0:"gotcha-modal-title","data-gotcha":true,style:V,className:Ne("gotcha-modal",qe),children:[jsx("button",{ref:Fe,type:"button",onClick:H,"aria-label":"Close feedback form",style:{position:"absolute",top:P?10:6,right:P?10:6,width:P?40:36,height:P?40:36,border:"none",background:"transparent",outline:"none",cursor:"pointer",zIndex:10,color:m.colors.closeButton,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:m.borders.radius.sm,transition:`all ${m.animation.duration.fast} ${m.animation.easing.default}`,...o?.closeButton},onMouseEnter:G=>{G.currentTarget.style.backgroundColor=m.colors.closeButtonBg,G.currentTarget.style.color=m.colors.closeButtonHover;},onMouseLeave:G=>{G.currentTarget.style.backgroundColor="transparent",G.currentTarget.style.color=m.colors.closeButton;},children:jsx("svg",{width:P?16:14,height:P?16:14,viewBox:"0 0 14 14",fill:"none",children:jsx("path",{d:"M1 1L13 13M1 13L13 1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),!s&&jsx("h2",{id:"gotcha-modal-title",style:{margin:"0 0 16px 0",fontSize:P?m.typography.fontSize.lg:m.typography.fontSize.md,fontWeight:m.typography.fontWeight.semibold,paddingRight:P?44:38,letterSpacing:"-0.02em",lineHeight:1.4,textAlign:"left",fontFamily:m.typography.fontFamily,...K(0),...o?.title},children:t||se}),s&&jsxs("div",{style:{textAlign:"center",padding:"28px 0 20px"},children:[jsx("div",{style:{width:52,height:52,borderRadius:"50%",backgroundColor:m.colors.successSurface,display:"flex",alignItems:"center",justifyContent:"center",margin:"0 auto 16px",animation:`gotcha-success-pop 0.4s ${m.animation.easing.spring} both, gotcha-glow-pulse 0.8s ease 0.4s`,...o?.successIcon},children:jsx("svg",{width:"26",height:"26",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M20 6L9 17L4 12",stroke:m.colors.success,strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",style:{strokeDasharray:24,strokeDashoffset:0,animation:"gotcha-check-draw 0.4s ease 0.2s both"}})})}),jsx("p",{style:{margin:0,fontSize:ae?22:m.typography.fontSize.md,fontWeight:ae?m.typography.fontWeight.bold:m.typography.fontWeight.medium,color:m.colors.text,fontFamily:ae?"'Carter One', cursive":m.typography.fontFamily,animation:"gotcha-success-text 0.3s ease 0.3s both",...o?.successMessage},children:ae?"Gotcha!":l}),ae&&jsx("p",{style:{margin:"6px 0 0",fontSize:m.typography.fontSize.sm,fontWeight:m.typography.fontWeight.normal,color:m.colors.textSecondary,animation:"gotcha-success-text 0.3s ease 0.45s both"},children:"Thanks for your feedback!"})]}),c&&!s&&jsxs("div",{style:{padding:"8px 10px",marginBottom:12,borderRadius:m.borders.radius.sm,backgroundColor:m.colors.errorSurface,border:`1px solid ${m.colors.errorBorder}`,color:m.colors.error,fontSize:m.typography.fontSize.sm,lineHeight:1.4,display:"flex",alignItems:"center",gap:8,...K(1),...o?.errorMessage},children:[jsx("svg",{width:14,height:14,viewBox:"0 0 24 24",fill:"none",style:{flexShrink:0},children:jsx("path",{d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})}),c]}),a==="followUp"&&h&&i&&jsx("div",{style:K(1),children:jsx(ct,{resolvedTheme:m,promptText:h.promptText,placeholder:h.placeholder,isLoading:d,onSubmit:i})}),a==="form"&&p&&jsx("div",{style:{display:"flex",justifyContent:"center",padding:"24px 0",...K(1)},children:jsx(L,{size:24,color:m.colors.textSecondary})}),a==="form"&&!p&&jsxs("div",{style:K(1),children:[e==="feedback"&&jsx(et,{resolvedTheme:m,placeholder:n,submitText:g,isLoading:u,onSubmit:b,customStyles:o,initialValues:f?{content:f.content,rating:f.rating}:void 0,isEditing:S,showText:x,showRating:B,enableBugFlag:z,bugFlagLabel:ne,enableScreenshot:U}),e==="vote"&&jsx(ot,{resolvedTheme:m,isLoading:u,onSubmit:b,initialVote:f?.vote||void 0,isEditing:S,labels:k}),e==="nps"&&jsx(at,{resolvedTheme:m,submitText:g,isLoading:u,onSubmit:b,showFollowUp:w,followUpPlaceholder:E,lowLabel:T,highLabel:v,customStyles:o,initialValues:f?{rating:f.rating,content:f.content}:void 0,isEditing:S}),e==="poll"&&A&&A.length>0&&jsx(nt,{resolvedTheme:m,options:A,allowMultiple:D,isLoading:u,onSubmit:b,initialSelected:f?.pollSelected||void 0,isEditing:S})]}),jsxs("div",{"aria-live":"polite",className:"sr-only",style:{position:"absolute",left:-9999},children:[s&&"Thank you! Your feedback has been submitted.",c&&`Error: ${c}`]})]})}function ar({elementId:e,user:r,mode:o="feedback",showText:t=true,showRating:n=true,voteLabels:g,options:l,allowMultiple:u=false,npsQuestion:p,npsFollowUp:s=true,npsFollowUpPlaceholder:a,npsLowLabel:h,npsHighLabel:d,enableBugFlag:i=false,bugFlagLabel:c,enableScreenshot:f=false,onePerUser:S=false,cooldownDays:x,hideAfterSubmitDays:B,showAfterSeconds:k,showAfterScrollPercent:A,showAfterVisits:D,followUp:y,animated:w=true,position:E=q.POSITION,size:T=q.SIZE,theme:v=q.THEME,customStyles:z,visible:ne=true,showOnHover:U=q.SHOW_ON_HOVER,touchBehavior:b=q.TOUCH_BEHAVIOR,promptText:H,placeholder:Y,submitText:je=q.SUBMIT_TEXT,thankYouMessage:Ge=q.THANK_YOU_MESSAGE,onSubmit:Fe,onOpen:ge,onClose:P,onError:Xe}){let{disabled:De,activeModalId:ze,openModal:fe,closeModal:m,defaultUser:me,client:se}=F(),{conditionsMet:he}=jo({elementId:e,showAfterSeconds:k,showAfterScrollPercent:A,showAfterVisits:D}),{isHidden:be,markHidden:qe}=Ko({elementId:e,userId:r?.id||me?.id,hideAfterSubmitDays:B}),[ye,V]=useState("form"),[K,ae]=useState(null),[G,j]=useState(false),[_,ce]=useState(0),[Pe,Se]=useState(false),[ft,mt]=useState(null),[xe,ht]=useState(false),[yo,bt]=useState(false),ve=useRef(null),we=useRef(),ke=useRef(null);useEffect(()=>(bt(true),ht(window.innerWidth<640),()=>{clearTimeout(we.current);}),[]),useEffect(()=>{ce(se.getQueueLength());let C=()=>{setTimeout(()=>ce(se.getQueueLength()),2e3);};return window.addEventListener("online",C),()=>window.removeEventListener("online",C)},[se]);let X=ze===e;useEffect(()=>{X||(V("form"),clearTimeout(we.current));},[X]),useEffect(()=>{if(!X||!xe)return;let C=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=C;}},[X,xe]),useEffect(()=>{if(!U)return;let C=ve.current;if(!C)return;let N=C.parentElement;if(!N)return;let ko=()=>Se(true),To=()=>Se(false);return N.addEventListener("mouseenter",ko),N.addEventListener("mouseleave",To),()=>{N.removeEventListener("mouseenter",ko),N.removeEventListener("mouseleave",To);}},[U]);let{submit:So,isLoading:yt,isCheckingExisting:St,error:xt,existingResponse:vt,isEditing:xo}=Wo({elementId:e,mode:o,pollOptions:l,user:r,onePerUser:S,cooldownDays:x,onSuccess:C=>{ae(C.id),B&&qe(),Fe?.(C),y&&ke.current&&(y.ratingThreshold!=null&&ke.current.rating!=null&&ke.current.rating<=y.ratingThreshold||y.onNegativeVote&&ke.current.vote==="down")&&o!=="poll"?V("followUp"):(V("success"),we.current=setTimeout(()=>{m(),V("form");},3e3));},onError:C=>{console.warn("[Gotcha] Submission failed:",C instanceof Error?C.message:C),Xe?.(C);}}),wt=useCallback(()=>{if(ve.current){let C=ve.current.querySelector("button");mt((C??ve.current).getBoundingClientRect());}fe(e),ge?.();},[e,fe,ge]),vo=useCallback(()=>{clearTimeout(we.current),m(),V("form"),P?.();},[m,P]),kt=useCallback(C=>{ke.current={rating:C.rating,vote:C.vote},So(C);},[So]),Tt=useCallback(async C=>{if(K){j(true);try{await se.updateResponse(K,{content:C});}catch(N){console.warn("[Gotcha] Follow-up submission failed:",N instanceof Error?N.message:N);}finally{j(false),V("success"),we.current=setTimeout(()=>{m(),V("form");},3e3);}}},[K,m,se]),Ct=S&&xo?"Update":je;if(De||!ne||be||!he)return null;let Et={"top-right":{position:"absolute",top:0,right:0,transform:"translate(50%, -50%)"},"top-left":{position:"absolute",top:0,left:0,transform:"translate(-50%, -50%)"},"bottom-right":{position:"absolute",bottom:0,right:0,transform:"translate(50%, 50%)"},"bottom-left":{position:"absolute",bottom:0,left:0,transform:"translate(-50%, 50%)"},inline:{position:"relative",display:"inline-flex"}},wo={mode:o,theme:v,customStyles:z,promptText:H,placeholder:Y,submitText:Ct,thankYouMessage:Ge,isLoading:yt,isCheckingExisting:S&&St,isSubmitted:ye==="success",phase:ye,followUpConfig:y,followUpLoading:G,onFollowUpSubmit:Tt,error:xt,existingResponse:S?vt:null,isEditing:S&&xo,showText:t,showRating:n,voteLabels:g,options:l,allowMultiple:u,npsQuestion:p,npsFollowUp:s,npsFollowUpPlaceholder:a,npsLowLabel:h,npsHighLabel:d,enableBugFlag:i,bugFlagLabel:c,enableScreenshot:f,onSubmit:kt,onClose:vo,anchorRect:ft||void 0,useFixedPosition:!xe};return jsxs("div",{ref:ve,style:{...Et[E],zIndex:X?1e4:"auto"},className:"gotcha-container","data-gotcha-element":e,children:[jsx(qo,{size:T,theme:v,customStyles:z,showOnHover:U,touchBehavior:b,onClick:wt,isOpen:X,isParentHovered:Pe,animated:w,queuedCount:_}),X&&!xe&&yo&&createPortal(jsx(mo,{...wo}),document.body),X&&xe&&yo&&createPortal(jsx("div",{role:"presentation",style:{position:"fixed",inset:0,zIndex:99999,backgroundColor:"rgba(0,0,0,0.4)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},className:"gotcha-overlay-enter",onClick:vo,children:jsx("div",{onClick:C=>C.stopPropagation(),children:jsx(mo,{...wo})})}),document.body)]})}function pt({elementId:e,refreshInterval:r}){let{client:o}=F(),[t,n]=useState(null),[g,l]=useState(true),[u,p]=useState(null);return useEffect(()=>{let s=false,a=async()=>{try{let d=await o.getScore(e);s||(n(d),p(null));}catch(d){s||p(d instanceof Error?d.message:"Failed to load score");}finally{s||l(false);}};a();let h;return r&&r>0&&(h=setInterval(a,r)),()=>{s=true,h&&clearInterval(h);}},[o,e,r]),{score:t,isLoading:g,error:u}}var pr={sm:{fontSize:11,ratingFontSize:13,starSize:13,gap:5,pillPx:8,pillPy:4,barHeight:3,iconSize:12},md:{fontSize:12.5,ratingFontSize:15,starSize:15,gap:6,pillPx:10,pillPy:5,barHeight:4,iconSize:14},lg:{fontSize:14,ratingFontSize:18,starSize:18,gap:8,pillPx:12,pillPy:6,barHeight:5,iconSize:16}};function gr({rating:e,size:r,filledColor:o,emptyColor:t}){let n=`gotcha-star-clip-${Math.random().toString(36).slice(2,8)}`,g=[];for(let l=1;l<=5;l++){let u=Math.min(1,Math.max(0,e-(l-1))),p=`${n}-${l}`;g.push(jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",style:{display:"block"},children:[jsx("defs",{children:jsx("clipPath",{id:p,children:jsx("rect",{x:"0",y:"0",width:24*u,height:"24"})})}),jsx("path",{d:"M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z",fill:t}),jsx("path",{d:"M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z",fill:o,clipPath:`url(#${p})`})]},l));}return jsx("span",{style:{display:"inline-flex",gap:Math.max(1,r*.08),alignItems:"center"},children:g})}function fr({rate:e,height:r,filledColor:o,trackColor:t}){return jsx("span",{style:{display:"inline-block",width:48,height:r,borderRadius:r,backgroundColor:t,overflow:"hidden",verticalAlign:"middle"},children:jsx("span",{style:{display:"block",width:`${e}%`,height:"100%",borderRadius:r,background:o,transition:"width 0.6s cubic-bezier(0.4, 0, 0.2, 1)"}})})}function mr({size:e,color:r}){return jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:r,style:{display:"block"},children:jsx("path",{d:"M2 20h2c.55 0 1-.45 1-1v-9c0-.55-.45-1-1-1H2v11zm19.83-7.12c.11-.25.17-.52.17-.8V11c0-1.1-.9-2-2-2h-5.5l.92-4.65c.05-.22.02-.46-.08-.66a4.8 4.8 0 00-.88-1.12L14 2 7.59 8.41C7.21 8.79 7 9.3 7 9.83v7.84C7 18.95 8.05 20 9.34 20h8.11c.7 0 1.36-.37 1.72-.97l2.66-6.15z"})})}function hr({elementId:e,variant:r="stars",showCount:o=true,size:t="md",theme:n="auto",refreshInterval:g,style:l}){let{score:u,isLoading:p}=pt({elementId:e,refreshInterval:g}),[s,a]=useState("light");useEffect(()=>{if(typeof window>"u")return;let T=window.matchMedia("(prefers-color-scheme: dark)");a(T.matches?"dark":"light");let v=z=>a(z.matches?"dark":"light");return T.addEventListener("change",v),()=>T.removeEventListener("change",v)},[]);let{themeConfig:h}=F(),d=useMemo(()=>oe(n,s,h),[n,s,h]);if(p||!u)return null;let i=pr[t],c=d.colors.text,f=d.colors.textDisabled,S=d.colors.starFilled,x=d.colors.starEmpty,B=d.colors.voteUp,k=d.colors.starEmpty,A={display:"inline-flex",alignItems:"center",gap:i.gap,fontFamily:d.typography.fontFamily,lineHeight:1,letterSpacing:"-0.01em",WebkitFontSmoothing:"antialiased",...l},D=(T,v)=>{let z=T===1?v:`${v}s`;return `${T.toLocaleString()} ${z}`};if(r==="votes"){let{voteCount:T,positiveRate:v}=u,z=T.up+T.down;return z===0?null:jsxs("span",{style:A,children:[jsx(mr,{size:i.iconSize,color:B}),jsxs("span",{style:{fontSize:i.ratingFontSize,fontWeight:600,color:B,fontVariantNumeric:"tabular-nums"},children:[v,"%"]}),jsx(fr,{rate:v??0,height:i.barHeight,filledColor:B,trackColor:k}),o&&jsx("span",{style:{fontSize:i.fontSize,color:f,fontWeight:400},children:D(z,"vote")})]})}let{averageRating:y,totalResponses:w}=u;if(y===null||w===0)return null;let E=y.toFixed(1);return r==="compact"?jsxs("span",{style:A,children:[jsx("svg",{width:i.starSize,height:i.starSize,viewBox:"0 0 24 24",style:{display:"block",flexShrink:0},children:jsx("path",{d:"M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z",fill:S})}),jsx("span",{style:{fontSize:i.ratingFontSize,fontWeight:700,color:c,fontVariantNumeric:"tabular-nums"},children:E}),o&&jsxs("span",{style:{fontSize:i.fontSize,color:f,fontWeight:400},children:["(",w.toLocaleString(),")"]})]}):r==="number"?jsxs("span",{style:A,children:[jsx("span",{style:{fontSize:i.ratingFontSize,fontWeight:700,color:c,fontVariantNumeric:"tabular-nums"},children:E}),jsx("span",{style:{fontSize:i.fontSize,color:f,fontWeight:400},children:"/ 5"}),o&&jsxs("span",{style:{fontSize:i.fontSize,color:f,fontWeight:400,marginLeft:2},children:["(",D(w,"response"),")"]})]}):jsxs("span",{style:A,children:[jsx(gr,{rating:y,size:i.starSize,filledColor:S,emptyColor:x}),jsx("span",{style:{fontSize:i.ratingFontSize,fontWeight:700,color:c,fontVariantNumeric:"tabular-nums"},children:E}),o&&jsxs("span",{style:{fontSize:i.fontSize,color:f,fontWeight:400},children:["(",D(w,"response"),")"]})]})}function br(){let{client:e,disabled:r,defaultUser:o,debug:t,openModal:n,closeModal:g,activeModalId:l}=F();return {client:e,disabled:r,defaultUser:o,debug:t,submitFeedback:e.submitResponse.bind(e),openModal:n,closeModal:g,activeModalId:l}}function yr(e){let{activeModalId:r,openModal:o,closeModal:t}=F(),n=useCallback(()=>o(e),[o,e]),g=useCallback(()=>t(),[t]);return {open:n,close:g,isOpen:r===e}}
|
|
160
160
|
export{ar as Gotcha,$t as GotchaProvider,hr as GotchaScore,It as createTheme,br as useGotcha,yr as useGotchaTrigger};//# sourceMappingURL=index.mjs.map
|
|
161
161
|
//# sourceMappingURL=index.mjs.map
|