@frigade/react 2.0.0-alpha.3 → 2.0.0-alpha.32

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.cjs CHANGED
@@ -1,3 +1,59 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }"use client";
2
- var _=Object.defineProperty,Fr=Object.defineProperties;var Wr=Object.getOwnPropertyDescriptors;var A=Object.getOwnPropertySymbols;var rr=Object.prototype.hasOwnProperty,er=Object.prototype.propertyIsEnumerable;var Z=(r,e,o)=>e in r?_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,l=(r,e)=>{for(var o in e||(e={}))rr.call(e,o)&&Z(r,o,e[o]);if(A)for(var o of A(e))er.call(e,o)&&Z(r,o,e[o]);return r},p=(r,e)=>Fr(r,Wr(e));var c=(r,e)=>{var o={};for(var t in r)rr.call(r,t)&&e.indexOf(t)<0&&(o[t]=r[t]);if(r!=null&&A)for(var t of A(r))e.indexOf(t)<0&&er.call(r,t)&&(o[t]=r[t]);return o};var or=(r,e)=>{for(var o in e)_(r,o,{get:e[o],enumerable:!0})};var R=(r,e,o)=>new Promise((t,n)=>{var a=f=>{try{s(o.next(f))}catch(m){n(m)}},i=f=>{try{s(o.throw(f))}catch(m){n(m)}},s=f=>f.done?t(f.value):Promise.resolve(f.value).then(a,i);s((o=o.apply(r,e)).next())});var _react = require('react'); var sr = _interopRequireWildcard(_react); var z = _interopRequireWildcard(_react);var _clsx = require('clsx');var d={borders:{md:"var(--fr-borders-md)"},borderWidths:{0:"var(--fr-borderWidths-0)",md:"var(--fr-borderWidths-md)"},colors:{black:"var(--fr-colors-black)",gray100:"var(--fr-colors-gray100)",gray200:"var(--fr-colors-gray200)",gray300:"var(--fr-colors-gray300)",gray400:"var(--fr-colors-gray400)",gray500:"var(--fr-colors-gray500)",gray600:"var(--fr-colors-gray600)",gray700:"var(--fr-colors-gray700)",gray800:"var(--fr-colors-gray800)",gray900:"var(--fr-colors-gray900)",white:"var(--fr-colors-white)",blue400:"var(--fr-colors-blue400)",blue500:"var(--fr-colors-blue500)",blue800:"var(--fr-colors-blue800)",blue900:"var(--fr-colors-blue900)",green400:"var(--fr-colors-green400)",green500:"var(--fr-colors-green500)",green800:"var(--fr-colors-green800)",transparent:"var(--fr-colors-transparent)",red500:"var(--fr-colors-red500)",neutral:{background:"var(--fr-colors-neutral-background)",border:"var(--fr-colors-neutral-border)",foreground:"var(--fr-colors-neutral-foreground)",surface:"var(--fr-colors-neutral-surface)",active:{background:"var(--fr-colors-neutral-active-background)",border:"var(--fr-colors-neutral-active-border)",foreground:"var(--fr-colors-neutral-active-foreground)",surface:"var(--fr-colors-neutral-active-surface)"},focus:{background:"var(--fr-colors-neutral-focus-background)",border:"var(--fr-colors-neutral-focus-border)",foreground:"var(--fr-colors-neutral-focus-foreground)",surface:"var(--fr-colors-neutral-focus-surface)"},hover:{background:"var(--fr-colors-neutral-hover-background)",border:"var(--fr-colors-neutral-hover-border)",foreground:"var(--fr-colors-neutral-hover-foreground)",surface:"var(--fr-colors-neutral-hover-surface)"}},primary:{background:"var(--fr-colors-primary-background)",border:"var(--fr-colors-primary-border)",foreground:"var(--fr-colors-primary-foreground)",surface:"var(--fr-colors-primary-surface)",active:{background:"var(--fr-colors-primary-active-background)",border:"var(--fr-colors-primary-active-border)",foreground:"var(--fr-colors-primary-active-foreground)",surface:"var(--fr-colors-primary-active-surface)"},focus:{background:"var(--fr-colors-primary-focus-background)",border:"var(--fr-colors-primary-focus-border)",foreground:"var(--fr-colors-primary-focus-foreground)",surface:"var(--fr-colors-primary-focus-surface)"},hover:{background:"var(--fr-colors-primary-hover-background)",border:"var(--fr-colors-primary-hover-border)",foreground:"var(--fr-colors-primary-hover-foreground)",surface:"var(--fr-colors-primary-hover-surface)"}},secondary:{background:"var(--fr-colors-secondary-background)",border:"var(--fr-colors-secondary-border)",foreground:"var(--fr-colors-secondary-foreground)",surface:"var(--fr-colors-secondary-surface)",active:{background:"var(--fr-colors-secondary-active-background)",border:"var(--fr-colors-secondary-active-border)",foreground:"var(--fr-colors-secondary-active-foreground)",surface:"var(--fr-colors-secondary-active-surface)"},focus:{background:"var(--fr-colors-secondary-focus-background)",border:"var(--fr-colors-secondary-focus-border)",foreground:"var(--fr-colors-secondary-focus-foreground)",surface:"var(--fr-colors-secondary-focus-surface)"},hover:{background:"var(--fr-colors-secondary-hover-background)",border:"var(--fr-colors-secondary-hover-border)",foreground:"var(--fr-colors-secondary-hover-foreground)",surface:"var(--fr-colors-secondary-hover-surface)"}}},fontFamilies:{default:"var(--fr-fontFamilies-default)"},fontSizes:{xs:"var(--fr-fontSizes-xs)",sm:"var(--fr-fontSizes-sm)",md:"var(--fr-fontSizes-md)",lg:"var(--fr-fontSizes-lg)",xl:"var(--fr-fontSizes-xl)","2xl":"var(--fr-fontSizes-2xl)","3xl":"var(--fr-fontSizes-3xl)","4xl":"var(--fr-fontSizes-4xl)","5xl":"var(--fr-fontSizes-5xl)"},fontWeights:{regular:"var(--fr-fontWeights-regular)",demibold:"var(--fr-fontWeights-demibold)",bold:"var(--fr-fontWeights-bold)"},letterSpacings:{md:"var(--fr-letterSpacings-md)"},lineHeights:{xs:"var(--fr-lineHeights-xs)",sm:"var(--fr-lineHeights-sm)",md:"var(--fr-lineHeights-md)",lg:"var(--fr-lineHeights-lg)",xl:"var(--fr-lineHeights-xl)","2xl":"var(--fr-lineHeights-2xl)","3xl":"var(--fr-lineHeights-3xl)","4xl":"var(--fr-lineHeights-4xl)"},radii:{md:"var(--fr-radii-md)",lg:"var(--fr-radii-lg)",round:"var(--fr-radii-round)"},shadows:{md:"var(--fr-shadows-md)"},space:{0:"var(--fr-space-0)",1:"var(--fr-space-1)",2:"var(--fr-space-2)",3:"var(--fr-space-3)",4:"var(--fr-space-4)",5:"var(--fr-space-5)",6:"var(--fr-space-6)",7:"var(--fr-space-7)",8:"var(--fr-space-8)",9:"var(--fr-space-9)",10:"var(--fr-space-10)",11:"var(--fr-space-11)",12:"var(--fr-space-12)",13:"var(--fr-space-13)",14:"var(--fr-space-14)",15:"var(--fr-space-15)",16:"var(--fr-space-16)",17:"var(--fr-space-17)",18:"var(--fr-space-18)",19:"var(--fr-space-19)",20:"var(--fr-space-20)","-20":"var(--fr-space--20)","-19":"var(--fr-space--19)","-18":"var(--fr-space--18)","-17":"var(--fr-space--17)","-16":"var(--fr-space--16)","-15":"var(--fr-space--15)","-14":"var(--fr-space--14)","-13":"var(--fr-space--13)","-12":"var(--fr-space--12)","-11":"var(--fr-space--11)","-10":"var(--fr-space--10)","-9":"var(--fr-space--9)","-8":"var(--fr-space--8)","-7":"var(--fr-space--7)","-6":"var(--fr-space--6)","-5":"var(--fr-space--5)","-4":"var(--fr-space--4)","-3":"var(--fr-space--3)","-2":"var(--fr-space--2)","-1":"var(--fr-space--1)","-0.5":"var(--fr-space--0-5)","0.5":"var(--fr-space-0-5)",auto:"var(--fr-space-auto)"}};function E(r,e="",o="."){return Object.keys(r).reduce((t,n)=>{let i=`${e.length?`${e}${o}`:""}${n}`,s=r[n];return typeof s=="object"&&s!==null&&!Array.isArray(s)?Object.assign(t,E(s,i,o)):t[i]=s,t},{})}var M=E(d.colors),tr={color:M,backgroundColor:M,borderColor:M,border:d.borders,borderRadius:d.radii,borderWidth:d.borderWidths,fontFamily:d.fontFamilies,fontSize:d.fontSizes,fontWeight:d.fontWeights,gap:d.space,lineHeight:d.lineHeights,margin:d.space,marginTop:d.space,marginRight:d.space,marginBottom:d.space,marginLeft:d.space,padding:d.space,paddingTop:d.space,paddingRight:d.space,paddingBottom:d.space,paddingLeft:d.space,alignContent:["center","start","end","flex-start","flex-end","normal","baseline","first baseline","last baseline","space-between","space-around","space-evenly","stretch","safe center","unsafe center","inherit","initial","revert","revert-layer","unset"],alignItems:["normal","stretch","center","start","end","flex-start","flex-end","self-start","self-end","baseline","first baseline","last baseline","safe center","unsafe center","inherit","initial","revert","revert-layer","unset"],alignSelf:["auto","normal","center","start","end","self-start","self-end","flex-start","flex-end","baseline","first baseline","last baseline","stretch","safe center","unsafe center","inherit","initial","revert","revert-layer","unset"],flexDirection:["row","row-reverse","column","column-reverse","inherit","initial","revert","revert-layer","unset"],flexWrap:["nowrap","wrap","wrap-reverse","inherit","initial","revert","revert-layer","unset"],justifyContent:["center","start","end","flex-start","flex-end","left","right","normal","space-between","space-around","space-evenly","stretch","safe center","unsafe center","inherit","initial","revert","revert-layer","unset"],justifyItems:["normal","stretch","center","start","end","flex-start","flex-end","self-start","self-end","left","right","baseline","first baseline","last baseline","safe center","unsafe center","legacy right","legacy left","legacy center","inherit","initial","revert","revert-layer","unset"],boxSizing:["border-box","content-box","inherit","initial","revert","revert-layer","unset"],position:["static","relative","absolute","fixed","sticky","inherit","initial","revert","revert-layer","unset"],display:["block","block flex","block flow","block flow-root","block grid","contents","flex","flow-root","grid","inherit","initial","inline","inline flex","inline flow","inline flow-root","inline grid","inline-block","inline-flex","inline-grid","list-item","none","revert","revert-layer","table","table-row-group","table-header-group","table-footer-group","table-row","table-cell","table-column-group","table-column","table-caption","unset"]},nr={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"]};function Ar(r){if(Array.isArray(r))return new Map(r.map(e=>[e,e]));if(typeof r=="object"&&r!==null)return new Map(Object.entries(r));if(["string","number"].includes(typeof r))return new Map([r,r]);throw new Error("Invalid entry in styleProps")}var Vr=new Map(Object.entries(tr).map(([r,e])=>[r,Ar(e)])),Er=new Map(Object.entries(nr).map(([r,e])=>[r,new Set(e)]));function ar(r){let e=Object.assign({},r),o={};return Object.entries(e).forEach(([t,n])=>{let a=Er.get(t);a!=null&&(a.forEach(i=>{e[i]=n}),delete e[t])}),Object.entries(e).forEach(([t,n])=>{let a=Vr.get(t);if(a!=null)if(typeof n=="string"&&n.indexOf(" ")>-1){let i=n.split(" ");o[t]=i.map(s=>{var f;return(f=a.get(s.toString()))!=null?f:s}).join(" "),delete e[t]}else a.has(n.toString())&&(o[t]=a.get(n.toString()),delete e[t])}),{cssFromProps:o,unmatchedProps:e}}var _jsxruntime = require('@emotion/react/jsx-runtime');function ir(r){return r&&`fr-${r}`}function jr(r){return r&&(Array.isArray(r)?r.map(e=>ir(e)).join(" "):ir(r))}function Dr(s,i){var f=s,{as:r,children:e,className:o,css:t,part:n}=f,a=c(f,["as","children","className","css","part"]);let m=r!=null?r:"div",{cssFromProps:x,unmatchedProps:b}=ar(a),P=jr(n),B=o||P?_clsx.clsx.call(void 0, o,P):void 0;return _jsxruntime.jsx.call(void 0, m,p(l({className:B,css:[l(l({boxSizing:"border-box"},x),t)]},b),{ref:i,children:e}))}var u=sr.forwardRef(Dr);var j={};or(j,{Body1:()=>Xr,Body2:()=>Jr,Caption:()=>Qr,Display1:()=>Ir,Display2:()=>$r,H1:()=>Lr,H2:()=>Kr,H3:()=>Nr,H4:()=>qr,base:()=>y});var y=({fontFamilies:r})=>({fontFamily:r.default,margin:0}),Ir=({fontSizes:r,fontWeights:e,lineHeights:o})=>[y,{fontSize:r["5xl"],fontWeight:e.bold,lineHeight:o["4xl"]}],$r=({fontSizes:r,fontWeights:e,lineHeights:o})=>[y,{fontSize:r["4xl"],fontWeight:e.bold,lineHeight:o["3xl"]}],Lr=({fontSizes:r,fontWeights:e,lineHeights:o})=>[y,{fontSize:r["3xl"],fontWeight:e.bold,lineHeight:o["2xl"]}],Kr=({fontSizes:r,fontWeights:e,lineHeights:o})=>[y,{fontSize:r["2xl"],fontWeight:e.bold,lineHeight:o.xl}],Nr=({fontSizes:r,fontWeights:e,lineHeights:o})=>[y,{fontSize:r.xl,fontWeight:e.bold,lineHeight:o.lg}],qr=({fontSizes:r,fontWeights:e,lineHeights:o})=>[y,{fontSize:r.lg,fontWeight:e.bold,lineHeight:o.md}],Xr=({fontSizes:r,fontWeights:e,lineHeights:o})=>[y,{fontSize:r.md,fontWeight:e.regular,lineHeight:o.md}],Jr=({fontSizes:r,fontWeights:e,lineHeights:o})=>[y,{fontSize:r.sm,fontWeight:e.regular,lineHeight:o.md}],Qr=({fontSizes:r,fontWeights:e,lineHeights:o})=>[y,{fontSize:r.xs,fontWeight:e.regular,lineHeight:o.sm}];function lr(a){var i=a,{as:r="span",children:e,css:o,variant:t="Body1"}=i,n=c(i,["as","children","css","variant"]);return _jsxruntime.jsx.call(void 0, u,p(l({as:r,css:[j[t],o]},n),{children:e}))}var Ur=["Display1","Display2","H1","H2","H3","H4","Body1","Body2","Caption"],Yr=Object.fromEntries(Ur.map(r=>{let e=["H1","H2","H3","H4"].includes(r)?r.toLowerCase():void 0,o=t=>_jsxruntime.jsx.call(void 0, lr,p(l({as:e},t),{variant:r,children:t.children}));return o.displayName=`Text.${r}`,[r,o]})),w= exports.Text =Object.assign(lr,Yr);var D={};or(D,{Link:()=>_r,Plain:()=>re,Primary:()=>Gr,Secondary:()=>Zr,base:()=>k});var k=({radii:r,space:e})=>({borderWidth:0,borderRadius:r.md,padding:`${e[2]} ${e[4]}`}),Gr=({colors:r})=>[k,{backgroundColor:r.primary.surface,color:r.primary.foreground,"&:hover":{backgroundColor:r.primary.hover.surface}}],Zr=({colors:r})=>[k,{backgroundColor:r.secondary.surface,color:r.secondary.foreground,"&:hover":{backgroundColor:r.secondary.hover.surface}}],_r=({colors:r})=>[k,{backgroundColor:r.transparent,color:r.primary.surface,"&:hover":{color:r.primary.hover.surface}}],re=({colors:r})=>[k,{backgroundColor:r.transparent,color:r.neutral.foreground}];function fr(i){var s=i,{as:r,children:e,css:o={},title:t,variant:n="Primary"}=s,a=c(s,["as","children","css","title","variant"]);return _jsxruntime.jsxs.call(void 0, u,p(l({as:r!=null?r:"button",css:[D[n],o]},a),{children:[e,t&&_jsxruntime.jsx.call(void 0, w.Body2,{fontWeight:"demibold",children:t})]}))}var ee=["Primary","Secondary","Link","Plain"],oe=Object.fromEntries(ee.map(r=>{let e=r.toLocaleLowerCase(),o=a=>{var i=a,{part:t}=i,n=c(i,["part"]);return _jsxruntime.jsx.call(void 0, fr,p(l({part:[`button-${e}`,t]},n),{variant:r,children:n.children}))};return o.displayName=`Text.${r}`,[r,o]})),O= exports.Button =Object.assign(fr,oe);var ne=z.forwardRef((n,t)=>{var a=n,{children:r,css:e}=a,o=c(a,["children","css"]);return _jsxruntime.jsx.call(void 0, u,p(l({css:[{display:"flex",flexDirection:"row"},e]},o),{ref:t,children:r}))}),ae=z.forwardRef((n,t)=>{var a=n,{children:r,css:e}=a,o=c(a,["children","css"]);return _jsxruntime.jsx.call(void 0, u,p(l({css:[{display:"flex",flexDirection:"column"},e]},o),{ref:t,children:r}))}),S= exports.Flex ={Column:ae,Row:ne};var _react2 = require('@emotion/react');function ur(r){var e=r.match(/^var\((.*)\)$/);return e?e[1]:r}function gr(r,e){var o=r;for(var t of e){if(!(t in o))throw new Error("Path ".concat(e.join(" -> ")," does not exist in object"));o=o[t]}return o}function I(r,e){var o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],t=r.constructor();for(var n in r){var a=r[n],i=[...o,n];typeof a=="string"||typeof a=="number"||a==null?t[n]=e(a,i):typeof a=="object"&&!Array.isArray(a)?t[n]=I(a,e,i):console.warn('Skipping invalid key "'.concat(i.join("."),'". Should be a string, number, null or object. Received: "').concat(Array.isArray(a)?"Array":typeof a,'"'))}return t}function mr(r,e,o){r.style.setProperty(ur(e),o)}function vr(r,e,o){if(typeof o=="object"){var t=e;I(o,(i,s)=>{mr(r,gr(t,s),String(i))})}else{var n=e;for(var a in n)mr(r,a,n[a])}}function $(r,e=d){return Object.keys(r).reduce((o,t)=>{let n=r[t];return typeof n=="object"&&n!==null&&!Array.isArray(n)&&t in r?Object.assign(o,$(n,e[t])):o[e[t]]=r[t],o},{})}function br(r={},e=":root"){_react.useEffect.call(void 0, ()=>{let o=$(r),t=document.querySelector(e);vr(t,o)},[r])}var L=_react.createContext.call(void 0, {apiKey:"",config:{}});function ce({apiKey:r,children:e,config:o={},theme:t}){return br(t),_jsxruntime.jsx.call(void 0, L.Provider,{value:{apiKey:r,config:o},children:_jsxruntime.jsx.call(void 0, _react2.ThemeProvider,{theme:d,children:e})})}var _solid = require('@heroicons/react/24/solid');var _reactpopover = require('@radix-ui/react-popover'); var h = _interopRequireWildcard(_reactpopover);function hr(){let r="DOMRect"in globalThis?new DOMRect:{height:0,width:0,x:0,y:0,bottom:0,top:0,right:0,left:0,toJSON:()=>{}},[e,o]=_react.useState.call(void 0, r),[t,n]=_react.useState.call(void 0, null),a=_react.useCallback.call(void 0, i=>{n(i)},[]);return _react.useLayoutEffect.call(void 0, ()=>{t&&o(t.getBoundingClientRect())},[t]),{node:t,rect:e,ref:a}}var Pr="_16td421";function Tr(t){var n=t,{style:r={},part:e=""}=n,o=c(n,["style","part"]);return _jsxruntime.jsxs.call(void 0, u,p(l({part:`dot-wrapper ${e}`,style:l({height:"48px",position:"absolute",width:"48px"},r)},o),{children:[_jsxruntime.jsx.call(void 0, u,{backgroundColor:"primary.surface",className:Pr,part:"dot-pulse",style:{borderRadius:"24px",height:"48px",left:0,position:"absolute",top:0,transformOrigin:"center center",width:"48px"}}),_jsxruntime.jsx.call(void 0, u,{backgroundColor:"primary.surface",part:"dot",style:{borderRadius:"12px",height:"24px",left:"12px",position:"absolute",top:"12px",width:"24px"}})]}))}function K(t){var n=t,{part:r,src:e}=n,o=c(n,["part","src"]);return _jsxruntime.jsx.call(void 0, u,l({as:"img",part:["image",r],src:e},o))}function ge(r){var e,o,t;if(r.includes("youtube"))return`https://www.youtube.com/embed/${(e=r.split("v=")[1])==null?void 0:e.split("&")[0]}`;if(r.includes("vimeo"))return`https://player.vimeo.com/video/${(o=r.split("vimeo.com/")[1])==null?void 0:o.split("&")[0]}`;if(r.includes("wistia"))return`https://fast.wistia.net/embed/iframe/${(t=r.split("wistia.com/medias/")[1])==null?void 0:t.split("&")[0]}`;throw new Error("Could not map videoUri to a known provider (Youtube, Vimeo, Wistia).")}function N(t){var n=t,{part:r,src:e}=n,o=c(n,["part","src"]);let a=ge(e);return _jsxruntime.jsx.call(void 0, u,l({allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,as:"iframe",backgroundColor:"gray100",borderWidth:0,part:["video",r],src:a},o))}function q(t){var n=t,{src:r,type:e}=n,o=c(n,["src","type"]);return _jsxruntime.jsx.call(void 0, e==="video"?N:K,l({src:r},o))}function Br({props:r,alignAttr:e,sideAttr:o}){let t=o!=null?o:"bottom",n={},a=(()=>{if(["after","before"].includes(r.align)){if(e=="start")return"before";if(e=="end")return"after"}return r.align})(),i="-24px",s={top:"bottom",right:"left",bottom:"top",left:"right"};return n[s[t]]=i,["before","end"].includes(a)?["top","bottom"].includes(t)?n.right=i:n.bottom=i:["after","start"].includes(a)?["top","bottom"].includes(t)?n.left=i:n.top=i:["top","bottom"].includes(t)?n.left=`calc(50% + ${i})`:n.top=`calc(50% + ${i})`,n}var Sr={content:["align","alignOffset","arrowPadding","avoidCollisions","collisionBoundary","collisionPadding","forceMount","hideWhenDetached","onCloseAutoFocus","onEscapeKeyDown","onFocusOutside","onInteractOutside","onOpenAutoFocus","onPointerDownOutside","side","sideOffset","sticky"],root:["defaultOpen","modal","onOpenChange","open"]};function Cr(r,e){var n,a,i;let o=Object.fromEntries(Sr.content.map(s=>[s,r[s]]).filter(s=>s[1]!==void 0)),t=Object.fromEntries(Sr.root.map(s=>[s,r[s]]).filter(s=>s[1]!==void 0));if(["before","after"].includes(o.align)){let s={after:"end",before:"start"},f=(H,V)=>["top","bottom"].includes(V)?H=="after"?"marginLeft":"marginRight":H=="after"?"marginTop":"marginBottom",m=(n=o.alignOffset)!=null?n:0,x=(a=o.style)!=null?a:{},b=(i=o.side)!=null?i:"bottom",P=o.align;o.style=p(l({},x),{[f(P,b)]:m});let B=["top","bottom"].includes(b)?e.width:e.height;o.alignOffset=(B+m)*-1,o.align=s[P]}return{contentProps:o,rootProps:t}}function g(i){var s=i,{anchor:r,children:e,css:o,spotlight:t=!1,style:n}=s,a=c(s,["anchor","children","css","spotlight","style"]);let{node:f,rect:m,ref:x}=hr(),[b,P]=_react.useState.call(void 0, a.align),[B,H]=_react.useState.call(void 0, a.side);if(f!==null){let C=f.getAttribute("data-align"),G=f.getAttribute("data-side");b!==C&&P(C),B!==G&&H(G)}let{contentProps:V,rootProps:kr}=Cr(a,m),U=_react.useRef.call(void 0, null),[F,Or]=_react.useState.call(void 0, null);if(_react.useEffect.call(void 0, ()=>{let C=document.querySelector(r);C!=null&&(U.current=C,Or(U))},[r]),F==null)return null;let W=F.current.getBoundingClientRect(),Y="0";typeof window!="undefined"&&(Y=window.getComputedStyle(F.current).borderRadius);let Hr=Br({props:a,alignAttr:b,sideAttr:B});return _jsxruntime.jsxs.call(void 0, h.Root,p(l({defaultOpen:!0},kr),{children:[_jsxruntime.jsx.call(void 0, h.Anchor,{virtualRef:F}),_jsxruntime.jsx.call(void 0, h.Portal,{children:_jsxruntime.jsxs.call(void 0, "div",{css:o,children:[t&&_jsxruntime.jsx.call(void 0, u,{borderRadius:Y,part:"tooltip-spotlight",position:"absolute",css:{boxShadow:"0 0 0 2000px rgb(0 0 0 / 0.5)",height:W.height,left:W.left,top:W.top,width:W.width}}),_jsxruntime.jsx.call(void 0, h.Content,p(l({asChild:!0},V),{ref:x,children:_jsxruntime.jsxs.call(void 0, S.Column,{backgroundColor:"white",borderRadius:"md",p:5,part:"tooltip-content",position:"relative",css:l({boxShadow:"0px 4px 20px rgba(0, 0, 0, 0.1)",width:"300px"},n),children:[_jsxruntime.jsx.call(void 0, Tr,{style:Hr}),e]})}))]})})]}))}g.Close=o=>{var t=o,{css:r}=t,e=c(t,["css"]);return _jsxruntime.jsx.call(void 0, h.Close,{"aria-label":"Close",asChild:!0,children:_jsxruntime.jsx.call(void 0, O.Plain,p(l({css:[{top:0,right:0},r],part:"tooltip-close",position:"absolute"},e),{children:_jsxruntime.jsx.call(void 0, _solid.XMarkIcon,{height:"20",fill:"currentColor"})}))})};g.Media=o=>{var t=o,{src:r}=t,e=c(t,["src"]);return r==null?null:_jsxruntime.jsx.call(void 0, q,l({borderRadius:"md md 0 0",borderWidth:"0",css:{aspectRatio:"2"},margin:"-5 -5 5",src:r},e))};g.Primary=t=>{var n=t,{onClick:r,title:e}=n,o=c(n,["onClick","title"]);return e==null?null:_jsxruntime.jsx.call(void 0, O.Primary,l({title:e,onClick:r},o))};g.Progress=o=>{var t=o,{children:r}=t,e=c(t,["children"]);return r==null?null:_jsxruntime.jsx.call(void 0, w.Body2,p(l({fontWeight:"demibold",part:"progress"},e),{children:r}))};g.Secondary=t=>{var n=t,{onClick:r,title:e}=n,o=c(n,["onClick","title"]);return e==null?null:_jsxruntime.jsx.call(void 0, O.Secondary,l({title:e,onClick:r},o))};g.Subtitle=o=>{var t=o,{children:r}=t,e=c(t,["children"]);return r==null?null:_jsxruntime.jsx.call(void 0, w.Body2,p(l({part:"subtitle"},e),{children:r}))};g.Title=o=>{var t=o,{children:r}=t,e=c(t,["children"]);return r==null?null:_jsxruntime.jsx.call(void 0, w.Body1,p(l({fontWeight:"bold",mb:1,part:"title"},e),{children:r}))};var _js = require('@frigade/js');function Rr(r){let[e,o]=_react.useState.call(void 0, null),{apiKey:t,config:n}=_react.useContext.call(void 0, L);function a(){return R(this,null,function*(){let i=Object.fromEntries(Object.entries(n).filter(([m,x])=>["apiUrl","userId"].includes(m)&&x!=null)),f=yield(yield new (0, _js.Frigade)(t,i)).getFlow(r);o(f)})}return e===null&&a(),{flow:e,fetchFlow:a}}function Te(o){var t=o,{flowId:r}=t,e=c(t,["flowId"]);var x;let{flow:n,fetchFlow:a}=Rr(r);if(n==null||n!=null&&n.isCompleted||n!=null&&n.isSkipped)return null;n.start();let i=n.getCurrentStep();i==null||i.start();function s(){return R(this,null,function*(){yield n.skip(),a()})}function f(){return R(this,null,function*(){yield i.complete(),a()})}let m=f;return _jsxruntime.jsxs.call(void 0, g,p(l({align:"after",anchor:i.selector,onOpenAutoFocus:b=>b.preventDefault(),onPointerDownOutside:b=>b.preventDefault()},e),{children:[_jsxruntime.jsx.call(void 0, g.Close,{onClick:s}),_jsxruntime.jsx.call(void 0, g.Media,{src:(x=i.videoUri)!=null?x:i.imageUri,type:i.videoUri?"video":"image"}),_jsxruntime.jsx.call(void 0, g.Title,{children:i.title}),_jsxruntime.jsx.call(void 0, g.Subtitle,{children:i.subtitle}),_jsxruntime.jsxs.call(void 0, S.Row,{pt:4,alignItems:"center",justifyContent:"space-between",children:[_jsxruntime.jsx.call(void 0, g.Progress,{children:`${n.getNumberOfCompletedSteps()}/${n.steps.size}`}),_jsxruntime.jsxs.call(void 0, S.Row,{gap:3,children:[_jsxruntime.jsx.call(void 0, g.Secondary,{title:i.secondaryButtonTitle,onClick:m}),_jsxruntime.jsx.call(void 0, g.Primary,{title:i.primaryButtonTitle,onClick:f})]})]})]}))}exports.Box = u; exports.Button = O; exports.Flex = S; exports.Provider = ce; exports.Text = w; exports.Tooltip = g; exports.Tour = Te;
1
+ 'use strict';
2
+
3
+ var h = require('@radix-ui/react-dialog');
4
+ var solid = require('@heroicons/react/24/solid');
5
+ var U = require('react');
6
+ var clsx = require('clsx');
7
+ var qe = require('known-css-properties');
8
+ var it = require('dompurify');
9
+ var jsxRuntime = require('@emotion/react/jsx-runtime');
10
+ var react = require('@emotion/react');
11
+ var js = require('@frigade/js');
12
+ var C = require('@radix-ui/react-popover');
13
+
14
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
15
+
16
+ function _interopNamespace(e) {
17
+ if (e && e.__esModule) return e;
18
+ var n = Object.create(null);
19
+ if (e) {
20
+ Object.keys(e).forEach(function (k) {
21
+ if (k !== 'default') {
22
+ var d = Object.getOwnPropertyDescriptor(e, k);
23
+ Object.defineProperty(n, k, d.get ? d : {
24
+ enumerable: true,
25
+ get: function () { return e[k]; }
26
+ });
27
+ }
28
+ });
29
+ }
30
+ n.default = e;
31
+ return Object.freeze(n);
32
+ }
33
+
34
+ var h__namespace = /*#__PURE__*/_interopNamespace(h);
35
+ var U__namespace = /*#__PURE__*/_interopNamespace(U);
36
+ var qe__default = /*#__PURE__*/_interopDefault(qe);
37
+ var it__default = /*#__PURE__*/_interopDefault(it);
38
+ var C__namespace = /*#__PURE__*/_interopNamespace(C);
39
+
40
+ var _e=Object.defineProperty;var Ue=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,o)=>(typeof require<"u"?require:t)[o]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var te=(e,t)=>{for(var o in t)_e(e,o,{get:t[o],enumerable:!0});};var oe={borders:{md:"1px solid"},borderWidths:{0:"0",md:"1px"}};var re={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 ne={md:"10px",lg:"20px",round:"50%"};var l=e=>`var(--fr-colors-${e})`,ie={neutral:{background:l("white"),border:l("gray500"),foreground:l("black"),surface:l("gray700"),active:{background:l("white"),border:l("gray900"),foreground:l("black"),surface:l("gray700")},focus:{background:l("white"),border:l("gray900"),foreground:l("black"),surface:l("gray700")},hover:{background:l("white"),border:l("gray900"),foreground:l("black"),surface:l("gray700")}},primary:{background:l("blue500"),border:l("blue500"),foreground:l("white"),surface:l("blue500"),active:{background:l("blue400"),border:l("blue400"),foreground:l("white"),surface:l("blue400")},focus:{background:l("blue500"),border:l("blue500"),foreground:l("white"),surface:l("blue500")},hover:{background:l("blue400"),border:l("blue400"),foreground:l("white"),surface:l("blue400")}},secondary:{background:l("gray900"),border:l("gray900"),foreground:l("black"),surface:l("gray900"),active:{background:l("gray800"),border:l("gray800"),foreground:l("black"),surface:l("gray800")},focus:{background:l("gray900"),border:l("gray900"),foreground:l("black"),surface:l("gray900")},hover:{background:l("gray800"),border:l("gray800"),foreground:l("black"),surface:l("gray800")}}};var se={md:"0px 4px 20px rgba(0, 0, 0, 0.1)"};var Je="px",Xe=e=>typeof e=="number"?`${4*e}${Je}`:e,Ge=[-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"],ae=Object.fromEntries(Ge.map(e=>[e,Xe(e)]));var le={fontFamilies:{default:"TT Interphases Pro, sans-serif"},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 z={...oe,colors:{...re,...ie},...le,radii:ne,shadows:se,space:ae};function A(e,t="",o="."){return Object.keys(e).reduce((r,n)=>{let s=`${t.length?`${t}${o}`:""}${n}`,p=e[n];return typeof p=="object"&&p!==null&&!Array.isArray(p)?Object.assign(r,A(p,s,o)):r[s]=p,r},{})}function K(e){return A(e,"--fr","-")}function pe(e,t="--fr"){let o={};return Object.keys(e).forEach(r=>{let n=e[r];typeof n=="object"&&n!==null&&!Array.isArray(n)?o[r]=pe(n,`${t}-${r}`):o[r]=`var(${t}-${r})`;}),o}var de=K(z),c=pe(z);var Ye=new Set(["alt","size","src"]),Qe=qe__default.default.all.filter(e=>e.indexOf("-")!=0&&!Ye.has(e)).map(e=>[e.replace(/-([a-z])/g,(t,o)=>o.toUpperCase()),null]),Ze=Object.fromEntries(Qe),j=A(c.colors),et={color:j,backgroundColor:j,borderColor:j,border:c.borders,borderRadius:c.radii,borderWidth:c.borderWidths,boxShadow:c.shadows,fontFamily:c.fontFamilies,fontSize:c.fontSizes,fontWeight:c.fontWeights,gap:c.space,lineHeight:c.lineHeights,margin:c.space,marginBottom:c.space,marginLeft:c.space,marginRight:c.space,marginTop:c.space,padding:c.space,paddingBottom:c.space,paddingLeft:c.space,paddingRight:c.space,paddingTop:c.space},ce={...Ze,...et},ue={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"]},me=new Set(["active","focus","focusVisible","focusWithin","hover"]);function tt(e){return Array.isArray(e)?new Map(e.map(t=>[t,t])):typeof e=="object"&&e!==null?new Map(Object.entries(e)):["string","number"].includes(typeof e)?new Map([e,e]):new Map}var fe=new Map(Object.entries(ce).map(([e,t])=>[e,tt(t)])),ot=new Map(Object.entries(ue).map(([e,t])=>[e,new Set(t)])),rt=new Set(["height","width"]),nt=new Set(["canvas","embed","iframe","img","input","object","video"]);function ge(e){let[t,o]=e.split(":");return [t,me.has(o)?o:null]}function xe(e,t="div"){let o=Object.assign({},e),r={};function n(i){if(i==null)return r;let p=`&:${i.replace(/[A-Z]/g,a=>`-${a.toLocaleLowerCase()}`)}`;return r[p]==null&&(r[p]={}),r[p]}return Object.entries(o).forEach(([i,s])=>{let[p,a]=ge(i),d=ot.get(p);d!=null&&(d.forEach(f=>{let m=`${f}${a?":"+a:""}`;o[m]=s;}),delete o[i]);}),Object.entries(o).forEach(([i,s])=>{let[p,a]=ge(i),d=fe.get(p);if(d!=null){if(typeof s=="string"&&s.indexOf(" ")>-1){let f=s.split(" ");n(a)[p]=f.map(m=>d.get(m.toString())??m).join(" ");}else d.has(s.toString())?n(a)[p]=d.get(s.toString()):n(a)[p]=s;(typeof t!="string"||!nt.has(t)||!rt.has(p))&&delete o[i];}}),Object.keys(o).forEach(i=>{let s=i.substring(1);i.indexOf("_")===0&&fe.has(s)&&(o[s]=o[i],delete o[i]);}),{cssFromProps:r,unmatchedProps:o}}function st(){if(typeof window>"u"){let{JSDOM:e}=Ue("jsdom");return new e("<!DOCTYPE html>").window}return window}function ye(e){return e?{__html:it__default.default(st()).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 lt(e){return e&&`fr-${e}`}function be(e){return e&&(Array.isArray(e)?e.map(t=>be(t)).join(" "):lt(e))}function pt({as:e,children:t,className:o,css:r={},part:n,...i},s){let p=e??"div",{cssFromProps:a,unmatchedProps:d}=xe(i,p),f=be(n),m=o||f?clsx.clsx(o,f):void 0,v=[{boxSizing:"border-box"},a,r];return typeof t=="string"?jsxRuntime.jsx(p,{className:m,css:v,...d,ref:s,dangerouslySetInnerHTML:ye(t)}):jsxRuntime.jsx(p,{className:m,css:v,...d,ref:s,children:t})}var u=U__namespace.forwardRef(pt);var N={};te(N,{Body1:()=>xt,Body2:()=>yt,Caption:()=>ht,Display1:()=>dt,Display2:()=>ct,H1:()=>ut,H2:()=>mt,H3:()=>ft,H4:()=>gt});var w={color:"neutral.foreground",fontFamily:"default",margin:"0"},dt={...w,fontSize:"5xl",fontWeight:"bold",lineHeight:"4xl"},ct={...w,fontSize:"4xl",fontWeight:"bold",lineHeight:"3xl"},ut={...w,fontSize:"3xl",fontWeight:"bold",lineHeight:"2xl"},mt={...w,fontSize:"2xl",fontWeight:"bold",lineHeight:"xl"},ft={...w,fontSize:"xl",fontWeight:"bold",lineHeight:"lg"},gt={...w,fontSize:"lg",fontWeight:"bold",lineHeight:"md"},xt={...w,fontSize:"md",fontWeight:"regular",lineHeight:"md"},yt={...w,fontSize:"sm",fontWeight:"regular",lineHeight:"md"},ht={...w,fontSize:"xs",fontWeight:"regular",lineHeight:"sm"};function Te({as:e="span",children:t,variant:o="Body1",...r}){return jsxRuntime.jsx(u,{as:e,...N[o],...r,children:t})}var Pt=["Display1","Display2","H1","H2","H3","H4","Body1","Body2","Caption"],bt=Object.fromEntries(Pt.map(e=>{let t=["H1","H2","H3","H4"].includes(e)?e.toLowerCase():void 0,o=r=>jsxRuntime.jsx(Te,{as:t,...r,variant:e,children:r.children});return o.displayName=`Text.${e}`,[e,o]})),b=Object.assign(Te,bt);var _={};te(_,{Link:()=>Ct,Plain:()=>wt,Primary:()=>Tt,Secondary:()=>St});var I={borderWidth:"0",borderRadius:"md",padding:"2 4"},Tt={...I,backgroundColor:"primary.surface",color:"primary.foreground","backgroundColor:hover":"primary.hover.surface"},St={...I,backgroundColor:"secondary.surface",color:"secondary.foreground","backgroundColor:hover":"secondary.hover.surface"},Ct={...I,backgroundColor:"transparent",color:"primary.surface","color:hover":"primary.hover.surface"},wt={...I,backgroundColor:"transparent",color:"neutral.foreground"};function Ce({as:e,children:t,part:o,title:r,variant:n="Primary",...i}){let s=n.toLocaleLowerCase();return jsxRuntime.jsxs(u,{as:e??"button",part:[`button-${s}`,o],..._[n],...i,children:[t,r&&jsxRuntime.jsx(b.Body2,{fontWeight:"demibold",color:"inherit",children:r})]})}var Bt=["Primary","Secondary","Link","Plain"],Rt=Object.fromEntries(Bt.map(e=>{let t=o=>jsxRuntime.jsx(Ce,{...o,variant:e,children:o.children});return t.displayName=`Text.${e}`,[e,t]})),T=Object.assign(Ce,Rt);var Ft=U__namespace.forwardRef(({children:e,css:t,...o},r)=>jsxRuntime.jsx(u,{css:[{display:"flex",flexDirection:"row"},t],...o,ref:r,children:e})),kt=U__namespace.forwardRef(({children:e,css:t,...o},r)=>jsxRuntime.jsx(u,{css:[{display:"flex",flexDirection:"column"},t],...o,ref:r,children:e})),S={Column:kt,Row:Ft};var F=U__namespace.forwardRef(({as:e,children:t,...o},r)=>{let n=e??S.Column;return jsxRuntime.jsx(n,{backgroundColor:"neutral.background",borderRadius:"md",p:5,...o,ref:r,children:t})});function ve({part:e,src:t,...o}){return jsxRuntime.jsx(u,{as:"img",part:["image",e],src:t,...o})}function Ht(e){var t,o,r;if(e.includes("youtube"))return `https://www.youtube.com/embed/${(t=e.split("v=")[1])==null?void 0:t.split("&")[0]}`;if(e.includes("vimeo"))return `https://player.vimeo.com/video/${(o=e.split("vimeo.com/")[1])==null?void 0:o.split("&")[0]}`;if(e.includes("wistia"))return `https://fast.wistia.net/embed/iframe/${(r=e.split("wistia.com/medias/")[1])==null?void 0:r.split("&")[0]}`;throw new Error("Could not map videoUri to a known provider (Youtube, Vimeo, Wistia).")}function Fe({part:e,src:t,...o}){let r=Ht(t);return jsxRuntime.jsx(u,{allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,as:"iframe",backgroundColor:"gray100",borderWidth:0,part:["video",e],src:r,...o})}function $({src:e,type:t,...o}){return jsxRuntime.jsx(t==="video"?Fe:ve,{src:e,...o})}function y({children:e,...t}){return jsxRuntime.jsx(h__namespace.Root,{defaultOpen:!0,modal:!0,children:jsxRuntime.jsx(h__namespace.Portal,{children:jsxRuntime.jsxs(u,{inset:"0",position:"fixed",zIndex:"9999",children:[jsxRuntime.jsx(h__namespace.Overlay,{asChild:!0,children:jsxRuntime.jsx(u,{background:"rgb(0 0 0 / 0.5)",part:"dialog-overlay",position:"fixed",inset:"0"})}),jsxRuntime.jsx(h__namespace.Content,{asChild:!0,onOpenAutoFocus:o=>o.preventDefault(),onPointerDownOutside:o=>o.preventDefault(),children:jsxRuntime.jsx(F,{boxShadow:"md",left:"50%",maxWidth:"430px",p:8,part:"dialog-content",position:"fixed",textAlign:"center",top:"50%",transform:"translate(-50%, -50%)",...t,children:e})})]})})})}y.Close=e=>jsxRuntime.jsx(h__namespace.Close,{"aria-label":"Close",asChild:!0,children:jsxRuntime.jsx(T.Plain,{part:"close",position:"absolute",right:"-4px",top:"4px",...e,children:jsxRuntime.jsx(solid.XMarkIcon,{height:"24",fill:"currentColor"})})});y.Subtitle=({children:e,...t})=>jsxRuntime.jsx(h__namespace.Description,{asChild:!0,children:jsxRuntime.jsx(b.Body2,{mb:5,part:"subtitle",...t,children:e})});y.Media=({src:e,...t})=>e==null?null:jsxRuntime.jsx($,{borderRadius:"md",src:e,...t});y.Primary=({onClick:e,title:t,...o})=>t==null?null:jsxRuntime.jsx(T.Primary,{title:t,onClick:e,...o});y.ProgressDots=({current:e,total:t})=>{let o=[...Array(t)].map((r,n)=>jsxRuntime.jsx("circle",{r:4,cx:4+16*n,cy:"4px",fill:e===n?c.colors.blue500:c.colors.blue800},n));return jsxRuntime.jsx(u,{as:"svg",height:"8px",margin:"5 auto",part:"progress",viewBox:`0 0 ${16*t-8} 8`,width:16*t-8,children:o})};y.Secondary=({onClick:e,title:t,...o})=>t==null?null:jsxRuntime.jsx(T.Secondary,{title:t,onClick:e,...o});y.Title=({children:e,...t})=>jsxRuntime.jsx(h__namespace.Title,{asChild:!0,children:jsxRuntime.jsx(b.H3,{mb:1,part:"title",...t,children:e})});var B=U.createContext({apiKey:"",modals:[],setModals:()=>{},navigate:()=>{}});function Nt({children:e,navigate:t,theme:o,...r}){let n=o?K(o):{},[i,s]=U.useState([]),p=U.useRef(new js.Frigade(r.apiKey,{apiKey:r.apiKey,apiUrl:r.apiUrl,userId:r.userId,groupId:r.groupId})),a=t??((d,f="_self")=>{window.open(d,f);});return U.useEffect(()=>()=>{var d;(d=p.current)==null||d.destroy();},[]),jsxRuntime.jsxs(B.Provider,{value:{modals:i,setModals:s,navigate:a,...r,frigade:p.current},children:[jsxRuntime.jsx(react.Global,{styles:{":root":{...de,...n}}}),jsxRuntime.jsx(react.ThemeProvider,{theme:c,children:e})]})}function k(e,t){let[o,r]=U.useState(),[n,i]=U.useState(""),{frigade:s}=U.useContext(B),p=a=>{a.id===e&&(t!=null&&t.variables&&a.applyVariables(t.variables),r(a),i(Math.random().toString()));};return U.useEffect(()=>((async()=>{let a=await s.getFlow(e);if(!a||s.hasFailedToLoad()){r(void 0);return}t!=null&&t.variables&&a.applyVariables(t.variables),r(a);})(),s.onStateChange(p),()=>{s.removeStateChangeHandler(p);}),[]),{flow:o}}function R(e,{onComplete:t,onDismiss:o}={}){let r=U.useRef(null);return U.useEffect(()=>{e!=null&&(e.isCompleted&&r.current===!1&&(async()=>await(t==null?void 0:t(e)))(),r.current=e==null?void 0:e.isCompleted);},[e==null?void 0:e.isCompleted]),{handleDismiss:U.useCallback(async n=>{if(await(o==null?void 0:o(e,n))===!1)return n.preventDefault(),!1;await e.skip();},[e])}}function D(e,{onPrimary:t,onSecondary:o}={}){let{navigate:r}=U.useContext(B);return {handlePrimary:U.useCallback(async n=>{if(await(t==null?void 0:t(e,n))===!1)return n.preventDefault(),!1;await e.complete(),e.primaryButtonUri!=null&&r(e.primaryButtonUri,e.primaryButtonUriTarget);},[e]),handleSecondary:U.useCallback(async n=>{if(await(o==null?void 0:o(e,n))===!1)return n.preventDefault(),!1;await e.complete(),e.secondaryButtonUri!=null&&r(e.secondaryButtonUri,e.secondaryButtonUriTarget);},[e])}}function Qt({dismissible:e=!0,flowId:t,onComplete:o,onDismiss:r,onPrimary:n,onSecondary:i,variables:s,...p}){let{flow:a}=k(t,{variables:s}),d=a==null?void 0:a.getCurrentStep(),{handleDismiss:f}=R(a,{onComplete:o,onDismiss:r}),{handlePrimary:m,handleSecondary:v}=D(d,{onPrimary:n,onSecondary:i});return a==null||a.isVisible===!1?null:(a.start(),d==null||d.start(),jsxRuntime.jsxs(y,{...p,children:[e&&jsxRuntime.jsx(y.Close,{onClick:f}),jsxRuntime.jsx(y.Title,{children:d.title}),jsxRuntime.jsx(y.Subtitle,{children:d.subtitle}),jsxRuntime.jsx(y.Media,{src:d.imageUri,css:{aspectRatio:"1.5",objectFit:"cover",width:"100%"}}),jsxRuntime.jsx(y.ProgressDots,{current:a.getNumberOfCompletedSteps(),total:a.getNumberOfAvailableSteps()}),jsxRuntime.jsxs(S.Row,{css:{"& > button":{flexGrow:1}},gap:3,children:[jsxRuntime.jsx(y.Secondary,{title:"Secondary",onClick:v}),jsxRuntime.jsx(y.Primary,{title:"Primary",onClick:m})]})]}))}function eo({dismissible:e=!0,flowId:t,onComplete:o,onDismiss:r,onPrimary:n,onSecondary:i,...s}){let{flow:p}=k(t),a=p==null?void 0:p.getCurrentStep(),{handleDismiss:d}=R(p,{onComplete:o,onDismiss:r}),{handlePrimary:f,handleSecondary:m}=D(a,{onPrimary:n,onSecondary:i});return p==null||p.isVisible===!1?null:(p.start(),a==null||a.start(),jsxRuntime.jsxs(F,{as:S.Row,border:"md",borderColor:"gray900",justifyContent:"space-between",...s,children:[jsxRuntime.jsxs(S.Row,{gap:3,children:[jsxRuntime.jsx("img",{src:a.imageUri,style:{height:40,width:40,alignSelf:"center"}}),jsxRuntime.jsxs(S.Column,{children:[jsxRuntime.jsx(b.H4,{mb:1,children:a.title}),jsxRuntime.jsx(b.Body2,{children:a.subtitle})]})]}),jsxRuntime.jsxs(S.Row,{alignItems:"center",gap:3,children:[jsxRuntime.jsx(T.Secondary,{title:a.secondaryButtonTitle,onClick:m}),jsxRuntime.jsx(T.Primary,{title:a.primaryButtonTitle,onClick:f}),e&&jsxRuntime.jsx(T.Plain,{part:"banner-close",onClick:d,children:jsxRuntime.jsx(solid.XMarkIcon,{height:"24",fill:"currentColor"})})]})]}))}function J(){let e="DOMRect"in globalThis?new DOMRect:{height:0,width:0,x:0,y:0,bottom:0,top:0,right:0,left:0,toJSON:()=>{}},[t,o]=U.useState(e),[r,n]=U.useState(null),i=U.useCallback(s=>{n(s);},[]);return U.useLayoutEffect(()=>{r&&o(r.getBoundingClientRect());},[r]),{node:r,rect:t,ref:i}}var no=react.keyframes({"0%":{opacity:.5,transform:"scale(0.5)"},"50%":{opacity:0,transform:"scale(1)"},"100%":{opacity:0,transform:"scale(1)"}});function Ae({style:e={},part:t="",...o}){return jsxRuntime.jsxs(u,{part:`dot-wrapper ${t}`,style:{height:"48px",position:"absolute",width:"48px",...e},...o,children:[jsxRuntime.jsx(u,{backgroundColor:"primary.surface",part:"dot-pulse",css:{animation:`2s ease-out infinite ${no}`,borderRadius:"24px",height:"48px",left:0,position:"absolute",top:0,transformOrigin:"center center",width:"48px"}}),jsxRuntime.jsx(u,{backgroundColor:"primary.surface",part:"dot",style:{borderRadius:"12px",height:"24px",left:"12px",position:"absolute",top:"12px",width:"24px"}})]})}function $e({props:e,alignAttr:t,sideAttr:o}){let r=o??"bottom",n={},i=()=>{if(["after","before"].includes(e.align)){if(t=="start")return "before";if(t=="end")return "after"}return e.align??"after"},s="-24px",p={top:"bottom",right:"left",bottom:"top",left:"right"};n[p[r]]=s;let a=i();return ["before","end"].includes(a)?["top","bottom"].includes(r)?n.right=s:n.bottom=s:["after","start"].includes(a)?["top","bottom"].includes(r)?n.left=s:n.top=s:["top","bottom"].includes(r)?n.left=`calc(50% + ${s})`:n.top=`calc(50% + ${s})`,n}var We={content:["align","alignOffset","arrowPadding","avoidCollisions","collisionBoundary","collisionPadding","forceMount","hideWhenDetached","onCloseAutoFocus","onEscapeKeyDown","onFocusOutside","onInteractOutside","onOpenAutoFocus","onPointerDownOutside","side","sideOffset","sticky"],root:["defaultOpen","modal","onOpenChange","open"]};function Ve(e,t){let o=Object.fromEntries(We.content.map(n=>[n,e[n]]).filter(n=>n[1]!==void 0)),r=Object.fromEntries(We.root.map(n=>[n,e[n]]).filter(n=>n[1]!==void 0));if(o.align=o.align??"after",o.side=o.side??"bottom",["before","after"].includes(o.align)){let n={after:"end",before:"start"},i=(m,v)=>["top","bottom"].includes(v)?m=="after"?"marginLeft":"marginRight":m=="after"?"marginTop":"marginBottom",s=o.alignOffset??0,p=o.style??{},a=o.side??"bottom",d=o.align;o.style={...p,[i(d,a)]:s};let f=["top","bottom"].includes(a)?t.width:t.height;o.alignOffset=(f+s)*-1,o.align=n[d];}return {contentProps:o,rootProps:r}}function x({anchor:e,children:t,className:o,spotlight:r=!1,style:n,...i}){let{node:s,rect:p,ref:a}=J(),{contentProps:d,rootProps:f}=Ve(i,p),[m,v]=U.useState(d.align),[Y,Ke]=U.useState(d.side);if(s!==null){let M=s.getAttribute("data-align"),ee=s.getAttribute("data-side");m!==M&&v(M),Y!==ee&&Ke(ee);}let Q=U.useRef(null),[W,je]=U.useState(null);if(U.useEffect(()=>{let M=document.querySelector(e);M!=null&&(Q.current=M,je(Q));},[e]),W==null)return null;let V=W.current.getBoundingClientRect(),Z="0";typeof window<"u"&&(Z=window.getComputedStyle(W.current).borderRadius);let Ne=$e({props:i,alignAttr:m,sideAttr:Y});return jsxRuntime.jsxs(C__namespace.Root,{defaultOpen:!0,...f,children:[jsxRuntime.jsx(C__namespace.Anchor,{virtualRef:W}),jsxRuntime.jsx(C__namespace.Portal,{children:jsxRuntime.jsxs("div",{className:o,css:{bottom:0,left:0,position:"absolute",right:0,top:0,zIndex:9999},children:[r&&jsxRuntime.jsx(u,{part:"tooltip-spotlight",position:"absolute",css:{borderRadius:Z,boxShadow:"0 0 0 2000px rgb(0 0 0 / 0.5)",height:V.height,left:V.left,top:V.top,width:V.width}}),jsxRuntime.jsx(C__namespace.Content,{asChild:!0,...d,ref:a,children:jsxRuntime.jsxs(F,{boxShadow:"md",part:"tooltip-content",position:"relative",css:{maxWidth:"360px",...n},children:[jsxRuntime.jsx(Ae,{style:Ne}),t]})})]})})]})}x.Close=e=>jsxRuntime.jsx(C__namespace.Close,{"aria-label":"Close",asChild:!0,children:jsxRuntime.jsx(T.Plain,{css:{top:"12px",right:"4px"},part:"close",position:"absolute",...e,children:jsxRuntime.jsx(solid.XMarkIcon,{height:"24",fill:"currentColor"})})});x.Media=({src:e,...t})=>e==null?null:jsxRuntime.jsx($,{borderRadius:"md md 0 0",borderWidth:"0",css:{aspectRatio:"2"},margin:"-5 -5 5",src:e,...t});x.Primary=({onClick:e,title:t,...o})=>t==null?null:jsxRuntime.jsx(T.Primary,{title:t,onClick:e,...o});x.Progress=({children:e,...t})=>e==null?null:jsxRuntime.jsx(b.Body2,{fontWeight:"demibold",part:"progress",...t,children:e});x.Secondary=({onClick:e,title:t,...o})=>t==null?null:jsxRuntime.jsx(T.Secondary,{title:t,onClick:e,...o});x.Subtitle=({children:e,...t})=>e==null?null:jsxRuntime.jsx(b.Body2,{part:"subtitle",...t,children:e});x.Title=({children:e,...t})=>e==null?null:jsxRuntime.jsx(b.Body1,{fontWeight:"bold",mb:1,part:"title",...t,children:e});function q(e){let{modals:t,setModals:o}=U.useContext(B),[r,n]=U.useState(!1);return U.useEffect(()=>(o([...t,e]),()=>o(t.filter(i=>i!==e))),[]),U.useEffect(()=>{let i=t[0]===e;i!==r&&n(i);},[t]),{isCurrentModal:r}}function ze({dismissible:e=!0,flow:t,onDismiss:o,onPrimary:r,onSecondary:n,step:i,...s}){let{isCurrentModal:p}=q(`${t.id}-${i.id}`),{handleDismiss:a}=R(t,{onDismiss:o}),{handlePrimary:d,handleSecondary:f}=D(i,{onPrimary:r,onSecondary:n});return p?jsxRuntime.jsxs(x,{anchor:i.selector,onOpenAutoFocus:m=>m.preventDefault(),onPointerDownOutside:m=>m.preventDefault(),...s,children:[e&&jsxRuntime.jsx(x.Close,{onClick:a}),jsxRuntime.jsx(x.Media,{src:i.videoUri??i.imageUri,type:i.videoUri?"video":"image"}),jsxRuntime.jsx(x.Title,{children:i.title}),jsxRuntime.jsx(x.Subtitle,{children:i.subtitle}),jsxRuntime.jsxs(S.Row,{alignItems:"center",gap:3,justifyContent:"flex-end",part:"tooltip-footer",pt:4,children:[jsxRuntime.jsx(x.Progress,{children:`${t.getNumberOfCompletedSteps()+1}/${t.getNumberOfAvailableSteps()}`}),jsxRuntime.jsx(x.Secondary,{marginLeft:"auto",title:i.secondaryButtonTitle,onClick:f}),jsxRuntime.jsx(x.Primary,{title:i.primaryButtonTitle,onClick:d})]})]},i.id):null}function uo({flowId:e,onComplete:t,variables:o,...r}){let{flow:n}=k(e,{variables:o});if(R(n,{onComplete:t}),n==null||n.isVisible===!1)return null;n.start();let i=n.getCurrentStep();return i==null||i.start(),jsxRuntime.jsx(ze,{step:i,flow:n,...r})}function go(){let{frigade:e}=U.useContext(B);return {frigade:e}}
41
+
42
+ exports.Announcement = Qt;
43
+ exports.Banner = eo;
44
+ exports.Box = u;
45
+ exports.Button = T;
46
+ exports.Card = F;
47
+ exports.Flex = S;
48
+ exports.Provider = Nt;
49
+ exports.Text = b;
50
+ exports.Tooltip = x;
51
+ exports.Tour = uo;
52
+ exports.useBoundingClientRect = J;
53
+ exports.useFlow = k;
54
+ exports.useFlowHandlers = R;
55
+ exports.useFrigade = go;
56
+ exports.useModal = q;
57
+ exports.useStepHandlers = D;
58
+ //# sourceMappingURL=out.js.map
3
59
  //# sourceMappingURL=index.cjs.map