@frigade/react 2.0.33 → 2.0.34

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 CHANGED
@@ -35,7 +35,7 @@ var no=Object.defineProperty,ht=Object.defineProperties;var Pt=Object.getOwnProp
35
35
  height: 0;
36
36
  opacity: 0;
37
37
  }
38
- `,Gr=()=>jsx(m,{as:"svg",color:"primary.foreground",width:"10px",height:"8px",viewBox:"0 0 10 8",fill:"none",children:jsx("path",{d:"M1 4.34664L3.4618 6.99729L3.4459 6.98017L9 1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})});function Xr({checked:e=!1}){return jsx(m,{backgroundColor:"inherit",borderWidth:"md",borderStyle:"solid",borderColor:"neutral.border",borderRadius:"100%",padding:"0",part:"field-radio-value",position:"relative",height:"22px",width:"22px",children:e&&jsx(m,{alignItems:"center",bg:"green500",borderWidth:"md",borderStyle:"solid",borderColor:"green500",borderRadius:"100%",display:"flex",height:"calc(100% + 2px)",justifyContent:"center",left:"-1px",part:"field-radio-indicator",position:"absolute",top:"-1px",width:"calc(100% + 2px)",children:jsx(Gr,{})})})}function Ke({children:e}){return jsx(pe.Content,{asChild:!0,children:jsxs(b.Column,{css:{'&[data-state="open"]':{animation:`${Kr} 300ms ease-out`},'&[data-state="closed"]':{animation:`${Ur} 300ms ease-out`},overflow:"hidden"},gap:5,children:[jsx(m,{}),e]})})}function Ue(s){var a=s,{children:e,disabled:o=!1,onOpenChange:t=()=>{},open:r=!1}=a,n=d(a,["children","disabled","onOpenChange","open"]);return jsx(pe.Root,{asChild:!0,disabled:o,open:r,onOpenChange:t,children:jsx(x,l(i({borderWidth:"md",css:{'&[data-state="open"] .fr-collapsible-step-icon':{transform:"rotate(180deg)"}},gap:0},n),{children:e}))})}function Ge({isCompleted:e,title:o}){return jsx(pe.Trigger,{asChild:!0,children:jsxs(b.Row,{alignItems:"center",justifyContent:"space-between",margin:-5,padding:5,zIndex:1,children:[jsxs(b.Row,{alignItems:"center",gap:2,children:[jsx(Xr,{checked:e}),jsx(C.Body2,{fontWeight:"demibold",userSelect:"none",children:o})]}),jsx(m,{as:ChevronDownIcon,color:"gray100",css:{"& path":{vectorEffect:"non-scaling-stroke"}},display:"block",height:"16px",order:2,part:"collapsible-step-icon",width:"16px"})]})})}var we={};z(we,{Bar:()=>Te,Dots:()=>_o,Segments:()=>jo});function Te(r){var n=r,{current:e,total:o}=n,t=d(n,["current","total"]);let s=o>0?Math.min(e/o,1):0,a=s===0?"10px":`${100*s}%`;return jsx(m,l(i({part:"progress-bar",backgroundColor:"blue800",borderRadius:"md",height:"10px"},t),{children:jsx(m,{backgroundColor:"primary.surface",part:"progress-bar-fill",borderRadius:"md",height:"100%",style:{width:a},transition:"width 300ms ease-out"})}))}function _o(r){var n=r,{current:e,total:o}=n,t=d(n,["current","total"]);if(o==1)return null;let s=[...Array(o)].map((a,p)=>jsx(m,{as:"circle",r:4,cx:4+16*p,cy:"4px",fill:e-1===p?T.colors.blue500:T.colors.blue800},p));return jsx(m,l(i({as:"svg",height:"8px",part:"progress-dots",viewBox:`0 0 ${16*o-8} 8`,width:16*o-8},t),{children:s}))}function jo(r){var n=r,{current:e,total:o}=n,t=d(n,["current","total"]);let s=[...Array(o)].map((a,p)=>jsx(m,{backgroundColor:e-1===p?"primary.surface":"blue800",borderRadius:"md",flexGrow:1,height:"100%"},p));return jsx(b.Row,l(i({gap:1,height:"10px"},t),{children:s}))}var Ko=createContext({onPrimary:()=>{},onSecondary:()=>{},openStepId:null,setOpenStepId:()=>{},stepTypes:{}});function Uo({handlePrimary:e,handleSecondary:o,open:t,onOpenChange:r,step:n}){var y,S;let{isBlocked:s,isCompleted:a,primaryButtonTitle:p,secondaryButtonTitle:c,subtitle:u,title:g}=n,h=(y=n.props)!=null?y:{};return jsxs(Ue,l(i({open:t,onOpenChange:r},h),{children:[jsx(Ge,{isCompleted:a,title:g}),jsxs(Ke,{children:[jsx(x.Media,{aspectRatio:2.5,objectFit:"cover",src:(S=n.videoUri)!=null?S:n.imageUri,type:n.videoUri?"video":"image"}),jsx(x.Subtitle,{color:"gray500",children:u}),jsxs(b.Row,{gap:3,children:[jsx(x.Secondary,{disabled:!!(a||s),title:c,onClick:o}),jsx(x.Primary,{disabled:!!(a||s),title:p,onClick:e})]})]})]}))}var Qr={default:Uo};function Zr(r){var n=r,{flow:e,step:o}=n,t=d(n,["flow","step"]);var F;let{onPrimary:s,onSecondary:a,openStepId:p,setOpenStepId:c,stepTypes:u}=useContext(Ko),{handlePrimary:g,handleSecondary:h}=te(o,{onPrimary:s,onSecondary:a}),y=(p!=null?p:e.getCurrentStep().id)===o.id,S=(F=u[o.type])!=null?F:Uo;function P(O){return D(this,null,function*(){c(O?o.id:""),O&&!o.isCompleted&&(yield o.start());})}return jsx(S,l(i({flow:e,onOpenChange:P,open:y,step:o},t),{handlePrimary:g,handleSecondary:h}),o.id)}function Go(a){var p=a,{dismissible:e,flowId:o,onPrimary:t,onSecondary:r,stepTypes:n={}}=p,s=d(p,["dismissible","flowId","onPrimary","onSecondary","stepTypes"]);let[c,u]=useState(null),g=i(i({},Qr),n);return jsx(Ko.Provider,{value:{openStepId:c,setOpenStepId:u,onPrimary:t,onSecondary:r,stepTypes:g},children:jsx(N,l(i({as:x,borderWidth:"md",flowId:o,part:"checklist"},s),{children:P=>{var F=P,{flow:h,handleDismiss:y}=F,S=d(F,["flow","handleDismiss"]);let O=Array.from(h.steps.entries()).map(([,Y])=>jsx(Zr,l(i({flow:h,handleDismiss:y},S),{step:Y}),Y.id)),$=h.getNumberOfCompletedSteps(),G=h.getNumberOfAvailableSteps();return jsxs(Fragment,{children:[jsxs(b.Column,{gap:2,children:[jsxs(b.Row,{alignItems:"center",flexWrap:"wrap",gap:1,justifyContent:"space-between",part:"checklist-header",children:[jsx(x.Title,{children:h.title}),e&&jsx(x.Dismiss,{onClick:y}),jsx(x.Subtitle,{color:"gray500",flexBasis:"100%",children:h.subtitle})]}),jsxs(b.Row,{alignItems:"center",gap:2,children:[jsxs(C.Body2,{fontWeight:"demibold",children:[$,"/",G]}),jsx(Te,{current:$,total:G,flexGrow:1})]})]}),O]})}}))})}var rn=new Set(["required","min","max","minLength","maxLength","pattern"]);function nn({fieldComponent:e,control:o,fieldData:t,submit:r}){t.pattern!=null&&(typeof t.pattern=="string"?t.pattern=new RegExp(t.pattern.replace(/^\/|\/$/g,"")):typeof t.pattern=="object"&&typeof t.pattern.value=="string"&&(t.pattern.value=new RegExp(t.pattern.value.replace(/^\/|\/$/g,""))));let n=Object.fromEntries(Object.entries(t).filter(([a])=>rn.has(a))),s=useController({name:t.id,control:o,rules:n});return jsx(e,l(i({},s),{fieldData:t,submit:r}))}function Xo({fieldTypes:e,handleDismiss:o,handlePrimary:t,handleSecondary:r,parentProps:{dismissible:n},step:s}){var y,S,P;let{control:a,handleSubmit:p}=useForm({delayError:2e3,mode:"onChange"}),c=[],u=(y=s.props)!=null?y:{};function g(F,O){t(O,F);}function h(F,O){r(O,F);}return (S=s.fields)==null||S.forEach(F=>{e[F.type]!=null&&c.push(jsx(nn,{control:a,fieldComponent:e[F.type],fieldData:F,submit:p(g)},F.id));}),jsxs(b.Column,l(i({gap:5,part:"form-step"},u),{children:[jsxs(b.Row,{alignItems:"center",flexWrap:"wrap",gap:1,justifyContent:"space-between",part:"form-step-header",children:[jsx(x.Title,{children:s.title}),n&&jsx(x.Dismiss,{onClick:o}),jsx(x.Subtitle,{flexBasis:"100%",children:s.subtitle})]}),c,jsxs(b.Row,{part:"form-step-footer",justifyContent:"flex-end",gap:3,children:[s.secondaryButtonTitle&&jsx(w.Secondary,{title:s.secondaryButtonTitle,onClick:p(h)}),jsx(w.Primary,{title:(P=s.primaryButtonTitle)!=null?P:"Submit",onClick:p(g)})]},"form-footer")]}))}function Jo({error:e}){var o;return (o=e==null?void 0:e.message)!=null&&o.length?jsx(C.Caption,{color:"red500",display:"block",part:"field-error",textAlign:"end",children:e==null?void 0:e.message}):null}function qo({children:e,id:o,required:t=!1}){return jsxs(C.H4,{as:"label",htmlFor:o,part:"field-label",children:[e,t&&" *"]})}var be={px:"4",py:"2",backgroundColor:"neutral.background",borderColor:"neutral.border",borderStyle:"solid",borderWidth:"md",borderRadius:"md",display:"block",outline:"none",width:"100%"};function q({children:e,field:o,fieldData:t,fieldState:r}){var u;let{id:n,label:s,placeholder:a}=t,{error:p}=r,c=l(i(i(i({id:n},o),a?{placeholder:a}:{}),be),{"aria-invalid":!!p,value:(u=o.value)!=null?u:""});return jsxs(m,{part:"field",children:[jsx(qo,{id:n,required:!!t.required,children:s}),e(c),jsx(Jo,{error:p})]})}var pn=()=>jsx(m,{as:"svg",color:"primary.foreground",width:"10px",height:"8px",viewBox:"0 0 10 8",fill:"none",children:jsx("path",{d:"M1 4.34664L3.4618 6.99729L3.4459 6.98017L9 1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),dn=Ve.forwardRef(({label:e,value:o},t)=>jsxs(m,{as:"label",backgroundColor:"neutral.background",borderColor:"neutral.border",borderRadius:"md",borderStyle:"solid",borderWidth:"md",display:"flex",htmlFor:o,justifyContent:"space-between",part:"field-radio",px:4,py:2,children:[jsx(C.Body2,{part:"field-radio-label",children:e}),jsx(de.Item,{id:o,value:o,ref:t,asChild:!0,children:jsx(m,{as:"button",backgroundColor:"inherit",borderWidth:"md",borderStyle:"solid",borderColor:"neutral.border",borderRadius:"100%",padding:"0",part:"field-radio-value",position:"relative",height:"24px",width:"24px",children:jsx(m,{as:de.Indicator,alignItems:"center",bg:"primary.surface",borderWidth:"md",borderStyle:"solid",borderColor:"primary.border",borderRadius:"100%",display:"flex",height:"calc(100% + 2px)",justifyContent:"center",left:"-1px",part:"field-radio-indicator",position:"absolute",top:"-1px",width:"calc(100% + 2px)",children:jsx(pn,{})})})})]}));function et(e){let{field:{onChange:o,value:t},fieldData:{options:r=[]}}=e,n=r.map(({label:s,value:a})=>jsx(dn,{value:a,label:s},a));return jsx(q,l(i({},e),{children:()=>jsx(de.Root,{value:t,onValueChange:o,asChild:!0,children:jsx(b.Column,{gap:2,part:"field-radio-group",children:n})})}))}var mn=Ve.forwardRef(({label:e,value:o},t)=>jsx(v.Item,{value:o,ref:t,asChild:!0,children:jsx(m,{"backgroundColor:hover":"blue900",borderRadius:"md",outline:"none",part:"field-select-option",px:"3",py:"2",children:jsx(v.ItemText,{asChild:!0,children:jsx(C.Body2,{part:"field-select-option-label",children:e})})})}));function rt(e){let{field:{onChange:o,value:t},fieldData:{options:r=[],placeholder:n}}=e,s=r.map(({label:a,value:p})=>jsx(mn,{value:p,label:a},p));return jsx(q,l(i({},e),{children:()=>jsxs(v.Root,{value:t,onValueChange:o,children:[jsx(v.Trigger,{asChild:!0,children:jsxs(C.Body2,l(i({},be),{alignItems:"center",display:"flex",justifyContent:"space-between",part:"field-select",children:[jsx(v.Value,{placeholder:n!=null?n:"Select one"}),jsx(v.Icon,{children:jsx(m,{as:ChevronDownIcon,color:"gray100",display:"block",height:"24px",part:"field-select-icon",width:"24px"})})]}))}),jsx(v.Portal,{children:jsx(v.Content,{position:"popper",sideOffset:4,asChild:!0,children:jsx(m,l(i({},be),{p:"1",part:"field-select-options",width:"var(--radix-popper-anchor-width)",children:jsx(v.Viewport,{children:s})}))})})]})}))}function it(e){return jsx(q,l(i({},e),{children:o=>jsx(C.Body2,i({as:"input",part:"field-text",type:"text"},o))}))}function at(e){return jsx(q,l(i({},e),{children:o=>jsx(C.Body2,i({as:"textarea",part:"field-textarea"},o))}))}var fn={radio:et,select:rt,text:it,textarea:at};function qe(r){var n=r,{fieldTypes:e={},flowId:o}=n,t=d(n,["fieldTypes","flowId"]);let s=Object.assign({},fn,e);return jsx(N,l(i({flowId:o,part:"form"},t),{children:a=>jsx(Xo,i({fieldTypes:s},a))}))}var Ye={};z(Ye,{NPS:()=>ct});function dt({field:e,submit:o}){let t=[...Array(11)].map((r,n)=>{let s=e.value===n?w.Primary:w.Secondary;return jsx(s,{borderWidth:"1px",onClick:()=>{e.onChange(n),o();},title:`${n}`,css:{".fr-button-title":{fontSize:"15px"}}},n)});return jsxs(b.Column,{gap:2,children:[jsx(b.Row,{gap:2,justifyContent:"space-between",part:"field-nps",children:t}),jsxs(b.Row,{justifyContent:"space-between",part:"field-nps-label",children:[jsx(C.Caption,{part:"field-nps-left-label",color:"gray600",children:"Not likely at all"}),jsx(C.Caption,{part:"field-nps-right-label",color:"gray600",children:"Extremely likely"})]})]})}function ct(n){var s=n,{as:e=R,flowId:o,fieldTypes:t}=s,r=d(s,["as","flowId","fieldTypes"]);let{flow:a}=ee(o);return jsx(qe,i({alignSelf:"end",as:e,flowId:o,fieldTypes:i({nps:dt},t),minWidth:"620px",modal:!1,width:"620px",css:l(i({},!a||a.getCurrentStepIndex()==0?{".fr-form-step-footer":{display:"none"}}:{}),{".fr-form":{padding:"20px"},".fr-form-step":{gap:"1"}})},r))}function Be(){let e="DOMRect"in globalThis?new DOMRect:{height:0,width:0,x:0,y:0,bottom:0,top:0,right:0,left:0,toJSON:()=>{}},[o,t]=useState(e),[r,n]=useState(null),s=useCallback(a=>{n(a);},[]);return useLayoutEffect(()=>{if(!r)return;let a=()=>{let p=r.getBoundingClientRect();t(p);};return a(),window.addEventListener("resize",a),()=>window.removeEventListener("resize",a)},[r]),{node:r,rect:o,ref:s}}var hn=keyframes({"0%":{opacity:.5,transform:"scale(0.5)"},"50%":{opacity:0,transform:"scale(1)"},"100%":{opacity:0,transform:"scale(1)"}});function ft(r){var n=r,{style:e={},part:o=""}=n,t=d(n,["style","part"]);return jsxs(m,l(i({part:`dot-wrapper ${o}`,style:i({height:"48px",position:"absolute",width:"48px"},e)},t),{children:[jsx(m,{backgroundColor:"primary.surface",part:"dot-pulse",css:{animation:`2s ease-out infinite ${hn}`,borderRadius:"24px",height:"48px",left:0,position:"absolute",top:0,transformOrigin:"center center",width:"48px"}}),jsx(m,{backgroundColor:"primary.surface",part:"dot",style:{borderRadius:"12px",height:"24px",left:"12px",position:"absolute",top:"12px",width:"24px"}})]}))}function gt({props:e,alignAttr:o,sideAttr:t}){let r=t!=null?t:"bottom",n={},s=()=>{var u;if(["after","before"].includes(e.align)){if(o=="start")return "before";if(o=="end")return "after"}return (u=e.align)!=null?u:"after"},a="-24px",p={top:"bottom",right:"left",bottom:"top",left:"right"};n[p[r]]=a;let c=s();return ["before","end"].includes(c)?["top","bottom"].includes(r)?n.right=a:n.bottom=a:["after","start"].includes(c)?["top","bottom"].includes(r)?n.left=a:n.top=a:["top","bottom"].includes(r)?n.left=`calc(50% + ${a})`:n.top=`calc(50% + ${a})`,n}var ve={content:["align","alignOffset","arrowPadding","avoidCollisions","collisionBoundary","collisionPadding","forceMount","hideWhenDetached","onCloseAutoFocus","onEscapeKeyDown","onFocusOutside","onInteractOutside","onOpenAutoFocus","onPointerDownOutside","side","sideOffset","sticky"],root:["defaultOpen","modal","onOpenChange","open"]};function xt(e,o){var s,a,p,c,u;let t=Object.fromEntries(ve.content.map(g=>[g,e[g]]).filter(g=>g[1]!==void 0)),r=Object.fromEntries(ve.root.map(g=>[g,e[g]]).filter(g=>g[1]!==void 0)),n={};for(let g of Object.keys(e))!ve.content.includes(g)&&!ve.root.includes(g)&&(n[g]=e[g]);if(t.align=(s=t.align)!=null?s:"after",t.side=(a=t.side)!=null?a:"bottom",["before","after"].includes(t.align)){let g={after:"end",before:"start"},h=($,G)=>["top","bottom"].includes(G)?$=="after"?"marginLeft":"marginRight":$=="after"?"marginTop":"marginBottom",y=(p=t.alignOffset)!=null?p:0,S=(c=t.style)!=null?c:{},P=(u=t.side)!=null?u:"bottom",F=t.align;t.style=l(i({},S),{[h(F,P)]:y});let O=["top","bottom"].includes(P)?o.width:o.height;t.alignOffset=(O+y)*-1,t.align=g[F];}return {contentProps:t,otherProps:n,rootProps:r}}function k(a){var p=a,{anchor:e,children:o,className:t,spotlight:r=!1,style:n}=p,s=d(p,["anchor","children","className","spotlight","style"]);let{node:c,rect:u,ref:g}=Be(),{node:h,rect:y,ref:S}=Be(),{contentProps:P,otherProps:F,rootProps:O}=xt(s,u),[$,G]=useState(P.align),[Y,ce]=useState(P.side),[De,Ee]=useState(0),[Oe,oo]=useState(0);if(c!==null){let L=c.getAttribute("data-align"),Q=c.getAttribute("data-side");$!==L&&G(L),Y!==Q&&ce(Q);}let he=useRef(null);if(useEffect(()=>{let L=document.querySelector(e);L!=null?(S(L),he.current=L):console.debug(`[frigade] Tooltip: No anchor found for query: ${e}`);},[e]),useEffect(()=>{function L(ue){if(ue.matches(e))return ue;let le=ue.querySelectorAll(e);return le.length>0?le[0]:null}let Q=new MutationObserver(ue=>{for(let le of ue)if(le.type==="childList"){for(let me of le.addedNodes){if(me.nodeType!==Node.ELEMENT_NODE)continue;let Z=L(me);if(Z!=null){S(Z),he.current=Z,console.debug("[frigade] Tooltip: MutationObserver added anchor: ",Z);break}}for(let me of le.removedNodes){if(me.nodeType!==Node.ELEMENT_NODE)continue;let Z=L(me);if(Z!=null){S(null),he.current=null,console.debug("[frigade] Tooltip: MutationObserver removed anchor: ",Z);break}}}});return Q.observe(document.querySelector("body"),{childList:!0,subtree:!0}),()=>Q.disconnect()},[]),useEffect(()=>{let{scrollX:L,scrollY:Q}=window;Ee(y.left+L),oo(y.top+Q);},[y.left,y.top]),h==null)return null;let to="0";typeof window!="undefined"&&(to=window.getComputedStyle(h).borderRadius);let bt=gt({props:s,alignAttr:$,sideAttr:Y});return jsxs(_.Root,l(i({defaultOpen:!0},O),{children:[jsx(_.Anchor,{virtualRef:he}),jsx(_.Portal,{children:jsxs(Fragment,{children:[r&&jsx(m,i({boxShadow:"0 0 0 20000px rgb(0 0 0 / 0.5)",part:"tooltip-spotlight",pointerEvents:"none",position:"absolute",style:{borderRadius:to,height:y.height,left:De,top:Oe,width:y.width}},s.zIndex!=null?{zIndex:s.zIndex}:{})),jsx(_.Content,l(i({asChild:!0},P),{ref:g,children:jsxs(x,l(i({boxShadow:"md",part:"tooltip",position:"relative",className:t,css:{maxWidth:"360px",pointerEvents:"auto"},style:n},F),{children:[jsx(ft,{style:bt}),o]}))}))]})})]}))}k.Close=e=>jsx(_.Close,{"aria-label":"Close",asChild:!0,children:jsx(w.Plain,l(i({css:{top:"12px",right:"4px"},part:"close",position:"absolute"},e),{children:jsx(XMarkIcon,{height:"24",fill:"currentColor"})}))});k.Media=t=>{var r=t,{src:e}=r,o=d(r,["src"]);return e==null?null:jsx(ne,i({borderRadius:"md md 0 0",borderWidth:"0",css:{aspectRatio:"2",objectFit:"cover"},margin:"-5 -5 0",src:e},o))};k.Primary=r=>{var n=r,{onClick:e,title:o}=n,t=d(n,["onClick","title"]);return o==null?null:jsx(w.Primary,i({title:o,onClick:e},t))};k.Progress=t=>{var r=t,{children:e}=r,o=d(r,["children"]);return e==null?null:jsx(C.H4,l(i({part:"progress"},o),{children:e}))};k.Secondary=r=>{var n=r,{onClick:e,title:o}=n,t=d(n,["onClick","title"]);return o==null?null:jsx(w.Secondary,i({title:o,onClick:e},t))};k.Subtitle=t=>{var r=t,{children:e}=r,o=d(r,["children"]);return e==null?null:jsx(C.Body2,l(i({part:"subtitle"},o),{children:e}))};k.Title=t=>{var r=t,{children:e}=r,o=d(r,["children"]);return e==null?null:jsx(C.H4,l(i({part:"title"},o),{children:e}))};function yt(p){var c=p,{dismissible:e=!0,flow:o,onDismiss:t,onPrimary:r,onSecondary:n,step:s}=c,a=d(c,["dismissible","flow","onDismiss","onPrimary","onSecondary","step"]);var S,P;let{handleDismiss:u}=oe(o,{onDismiss:t}),{handlePrimary:g,handleSecondary:h}=te(s,{onPrimary:r,onSecondary:n}),y=(S=s.props)!=null?S:{};return jsxs(k,l(i(i({anchor:s.selector,onOpenAutoFocus:F=>F.preventDefault(),onPointerDownOutside:F=>F.preventDefault(),onInteractOutside:F=>F.preventDefault()},a),y),{children:[e&&jsx(k.Close,{onClick:u}),jsx(k.Media,{src:(P=s.videoUri)!=null?P:s.imageUri,type:s.videoUri?"video":"image"}),jsxs(b.Column,{gap:1,part:"tooltip-header",children:[jsx(k.Title,{children:s.title}),jsx(k.Subtitle,{color:"gray500",children:s.subtitle})]}),jsxs(b.Row,{alignItems:"center",gap:3,justifyContent:"flex-end",part:"tooltip-footer",children:[jsx(k.Progress,{marginRight:"auto",transform:"translateY(1px)",children:`${o.getNumberOfCompletedSteps()+1}/${o.getNumberOfAvailableSteps()}`}),jsx(k.Secondary,{title:s.secondaryButtonTitle,onClick:h}),jsx(k.Primary,{title:s.primaryButtonTitle,onClick:g})]})]}),s.id)}function wn(n){var s=n,{flowId:e,onComplete:o,variables:t}=s,r=d(s,["flowId","onComplete","variables"]);let{flow:a}=ee(e,{variables:t});oe(a,{onComplete:o});let{isCurrentModal:p,removeModal:c}=xe(a);if(useEffect(()=>{!(a!=null&&a.isVisible)&&p&&c();},[a==null?void 0:a.isVisible,p]),a==null||a.isVisible===!1||!p)return null;let u=a.getCurrentStep();return u==null||u.start(),jsx(yt,i({step:u,flow:a},r))}function vn(){let{frigade:e}=useContext(E);return {frigade:e,isLoading:!(e!=null&&e.isReady())}}function Dn(){let{userId:e,frigade:o}=useContext(E);function t(n){return D(this,null,function*(){yield o.identify(e,n);})}function r(n,s){return D(this,null,function*(){yield o.track(n,s);})}return {userId:e,addProperties:t,track:r}}function On(){let{groupId:e,frigade:o}=useContext(E);function t(n){return D(this,null,function*(){if(!e){console.error("No Group ID is set. Cannot set properties without a Group ID.");return}yield o.group(e,n);})}function r(n,s){return D(this,null,function*(){yield o.track(n,s);})}return {groupId:e,addProperties:t,track:r}}
38
+ `,Gr=()=>jsx(m,{as:"svg",color:"primary.foreground",width:"10px",height:"8px",viewBox:"0 0 10 8",fill:"none",children:jsx("path",{d:"M1 4.34664L3.4618 6.99729L3.4459 6.98017L9 1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})});function Xr({checked:e=!1}){return jsx(m,{backgroundColor:"inherit",borderWidth:"md",borderStyle:"solid",borderColor:"neutral.border",borderRadius:"100%",padding:"0",part:"field-radio-value",position:"relative",height:"22px",width:"22px",children:e&&jsx(m,{alignItems:"center",bg:"green500",borderWidth:"md",borderStyle:"solid",borderColor:"green500",borderRadius:"100%",display:"flex",height:"calc(100% + 2px)",justifyContent:"center",left:"-1px",part:"field-radio-indicator",position:"absolute",top:"-1px",width:"calc(100% + 2px)",children:jsx(Gr,{})})})}function Ke({children:e}){return jsx(pe.Content,{asChild:!0,children:jsxs(b.Column,{css:{'&[data-state="open"]':{animation:`${Kr} 300ms ease-out`},'&[data-state="closed"]':{animation:`${Ur} 300ms ease-out`},overflow:"hidden"},gap:5,children:[jsx(m,{}),e]})})}function Ue(s){var a=s,{children:e,disabled:o=!1,onOpenChange:t=()=>{},open:r=!1}=a,n=d(a,["children","disabled","onOpenChange","open"]);return jsx(pe.Root,{asChild:!0,disabled:o,open:r,onOpenChange:t,children:jsx(x,l(i({borderWidth:"md",css:{'&[data-state="open"] .fr-collapsible-step-icon':{transform:"rotate(180deg)"}},gap:0},n),{children:e}))})}function Ge({isCompleted:e,title:o}){return jsx(pe.Trigger,{asChild:!0,children:jsxs(b.Row,{alignItems:"center",justifyContent:"space-between",margin:-5,padding:5,zIndex:1,children:[jsxs(b.Row,{alignItems:"center",gap:2,children:[jsx(Xr,{checked:e}),jsx(C.Body2,{fontWeight:"demibold",userSelect:"none",children:o})]}),jsx(m,{as:ChevronDownIcon,color:"gray100",css:{"& path":{vectorEffect:"non-scaling-stroke"}},display:"block",height:"16px",order:2,part:"collapsible-step-icon",width:"16px"})]})})}var we={};z(we,{Bar:()=>Te,Dots:()=>_o,Segments:()=>jo});function Te(r){var n=r,{current:e,total:o}=n,t=d(n,["current","total"]);let s=o>0?Math.min(e/o,1):0,a=s===0?"10px":`${100*s}%`;return jsx(m,l(i({part:"progress-bar",backgroundColor:"blue800",borderRadius:"md",height:"10px"},t),{children:jsx(m,{backgroundColor:"primary.surface",part:"progress-bar-fill",borderRadius:"md",height:"100%",style:{width:a},transition:"width 300ms ease-out"})}))}function _o(r){var n=r,{current:e,total:o}=n,t=d(n,["current","total"]);if(o==1)return null;let s=[...Array(o)].map((a,p)=>jsx(m,{as:"circle",r:4,cx:4+16*p,cy:"4px",fill:e-1===p?T.colors.blue500:T.colors.blue800},p));return jsx(m,l(i({as:"svg",height:"8px",part:"progress-dots",viewBox:`0 0 ${16*o-8} 8`,width:16*o-8},t),{children:s}))}function jo(r){var n=r,{current:e,total:o}=n,t=d(n,["current","total"]);let s=[...Array(o)].map((a,p)=>jsx(m,{backgroundColor:e-1===p?"primary.surface":"blue800",borderRadius:"md",flexGrow:1,height:"100%"},p));return jsx(b.Row,l(i({gap:1,height:"10px"},t),{children:s}))}var Ko=createContext({onPrimary:()=>{},onSecondary:()=>{},openStepId:null,setOpenStepId:()=>{},stepTypes:{}});function Uo({handlePrimary:e,handleSecondary:o,open:t,onOpenChange:r,step:n}){var y,S;let{isBlocked:s,isCompleted:a,primaryButtonTitle:p,secondaryButtonTitle:c,subtitle:u,title:g}=n,h=(y=n.props)!=null?y:{};return jsxs(Ue,l(i({open:t,onOpenChange:r},h),{children:[jsx(Ge,{isCompleted:a,title:g}),jsxs(Ke,{children:[jsx(x.Media,{aspectRatio:2.5,objectFit:"cover",src:(S=n.videoUri)!=null?S:n.imageUri,type:n.videoUri?"video":"image"}),jsx(x.Subtitle,{color:"gray500",children:u}),jsxs(b.Row,{gap:3,children:[jsx(x.Secondary,{disabled:!!(a||s),title:c,onClick:o}),jsx(x.Primary,{disabled:!!(a||s),title:p,onClick:e})]})]})]}))}var Qr={default:Uo};function Zr(r){var n=r,{flow:e,step:o}=n,t=d(n,["flow","step"]);var F;let{onPrimary:s,onSecondary:a,openStepId:p,setOpenStepId:c,stepTypes:u}=useContext(Ko),{handlePrimary:g,handleSecondary:h}=te(o,{onPrimary:s,onSecondary:a}),y=(p!=null?p:e.getCurrentStep().id)===o.id,S=(F=u[o.type])!=null?F:Uo;function P(O){return D(this,null,function*(){c(O?o.id:""),O&&!o.isCompleted&&(yield o.start());})}return jsx(S,l(i({flow:e,onOpenChange:P,open:y,step:o},t),{handlePrimary:g,handleSecondary:h}),o.id)}function Go(a){var p=a,{dismissible:e,flowId:o,onPrimary:t,onSecondary:r,stepTypes:n={}}=p,s=d(p,["dismissible","flowId","onPrimary","onSecondary","stepTypes"]);let[c,u]=useState(null),g=i(i({},Qr),n);return jsx(Ko.Provider,{value:{openStepId:c,setOpenStepId:u,onPrimary:t,onSecondary:r,stepTypes:g},children:jsx(N,l(i({as:x,borderWidth:"md",flowId:o,part:"checklist"},s),{children:P=>{var F=P,{flow:h,handleDismiss:y}=F,S=d(F,["flow","handleDismiss"]);let O=Array.from(h.steps.entries()).map(([,Y])=>jsx(Zr,l(i({flow:h,handleDismiss:y},S),{step:Y}),Y.id)),$=h.getNumberOfCompletedSteps(),G=h.getNumberOfAvailableSteps();return jsxs(Fragment,{children:[jsxs(b.Column,{gap:2,children:[jsxs(b.Row,{alignItems:"center",flexWrap:"wrap",gap:1,justifyContent:"space-between",part:"checklist-header",children:[jsx(x.Title,{children:h.title}),e&&jsx(x.Dismiss,{onClick:y}),jsx(x.Subtitle,{color:"gray500",flexBasis:"100%",children:h.subtitle})]}),jsxs(b.Row,{alignItems:"center",gap:2,children:[jsxs(C.Body2,{fontWeight:"demibold",children:[$,"/",G]}),jsx(Te,{current:$,total:G,flexGrow:1})]})]}),O]})}}))})}var rn=new Set(["required","min","max","minLength","maxLength","pattern"]);function nn({fieldComponent:e,control:o,fieldData:t,submit:r}){t.pattern!=null&&(typeof t.pattern=="string"?t.pattern=new RegExp(t.pattern.replace(/^\/|\/$/g,"")):typeof t.pattern=="object"&&typeof t.pattern.value=="string"&&(t.pattern.value=new RegExp(t.pattern.value.replace(/^\/|\/$/g,""))));let n=Object.fromEntries(Object.entries(t).filter(([a])=>rn.has(a))),s=useController({name:t.id,control:o,rules:n});return jsx(e,l(i({},s),{fieldData:t,submit:r}))}function Xo({fieldTypes:e,handleDismiss:o,handlePrimary:t,handleSecondary:r,parentProps:{dismissible:n},step:s}){var y,S,P;let{control:a,handleSubmit:p}=useForm({delayError:2e3,mode:"onChange"}),c=[],u=(y=s.props)!=null?y:{};function g(F,O){t(O,F);}function h(F,O){r(O,F);}return (S=s.fields)==null||S.forEach(F=>{e[F.type]!=null&&c.push(jsx(nn,{control:a,fieldComponent:e[F.type],fieldData:F,submit:p(g)},F.id));}),jsxs(b.Column,l(i({gap:5,part:"form-step"},u),{children:[jsxs(b.Row,{alignItems:"center",flexWrap:"wrap",gap:1,justifyContent:"space-between",part:"form-step-header",children:[jsx(x.Title,{children:s.title}),n&&jsx(x.Dismiss,{onClick:o}),jsx(x.Subtitle,{flexBasis:"100%",children:s.subtitle})]}),c,jsxs(b.Row,{part:"form-step-footer",justifyContent:"flex-end",gap:3,children:[s.secondaryButtonTitle&&jsx(w.Secondary,{title:s.secondaryButtonTitle,onClick:p(h)}),jsx(w.Primary,{title:(P=s.primaryButtonTitle)!=null?P:"Submit",onClick:p(g)})]},"form-footer")]}))}function Jo({error:e}){var o;return (o=e==null?void 0:e.message)!=null&&o.length?jsx(C.Caption,{color:"red500",display:"block",part:"field-error",textAlign:"end",children:e==null?void 0:e.message}):null}function qo({children:e,id:o,required:t=!1}){return jsxs(C.Body2,{as:"label",htmlFor:o,part:"field-label",fontWeight:"bold",mb:"2",display:"block",children:[e,t&&" *"]})}var be={px:"4",py:"2",backgroundColor:"neutral.background",borderColor:"neutral.border",borderStyle:"solid",borderWidth:"md",borderRadius:"md",display:"block",outline:"none",width:"100%"};function q({children:e,field:o,fieldData:t,fieldState:r}){var u;let{id:n,label:s,placeholder:a}=t,{error:p}=r,c=l(i(i(i({id:n},o),a?{placeholder:a}:{}),be),{"aria-invalid":!!p,value:(u=o.value)!=null?u:""});return jsxs(m,{part:"field",children:[jsx(qo,{id:n,required:!!t.required,children:s}),e(c),jsx(Jo,{error:p})]})}var pn=()=>jsx(m,{as:"svg",color:"primary.foreground",width:"10px",height:"8px",viewBox:"0 0 10 8",fill:"none",children:jsx("path",{d:"M1 4.34664L3.4618 6.99729L3.4459 6.98017L9 1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),dn=Ve.forwardRef(({label:e,value:o},t)=>jsxs(m,{as:"label",backgroundColor:"neutral.background",borderColor:"neutral.border",borderRadius:"md",borderStyle:"solid",borderWidth:"md",display:"flex",htmlFor:o,justifyContent:"space-between",part:"field-radio",px:4,py:2,children:[jsx(C.Body2,{part:"field-radio-label",children:e}),jsx(de.Item,{id:o,value:o,ref:t,asChild:!0,children:jsx(m,{as:"button",backgroundColor:"inherit",borderWidth:"md",borderStyle:"solid",borderColor:"neutral.border",borderRadius:"100%",padding:"0",part:"field-radio-value",position:"relative",height:"24px",width:"24px",children:jsx(m,{as:de.Indicator,alignItems:"center",bg:"primary.surface",borderWidth:"md",borderStyle:"solid",borderColor:"primary.border",borderRadius:"100%",display:"flex",height:"calc(100% + 2px)",justifyContent:"center",left:"-1px",part:"field-radio-indicator",position:"absolute",top:"-1px",width:"calc(100% + 2px)",children:jsx(pn,{})})})})]}));function et(e){let{field:{onChange:o,value:t},fieldData:{options:r=[]}}=e,n=r.map(({label:s,value:a})=>jsx(dn,{value:a,label:s},a));return jsx(q,l(i({},e),{children:()=>jsx(de.Root,{value:t,onValueChange:o,asChild:!0,children:jsx(b.Column,{gap:2,part:"field-radio-group",children:n})})}))}var mn=Ve.forwardRef(({label:e,value:o},t)=>jsx(v.Item,{value:o,ref:t,asChild:!0,children:jsx(m,{"backgroundColor:hover":"blue900",borderRadius:"md",outline:"none",part:"field-select-option",px:"3",py:"2",children:jsx(v.ItemText,{asChild:!0,children:jsx(C.Body2,{part:"field-select-option-label",children:e})})})}));function rt(e){let{field:{onChange:o,value:t},fieldData:{options:r=[],placeholder:n}}=e,s=r.map(({label:a,value:p})=>jsx(mn,{value:p,label:a},p));return jsx(q,l(i({},e),{children:()=>jsxs(v.Root,{value:t,onValueChange:o,children:[jsx(v.Trigger,{asChild:!0,children:jsxs(C.Body2,l(i({},be),{alignItems:"center",display:"flex",justifyContent:"space-between",part:"field-select",children:[jsx(v.Value,{placeholder:n!=null?n:"Select one"}),jsx(v.Icon,{children:jsx(m,{as:ChevronDownIcon,color:"gray100",display:"block",height:"24px",part:"field-select-icon",width:"24px"})})]}))}),jsx(v.Portal,{children:jsx(v.Content,{position:"popper",sideOffset:4,asChild:!0,children:jsx(m,l(i({},be),{p:"1",part:"field-select-options",width:"var(--radix-popper-anchor-width)",children:jsx(v.Viewport,{children:s})}))})})]})}))}function it(e){return jsx(q,l(i({},e),{children:o=>jsx(C.Body2,i({as:"input",part:"field-text",type:"text"},o))}))}function at(e){return jsx(q,l(i({},e),{children:o=>jsx(C.Body2,i({as:"textarea",part:"field-textarea"},o))}))}var fn={radio:et,select:rt,text:it,textarea:at};function qe(r){var n=r,{fieldTypes:e={},flowId:o}=n,t=d(n,["fieldTypes","flowId"]);let s=Object.assign({},fn,e);return jsx(N,l(i({flowId:o,part:"form"},t),{children:a=>jsx(Xo,i({fieldTypes:s},a))}))}var Ye={};z(Ye,{NPS:()=>ct});function dt({field:e,submit:o}){let t=[...Array(11)].map((r,n)=>{let s=e.value===n?w.Primary:w.Secondary;return jsx(s,{borderWidth:"1px",onClick:()=>{e.onChange(n),o();},title:`${n}`,css:{".fr-button-title":{fontSize:"15px"}}},n)});return jsxs(b.Column,{gap:2,children:[jsx(b.Row,{gap:2,justifyContent:"space-between",part:"field-nps",children:t}),jsxs(b.Row,{justifyContent:"space-between",part:"field-nps-label",children:[jsx(C.Caption,{part:"field-nps-left-label",color:"gray600",children:"Not likely at all"}),jsx(C.Caption,{part:"field-nps-right-label",color:"gray600",children:"Extremely likely"})]})]})}function ct(n){var s=n,{as:e=R,flowId:o,fieldTypes:t}=s,r=d(s,["as","flowId","fieldTypes"]);let{flow:a}=ee(o);return jsx(qe,i({alignSelf:"end",as:e,flowId:o,fieldTypes:i({nps:dt},t),minWidth:"620px",modal:!1,width:"620px",css:l(i({},!a||a.getCurrentStepIndex()==0?{".fr-form-step-footer":{display:"none"}}:{}),{".fr-form":{padding:"20px"},".fr-form-step":{gap:"1"}})},r))}function Be(){let e="DOMRect"in globalThis?new DOMRect:{height:0,width:0,x:0,y:0,bottom:0,top:0,right:0,left:0,toJSON:()=>{}},[o,t]=useState(e),[r,n]=useState(null),s=useCallback(a=>{n(a);},[]);return useLayoutEffect(()=>{if(!r)return;let a=()=>{let p=r.getBoundingClientRect();t(p);};return a(),window.addEventListener("resize",a),()=>window.removeEventListener("resize",a)},[r]),{node:r,rect:o,ref:s}}var hn=keyframes({"0%":{opacity:.5,transform:"scale(0.5)"},"50%":{opacity:0,transform:"scale(1)"},"100%":{opacity:0,transform:"scale(1)"}});function ft(r){var n=r,{style:e={},part:o=""}=n,t=d(n,["style","part"]);return jsxs(m,l(i({part:`dot-wrapper ${o}`,style:i({height:"48px",position:"absolute",width:"48px"},e)},t),{children:[jsx(m,{backgroundColor:"primary.surface",part:"dot-pulse",css:{animation:`2s ease-out infinite ${hn}`,borderRadius:"24px",height:"48px",left:0,position:"absolute",top:0,transformOrigin:"center center",width:"48px"}}),jsx(m,{backgroundColor:"primary.surface",part:"dot",style:{borderRadius:"12px",height:"24px",left:"12px",position:"absolute",top:"12px",width:"24px"}})]}))}function gt({props:e,alignAttr:o,sideAttr:t}){let r=t!=null?t:"bottom",n={},s=()=>{var u;if(["after","before"].includes(e.align)){if(o=="start")return "before";if(o=="end")return "after"}return (u=e.align)!=null?u:"after"},a="-24px",p={top:"bottom",right:"left",bottom:"top",left:"right"};n[p[r]]=a;let c=s();return ["before","end"].includes(c)?["top","bottom"].includes(r)?n.right=a:n.bottom=a:["after","start"].includes(c)?["top","bottom"].includes(r)?n.left=a:n.top=a:["top","bottom"].includes(r)?n.left=`calc(50% + ${a})`:n.top=`calc(50% + ${a})`,n}var ve={content:["align","alignOffset","arrowPadding","avoidCollisions","collisionBoundary","collisionPadding","forceMount","hideWhenDetached","onCloseAutoFocus","onEscapeKeyDown","onFocusOutside","onInteractOutside","onOpenAutoFocus","onPointerDownOutside","side","sideOffset","sticky"],root:["defaultOpen","modal","onOpenChange","open"]};function xt(e,o){var s,a,p,c,u;let t=Object.fromEntries(ve.content.map(g=>[g,e[g]]).filter(g=>g[1]!==void 0)),r=Object.fromEntries(ve.root.map(g=>[g,e[g]]).filter(g=>g[1]!==void 0)),n={};for(let g of Object.keys(e))!ve.content.includes(g)&&!ve.root.includes(g)&&(n[g]=e[g]);if(t.align=(s=t.align)!=null?s:"after",t.side=(a=t.side)!=null?a:"bottom",["before","after"].includes(t.align)){let g={after:"end",before:"start"},h=($,G)=>["top","bottom"].includes(G)?$=="after"?"marginLeft":"marginRight":$=="after"?"marginTop":"marginBottom",y=(p=t.alignOffset)!=null?p:0,S=(c=t.style)!=null?c:{},P=(u=t.side)!=null?u:"bottom",F=t.align;t.style=l(i({},S),{[h(F,P)]:y});let O=["top","bottom"].includes(P)?o.width:o.height;t.alignOffset=(O+y)*-1,t.align=g[F];}return {contentProps:t,otherProps:n,rootProps:r}}function k(a){var p=a,{anchor:e,children:o,className:t,spotlight:r=!1,style:n}=p,s=d(p,["anchor","children","className","spotlight","style"]);let{node:c,rect:u,ref:g}=Be(),{node:h,rect:y,ref:S}=Be(),{contentProps:P,otherProps:F,rootProps:O}=xt(s,u),[$,G]=useState(P.align),[Y,ce]=useState(P.side),[De,Ee]=useState(0),[Oe,oo]=useState(0);if(c!==null){let L=c.getAttribute("data-align"),Q=c.getAttribute("data-side");$!==L&&G(L),Y!==Q&&ce(Q);}let he=useRef(null);if(useEffect(()=>{let L=document.querySelector(e);L!=null?(S(L),he.current=L):console.debug(`[frigade] Tooltip: No anchor found for query: ${e}`);},[e]),useEffect(()=>{function L(ue){if(ue.matches(e))return ue;let le=ue.querySelectorAll(e);return le.length>0?le[0]:null}let Q=new MutationObserver(ue=>{for(let le of ue)if(le.type==="childList"){for(let me of le.addedNodes){if(me.nodeType!==Node.ELEMENT_NODE)continue;let Z=L(me);if(Z!=null){S(Z),he.current=Z,console.debug("[frigade] Tooltip: MutationObserver added anchor: ",Z);break}}for(let me of le.removedNodes){if(me.nodeType!==Node.ELEMENT_NODE)continue;let Z=L(me);if(Z!=null){S(null),he.current=null,console.debug("[frigade] Tooltip: MutationObserver removed anchor: ",Z);break}}}});return Q.observe(document.querySelector("body"),{childList:!0,subtree:!0}),()=>Q.disconnect()},[]),useEffect(()=>{let{scrollX:L,scrollY:Q}=window;Ee(y.left+L),oo(y.top+Q);},[y.left,y.top]),h==null)return null;let to="0";typeof window!="undefined"&&(to=window.getComputedStyle(h).borderRadius);let bt=gt({props:s,alignAttr:$,sideAttr:Y});return jsxs(_.Root,l(i({defaultOpen:!0},O),{children:[jsx(_.Anchor,{virtualRef:he}),jsx(_.Portal,{children:jsxs(Fragment,{children:[r&&jsx(m,i({boxShadow:"0 0 0 20000px rgb(0 0 0 / 0.5)",part:"tooltip-spotlight",pointerEvents:"none",position:"absolute",style:{borderRadius:to,height:y.height,left:De,top:Oe,width:y.width}},s.zIndex!=null?{zIndex:s.zIndex}:{})),jsx(_.Content,l(i({asChild:!0},P),{ref:g,children:jsxs(x,l(i({boxShadow:"md",part:"tooltip",position:"relative",className:t,css:{maxWidth:"360px",pointerEvents:"auto"},style:n},F),{children:[jsx(ft,{style:bt}),o]}))}))]})})]}))}k.Close=e=>jsx(_.Close,{"aria-label":"Close",asChild:!0,children:jsx(w.Plain,l(i({css:{top:"12px",right:"4px"},part:"close",position:"absolute"},e),{children:jsx(XMarkIcon,{height:"24",fill:"currentColor"})}))});k.Media=t=>{var r=t,{src:e}=r,o=d(r,["src"]);return e==null?null:jsx(ne,i({borderRadius:"md md 0 0",borderWidth:"0",css:{aspectRatio:"2",objectFit:"cover"},margin:"-5 -5 0",src:e},o))};k.Primary=r=>{var n=r,{onClick:e,title:o}=n,t=d(n,["onClick","title"]);return o==null?null:jsx(w.Primary,i({title:o,onClick:e},t))};k.Progress=t=>{var r=t,{children:e}=r,o=d(r,["children"]);return e==null?null:jsx(C.H4,l(i({part:"progress"},o),{children:e}))};k.Secondary=r=>{var n=r,{onClick:e,title:o}=n,t=d(n,["onClick","title"]);return o==null?null:jsx(w.Secondary,i({title:o,onClick:e},t))};k.Subtitle=t=>{var r=t,{children:e}=r,o=d(r,["children"]);return e==null?null:jsx(C.Body2,l(i({part:"subtitle"},o),{children:e}))};k.Title=t=>{var r=t,{children:e}=r,o=d(r,["children"]);return e==null?null:jsx(C.H4,l(i({part:"title"},o),{children:e}))};function yt(p){var c=p,{dismissible:e=!0,flow:o,onDismiss:t,onPrimary:r,onSecondary:n,step:s}=c,a=d(c,["dismissible","flow","onDismiss","onPrimary","onSecondary","step"]);var S,P;let{handleDismiss:u}=oe(o,{onDismiss:t}),{handlePrimary:g,handleSecondary:h}=te(s,{onPrimary:r,onSecondary:n}),y=(S=s.props)!=null?S:{};return jsxs(k,l(i(i({anchor:s.selector,onOpenAutoFocus:F=>F.preventDefault(),onPointerDownOutside:F=>F.preventDefault(),onInteractOutside:F=>F.preventDefault()},a),y),{children:[e&&jsx(k.Close,{onClick:u}),jsx(k.Media,{src:(P=s.videoUri)!=null?P:s.imageUri,type:s.videoUri?"video":"image"}),jsxs(b.Column,{gap:1,part:"tooltip-header",children:[jsx(k.Title,{children:s.title}),jsx(k.Subtitle,{color:"gray500",children:s.subtitle})]}),jsxs(b.Row,{alignItems:"center",gap:3,justifyContent:"flex-end",part:"tooltip-footer",children:[jsx(k.Progress,{marginRight:"auto",transform:"translateY(1px)",children:`${o.getNumberOfCompletedSteps()+1}/${o.getNumberOfAvailableSteps()}`}),jsx(k.Secondary,{title:s.secondaryButtonTitle,onClick:h}),jsx(k.Primary,{title:s.primaryButtonTitle,onClick:g})]})]}),s.id)}function wn(n){var s=n,{flowId:e,onComplete:o,variables:t}=s,r=d(s,["flowId","onComplete","variables"]);let{flow:a}=ee(e,{variables:t});oe(a,{onComplete:o});let{isCurrentModal:p,removeModal:c}=xe(a);if(useEffect(()=>{!(a!=null&&a.isVisible)&&p&&c();},[a==null?void 0:a.isVisible,p]),a==null||a.isVisible===!1||!p)return null;let u=a.getCurrentStep();return u==null||u.start(),jsx(yt,i({step:u,flow:a},r))}function vn(){let{frigade:e}=useContext(E);return {frigade:e,isLoading:!(e!=null&&e.isReady())}}function Dn(){let{userId:e,frigade:o}=useContext(E);function t(n){return D(this,null,function*(){yield o.identify(e,n);})}function r(n,s){return D(this,null,function*(){yield o.track(n,s);})}return {userId:e,addProperties:t,track:r}}function On(){let{groupId:e,frigade:o}=useContext(E);function t(n){return D(this,null,function*(){if(!e){console.error("No Group ID is set. Cannot set properties without a Group ID.");return}yield o.group(e,n);})}function r(n,s){return D(this,null,function*(){yield o.track(n,s);})}return {groupId:e,addProperties:t,track:r}}
39
39
 
40
40
  export { _r as Announcement, zr as Banner, m as Box, w as Button, x as Card, Xe as Checklist, R as Dialog, b as Flex, qe as Form, we as Progress, ko as Provider, Ye as Survey, C as Text, k as Tooltip, wn as Tour, He as themeVariables, Be as useBoundingClientRect, ee as useFlow, oe as useFlowHandlers, vn as useFrigade, On as useGroup, xe as useModal, te as useStepHandlers, Dn as useUser };
41
41
  //# sourceMappingURL=out.js.map