@frigade/react 2.0.26 → 2.0.27

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
@@ -1,23 +1,23 @@
1
1
  'use client';
2
- import * as R from '@radix-ui/react-dialog';
2
+ import * as O from '@radix-ui/react-dialog';
3
3
  import { XMarkIcon } from '@heroicons/react/24/solid';
4
- import * as we from 'react';
4
+ import * as Me from 'react';
5
5
  import { createContext, useState, useMemo, useEffect, useContext, useRef, useCallback, useLayoutEffect } from 'react';
6
6
  import { clsx } from 'clsx';
7
- import lt from 'known-css-properties';
8
- import yt from 'dompurify';
7
+ import Pt from 'known-css-properties';
8
+ import kt from 'dompurify';
9
9
  import { jsx, jsxs, Fragment } from '@emotion/react/jsx-runtime';
10
10
  import { Frigade } from '@frigade/js';
11
11
  export { Flow, FlowType, Frigade } from '@frigade/js';
12
12
  import { keyframes, Global, ThemeProvider } from '@emotion/react';
13
13
  import { ChevronDownIcon } from '@heroicons/react/24/outline';
14
- import * as Y from '@radix-ui/react-collapsible';
14
+ import * as ie from '@radix-ui/react-collapsible';
15
15
  import { useForm, useController } from 'react-hook-form';
16
- import * as Q from '@radix-ui/react-radio-group';
17
- import * as S from '@radix-ui/react-select';
18
- import * as I from '@radix-ui/react-popover';
16
+ import * as se from '@radix-ui/react-radio-group';
17
+ import * as B from '@radix-ui/react-select';
18
+ import * as _ from '@radix-ui/react-popover';
19
19
 
