@verifiedinc-public/shared-ui-elements 5.0.4-beta.0 → 5.1.0

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.
@@ -0,0 +1,2 @@
1
+ import { PropsWithChildren, ReactElement } from 'react';
2
+ export declare function AnimateHeight(props: PropsWithChildren): ReactElement;
@@ -1,2 +1,3 @@
1
1
  export * from './Counter';
2
2
  export * from './motions';
3
+ export * from './AnimatedHeight';
@@ -1 +1 @@
1
- "use strict";import{C as o,M as a,f as s,a as t,d as n,c as i,b as M,e}from"../../shared/motions-BBPeWBPV.mjs";export{o as Counter,a as MotionBox,s as MotionButton,t as MotionStack,n as MotionTableCell,i as MotionTableRow,M as MotionTbody,e as MotionTypography};
1
+ "use strict";import{C as i,M as n,f as r,a as e,d as m,c as l,b as f,e as h}from"../../shared/motions-BBPeWBPV.mjs";import{j as t}from"../../shared/jsx-runtime-DHlBLioN.mjs";import{useRef as p}from"react";import{motion as u}from"framer-motion";import{u as d}from"../../shared/useResizeObserver-D434c1uN.mjs";function M(s){const o=p(null),[,a]=d(o);return t.jsx(u.div,{style:{height:a,transition:"height 75ms ease-out"},children:t.jsx("div",{ref:o,children:s.children})})}export{M as AnimateHeight,i as Counter,n as MotionBox,r as MotionButton,e as MotionStack,m as MotionTableCell,l as MotionTableRow,f as MotionTbody,h as MotionTypography};
@@ -14,3 +14,5 @@ export * from './useIntersectionObserver';
14
14
  export * from './useCounter';
15
15
  export * from './useOnClickOutside';
16
16
  export * from './usePrevious';
