Module 353068

3,929 characters · in c4498ca49057aa35.js
Dependencies
Required by (2)
Lazily required by (0)none
Lazily requires (0)none
Source Raw
function(e,t,s){"use strict";s.d(t,{kS:()=>m,EN:()=>x});var i=s(197867),l=s(825913),r=s(340287),a=s(64700),o=s(985620),d=s(248215),n=s(3388),u=s(341221),c=s(498430),p=s(492313),h=s(290424),b=s(318473),f=s(561514);let g=(0,a.createContext)(null),v=(0,a.createContext)(null),y=(0,a.createContext)(null),P=(0,a.createContext)(null),x=(0,a.forwardRef)(function(e,t){[e,t]=(0,l.JT)(e,t,v);let s=(0,a.useContext)(g),{id:f,...x}=e,m=(0,o.Bi)();f||(f=m);let S=s?s.expandedKeys.has(f):e.isExpanded,E=function(e){let[t,s]=(0,p.P)(e.isExpanded,e.defaultExpanded||!1,e.onExpandedChange),i=(0,a.useCallback)(()=>{s(!0)},[s]),l=(0,a.useCallback)(()=>{s(!1)},[s]),r=(0,a.useCallback)(()=>{s(!t)},[s,t]);return{isExpanded:t,setExpanded:s,expand:i,collapse:l,toggle:r}}({...e,isExpanded:S,onExpandedChange(t){var i;s&&s.toggleKey(f),null==(i=e.onExpandedChange)||i.call(e,t)}}),w=a.useRef(null),C=e.isDisabled||(null==s?void 0:s.isDisabled)||!1,{buttonProps:D,panelProps:k}=function(e,t,s){let{isDisabled:i}=e,l=(0,o.Bi)(),c=(0,o.Bi)(),p=(0,u.wR)(),h=(0,a.useRef)(null),b=(0,a.useCallback)(()=>{h.current=requestAnimationFrame(()=>{s.current&&s.current.setAttribute("hidden","until-found")}),(0,r.flushSync)(()=>{t.toggle()})},[s,t]);(0,d._)(s,"beforematch",b);let f=(0,a.useRef)(null);return(0,n.N)(()=>{if(h.current&&cancelAnimationFrame(h.current),s.current&&!i&&!p){let e=s.current;null==f.current||"function"!=typeof e.getAnimations?t.isExpanded?(e.removeAttribute("hidden"),e.style.setProperty("--disclosure-panel-width","auto"),e.style.setProperty("--disclosure-panel-height","auto")):(e.setAttribute("hidden","until-found"),e.style.setProperty("--disclosure-panel-width","0px"),e.style.setProperty("--disclosure-panel-height","0px")):t.isExpanded!==f.current&&(t.isExpanded?(e.removeAttribute("hidden"),e.style.setProperty("--disclosure-panel-width",e.scrollWidth+"px"),e.style.setProperty("--disclosure-panel-height",e.scrollHeight+"px"),Promise.all(e.getAnimations().map(e=>e.finished)).then(()=>{e.style.setProperty("--disclosure-panel-width","auto"),e.style.setProperty("--disclosure-panel-height","auto")}).catch(()=>{})):(e.style.setProperty("--disclosure-panel-width",e.scrollWidth+"px"),e.style.setProperty("--disclosure-panel-height",e.scrollHeight+"px"),window.getComputedStyle(e).height,e.style.setProperty("--disclosure-panel-width","0px"),e.style.setProperty("--disclosure-panel-height","0px"),Promise.all(e.getAnimations().map(e=>e.finished)).then(()=>e.setAttribute("hidden","until-found")).catch(()=>{}))),f.current=t.isExpanded}},[i,s,t.isExpanded,p]),(0,a.useEffect)(()=>()=>{h.current&&cancelAnimationFrame(h.current)},[]),{buttonProps:{id:l,"aria-expanded":t.isExpanded,"aria-controls":c,onPress:e=>{i||"keyboard"===e.pointerType||t.toggle()},isDisabled:i,onPressStart(e){"keyboard"!==e.pointerType||i||t.toggle()}},panelProps:{id:c,role:"group","aria-labelledby":l,"aria-hidden":!t.isExpanded,hidden:p||i?i||!t.isExpanded:void 0}}}({...e,isExpanded:S,isDisabled:C},E,w),{isFocusVisible:K,focusProps:A}=(0,c.o)({within:!0}),F=(0,l.Sl)({...e,id:void 0,defaultClassName:"react-aria-Disclosure",values:{isExpanded:E.isExpanded,isDisabled:C,isFocusVisibleWithin:K,state:E}}),T=(0,h.$)(x,{global:!0});return a.createElement(l.Kq,{values:[[i.k,{slots:{[l.P_]:{},trigger:D}}],[P,{panelProps:k,panelRef:w}],[y,E]]},a.createElement("div",{...(0,b.v)(T,F,A),ref:t,"data-expanded":E.isExpanded||void 0,"data-disabled":C||void 0,"data-focus-visible-within":K||void 0},F.children))}),m=(0,a.forwardRef)(function(e,t){let{role:s="group"}=e,{panelProps:r,panelRef:o}=(0,a.useContext)(P),{isFocusVisible:d,focusProps:n}=(0,c.o)({within:!0}),u=(0,l.Sl)({...e,defaultClassName:"react-aria-DisclosurePanel",values:{isFocusVisibleWithin:d}}),p=(0,h.$)(e,{global:!0});return a.createElement("div",{...(0,b.v)(p,u,r,n),ref:(0,f.P)(t,o),role:s,"data-focus-visible-within":d||void 0},a.createElement(l.Kq,{values:[[i.k,null]]},e.children))})}