20
- var rt=Object.defineProperty;var nt=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(o,t)=>(typeof require<"u"?require:o)[t]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var M=(e,o)=>{for(var t in o)rt(e,t,{get:o[t],enumerable:!0});};var Ne={borders:{md:"1px solid"},borderWidths:{0:"0",md:"1px"}};var je={black:"#000000",gray100:"#14161A",gray200:"#181B20",gray300:"#1F2329",gray400:"#2E343D",gray500:"#4C5766",gray600:"#5A6472",gray700:"#C5CBD3",gray800:"#E2E5E9",gray900:"#F1F2F4",white:"#ffffff",blue400:"#015AC6",blue500:"#0171F8",blue800:"#DBECFF",blue900:"#F5F9FF",green400:"#009E37",green500:"#00D149",green800:"#DBFFE8",transparent:"#FFFFFF00",inherit:"inherit",red500:"#c00000"};var ze={md:"10px",lg:"20px",round:"50%"};var p=e=>`var(--fr-colors-${e})`,Ke={neutral:{background:p("white"),border:p("gray800"),foreground:p("black"),surface:p("gray700"),active:{background:p("white"),border:p("gray900"),foreground:p("black"),surface:p("gray700")},focus:{background:p("white"),border:p("gray900"),foreground:p("black"),surface:p("gray700")},hover:{background:p("white"),border:p("gray900"),foreground:p("black"),surface:p("gray700")}},primary:{background:p("blue500"),border:p("blue500"),foreground:p("white"),surface:p("blue500"),active:{background:p("blue400"),border:p("blue400"),foreground:p("white"),surface:p("blue400")},focus:{background:p("blue500"),border:p("blue500"),foreground:p("white"),surface:p("blue500")},hover:{background:p("blue400"),border:p("blue400"),foreground:p("white"),surface:p("blue400")}},secondary:{background:p("white"),border:p("gray800"),foreground:p("black"),surface:p("gray900"),active:{background:p("gray900"),border:p("gray800"),foreground:p("black"),surface:p("gray800")},focus:{background:p("gray900"),border:p("gray800"),foreground:p("black"),surface:p("gray900")},hover:{background:p("gray900"),border:p("gray800"),foreground:p("black"),surface:p("gray800")}}};var Ue={md:"0px 4px 20px rgba(0, 0, 0, 0.1)"};var it="px",st=e=>typeof e=="number"?`${4*e}${it}`:e,at=[-20,-19,-18,-17,-16,-15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,-.5,0,.5,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,"auto"],Ge=Object.fromEntries(at.map(e=>[e,st(e)]));var Xe={fontFamilies:{default:"inherit"},fontSizes:{xs:"12px",sm:"14px",md:"16px",lg:"18px",xl:"20px","2xl":"24px","3xl":"30px","4xl":"36px","5xl":"48px"},fontWeights:{thin:"100",extralight:"200",light:"300",regular:"400",medium:"500",demibold:"600",bold:"700",extrabold:"800",black:"900"},letterSpacings:{md:"0.02em"},lineHeights:{xs:"18px",sm:"22px",md:"24px",lg:"26px",xl:"30px","2xl":"38px","3xl":"46px","4xl":"60px"}};var be={...Ne,colors:{...je,...Ke},...Xe,radii:ze,shadows:Ue,space:Ge};function ee(e,o="",t="."){return Object.keys(e).reduce((i,r)=>{let a=`${o.length?`${o}${t}`:""}${r}`,s=e[r];return typeof s=="object"&&s!==null&&!Array.isArray(s)?Object.assign(i,ee(s,a,t)):i[a]=s,i},{})}function Pe(e){return ee(e,"--fr","-")}function Je(e,o="--fr"){let t={};return Object.keys(e).forEach(i=>{let r=e[i];typeof r=="object"&&r!==null&&!Array.isArray(r)?t[i]=Je(r,`${o}-${i}`):t[i]=`var(${o}-${i})`;}),t}var Ce=Pe(be),y=Je(be);var pt=new Set(["alt","size","src"]),dt=lt.all.filter(e=>e.indexOf("-")!=0&&!pt.has(e)).map(e=>[e.replace(/-([a-z])/g,(o,t)=>t.toUpperCase()),null]),ct=Object.fromEntries(dt),Se=ee(y.colors),mt={color:Se,backgroundColor:Se,borderColor:Se,border:y.borders,borderRadius:y.radii,borderWidth:y.borderWidths,boxShadow:y.shadows,fontFamily:y.fontFamilies,fontSize:y.fontSizes,fontWeight:y.fontWeights,gap:y.space,lineHeight:y.lineHeights,margin:y.space,marginBottom:y.space,marginLeft:y.space,marginRight:y.space,marginTop:y.space,padding:y.space,paddingBottom:y.space,paddingLeft:y.space,paddingRight:y.space,paddingTop:y.space},qe={...ct,...mt},Ye={bg:["backgroundColor"],m:["margin"],mt:["marginTop"],mr:["marginRight"],mb:["marginBottom"],ml:["marginLeft"],mx:["marginLeft","marginRight"],my:["marginTop","marginBottom"],p:["padding"],pt:["paddingTop"],pr:["paddingRight"],pb:["paddingBottom"],pl:["paddingLeft"],px:["paddingLeft","paddingRight"],py:["paddingTop","paddingBottom"]},Qe=new Set(["active","disabled","focus","focusVisible","focusWithin","hover"]);function ut(e){return Array.isArray(e)?new Map(e.map(o=>[o,o])):typeof e=="object"&&e!==null?new Map(Object.entries(e)):typeof e=="string"||typeof e=="number"?new Map([[e,e]]):new Map}var Ze=new Map(Object.entries(qe).map(([e,o])=>[e,ut(o)])),ft=new Map(Object.entries(Ye).map(([e,o])=>[e,new Set(o)])),gt=new Set(["height","width"]),xt=new Set(["canvas","embed","iframe","img","input","object","video"]);function eo(e){let[o,t]=e.split(":");return [o,Qe.has(t)?t:null]}function oo(e,o="div"){let t=Object.assign({},e),i={};function r(n){if(n==null)return i;let s=`&:${n.replace(/[A-Z]/g,d=>`-${d.toLocaleLowerCase()}`)}`;return i[s]==null&&(i[s]={}),i[s]}return Object.entries(t).forEach(([n,a])=>{let[s,d]=eo(n),m=ft.get(s);m!=null&&(m.forEach(g=>{let b=`${g}${d?":"+d:""}`;t[b]=a;}),delete t[n]);}),Object.entries(t).forEach(([n,a])=>{let[s,d]=eo(n),m=Ze.get(s);if(m!=null){if(typeof a=="string"&&a.indexOf(" ")>-1){let g=a.split(" ");r(d)[s]=g.map(b=>m.get(b.toString())??b).join(" ");}else m.has(a.toString())?r(d)[s]=m.get(a.toString()):r(d)[s]=a;(typeof o!="string"||!xt.has(o)||!gt.has(s))&&delete t[n];}}),Object.keys(t).forEach(n=>{let a=n.substring(1);n.indexOf("_")===0&&Ze.has(a)&&(t[a]=t[n],delete t[n]);}),{cssFromProps:i,unmatchedProps:t}}function ht(){if(typeof window>"u"){let{JSDOM:e}=nt("jsdom");return new e("<!DOCTYPE html>").window}return window}function to(e){return e?{__html:yt(ht()).sanitize(e,{ALLOWED_TAGS:["b","i","a","span","div","p","pre","u","br","img","code","li","ul","table","tbody","thead","tr","td","th","h1","h2","h3","h4","video"],ALLOWED_ATTR:["style","class","target","id","href","alt","src","controls","autoplay","loop","muted"]})}:{__html:""}}function Pt(e){return e&&`fr-${e}`}function io(e){return e&&(Array.isArray(e)?e.map(o=>io(o)).join(" "):Pt(e))}function Ct({as:e,children:o,className:t,css:i={},part:r,...n},a){let s=e??"div",{cssFromProps:d,unmatchedProps:m}=oo(n,s),g=io(r),b=t||g?clsx(t,g):void 0,c=[{boxSizing:"border-box"},d,i];return typeof o=="string"?jsx(s,{className:b,css:c,...m,ref:a,dangerouslySetInnerHTML:to(o)}):jsx(s,{className:b,css:c,...m,ref:a,children:o})}var l=we.forwardRef(Ct);var h={};M(h,{Link:()=>Xt,Plain:()=>Jt,Primary:()=>Ut,Secondary:()=>Gt});var x={};M(x,{Body1:()=>Lt,Body2:()=>Vt,Caption:()=>$t,Display1:()=>Ot,Display2:()=>It,H1:()=>Mt,H2:()=>Ht,H3:()=>Wt,H4:()=>At});var Fe={};M(Fe,{Body1:()=>vt,Body2:()=>kt,Caption:()=>Dt,Display1:()=>St,Display2:()=>Ft,H1:()=>Tt,H2:()=>wt,H3:()=>Rt,H4:()=>Bt});var H={color:"neutral.foreground",fontFamily:"default",margin:"0"},St={...H,fontSize:"5xl",fontWeight:"bold",lineHeight:"4xl"},Ft={...H,fontSize:"4xl",fontWeight:"bold",lineHeight:"3xl"},Tt={...H,fontSize:"3xl",fontWeight:"demibold",lineHeight:"2xl"},wt={...H,fontSize:"2xl",fontWeight:"demibold",lineHeight:"xl"},Rt={...H,fontSize:"xl",fontWeight:"demibold",lineHeight:"lg"},Bt={...H,fontSize:"md",fontWeight:"demibold",lineHeight:"md"},vt={...H,fontSize:"md",fontWeight:"regular",lineHeight:"md"},kt={...H,fontSize:"sm",fontWeight:"regular",lineHeight:"sm"},Dt={...H,fontSize:"xs",fontWeight:"regular",lineHeight:"xs"};var Et=["Display1","Display2","H1","H2","H3","H4","Body1","Body2","Caption"],W=Object.fromEntries(Et.map(e=>{let o=["H1","H2","H3","H4"].includes(e)?e.toLowerCase():"span",t=we.forwardRef(({as:i=o,children:r,...n},a)=>jsx(l,{as:i,...Fe[e],...n,ref:a,children:r}));return t.displayName=`Text.${e}`,[e,t]})),Ot=W.Display1,It=W.Display2,Mt=W.H1,Ht=W.H2,Wt=W.H3,At=W.H4,Lt=W.Body1,Vt=W.Body2,$t=W.Caption;var Te={};M(Te,{Link:()=>zt,Plain:()=>Kt,Primary:()=>Nt,Secondary:()=>jt});var ae={borderWidth:"md",borderRadius:"md",borderStyle:"solid",display:"flex",gap:"2",padding:"2 4"},Nt={...ae,backgroundColor:"primary.surface",borderColor:"primary.border",color:"primary.foreground","backgroundColor:hover":"primary.hover.surface","backgroundColor:disabled":"primary.surface","opacity:disabled":"0.7"},jt={...ae,backgroundColor:"secondary.background",borderColor:"secondary.border",color:"secondary.foreground","backgroundColor:hover":"secondary.hover.background","backgroundColor:disabled":"secondary.background","opacity:disabled":"0.7"},zt={...ae,backgroundColor:"transparent",borderColor:"transparent",color:"primary.surface","color:hover":"primary.hover.surface"},Kt={...ae,backgroundColor:"transparent",borderColor:"transparent",color:"neutral.foreground"};function le({as:e,children:o,part:t,title:i,variant:r="Primary",...n}){let a=r.toLocaleLowerCase();return jsxs(l,{as:e??"button",part:[`button-${a}`,t],...Te[r],...n,children:[o,i&&jsx(x.Body2,{color:"inherit",css:{WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"},flexGrow:"1",fontWeight:"demibold",part:"button-title",children:i})]})}function Ut({children:e,...o}){return jsx(le,{...o,variant:"Primary",children:e})}function Gt({children:e,...o}){return jsx(le,{...o,variant:"Secondary",children:e})}function Xt({children:e,...o}){return jsx(le,{...o,variant:"Link",children:e})}function Jt({children:e,...o}){return jsx(le,{...o,variant:"Plain",children:e})}var u={};M(u,{Column:()=>Qt,Row:()=>Yt});var Yt=we.forwardRef((e,o)=>jsx(l,{display:"flex",flexDirection:"row",...e,ref:o})),Qt=we.forwardRef((e,o)=>jsx(l,{display:"flex",flexDirection:"column",...e,ref:o}));var w=createContext({apiKey:"",modals:new Set,setModals:()=>{},currentModal:null,navigate:()=>{}});function po({children:e,navigate:o,theme:t,...i}){let r=t?Pe(t):{},[n,a]=useState(new Set),s=useMemo(()=>new Frigade(i.apiKey,{apiKey:i.apiKey,apiUrl:i.apiUrl,userId:i.userId,groupId:i.groupId,__readOnly:i.__readOnly,__flowConfigOverrides:i.__flowConfigOverrides}),[i.userId,i.groupId,i.apiKey]),d=o??((g,b="_self")=>{window.open(g,b);});useEffect(()=>()=>{s.destroy();},[]);let m=n.size>0?n.values().next().value:null;return jsxs(w.Provider,{value:{modals:n,setModals:a,currentModal:m,navigate:d,...i,frigade:s},children:[jsx(Global,{styles:{":root":{...Ce,...r}}}),jsx(ThemeProvider,{theme:y,children:e})]})}function te(e,o){let[t,i]=useState(),[,r]=useState(""),{frigade:n}=useContext(w),a=s=>{s.id===e&&(o!=null&&o.variables&&s.applyVariables(o.variables),i(s),r(Math.random().toString()));};return useEffect(()=>((async()=>{let s=await n.getFlow(e);if(!s||n.hasFailedToLoad()){i(void 0);return}o!=null&&o.variables&&s.applyVariables(o.variables),i(s);})(),n.onStateChange(a),()=>{n.removeStateChangeHandler(a);}),[]),useEffect(()=>{!(o!=null&&o.variables)||!t||a(t);},[o==null?void 0:o.variables]),{flow:t}}function j(e,{onComplete:o,onDismiss:t}={}){let i=useRef(null);return useEffect(()=>{e!=null&&(e.isCompleted&&i.current===!1&&(async()=>await(o==null?void 0:o(e)))(),i.current=e==null?void 0:e.isCompleted);},[e==null?void 0:e.isCompleted]),{handleDismiss:useCallback(async r=>{if(await(t==null?void 0:t(e,r))===!1)return r.preventDefault(),!1;e.skip();},[e])}}function z(e,{onPrimary:o,onSecondary:t}={}){let{navigate:i}=useContext(w);return {handlePrimary:useCallback(async(r,n)=>await(o==null?void 0:o(e,r))===!1?(r.preventDefault(),!1):(e.complete(n),e.primaryButtonUri!=null&&i(e.primaryButtonUri,e.primaryButtonUriTarget),!0),[e]),handleSecondary:useCallback(async(r,n)=>await(t==null?void 0:t(e,r))===!1?(r.preventDefault(),!1):(e.complete(n),e.secondaryButtonUri!=null&&i(e.secondaryButtonUri,e.secondaryButtonUriTarget),!0),[e])}}function re(e,o=!0){let{currentModal:t,modals:i,setModals:r}=useContext(w),[n,a]=useState(!1);useEffect(()=>{o&&(e!=null&&e.isVisible)&&e&&!i.has(e.id)&&r(d=>new Set(d).add(e.id));},[e==null?void 0:e.id,e==null?void 0:e.isVisible]),useEffect(()=>{let d=t===(e==null?void 0:e.id);o&&(e==null?void 0:e.id)!=null&&d!==n&&a(d);},[e==null?void 0:e.id,t]);function s(){o&&i.has(e==null?void 0:e.id)&&r(d=>{let m=new Set(d);return m.delete(e==null?void 0:e.id),m});}return {isCurrentModal:n||!o,removeModal:s}}function O({as:e,children:o,container:t,dismissible:i=!1,flowId:r,onComplete:n,onDismiss:a,onPrimary:s,onSecondary:d,variables:m,forceMount:g,...b}){let{flow:c}=te(r,{variables:m}),F=c==null?void 0:c.getCurrentStep(),{handleDismiss:q}=j(c,{onComplete:n,onDismiss:a}),{handlePrimary:N,handleSecondary:xe}=z(F,{onPrimary:s,onSecondary:d}),ie=e&&typeof e=="function"&&(e.displayName==="Dialog"||e.displayName==="Modal"),{isCurrentModal:Z,removeModal:ye}=re(c,ie);if(useEffect(()=>{!(c!=null&&c.isVisible)&&Z&&ye();},[c==null?void 0:c.isVisible,Z]),c==null||!Z)return null;let he=g&&c.isCompleted;return !c.isVisible&&!he?null:(!c.isCompleted&&!c.isSkipped&&F.start(),jsx(e??l,{position:"relative",...b,children:o({flow:c,handleDismiss:q,handlePrimary:N,handleSecondary:xe,parentProps:{container:t,dismissible:i,flowId:r,variables:m,...b},step:F})}))}function go(e){return jsx(O,{as:f,gap:5,borderColor:"neutral.border",borderStyle:"solid",borderWidth:"md",part:"card",...e,children:({handleDismiss:o,handlePrimary:t,handleSecondary:i,parentProps:{dismissible:r},step:n})=>jsxs(Fragment,{children:[jsxs(u.Row,{alignItems:"center",flexWrap:"wrap",gap:1,justifyContent:"space-between",part:"card-header",children:[jsx(f.Title,{children:n.title}),r&&jsx(f.Dismiss,{onClick:o}),jsx(f.Subtitle,{flexBasis:"100%",children:n.subtitle})]}),jsx(f.Media,{src:n.imageUri,css:{objectFit:"contain",width:"100%"}}),jsxs(u.Row,{gap:3,justifyContent:"flex-end",part:"card-footer",children:[jsx(f.Secondary,{title:n.secondaryButtonTitle,onClick:i}),jsx(f.Primary,{title:n.primaryButtonTitle,onClick:t})]})]})})}function Be({part:e,src:o,...t}){return jsx(l,{as:"img",part:["image",e],src:o,...t})}function hr(e){var o,t,i,r;return e.includes("youtube")?`https://www.youtube.com/embed/${(o=e.split("v=")[1])==null?void 0:o.split("&")[0]}`:e.includes("vimeo")?`https://player.vimeo.com/video/${(t=e.split("vimeo.com/")[1])==null?void 0:t.split("&")[0]}`:e.includes("wistia")?`https://fast.wistia.net/embed/iframe/${(i=e.split("wistia.com/medias/")[1])==null?void 0:i.split("&")[0]}`:e.includes("loom")?`https://loom.com/embed/${(r=e.split("loom.com/share/")[1])==null?void 0:r.split("&")[0]}?hideEmbedTopBar=true&hide_title=true&hide_share=true&hide_owner=true`:null}function ve({part:e,src:o,...t}){let i=hr(o);return i?jsx(l,{allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,as:"iframe",backgroundColor:"gray100",borderWidth:0,part:["video",e],src:i,...t}):o!=null&&o.endsWith(".mp4")?jsx(l,{as:"video",controls:!0,part:["video",e],src:o,...t}):(console.error(`Could not map videoUri ${o} to a known provider (Youtube, Vimeo, Wistia, Loom) or valid mp4 file.`),null)}function U({src:e,type:o,...t}){return jsx(o==="video"?ve:Be,{src:e,...t})}var f=we.forwardRef(({children:e,flowId:o,...t},i)=>{if(o!=null)return jsx(go,{flowId:o,...t});let r=t.as??u.Column;return jsx(r,{backgroundColor:"neutral.background",borderColor:"neutral.border",borderStyle:"solid",borderRadius:"md",borderWidth:"0",gap:5,p:5,...t,ref:i,children:e})});f.Dismiss=e=>jsx(h.Plain,{part:"dismiss",padding:0,...e,children:jsx(XMarkIcon,{height:"24",fill:"currentColor"})});f.Media=({src:e,...o})=>e==null?null:jsx(U,{borderRadius:"md",src:e,...o});f.Primary=({onClick:e,title:o,...t})=>o==null?null:jsx(h.Primary,{title:o,onClick:e,...t});f.Secondary=({onClick:e,title:o,...t})=>o==null?null:jsx(h.Secondary,{title:o,onClick:e,...t});f.Subtitle=({children:e,...o})=>e==null?null:jsx(x.Body2,{display:"block",part:"subtitle",...o,children:e});f.Title=({children:e,...o})=>e==null?null:jsx(x.Body1,{display:"block",fontWeight:"bold",part:"title",...o,children:e});var pe={content:["onOpenAutoFocus","onCloseAutoFocus","onEscapeKeyDown","onPointerDownOutside","onInteractOutside"],root:["defaultOpen","modal","onOpenChange","open"]};function ho(e){let o=Object.fromEntries(pe.content.map(r=>[r,e[r]]).filter(r=>r[1]!==void 0)),t=Object.fromEntries(pe.root.map(r=>[r,e[r]]).filter(r=>r[1]!==void 0)),i={};for(let r of Object.keys(e))!pe.content.includes(r)&&!pe.root.includes(r)&&(i[r]=e[r]);return {contentProps:o,otherProps:i,rootProps:t}}function P({children:e,className:o,modal:t=!0,...i}){let{rootProps:r,contentProps:n,otherProps:a}=ho(i);return jsx(R.Root,{defaultOpen:!0,modal:t,...r,children:jsx(R.Portal,{children:jsxs(l,{className:o,display:"grid",inset:"0",padding:"6",pointerEvents:"none",position:"fixed",children:[jsx(R.Overlay,{asChild:!0,children:jsx(l,{background:"rgb(0 0 0 / 0.5)",inset:"0",part:"dialog-overlay",position:"absolute"})}),jsx(R.Content,{asChild:!0,onOpenAutoFocus:s=>s.preventDefault(),onPointerDownOutside:s=>s.preventDefault(),...n,children:jsx(f,{alignSelf:"center",boxShadow:"md",justifySelf:"center",maxWidth:"430px",p:8,part:"dialog",pointerEvents:"auto",...a,children:e})})]})})})}P.Dismiss=e=>jsx(R.Close,{"aria-label":"Close",asChild:!0,children:jsx(h.Plain,{part:"close",position:"absolute",right:"-4px",top:"4px",...e,children:jsx(XMarkIcon,{height:"24",fill:"currentColor"})})});P.Subtitle=({children:e,...o})=>jsx(R.Description,{asChild:!0,children:jsx(x.Body2,{part:"subtitle",...o,children:e})});P.Media=({src:e,...o})=>e==null?null:jsx(U,{borderRadius:"md",src:e,...o});P.Primary=({onClick:e,title:o,...t})=>o==null?null:jsx(h.Primary,{title:o,onClick:e,...t});P.ProgressDots=({current:e,total:o})=>{if(o==1)return null;let t=[...Array(o)].map((i,r)=>jsx(l,{as:"circle",r:4,cx:4+16*r,cy:"4px",fill:e===r?y.colors.blue500:y.colors.blue800,part:e===r?"progress-dot-selected":"progress-dot"},r));return jsx(l,{as:"svg",height:"8px",marginInline:"auto",part:"progress",viewBox:`0 0 ${16*o-8} 8`,width:16*o-8,children:t})};P.Secondary=({onClick:e,title:o,...t})=>o==null?null:jsx(h.Secondary,{title:o,onClick:e,...t});P.Title=({children:e,...o})=>jsx(R.Title,{asChild:!0,children:jsx(x.H3,{part:"title",...o,children:e})});P.displayName="Dialog";function Fr({flowId:e,...o}){return jsx(O,{as:P,dismissible:!0,flowId:e,textAlign:"center",...o,children:({flow:t,handleDismiss:i,handlePrimary:r,handleSecondary:n,parentProps:{dismissible:a},step:s})=>jsxs(Fragment,{children:[a&&jsx(P.Dismiss,{onClick:i}),jsxs(u.Column,{gap:1,part:"announcement-header",children:[jsx(P.Title,{children:s.title}),jsx(P.Subtitle,{children:s.subtitle})]}),jsx(P.Media,{src:s.videoUri??s.imageUri,type:s.videoUri?"video":"image",css:{aspectRatio:"1.5",objectFit:"cover",width:"100%"}}),jsx(P.ProgressDots,{current:t.getNumberOfCompletedSteps(),total:t.getNumberOfAvailableSteps()}),jsxs(u.Row,{css:{"& > button":{flexBasis:"50%",flexGrow:1}},gap:3,part:"announcement-footer",children:[s.secondaryButtonTitle&&jsx(P.Secondary,{onClick:n,title:s.secondaryButtonTitle}),s.primaryButtonTitle&&jsx(P.Primary,{onClick:r,title:s.primaryButtonTitle??"Continue"})]})]})})}function wr({flowId:e,...o}){return jsx(O,{as:f,borderWidth:"md",display:"flex",flexDirection:"row",flowId:e,gap:3,justifyContent:"space-between",part:"banner",...o,children:({handleDismiss:t,handlePrimary:i,handleSecondary:r,step:n})=>jsxs(Fragment,{children:[jsxs(u.Row,{gap:3,children:[n.imageUri&&jsx(l,{as:"img",part:"image",src:n.imageUri,style:{height:40,width:40,alignSelf:"center"}}),jsxs(u.Column,{children:[jsx(x.H4,{part:"title",children:n.title}),jsx(x.Body2,{part:"subtitle",children:n.subtitle})]})]}),jsxs(u.Row,{alignItems:"center",gap:3,justifyContent:"center",children:[n.secondaryButtonTitle&&jsx(h.Secondary,{title:n.secondaryButtonTitle,onClick:r}),jsx(h.Primary,{title:n.primaryButtonTitle,onClick:i}),o.dismissible&&jsx(f.Dismiss,{onClick:t})]})]})})}var vo={};M(vo,{Collapsible:()=>Bo,CollapsibleStep:()=>ce});var ce={};M(ce,{Content:()=>Ee,Root:()=>Oe,Trigger:()=>Ie});var vr=keyframes`
20
+ var Qe=Object.defineProperty,ft=Object.defineProperties;var gt=Object.getOwnPropertyDescriptors;var ge=Object.getOwnPropertySymbols;var Ze=Object.prototype.hasOwnProperty,eo=Object.prototype.propertyIsEnumerable;var Ye=(e,o,t)=>o in e?Qe(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,i=(e,o)=>{for(var t in o||(o={}))Ze.call(o,t)&&Ye(e,t,o[t]);if(ge)for(var t of ge(o))eo.call(o,t)&&Ye(e,t,o[t]);return e},p=(e,o)=>ft(e,gt(o));var xt=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(o,t)=>(typeof require!="undefined"?require:o)[t]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var d=(e,o)=>{var t={};for(var r in e)Ze.call(e,r)&&o.indexOf(r)<0&&(t[r]=e[r]);if(e!=null&&ge)for(var r of ge(e))o.indexOf(r)<0&&eo.call(e,r)&&(t[r]=e[r]);return t};var N=(e,o)=>{for(var t in o)Qe(e,t,{get:o[t],enumerable:!0});};var k=(e,o,t)=>new Promise((r,n)=>{var s=c=>{try{l(t.next(c));}catch(m){n(m);}},a=c=>{try{l(t.throw(c));}catch(m){n(m);}},l=c=>c.done?r(c.value):Promise.resolve(c.value).then(s,a);l((t=t.apply(e,o)).next());});var oo={borders:{md:"1px solid"},borderWidths:{0:"0",md:"1px"}};var to={black:"#000000",gray100:"#14161A",gray200:"#181B20",gray300:"#1F2329",gray400:"#2E343D",gray500:"#4C5766",gray600:"#5A6472",gray700:"#C5CBD3",gray800:"#E2E5E9",gray900:"#F1F2F4",white:"#ffffff",blue400:"#015AC6",blue500:"#0171F8",blue800:"#DBECFF",blue900:"#F5F9FF",green400:"#009E37",green500:"#00D149",green800:"#DBFFE8",transparent:"#FFFFFF00",inherit:"inherit",red500:"#c00000"};var ro={md:"10px",lg:"20px",round:"50%"};var f=e=>`var(--fr-colors-${e})`,no={neutral:{background:f("white"),border:f("gray800"),foreground:f("black"),surface:f("gray700"),active:{background:f("white"),border:f("gray900"),foreground:f("black"),surface:f("gray700")},focus:{background:f("white"),border:f("gray900"),foreground:f("black"),surface:f("gray700")},hover:{background:f("white"),border:f("gray900"),foreground:f("black"),surface:f("gray700")}},primary:{background:f("blue500"),border:f("blue500"),foreground:f("white"),surface:f("blue500"),active:{background:f("blue400"),border:f("blue400"),foreground:f("white"),surface:f("blue400")},focus:{background:f("blue500"),border:f("blue500"),foreground:f("white"),surface:f("blue500")},hover:{background:f("blue400"),border:f("blue400"),foreground:f("white"),surface:f("blue400")}},secondary:{background:f("white"),border:f("gray800"),foreground:f("black"),surface:f("gray900"),active:{background:f("gray900"),border:f("gray800"),foreground:f("black"),surface:f("gray800")},focus:{background:f("gray900"),border:f("gray800"),foreground:f("black"),surface:f("gray900")},hover:{background:f("gray900"),border:f("gray800"),foreground:f("black"),surface:f("gray800")}}};var io={md:"0px 4px 20px rgba(0, 0, 0, 0.1)"};var yt="px",ht=e=>typeof e=="number"?`${4*e}${yt}`:e,bt=[-20,-19,-18,-17,-16,-15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,-.5,0,.5,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,"auto"],so=Object.fromEntries(bt.map(e=>[e,ht(e)]));var ao={fontFamilies:{default:"inherit"},fontSizes:{xs:"12px",sm:"14px",md:"16px",lg:"18px",xl:"20px","2xl":"24px","3xl":"30px","4xl":"36px","5xl":"48px"},fontWeights:{thin:"100",extralight:"200",light:"300",regular:"400",medium:"500",demibold:"600",bold:"700",extrabold:"800",black:"900"},letterSpacings:{md:"0.02em"},lineHeights:{xs:"18px",sm:"22px",md:"24px",lg:"26px",xl:"30px","2xl":"38px","3xl":"46px","4xl":"60px"}};var ve=p(i(p(i({},oo),{colors:i(i({},to),no)}),ao),{radii:ro,shadows:io,space:so});function le(e,o="",t="."){return Object.keys(e).reduce((r,n)=>{let a=`${o.length?`${o}${t}`:""}${n}`,l=e[n];return typeof l=="object"&&l!==null&&!Array.isArray(l)?Object.assign(r,le(l,a,t)):r[a]=l,r},{})}function ke(e){return le(e,"--fr","-")}function lo(e,o="--fr"){let t={};return Object.keys(e).forEach(r=>{let n=e[r];typeof n=="object"&&n!==null&&!Array.isArray(n)?t[r]=lo(n,`${o}-${r}`):t[r]=`var(${o}-${r})`;}),t}var De=ke(ve),F=lo(ve);var Ct=new Set(["alt","size","src"]),St=Pt.all.filter(e=>e.indexOf("-")!=0&&!Ct.has(e)).map(e=>[e.replace(/-([a-z])/g,(o,t)=>t.toUpperCase()),null]),Ft=Object.fromEntries(St),Ee=le(F.colors),Tt={color:Ee,backgroundColor:Ee,borderColor:Ee,border:F.borders,borderRadius:F.radii,borderWidth:F.borderWidths,boxShadow:F.shadows,fontFamily:F.fontFamilies,fontSize:F.fontSizes,fontWeight:F.fontWeights,gap:F.space,lineHeight:F.lineHeights,margin:F.space,marginBottom:F.space,marginLeft:F.space,marginRight:F.space,marginTop:F.space,padding:F.space,paddingBottom:F.space,paddingLeft:F.space,paddingRight:F.space,paddingTop:F.space},po=i(i({},Ft),Tt),co={bg:["backgroundColor"],m:["margin"],mt:["marginTop"],mr:["marginRight"],mb:["marginBottom"],ml:["marginLeft"],mx:["marginLeft","marginRight"],my:["marginTop","marginBottom"],p:["padding"],pt:["paddingTop"],pr:["paddingRight"],pb:["paddingBottom"],pl:["paddingLeft"],px:["paddingLeft","paddingRight"],py:["paddingTop","paddingBottom"]},mo=new Set(["active","disabled","focus","focusVisible","focusWithin","hover"]);function wt(e){return Array.isArray(e)?new Map(e.map(o=>[o,o])):typeof e=="object"&&e!==null?new Map(Object.entries(e)):typeof e=="string"||typeof e=="number"?new Map([[e,e]]):new Map}var uo=new Map(Object.entries(po).map(([e,o])=>[e,wt(o)])),Rt=new Map(Object.entries(co).map(([e,o])=>[e,new Set(o)])),Bt=new Set(["height","width"]),vt=new Set(["canvas","embed","iframe","img","input","object","video"]);function fo(e){let[o,t]=e.split(":");return [o,mo.has(t)?t:null]}function go(e,o="div"){let t=Object.assign({},e),r={};function n(s){if(s==null)return r;let l=`&:${s.replace(/[A-Z]/g,c=>`-${c.toLocaleLowerCase()}`)}`;return r[l]==null&&(r[l]={}),r[l]}return Object.entries(t).forEach(([s,a])=>{let[l,c]=fo(s),m=Rt.get(l);m!=null&&(m.forEach(g=>{let b=`${g}${c?":"+c:""}`;t[b]=a;}),delete t[s]);}),Object.entries(t).forEach(([s,a])=>{let[l,c]=fo(s),m=uo.get(l);if(m!=null){if(typeof a=="string"&&a.indexOf(" ")>-1){let g=a.split(" ");n(c)[l]=g.map(b=>{var S;return (S=m.get(b.toString()))!=null?S:b}).join(" ");}else m.has(a.toString())?n(c)[l]=m.get(a.toString()):n(c)[l]=a;(typeof o!="string"||!vt.has(o)||!Bt.has(l))&&delete t[s];}}),Object.keys(t).forEach(s=>{let a=s.substring(1);s.indexOf("_")===0&&uo.has(a)&&(t[a]=t[s],delete t[s]);}),{cssFromProps:r,unmatchedProps:t}}function Dt(){if(typeof window=="undefined"){let{JSDOM:e}=xt("jsdom");return new e("<!DOCTYPE html>").window}return window}function xo(e){return e?{__html:kt(Dt()).sanitize(e,{ALLOWED_TAGS:["b","i","a","span","div","p","pre","u","br","img","code","li","ul","table","tbody","thead","tr","td","th","h1","h2","h3","h4","video"],ALLOWED_ATTR:["style","class","target","id","href","alt","src","controls","autoplay","loop","muted"]})}:{__html:""}}function Ot(e){return e&&`fr-${e}`}function bo(e){return e&&(Array.isArray(e)?e.map(o=>bo(o)).join(" "):Ot(e))}function It(l,a){var c=l,{as:e,children:o,className:t,css:r={},part:n}=c,s=d(c,["as","children","className","css","part"]);let m=e!=null?e:"div",{cssFromProps:g,unmatchedProps:b}=go(s,m),S=bo(n),C=t||S?clsx(t,S):void 0,P=[{boxSizing:"border-box"},g,r];return typeof o=="string"?jsx(m,p(i({className:C,css:P},b),{ref:a,dangerouslySetInnerHTML:xo(o)})):jsx(m,p(i({className:C,css:P},b),{ref:a,children:o}))}var u=Me.forwardRef(It);var T={};N(T,{Link:()=>sr,Plain:()=>ar,Primary:()=>nr,Secondary:()=>ir});var h={};N(h,{Body1:()=>qt,Body2:()=>Yt,Caption:()=>Qt,Display1:()=>zt,Display2:()=>Kt,H1:()=>Ut,H2:()=>Gt,H3:()=>Xt,H4:()=>Jt});var Oe={};N(Oe,{Body1:()=>$t,Body2:()=>_t,Caption:()=>Nt,Display1:()=>Mt,Display2:()=>Ht,H1:()=>Wt,H2:()=>At,H3:()=>Lt,H4:()=>Vt});var j={color:"neutral.foreground",fontFamily:"default",margin:"0"},Mt=p(i({},j),{fontSize:"5xl",fontWeight:"bold",lineHeight:"4xl"}),Ht=p(i({},j),{fontSize:"4xl",fontWeight:"bold",lineHeight:"3xl"}),Wt=p(i({},j),{fontSize:"3xl",fontWeight:"demibold",lineHeight:"2xl"}),At=p(i({},j),{fontSize:"2xl",fontWeight:"demibold",lineHeight:"xl"}),Lt=p(i({},j),{fontSize:"xl",fontWeight:"demibold",lineHeight:"lg"}),Vt=p(i({},j),{fontSize:"md",fontWeight:"demibold",lineHeight:"md"}),$t=p(i({},j),{fontSize:"md",fontWeight:"regular",lineHeight:"md"}),_t=p(i({},j),{fontSize:"sm",fontWeight:"regular",lineHeight:"sm"}),Nt=p(i({},j),{fontSize:"xs",fontWeight:"regular",lineHeight:"xs"});var jt=["Display1","Display2","H1","H2","H3","H4","Body1","Body2","Caption"],z=Object.fromEntries(jt.map(e=>{let o=["H1","H2","H3","H4"].includes(e)?e.toLowerCase():"span",t=Me.forwardRef((l,a)=>{var c=l,{as:r=o,children:n}=c,s=d(c,["as","children"]);return jsx(u,p(i(i({as:r},Oe[e]),s),{ref:a,children:n}))});return t.displayName=`Text.${e}`,[e,t]})),zt=z.Display1,Kt=z.Display2,Ut=z.H1,Gt=z.H2,Xt=z.H3,Jt=z.H4,qt=z.Body1,Yt=z.Body2,Qt=z.Caption;var Ie={};N(Ie,{Link:()=>tr,Plain:()=>rr,Primary:()=>er,Secondary:()=>or});var xe={borderWidth:"md",borderRadius:"md",borderStyle:"solid",display:"flex",gap:"2",padding:"2 4"},er=p(i({},xe),{backgroundColor:"primary.surface",borderColor:"primary.border",color:"primary.foreground","backgroundColor:hover":"primary.hover.surface","backgroundColor:disabled":"primary.surface","opacity:disabled":"0.7"}),or=p(i({},xe),{backgroundColor:"secondary.background",borderColor:"secondary.border",color:"secondary.foreground","backgroundColor:hover":"secondary.hover.background","backgroundColor:disabled":"secondary.background","opacity:disabled":"0.7"}),tr=p(i({},xe),{backgroundColor:"transparent",borderColor:"transparent",color:"primary.surface","color:hover":"primary.hover.surface"}),rr=p(i({},xe),{backgroundColor:"transparent",borderColor:"transparent",color:"neutral.foreground"});function ye(a){var l=a,{as:e,children:o,part:t,title:r,variant:n="Primary"}=l,s=d(l,["as","children","part","title","variant"]);let c=n.toLocaleLowerCase();return jsxs(u,p(i(i({as:e!=null?e:"button",part:[`button-${c}`,t]},Ie[n]),s),{children:[o,r&&jsx(h.Body2,{color:"inherit",css:{WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"},flexGrow:"1",fontWeight:"demibold",part:"button-title",children:r})]}))}function nr(t){var r=t,{children:e}=r,o=d(r,["children"]);return jsx(ye,p(i({},o),{variant:"Primary",children:e}))}function ir(t){var r=t,{children:e}=r,o=d(r,["children"]);return jsx(ye,p(i({},o),{variant:"Secondary",children:e}))}function sr(t){var r=t,{children:e}=r,o=d(r,["children"]);return jsx(ye,p(i({},o),{variant:"Link",children:e}))}function ar(t){var r=t,{children:e}=r,o=d(r,["children"]);return jsx(ye,p(i({},o),{variant:"Plain",children:e}))}var x={};N(x,{Column:()=>dr,Row:()=>pr});var pr=Me.forwardRef((e,o)=>jsx(u,p(i({display:"flex",flexDirection:"row"},e),{ref:o}))),dr=Me.forwardRef((e,o)=>jsx(u,p(i({display:"flex",flexDirection:"column"},e),{ref:o})));var D=createContext({apiKey:"",modals:new Set,setModals:()=>{},currentModal:null,navigate:()=>{}});function Fo(n){var s=n,{children:e,navigate:o,theme:t}=s,r=d(s,["children","navigate","theme"]);let a=t?ke(t):{},[l,c]=useState(new Set),m=useMemo(()=>new Frigade(r.apiKey,{apiKey:r.apiKey,apiUrl:r.apiUrl,userId:r.userId,groupId:r.groupId,__readOnly:r.__readOnly,__flowConfigOverrides:r.__flowConfigOverrides}),[r.userId,r.groupId,r.apiKey]),g=o!=null?o:(S,C="_self")=>{window.open(S,C);};useEffect(()=>()=>{m.destroy();},[]);let b=l.size>0?l.values().next().value:null;return jsxs(D.Provider,{value:p(i({modals:l,setModals:c,currentModal:b,navigate:g},r),{frigade:m}),children:[jsx(Global,{styles:{":root":i(i({},De),a)}}),jsx(ThemeProvider,{theme:F,children:e})]})}function de(e,o){let[t,r]=useState(),[,n]=useState(""),{frigade:s}=useContext(D),a=l=>{l.id===e&&(o!=null&&o.variables&&l.applyVariables(o.variables),r(l),n(Math.random().toString()));};return useEffect(()=>(k(this,null,function*(){let l=yield s.getFlow(e);if(!l||s.hasFailedToLoad()){r(void 0);return}o!=null&&o.variables&&l.applyVariables(o.variables),r(l);}),s.onStateChange(a),()=>{s.removeStateChangeHandler(a);}),[]),useEffect(()=>{!(o!=null&&o.variables)||!t||a(t);},[o==null?void 0:o.variables]),{flow:t}}function Q(e,{onComplete:o,onDismiss:t}={}){let r=useRef(null);return useEffect(()=>{e!=null&&(e.isCompleted&&r.current===!1&&k(this,null,function*(){yield o==null?void 0:o(e);}),r.current=e==null?void 0:e.isCompleted);},[e==null?void 0:e.isCompleted]),{handleDismiss:useCallback(n=>k(this,null,function*(){if((yield t==null?void 0:t(e,n))===!1)return n.preventDefault(),!1;e.skip();}),[e])}}function Z(e,{onPrimary:o,onSecondary:t}={}){let{navigate:r}=useContext(D);return {handlePrimary:useCallback((n,s)=>k(this,null,function*(){return (yield o==null?void 0:o(e,n))===!1?(n.preventDefault(),!1):(e.complete(s),e.primaryButtonUri!=null&&r(e.primaryButtonUri,e.primaryButtonUriTarget),!0)}),[e]),handleSecondary:useCallback((n,s)=>k(this,null,function*(){return (yield t==null?void 0:t(e,n))===!1?(n.preventDefault(),!1):(e.complete(s),e.secondaryButtonUri!=null&&r(e.secondaryButtonUri,e.secondaryButtonUriTarget),!0)}),[e])}}function ce(e,o=!0){let{currentModal:t,modals:r,setModals:n}=useContext(D),[s,a]=useState(!1);useEffect(()=>{o&&(e!=null&&e.isVisible)&&e&&!r.has(e.id)&&n(c=>new Set(c).add(e.id));},[e==null?void 0:e.id,e==null?void 0:e.isVisible]),useEffect(()=>{let c=t===(e==null?void 0:e.id);o&&(e==null?void 0:e.id)!=null&&c!==s&&a(c);},[e==null?void 0:e.id,t]);function l(){o&&r.has(e==null?void 0:e.id)&&n(c=>{let m=new Set(c);return m.delete(e==null?void 0:e.id),m});}return {isCurrentModal:s||!o,removeModal:l}}function $(S){var C=S,{as:e,children:o,container:t,dismissible:r=!1,flowId:n,onComplete:s,onDismiss:a,onPrimary:l,onSecondary:c,variables:m,forceMount:g}=C,b=d(C,["as","children","container","dismissible","flowId","onComplete","onDismiss","onPrimary","onSecondary","variables","forceMount"]);let{flow:P}=de(n,{variables:m}),E=P==null?void 0:P.getCurrentStep(),{handleDismiss:L}=Q(P,{onComplete:s,onDismiss:a}),{handlePrimary:V,handleSecondary:U}=Z(E,{onPrimary:l,onSecondary:c}),Y=e&&typeof e=="function"&&(e.displayName==="Dialog"||e.displayName==="Modal"),{isCurrentModal:ae,removeModal:we}=ce(P,Y);if(useEffect(()=>{!(P!=null&&P.isVisible)&&ae&&we();},[P==null?void 0:P.isVisible,ae]),P==null||!ae)return null;let Re=g&&P.isCompleted;if(!P.isVisible&&!Re)return null;!P.isCompleted&&!P.isSkipped&&E.start();let Be=e!=null?e:u;return jsx(Be,p(i({position:"relative"},b),{children:o({flow:P,handleDismiss:L,handlePrimary:V,handleSecondary:U,parentProps:i({container:t,dismissible:r,flowId:n,variables:m},b),step:E})}))}function vo(e){return jsx($,p(i({as:y,gap:5,borderColor:"neutral.border",borderStyle:"solid",borderWidth:"md",part:"card"},e),{children:({handleDismiss:o,handlePrimary:t,handleSecondary:r,parentProps:{dismissible:n},step:s})=>jsxs(Fragment,{children:[jsxs(x.Row,{alignItems:"center",flexWrap:"wrap",gap:1,justifyContent:"space-between",part:"card-header",children:[jsx(y.Title,{children:s.title}),n&&jsx(y.Dismiss,{onClick:o}),jsx(y.Subtitle,{flexBasis:"100%",children:s.subtitle})]}),jsx(y.Media,{src:s.imageUri,css:{objectFit:"contain",width:"100%"}}),jsxs(x.Row,{gap:3,justifyContent:"flex-end",part:"card-footer",children:[jsx(y.Secondary,{title:s.secondaryButtonTitle,onClick:r}),jsx(y.Primary,{title:s.primaryButtonTitle,onClick:t})]})]})}))}function We(r){var n=r,{part:e,src:o}=n,t=d(n,["part","src"]);return jsx(u,i({as:"img",part:["image",e],src:o},t))}function Dr(e){var o,t,r,n;return e.includes("youtube")?`https://www.youtube.com/embed/${(o=e.split("v=")[1])==null?void 0:o.split("&")[0]}`:e.includes("vimeo")?`https://player.vimeo.com/video/${(t=e.split("vimeo.com/")[1])==null?void 0:t.split("&")[0]}`:e.includes("wistia")?`https://fast.wistia.net/embed/iframe/${(r=e.split("wistia.com/medias/")[1])==null?void 0:r.split("&")[0]}`:e.includes("loom")?`https://loom.com/embed/${(n=e.split("loom.com/share/")[1])==null?void 0:n.split("&")[0]}?hideEmbedTopBar=true&hide_title=true&hide_share=true&hide_owner=true`:null}function Ae(r){var n=r,{part:e,src:o}=n,t=d(n,["part","src"]);let s=Dr(o);return s?jsx(u,i({allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,as:"iframe",backgroundColor:"gray100",borderWidth:0,part:["video",e],src:s},t)):o!=null&&o.endsWith(".mp4")?jsx(u,i({as:"video",controls:!0,part:["video",e],src:o},t)):(console.error(`Could not map videoUri ${o} to a known provider (Youtube, Vimeo, Wistia, Loom) or valid mp4 file.`),null)}function oe(r){var n=r,{src:e,type:o}=n,t=d(n,["src","type"]);return jsx(o==="video"?Ae:We,i({src:e},t))}var y=Me.forwardRef((n,r)=>{var s=n,{children:e,flowId:o}=s,t=d(s,["children","flowId"]);var l;if(o!=null)return jsx(vo,i({flowId:o},t));let a=(l=t.as)!=null?l:x.Column;return jsx(a,p(i({backgroundColor:"neutral.background",borderColor:"neutral.border",borderStyle:"solid",borderRadius:"md",borderWidth:"0",gap:5,p:5},t),{ref:r,children:e}))});y.Dismiss=e=>jsx(T.Plain,p(i({part:"dismiss",padding:0},e),{children:jsx(XMarkIcon,{height:"24",fill:"currentColor"})}));y.Media=t=>{var r=t,{src:e}=r,o=d(r,["src"]);return e==null?null:jsx(oe,i({borderRadius:"md",src:e},o))};y.Primary=r=>{var n=r,{onClick:e,title:o}=n,t=d(n,["onClick","title"]);return o==null?null:jsx(T.Primary,i({title:o,onClick:e},t))};y.Secondary=r=>{var n=r,{onClick:e,title:o}=n,t=d(n,["onClick","title"]);return o==null?null:jsx(T.Secondary,i({title:o,onClick:e},t))};y.Subtitle=t=>{var r=t,{children:e}=r,o=d(r,["children"]);return e==null?null:jsx(h.Body2,p(i({display:"block",part:"subtitle"},o),{children:e}))};y.Title=t=>{var r=t,{children:e}=r,o=d(r,["children"]);return e==null?null:jsx(h.Body1,p(i({display:"block",fontWeight:"bold",part:"title"},o),{children:e}))};var he={content:["onOpenAutoFocus","onCloseAutoFocus","onEscapeKeyDown","onPointerDownOutside","onInteractOutside"],root:["defaultOpen","modal","onOpenChange","open"]};function Eo(e){let o=Object.fromEntries(he.content.map(n=>[n,e[n]]).filter(n=>n[1]!==void 0)),t=Object.fromEntries(he.root.map(n=>[n,e[n]]).filter(n=>n[1]!==void 0)),r={};for(let n of Object.keys(e))!he.content.includes(n)&&!he.root.includes(n)&&(r[n]=e[n]);return {contentProps:o,otherProps:r,rootProps:t}}function w(n){var s=n,{children:e,className:o,modal:t=!0}=s,r=d(s,["children","className","modal"]);let{rootProps:a,contentProps:l,otherProps:c}=Eo(r);return jsx(O.Root,p(i({defaultOpen:!0,modal:t},a),{children:jsx(O.Portal,{children:jsxs(u,{className:o,display:"grid",inset:"0",padding:"6",pointerEvents:"none",position:"fixed",children:[jsx(O.Overlay,{asChild:!0,children:jsx(u,{background:"rgb(0 0 0 / 0.5)",inset:"0",part:"dialog-overlay",position:"absolute"})}),jsx(O.Content,p(i({asChild:!0,onOpenAutoFocus:m=>m.preventDefault(),onPointerDownOutside:m=>m.preventDefault()},l),{children:jsx(y,p(i({alignSelf:"center",boxShadow:"md",justifySelf:"center",maxWidth:"430px",p:8,part:"dialog",pointerEvents:"auto"},c),{children:e}))}))]})})}))}w.Dismiss=e=>jsx(O.Close,{"aria-label":"Close",asChild:!0,children:jsx(T.Plain,p(i({part:"close",position:"absolute",right:"-4px",top:"4px"},e),{children:jsx(XMarkIcon,{height:"24",fill:"currentColor"})}))});w.Subtitle=t=>{var r=t,{children:e}=r,o=d(r,["children"]);return jsx(O.Description,{asChild:!0,children:jsx(h.Body2,p(i({part:"subtitle"},o),{children:e}))})};w.Media=t=>{var r=t,{src:e}=r,o=d(r,["src"]);return e==null?null:jsx(oe,i({borderRadius:"md",src:e},o))};w.Primary=r=>{var n=r,{onClick:e,title:o}=n,t=d(n,["onClick","title"]);return o==null?null:jsx(T.Primary,i({title:o,onClick:e},t))};w.ProgressDots=({current:e,total:o})=>{if(o==1)return null;let t=[...Array(o)].map((r,n)=>jsx(u,{as:"circle",r:4,cx:4+16*n,cy:"4px",fill:e===n?F.colors.blue500:F.colors.blue800,part:e===n?"progress-dot-selected":"progress-dot"},n));return jsx(u,{as:"svg",height:"8px",marginInline:"auto",part:"progress",viewBox:`0 0 ${16*o-8} 8`,width:16*o-8,children:t})};w.Secondary=r=>{var n=r,{onClick:e,title:o}=n,t=d(n,["onClick","title"]);return o==null?null:jsx(T.Secondary,i({title:o,onClick:e},t))};w.Title=t=>{var r=t,{children:e}=r,o=d(r,["children"]);return jsx(O.Title,{asChild:!0,children:jsx(h.H3,p(i({part:"title"},o),{children:e}))})};w.displayName="Dialog";function Hr(t){var r=t,{flowId:e}=r,o=d(r,["flowId"]);return jsx($,p(i({as:w,dismissible:!0,flowId:e,textAlign:"center"},o),{children:({flow:n,handleDismiss:s,handlePrimary:a,handleSecondary:l,parentProps:{dismissible:c},step:m})=>{var g,b;return jsxs(Fragment,{children:[c&&jsx(w.Dismiss,{onClick:s}),jsxs(x.Column,{gap:1,part:"announcement-header",children:[jsx(w.Title,{children:m.title}),jsx(w.Subtitle,{children:m.subtitle})]}),jsx(w.Media,{src:(g=m.videoUri)!=null?g:m.imageUri,type:m.videoUri?"video":"image",css:{aspectRatio:"1.5",objectFit:"cover",width:"100%"}}),jsx(w.ProgressDots,{current:n.getNumberOfCompletedSteps(),total:n.getNumberOfAvailableSteps()}),jsxs(x.Row,{css:{"& > button":{flexBasis:"50%",flexGrow:1}},gap:3,part:"announcement-footer",children:[m.secondaryButtonTitle&&jsx(w.Secondary,{onClick:l,title:m.secondaryButtonTitle}),m.primaryButtonTitle&&jsx(w.Primary,{onClick:a,title:(b=m.primaryButtonTitle)!=null?b:"Continue"})]})]})}}))}function Ar(t){var r=t,{flowId:e}=r,o=d(r,["flowId"]);return jsx($,p(i({as:y,borderWidth:"md",display:"flex",flexDirection:"row",flowId:e,gap:3,justifyContent:"space-between",part:"banner"},o),{children:({handleDismiss:n,handlePrimary:s,handleSecondary:a,step:l})=>jsxs(Fragment,{children:[jsxs(x.Row,{gap:3,children:[l.imageUri&&jsx(u,{as:"img",part:"image",src:l.imageUri,style:{height:40,width:40,alignSelf:"center"}}),jsxs(x.Column,{children:[jsx(h.H4,{part:"title",children:l.title}),jsx(h.Body2,{part:"subtitle",children:l.subtitle})]})]}),jsxs(x.Row,{alignItems:"center",gap:3,justifyContent:"center",children:[l.secondaryButtonTitle&&jsx(T.Secondary,{title:l.secondaryButtonTitle,onClick:a}),jsx(T.Primary,{title:l.primaryButtonTitle,onClick:s}),o.dismissible&&jsx(y.Dismiss,{onClick:n})]})]})}))}var je={};N(je,{Collapsible:()=>$o,CollapsibleStep:()=>me});var me={};N(me,{Content:()=>$e,Root:()=>_e,Trigger:()=>Ne});var $r=keyframes`
21
21
  from {
22
22
  height: 0;
23
23
  opacity: 0;
@@ -26,7 +26,7 @@ var rt=Object.defineProperty;var nt=(e=>typeof require<"u"?require:typeof Proxy<
26
26
  height: var(--radix-collapsible-content-height);
27
27
  opacity: 1;
28
28
  }
29
- `,kr=keyframes`
29
+ `,_r=keyframes`
30
30
  from {
31
31
  height: var(--radix-collapsible-content-height);
32
32
  opacity: 1;
@@ -35,8 +35,8 @@ var rt=Object.defineProperty;var nt=(e=>typeof require<"u"?require:typeof Proxy<
35
35
  height: 0;
36
36
  opacity: 0;
37
37
  }
38
- `,Dr=()=>jsx(l,{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 Er({checked:e=!1}){return jsx(l,{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(l,{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(Dr,{})})})}function Ee({children:e}){return jsx(Y.Content,{asChild:!0,children:jsxs(u.Column,{css:{'&[data-state="open"]':{animation:`${vr} 300ms ease-out`},'&[data-state="closed"]':{animation:`${kr} 300ms ease-out`},overflow:"hidden"},gap:5,children:[jsx(l,{}),e]})})}function Oe({children:e,open:o=!1,onOpenChange:t=()=>{}}){return jsx(Y.Root,{asChild:!0,open:o,onOpenChange:t,children:jsx(f,{borderWidth:"md",css:{'&[data-state="open"] .fr-collapsible-step-icon':{transform:"rotate(180deg)"}},gap:0,children:e})})}function Ie({isCompleted:e,title:o}){return jsx(Y.Trigger,{asChild:!0,children:jsxs(u.Row,{alignItems:"center",justifyContent:"space-between",margin:-5,padding:5,zIndex:1,children:[jsxs(u.Row,{alignItems:"center",gap:2,children:[jsx(Er,{checked:e}),jsx(x.Body2,{fontWeight:"demibold",userSelect:"none",children:o})]}),jsx(l,{as:ChevronDownIcon,color:"gray100",css:{"& path":{vectorEffect:"non-scaling-stroke"}},display:"block",height:"16px",order:2,part:"collapsible-step-icon",width:"16px"})]})})}var Me={};M(Me,{Bar:()=>me,Dots:()=>So,Segments:()=>To});function me({current:e,total:o,...t}){let i=o>0?Math.min(e/o,1):0,r=i===0?"10px":`${100*i}%`;return jsx(l,{part:"progress-bar",backgroundColor:"blue800",borderRadius:"md",height:"10px",...t,children:jsx(l,{backgroundColor:"primary.surface",part:"progress-bar-fill",borderRadius:"md",height:"100%",style:{width:r},transition:"width 300ms ease-out"})})}function So({current:e,total:o,...t}){if(o==1)return null;let i=[...Array(o)].map((r,n)=>jsx(l,{as:"circle",r:4,cx:4+16*n,cy:"4px",fill:e-1===n?y.colors.blue500:y.colors.blue800},n));return jsx(l,{as:"svg",height:"8px",part:"progress-dots",viewBox:`0 0 ${16*o-8} 8`,width:16*o-8,...t,children:i})}function To({current:e,total:o,...t}){let i=[...Array(o)].map((r,n)=>jsx(l,{backgroundColor:e-1===n?"primary.surface":"blue800",borderRadius:"md",flexGrow:1,height:"100%"},n));return jsx(u.Row,{gap:1,height:"10px",...t,children:i})}var wo=createContext({onPrimary:()=>{},onSecondary:()=>{},openStepId:null,setOpenStepId:()=>{},stepTypes:{}});function Ro({handlePrimary:e,handleSecondary:o,open:t,onOpenChange:i,step:r}){let{isBlocked:n,isCompleted:a,primaryButtonTitle:s,secondaryButtonTitle:d,subtitle:m,title:g}=r;return jsxs(Oe,{open:t,onOpenChange:i,children:[jsx(Ie,{isCompleted:a,title:g}),jsxs(Ee,{children:[jsx(f.Media,{aspectRatio:2.5,objectFit:"cover",src:r.imageUri}),jsx(f.Subtitle,{color:"gray500",children:m}),jsxs(u.Row,{gap:3,children:[jsx(f.Secondary,{disabled:!!(a||n),title:d,onClick:o}),jsx(f.Primary,{disabled:!!(a||n),title:s,onClick:e})]})]})]})}var Hr={default:Ro};function Wr({flow:e,step:o,...t}){let{onPrimary:i,onSecondary:r,openStepId:n,setOpenStepId:a,stepTypes:s}=useContext(wo),{handlePrimary:d,handleSecondary:m}=z(o,{onPrimary:i,onSecondary:r}),g=(n??e.getCurrentStep().id)===o.id,b=s[o.type]??Ro;async function c(F){a(F?o.id:""),F&&!o.isCompleted&&await o.start();}return jsx(b,{flow:e,onOpenChange:c,open:g,step:o,...t,handlePrimary:d,handleSecondary:m},o.id)}function Bo({dismissible:e,flowId:o,onPrimary:t,onSecondary:i,stepTypes:r={},...n}){let[a,s]=useState(null),d={...Hr,...r};return jsx(wo.Provider,{value:{openStepId:a,setOpenStepId:s,onPrimary:t,onSecondary:i,stepTypes:d},children:jsx(O,{as:f,borderWidth:"md",flowId:o,part:"checklist",...n,children:({flow:m,handleDismiss:g,...b})=>{let c=Array.from(m.steps.entries()).map(([,N])=>jsx(Wr,{flow:m,handleDismiss:g,...b,step:N},N.id)),F=m.getNumberOfCompletedSteps(),q=m.getNumberOfAvailableSteps();return jsxs(Fragment,{children:[jsxs(u.Column,{gap:2,children:[jsxs(u.Row,{alignItems:"center",flexWrap:"wrap",gap:1,justifyContent:"space-between",part:"checklist-header",children:[jsx(f.Title,{children:m.title}),e&&jsx(f.Dismiss,{onClick:g}),jsx(f.Subtitle,{color:"gray500",flexBasis:"100%",children:m.subtitle})]}),jsxs(u.Row,{alignItems:"center",gap:2,children:[jsxs(x.Body2,{fontWeight:"demibold",children:[F,"/",q]}),jsx(me,{current:F,total:q,flexGrow:1})]})]}),c]})}})})}var $r=new Set(["required","min","max","minLength","maxLength","pattern"]);function _r({fieldComponent:e,control:o,fieldData:t}){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 i=Object.fromEntries(Object.entries(t).filter(([n])=>$r.has(n))),r=useController({name:t.id,control:o,rules:i});return jsx(e,{...r,fieldData:t})}function ko({fieldTypes:e,handleDismiss:o,handlePrimary:t,handleSecondary:i,parentProps:{dismissible:r},step:n}){var b;let{control:a,handleSubmit:s}=useForm({delayError:2e3,mode:"onChange"}),d=[];function m(c,F){t(F,c);}function g(c,F){i(F,c);}return (b=n.fields)==null||b.forEach(c=>{e[c.type]!=null&&d.push(jsx(_r,{control:a,fieldComponent:e[c.type],fieldData:c},c.id));}),jsxs(u.Column,{gap:5,part:"form-step",children:[jsxs(u.Row,{alignItems:"center",flexWrap:"wrap",gap:1,justifyContent:"space-between",part:"form-step-header",children:[jsx(f.Title,{children:n.title}),r&&jsx(f.Dismiss,{onClick:o}),jsx(f.Subtitle,{flexBasis:"100%",children:n.subtitle})]}),d,jsxs(u.Row,{part:"form-step-footer",justifyContent:"flex-end",gap:3,children:[n.secondaryButtonTitle&&jsx(h.Secondary,{title:n.secondaryButtonTitle,onClick:s(g)}),jsx(h.Primary,{title:n.primaryButtonTitle??"Submit",onClick:s(m)})]},"form-footer")]})}function Do({error:e}){var o;return (o=e==null?void 0:e.message)!=null&&o.length?jsx(x.Caption,{color:"red500",display:"block",part:"field-error",textAlign:"end",children:e==null?void 0:e.message}):null}function Eo({children:e,id:o,required:t=!1}){return jsxs(x.H4,{as:"label",htmlFor:o,part:"field-label",children:[e,t&&" *"]})}var ne={px:"4",py:"2",backgroundColor:"neutral.background",borderColor:"neutral.border",borderStyle:"solid",borderWidth:"md",borderRadius:"md",display:"block",outline:"none",width:"100%"};function _({children:e,field:o,fieldData:t,fieldState:i}){let{id:r,label:n,placeholder:a}=t,{error:s}=i,d={id:r,...o,...a?{placeholder:a}:{},...ne,"aria-invalid":!!s,value:o.value??""};return jsxs(l,{part:"field",children:[jsx(Eo,{id:r,required:!!t.required,children:n}),e(d),jsx(Do,{error:s})]})}var Kr=()=>jsx(l,{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"})}),Ur=we.forwardRef(({label:e,value:o},t)=>jsxs(l,{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(x.Body2,{part:"field-radio-label",children:e}),jsx(Q.Item,{id:o,value:o,ref:t,asChild:!0,children:jsx(l,{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(l,{as:Q.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(Kr,{})})})})]}));function Ho(e){let{field:{onChange:o,value:t},fieldData:{options:i=[]}}=e,r=i.map(({label:n,value:a})=>jsx(Ur,{value:a,label:n},a));return jsx(_,{...e,children:()=>jsx(Q.Root,{value:t,onValueChange:o,asChild:!0,children:jsx(u.Column,{gap:2,part:"field-radio-group",children:r})})})}var Jr=we.forwardRef(({label:e,value:o},t)=>jsx(S.Item,{value:o,ref:t,asChild:!0,children:jsx(l,{"backgroundColor:hover":"blue900",borderRadius:"md",outline:"none",part:"field-select-option",px:"3",py:"2",children:jsx(S.ItemText,{asChild:!0,children:jsx(x.Body2,{part:"field-select-option-label",children:e})})})}));function Lo(e){let{field:{onChange:o,value:t},fieldData:{options:i=[],placeholder:r}}=e,n=i.map(({label:a,value:s})=>jsx(Jr,{value:s,label:a},s));return jsx(_,{...e,children:()=>jsxs(S.Root,{value:t,onValueChange:o,children:[jsx(S.Trigger,{asChild:!0,children:jsxs(x.Body2,{...ne,alignItems:"center",display:"flex",justifyContent:"space-between",part:"field-select",children:[jsx(S.Value,{placeholder:r??"Select one"}),jsx(S.Icon,{children:jsx(l,{as:ChevronDownIcon,color:"gray100",display:"block",height:"24px",part:"field-select-icon",width:"24px"})})]})}),jsx(S.Portal,{children:jsx(S.Content,{position:"popper",sideOffset:4,asChild:!0,children:jsx(l,{...ne,p:"1",part:"field-select-options",width:"var(--radix-popper-anchor-width)",children:jsx(S.Viewport,{children:n})})})})]})})}function $o(e){return jsx(_,{...e,children:o=>jsx(x.Body2,{as:"input",part:"field-text",type:"text",...o})})}function No(e){return jsx(_,{...e,children:o=>jsx(x.Body2,{as:"textarea",part:"field-textarea",...o})})}var qr={radio:Ho,select:Lo,text:$o,textarea:No};function We({fieldTypes:e={},flowId:o,...t}){let i=Object.assign({},qr,e);return jsx(O,{flowId:o,part:"form",...t,children:r=>jsx(ko,{fieldTypes:i,...r})})}var Go={};M(Go,{NPS:()=>Uo});function Ko({field:e}){let o=[...Array(11)].map((t,i)=>{let r=e.value===i?h.Primary:h.Secondary;return jsx(r,{borderWidth:"1px",onClick:()=>e.onChange(i),title:`${i}`},i)});return jsx(u.Row,{gap:2,justifyContent:"space-between",part:"field-nps",children:o})}function Uo({as:e=P,flowId:o,fieldTypes:t,...i}){return jsx(We,{alignSelf:"end",as:e,flowId:o,fieldTypes:{nps:Ko,...t},minWidth:"620px",modal:!1,width:"620px",...i})}function ue(){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),[i,r]=useState(null),n=useCallback(a=>{r(a);},[]);return useLayoutEffect(()=>{if(!i)return;let a=()=>{let s=i.getBoundingClientRect();t(s);};return a(),window.addEventListener("resize",a),()=>window.removeEventListener("resize",a)},[i]),{node:i,rect:o,ref:n}}var on=keyframes({"0%":{opacity:.5,transform:"scale(0.5)"},"50%":{opacity:0,transform:"scale(1)"},"100%":{opacity:0,transform:"scale(1)"}});function qo({style:e={},part:o="",...t}){return jsxs(l,{part:`dot-wrapper ${o}`,style:{height:"48px",position:"absolute",width:"48px",...e},...t,children:[jsx(l,{backgroundColor:"primary.surface",part:"dot-pulse",css:{animation:`2s ease-out infinite ${on}`,borderRadius:"24px",height:"48px",left:0,position:"absolute",top:0,transformOrigin:"center center",width:"48px"}}),jsx(l,{backgroundColor:"primary.surface",part:"dot",style:{borderRadius:"12px",height:"24px",left:"12px",position:"absolute",top:"12px",width:"24px"}})]})}function Yo({props:e,alignAttr:o,sideAttr:t}){let i=t??"bottom",r={},n=()=>{if(["after","before"].includes(e.align)){if(o=="start")return "before";if(o=="end")return "after"}return e.align??"after"},a="-24px",s={top:"bottom",right:"left",bottom:"top",left:"right"};r[s[i]]=a;let d=n();return ["before","end"].includes(d)?["top","bottom"].includes(i)?r.right=a:r.bottom=a:["after","start"].includes(d)?["top","bottom"].includes(i)?r.left=a:r.top=a:["top","bottom"].includes(i)?r.left=`calc(50% + ${a})`:r.top=`calc(50% + ${a})`,r}var fe={content:["align","alignOffset","arrowPadding","avoidCollisions","collisionBoundary","collisionPadding","forceMount","hideWhenDetached","onCloseAutoFocus","onEscapeKeyDown","onFocusOutside","onInteractOutside","onOpenAutoFocus","onPointerDownOutside","side","sideOffset","sticky"],root:["defaultOpen","modal","onOpenChange","open"]};function Qo(e,o){let t=Object.fromEntries(fe.content.map(n=>[n,e[n]]).filter(n=>n[1]!==void 0)),i=Object.fromEntries(fe.root.map(n=>[n,e[n]]).filter(n=>n[1]!==void 0)),r={};for(let n of Object.keys(e))!fe.content.includes(n)&&!fe.root.includes(n)&&(r[n]=e[n]);if(t.align=t.align??"after",t.side=t.side??"bottom",["before","after"].includes(t.align)){let n={after:"end",before:"start"},a=(c,F)=>["top","bottom"].includes(F)?c=="after"?"marginLeft":"marginRight":c=="after"?"marginTop":"marginBottom",s=t.alignOffset??0,d=t.style??{},m=t.side??"bottom",g=t.align;t.style={...d,[a(g,m)]:s};let b=["top","bottom"].includes(m)?o.width:o.height;t.alignOffset=(b+s)*-1,t.align=n[g];}return {contentProps:t,otherProps:r,rootProps:i}}function T({anchor:e,children:o,className:t,spotlight:i=!1,style:r,...n}){let{node:a,rect:s,ref:d}=ue(),{node:m,rect:g,ref:b}=ue(),{contentProps:c,otherProps:F,rootProps:q}=Qo(n,s),[N,xe]=useState(c.align),[ie,Z]=useState(c.side),[ye,he]=useState(0),[Ve,ot]=useState(0);if(a!==null){let L=a.getAttribute("data-align"),se=a.getAttribute("data-side");N!==L&&xe(L),ie!==se&&Z(se);}let $e=useRef(null);if(useEffect(()=>{let L=document.querySelector(e);L!=null?(b(L),$e.current=L):console.debug(`No anchor found for query: ${e}`);},[e]),useEffect(()=>{let{scrollX:L,scrollY:se}=window;he(g.left+L),ot(g.top+se);},[g.left,g.top]),m==null)return null;let _e="0";typeof window<"u"&&(_e=window.getComputedStyle(m).borderRadius);let tt=Yo({props:n,alignAttr:N,sideAttr:ie});return jsxs(I.Root,{defaultOpen:!0,...q,children:[jsx(I.Anchor,{virtualRef:$e}),jsx(I.Portal,{children:jsxs(Fragment,{children:[i&&jsx(l,{boxShadow:"0 0 0 20000px rgb(0 0 0 / 0.5)",part:"tooltip-spotlight",pointerEvents:"none",position:"absolute",style:{borderRadius:_e,height:g.height,left:ye,top:Ve,width:g.width}}),jsx(I.Content,{asChild:!0,...c,ref:d,children:jsxs(f,{boxShadow:"md",part:"tooltip",position:"relative",className:t,css:{maxWidth:"360px",pointerEvents:"auto"},style:r,...F,children:[jsx(qo,{style:tt}),o]})})]})})]})}T.Close=e=>jsx(I.Close,{"aria-label":"Close",asChild:!0,children:jsx(h.Plain,{css:{top:"12px",right:"4px"},part:"close",position:"absolute",...e,children:jsx(XMarkIcon,{height:"24",fill:"currentColor"})})});T.Media=({src:e,...o})=>e==null?null:jsx(U,{borderRadius:"md md 0 0",borderWidth:"0",css:{aspectRatio:"2",objectFit:"cover"},margin:"-5 -5 0",src:e,...o});T.Primary=({onClick:e,title:o,...t})=>o==null?null:jsx(h.Primary,{title:o,onClick:e,...t});T.Progress=({children:e,...o})=>e==null?null:jsx(x.H4,{part:"progress",...o,children:e});T.Secondary=({onClick:e,title:o,...t})=>o==null?null:jsx(h.Secondary,{title:o,onClick:e,...t});T.Subtitle=({children:e,...o})=>e==null?null:jsx(x.Body2,{part:"subtitle",...o,children:e});T.Title=({children:e,...o})=>e==null?null:jsx(x.H4,{part:"title",...o,children:e});function et({dismissible:e=!0,flow:o,onDismiss:t,onPrimary:i,onSecondary:r,step:n,...a}){let{handleDismiss:s}=j(o,{onDismiss:t}),{handlePrimary:d,handleSecondary:m}=z(n,{onPrimary:i,onSecondary:r});return jsxs(T,{anchor:n.selector,onOpenAutoFocus:g=>g.preventDefault(),onPointerDownOutside:g=>g.preventDefault(),onInteractOutside:g=>g.preventDefault(),...a,children:[e&&jsx(T.Close,{onClick:s}),jsx(T.Media,{src:n.videoUri??n.imageUri,type:n.videoUri?"video":"image"}),jsxs(u.Column,{gap:1,part:"tooltip-header",children:[jsx(T.Title,{children:n.title}),jsx(T.Subtitle,{color:"gray500",children:n.subtitle})]}),jsxs(u.Row,{alignItems:"center",gap:3,justifyContent:"flex-end",part:"tooltip-footer",children:[jsx(T.Progress,{marginRight:"auto",transform:"translateY(1px)",children:`${o.getNumberOfCompletedSteps()+1}/${o.getNumberOfAvailableSteps()}`}),jsx(T.Secondary,{title:n.secondaryButtonTitle,onClick:m}),jsx(T.Primary,{title:n.primaryButtonTitle,onClick:d})]})]},n.id)}function ln({flowId:e,onComplete:o,variables:t,...i}){let{flow:r}=te(e,{variables:t});j(r,{onComplete:o});let{isCurrentModal:n,removeModal:a}=re(r);if(useEffect(()=>{!(r!=null&&r.isVisible)&&n&&a();},[r==null?void 0:r.isVisible,n]),r==null||r.isVisible===!1||!n)return null;let s=r.getCurrentStep();return s==null||s.start(),jsx(et,{step:s,flow:r,...i})}function cn(){let{frigade:e}=useContext(w);return {frigade:e,isLoading:!(e!=null&&e.isReady())}}function un(){let{userId:e,frigade:o}=useContext(w);async function t(r){await o.identify(e,r);}async function i(r,n){await o.track(r,n);}return {userId:e,addProperties:t,track:i}}function gn(){let{groupId:e,frigade:o}=useContext(w);async function t(r){if(!e){console.error("No Group ID is set. Cannot set properties without a Group ID.");return}await o.group(e,r);}async function i(r,n){await o.track(r,n);}return {groupId:e,addProperties:t,track:i}}
38
+ `,Nr=()=>jsx(u,{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 jr({checked:e=!1}){return jsx(u,{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(u,{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(Nr,{})})})}function $e({children:e}){return jsx(ie.Content,{asChild:!0,children:jsxs(x.Column,{css:{'&[data-state="open"]':{animation:`${$r} 300ms ease-out`},'&[data-state="closed"]':{animation:`${_r} 300ms ease-out`},overflow:"hidden"},gap:5,children:[jsx(u,{}),e]})})}function _e({children:e,open:o=!1,onOpenChange:t=()=>{}}){return jsx(ie.Root,{asChild:!0,open:o,onOpenChange:t,children:jsx(y,{borderWidth:"md",css:{'&[data-state="open"] .fr-collapsible-step-icon':{transform:"rotate(180deg)"}},gap:0,children:e})})}function Ne({isCompleted:e,title:o}){return jsx(ie.Trigger,{asChild:!0,children:jsxs(x.Row,{alignItems:"center",justifyContent:"space-between",margin:-5,padding:5,zIndex:1,children:[jsxs(x.Row,{alignItems:"center",gap:2,children:[jsx(jr,{checked:e}),jsx(h.Body2,{fontWeight:"demibold",userSelect:"none",children:o})]}),jsx(u,{as:ChevronDownIcon,color:"gray100",css:{"& path":{vectorEffect:"non-scaling-stroke"}},display:"block",height:"16px",order:2,part:"collapsible-step-icon",width:"16px"})]})})}var Ce={};N(Ce,{Bar:()=>Pe,Dots:()=>Ho,Segments:()=>Ao});function Pe(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(u,p(i({part:"progress-bar",backgroundColor:"blue800",borderRadius:"md",height:"10px"},t),{children:jsx(u,{backgroundColor:"primary.surface",part:"progress-bar-fill",borderRadius:"md",height:"100%",style:{width:a},transition:"width 300ms ease-out"})}))}function Ho(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,l)=>jsx(u,{as:"circle",r:4,cx:4+16*l,cy:"4px",fill:e-1===l?F.colors.blue500:F.colors.blue800},l));return jsx(u,p(i({as:"svg",height:"8px",part:"progress-dots",viewBox:`0 0 ${16*o-8} 8`,width:16*o-8},t),{children:s}))}function Ao(r){var n=r,{current:e,total:o}=n,t=d(n,["current","total"]);let s=[...Array(o)].map((a,l)=>jsx(u,{backgroundColor:e-1===l?"primary.surface":"blue800",borderRadius:"md",flexGrow:1,height:"100%"},l));return jsx(x.Row,p(i({gap:1,height:"10px"},t),{children:s}))}var Lo=createContext({onPrimary:()=>{},onSecondary:()=>{},openStepId:null,setOpenStepId:()=>{},stepTypes:{}});function Vo({handlePrimary:e,handleSecondary:o,open:t,onOpenChange:r,step:n}){let{isBlocked:s,isCompleted:a,primaryButtonTitle:l,secondaryButtonTitle:c,subtitle:m,title:g}=n;return jsxs(_e,{open:t,onOpenChange:r,children:[jsx(Ne,{isCompleted:a,title:g}),jsxs($e,{children:[jsx(y.Media,{aspectRatio:2.5,objectFit:"cover",src:n.imageUri}),jsx(y.Subtitle,{color:"gray500",children:m}),jsxs(x.Row,{gap:3,children:[jsx(y.Secondary,{disabled:!!(a||s),title:c,onClick:o}),jsx(y.Primary,{disabled:!!(a||s),title:l,onClick:e})]})]})]})}var Gr={default:Vo};function Xr(r){var n=r,{flow:e,step:o}=n,t=d(n,["flow","step"]);var E;let{onPrimary:s,onSecondary:a,openStepId:l,setOpenStepId:c,stepTypes:m}=useContext(Lo),{handlePrimary:g,handleSecondary:b}=Z(o,{onPrimary:s,onSecondary:a}),S=(l!=null?l:e.getCurrentStep().id)===o.id,C=(E=m[o.type])!=null?E:Vo;function P(L){return k(this,null,function*(){c(L?o.id:""),L&&!o.isCompleted&&(yield o.start());})}return jsx(C,p(i({flow:e,onOpenChange:P,open:S,step:o},t),{handlePrimary:g,handleSecondary:b}),o.id)}function $o(a){var l=a,{dismissible:e,flowId:o,onPrimary:t,onSecondary:r,stepTypes:n={}}=l,s=d(l,["dismissible","flowId","onPrimary","onSecondary","stepTypes"]);let[c,m]=useState(null),g=i(i({},Gr),n);return jsx(Lo.Provider,{value:{openStepId:c,setOpenStepId:m,onPrimary:t,onSecondary:r,stepTypes:g},children:jsx($,p(i({as:y,borderWidth:"md",flowId:o,part:"checklist"},s),{children:P=>{var E=P,{flow:b,handleDismiss:S}=E,C=d(E,["flow","handleDismiss"]);let L=Array.from(b.steps.entries()).map(([,Y])=>jsx(Xr,p(i({flow:b,handleDismiss:S},C),{step:Y}),Y.id)),V=b.getNumberOfCompletedSteps(),U=b.getNumberOfAvailableSteps();return jsxs(Fragment,{children:[jsxs(x.Column,{gap:2,children:[jsxs(x.Row,{alignItems:"center",flexWrap:"wrap",gap:1,justifyContent:"space-between",part:"checklist-header",children:[jsx(y.Title,{children:b.title}),e&&jsx(y.Dismiss,{onClick:S}),jsx(y.Subtitle,{color:"gray500",flexBasis:"100%",children:b.subtitle})]}),jsxs(x.Row,{alignItems:"center",gap:2,children:[jsxs(h.Body2,{fontWeight:"demibold",children:[V,"/",U]}),jsx(Pe,{current:V,total:U,flexGrow:1})]})]}),L]})}}))})}var Qr=new Set(["required","min","max","minLength","maxLength","pattern"]);function Zr({fieldComponent:e,control:o,fieldData:t}){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 r=Object.fromEntries(Object.entries(t).filter(([s])=>Qr.has(s))),n=useController({name:t.id,control:o,rules:r});return jsx(e,p(i({},n),{fieldData:t}))}function _o({fieldTypes:e,handleDismiss:o,handlePrimary:t,handleSecondary:r,parentProps:{dismissible:n},step:s}){var b,S;let{control:a,handleSubmit:l}=useForm({delayError:2e3,mode:"onChange"}),c=[];function m(C,P){t(P,C);}function g(C,P){r(P,C);}return (b=s.fields)==null||b.forEach(C=>{e[C.type]!=null&&c.push(jsx(Zr,{control:a,fieldComponent:e[C.type],fieldData:C},C.id));}),jsxs(x.Column,{gap:5,part:"form-step",children:[jsxs(x.Row,{alignItems:"center",flexWrap:"wrap",gap:1,justifyContent:"space-between",part:"form-step-header",children:[jsx(y.Title,{children:s.title}),n&&jsx(y.Dismiss,{onClick:o}),jsx(y.Subtitle,{flexBasis:"100%",children:s.subtitle})]}),c,jsxs(x.Row,{part:"form-step-footer",justifyContent:"flex-end",gap:3,children:[s.secondaryButtonTitle&&jsx(T.Secondary,{title:s.secondaryButtonTitle,onClick:l(g)}),jsx(T.Primary,{title:(S=s.primaryButtonTitle)!=null?S:"Submit",onClick:l(m)})]},"form-footer")]})}function No({error:e}){var o;return (o=e==null?void 0:e.message)!=null&&o.length?jsx(h.Caption,{color:"red500",display:"block",part:"field-error",textAlign:"end",children:e==null?void 0:e.message}):null}function jo({children:e,id:o,required:t=!1}){return jsxs(h.H4,{as:"label",htmlFor:o,part:"field-label",children:[e,t&&" *"]})}var ue={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 m;let{id:n,label:s,placeholder:a}=t,{error:l}=r,c=p(i(i(i({id:n},o),a?{placeholder:a}:{}),ue),{"aria-invalid":!!l,value:(m=o.value)!=null?m:""});return jsxs(u,{part:"field",children:[jsx(jo,{id:n,required:!!t.required,children:s}),e(c),jsx(No,{error:l})]})}var rn=()=>jsx(u,{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"})}),nn=Me.forwardRef(({label:e,value:o},t)=>jsxs(u,{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(h.Body2,{part:"field-radio-label",children:e}),jsx(se.Item,{id:o,value:o,ref:t,asChild:!0,children:jsx(u,{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(u,{as:se.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(rn,{})})})})]}));function Go(e){let{field:{onChange:o,value:t},fieldData:{options:r=[]}}=e,n=r.map(({label:s,value:a})=>jsx(nn,{value:a,label:s},a));return jsx(q,p(i({},e),{children:()=>jsx(se.Root,{value:t,onValueChange:o,asChild:!0,children:jsx(x.Column,{gap:2,part:"field-radio-group",children:n})})}))}var ln=Me.forwardRef(({label:e,value:o},t)=>jsx(B.Item,{value:o,ref:t,asChild:!0,children:jsx(u,{"backgroundColor:hover":"blue900",borderRadius:"md",outline:"none",part:"field-select-option",px:"3",py:"2",children:jsx(B.ItemText,{asChild:!0,children:jsx(h.Body2,{part:"field-select-option-label",children:e})})})}));function qo(e){let{field:{onChange:o,value:t},fieldData:{options:r=[],placeholder:n}}=e,s=r.map(({label:a,value:l})=>jsx(ln,{value:l,label:a},l));return jsx(q,p(i({},e),{children:()=>jsxs(B.Root,{value:t,onValueChange:o,children:[jsx(B.Trigger,{asChild:!0,children:jsxs(h.Body2,p(i({},ue),{alignItems:"center",display:"flex",justifyContent:"space-between",part:"field-select",children:[jsx(B.Value,{placeholder:n!=null?n:"Select one"}),jsx(B.Icon,{children:jsx(u,{as:ChevronDownIcon,color:"gray100",display:"block",height:"24px",part:"field-select-icon",width:"24px"})})]}))}),jsx(B.Portal,{children:jsx(B.Content,{position:"popper",sideOffset:4,asChild:!0,children:jsx(u,p(i({},ue),{p:"1",part:"field-select-options",width:"var(--radix-popper-anchor-width)",children:jsx(B.Viewport,{children:s})}))})})]})}))}function Qo(e){return jsx(q,p(i({},e),{children:o=>jsx(h.Body2,i({as:"input",part:"field-text",type:"text"},o))}))}function et(e){return jsx(q,p(i({},e),{children:o=>jsx(h.Body2,i({as:"textarea",part:"field-textarea"},o))}))}var pn={radio:Go,select:qo,text:Qo,textarea:et};function Ke(r){var n=r,{fieldTypes:e={},flowId:o}=n,t=d(n,["fieldTypes","flowId"]);let s=Object.assign({},pn,e);return jsx($,p(i({flowId:o,part:"form"},t),{children:a=>jsx(_o,i({fieldTypes:s},a))}))}var Ue={};N(Ue,{NPS:()=>nt});function rt({field:e}){let o=[...Array(11)].map((t,r)=>{let n=e.value===r?T.Primary:T.Secondary;return jsx(n,{borderWidth:"1px",onClick:()=>e.onChange(r),title:`${r}`},r)});return jsx(x.Row,{gap:2,justifyContent:"space-between",part:"field-nps",children:o})}function nt(n){var s=n,{as:e=w,flowId:o,fieldTypes:t}=s,r=d(s,["as","flowId","fieldTypes"]);return jsx(Ke,i({alignSelf:"end",as:e,flowId:o,fieldTypes:i({nps:rt},t),minWidth:"620px",modal:!1,width:"620px"},r))}function Se(){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 l=r.getBoundingClientRect();t(l);};return a(),window.addEventListener("resize",a),()=>window.removeEventListener("resize",a)},[r]),{node:r,rect:o,ref:s}}var fn=keyframes({"0%":{opacity:.5,transform:"scale(0.5)"},"50%":{opacity:0,transform:"scale(1)"},"100%":{opacity:0,transform:"scale(1)"}});function at(r){var n=r,{style:e={},part:o=""}=n,t=d(n,["style","part"]);return jsxs(u,p(i({part:`dot-wrapper ${o}`,style:i({height:"48px",position:"absolute",width:"48px"},e)},t),{children:[jsx(u,{backgroundColor:"primary.surface",part:"dot-pulse",css:{animation:`2s ease-out infinite ${fn}`,borderRadius:"24px",height:"48px",left:0,position:"absolute",top:0,transformOrigin:"center center",width:"48px"}}),jsx(u,{backgroundColor:"primary.surface",part:"dot",style:{borderRadius:"12px",height:"24px",left:"12px",position:"absolute",top:"12px",width:"24px"}})]}))}function lt({props:e,alignAttr:o,sideAttr:t}){let r=t!=null?t:"bottom",n={},s=()=>{var m;if(["after","before"].includes(e.align)){if(o=="start")return "before";if(o=="end")return "after"}return (m=e.align)!=null?m:"after"},a="-24px",l={top:"bottom",right:"left",bottom:"top",left:"right"};n[l[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 Fe={content:["align","alignOffset","arrowPadding","avoidCollisions","collisionBoundary","collisionPadding","forceMount","hideWhenDetached","onCloseAutoFocus","onEscapeKeyDown","onFocusOutside","onInteractOutside","onOpenAutoFocus","onPointerDownOutside","side","sideOffset","sticky"],root:["defaultOpen","modal","onOpenChange","open"]};function pt(e,o){var s,a,l,c,m;let t=Object.fromEntries(Fe.content.map(g=>[g,e[g]]).filter(g=>g[1]!==void 0)),r=Object.fromEntries(Fe.root.map(g=>[g,e[g]]).filter(g=>g[1]!==void 0)),n={};for(let g of Object.keys(e))!Fe.content.includes(g)&&!Fe.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"},b=(V,U)=>["top","bottom"].includes(U)?V=="after"?"marginLeft":"marginRight":V=="after"?"marginTop":"marginBottom",S=(l=t.alignOffset)!=null?l:0,C=(c=t.style)!=null?c:{},P=(m=t.side)!=null?m:"bottom",E=t.align;t.style=p(i({},C),{[b(E,P)]:S});let L=["top","bottom"].includes(P)?o.width:o.height;t.alignOffset=(L+S)*-1,t.align=g[E];}return {contentProps:t,otherProps:n,rootProps:r}}function v(a){var l=a,{anchor:e,children:o,className:t,spotlight:r=!1,style:n}=l,s=d(l,["anchor","children","className","spotlight","style"]);let{node:c,rect:m,ref:g}=Se(),{node:b,rect:S,ref:C}=Se(),{contentProps:P,otherProps:E,rootProps:L}=pt(s,m),[V,U]=useState(P.align),[Y,ae]=useState(P.side),[we,Re]=useState(0),[Be,mt]=useState(0);if(c!==null){let G=c.getAttribute("data-align"),fe=c.getAttribute("data-side");V!==G&&U(G),Y!==fe&&ae(fe);}let Je=useRef(null);if(useEffect(()=>{let G=document.querySelector(e);G!=null?(C(G),Je.current=G):console.debug(`No anchor found for query: ${e}`);},[e]),useEffect(()=>{let{scrollX:G,scrollY:fe}=window;Re(S.left+G),mt(S.top+fe);},[S.left,S.top]),b==null)return null;let qe="0";typeof window!="undefined"&&(qe=window.getComputedStyle(b).borderRadius);let ut=lt({props:s,alignAttr:V,sideAttr:Y});return jsxs(_.Root,p(i({defaultOpen:!0},L),{children:[jsx(_.Anchor,{virtualRef:Je}),jsx(_.Portal,{children:jsxs(Fragment,{children:[r&&jsx(u,{boxShadow:"0 0 0 20000px rgb(0 0 0 / 0.5)",part:"tooltip-spotlight",pointerEvents:"none",position:"absolute",style:{borderRadius:qe,height:S.height,left:we,top:Be,width:S.width}}),jsx(_.Content,p(i({asChild:!0},P),{ref:g,children:jsxs(y,p(i({boxShadow:"md",part:"tooltip",position:"relative",className:t,css:{maxWidth:"360px",pointerEvents:"auto"},style:n},E),{children:[jsx(at,{style:ut}),o]}))}))]})})]}))}v.Close=e=>jsx(_.Close,{"aria-label":"Close",asChild:!0,children:jsx(T.Plain,p(i({css:{top:"12px",right:"4px"},part:"close",position:"absolute"},e),{children:jsx(XMarkIcon,{height:"24",fill:"currentColor"})}))});v.Media=t=>{var r=t,{src:e}=r,o=d(r,["src"]);return e==null?null:jsx(oe,i({borderRadius:"md md 0 0",borderWidth:"0",css:{aspectRatio:"2",objectFit:"cover"},margin:"-5 -5 0",src:e},o))};v.Primary=r=>{var n=r,{onClick:e,title:o}=n,t=d(n,["onClick","title"]);return o==null?null:jsx(T.Primary,i({title:o,onClick:e},t))};v.Progress=t=>{var r=t,{children:e}=r,o=d(r,["children"]);return e==null?null:jsx(h.H4,p(i({part:"progress"},o),{children:e}))};v.Secondary=r=>{var n=r,{onClick:e,title:o}=n,t=d(n,["onClick","title"]);return o==null?null:jsx(T.Secondary,i({title:o,onClick:e},t))};v.Subtitle=t=>{var r=t,{children:e}=r,o=d(r,["children"]);return e==null?null:jsx(h.Body2,p(i({part:"subtitle"},o),{children:e}))};v.Title=t=>{var r=t,{children:e}=r,o=d(r,["children"]);return e==null?null:jsx(h.H4,p(i({part:"title"},o),{children:e}))};function ct(l){var c=l,{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;let{handleDismiss:m}=Q(o,{onDismiss:t}),{handlePrimary:g,handleSecondary:b}=Z(s,{onPrimary:r,onSecondary:n});return jsxs(v,p(i({anchor:s.selector,onOpenAutoFocus:C=>C.preventDefault(),onPointerDownOutside:C=>C.preventDefault(),onInteractOutside:C=>C.preventDefault()},a),{children:[e&&jsx(v.Close,{onClick:m}),jsx(v.Media,{src:(S=s.videoUri)!=null?S:s.imageUri,type:s.videoUri?"video":"image"}),jsxs(x.Column,{gap:1,part:"tooltip-header",children:[jsx(v.Title,{children:s.title}),jsx(v.Subtitle,{color:"gray500",children:s.subtitle})]}),jsxs(x.Row,{alignItems:"center",gap:3,justifyContent:"flex-end",part:"tooltip-footer",children:[jsx(v.Progress,{marginRight:"auto",transform:"translateY(1px)",children:`${o.getNumberOfCompletedSteps()+1}/${o.getNumberOfAvailableSteps()}`}),jsx(v.Secondary,{title:s.secondaryButtonTitle,onClick:b}),jsx(v.Primary,{title:s.primaryButtonTitle,onClick:g})]})]}),s.id)}function Pn(n){var s=n,{flowId:e,onComplete:o,variables:t}=s,r=d(s,["flowId","onComplete","variables"]);let{flow:a}=de(e,{variables:t});Q(a,{onComplete:o});let{isCurrentModal:l,removeModal:c}=ce(a);if(useEffect(()=>{!(a!=null&&a.isVisible)&&l&&c();},[a==null?void 0:a.isVisible,l]),a==null||a.isVisible===!1||!l)return null;let m=a.getCurrentStep();return m==null||m.start(),jsx(ct,i({step:m,flow:a},r))}function Fn(){let{frigade:e}=useContext(D);return {frigade:e,isLoading:!(e!=null&&e.isReady())}}function wn(){let{userId:e,frigade:o}=useContext(D);function t(n){return k(this,null,function*(){yield o.identify(e,n);})}function r(n,s){return k(this,null,function*(){yield o.track(n,s);})}return {userId:e,addProperties:t,track:r}}function Bn(){let{groupId:e,frigade:o}=useContext(D);function t(n){return k(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 k(this,null,function*(){yield o.track(n,s);})}return {groupId:e,addProperties:t,track:r}}
39
39
 
40
- export { Fr as Announcement, wr as Banner, l as Box, h as Button, f as Card, vo as Checklist, P as Dialog, u as Flex, We as Form, Me as Progress, po as Provider, Go as Survey, x as Text, T as Tooltip, ln as Tour, Ce as themeVariables, ue as useBoundingClientRect, te as useFlow, j as useFlowHandlers, cn as useFrigade, gn as useGroup, re as useModal, z as useStepHandlers, un as useUser };
40
+ export { Hr as Announcement, Ar as Banner, u as Box, T as Button, y as Card, je as Checklist, w as Dialog, x as Flex, Ke as Form, Ce as Progress, Fo as Provider, Ue as Survey, h as Text, v as Tooltip, Pn as Tour, De as themeVariables, Se as useBoundingClientRect, de as useFlow, Q as useFlowHandlers, Fn as useFrigade, Bn as useGroup, ce as useModal, Z as useStepHandlers, wn as useUser };
41
41
  //# sourceMappingURL=out.js.map
42
42
  //# sourceMappingURL=index.js.map