17
+ export * from './useResizeObserver';
18
+ export * from './useNavigatorOnline';
@@ -1 +1 @@
1
- "use strict";import{b as s,d as a,a as e,j as u,u as o,e as r,c as i,f as t,g as l,h as c,i as m}from"../shared/useIntersectionObserver-CbpWuEs0.mjs";import{u as p,a as n}from"../shared/useCopyToClipboard-_Ur9Q8Gv.mjs";import{a as d,u as C}from"../shared/useOnClickOutside-P5GTcgh8.mjs";import{u as b}from"../shared/useCounter-BV32zXDQ.mjs";export{s as useCallbackRef,p as useCopyToClipboard,b as useCounter,a as useDebounceValue,e as useDisclosure,u as useIntersectionObserver,o as useLocalStorage,d as useOnClickOutside,n as usePrevious,C as useQRCode,r as useScript,i as useSearchParams,t as useThrottle,l as useToggle,c as useWindowScroll,m as useWindowSize};
1
+ "use strict";import{b as s,d as a,a as e,j as u,u as o,k as r,e as i,c as t,f as l,g as m,h as c,i as n}from"../shared/useNavigatorOnline-LJuH4983.mjs";import{u as p,a as f}from"../shared/useCopyToClipboard-_Ur9Q8Gv.mjs";import{a as b,u as C}from"../shared/useOnClickOutside-P5GTcgh8.mjs";import{u as d}from"../shared/useCounter-BV32zXDQ.mjs";import{u as O}from"../shared/useResizeObserver-D434c1uN.mjs";export{s as useCallbackRef,p as useCopyToClipboard,d as useCounter,a as useDebounceValue,e as useDisclosure,u as useIntersectionObserver,o as useLocalStorage,r as useNavigatorOnline,b as useOnClickOutside,f as usePrevious,C as useQRCode,O as useResizeObserver,i as useScript,t as useSearchParams,l as useThrottle,m as useToggle,c as useWindowScroll,n as useWindowSize};
@@ -0,0 +1,14 @@
1
+ /**
2
+ * A React hook that tracks the browser's online/offline status.
3
+ * Uses the Navigator.onLine property and online/offline events for efficient status tracking.
4
+ * Implements useSyncExternalStore for React 18+ concurrent rendering compatibility.
5
+ *
6
+ * Features:
7
+ * - SSR compatible (defaults to online during server-side rendering)
8
+ * - Updates automatically when network status changes
9
+ * - Type-safe return value
10
+ * - Zero dependencies
11
+ *
12
+ * @returns {boolean} Current online status of the browser
13
+ */
14
+ export declare function useNavigatorOnline(): boolean;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * A React hook that observes and returns the dimensions of a DOM element.
3
+ * Uses ResizeObserver API for efficient size tracking and useSyncExternalStore
4
+ * for React 18+ concurrent rendering compatibility.
5
+ * @param containerRef - React ref object pointing to the DOM element to observe
6
+ * @returns [width, height] - Array containing the current width and height. Returns 'auto' for each dimension if the ref is not yet attached.
7
+ */
8
+ export declare function useResizeObserver(containerRef: React.RefObject<HTMLDivElement>): Array<string | number>;
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- "use strict";import{A as e,c as t,l as r,B as o,n as i,m as n,C as m,D as l,f as u,E as c,j as d,F as p,I as h,b as S,L as g,O as C,h as k,e as f,P,Q as y,R as b,S as B,d as T,k as D,T as I,g as v,a as w,V as O,i as R,o as L,t as M,u as N}from"./shared/index-Cj3wekcx.mjs";import{a as x,b as E,P as Y,S as F}from"./shared/PageSectionHeader-DdpDhBZG.mjs";import{B as G,C as W,i as z,E as A,L as U,j as V,M as H,g as j,O as q,P as Q,R as $,e as J,d as K,S as X,a as Z,b as _,k as aa,c as sa,f as ea,W as ta,l as ra,o as oa,n as ia,p as na,h as ma,m as la,u as ua,q as ca}from"./shared/SignupBigNumbers-8kKjFq0L.mjs";import{b as da,d as pa,a as ha,j as Sa,u as ga,e as Ca,c as ka,f as fa,g as Pa,h as ya,i as ba}from"./shared/useIntersectionObserver-CbpWuEs0.mjs";import{u as Ba,a as Ta}from"./shared/useCopyToClipboard-_Ur9Q8Gv.mjs";import{a as Da,u as Ia}from"./shared/useOnClickOutside-P5GTcgh8.mjs";import{u as va}from"./shared/useCounter-BV32zXDQ.mjs";import{b as wa,a as Oa,v as Ra,e as La,d as Ma,p as Na,u as xa,h as Ea,j as Ya,g as Fa,o as Ga,s as Wa,m as za,c as Aa,l as Ua,n as Va,q as Ha,f as ja,i as qa,r as Qa,z as $a,t as Ja,x as Ka,k as Xa,w as Za,y as _a}from"./shared/shadows-Dhd7FrwF.mjs";import{c as as,g as ss,a as es,p as ts,s as rs,v as os}from"./shared/phone-D5XIxT7-.mjs";import{masks as is}from"./utils/masks/index.mjs";import{toCapitalize as ns,toSentenceCase as ms}from"./utils/string/index.mjs";import{k as ls}from"./shared/formatKebabToPretty-Du43TgPC.mjs";import{M as us,S as cs,U as ds,d as ps,e as hs,f as Ss,g as gs,a as Cs,s as ks}from"./shared/unix.schema-CMYTtXco.mjs";import{p as fs}from"./shared/phone.schema-XBbyizhq.mjs";import{SnackbarProvider as Ps}from"notistack";async function ys(a){try{return[await a,null]}catch(s){return[null,s]}}const bs=a=>a.replace(/(\d{3})-?(\d{2})-?(\d{4})/,"\u2022\u2022\u2022-\u2022\u2022-$3");export{e as AcceptTermsNotice,t as Alert,r as Backdrop,o as Banner,G as BigNumber,i as BrandFilterInput,n as Button,m as CredentialRequestsEditor,W as CustomAlertComponent,l as DateInput,u as DateRangeInput,c as EmailInput,z as EmptyChartSection,A as ErrorCodesChart,d as ExactBirthdayBanner,p as FullWidthAlert,h as Image,S as LegalLink,g as LinkButton,U as LoadingChartSection,us as MaskedAndUnmaskedSSNSchema,V as MetricLastUpdated,H as MonthlySignupsOverviewTable,C as OTPInput,k as OneClickForm,j as OneClickOverTimeChart,q as OneClickPercentageChart,x as PageHeader,E as PageSectionHeader,Y as Paragraph,f as PhoneInput,Q as PieChart,P as PrivacyPolicyNotice,y as QRCodeDisplay,$ as ReasonCodesChart,b as ResendPhoneBanner,J as RiskScoreBarChart,K as RiskScorePieChart,B as SSNInput,cs as SSNSchema,F as SectionHeader,T as SelectInput,X as SeriesChart,Z as SeriesChartLegend,_ as SeriesPercentageChart,aa as SignupBigNumbers,sa as SimpleBarChart,ea as SimpleLegend,Ps as SnackbarProvider,D as TestPhoneNumbersBanner,I as TextButton,v as TimezoneInput,w as Typography,ds as USDateSchema,O as VerifiedImage,R as VerifiedIncLogo,ta as When,wa as black,Oa as blue,Ra as colors,as as countries,La as darkBlue,Ma as darkGreen,Na as darkGrey,xa as darkGreyContrast,Ea as darkRed,Ya as darkYellow,ps as descriptionSchema,hs as emailSchema,Ss as fieldSchema,ra as formatDateMMDDYYYY,oa as formatDateMMYY,ia as formatDateToTimestamp,na as formatExtendedDate,gs as getDateSchemaWithPastValidation,ss as getPhoneData,es as getPhoneDataByFieldName,Cs as getUnixSchema,Fa as green,Ga as grey,Wa as greyContrast,za as infoContrast,ls as kebabCaseToPretty,Aa as lightBlue,Ua as lightGreen,Va as lightGrey,Ha as lightGreyContrast,ja as lightRed,qa as lightYellow,ma as mapMonthlySignupsOverviewTableData,la as mapTimeSeriesData,is as masks,L as omitProperties,ts as parseToPhoneNational,fs as phoneSchema,Qa as red,$a as shadows,rs as sortByCountryName,bs as ssnFormatter,ks as stateSchema,Ja as textDisabled,Ka as theme,ns as toCapitalize,M as toOption,ms as toSentenceCase,N as useBrandFilterInput,da as useCallbackRef,Ba as useCopyToClipboard,va as useCounter,pa as useDebounceValue,ha as useDisclosure,Sa as useIntersectionObserver,ga as useLocalStorage,Da as useOnClickOutside,Ta as usePrevious,Ia as useQRCode,Ca as useScript,ka as useSearchParams,ua as useSnackbar,fa as useThrottle,Pa as useToggle,ya as useWindowScroll,ba as useWindowSize,ca as uuidToHashedColor,os as validatePhone,Xa as warningContrast,Za as white,ys as wrapPromise,_a as yellow};
1
+ "use strict";import{A as e,c as t,l as r,B as o,n as i,m as n,C as m,D as l,f as u,E as c,j as p,F as d,I as h,b as S,L as g,O as C,h as f,e as k,P,Q as y,R as b,S as B,d as D,k as T,T as v,g as I,a as O,V as R,i as w,o as N,t as L,u as M}from"./shared/index-Cj3wekcx.mjs";import{a as E,b as Y,P as x,S as F}from"./shared/PageSectionHeader-DdpDhBZG.mjs";import{B as z,C as G,i as W,E as A,L as U,j,M as H,g as V,O as q,P as Q,R as $,e as J,d as K,S as X,a as Z,b as _,k as aa,c as sa,f as ea,W as ta,l as ra,o as oa,n as ia,p as na,h as ma,m as la,u as ua,q as ca}from"./shared/SignupBigNumbers-8kKjFq0L.mjs";import{b as pa,d as da,a as ha,j as Sa,u as ga,k as Ca,e as fa,c as ka,f as Pa,g as ya,h as ba,i as Ba}from"./shared/useNavigatorOnline-LJuH4983.mjs";import{u as Da,a as Ta}from"./shared/useCopyToClipboard-_Ur9Q8Gv.mjs";import{a as va,u as Ia}from"./shared/useOnClickOutside-P5GTcgh8.mjs";import{u as Oa}from"./shared/useCounter-BV32zXDQ.mjs";import{u as Ra}from"./shared/useResizeObserver-D434c1uN.mjs";import{b as wa,a as Na,v as La,e as Ma,d as Ea,p as Ya,u as xa,h as Fa,j as za,g as Ga,o as Wa,s as Aa,m as Ua,c as ja,l as Ha,n as Va,q as qa,f as Qa,i as $a,r as Ja,z as Ka,t as Xa,x as Za,k as _a,w as as,y as ss}from"./shared/shadows-Dhd7FrwF.mjs";import{c as es,g as ts,a as rs,p as os,s as is,v as ns}from"./shared/phone-D5XIxT7-.mjs";import{masks as ms}from"./utils/masks/index.mjs";import{toCapitalize as ls,toSentenceCase as us}from"./utils/string/index.mjs";import{k as cs}from"./shared/formatKebabToPretty-Du43TgPC.mjs";import{M as ps,S as ds,U as hs,d as Ss,e as gs,f as Cs,g as fs,a as ks,s as Ps}from"./shared/unix.schema-CMYTtXco.mjs";import{p as ys}from"./shared/phone.schema-XBbyizhq.mjs";import{SnackbarProvider as bs}from"notistack";async function Bs(a){try{return[await a,null]}catch(s){return[null,s]}}const Ds=a=>a.replace(/(\d{3})-?(\d{2})-?(\d{4})/,"\u2022\u2022\u2022-\u2022\u2022-$3");export{e as AcceptTermsNotice,t as Alert,r as Backdrop,o as Banner,z as BigNumber,i as BrandFilterInput,n as Button,m as CredentialRequestsEditor,G as CustomAlertComponent,l as DateInput,u as DateRangeInput,c as EmailInput,W as EmptyChartSection,A as ErrorCodesChart,p as ExactBirthdayBanner,d as FullWidthAlert,h as Image,S as LegalLink,g as LinkButton,U as LoadingChartSection,ps as MaskedAndUnmaskedSSNSchema,j as MetricLastUpdated,H as MonthlySignupsOverviewTable,C as OTPInput,f as OneClickForm,V as OneClickOverTimeChart,q as OneClickPercentageChart,E as PageHeader,Y as PageSectionHeader,x as Paragraph,k as PhoneInput,Q as PieChart,P as PrivacyPolicyNotice,y as QRCodeDisplay,$ as ReasonCodesChart,b as ResendPhoneBanner,J as RiskScoreBarChart,K as RiskScorePieChart,B as SSNInput,ds as SSNSchema,F as SectionHeader,D as SelectInput,X as SeriesChart,Z as SeriesChartLegend,_ as SeriesPercentageChart,aa as SignupBigNumbers,sa as SimpleBarChart,ea as SimpleLegend,bs as SnackbarProvider,T as TestPhoneNumbersBanner,v as TextButton,I as TimezoneInput,O as Typography,hs as USDateSchema,R as VerifiedImage,w as VerifiedIncLogo,ta as When,wa as black,Na as blue,La as colors,es as countries,Ma as darkBlue,Ea as darkGreen,Ya as darkGrey,xa as darkGreyContrast,Fa as darkRed,za as darkYellow,Ss as descriptionSchema,gs as emailSchema,Cs as fieldSchema,ra as formatDateMMDDYYYY,oa as formatDateMMYY,ia as formatDateToTimestamp,na as formatExtendedDate,fs as getDateSchemaWithPastValidation,ts as getPhoneData,rs as getPhoneDataByFieldName,ks as getUnixSchema,Ga as green,Wa as grey,Aa as greyContrast,Ua as infoContrast,cs as kebabCaseToPretty,ja as lightBlue,Ha as lightGreen,Va as lightGrey,qa as lightGreyContrast,Qa as lightRed,$a as lightYellow,ma as mapMonthlySignupsOverviewTableData,la as mapTimeSeriesData,ms as masks,N as omitProperties,os as parseToPhoneNational,ys as phoneSchema,Ja as red,Ka as shadows,is as sortByCountryName,Ds as ssnFormatter,Ps as stateSchema,Xa as textDisabled,Za as theme,ls as toCapitalize,L as toOption,us as toSentenceCase,M as useBrandFilterInput,pa as useCallbackRef,Da as useCopyToClipboard,Oa as useCounter,da as useDebounceValue,ha as useDisclosure,Sa as useIntersectionObserver,ga as useLocalStorage,Ca as useNavigatorOnline,va as useOnClickOutside,Ta as usePrevious,Ia as useQRCode,Ra as useResizeObserver,fa as useScript,ka as useSearchParams,ua as useSnackbar,Pa as useThrottle,ya as useToggle,ba as useWindowScroll,Ba as useWindowSize,ca as uuidToHashedColor,ns as validatePhone,_a as warningContrast,as as white,Bs as wrapPromise,ss as yellow};
@@ -0,0 +1 @@
1
+ "use strict";import{useRef as y,useInsertionEffect as C,useCallback as w,useState as d,useId as x,useEffect as g,useLayoutEffect as I,useSyncExternalStore as A}from"react";function k(e){return{set:r=>{const o=typeof r=="string"?r:JSON.stringify(r);localStorage.setItem(e,o)},get:()=>{const r=localStorage.getItem(e);if(r)try{return JSON.parse(r)}catch{return r}return null},remove:()=>{localStorage.removeItem(e)}}}function E(e,r=[]){const o=y(()=>{throw new Error("Cannot call an event handler while rendering.")});return C(()=>{o.current=e}),w((...t)=>{var i;return(i=o.current)==null?void 0:i.call(o,...t)},r)}function z(e={}){const{onClose:r,onOpen:o,open:t,id:i}=e,n=E(o),s=E(r),[a,l]=d(e.defaultOpen??!1),c=t??a,u=t!==void 0,m=x(),f=i??`disclosure-${m}`,h=w(()=>{u||l(!1),s?.()},[u,s]),p=w(()=>{u||l(!0),n?.()},[u,n]),b=w(()=>{c?h():p()},[c,p,h]);function S(v={}){return{...v,"aria-expanded":c,"aria-controls":f,onClick(O){var L;(L=v.onClick)==null||L.call(v,O),b()}}}function T(v={}){return{...v,hidden:!c,id:f}}return{open:c,onOpen:p,onClose:h,onToggle:b,isControlled:u,getButtonProps:S,getDisclosureProps:T}}function D(e){return new URLSearchParams(e??window.location.search)}function P(e,r=250){const[o,t]=d(e);return g(()=>{const i=setTimeout(()=>{t(e)},r);return()=>{clearTimeout(i)}},[e,r]),o}function W(e,r={removeOnUnmount:!1}){const[o,t]=d("loading"),i=y(r);return g(()=>{let n=document.querySelector(`script[src="${e}"]`);const s=n?.getAttribute("data-status");if(s){t(s);return}if(n===null){n=document.createElement("script"),n.src=e,n.async=!0,n.setAttribute("data-status","loading"),document.body.appendChild(n);const a=()=>{n?.setAttribute("data-status","ready"),t("ready"),c()},l=()=>{n?.setAttribute("data-status","error"),t("error"),c()},c=()=>{n?.removeEventListener("load",a),n?.removeEventListener("error",l)};n.addEventListener("load",a),n.addEventListener("error",l);const u=i.current.removeOnUnmount;return()=>{u&&(n?.remove(),c())}}else t("unknown")},[e]),o}function j(e,r=500){const[o,t]=d(e),i=y(Date.now());return g(()=>{const n=Date.now(),s=n-i.current;if(s>=r)i.current=n,t(e);else{const a=r-s,l=window.setTimeout(()=>{i.current=Date.now(),t(e)},a);return()=>{window.clearTimeout(l)}}},[e,r]),o}function U(e){const[r,o]=d(()=>typeof e=="boolean"?e:!!e),t=w(i=>{if(typeof i=="boolean"){o(i);return}o(n=>!n)},[]);return[r,t]}function H(){const[e,r]=d({x:0,y:0}),o=w((...t)=>{if(t.length===1&&typeof t[0]=="object")window.scrollTo(t[0]);else if(t.length===2)window.scrollTo(t[0],t[1]);else throw new Error("Invalid arguments passed to scrollTo. Expected either ScrollToOptions object or x,y coordinates. See https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo")},[]);return I(()=>{const t=()=>{r({x:window.scrollX,y:window.scrollY})};return t(),window.addEventListener("scroll",t),()=>{window.removeEventListener("scroll",t)}},[]),{...e,scrollTo:o}}function J(){const[e,r]=d({width:window.innerWidth,height:window.innerHeight});return I(()=>{const o=()=>{r({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener("resize",o),()=>{window.removeEventListener("resize",o)}},[]),e}function N(e,{threshold:r=0,root:o=null,rootMargin:t="0%",freezeOnceVisible:i=!1}={}){const[n,s]=d({isIntersecting:!1,entry:null});return g(()=>{const a=e?.current;let l;if(a){if(i&&n.isIntersecting)return;const c=m=>{const[f]=m;s({isIntersecting:f.isIntersecting,entry:f})},u=new IntersectionObserver(c,{threshold:r,root:o,rootMargin:t});u.observe(a),l=()=>{u.disconnect()}}return()=>{l&&l()}},[e,r,o,t,i,n.isIntersecting]),n}function $(){return A(e=>typeof window>"u"?()=>{}:(window.addEventListener("online",e),window.addEventListener("offline",e),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",e)}),()=>typeof navigator>"u"?!0:navigator.onLine,()=>!0)}export{z as a,E as b,D as c,P as d,W as e,j as f,U as g,H as h,J as i,N as j,$ as k,k as u};
@@ -0,0 +1 @@
1
+ "use strict";import{useRef as i,useSyncExternalStore as c}from"react";function s(n){const e=i(["auto","auto"]);return c(t=>{if(typeof window>"u"||typeof ResizeObserver>"u")return()=>{};if(!n.current)return()=>{};const r=new ResizeObserver(t);return r.observe(n.current),()=>{r.disconnect()}},()=>{var t;if(typeof window>"u")return e.current;const r=(t=n.current)==null?void 0:t.getBoundingClientRect(),u=r?.width??"auto",o=r?.height??"auto";return(e.current[0]!==u||e.current[1]!==o)&&(e.current=[u,o]),e.current},()=>e.current)}export{s as u};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verifiedinc-public/shared-ui-elements",
3
- "version": "5.0.4-beta.0",
3
+ "version": "5.1.0",
4
4
  "description": "A set of UI components, utilities that is shareable with the core apps.",
5
5
  "private": false,
6
6
  "keywords": [],
@@ -1 +0,0 @@
1
- "use strict";import{useRef as y,useInsertionEffect as C,useCallback as w,useState as d,useId as x,useEffect as h,useLayoutEffect as S}from"react";function A(e){return{set:r=>{const o=typeof r=="string"?r:JSON.stringify(r);localStorage.setItem(e,o)},get:()=>{const r=localStorage.getItem(e);if(r)try{return JSON.parse(r)}catch{return r}return null},remove:()=>{localStorage.removeItem(e)}}}function b(e,r=[]){const o=y(()=>{throw new Error("Cannot call an event handler while rendering.")});return C(()=>{o.current=e}),w((...t)=>{var s;return(s=o.current)==null?void 0:s.call(o,...t)},r)}function k(e={}){const{onClose:r,onOpen:o,open:t,id:s}=e,n=b(o),i=b(r),[a,l]=d(e.defaultOpen??!1),c=t??a,u=t!==void 0,m=x(),f=s??`disclosure-${m}`,v=w(()=>{u||l(!1),i?.()},[u,i]),p=w(()=>{u||l(!0),n?.()},[u,n]),E=w(()=>{c?v():p()},[c,p,v]);function T(g={}){return{...g,"aria-expanded":c,"aria-controls":f,onClick(O){var I;(I=g.onClick)==null||I.call(g,O),E()}}}function L(g={}){return{...g,hidden:!c,id:f}}return{open:c,onOpen:p,onClose:v,onToggle:E,isControlled:u,getButtonProps:T,getDisclosureProps:L}}function z(e){return new URLSearchParams(e??window.location.search)}function D(e,r=250){const[o,t]=d(e);return h(()=>{const s=setTimeout(()=>{t(e)},r);return()=>{clearTimeout(s)}},[e,r]),o}function P(e,r={removeOnUnmount:!1}){const[o,t]=d("loading"),s=y(r);return h(()=>{let n=document.querySelector(`script[src="${e}"]`);const i=n?.getAttribute("data-status");if(i){t(i);return}if(n===null){n=document.createElement("script"),n.src=e,n.async=!0,n.setAttribute("data-status","loading"),document.body.appendChild(n);const a=()=>{n?.setAttribute("data-status","ready"),t("ready"),c()},l=()=>{n?.setAttribute("data-status","error"),t("error"),c()},c=()=>{n?.removeEventListener("load",a),n?.removeEventListener("error",l)};n.addEventListener("load",a),n.addEventListener("error",l);const u=s.current.removeOnUnmount;return()=>{u&&(n?.remove(),c())}}else t("unknown")},[e]),o}function W(e,r=500){const[o,t]=d(e),s=y(Date.now());return h(()=>{const n=Date.now(),i=n-s.current;if(i>=r)s.current=n,t(e);else{const a=r-i,l=window.setTimeout(()=>{s.current=Date.now(),t(e)},a);return()=>{window.clearTimeout(l)}}},[e,r]),o}function j(e){const[r,o]=d(()=>typeof e=="boolean"?e:!!e),t=w(s=>{if(typeof s=="boolean"){o(s);return}o(n=>!n)},[]);return[r,t]}function U(){const[e,r]=d({x:0,y:0}),o=w((...t)=>{if(t.length===1&&typeof t[0]=="object")window.scrollTo(t[0]);else if(t.length===2)window.scrollTo(t[0],t[1]);else throw new Error("Invalid arguments passed to scrollTo. Expected either ScrollToOptions object or x,y coordinates. See https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo")},[]);return S(()=>{const t=()=>{r({x:window.scrollX,y:window.scrollY})};return t(),window.addEventListener("scroll",t),()=>{window.removeEventListener("scroll",t)}},[]),{...e,scrollTo:o}}function H(){const[e,r]=d({width:window.innerWidth,height:window.innerHeight});return S(()=>{const o=()=>{r({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener("resize",o),()=>{window.removeEventListener("resize",o)}},[]),e}function N(e,{threshold:r=0,root:o=null,rootMargin:t="0%",freezeOnceVisible:s=!1}={}){const[n,i]=d({isIntersecting:!1,entry:null});return h(()=>{const a=e?.current;let l;if(a){if(s&&n.isIntersecting)return;const c=m=>{const[f]=m;i({isIntersecting:f.isIntersecting,entry:f})},u=new IntersectionObserver(c,{threshold:r,root:o,rootMargin:t});u.observe(a),l=()=>{u.disconnect()}}return()=>{l&&l()}},[e,r,o,t,s,n.isIntersecting]),n}export{k as a,b,z as c,D as d,P as e,W as f,j as g,U as h,H as i,N as j,A as u};