Kremta-Website/_astro/ScrollArea.B1KsmG8V.js

2 lines
37 KiB
JavaScript
Raw Normal View History

import{j as h}from"./jsx-runtime.CyXy1Ci3.js";import{r as a}from"./index.CaZlGE7t.js";import{r as Ve}from"./index.CCkGd1JC.js";Ve();function he(e,r){if(typeof e=="function")return e(r);e!=null&&(e.current=r)}function xe(...e){return r=>{let t=!1;const o=e.map(n=>{const s=he(n,r);return!t&&typeof s=="function"&&(t=!0),s});if(t)return()=>{for(let n=0;n<o.length;n++){const s=o[n];typeof s=="function"?s():he(e[n],null)}}}}function H(...e){return a.useCallback(xe(...e),e)}function Ge(e){const r=Fe(e),t=a.forwardRef((o,n)=>{const{children:s,...i}=o,l=a.Children.toArray(s),c=l.find($e);if(c){const d=c.props.children,u=l.map(f=>f===c?a.Children.count(d)>1?a.Children.only(null):a.isValidElement(d)?d.props.children:null:f);return h.jsx(r,{...i,ref:n,children:a.isValidElement(d)?a.cloneElement(d,void 0,u):null})}return h.jsx(r,{...i,ref:n,children:s})});return t.displayName=`${e}.Slot`,t}function Fe(e){const r=a.forwardRef((t,o)=>{const{children:n,...s}=t;if(a.isValidElement(n)){const i=Ye(n),l=Xe(s,n.props);return n.type!==a.Fragment&&(l.ref=o?xe(o,i):i),a.cloneElement(n,l)}return a.Children.count(n)>1?a.Children.only(null):null});return r.displayName=`${e}.SlotClone`,r}var Be=Symbol("radix.slottable");function $e(e){return a.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Be}function Xe(e,r){const t={...r};for(const o in r){const n=e[o],s=r[o];/^on[A-Z]/.test(o)?n&&s?t[o]=(...l)=>{const c=s(...l);return n(...l),c}:n&&(t[o]=n):o==="style"?t[o]={...n,...s}:o==="className"&&(t[o]=[n,s].filter(Boolean).join(" "))}return{...e,...t}}function Ye(e){let r=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,t=r&&"isReactWarning"in r&&r.isReactWarning;return t?e.ref:(r=Object.getOwnPropertyDescriptor(e,"ref")?.get,t=r&&"isReactWarning"in r&&r.isReactWarning,t?e.props.ref:e.props.ref||e.ref)}var qe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Y=qe.reduce((e,r)=>{const t=Ge(`Primitive.${r}`),o=a.forwardRef((n,s)=>{const{asChild:i,...l}=n,c=i?t:r;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),h.jsx(c,{...l,ref:s})});return o.displayName=`Primitive.${r}`,{...e,[r]:o}},{}),se=globalThis?.document?a.useLayoutEffect:()=>{};function Ze(e,r){return a.useReducer((t,o)=>r[t][o]??t,e)}var q=e=>{const{present:r,children:t}=e,o=Je(r),n=typeof t=="function"?t({present:o.isPresent}):a.Children.only(t),s=H(o.ref,Ke(n));return typeof t=="function"||o.isPresent?a.cloneElement(n,{ref:s}):null};q.displayName="Presence";function Je(e){const[r,t]=a.useState(),o=a.useRef(null),n=a.useRef(e),s=a.useRef("none"),i=e?"mounted":"unmounted",[l,c]=Ze(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return a.useEffect(()=>{const d=K(o.current);s.current=l==="mounted"?d:"none"},[l]),se(()=>{const d=o.current,u=n.current;if(u!==e){const p=s.current,b=K(d);e?c("MOUNT"):b==="none"||d?.display==="none"?c("UNMOUNT"):c(u&&p!==b?"ANIMATION_OUT":"UNMOUNT"),n.current=e}},[e,c]),se(()=>{if(r){let d;const u=r.ownerDocument.defaultView??window,f=b=>{const w=K(o.current).includes(CSS.escape(b.animationName));if(b.target===r&&w&&(c("ANIMATION_END"),!n.current)){const v=r.style.animationFillMode;r.style.animationFillMode="forwards",d=u.setTimeout(()=>{r.style.animationFillMode==="forwards"&&(r.style.animationFillMode=v)})}},p=b=>{b.target===r&&(s.current=K(o.current))};return r.addEventListener("animationstart",p),r.addEventListener("animationcancel",f),r.addEventListener("animationend",f),()=>{u.clearTimeout(d),r.removeEventListener("animationstart",p),r.removeEventListener("animationcancel",f),r.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[r,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:a.useCallback(d=>{o.current=d?getComputedStyle(d):null,t(d)},[])}}function K(e){return e?.animationName||"none"}function Ke(e){let r=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,t=r&&"isReactWarning"in r&&r.isReactWarning;return t?e.ref:(r