@frigade/react
Version:
Build better product onboarding, faster.
89 lines (84 loc) • 95.3 kB
JavaScript
'use strict';
var react$1 = require('@emotion/react');
var Y = require('@radix-ui/react-dialog');
var jsxRuntime = require('@emotion/react/jsx-runtime');
var jo = require('react');
var clsx = require('clsx');
var Ln = require('known-css-properties');
var Xn = require('dompurify');
var js = require('@frigade/js');
var Ni = require('embla-carousel-react');
var Ae = require('@radix-ui/react-collapsible');
var react = require('@floating-ui/react');
var reactRemoveScroll = require('react-remove-scroll');
var reactHookForm = require('react-hook-form');
var Ue = require('@radix-ui/react-radio-group');
var z = require('@radix-ui/react-select');
var Ro = require('@radix-ui/react-checkbox');
var reactDom = require('react-dom');
var ln = require('use-sync-external-store/shim/index.js');
var me = require('@radix-ui/react-popover');
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
function _interopNamespace(e) {
if (e && e.__esModule) return e;
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n.default = e;
return Object.freeze(n);
}
var Y__namespace = /*#__PURE__*/_interopNamespace(Y);
var jo__namespace = /*#__PURE__*/_interopNamespace(jo);
var Ln__default = /*#__PURE__*/_interopDefault(Ln);
var Xn__default = /*#__PURE__*/_interopDefault(Xn);
var js__namespace = /*#__PURE__*/_interopNamespace(js);
var Ni__default = /*#__PURE__*/_interopDefault(Ni);
var Ae__namespace = /*#__PURE__*/_interopNamespace(Ae);
var react__namespace = /*#__PURE__*/_interopNamespace(react);
var Ue__namespace = /*#__PURE__*/_interopNamespace(Ue);
var z__namespace = /*#__PURE__*/_interopNamespace(z);
var Ro__namespace = /*#__PURE__*/_interopNamespace(Ro);
var ln__namespace = /*#__PURE__*/_interopNamespace(ln);
var me__namespace = /*#__PURE__*/_interopNamespace(me);
var Dt=Object.defineProperty,In=Object.defineProperties;var Dn=Object.getOwnPropertyDescriptors;var ao=Object.getOwnPropertySymbols;var Ht=Object.prototype.hasOwnProperty,At=Object.prototype.propertyIsEnumerable;var It=(e,o,t)=>o in e?Dt(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,i=(e,o)=>{for(var t in o||(o={}))Ht.call(o,t)&&It(e,t,o[t]);if(ao)for(var t of ao(o))At.call(o,t)&&It(e,t,o[t]);return e},p=(e,o)=>In(e,Dn(o));var Hn=(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 y=(e,o)=>{var t={};for(var r in e)Ht.call(e,r)&&o.indexOf(r)<0&&(t[r]=e[r]);if(e!=null&&ao)for(var r of ao(e))o.indexOf(r)<0&&At.call(e,r)&&(t[r]=e[r]);return t};var ue=(e,o)=>{for(var t in o)Dt(e,t,{get:o[t],enumerable:!0});};var A=(e,o,t)=>new Promise((r,n)=>{var a=d=>{try{l(t.next(d));}catch(m){n(m);}},s=d=>{try{l(t.throw(d));}catch(m){n(m);}},l=d=>d.done?r(d.value):Promise.resolve(d.value).then(a,s);l((t=t.apply(e,o)).next());});function Ie(e){return jsxRuntime.jsx("svg",p(i({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"size-5"},e),{children:jsxRuntime.jsx("path",{d:"M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z"})}))}var Vt={borderWidths:{md:"1px"}};var so=[5,10,20,35,50,65,80,95,98],Mt=[...so],No=[...so];Mt[4]=40;No[4]=60;var An={blue:{h:213,s:100,l:so},gray:{h:220,s:10,l:so},green:{h:141,s:90,l:Mt},red:{h:9,s:90,l:No},yellow:{h:50,s:90,l:No}};var W={};for(let[e,{h:o,s:t,l:r}]of Object.entries(An))W[e]=Object.fromEntries(r.map((n,a)=>[`${(a+1)*100}`,`hsl(${o} ${t}% ${n}%)`]));var Lt=p(i({black:"hsl(0 0% 0%)",white:"hsl(0 0% 100%)"},W),{gray100:W.gray[100],gray200:W.gray[200],gray300:W.gray[300],gray400:W.gray[400],gray500:W.gray[500],gray600:W.gray[600],gray700:W.gray[700],gray800:W.gray[800],gray900:W.gray[900],blue400:W.blue[400],blue500:W.blue[500],blue800:W.blue[800],blue900:W.blue[900],green400:W.green[400],green500:W.green[500],green800:W.green[800],red500:W.red[500],transparent:"#FFFFFF00",inherit:"inherit"});var Wt={md:"8px",lg:"20px",round:"50%"};var u=e=>`var(--fr-colors-${e})`,Nt={negative:{100:u("red-100"),200:u("red-200"),300:u("red-300"),400:u("red-400"),500:u("red-500"),600:u("red-600"),700:u("red-700"),800:u("red-800"),900:u("red-900"),background:u("negative-500"),border:u("negative-500"),foreground:u("white"),surface:u("negative-500"),active:{background:u("negative-400"),border:u("negative-400"),foreground:u("white"),surface:u("negative-400")},focus:{background:u("negative-500"),border:u("negative-500"),foreground:u("white"),surface:u("negative-500")},hover:{background:u("negative-400"),border:u("negative-400"),foreground:u("white"),surface:u("negative-400")}},neutral:{100:u("gray-100"),200:u("gray-200"),300:u("gray-300"),400:u("gray-400"),500:u("gray-500"),600:u("gray-600"),700:u("gray-700"),800:u("gray-800"),900:u("gray-900"),background:u("white"),border:u("neutral-800"),foreground:u("black"),surface:u("neutral-700"),active:{background:u("white"),border:u("neutral-900"),foreground:u("black"),surface:u("neutral-700")},focus:{background:u("white"),border:u("neutral-900"),foreground:u("black"),surface:u("neutral-700")},hover:{background:u("neutral-900"),border:u("neutral-800"),foreground:u("black"),surface:u("neutral-700")}},positive:{100:u("green-100"),200:u("green-200"),300:u("green-300"),400:u("green-400"),500:u("green-500"),600:u("green-600"),700:u("green-700"),800:u("green-800"),900:u("green-900"),background:u("positive-500"),border:u("positive-500"),foreground:u("white"),surface:u("positive-500"),active:{background:u("positive-400"),border:u("positive-400"),foreground:u("white"),surface:u("positive-400")},focus:{background:u("positive-500"),border:u("positive-500"),foreground:u("white"),surface:u("positive-500")},hover:{background:u("positive-400"),border:u("positive-400"),foreground:u("white"),surface:u("positive-400")}},primary:{100:u("blue-100"),200:u("blue-200"),300:u("blue-300"),400:u("blue-400"),500:u("blue-500"),600:u("blue-600"),700:u("blue-700"),800:u("blue-800"),900:u("blue-900"),background:u("primary-500"),border:u("primary-500"),foreground:u("white"),surface:u("primary-500"),active:{background:u("primary-300"),border:u("primary-300"),foreground:u("white"),surface:u("primary-300")},focus:{background:u("primary-500"),border:u("primary-500"),foreground:u("white"),surface:u("primary-500")},hover:{background:u("primary-400"),border:u("primary-400"),foreground:u("white"),surface:u("primary-400")}},secondary:{100:u("gray-100"),200:u("gray-200"),300:u("gray-300"),400:u("gray-400"),500:u("gray-500"),600:u("gray-600"),700:u("gray-700"),800:u("gray-800"),900:u("gray-900"),background:u("white"),border:u("secondary-800"),foreground:u("black"),surface:u("secondary-900"),active:{background:u("secondary-900"),border:u("secondary-800"),foreground:u("black"),surface:u("secondary-800")},focus:{background:u("secondary-900"),border:u("secondary-800"),foreground:u("black"),surface:u("secondary-900")},hover:{background:u("secondary-900"),border:u("secondary-800"),foreground:u("black"),surface:u("secondary-800")}}};var Ut={md:"0px 4px 20px rgba(0, 0, 0, 0.1)"};var $n="px",Vn=e=>typeof e=="number"?`${4*e}${$n}`:e,Mn=[-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"],_t=Object.fromEntries(Mn.map(e=>[e,Vn(e)]));var zt={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 lo=p(i(p(i({},Vt),{colors:i(i({},Lt),Nt)}),zt),{radii:Wt,shadows:Ut,space:_t});function Ke(e,o="",t="."){return Object.keys(e).reduce((r,n)=>{let s=`${o.length?`${o}${t}`:""}${n}`,l=e[n];return typeof l=="object"&&l!==null&&!Array.isArray(l)?Object.assign(r,Ke(l,s,t)):r[s]=l,r},{})}function Uo(e){let o=Ke(e,"--fr","-");for(let[t,r]of Object.entries(o))if(t.indexOf(".")>-1){let n=t.replace(/\./g,"-");o[n]=r,delete o[t];}return o}function Gt(e,o="--fr"){let t={};return Object.keys(e).forEach(r=>{let n=e[r],a=r.replace(/\./g,"-");typeof n=="object"&&n!==null&&!Array.isArray(n)?t[r]=Gt(n,`${o}-${r}`):t[r]=`var(${o}-${a})`;}),t}var _o=Uo(lo),E=Gt(lo);var Wn=new Set(["alt","size","src"]),Nn=Ln__default.default.all.filter(e=>e.indexOf("-")!=0&&!Wn.has(e)).map(e=>[e.replace(/-([a-z])/g,(o,t)=>t.toUpperCase()),null]),Un=Object.fromEntries(Nn),po=Ke(E.colors),_n={color:po,backgroundColor:po,borderColor:po,border:i(i({},E.borderWidths),po),borderRadius:E.radii,borderWidth:E.borderWidths,boxShadow:E.shadows,fontFamily:E.fontFamilies,fontSize:E.fontSizes,fontWeight:E.fontWeights,gap:E.space,lineHeight:E.lineHeights,margin:E.space,marginBottom:E.space,marginLeft:E.space,marginRight:E.space,marginTop:E.space,padding:E.space,paddingBottom:E.space,paddingLeft:E.space,paddingRight:E.space,paddingTop:E.space},Kt=i(i({},Un),_n),jt={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"]},Xt=new Set(["active","disabled","focus","focusVisible","focusWithin","hover"]);function zn(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 Jt=new Map(Object.entries(Kt).map(([e,o])=>[e,zn(o)])),Gn=new Map(Object.entries(jt).map(([e,o])=>[e,new Set(o)])),Kn=new Set(["height","width"]),jn=new Set(["canvas","embed","iframe","img","input","object","video"]);function qt(e){let[o,t]=e.split(":");return [o,Xt.has(t)?t:null]}function Zt(e,o="div"){let t=Object.assign({},e),r={};function n(a){if(a==null)return r;let l=`&:${a.replace(/[A-Z]/g,d=>`-${d.toLocaleLowerCase()}`)}`;return r[l]==null&&(r[l]={}),r[l]}return Object.entries(t).forEach(([a,s])=>{let[l,d]=qt(a),m=Gn.get(l);m!=null&&(m.forEach(c=>{let f=`${c}${d?":"+d:""}`;t[f]=s;}),delete t[a]);}),Object.entries(t).forEach(([a,s])=>{let[l,d]=qt(a),m=Jt.get(l);if(m!=null){if(s==null)delete t[a];else if(typeof s=="string"&&s.indexOf(" ")>-1){let c=s.split(" ");n(d)[l]=c.map(f=>{var g;return (g=m.get(f.toString()))!=null?g:f}).join(" ");}else m.has(s.toString())?n(d)[l]=m.get(s.toString()):n(d)[l]=s;(typeof o!="string"||!jn.has(o)||!Kn.has(l))&&delete t[a];}}),Object.keys(t).forEach(a=>{let s=a.substring(1);a.indexOf("_")===0&&Jt.has(s)&&(t[s]=t[a],delete t[a]);}),{cssFromProps:r,unmatchedProps:t}}function Jn(){if(typeof window=="undefined"){let{JSDOM:e}=Hn("jsdom");return new e("<!DOCTYPE html>").window}return window}function Yt(e){return e?{__html:Xn__default.default(Jn()).sanitize(e,{ALLOWED_TAGS:["b","strong","i","em","a","span","div","p","pre","s","u","br","img","code","li","ol","ul","table","tbody","thead","tr","td","th","h1","h2","h3","h4","video","p","style"],ALLOWED_ATTR:["style","class","target","id","href","alt","src","controls","autoplay","loop","muted","playsinline"]})}:{__html:""}}function Zn(e){return e&&`fr-${e}`}function or(e){return e&&(Array.isArray(e)?e.filter(o=>o!=null).map(o=>or(o)).join(" "):Zn(e))}function Yn(l,s){var d=l,{as:e,children:o,className:t,css:r={},part:n}=d,a=y(d,["as","children","className","css","part"]);let m=e!=null?e:"div",{cssFromProps:c,unmatchedProps:f}=Zt(a,m),g=or(n),C=t||g?clsx.clsx(t,g):void 0,w=[{boxSizing:"border-box"},c,r];return typeof o=="string"?jsxRuntime.jsx(m,p(i({className:C,css:w},f),{ref:s,dangerouslySetInnerHTML:Yt(o)})):jsxRuntime.jsx(m,p(i({className:C,css:w},f),{ref:s,children:o}))}var x=jo__namespace.forwardRef(Yn);var H={};ue(H,{Link:()=>Ti,Plain:()=>Bi,Primary:()=>Fi,Secondary:()=>Ri});var T={};ue(T,{Body1:()=>gi,Body2:()=>yi,Caption:()=>xi,Display1:()=>pi,Display2:()=>di,H1:()=>ci,H2:()=>ui,H3:()=>mi,H4:()=>fi});var zo={};ue(zo,{Body1:()=>ii,Body2:()=>ai,Caption:()=>si,Display1:()=>Qn,Display2:()=>ei,H1:()=>oi,H2:()=>ti,H3:()=>ri,H4:()=>ni});var fe={color:"neutral.foreground",fontFamily:"default",margin:"0"},Qn=p(i({},fe),{fontSize:"5xl",fontWeight:"bold",lineHeight:"4xl"}),ei=p(i({},fe),{fontSize:"4xl",fontWeight:"bold",lineHeight:"3xl"}),oi=p(i({},fe),{fontSize:"3xl",fontWeight:"demibold",lineHeight:"2xl"}),ti=p(i({},fe),{fontSize:"2xl",fontWeight:"demibold",lineHeight:"xl"}),ri=p(i({},fe),{fontSize:"xl",fontWeight:"demibold",lineHeight:"lg"}),ni=p(i({},fe),{fontSize:"md",fontWeight:"demibold",lineHeight:"md"}),ii=p(i({},fe),{fontSize:"md",fontWeight:"regular",lineHeight:"md"}),ai=p(i({},fe),{fontSize:"sm",fontWeight:"regular",lineHeight:"sm"}),si=p(i({},fe),{fontSize:"xs",fontWeight:"regular",lineHeight:"xs"});var li=["Display1","Display2","H1","H2","H3","H4","Body1","Body2","Caption"],ge=Object.fromEntries(li.map(e=>{let o=["H1","H2","H3","H4"].includes(e)?e.toLowerCase():"span",t=jo__namespace.forwardRef((l,s)=>{var d=l,{as:r=o,children:n}=d,a=y(d,["as","children"]);return jsxRuntime.jsx(x,p(i(i({as:r},zo[e]),a),{ref:s,children:n}))});return t.displayName=`Text.${e}`,[e,t]})),pi=ge.Display1,di=ge.Display2,ci=ge.H1,ui=ge.H2,mi=ge.H3,fi=ge.H4,gi=ge.Body1,yi=ge.Body2,xi=ge.Caption;var Ko={};ue(Ko,{Link:()=>Si,Plain:()=>vi,Primary:()=>Pi,Secondary:()=>Ci,loadingCSSStyle:()=>Go});var co={alignItems:"center",borderWidth:"md",borderRadius:"md",borderStyle:"solid",cursor:"pointer","cursor:disabled":"not-allowed",display:"flex",gap:"2",padding:"2 4",fontFamily:"inherit",textDecoration:"none","opacity:disabled":"0.6","pointerEvents:disabled":"none"},Pi=p(i({},co),{backgroundColor:"primary.surface",borderColor:"primary.border",color:"primary.foreground","backgroundColor:hover":"primary.hover.surface","backgroundColor:active":"primary.active.surface","backgroundColor:disabled":"primary.surface"}),Ci=p(i({},co),{backgroundColor:"secondary.background",borderColor:"secondary.border",color:"secondary.foreground","backgroundColor:hover":"secondary.hover.background","backgroundColor:active":"secondary.active.surface","backgroundColor:disabled":"secondary.background"}),Si=p(i({},co),{backgroundColor:"transparent",borderColor:"transparent",color:"primary.surface","color:hover":"primary.hover.surface","color:active":"primary.active.surface"}),vi=p(i({},co),{backgroundColor:"transparent",borderColor:"transparent",color:"neutral.foreground"}),wi=react$1.keyframes({from:{transform:"rotate(0turn)"},to:{transform:"rotate(1turn)"}}),Go={position:"relative",color:"transparent","&:after":{content:'""',position:"absolute",width:"16px",height:"16px",top:0,left:0,right:0,bottom:0,margin:"auto",border:"4px solid transparent",borderTopColor:"var(--fr-colors-primary-foreground)",borderRadius:"50%",animation:wi+" 1s ease infinite"}};function uo(s){var l=s,{as:e,children:o,part:t,title:r,variant:n="Primary"}=l,a=y(l,["as","children","part","title","variant"]);var m;let d=n.toLocaleLowerCase();return jsxRuntime.jsxs(x,p(i(p(i({as:e!=null?e:"button",part:[`button-${d}`,t]},Ko[n]),{css:i(i({},(m=a.css)!=null?m:{}),a.loading?Go:{})}),a),{loading:void 0,children:[o,r&&jsxRuntime.jsx(T.Body2,{color:"inherit",css:{WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"},flexGrow:"1",fontWeight:"medium",lineHeight:"20px",part:"button-title",textWrap:"nowrap",children:r})]}))}function Fi(t){var r=t,{children:e}=r,o=y(r,["children"]);return jsxRuntime.jsx(uo,p(i({},o),{variant:"Primary",children:e}))}function Ri(t){var r=t,{children:e}=r,o=y(r,["children"]);return jsxRuntime.jsx(uo,p(i({},o),{variant:"Secondary",children:e}))}function Ti(t){var r=t,{children:e}=r,o=y(r,["children"]);return jsxRuntime.jsx(uo,p(i({},o),{variant:"Link",children:e}))}function Bi(t){var r=t,{children:e}=r,o=y(r,["children"]);return jsxRuntime.jsx(uo,p(i({},o),{variant:"Plain",children:e}))}var B={};ue(B,{Column:()=>Ei,Row:()=>Oi});var Oi=jo__namespace.forwardRef((e,o)=>jsxRuntime.jsx(x,p(i({display:"flex",flexDirection:"row"},e),{ref:o}))),Ei=jo__namespace.forwardRef((e,o)=>jsxRuntime.jsx(x,p(i({display:"flex",flexDirection:"column"},e),{ref:o})));function Xo(t){var r=t,{flowId:e}=r,o=y(r,["flowId"]);return jsxRuntime.jsx(N,p(i({as:null,flowId:e},o),{children:({handleDismiss:n,primaryButtonProps:a,secondaryButtonProps:s,parentProps:{containerProps:l,dismissible:d},step:m})=>{var C,w,b,h;let c=(w=(C=m.primaryButton)==null?void 0:C.title)!=null?w:m.primaryButtonTitle,f=(h=(b=m.secondaryButton)==null?void 0:b.title)!=null?h:m.secondaryButtonTitle,g=m.$state.blocked;return jsxRuntime.jsxs(S,p(i({alignItems:"center","aria-label":"Banner",borderWidth:"md","data-step-id":m.id,display:"flex",flexDirection:"row",gap:3,justifyContent:"flex-start",part:"banner",role:"complementary"},l),{children:[m.imageUri&&jsxRuntime.jsx(x,{as:"img",part:"image",src:m.imageUri,style:{height:40,width:40,alignSelf:"center"}}),jsxRuntime.jsxs(B.Column,{marginInlineEnd:"auto",part:"banner-title-wrapper",children:[jsxRuntime.jsx(S.Title,{part:"title",children:m.title}),jsxRuntime.jsx(S.Subtitle,{part:"subtitle",children:m.subtitle})]}),jsxRuntime.jsx(S.Secondary,i({disabled:g,title:f},s)),jsxRuntime.jsx(S.Primary,i({disabled:g,title:c},a)),d&&jsxRuntime.jsx(S.Dismiss,{onClick:n})]}))}}))}var vo={};ue(vo,{Carousel:()=>Cr,Collapsible:()=>xo,CollapsibleStep:()=>Je,Floating:()=>Vr});var be={};ue(be,{Bar:()=>he,Dots:()=>sr,Fraction:()=>De,Ring:()=>mo,Segments:()=>fo});function he(r){var n=r,{current:e,total:o}=n,t=y(n,["current","total"]);let a=o>0?Math.min(e/o,1):0,s=a===0?"10px":`${100*a}%`;return jsxRuntime.jsx(x,p(i({"aria-description":"Progress represented as a bar","aria-label":"Progress Bar","aria-valuemin":"0","aria-valuemax":o,"aria-valuenow":e,backgroundColor:"neutral.800",borderRadius:"md",height:"10px",part:"progress-bar",role:"meter"},t),{children:jsxRuntime.jsx(x,{backgroundColor:"primary.surface",part:"progress-bar-fill",borderRadius:"md",height:"100%",style:{width:s},transition:"width 300ms ease-out"})}))}function sr(r){var n=r,{current:e,total:o}=n,t=y(n,["current","total"]);if(o==1)return null;let a=[...Array(o)].map((s,l)=>jsxRuntime.jsx(x,{as:"circle",cx:4+16*l,cy:"4px",fill:e-1===l?E.colors.blue500:E.colors.blue800,part:["progress-dot",e-1===l?"progress-dot-filled":null],r:4},l));return jsxRuntime.jsx(x,p(i({"aria-description":"Progress represented as dots","aria-label":"Progress Dots","aria-valuemin":"0","aria-valuemax":o,"aria-valuenow":e,as:"svg",height:"8px",part:"progress-dots",role:"meter",viewBox:`0 0 ${16*o-8} 8`,width:16*o-8},t),{children:a}))}function De(r){var n=r,{current:e,total:o}=n,t=y(n,["current","total"]);return jsxRuntime.jsx(T.Body2,p(i({"aria-description":"Progress represented as a fraction of a total","aria-label":"Progress Fraction","aria-valuemin":"0","aria-valuemax":o,"aria-valuenow":e,part:"progress-fraction",role:"meter"},t),{children:`${e}/${o}`}))}function mo(d){var m=d,{css:e,current:o,height:t="48px",showLabel:r=!1,strokeWidth:n="8px",total:a,width:s="48px"}=m,l=y(m,["css","current","height","showLabel","strokeWidth","total","width"]);if(a==1)return null;let c=a>0?Math.min(Math.round(o/a*100)/100,1):0;return jsxRuntime.jsxs(x,p(i({"aria-description":"Progress represented as a ring","aria-label":"Progress Ring","aria-valuemin":"0","aria-valuemax":a,"aria-valuenow":o,as:"svg",css:i({"--progress-percent":c,"--radius":`calc((min(${t}, ${s}) - ${n}) / 2)`,"--circumference":"calc(var(--radius) * pi * 2)","--dash-length":"calc(var(--circumference) * var(--progress-percent))","--gap-length":"calc(var(--circumference) - var(--dash-length))"},e),height:t,part:"progress-ring",position:"relative",role:"meter",width:s},l),{children:[jsxRuntime.jsx(x,{as:"circle",cx:"50%",cy:"50%",fill:"transparent",part:"progress-ring-track",r:"var(--radius)",stroke:E.colors.primary[800],strokeWidth:n}),jsxRuntime.jsx(x,{as:"circle",cx:"50%",cy:"50%",fill:"transparent",part:"progress-ring-filled",r:"var(--radius)",stroke:E.colors.primary.surface,strokeWidth:n,style:{strokeDasharray:"var(--dash-length) var(--gap-length)"},transform:"rotate(-90deg)",transformOrigin:"50% 50%",transition:"stroke-dasharray 0.2s ease-out"}),r&&jsxRuntime.jsx(T.Caption,{as:"text",dominantBaseline:"middle",fontWeight:"medium",textAnchor:"middle",_x:"50%",_y:"52%",children:c*100})]}))}function fo(r){var n=r,{current:e,total:o}=n,t=y(n,["current","total"]);let a=[...Array(o)].map((s,l)=>jsxRuntime.jsx(x,{backgroundColor:e-1>=l?"primary.surface":"blue800",borderRadius:"md",flexGrow:1,height:"100%",minWidth:"10px",part:["progress-segment",e-1===l?"progress-segment-filled":null]},l));return jsxRuntime.jsx(B.Row,p(i({"aria-description":"Progress represented as a segmented bar","aria-label":"Progress Segments","aria-valuemin":"0","aria-valuemax":o,"aria-valuenow":e,gap:1,height:"10px",part:"progress-segments",role:"meter"},t),{children:a}))}function dr(e){return jsxRuntime.jsx("svg",p(i({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",fill:"currentColor",className:"size-4"},e),{children:jsxRuntime.jsx("path",{fillRule:"evenodd",d:"M8 1a3.5 3.5 0 0 0-3.5 3.5V7A1.5 1.5 0 0 0 3 8.5v5A1.5 1.5 0 0 0 4.5 15h7a1.5 1.5 0 0 0 1.5-1.5v-5A1.5 1.5 0 0 0 11.5 7V4.5A3.5 3.5 0 0 0 8 1Zm2 6V4.5a2 2 0 1 0-4 0V7h4Z",clipRule:"evenodd"})}))}function Hi(){return jsxRuntime.jsx(x,{as:"svg",color:"primary.foreground",fill:"none",height:"8px",part:"check-icon",viewBox:"0 0 10 8",width:"10px",children:jsxRuntime.jsx("path",{d:"M1 4.34664L3.4618 6.99729L3.4459 6.98017L9 1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function go(r){var n=r,{checked:e=!1,size:o="22px"}=n,t=y(n,["checked","size"]);return jsxRuntime.jsx(x,p(i({backgroundColor:"inherit",borderWidth:"md",borderStyle:"solid",borderColor:"neutral.border",borderRadius:"100%",padding:"0",part:"check-indicator",position:"relative",height:o,width:o},t),{children:e&&jsxRuntime.jsx(x,{alignItems:"center",bg:"green500",borderWidth:"md",borderStyle:"solid",borderColor:"green500",borderRadius:"100%",display:"flex",height:"calc(100% + 2px)",justifyContent:"center",left:"-1px",part:"check-indicator-checked",position:"absolute",top:"-1px",width:"calc(100% + 2px)",children:jsxRuntime.jsx(Hi,{})})}))}function $i(e){return e==null?{}:e.primaryButton!=null?{uri:e.primaryButton.uri,target:e.primaryButton.target}:{uri:e.primaryButtonUri,target:e.primaryButtonUriTarget}}function Vi(e){return e==null?{}:e.secondaryButton!=null?{uri:e.secondaryButton.uri,target:e.secondaryButton.target}:{uri:e.secondaryButtonUri,target:e.secondaryButtonUriTarget}}function ur(e,o){if(e==null)return {};let t={as:"a",href:e};return o!=null&&(t.target=o,o==="_blank"&&(t.rel="noopener noreferrer")),t}function ie(e,{onPrimary:o,onSecondary:t}={}){let{navigate:r,hasCustomNavigate:n}=jo.useContext(V),a=jo.useMemo(()=>e==null?{}:{"flow.back":h=>e.flow.back(h),"flow.complete":h=>e.flow.complete(h),"flow.forward":h=>e.flow.forward(h),"flow.restart":()=>e.flow.restart(),"flow.skip":h=>e.flow.skip(h),"flow.start":h=>e.flow.start(h),"step.complete":(h,P)=>e.complete(h,P),"step.skip":(h,P)=>e.skip(h,P),"step.reset":()=>e.reset(),"step.start":h=>e.start(h)},[e]),{uri:s,target:l}=$i(e),{uri:d,target:m}=Vi(e),c=s!=null&&!n,f=d!=null&&!n,g=jo.useCallback((h,P,F=!0)=>A(this,null,function*(){if((yield o==null?void 0:o(e,h,P))===!1)return h.preventDefault(),!1;if(e.primaryButton!=null){let R=e.primaryButton.action===!1?!1:a[e.primaryButton.action];typeof R=="function"?yield R(P,F):R!==!1&&(yield e.complete(P,F)),e.primaryButton.uri!=null&&!c&&r(e.primaryButton.uri,e.primaryButton.target);}else yield e.complete(P,F),e.primaryButtonUri!=null&&!c&&r(e.primaryButtonUri,e.primaryButtonUriTarget);return !0}),[r,o,c,e,a]),C=jo.useCallback((h,P)=>A(this,null,function*(){if((yield t==null?void 0:t(e,h,P))===!1)return h.preventDefault(),!1;if(e.secondaryButton!=null){let k=e.secondaryButton.action===!1?!1:a[e.secondaryButton.action];typeof k=="function"?k():k!==!1&&e.complete(P),e.secondaryButton.uri!=null&&!f&&r(e.secondaryButton.uri,e.secondaryButton.target);}else e.complete(P),e.secondaryButtonUri!=null&&!f&&r(e.secondaryButtonUri,e.secondaryButtonUriTarget);return !0}),[r,t,f,e,a]),w=jo.useMemo(()=>i({onClick:g},c?ur(s,l):{}),[g,l,s,c]),b=jo.useMemo(()=>i({onClick:C},f?ur(d,m):{}),[C,f,m,d]);return {handlePrimary:g,handleSecondary:C,primaryButtonProps:w,secondaryButtonProps:b}}function mr({onPrimary:e,onSecondary:o,step:t}){var m,c;let{primaryButtonProps:r,secondaryButtonProps:n}=ie(t,{onPrimary:e,onSecondary:o}),{blocked:a,completed:s,skipped:l}=t.$state,d=s||l||!a?jsxRuntime.jsx(go,{checked:s||l,marginLeft:"auto"}):jsxRuntime.jsx(x,{as:dr,height:"22px",marginLeft:"auto",width:"22px"});return jsxRuntime.jsxs(S,{borderWidth:1,containerType:"inline-size",css:{"@container (max-width: 600px)":{flexBasis:"85%"},"@container (min-width: 601px) and (max-width: 900px)":{flexBasis:"45%"},"@container (min-width: 1200px)":{flexBasis:"25%"}},"data-step-id":t.id,flex:"0 0 30%",gap:"2",p:"4",part:"carousel-step",userSelect:"none",disabled:a,opacity:a?.5:1,children:[jsxRuntime.jsxs(B.Row,{marginBottom:"2",part:"carousel-step-header",children:[t.iconUri&&jsxRuntime.jsx(S.Media,{borderRadius:"0",height:"24px",src:t.iconUri,width:"24px"}),d]}),jsxRuntime.jsx(S.Title,{children:t.title}),jsxRuntime.jsx(S.Subtitle,{children:t.subtitle}),jsxRuntime.jsxs(B.Row,{css:{"@container (max-width: 200px)":{"& > button, & > a":{flexBasis:"50%",flexGrow:1},flexDirection:"column-reverse"}},gap:"2",marginTop:"auto",paddingTop:"3",part:"carousel-step-footer",children:[jsxRuntime.jsx(S.Secondary,i({disabled:a,title:(m=t.secondaryButton)==null?void 0:m.title},n)),jsxRuntime.jsx(S.Primary,i({disabled:a,title:(c=t.primaryButton)==null?void 0:c.title},r))]})]})}function gr(e){return jsxRuntime.jsx("svg",p(i({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"size-5"},e),{children:jsxRuntime.jsx("path",{fillRule:"evenodd",d:"M3 10a.75.75 0 0 1 .75-.75h10.638L10.23 5.29a.75.75 0 1 1 1.04-1.08l5.5 5.25a.75.75 0 0 1 0 1.08l-5.5 5.25a.75.75 0 1 1-1.04-1.08l4.158-3.96H3.75A.75.75 0 0 1 3 10Z",clipRule:"evenodd"})}))}function xr(e){return jsxRuntime.jsx("svg",p(i({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"size-5"},e),{children:jsxRuntime.jsx("path",{fillRule:"evenodd",d:"M17 10a.75.75 0 0 1-.75.75H5.612l4.158 3.96a.75.75 0 1 1-1.04 1.08l-5.5-5.25a.75.75 0 0 1 0-1.08l5.5-5.25a.75.75 0 1 1 1.04 1.08L5.612 9.25H16.25A.75.75 0 0 1 17 10Z",clipRule:"evenodd"})}))}var hr=react$1.keyframes`
from {
opacity: 0;
}
to {
opacity: 1;
}
`;function br({flow:e,sort:o,onPrimary:t,onSecondary:r}){var b,h;let[n,a]=jo.useState(),[s]=jo.useState({align:"start",container:".fr-carousel-content",skipSnaps:!0,slides:".fr-carousel-step",startIndex:o=="completed-last"?0:(h=(b=Array.from(e.steps.values()).find(P=>!P.$state.completed&&!P.$state.skipped))==null?void 0:b.order)!=null?h:0}),[l,d]=Ni__default.default(s),[m,c]=jo.useState(),[f,g]=jo.useState();jo.useLayoutEffect(()=>{d&&(m==null&&c(d.canScrollNext()),f==null&&g(d.canScrollPrev()),d.on("select",()=>{c(d.canScrollNext()),g(d.canScrollPrev());}));},[d,m,f]),jo.useEffect(()=>{if(!n){let P=Array.from(e.steps.values()),F=P.filter(R=>R.$state.completed||R.$state.skipped).sort((R,I)=>R.order-I.order),k=P.filter(R=>!R.$state.completed&&!R.$state.skipped).sort((R,I)=>R.order-I.order);a(o==="completed-last"?[...k,...F].map(R=>R.id):P.map(R=>R.id));}},[e.steps,o,n]);let C=e.getNumberOfCompletedSteps(),w=e.getNumberOfAvailableSteps();return n?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(B.Row,{css:{"@container (max-width: 750px)":{flexDirection:"column",gap:E.space[5]}},justifyContent:"space-between",part:"carousel-header",children:[jsxRuntime.jsxs(B.Column,{part:"carousel-header-content",children:[jsxRuntime.jsx(T.H3,{children:e.title}),jsxRuntime.jsx(T.Body2,{color:"neutral.400",children:e.subtitle})]}),jsxRuntime.jsxs(B.Row,{alignItems:"center",gap:2,part:"progress",children:[jsxRuntime.jsxs(T.Body2,{fontWeight:"demibold",part:"progress-text",children:[C,"/",w]}),jsxRuntime.jsx(he,{current:C,total:w,minWidth:"200px"})]})]}),jsxRuntime.jsxs(x,{margin:`0 ${E.space[-4]}`,overflow:"hidden",part:"carousel-wrapper",px:"4",position:"relative",ref:l,children:[jsxRuntime.jsx(B.Row,{gap:4,part:"carousel-content",children:Array.from(e.steps.values()).filter(P=>P.$state.visible).sort((P,F)=>n.indexOf(P.id)-n.indexOf(F.id)).map(P=>jsxRuntime.jsx(mr,{onPrimary:t,onSecondary:r,step:P},P.id))}),f&&jsxRuntime.jsx(B.Column,{animation:`${hr} 300ms ease-out`,background:"linear-gradient(to right, rgba(255, 255, 255, 0.5), transparent 50%)",bottom:"0",left:"0",justifyContent:"center",paddingLeft:"3",part:"carousel-prev-wrapper",position:"absolute",top:"0",children:jsxRuntime.jsx(H.Plain,{border:"1px solid neutral.border",borderRadius:"100%",boxShadow:"md",backgroundColor:"neutral.background",color:"primary.surface",onClick:()=>d.scrollPrev(),padding:"2",children:jsxRuntime.jsx(xr,{height:"24px",width:"24px"})})}),m&&jsxRuntime.jsx(B.Column,{animation:`${hr} 300ms ease-out`,background:"linear-gradient(to left, rgba(255, 255, 255, 0.5), transparent 50%)",bottom:"0",justifyContent:"center",paddingRight:"3",part:"carousel-next-wrapper",position:"absolute",right:"0",top:"0",children:jsxRuntime.jsx(H.Plain,{border:"1px solid neutral.border",borderRadius:"100%",boxShadow:"md",backgroundColor:"neutral.background",color:"primary.surface",onClick:()=>d.scrollNext(),padding:"2",children:jsxRuntime.jsx(gr,{height:"24px",width:"24px"})})})]})]}):null}function Cr(o){var e=y(o,[]);return jsxRuntime.jsx(N,p(i({as:S,borderWidth:1,containerType:"inline-size",p:"4",part:"carousel"},e),{children:t=>jsxRuntime.jsx(br,i(i({},e),t))}))}var Je={};ue(Je,{Content:()=>Yo,Root:()=>Qo,Trigger:()=>et});function vr(e){return jsxRuntime.jsx("svg",p(i({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"size-6"},e),{children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"})}))}var _i=react$1.keyframes`
from {
height: 0;
opacity: 0;
}
to {
height: var(--radix-collapsible-content-height);
opacity: 1;
}
`,zi=react$1.keyframes`
from {
height: var(--radix-collapsible-content-height);
opacity: 1;
}
to {
height: 0;
opacity: 0;
}
`,Gi=()=>jsxRuntime.jsx(x,{as:"svg",color:"primary.foreground",width:"10px",height:"8px",viewBox:"0 0 10 8",fill:"none",children:jsxRuntime.jsx("path",{d:"M1 4.34664L3.4618 6.99729L3.4459 6.98017L9 1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})});function Ki({checked:e=!1}){return jsxRuntime.jsx(x,{backgroundColor:"inherit",borderWidth:"md",borderStyle:"solid",borderColor:"neutral.border",borderRadius:"100%",marginRight:"2",padding:"0",part:"field-radio-value",position:"relative",height:"22px",width:"22px",children:e&&jsxRuntime.jsx(x,{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:jsxRuntime.jsx(Gi,{})})})}function Yo({children:e}){return jsxRuntime.jsx(Ae__namespace.Content,{asChild:!0,children:jsxRuntime.jsxs(B.Column,{css:{'&[data-state="open"]':{animation:`${_i} 300ms ease-out`},'&[data-state="closed"]':{animation:`${zi} 300ms ease-out`},overflow:"hidden"},gap:5,part:"collapsible-content",children:[jsxRuntime.jsx(x,{part:"checklist-spacer"}),e]})})}function Qo(a){var s=a,{children:e,disabled:o=!1,onOpenChange:t=()=>{},open:r=!1}=s,n=y(s,["children","disabled","onOpenChange","open"]);return jsxRuntime.jsx(Ae__namespace.Root,{asChild:!0,disabled:o,open:r,onOpenChange:t,children:jsxRuntime.jsx(S,p(i({borderWidth:"md",css:{'&[data-state="open"] .fr-collapsible-step-icon':{transform:"rotate(180deg)"}},gap:0,part:"collapsible-step"},n),{children:e}))})}function et({isCompleted:e,isBlocked:o,title:t}){return jsxRuntime.jsx(Ae__namespace.Trigger,{asChild:!0,children:jsxRuntime.jsxs(B.Row,{alignItems:"center",justifyContent:"flex-start",margin:-5,padding:5,zIndex:1,opacity:o?.4:1,disabled:o,pointerEvents:o?"none":"auto",cursor:o?"not-allowed":"pointer",part:"collapsible-header",children:[jsxRuntime.jsx(Ki,{checked:e}),jsxRuntime.jsx(T.Body2,{fontWeight:"demibold",userSelect:"none",part:"collapsible-title",children:t}),jsxRuntime.jsx(x,{as:vr,color:"neutral.100",css:{"& path":{vectorEffect:"non-scaling-stroke"}},display:"block",height:"16px",marginLeft:"auto",order:2,part:"collapsible-step-icon",width:"16px"})]})})}var ji=["autoPlay","controls","controlsList","crossOrigin","disablePictureInPicture","disableRemotePlayback","loop","muted","playsInline","poster","preload","src"];function re(e){let o={},t={};for(let[r,n]of Object.entries(e))ji.some(a=>a===r)?o[r]=n:t[r]=n;return {otherProps:t,videoProps:o}}var Rr=jo.createContext({onPrimary:()=>{},onSecondary:()=>{},openStepId:null,setOpenStepId:()=>{},stepTypes:{}});function Tr({primaryButtonProps:e,secondaryButtonProps:o,open:t,onOpenChange:r,step:n}){var b,h,P,F,k,R;let{$state:{blocked:a,completed:s,skipped:l},subtitle:d,title:m}=n,c=(h=(b=n.primaryButton)==null?void 0:b.title)!=null?h:n.primaryButtonTitle,f=(F=(P=n.secondaryButton)==null?void 0:P.title)!=null?F:n.secondaryButtonTitle,g=(k=n.props)!=null?k:{},C=!!a,{videoProps:w}=re(g);return jsxRuntime.jsxs(Qo,p(i({"data-step-id":n.id,open:t,onOpenChange:r},g),{children:[jsxRuntime.jsx(et,{isBlocked:n.$state.blocked,isCompleted:s||l,title:m}),jsxRuntime.jsxs(Yo,{children:[jsxRuntime.jsx(S.Media,i({aspectRatio:2.5,objectFit:"cover",overflowClipMargin:"unset",src:(R=n.videoUri)!=null?R:n.imageUri,transform:"translate3d(0, 0, 1px)",type:n.videoUri?"video":"image"},w)),jsxRuntime.jsx(S.Subtitle,{color:"neutral.400",children:d}),jsxRuntime.jsxs(B.Row,{gap:3,part:"collapsible-footer",children:[jsxRuntime.jsx(S.Secondary,i({title:f},o)),jsxRuntime.jsx(S.Primary,i({disabled:C,title:c},e))]})]})]}))}var Zi={default:Tr};function Yi(r){var n=r,{flow:e,step:o}=n,t=y(n,["flow","step"]);var P;let{onPrimary:a,onSecondary:s,openStepId:l,setOpenStepId:d,stepTypes:m}=jo.useContext(Rr),{handlePrimary:c,handleSecondary:f,primaryButtonProps:g,secondaryButtonProps:C}=ie(o,{onPrimary:a,onSecondary:s}),w=(l!=null?l:e.getCurrentStep().id)===o.id,b=(P=m[o.type])!=null?P:Tr;function h(F){return A(this,null,function*(){d(F?o.id:""),F&&!o.$state.completed&&(yield o.start(),d(null));})}return jsxRuntime.jsx(b,p(i({flow:e,onOpenChange:h,open:w,step:o},t),{handlePrimary:c,handleSecondary:f,primaryButtonProps:g,secondaryButtonProps:C}),o.id)}function xo(s){var l=s,{flowId:e,onPrimary:o,onSecondary:t,part:r,stepTypes:n={}}=l,a=y(l,["flowId","onPrimary","onSecondary","part","stepTypes"]);let[d,m]=jo.useState(null),c=i(i({},Zi),n);return jsxRuntime.jsx(Rr.Provider,{value:{openStepId:d,setOpenStepId:m,onPrimary:o,onSecondary:t,stepTypes:c},children:jsxRuntime.jsx(N,p(i({as:S,borderWidth:"md",flowId:e,part:["checklist",r]},a),{children:w=>{var b=w,{flow:f,handleDismiss:g}=b,C=y(b,["flow","handleDismiss"]);var I;let P=Array.from(f.steps.entries()).filter(([,v])=>v.$state.visible===!0).map(([,v])=>jsxRuntime.jsx(Yi,p(i({flow:f,handleDismiss:g},C),{step:v}),v.id)),F=f.getNumberOfCompletedSteps(),k=f.getNumberOfAvailableSteps(),R=a.dismissible||!!((I=f==null?void 0:f.props)!=null&&I.dismissible);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(B.Column,{gap:2,part:"checklist-header",children:[jsxRuntime.jsx(S.Header,{dismissible:R,handleDismiss:g,subtitle:f.subtitle,title:f.title}),jsxRuntime.jsxs(B.Row,{alignItems:"center",gap:2,part:"checklist-progress",children:[jsxRuntime.jsxs(T.Body2,{fontWeight:"demibold",part:"progress-text",children:[F,"/",k]}),jsxRuntime.jsx(he,{current:F,total:k,flexGrow:1})]})]}),P]})}}))})}var Qe={};ue(Qe,{Content:()=>Me,Root:()=>Ve,Trigger:()=>Le});function na(s,a){var l=s,{children:e,lockScroll:o=!0,part:t,opacity:r=.5}=l,n=y(l,["children","lockScroll","part","opacity"]);let d=react$1.keyframes`
from {
opacity: 0;
}
to {
opacity: ${r}
}
`,[m,c]=jo.useState(!1);return jo.useEffect(()=>{if(!o){let f=()=>{m||(c(!0),window.removeEventListener("scroll",f));};return window.addEventListener("scroll",f),()=>{window.removeEventListener("scroll",f);}}},[o,m]),!o&&m?jsxRuntime.jsx(jsxRuntime.Fragment,{children:e}):jsxRuntime.jsx(reactRemoveScroll.RemoveScroll,{forwardProps:!0,ref:a,enabled:o,children:jsxRuntime.jsx(x,p(i({animation:`${d} 300ms ease-out`,backgroundColor:"black",inset:"0",opacity:"0.5",part:["overlay",t],position:"fixed"},n),{children:e}))})}var $e=jo__namespace.forwardRef(na);function da({maxX:e,maxY:o,radius:t,x1:r,x2:n,y1:a,y2:s}){return t>0?`path("${[`M${r+t},${a}`,`H${n-t}`,`A${t} ${t} 0,0,1 ${n} ${a+t}`,`V${s-t}`,`A${t} ${t} 0,0,1 ${n-t} ${s}`,`H${r+t}`,`A${t} ${t} 0,0,1 ${r} ${s-t}`,`V${o}`,`H${e}`,"V0","H0",`V${o}`,`H${r}`,`V${a+t}`,`A${t} ${t} 0,0,1 ${r+t} ${a}`,"Z"].join(" ")}")`:`path("M${r},${a} H${n} V${s} H${r} V${o} H${e} V0 H0 V${o} H${r} Z")`}function ca(e){if(!window||!("nodeType"in e))return 0;let o=Number(window.getComputedStyle(e).borderRadius.replace(/\D/g,""));return Number.isNaN(o)?0:o}function qe(a){var s=a,{anchor:e,lockScroll:o=!0,part:t,style:r={}}=s,n=y(s,["anchor","lockScroll","part","style"]);let[l,d]=jo.useState({maxX:0,maxY:0,radius:0,x1:0,x2:0,y1:0,y2:0}),{refs:m}=react.useFloating({middleware:[{name:"clipPath",fn({elements:c,rects:f}){return d({maxX:c.floating.clientWidth,maxY:c.floating.clientHeight,radius:ca(c.reference),x1:f.reference.x,x2:f.reference.x+f.reference.width,y1:f.reference.y,y2:f.reference.y+f.reference.height}),{}}}],open:!0,placement:"top-center",transform:!1,whileElementsMounted:react.autoUpdate});return jo.useEffect(()=>{try{let c=document.querySelector(e);c!=null?m.setReference(c):console.debug(`[frigade] Spotlight: No anchor found for selector: ${e}`);}catch(c){}},[e,m]),jsxRuntime.jsx($e,i({lockScroll:o,part:["spotlight",t],ref:m.setFloating,style:i({clipPath:da(l)},r)},n))}function Ze(e,o=!0){let[t,r]=jo.useState(!1);jo.useEffect(()=>{if(!t&&o&&e instanceof Element){let n=typeof o!="boolean"?o:{behavior:"smooth",block:"center"},a;window.addEventListener("scroll",function s(){clearTimeout(a),a=setTimeout(()=>{window.removeEventListener("scroll",s),r(!0);},100);},!0),e.scrollIntoView(n);}else o||r(!0);},[o,e,t]);}function Or(e,o){try{if(e.matches(o)&&Er(e))return e;let t=e.querySelectorAll(o);if(t.length>0&&Er(t[0]))return t[0]}catch(t){return null}}function Er(e){return e instanceof HTMLElement?!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length):!1}function Ir(e){let[o,t]=jo.useState(null);return jo.useEffect(()=>{if(typeof e=="string")try{let r=document.querySelector(e);r!=null?(console.debug(`[frigade] Found anchor: ${e}`),t(r)):console.debug(`[frigade] No anchor found for selector: ${e}`);}catch(r){console.debug(`[frigade] Invalid selector for anchor: ${e}`);}},[e]),jo.useEffect(()=>{if(typeof e!="string")return;let r=new MutationObserver(n=>{for(let a of n)if(a.type==="childList"){for(let s of a.addedNodes){if(s.nodeType!==Node.ELEMENT_NODE)continue;let l=Or(s,e);if(l!=null){console.debug(`[frigade] Found anchor: ${e}`),t(l);break}}for(let s of a.removedNodes){if(s.nodeType!==Node.ELEMENT_NODE)continue;if(Or(s,e)!=null){console.debug(`[frigade] Removed anchor: ${e}`),t(null);break}}}});return r.observe(document.querySelector("body"),{childList:!0,subtree:!0}),()=>r.disconnect()},[e]),{anchorElement:o}}function Ba(e){switch(e){case"after":return "end";case"before":return "start";default:return e}}function ho({align:e,alignOffset:o,anchor:t,nodeId:r,onOpenChange:n=()=>{},open:a,side:s,sideOffset:l}){let d=`${s}-${Ba(e)}`;function m({rects:M}){let U={alignmentAxis:o,mainAxis:l};return ["after","before"].includes(e)&&(["bottom","top"].includes(s)?U.alignmentAxis=o-M.floating.width:U.alignmentAxis=o-M.floating.height),U}let D=react.useFloating({middleware:[react.offset(m,[e,o,s,l]),react.flip(),react.shift()],nodeId:r,onOpenChange:n,open:a,placement:d,whileElementsMounted:react.autoUpdate}),{context:c,floatingStyles:f,placement:g,refs:C}=D,w=y(D,["context","floatingStyles","placement","refs"]),b=react.useClick(c),h=react.useDismiss(c,{outsidePress:!1}),P=react.useFocus(c),F=react.useRole(c),k=react.useTransitionStatus(c),{getFloatingProps:R,getReferenceProps:I}=react.useInteractions([b,h,P,F]),{anchorElement:v}=Ir(t);jo.useEffect(()=>{v!=null&&C.setReference(v);},[t,v,C]);let O=g.split("-");return e==="before"?O[1]=O[1]==="end"?"after":"before":e==="after"&&(O[1]=O[1]==="start"?"before":"after"),i({context:c,getFloatingProps:R,getReferenceProps:I,floatingStyles:f,placement:O.join("-"),refs:C,status:k},w)}var Ye=jo.createContext({floatingNodeId:null,isOpen:!1,setIsOpen:()=>{}});function Ve(C){var w=C,{align:e="center",alignOffset:o=0,anchor:t,autoScroll:r=!1,children:n,defaultOpen:a=!1,modal:s=!1,onOpenChange:l=()=>{},open:d,side:m="bottom",sideOffset:c=0,spotlight:f=!1}=w,g=y(w,["align","alignOffset","anchor","autoScroll","children","defaultOpen","modal","onOpenChange","open","side","sideOffset","spotlight"]);let[b,h]=jo.useState(a),P=d!=null?d:b,F=react.useFloatingNodeId(),k=ho(i({align:e,alignOffset:o,anchor:t,nodeId:F,onOpenChange:I=>{l(I),d==null&&h(I);},open:P,side:m,sideOffset:c},g)),{refs:R}=k;return Ze(R.reference.current,r),jsxRuntime.jsxs(Ye.Provider,{value:{floating:k,floatingNodeId:F,isOpen:P,setIsOpen:h},children:[f&&P&&jsxRuntime.jsx(qe,{anchor:t}),s&&!f&&P&&jsxRuntime.jsx($e,{lockScroll:!0}),n]})}var tt={height:0,width:0,x:0,y:0,bottom:0,top:0,right:0,left:0,toJSON:()=>{}};function bo(){let e="DOMRect"in globalThis?new DOMRect:tt,[o,t]=jo.useState(e),[r,n]=jo.useState(null),a=jo.useCallback(s=>{n(s);},[]);return jo.useLayoutEffect(()=>{if(!r)return;let s=()=>{let l=r.getBoundingClientRect();t(l);};return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)},[r]),{node:r,rect:o,ref:a}}function Po(e){let[o,t]=jo.useState(!1),[r,n]=jo.useState(tt),a=r.height>0&&r.width>0;return jo.useEffect(()=>{if(e==null)return;let s=new IntersectionObserver(l=>{let d=l[0];n(d.boundingClientRect),t(d.isIntersecting);},{root:null});return s.observe(e),()=>{s.disconnect();}},[e]),{isVisible:o&&a}}function Me(a){var s=a,{children:e,css:o,part:t,style:r}=s,n=y(s,["children","css","part","style"]);let{floating:l,floatingNodeId:d}=jo.useContext(Ye),{isVisible:m}=Po(l==null?void 0:l.refs.reference.current);if(l==null)return null;let{floatingStyles:c,getFloatingProps:f,placement:g,refs:C,status:w}=l;return C.reference.current==null||!m||(w==null?void 0:w.isMounted)===!1?null:jsxRuntime.jsx(react.FloatingNode,{id:d,children:jsxRuntime.jsx(x,p(i(i({autoFocus:!0,css:i({'&[data-status="unmounted"]':{display:"none"}},o),"data-placement":g,"data-status":w.status,part:["popover-content",t],ref:C.setFloating,style:i(i({},c),r)},f()),n),{children:jsxRuntime.jsx(x,{part:"popover-transition-container",children:e})}))})}function Le(r){var n=r,{children:e,part:o}=n,t=y(n,["children","part"]);var d;let{floating:{getReferenceProps:a,refs:s},setIsOpen:l}=jo.useContext(Ye);return jsxRuntime.jsx(x,p(i(i({ref:s==null?void 0:s.setReference,onClick:()=>l(m=>!m),part:["popover-trigger",o]},t),(d=a==null?void 0:a())!=null?d:{}),{children:e}))}var Co={'&[data-status="open"]':{opacity:1,zIndex:1},'&[data-status="close"]':{opacity:0,zIndex:0,'& [data-status="close"]':{display:"none"}},'&[data-status="initial"]':{opacity:.8},'&[data-status="open"], &[data-status="close"]':{transition:"transform 0.2s ease-out, opacity 0.2s ease-out"},'&[data-status="initial"] .fr-popover-transition-container':{transform:"scale(0.8)"},'&[data-status="close"] .fr-popover-transition-container':{transform:"scale(0.3)"},'&[data-status="open"] .fr-popover-transition-container':{transform:"scale(1)"},"& .fr-popover-transition-container":{transformOrigin:"left",transition:"transform 0.2s ease-out"}};function $r({onPrimary:e,onSecondary:o,openStepId:t,setOpenStepId:r,step:n}){var F,k,R,I,v,O;let a=jo.useRef(),{handlePrimary:s,handleSecondary:l,primaryButtonProps:d,secondaryButtonProps:m}=ie(n,{onPrimary:e,onSecondary:o}),c=t===n.id;function f(...D){return A(this,null,function*(){(yield s(...D))&&r(null);})}function g(...D){return A(this,null,function*(){(yield l(...D))&&r(null);})}function C(){clearTimeout(a.current),c||(a.current=setTimeout(()=>r(n.id),300));}function w(){clearTimeout(a.current);}let b=(k=(F=n.primaryButton)==null?void 0:F.title)!=null?k:n.primaryButtonTitle,h=(I=(R=n.secondaryButton)==null?void 0:R.title)!=null?I:n.secondaryButtonTitle,{videoProps:P}=re((v=n.props)!=null?v:{});return jsxRuntime.jsxs(Ve,{align:"start",open:c,side:"right",sideOffset:8,children:[jsxRuntime.jsxs(Le,{as:B.Row,alignItems:"center",borderRadius:"md",gap:"2",justifyContent:"space-between",onPointerEnter:C,onPointerLeave:w,padding:"1 2",part:"floating-checklist-step-list-item",style:{backgroundColor:c?"var(--fr-colors-neutral-800)":"transparent"},userSelect:"none",children:[jsxRuntime.jsx(T.Body2,{part:"floating-checklist-step-title",children:n.title}),jsxRuntime.jsx(go,{checked:n.$state.completed||n.$state.skipped,size:"18px"})]}),jsxRuntime.jsx(Me,{css:Co,part:"floating-step",children:jsxRuntime.jsxs(S,{backgroundColor:"neutral.background",border:"md solid neutral.border",borderRadius:"md",gap:"3",minWidth:"400px",p:"2",children:[jsxRuntime.jsx(S.Media,i({src:(O=n.videoUri)!=null?O:n.imageUri,type:n.videoUri?"video":"image",css:{objectFit:"contain",width:"100%"}},P)),jsxRuntime.jsx(S.Header,{dismissible:!1,padding:"0 1",subtitle:n.subtitle}),jsxRuntime.jsxs(B.Row,{gap:3,justifyContent:"flex-end",part:"card-footer",children:[jsxRuntime.jsx(S.Secondary,p(i({disabled:n.$state.blocked,padding:"1 2",title:h},m),{onClick:g})),jsxRuntime.jsx(S.Primary,p(i({disabled:n.$state.blocked,padding:"1 2",title:b},d),{onClick:f}))]})]})})]})}function Vr(s){var l=s,{children:e,flowId:o,onPrimary:t,onSecondary:r,part:n}=l,a=y(l,["children","flowId","onPrimary","onSecondary","part"]);let[d,m]=jo.useState(null),c=jo.useRef();function f(){clearTimeout(c.current);}function g(){clearTimeout(c.current),d!=null&&(c.current=setTimeout(()=>m(null),300));}function C(w){!w&&d!=null&&m(null);}return jsxRuntime.jsx(N,p(i({flowId:o,part:["floating-checklist",n]},a),{children:({flow:w})=>{let b=w.getNumberOfCompletedSteps(),h=w.getNumberOfAvailableSteps(),P=e!=null?e:jsxRuntime.jsxs(B.Row,{alignItems:"center",backgroundColor:"neutral.background",border:"md solid neutral.border",borderRadius:"md",cursor:"pointer",gap:"2",padding:"1 2",part:"floating-checklist-anchor",userSelect:"none",children:[jsxRuntime.jsx(T.Body2,{fontWeight:"medium",part:"floating-checklist-title",children:w.title}),jsxRuntime.jsx(mo,{current:b,height:"24px",strokeWidth:"4px",total:h,width:"24px"})]});return jsxRuntime.jsx(react.FloatingTree,{children:jsxRuntime.jsxs(Ve,{align:"start",onOpenChange:C,sideOffset:4,children:[jsxRuntime.jsx(Le,{display:"inline-block",children:P}),jsxRuntime.jsx(Me,{css:p(i({},Co),{'&[data-status="initial"]':{opacity:.3},"& .fr-popover-transition-container":{transformOrigin:"top left",transition:"transform 0.2s ease-out"},'&[data-placement^="top"] .fr-popover-transition-container':{transformOrigin:"bottom left"}}),children:jsxRuntime.jsxs(S,{backgroundColor:"neutral.background",border:"md solid neutral.border",borderRadius:"md",gap:"0",onPointerEnter:f,onPointerLeave:g,p:"0 1 1",part:"floating-checklist-step-list",children:[jsxRuntime.jsx(he,{borderRadius:"md md 0 0",clipPath:"border-box",css:{"& .fr-progress-bar-fill":{borderRadius:0}},current:b,height:"5px",total:h,flexGrow:1,margin:"0 -1 2"}),Array.from(w.steps.values()).map(F=>jsxRuntime.jsx($r,{onPrimary:t,onSecondary:r,openStepId:d,setOpenStepId:m,step:F},F.id))]})})]})})}}))}var Za=new Set(["required","min","max","minLength","maxLength","pattern"]);function Ya({fieldComponent:e,control:o,fieldData:t,submit:r}){let n=reactHookForm.useFormContext();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 a=Object.fromEntries(Object.entries(t).filter(([l])=>Za.has(l))),s=reactHookForm.useController({name:t.id,control:o,rules:a});return jsxRuntime.jsx(e,p(i({},s),{fieldData:t,formContext:n,submit:r}))}function Lr({fieldTypes:e,handleDismiss:o,handlePrimary:t,handleSecondary:r,parentProps:{dismissible:n},step:a}){var F,k,R,I;let{__readOnly:s}=jo.useContext(V),l=jo.useMemo(()=>{var v,O;return (O=(v=a.fields)==null?void 0:v.filter(D=>e[D.type]!=null&&D.id))!=null?O:[]},[a.fields,e]),d=reactHookForm.useForm({delayError:2e3,mode:"onChange",defaultValues:l.reduce((v,O)=>{var D;return v[O.id]=(D=O.value)!=null?D:"",v},{})});jo.useEffect(()=>{d.formState.isDirty||d.reset(l.reduce((v,O)=>{var D;return v[O.id]=(D=O.value)!=null?D:"",v},{}));},[l,d]),jo.useEffect(()=>{Object.keys(d.formState.dirtyFields).some(v=>l.some(O=>O.id===v))&&d.trigger();},[l,d,a.id]);let[m,c]=jo.useState(!1),f=[],{control:g,handleSubmit:C}=d;function w(v,O){c(!0),t(O,v,s==