@protonradio/proton-ui 0.7.5-beta14 → 0.7.5-beta15

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.js CHANGED
@@ -44,5 +44,5 @@ React keys must be passed directly to JSX without using spread:
44
44
  *
45
45
  * This source code is licensed under the MIT license found in the
46
46
  * LICENSE file in the root directory of this source tree.
47
- */var ti;function Pv(){return ti||(ti=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var t=a,e=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function n(x){{for(var k=arguments.length,P=new Array(k>1?k-1:0),T=1;T<k;T++)P[T-1]=arguments[T];r("error",x,P)}}function r(x,k,P){{var T=e.ReactDebugCurrentFrame,F=T.getStackAddendum();F!==""&&(k+="%s",P=P.concat([F]));var h=P.map(function(B){return String(B)});h.unshift("Warning: "+k),Function.prototype.apply.call(console[x],console,h)}}function l(x,k){return x===k&&(x!==0||1/x===1/k)||x!==x&&k!==k}var i=typeof Object.is=="function"?Object.is:l,o=t.useState,u=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue,d=!1,f=!1;function p(x,k,P){d||t.startTransition!==void 0&&(d=!0,n("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var T=k();if(!f){var F=k();i(T,F)||(n("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}var h=o({inst:{value:T,getSnapshot:k}}),B=h[0].inst,S=h[1];return s(function(){B.value=T,B.getSnapshot=k,v(B)&&S({inst:B})},[x,T,k]),u(function(){v(B)&&S({inst:B});var w=function(){v(B)&&S({inst:B})};return x(w)},[x]),c(T),T}function v(x){var k=x.getSnapshot,P=x.value;try{var T=k();return!i(P,T)}catch{return!0}}function b(x,k,P){return k()}var $=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",y=!$,C=y?b:p,D=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:C;Qn.useSyncExternalStore=D,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),Qn}process.env.NODE_ENV==="production"?Cr.exports=wv():Cr.exports=Pv();var Dv=Cr.exports;const Na=a.createContext(!1),Ot=a.createContext(null);function kv(t){if(a.useContext(Ot))return t.content;let{collection:n,document:r}=Kv(t.createCollection);return a.createElement(a.Fragment,null,a.createElement(Cv,null,a.createElement(Ot.Provider,{value:r},t.content)),a.createElement(Tv,{render:t.children,collection:n}))}function Tv({collection:t,render:e}){return e(t)}function Av(t,e,n){let r=Xe(),l=a.useRef(r);l.current=r;let i=a.useCallback(()=>l.current?n():e(),[e,n]);return Dv.useSyncExternalStore(t,i)}const Bv=typeof a.useSyncExternalStore=="function"?a.useSyncExternalStore:Av;function Kv(t){let[e]=a.useState(()=>new xv((t==null?void 0:t())||new $v)),n=a.useCallback(o=>e.subscribe(o),[e]),r=a.useCallback(()=>{let o=e.getCollection();return e.isSSR&&e.resetAfterSSR(),o},[e]),l=a.useCallback(()=>(e.isSSR=!0,e.getCollection()),[e]),i=Bv(n,r,l);return W(()=>(e.isMounted=!0,()=>{e.isMounted=!1}),[e]),{collection:i,document:e}}const Sr=a.createContext(null);function Mv(t,e,n,r,l,i){let o=a.useCallback(s=>{s==null||s.setProps(e,n,r,i)},[e,n,r,i]),u=a.useContext(Sr);if(u){let s=u.ownerDocument.nodesByProps.get(e);return s||(s=u.ownerDocument.createElement(t),s.setProps(e,n,r,i),u.appendChild(s),u.ownerDocument.updateCollection(),u.ownerDocument.nodesByProps.set(e,s)),l?a.createElement(Sr.Provider,{value:s},l):null}return a.createElement(t,{ref:o},l)}function Rv(t,e){let n=({node:l})=>e(l.props,l.props.ref,l),r=a.forwardRef((l,i)=>{if(!a.useContext(Na)){if(e.length>=3)throw new Error(e.name+" cannot be rendered outside a collection.");return e(l,i)}return Mv(t,l,i,"children"in l?l.children:null,null,u=>a.createElement(n,{node:u}))});return r.displayName=e.name,r}function Iv(t){return _a({...t,addIdAndValue:!0})}const ni=a.createContext(null);function Fv(t){let e=a.useContext(ni),n=((e==null?void 0:e.dependencies)||[]).concat(t.dependencies),r=t.idScope||(e==null?void 0:e.idScope),l=Iv({...t,idScope:r,dependencies:n});return a.useContext(Ot)&&(l=a.createElement(_v,null,l)),e=a.useMemo(()=>({dependencies:n,idScope:r}),[r,...n]),a.createElement(ni.Provider,{value:e},l)}function _v({children:t}){let e=a.useContext(Ot),n=a.useMemo(()=>a.createElement(Ot.Provider,{value:null},a.createElement(Na.Provider,{value:!0},t)),[t]);return Xe()?a.createElement(Sr.Provider,{value:e},n):it.createPortal(n,e)}const Nv=a.createContext(null),Lv={CollectionRoot({collection:t,renderDropIndicator:e}){return ri(t,null,e)},CollectionBranch({collection:t,parent:e,renderDropIndicator:n}){return ri(t,e,n)}};function ri(t,e,n){return _a({items:e?t.getChildren(e.key):t,dependencies:[n],children(r){var l;let i=r.render(r);if(!n||r.type!=="item")return i;let o=r.key,u=t.getKeyAfter(o);return a.createElement(a.Fragment,null,n({type:"item",key:o,dropPosition:"before"}),i,(u==null||((l=t.getItem(u))===null||l===void 0?void 0:l.type)!=="item")&&n({type:"item",key:o,dropPosition:"after"}))}})}const La=a.createContext(Lv);function Ov(t){return a.useMemo(()=>t!=null?new Set([t]):null,[t])}const li=Symbol("default");function Tn({values:t,children:e}){for(let[n,r]of t)e=a.createElement(n.Provider,{value:r},e);return e}function Ct(t){let{className:e,style:n,children:r,defaultClassName:l,defaultChildren:i,defaultStyle:o,values:u}=t;return a.useMemo(()=>{let s,c,d;return typeof e=="function"?s=e({...u,defaultClassName:l}):s=e,typeof n=="function"?c=n({...u,defaultStyle:o||{}}):c=n,typeof r=="function"?d=r({...u,defaultChildren:i}):r==null?d=i:d=r,{className:s??l,style:c||o?{...o,...c}:void 0,children:d??i,"data-rac":""}},[e,n,r,l,i,o,u])}function Oa(t,e){let n=a.useContext(t);if(e===null)return null;if(n&&typeof n=="object"&&"slots"in n&&n.slots){let r=new Intl.ListFormat().format(Object.keys(n.slots).map(i=>`"${i}"`));if(!e&&!n.slots[li])throw new Error(`A slot prop is required. Valid slot names are ${r}.`);let l=e||li;if(!n.slots[l])throw new Error(`Invalid slot "${e}". Valid slot names are ${r}.`);return n.slots[l]}return n}function Ht(t,e,n){let r=Oa(n,t.slot)||{},{ref:l,...i}=r,o=mn(a.useMemo(()=>Ic(e,l),[e,l])),u=z(i,t);return"style"in i&&i.style&&"style"in t&&t.style&&(typeof i.style=="function"||typeof t.style=="function"?u.style=s=>{let c=typeof i.style=="function"?i.style(s):i.style,d={...s.defaultStyle,...c},f=typeof t.style=="function"?t.style({...s,defaultStyle:d}):t.style;return{...d,...f}}:u.style={...i.style,...t.style}),[u,o]}function zv(){let[t,e]=a.useState(!0),n=a.useRef(!1),r=a.useCallback(l=>{n.current=!0,e(!!l)},[]);return W(()=>{n.current||e(!1)},[]),[r,t]}function jv(t,e=!0){let[n,r]=a.useState(!0);return za(t,n&&e,a.useCallback(()=>r(!1),[])),n&&e}function Vv(t,e){let[n,r]=a.useState(!1),[l,i]=a.useState("idle");return!e&&t.current&&l==="idle"&&(n=!0,r(!0),i("exiting")),!t.current&&l==="exited"&&i("idle"),za(t,n,a.useCallback(()=>{i("exited"),r(!1)},[])),n}function za(t,e,n){let r=a.useRef(null);e&&t.current&&(r.current=window.getComputedStyle(t.current).animation),W(()=>{if(e&&t.current){let l=window.getComputedStyle(t.current);if(l.animationName&&l.animationName!=="none"&&l.animation!==r.current){let i=u=>{u.target===t.current&&(o.removeEventListener("animationend",i),it.flushSync(()=>{n()}))},o=t.current;return o.addEventListener("animationend",i),()=>{o.removeEventListener("animationend",i)}}else n()}},[t,e,n])}const Hv=a.createContext(null),Uv=new Set(["form","formAction","formEncType","formMethod","formNoValidate","formTarget","name","value"]),Wv=a.createContext({});function Gv(t,e){[t,e]=Ht(t,e,Wv),t=Yv(t);let n=t,{isPending:r}=n,{buttonProps:l,isPressed:i}=Sn(t,e),{focusProps:o,isFocused:u,isFocusVisible:s}=Vt(t),{hoverProps:c,isHovered:d}=xt({...t,isDisabled:t.isDisabled||r}),f={isHovered:d,isPressed:(n.isPressed||i)&&!r,isFocused:u,isFocusVisible:s,isDisabled:t.isDisabled||!1,isPending:r??!1},p=Ct({...t,values:f,defaultClassName:"react-aria-Button"}),v=ae(l.id),b=ae(),$=l["aria-labelledby"];r&&($?$=`${$} ${b}`:l["aria-label"]&&($=`${v} ${b}`));let y=a.useRef(r);return a.useEffect(()=>{let C={"aria-labelledby":$||v};(!y.current&&u&&r||y.current&&u&&!r)&&dn(C,"assertive"),y.current=r},[r,u,$,v]),a.createElement("button",{...oe(t,{propNames:Uv}),...z(l,o,c),...p,id:v,ref:e,"aria-labelledby":$,slot:t.slot||void 0,"aria-disabled":r?"true":l["aria-disabled"],"data-disabled":t.isDisabled||void 0,"data-pressed":f.isPressed||void 0,"data-hovered":d||void 0,"data-focused":u||void 0,"data-pending":r||void 0,"data-focus-visible":s||void 0},a.createElement(Hv.Provider,{value:{id:b}},p.children))}function Yv(t){return t.isPending&&(t.onPress=void 0,t.onPressStart=void 0,t.onPressEnd=void 0,t.onPressChange=void 0,t.onPressUp=void 0,t.onKeyDown=void 0,t.onKeyUp=void 0,t.onClick=void 0,t.href=void 0),t}const ja=Sv(Gv),qv=a.createContext({}),Xv=a.createContext({}),Zv=a.createContext({}),Va=a.createContext({placement:"bottom"});function Jv(t,e){[t,e]=Ht(t,e,Va);let n=t.placement,r={position:"absolute",[n]:"100%",transform:n==="top"||n==="bottom"?"translateX(-50%)":"translateY(-50%)"},l=Ct({...t,defaultClassName:"react-aria-OverlayArrow",values:{placement:n}});return l.style&&Object.keys(l.style).forEach(i=>l.style[i]===void 0&&delete l.style[i]),a.createElement("div",{...t,...l,style:{...r,...l.style},ref:e,"data-placement":n})}const Qv=a.forwardRef(Jv),wr=a.createContext(null),eh=a.createContext(null),th=a.createContext({}),Ha=a.createContext(null),Jr=a.createContext(null),Ua=a.createContext(null);function nh(t){let e=Mp(t),n=a.useRef(null),{menuTriggerProps:r,menuProps:l}=hu({...t,type:"menu"},e,n),[i,o]=a.useState(null),u=a.useCallback(()=>{n.current&&o(n.current.offsetWidth+"px")},[n]);nr({ref:n,onResize:u});let s=a.useRef(null);return a.createElement(Tn,{values:[[Ha,{...l,ref:s}],[eh,e],[Ua,e],[wr,{trigger:"MenuTrigger",triggerRef:n,scrollRef:s,placement:"bottom start",style:{"--trigger-width":i}}]]},a.createElement(dd,{...r,ref:n,isPressed:e.isOpen},t.children))}const rh=a.createContext(null);function lh(t,e){return[t,e]=Ht(t,e,Ha),a.createElement(kv,{content:a.createElement(Fv,t)},n=>n.size>0&&a.createElement(ih,{props:t,collection:n,menuRef:e}))}function ih({props:t,collection:e,menuRef:n}){let r=Aa({...t,collection:e,children:void 0}),[l,i]=a.useState(null),{isVirtualized:o,CollectionRoot:u}=a.useContext(La),{menuProps:s}=bu({...t,isVirtualized:o},r,n),c=a.useContext(Ua),d=a.useContext(wr),f=(d==null?void 0:d.trigger)==="SubmenuTrigger";Pi({ref:n,onInteractOutside:y=>{c&&!(l!=null&&l.contains(y.target))&&c.close()},isDisabled:f||(c==null?void 0:c.expandedKeysStack.length)===0});let p=a.useRef(null),[v,b]=a.useState({left:0});a.useEffect(()=>{if(l&&p.current!==l&&v.left===0){p.current=l;let{left:y}=l.getBoundingClientRect();b({left:-1*y})}},[v,l]);let $=Ct({defaultClassName:"react-aria-Menu",className:t.className,style:t.style,values:{}});return a.createElement(xn,null,a.createElement("div",{...oe(t),...s,...$,ref:n,slot:t.slot||void 0,onScroll:t.onScroll},a.createElement(Tn,{values:[[Jr,r],[Zv,{elementType:"div"}],[wr,{UNSTABLE_portalContainer:l||void 0}],[Nv,{render:uh}],[rh,{parentMenuRef:n}],[Pr,null]]},a.createElement(u,{collection:e,persistedKeys:Ov(r.selectionManager.focusedKey),scrollRef:n}))),a.createElement("div",{ref:i,style:{width:"100vw",position:"absolute",top:0,...v}}))}const oh=a.forwardRef(lh);function uh(t,e,n){var r,l;let i=a.useContext(Jr),{CollectionBranch:o}=a.useContext(La),[u,s]=zv();var c;let{headingProps:d,groupProps:f}=Uf({heading:s,"aria-label":(c=n.props["aria-label"])!==null&&c!==void 0?c:void 0}),p=Ct({defaultClassName:"react-aria-Section",className:(r=n.props)===null||r===void 0?void 0:r.className,style:(l=n.props)===null||l===void 0?void 0:l.style,values:{}});return a.createElement("section",{...oe(t),...f,...p,ref:e},a.createElement(Xv.Provider,{value:{...d,ref:u}},a.createElement(o,{collection:i.collection,parent:n})))}const Pr=a.createContext(null),sh=Rv("item",function(e,n,r){var l;[e,n]=Ht(e,n,Pr);let i=(l=Oa(Pr))===null||l===void 0?void 0:l.id,o=a.useContext(Jr),u=mn(n),{menuItemProps:s,labelProps:c,descriptionProps:d,keyboardShortcutProps:f,...p}=gu({...e,id:i,key:r.key},o,u),{isFocusVisible:v,focusProps:b}=Vt(),{hoverProps:$,isHovered:y}=xt({isDisabled:p.isDisabled}),C=Ct({...e,id:void 0,children:r.rendered,defaultClassName:"react-aria-MenuItem",values:{...p,isHovered:y,isFocusVisible:v,selectionMode:o.selectionManager.selectionMode,selectionBehavior:o.selectionManager.selectionBehavior,hasSubmenu:!!e["aria-haspopup"],isOpen:e["aria-expanded"]==="true"}}),D=e.href?"a":"div";return a.createElement(D,{...z(s,b,$),...C,ref:u,"data-disabled":p.isDisabled||void 0,"data-hovered":y||void 0,"data-focused":p.isFocused||void 0,"data-focus-visible":v||void 0,"data-pressed":p.isPressed||void 0,"data-selected":p.isSelected||void 0,"data-selection-mode":o.selectionManager.selectionMode==="none"?void 0:o.selectionManager.selectionMode,"data-has-submenu":!!e["aria-haspopup"]||void 0,"data-open":e["aria-expanded"]==="true"||void 0},a.createElement(Tn,{values:[[qv,{slots:{label:c,description:d}}],[th,f]]},C.children))}),Qr=a.createContext(null),Wa=a.createContext(null);function ah(t){let e=Ta(t),n=a.useRef(null),{triggerProps:r,tooltipProps:l}=Tp(t,e,n);return a.createElement(Tn,{values:[[Qr,e],[Wa,{...l,triggerRef:n}]]},a.createElement(Id,{...r,ref:n},t.children))}function ch({UNSTABLE_portalContainer:t,...e},n){[e,n]=Ht(e,n,Wa);let r=a.useContext(Qr),l=Ta(e),i=e.isOpen!=null||e.defaultOpen!=null||!r?l:r,o=Vv(n,i.isOpen)||e.isExiting||!1;return!i.isOpen&&!o?null:a.createElement(wf,{portalContainer:t},a.createElement(fh,{...e,tooltipRef:n,isExiting:o}))}const dh=a.forwardRef(ch);function fh(t){let e=a.useContext(Qr),n=a.useRef(null),[r,l]=a.useState(0);W(()=>{n.current&&e.isOpen&&l(n.current.getBoundingClientRect().width)},[e.isOpen,n]);let{overlayProps:i,arrowProps:o,placement:u}=ji({placement:t.placement||"top",targetRef:t.triggerRef,overlayRef:t.tooltipRef,offset:t.offset,crossOffset:t.crossOffset,isOpen:e.isOpen,arrowSize:r,arrowBoundaryOffset:t.arrowBoundaryOffset,shouldFlip:t.shouldFlip}),s=jv(t.tooltipRef,!!u)||t.isEntering||!1,c=Ct({...t,defaultClassName:"react-aria-Tooltip",values:{placement:u,isEntering:s,isExiting:t.isExiting,state:e}});t=z(t,i);let{tooltipProps:d}=kp(t,e);return a.createElement("div",{...d,ref:t.tooltipRef,...c,style:{...i.style,...c.style},"data-placement":u,"data-entering":s||void 0,"data-exiting":t.isExiting||void 0},a.createElement(Va.Provider,{value:{...o,placement:u,ref:n}},c.children))}function Ga(t,e="down"){const n=e==="down"?`(max-width: ${t}px)`:`(min-width: ${t}px)`,[r,l]=a.useState(()=>typeof window<"u"?window.matchMedia(n).matches:!1);return a.useEffect(()=>{if(typeof window>"u")return;const i=window.matchMedia(n),o=u=>{l(u.matches)};return i.addEventListener("change",o),()=>i.removeEventListener("change",o)},[n]),r}const ph=({size:t})=>g.jsx("svg",{viewBox:"0 0 24 24",width:t,height:t,children:g.jsx("path",{fill:"currentColor",d:"M4 14c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm8 0c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm8 0c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z"})});function vh({renderTrigger:t,menuId:e,size:n=24,actions:r,disabled:l,onClose:i,testId:o,menuTestId:u}){const{className:s}=Ce(),c=Ga(Ie.BREAKPOINTS.SMALL),[d,f]=a.useState(!1),p=a.useRef(null),v={disabled:l,"data-testid":o,"aria-label":"Menu"},b=g.jsx(ja,{...v,ref:p,onPress:()=>f(y=>!y),isDisabled:l,className:`proton-ResponsiveMenuTrigger__button ${s}`,children:g.jsx(ph,{size:n})}),$=t?t({...v,onClick:()=>f(y=>!y)},d):b;return a.useEffect(()=>()=>{d&&(i==null||i())},[d,i]),c?g.jsxs(g.Fragment,{children:[$,d&&g.jsx(qr,{id:e,actions:r,isOpen:d,onClose:()=>{f(!1)},showCancel:!0,"data-testid":u})]}):g.jsxs(nh,{children:[$,d&&g.jsx(kn,{state:{isOpen:d,setOpen:f,open:()=>f(!0),close:()=>f(!1),toggle:()=>f(!d)},triggerRef:p,arrow:!1,children:g.jsx(oh,{className:"proton-ListBox proton-ResponsiveMenuTrigger__menu",id:e,autoFocus:!0,"data-testid":u,children:r.map(y=>g.jsx(sh,{href:y.to,target:"_blank",rel:"noopener noreferrer",onAction:()=>{var C;(C=y.onAction)==null||C.call(y,y.key),setTimeout(()=>{f(!1)},200)},className:"proton-ListBox__item proton-ResponsiveMenuTrigger__menu-item",children:y.label},y.key))})})]})}const Dr=t=>{let e=a.useRef(null),{state:n}=t,{listBoxProps:r}=Nf(t,n,e);return g.jsx(xn,{contain:!0,restoreFocus:!0,autoFocus:!0,children:g.jsx("ul",{...r,ref:e,"data-testid":"listbox",className:"proton-ListBox",children:[...n.collection].map(l=>g.jsx(hh,{item:l,state:n},l.key))})})};function hh({item:t,state:e}){let n=a.useRef(null),{optionProps:r,isSelected:l,isFocused:i,isDisabled:o}=Vf({key:t.key},e,n);return g.jsx("li",{...r,className:L.csx("proton-ListBox__item",i&&"proton-ListBox__item--focused",l&&"proton-ListBox__item--selected",o&&"proton-ListBox__item--disabled"),ref:n,children:t.rendered})}const Ya=a.forwardRef((t,e)=>{let{buttonProps:n}=Sn({...t,isDisabled:t.disabled},e);return g.jsx("button",{...n,ref:e,className:L.csx("proton-Select__trigger",t.disabled&&"proton-Select__trigger--disabled",!t.isOpen&&"proton-Select__trigger--closed",t.isOpen&&"proton-Select__trigger--opened"),children:t.children})});function mh({label:t,name:e,isDisabled:n,disabledKeys:r,selectedKey:l,onSelectionChange:i,onOpen:o,onClose:u,items:s,"data-testid":c,children:d}){const f={label:t,isDisabled:n,disabledKeys:r,selectedKey:l,items:s,"data-testid":c,children:d,onSelectionChange:i,onOpenChange:x=>{x?o==null||o():u==null||u()}},p=Ca(f),v=a.useRef(null),b=a.useRef(null),{labelProps:$,triggerProps:y,valueProps:C,menuProps:D}=Os({...f,label:t||e},p,v);return a.useEffect(()=>{p.isOpen&&b.current&&v.current&&!b.current.style.minWidth&&(b.current.style.minWidth=`${v.current.offsetWidth}px`)}),g.jsxs("div",{className:"proton-Select","aria-label":t||e,"aria-disabled":n,children:[t?g.jsx("div",{...$,className:"proton-Select__label","data-testid":"select-label",children:t}):g.jsx("div",{...$}),g.jsx(zs,{isDisabled:n,state:p,triggerRef:v,label:t||e,name:e,"data-testid":"hidden-select-container"}),g.jsxs(Ya,{...y,isOpen:p.isOpen,ref:v,disabled:n,"data-testid":c,children:[g.jsx("div",{...C,className:"proton-Select__value",children:p.selectedItem?p.selectedItem.rendered:"Select an option"}),g.jsx("div",{className:L.csx("proton-Select__trigger_icon",p.isOpen&&"proton-Select__trigger_icon--flipped"),"aria-hidden":"true",children:g.jsxs("svg",{id:"caret-down",viewBox:"0 0 512 512",children:[g.jsx("title",{children:p.isOpen?"caret down":"caret up"}),g.jsx("path",{fill:"currentColor",d:"M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7L86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z"})]})})]}),p.isOpen&&g.jsx("div",{className:"proton-Select__popover",children:g.jsx(kn,{arrow:!1,state:p,triggerRef:v,popoverRef:b,placement:"bottom start","data-testid":"select-popover",isEntering:p.isOpen,children:g.jsx(Dr,{...D,state:p})})})]})}const bh={Menu:mh,Option:Lr};function gh({label:t,name:e,isDisabled:n,disabledKeys:r,selectedKey:l,onSelectionChange:i,onOpen:o,onClose:u,items:s,"data-testid":c,children:d}){const f={label:t,isDisabled:n,disabledKeys:r,selectedKey:l,onSelectionChange:i,onOpenChange:k=>{k?o==null||o():u==null||u()},items:s,"data-testid":c,children:d},p=Ca(f),v=Ga(Ie.BREAKPOINTS.MEDIUM),b=a.useRef(null),$=a.useRef(null),{labelProps:y,triggerProps:C,valueProps:D,menuProps:x}=Os({...f,label:t||e},p,b);return a.useEffect(()=>{p.isOpen&&$.current&&b.current&&!$.current.style.minWidth&&($.current.style.minWidth=`${b.current.offsetWidth}px`)}),g.jsxs("div",{className:"proton-Select","aria-label":t||e,"aria-disabled":n,children:[t?g.jsx("div",{...y,className:"proton-Select__label","data-testid":"select-label",children:t}):g.jsx("div",{...y}),g.jsx(zs,{isDisabled:n,state:p,triggerRef:b,label:t||e,name:e,"data-testid":"hidden-select-container"}),g.jsxs(Ya,{...C,isOpen:p.isOpen,ref:b,disabled:n,"data-testid":c,children:[g.jsx("div",{...D,children:p.selectedItem?p.selectedItem.rendered:"Select an option"}),g.jsx("div",{className:L.csx("proton-Select__trigger_icon",p.isOpen&&"proton-Select__trigger_icon--flipped"),"aria-hidden":"true",children:g.jsxs("svg",{id:"caret-down",viewBox:"0 0 512 512",children:[g.jsx("title",{children:p.isOpen?"caret down":"caret up"}),g.jsx("path",{fill:"currentColor",d:"M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7L86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z"})]})})]}),p.isOpen&&g.jsx(g.Fragment,{children:v?g.jsx(qr,{isOpen:p.isOpen,onClose:()=>p.close(),children:g.jsx(Dr,{...x,state:p})}):g.jsx("div",{className:"proton-Select__popover",children:g.jsx(kn,{state:p,triggerRef:b,popoverRef:$,placement:"bottom start","data-testid":"select-popover",children:g.jsx(Dr,{...x,state:p})})})})]})}const yh={Menu:gh,Option:Lr};function $h(t){let e={...t,isSelected:t.isOn,"data-testid":void 0},n=a.useRef(null),r=lf(e),{inputProps:l}=hp(e,r,n);return g.jsxs("label",{className:L.csx("proton-Switch",t.isDisabled&&"proton-Switch--disabled",r.isSelected&&"proton-Switch--on"),"data-on":r.isSelected||void 0,"data-disabled":t.isDisabled||void 0,"data-testid":t["data-testid"]||void 0,"aria-label":t.label||void 0,children:[g.jsx(_r,{children:g.jsx("input",{...l,ref:n})}),t.label&&g.jsx("div",{className:"proton-Switch__label",children:t.label}),g.jsxs("div",{className:"proton-Switch__wrapper",children:[g.jsx("div",{className:"proton-Switch__toggle",children:g.jsx("div",{className:"proton-Switch__slider"})}),t.children&&g.jsx("div",{className:"proton-Switch__description",children:t.children})]})]})}function xh({item:t,state:e,children:n}){let r=a.useRef(),{rowProps:l}=wp({node:t},e);return g.jsx("tr",{className:L.csx("proton-Table__headerRow"),...l,ref:r,children:n})}function Eh({column:t,state:e}){var s,c;let n=a.useRef(),{columnHeaderProps:r}=Cp({node:t},e,n);const{align:l="left"}=t.props;let{isFocusVisible:i,focusProps:o}=Vt(),u=((s=e.sortDescriptor)==null?void 0:s.direction)==="ascending"?"▲":"▼";return g.jsxs("th",{...z(r,o),colSpan:t.colspan,className:L.csx("proton-Table__header",`proton-Table__header--${l}`,i?"proton-Table__header--focused":null),ref:n,children:[t.rendered,t.props.allowsSorting&&g.jsx("span",{"aria-hidden":"true",className:L.csx("proton-Table__headerSortIcon"),style:{visibility:((c=e.sortDescriptor)==null?void 0:c.column)===t.key?"visible":"hidden"},children:u})]})}function ii({type:t,children:e}){let{rowGroupProps:n}=Dp();return g.jsx(t,{...n,className:L.csx("proton-Table__rowGroup",t==="thead"?"proton-Table__rowGroup--header":"proton-Table__rowGroup--body"),children:e})}function Ch({item:t,children:e,state:n}){let r=a.useRef(),l=n.selectionManager.isSelected(t.key),{rowProps:i,isPressed:o}=Sp({node:t},n,r),{isFocusVisible:u,focusProps:s}=Vt();return g.jsx("tr",{className:L.csx("proton-Table__row",l?"proton-Table__row--selected":null,o?"proton-Table__row--pressed":null,u?"proton-Table__row--focused":null),...z(i,s),ref:r,children:e})}function Sh({cell:t,state:e,...n}){let r=a.useRef(),{gridCellProps:l}=Pp({node:t},e,r),{isFocusVisible:i,focusProps:o}=Vt();const{align:u}=t.props;return g.jsx("td",{...z(l,o),className:L.csx("proton-Table__cell",i?"proton-Table__cell--focused":null,`proton-Table__cell--${u}`),ref:r,children:t.rendered})}const wh=Wp,Ph=Yp;function Dh(t){let e=Vp({...t}),n=a.useRef(),{collection:r}=e,{gridProps:l}=xp({...t,"aria-label":t["aria-label"]||"Table"},e,n);return g.jsxs("table",{...l,ref:n,className:L.csx("proton-Table"),children:[g.jsx(ii,{type:"thead",children:r.headerRows.map(i=>g.jsx(xh,{item:i,state:e,children:Array.from(r.getChildren(i.key)).map(o=>g.jsx(Eh,{column:o,state:e},o.key))},i.key))}),g.jsx(ii,{type:"tbody",children:Array.from(r.body.childNodes).map(i=>g.jsx(Ch,{item:i,state:e,children:Array.from(r.getChildren(i.key)).map(o=>g.jsx(Sh,{cell:o,state:e},o.key))},i.key))})]})}function qa({children:t,arrow:e,...n}){const{style:r}=Ce();return g.jsxs(dh,{...n,className:"proton__Tooltip proton-Dialog",style:r,children:[e&&g.jsx(Qv,{className:"proton__TooltipArrow",children:g.jsx("svg",{width:8,height:8,viewBox:"0 0 8 8",children:g.jsx("path",{d:"M0 0 L4 4 L8 0"})})}),t]})}function Xa({children:t,delay:e=500,closeDelay:n=500,isDisabled:r,defaultOpen:l,onOpenChange:i,disableTriggerClick:o,content:u,...s}){const[c,d]=a.useState(!1),f=a.useRef(!1),p=a.useRef(!1);return g.jsxs(ah,{delay:e,closeDelay:n,isDisabled:r,isOpen:c,defaultOpen:l,onOpenChange:v=>{v&&!f.current&&(p.current=!0),i&&i(v),f.current||d(v),f.current=!1},children:[g.jsx(ja,{className:"proton__TooltipTrigger","aria-label":"Show tooltip",onPress:()=>{o||r||p.current||(f.current=!0,d(!c))},children:t}),g.jsx(qa,{...s,children:u})]})}const kh=({to:t,children:e,tooltipProps:n,"data-testid":r})=>{const{className:l}=Ce(),i=n?g.jsx(Xa,{delay:50,closeDelay:75,...n,children:e}):e;if(t){const o=L.isUrlExternal(t);return g.jsx("span",{className:L.csx("proton-TextEmphasis",n&&"proton-TextEmphasis--tooltip",l),children:g.jsx("a",{"data-testid":r,href:t,target:o?"_blank":void 0,rel:o?"noopener noreferrer":void 0,onClick:o?void 0:u=>L.handleInternalNavigation(u,t),children:i})})}return g.jsx("span",{className:L.csx("proton-TextEmphasis",n&&"proton-TextEmphasis--tooltip",l),"data-testid":r,children:i})};function Th({amplitude:t,isDisabled:e,isPlayed:n,isHovered:r,isVisible:l,hasAnimated:i,resolution:o,spacing:u,index:s}){const c=l?`${Math.max(t*100,4)}%`:"0%";return g.jsxs("div",{className:L.csx("proton-Waveform__bar-wrapper"),style:{width:`${o}px`,marginRight:`${u}px`},children:[g.jsx("div",{className:L.csx("proton-Waveform__bar","proton-Waveform__bar--upper",e&&"proton-Waveform__bar--disabled",n&&"proton-Waveform__bar--played",l&&"proton-Waveform__bar--visible",i&&"proton-Waveform__bar--animated"),style:{"--target-height":`calc(${c} / 2)`,"--index":s}}),g.jsx("div",{className:L.csx("proton-Waveform__bar","proton-Waveform__bar--lower",e&&"proton-Waveform__bar--disabled",n&&"proton-Waveform__bar--played",l&&"proton-Waveform__bar--visible",i&&"proton-Waveform__bar--animated"),style:{"--target-height":`calc(${c} / 2)`,"--index":s}}),r&&!e&&!n&&g.jsx("div",{className:"proton-Waveform__bar--hover",style:{"--hover-height":c}})]})}const Ah=Ih(100);function Bh({data:t,resolution:e=2,startDuration:n,endDuration:r,currentTime:l=0,showTimestamps:i=!1,totalDuration:o,onClick:u,"data-testid":s}){var S;const{className:c}=Ce(),d=a.useRef(null),[f,p]=a.useState([]),[v,b]=a.useState(null),[$,y]=a.useState(!1),[C,D]=a.useState(!1),x=t||Ah,k=e;a.useEffect(()=>{if(!d.current)return;const w=R=>{const A=Math.floor(R/(e+k)),j=Mh(x,A);p(j)},M=d.current.clientWidth;w(M);const E=new ResizeObserver(R=>{R&&R[0]&&w(R[0].contentRect.width)});return E.observe(d.current),()=>E.disconnect()},[x,e,k]),a.useEffect(()=>{const w=setTimeout(()=>y(!0),50),M=setTimeout(()=>D(!0),500);return()=>{clearTimeout(w),clearTimeout(M)}},[]);const P=w=>{if(!d.current)return;const M=d.current.getBoundingClientRect(),R=(w.clientX-M.left)/M.width*o;b(R)},T=()=>{b(null)},F=e+k,h=(w,M)=>{var A;const E=w/o*100;return(M==="start"?Math.floor(E/100*f.length):Math.ceil(E/100*f.length))*F/((A=d.current)==null?void 0:A.clientWidth)*100},B=(S=d.current)==null?void 0:S.clientWidth;return g.jsxs("div",{className:L.csx("proton-Waveform",c),"data-testid":s,children:[i&&g.jsx(oi,{direction:"left",seconds:l}),g.jsxs("div",{ref:d,className:"proton-Waveform__container",onMouseMove:P,onMouseLeave:T,onClick:w=>{if(!d.current)return;const M=d.current.getBoundingClientRect(),R=(w.clientX-M.left)/M.width*o;u==null||u(R,w)},children:[n!==void 0&&r!==void 0&&g.jsx("div",{className:"proton-Waveform__active-region",style:{left:d.current?`calc(${h(n,"start")}%`:"0%",right:d.current?`calc(${100-h(r,"end")}% - 2px)`:"0%"}}),v!==null&&g.jsx("div",{className:"proton-Waveform__hover-line",style:{left:`${v/o*100}%`}}),f.map((w,M)=>{const E=M/f.length*o,R=n!==void 0&&r!==void 0&&(E<n||E>r),A=l===0?!1:E<=l,j=v!==null&&E<=v;return g.jsx(Th,{amplitude:w,isDisabled:R,isPlayed:A,isHovered:j,isVisible:$,hasAnimated:C,resolution:e,spacing:k,index:M},M)})]}),!t&&g.jsx("div",{className:"proton-Waveform__bar-unavailable",style:{fontSize:B<325?"0.85rem":"1rem"},children:B<277?"Unavailable":"Waveform Unavailable"}),i&&g.jsx(oi,{direction:"right",seconds:o})]})}function oi({direction:t,seconds:e}){return g.jsx("div",{className:L.csx("proton-Waveform__timestamp",`proton-Waveform__timestamp--${t}`),children:Kh(e)})}function Kh(t){const e=Math.floor(t/60),n=Math.floor(t%60);return`${e}:${n<10?"0":""}${n.toFixed(0)}`}function Mh(t,e){const n=t.length,r=n/e,l=new Array(e).fill(0).map((i,o)=>{const u=o*r,s=Math.floor(u),c=Math.min(s+1,n-1),d=u-s;return t[s]*(1-d)+t[c]*d});return Rh(l)}function Rh(t){const e=Math.min(...t),n=Math.max(...t);return t.map(r=>{const l=(r-e)/(n-e);return Math.max(l*.8+.1,.1)})}function Ih(t){return Array.from({length:t},(e,n)=>{const l=n/(t-1)*6*2*Math.PI-Math.PI/2;return Math.sin(l)*.5+.5})}const Fh=t=>{const[e,n,r]=t,l=e+n+r;if(l<50){const i=l/100;return`rgba(255, 255, 255, ${Math.max(.1,.3-i)})`}return""};function _h({image:t,imageUrl:e="",onLoad:n,children:r}){const{palette:l}=Ce(),i=en.parseToRgba(l.BASE_COLOR),o=Fh(i);return g.jsxs(Yr,{fadeIn:!1,children:[t?g.jsx("div",{className:"proton-Backdrop__image","aria-hidden":"true",children:t}):g.jsx("img",{alt:"",src:e,className:"proton-Backdrop__image",onLoad:u=>n==null?void 0:n(u.currentTarget),"aria-hidden":"true"}),g.jsx("div",{className:"proton-Backdrop__blur","aria-hidden":"true",style:{WebkitBackdropFilter:"blur(24px) brightness(75%)",backdropFilter:"blur(24px) brightness(75%)",filter:"brightness(50%)",background:o}})]})}exports.THEMES=Ie.THEMES;exports.COLORS=X.colors;exports.ActionMenu=qr;exports.Backdrop=Yr;exports.Badge=ov;exports.BadgeVariants=iv;exports.Banner=ke;exports.Button=Xr;exports.ButtonGroup=Ra;exports.Cell=Ph;exports.Column=wh;exports.Dialog=vv;exports.Icon=bv;exports.ImageBackdrop=_h;exports.Input=Ia;exports.Popover=kn;exports.ResponsiveMenuTrigger=vh;exports.ResponsiveSelect=yh;exports.Row=Gp;exports.SearchInput=gv;exports.Section=Of;exports.Select=bh;exports.Switch=$h;exports.Table=Dh;exports.TableBody=Up;exports.TableHeader=Hp;exports.TextEmphasis=kh;exports.ThemeProvider=rv;exports.Tooltip=qa;exports.TooltipTrigger=Xa;exports.Waveform=Bh;exports.usePopoverTrigger=yv;exports.useTheme=Ce;
47
+ */var ti;function Pv(){return ti||(ti=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var t=a,e=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function n(x){{for(var k=arguments.length,P=new Array(k>1?k-1:0),T=1;T<k;T++)P[T-1]=arguments[T];r("error",x,P)}}function r(x,k,P){{var T=e.ReactDebugCurrentFrame,F=T.getStackAddendum();F!==""&&(k+="%s",P=P.concat([F]));var h=P.map(function(B){return String(B)});h.unshift("Warning: "+k),Function.prototype.apply.call(console[x],console,h)}}function l(x,k){return x===k&&(x!==0||1/x===1/k)||x!==x&&k!==k}var i=typeof Object.is=="function"?Object.is:l,o=t.useState,u=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue,d=!1,f=!1;function p(x,k,P){d||t.startTransition!==void 0&&(d=!0,n("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var T=k();if(!f){var F=k();i(T,F)||(n("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}var h=o({inst:{value:T,getSnapshot:k}}),B=h[0].inst,S=h[1];return s(function(){B.value=T,B.getSnapshot=k,v(B)&&S({inst:B})},[x,T,k]),u(function(){v(B)&&S({inst:B});var w=function(){v(B)&&S({inst:B})};return x(w)},[x]),c(T),T}function v(x){var k=x.getSnapshot,P=x.value;try{var T=k();return!i(P,T)}catch{return!0}}function b(x,k,P){return k()}var $=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",y=!$,C=y?b:p,D=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:C;Qn.useSyncExternalStore=D,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),Qn}process.env.NODE_ENV==="production"?Cr.exports=wv():Cr.exports=Pv();var Dv=Cr.exports;const Na=a.createContext(!1),Ot=a.createContext(null);function kv(t){if(a.useContext(Ot))return t.content;let{collection:n,document:r}=Kv(t.createCollection);return a.createElement(a.Fragment,null,a.createElement(Cv,null,a.createElement(Ot.Provider,{value:r},t.content)),a.createElement(Tv,{render:t.children,collection:n}))}function Tv({collection:t,render:e}){return e(t)}function Av(t,e,n){let r=Xe(),l=a.useRef(r);l.current=r;let i=a.useCallback(()=>l.current?n():e(),[e,n]);return Dv.useSyncExternalStore(t,i)}const Bv=typeof a.useSyncExternalStore=="function"?a.useSyncExternalStore:Av;function Kv(t){let[e]=a.useState(()=>new xv((t==null?void 0:t())||new $v)),n=a.useCallback(o=>e.subscribe(o),[e]),r=a.useCallback(()=>{let o=e.getCollection();return e.isSSR&&e.resetAfterSSR(),o},[e]),l=a.useCallback(()=>(e.isSSR=!0,e.getCollection()),[e]),i=Bv(n,r,l);return W(()=>(e.isMounted=!0,()=>{e.isMounted=!1}),[e]),{collection:i,document:e}}const Sr=a.createContext(null);function Mv(t,e,n,r,l,i){let o=a.useCallback(s=>{s==null||s.setProps(e,n,r,i)},[e,n,r,i]),u=a.useContext(Sr);if(u){let s=u.ownerDocument.nodesByProps.get(e);return s||(s=u.ownerDocument.createElement(t),s.setProps(e,n,r,i),u.appendChild(s),u.ownerDocument.updateCollection(),u.ownerDocument.nodesByProps.set(e,s)),l?a.createElement(Sr.Provider,{value:s},l):null}return a.createElement(t,{ref:o},l)}function Rv(t,e){let n=({node:l})=>e(l.props,l.props.ref,l),r=a.forwardRef((l,i)=>{if(!a.useContext(Na)){if(e.length>=3)throw new Error(e.name+" cannot be rendered outside a collection.");return e(l,i)}return Mv(t,l,i,"children"in l?l.children:null,null,u=>a.createElement(n,{node:u}))});return r.displayName=e.name,r}function Iv(t){return _a({...t,addIdAndValue:!0})}const ni=a.createContext(null);function Fv(t){let e=a.useContext(ni),n=((e==null?void 0:e.dependencies)||[]).concat(t.dependencies),r=t.idScope||(e==null?void 0:e.idScope),l=Iv({...t,idScope:r,dependencies:n});return a.useContext(Ot)&&(l=a.createElement(_v,null,l)),e=a.useMemo(()=>({dependencies:n,idScope:r}),[r,...n]),a.createElement(ni.Provider,{value:e},l)}function _v({children:t}){let e=a.useContext(Ot),n=a.useMemo(()=>a.createElement(Ot.Provider,{value:null},a.createElement(Na.Provider,{value:!0},t)),[t]);return Xe()?a.createElement(Sr.Provider,{value:e},n):it.createPortal(n,e)}const Nv=a.createContext(null),Lv={CollectionRoot({collection:t,renderDropIndicator:e}){return ri(t,null,e)},CollectionBranch({collection:t,parent:e,renderDropIndicator:n}){return ri(t,e,n)}};function ri(t,e,n){return _a({items:e?t.getChildren(e.key):t,dependencies:[n],children(r){var l;let i=r.render(r);if(!n||r.type!=="item")return i;let o=r.key,u=t.getKeyAfter(o);return a.createElement(a.Fragment,null,n({type:"item",key:o,dropPosition:"before"}),i,(u==null||((l=t.getItem(u))===null||l===void 0?void 0:l.type)!=="item")&&n({type:"item",key:o,dropPosition:"after"}))}})}const La=a.createContext(Lv);function Ov(t){return a.useMemo(()=>t!=null?new Set([t]):null,[t])}const li=Symbol("default");function Tn({values:t,children:e}){for(let[n,r]of t)e=a.createElement(n.Provider,{value:r},e);return e}function Ct(t){let{className:e,style:n,children:r,defaultClassName:l,defaultChildren:i,defaultStyle:o,values:u}=t;return a.useMemo(()=>{let s,c,d;return typeof e=="function"?s=e({...u,defaultClassName:l}):s=e,typeof n=="function"?c=n({...u,defaultStyle:o||{}}):c=n,typeof r=="function"?d=r({...u,defaultChildren:i}):r==null?d=i:d=r,{className:s??l,style:c||o?{...o,...c}:void 0,children:d??i,"data-rac":""}},[e,n,r,l,i,o,u])}function Oa(t,e){let n=a.useContext(t);if(e===null)return null;if(n&&typeof n=="object"&&"slots"in n&&n.slots){let r=new Intl.ListFormat().format(Object.keys(n.slots).map(i=>`"${i}"`));if(!e&&!n.slots[li])throw new Error(`A slot prop is required. Valid slot names are ${r}.`);let l=e||li;if(!n.slots[l])throw new Error(`Invalid slot "${e}". Valid slot names are ${r}.`);return n.slots[l]}return n}function Ht(t,e,n){let r=Oa(n,t.slot)||{},{ref:l,...i}=r,o=mn(a.useMemo(()=>Ic(e,l),[e,l])),u=z(i,t);return"style"in i&&i.style&&"style"in t&&t.style&&(typeof i.style=="function"||typeof t.style=="function"?u.style=s=>{let c=typeof i.style=="function"?i.style(s):i.style,d={...s.defaultStyle,...c},f=typeof t.style=="function"?t.style({...s,defaultStyle:d}):t.style;return{...d,...f}}:u.style={...i.style,...t.style}),[u,o]}function zv(){let[t,e]=a.useState(!0),n=a.useRef(!1),r=a.useCallback(l=>{n.current=!0,e(!!l)},[]);return W(()=>{n.current||e(!1)},[]),[r,t]}function jv(t,e=!0){let[n,r]=a.useState(!0);return za(t,n&&e,a.useCallback(()=>r(!1),[])),n&&e}function Vv(t,e){let[n,r]=a.useState(!1),[l,i]=a.useState("idle");return!e&&t.current&&l==="idle"&&(n=!0,r(!0),i("exiting")),!t.current&&l==="exited"&&i("idle"),za(t,n,a.useCallback(()=>{i("exited"),r(!1)},[])),n}function za(t,e,n){let r=a.useRef(null);e&&t.current&&(r.current=window.getComputedStyle(t.current).animation),W(()=>{if(e&&t.current){let l=window.getComputedStyle(t.current);if(l.animationName&&l.animationName!=="none"&&l.animation!==r.current){let i=u=>{u.target===t.current&&(o.removeEventListener("animationend",i),it.flushSync(()=>{n()}))},o=t.current;return o.addEventListener("animationend",i),()=>{o.removeEventListener("animationend",i)}}else n()}},[t,e,n])}const Hv=a.createContext(null),Uv=new Set(["form","formAction","formEncType","formMethod","formNoValidate","formTarget","name","value"]),Wv=a.createContext({});function Gv(t,e){[t,e]=Ht(t,e,Wv),t=Yv(t);let n=t,{isPending:r}=n,{buttonProps:l,isPressed:i}=Sn(t,e),{focusProps:o,isFocused:u,isFocusVisible:s}=Vt(t),{hoverProps:c,isHovered:d}=xt({...t,isDisabled:t.isDisabled||r}),f={isHovered:d,isPressed:(n.isPressed||i)&&!r,isFocused:u,isFocusVisible:s,isDisabled:t.isDisabled||!1,isPending:r??!1},p=Ct({...t,values:f,defaultClassName:"react-aria-Button"}),v=ae(l.id),b=ae(),$=l["aria-labelledby"];r&&($?$=`${$} ${b}`:l["aria-label"]&&($=`${v} ${b}`));let y=a.useRef(r);return a.useEffect(()=>{let C={"aria-labelledby":$||v};(!y.current&&u&&r||y.current&&u&&!r)&&dn(C,"assertive"),y.current=r},[r,u,$,v]),a.createElement("button",{...oe(t,{propNames:Uv}),...z(l,o,c),...p,id:v,ref:e,"aria-labelledby":$,slot:t.slot||void 0,"aria-disabled":r?"true":l["aria-disabled"],"data-disabled":t.isDisabled||void 0,"data-pressed":f.isPressed||void 0,"data-hovered":d||void 0,"data-focused":u||void 0,"data-pending":r||void 0,"data-focus-visible":s||void 0},a.createElement(Hv.Provider,{value:{id:b}},p.children))}function Yv(t){return t.isPending&&(t.onPress=void 0,t.onPressStart=void 0,t.onPressEnd=void 0,t.onPressChange=void 0,t.onPressUp=void 0,t.onKeyDown=void 0,t.onKeyUp=void 0,t.onClick=void 0,t.href=void 0),t}const ja=Sv(Gv),qv=a.createContext({}),Xv=a.createContext({}),Zv=a.createContext({}),Va=a.createContext({placement:"bottom"});function Jv(t,e){[t,e]=Ht(t,e,Va);let n=t.placement,r={position:"absolute",[n]:"100%",transform:n==="top"||n==="bottom"?"translateX(-50%)":"translateY(-50%)"},l=Ct({...t,defaultClassName:"react-aria-OverlayArrow",values:{placement:n}});return l.style&&Object.keys(l.style).forEach(i=>l.style[i]===void 0&&delete l.style[i]),a.createElement("div",{...t,...l,style:{...r,...l.style},ref:e,"data-placement":n})}const Qv=a.forwardRef(Jv),wr=a.createContext(null),eh=a.createContext(null),th=a.createContext({}),Ha=a.createContext(null),Jr=a.createContext(null),Ua=a.createContext(null);function nh(t){let e=Mp(t),n=a.useRef(null),{menuTriggerProps:r,menuProps:l}=hu({...t,type:"menu"},e,n),[i,o]=a.useState(null),u=a.useCallback(()=>{n.current&&o(n.current.offsetWidth+"px")},[n]);nr({ref:n,onResize:u});let s=a.useRef(null);return a.createElement(Tn,{values:[[Ha,{...l,ref:s}],[eh,e],[Ua,e],[wr,{trigger:"MenuTrigger",triggerRef:n,scrollRef:s,placement:"bottom start",style:{"--trigger-width":i}}]]},a.createElement(dd,{...r,ref:n,isPressed:e.isOpen},t.children))}const rh=a.createContext(null);function lh(t,e){return[t,e]=Ht(t,e,Ha),a.createElement(kv,{content:a.createElement(Fv,t)},n=>n.size>0&&a.createElement(ih,{props:t,collection:n,menuRef:e}))}function ih({props:t,collection:e,menuRef:n}){let r=Aa({...t,collection:e,children:void 0}),[l,i]=a.useState(null),{isVirtualized:o,CollectionRoot:u}=a.useContext(La),{menuProps:s}=bu({...t,isVirtualized:o},r,n),c=a.useContext(Ua),d=a.useContext(wr),f=(d==null?void 0:d.trigger)==="SubmenuTrigger";Pi({ref:n,onInteractOutside:y=>{c&&!(l!=null&&l.contains(y.target))&&c.close()},isDisabled:f||(c==null?void 0:c.expandedKeysStack.length)===0});let p=a.useRef(null),[v,b]=a.useState({left:0});a.useEffect(()=>{if(l&&p.current!==l&&v.left===0){p.current=l;let{left:y}=l.getBoundingClientRect();b({left:-1*y})}},[v,l]);let $=Ct({defaultClassName:"react-aria-Menu",className:t.className,style:t.style,values:{}});return a.createElement(xn,null,a.createElement("div",{...oe(t),...s,...$,ref:n,slot:t.slot||void 0,onScroll:t.onScroll},a.createElement(Tn,{values:[[Jr,r],[Zv,{elementType:"div"}],[wr,{UNSTABLE_portalContainer:l||void 0}],[Nv,{render:uh}],[rh,{parentMenuRef:n}],[Pr,null]]},a.createElement(u,{collection:e,persistedKeys:Ov(r.selectionManager.focusedKey),scrollRef:n}))),a.createElement("div",{ref:i,style:{width:"100vw",position:"absolute",top:0,...v}}))}const oh=a.forwardRef(lh);function uh(t,e,n){var r,l;let i=a.useContext(Jr),{CollectionBranch:o}=a.useContext(La),[u,s]=zv();var c;let{headingProps:d,groupProps:f}=Uf({heading:s,"aria-label":(c=n.props["aria-label"])!==null&&c!==void 0?c:void 0}),p=Ct({defaultClassName:"react-aria-Section",className:(r=n.props)===null||r===void 0?void 0:r.className,style:(l=n.props)===null||l===void 0?void 0:l.style,values:{}});return a.createElement("section",{...oe(t),...f,...p,ref:e},a.createElement(Xv.Provider,{value:{...d,ref:u}},a.createElement(o,{collection:i.collection,parent:n})))}const Pr=a.createContext(null),sh=Rv("item",function(e,n,r){var l;[e,n]=Ht(e,n,Pr);let i=(l=Oa(Pr))===null||l===void 0?void 0:l.id,o=a.useContext(Jr),u=mn(n),{menuItemProps:s,labelProps:c,descriptionProps:d,keyboardShortcutProps:f,...p}=gu({...e,id:i,key:r.key},o,u),{isFocusVisible:v,focusProps:b}=Vt(),{hoverProps:$,isHovered:y}=xt({isDisabled:p.isDisabled}),C=Ct({...e,id:void 0,children:r.rendered,defaultClassName:"react-aria-MenuItem",values:{...p,isHovered:y,isFocusVisible:v,selectionMode:o.selectionManager.selectionMode,selectionBehavior:o.selectionManager.selectionBehavior,hasSubmenu:!!e["aria-haspopup"],isOpen:e["aria-expanded"]==="true"}}),D=e.href?"a":"div";return a.createElement(D,{...z(s,b,$),...C,ref:u,"data-disabled":p.isDisabled||void 0,"data-hovered":y||void 0,"data-focused":p.isFocused||void 0,"data-focus-visible":v||void 0,"data-pressed":p.isPressed||void 0,"data-selected":p.isSelected||void 0,"data-selection-mode":o.selectionManager.selectionMode==="none"?void 0:o.selectionManager.selectionMode,"data-has-submenu":!!e["aria-haspopup"]||void 0,"data-open":e["aria-expanded"]==="true"||void 0},a.createElement(Tn,{values:[[qv,{slots:{label:c,description:d}}],[th,f]]},C.children))}),Qr=a.createContext(null),Wa=a.createContext(null);function ah(t){let e=Ta(t),n=a.useRef(null),{triggerProps:r,tooltipProps:l}=Tp(t,e,n);return a.createElement(Tn,{values:[[Qr,e],[Wa,{...l,triggerRef:n}]]},a.createElement(Id,{...r,ref:n},t.children))}function ch({UNSTABLE_portalContainer:t,...e},n){[e,n]=Ht(e,n,Wa);let r=a.useContext(Qr),l=Ta(e),i=e.isOpen!=null||e.defaultOpen!=null||!r?l:r,o=Vv(n,i.isOpen)||e.isExiting||!1;return!i.isOpen&&!o?null:a.createElement(wf,{portalContainer:t},a.createElement(fh,{...e,tooltipRef:n,isExiting:o}))}const dh=a.forwardRef(ch);function fh(t){let e=a.useContext(Qr),n=a.useRef(null),[r,l]=a.useState(0);W(()=>{n.current&&e.isOpen&&l(n.current.getBoundingClientRect().width)},[e.isOpen,n]);let{overlayProps:i,arrowProps:o,placement:u}=ji({placement:t.placement||"top",targetRef:t.triggerRef,overlayRef:t.tooltipRef,offset:t.offset,crossOffset:t.crossOffset,isOpen:e.isOpen,arrowSize:r,arrowBoundaryOffset:t.arrowBoundaryOffset,shouldFlip:t.shouldFlip}),s=jv(t.tooltipRef,!!u)||t.isEntering||!1,c=Ct({...t,defaultClassName:"react-aria-Tooltip",values:{placement:u,isEntering:s,isExiting:t.isExiting,state:e}});t=z(t,i);let{tooltipProps:d}=kp(t,e);return a.createElement("div",{...d,ref:t.tooltipRef,...c,style:{...i.style,...c.style},"data-placement":u,"data-entering":s||void 0,"data-exiting":t.isExiting||void 0},a.createElement(Va.Provider,{value:{...o,placement:u,ref:n}},c.children))}function Ga(t,e="down"){const n=e==="down"?`(max-width: ${t}px)`:`(min-width: ${t}px)`,[r,l]=a.useState(()=>typeof window<"u"?window.matchMedia(n).matches:!1);return a.useEffect(()=>{if(typeof window>"u")return;const i=window.matchMedia(n),o=u=>{l(u.matches)};return i.addEventListener("change",o),()=>i.removeEventListener("change",o)},[n]),r}const ph=({size:t})=>g.jsx("svg",{viewBox:"0 0 24 24",width:t,height:t,children:g.jsx("path",{fill:"currentColor",d:"M4 14c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm8 0c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm8 0c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z"})});function vh({renderTrigger:t,menuId:e,size:n=24,actions:r,disabled:l,onClose:i,testId:o,menuTestId:u}){const{className:s}=Ce(),c=Ga(Ie.BREAKPOINTS.SMALL),[d,f]=a.useState(!1),p=a.useRef(null),v={disabled:l,"data-testid":o,"aria-label":"Menu"},b=g.jsx(ja,{...v,ref:p,onPress:()=>f(y=>!y),isDisabled:l,className:`proton-ResponsiveMenuTrigger__button ${s}`,children:g.jsx(ph,{size:n})}),$=t?t({...v,onClick:()=>f(y=>!y)},d):b;return a.useEffect(()=>()=>{d&&(i==null||i())},[d,i]),c?g.jsxs(g.Fragment,{children:[$,d&&g.jsx(qr,{id:e,actions:r,isOpen:d,onClose:()=>{f(!1)},showCancel:!0,"data-testid":u})]}):g.jsxs(nh,{children:[$,d&&g.jsx(kn,{state:{isOpen:d,setOpen:f,open:()=>f(!0),close:()=>f(!1),toggle:()=>f(!d)},triggerRef:p,arrow:!1,children:g.jsx(oh,{className:"proton-ListBox proton-ResponsiveMenuTrigger__menu",id:e,autoFocus:!0,"data-testid":u,children:r.map(y=>g.jsx(sh,{href:y.to,target:"_blank",rel:"noopener noreferrer",onAction:()=>{var C;(C=y.onAction)==null||C.call(y,y.key),setTimeout(()=>{f(!1)},200)},className:"proton-ListBox__item proton-ResponsiveMenuTrigger__menu-item",children:y.label},y.key))})})]})}const Dr=t=>{let e=a.useRef(null),{state:n}=t,{listBoxProps:r}=Nf(t,n,e);return g.jsx(xn,{contain:!0,restoreFocus:!0,autoFocus:!0,children:g.jsx("ul",{...r,ref:e,"data-testid":"listbox",className:"proton-ListBox",children:[...n.collection].map(l=>g.jsx(hh,{item:l,state:n},l.key))})})};function hh({item:t,state:e}){let n=a.useRef(null),{optionProps:r,isSelected:l,isFocused:i,isDisabled:o}=Vf({key:t.key},e,n);return g.jsx("li",{...r,className:L.csx("proton-ListBox__item",i&&"proton-ListBox__item--focused",l&&"proton-ListBox__item--selected",o&&"proton-ListBox__item--disabled"),ref:n,children:t.rendered})}const Ya=a.forwardRef((t,e)=>{let{buttonProps:n}=Sn({...t,isDisabled:t.disabled},e);return g.jsx("button",{...n,ref:e,className:L.csx("proton-Select__trigger",t.disabled&&"proton-Select__trigger--disabled",!t.isOpen&&"proton-Select__trigger--closed",t.isOpen&&"proton-Select__trigger--opened"),children:t.children})});function mh({label:t,name:e,isDisabled:n,disabledKeys:r,selectedKey:l,onSelectionChange:i,onOpen:o,onClose:u,items:s,"data-testid":c,children:d}){const f={label:t,isDisabled:n,disabledKeys:r,selectedKey:l,items:s,"data-testid":c,children:d,onSelectionChange:i,onOpenChange:x=>{x?o==null||o():u==null||u()}},p=Ca(f),v=a.useRef(null),b=a.useRef(null),{labelProps:$,triggerProps:y,valueProps:C,menuProps:D}=Os({...f,label:t||e},p,v);return a.useEffect(()=>{p.isOpen&&b.current&&v.current&&!b.current.style.minWidth&&(b.current.style.minWidth=`${v.current.offsetWidth}px`)}),g.jsxs("div",{className:"proton-Select","aria-label":t||e,"aria-disabled":n,children:[t?g.jsx("div",{...$,className:"proton-Select__label","data-testid":"select-label",children:t}):g.jsx("div",{...$}),g.jsx(zs,{isDisabled:n,state:p,triggerRef:v,label:t||e,name:e,"data-testid":"hidden-select-container"}),g.jsxs(Ya,{...y,isOpen:p.isOpen,ref:v,disabled:n,"data-testid":c,children:[g.jsx("div",{...C,className:"proton-Select__value",children:p.selectedItem?p.selectedItem.rendered:"Select an option"}),g.jsx("div",{className:L.csx("proton-Select__trigger_icon",p.isOpen&&"proton-Select__trigger_icon--flipped"),"aria-hidden":"true",children:g.jsxs("svg",{id:"caret-down",viewBox:"0 0 512 512",children:[g.jsx("title",{children:p.isOpen?"caret down":"caret up"}),g.jsx("path",{fill:"currentColor",d:"M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7L86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z"})]})})]}),p.isOpen&&g.jsx("div",{className:"proton-Select__popover",children:g.jsx(kn,{arrow:!1,state:p,triggerRef:v,popoverRef:b,placement:"bottom start","data-testid":"select-popover",isEntering:p.isOpen,children:g.jsx(Dr,{...D,state:p})})})]})}const bh={Menu:mh,Option:Lr};function gh({label:t,name:e,isDisabled:n,disabledKeys:r,selectedKey:l,onSelectionChange:i,onOpen:o,onClose:u,items:s,"data-testid":c,children:d}){const f={label:t,isDisabled:n,disabledKeys:r,selectedKey:l,onSelectionChange:i,onOpenChange:k=>{k?o==null||o():u==null||u()},items:s,"data-testid":c,children:d},p=Ca(f),v=Ga(Ie.BREAKPOINTS.MEDIUM),b=a.useRef(null),$=a.useRef(null),{labelProps:y,triggerProps:C,valueProps:D,menuProps:x}=Os({...f,label:t||e},p,b);return a.useEffect(()=>{p.isOpen&&$.current&&b.current&&!$.current.style.minWidth&&($.current.style.minWidth=`${b.current.offsetWidth}px`)}),g.jsxs("div",{className:"proton-Select","aria-label":t||e,"aria-disabled":n,children:[t?g.jsx("div",{...y,className:"proton-Select__label","data-testid":"select-label",children:t}):g.jsx("div",{...y}),g.jsx(zs,{isDisabled:n,state:p,triggerRef:b,label:t||e,name:e,"data-testid":"hidden-select-container"}),g.jsxs(Ya,{...C,isOpen:p.isOpen,ref:b,disabled:n,"data-testid":c,children:[g.jsx("div",{...D,children:p.selectedItem?p.selectedItem.rendered:"Select an option"}),g.jsx("div",{className:L.csx("proton-Select__trigger_icon",p.isOpen&&"proton-Select__trigger_icon--flipped"),"aria-hidden":"true",children:g.jsxs("svg",{id:"caret-down",viewBox:"0 0 512 512",children:[g.jsx("title",{children:p.isOpen?"caret down":"caret up"}),g.jsx("path",{fill:"currentColor",d:"M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7L86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z"})]})})]}),p.isOpen&&g.jsx(g.Fragment,{children:v?g.jsx(qr,{isOpen:p.isOpen,onClose:()=>p.close(),children:g.jsx(Dr,{...x,state:p})}):g.jsx("div",{className:"proton-Select__popover",children:g.jsx(kn,{state:p,triggerRef:b,popoverRef:$,placement:"bottom start","data-testid":"select-popover",children:g.jsx(Dr,{...x,state:p})})})})]})}const yh={Menu:gh,Option:Lr};function $h(t){let e={...t,isSelected:t.isOn,"data-testid":void 0},n=a.useRef(null),r=lf(e),{inputProps:l}=hp(e,r,n);return g.jsxs("label",{className:L.csx("proton-Switch",t.isDisabled&&"proton-Switch--disabled",r.isSelected&&"proton-Switch--on"),"data-on":r.isSelected||void 0,"data-disabled":t.isDisabled||void 0,"data-testid":t["data-testid"]||void 0,"aria-label":t.label||void 0,children:[g.jsx(_r,{children:g.jsx("input",{...l,ref:n})}),t.label&&g.jsx("div",{className:"proton-Switch__label",children:t.label}),g.jsxs("div",{className:"proton-Switch__wrapper",children:[g.jsx("div",{className:"proton-Switch__toggle",children:g.jsx("div",{className:"proton-Switch__slider"})}),t.children&&g.jsx("div",{className:"proton-Switch__description",children:t.children})]})]})}function xh({item:t,state:e,children:n}){let r=a.useRef(),{rowProps:l}=wp({node:t},e);return g.jsx("tr",{className:L.csx("proton-Table__headerRow"),...l,ref:r,children:n})}function Eh({column:t,state:e}){var s,c;let n=a.useRef(),{columnHeaderProps:r}=Cp({node:t},e,n);const{align:l="left"}=t.props;let{isFocusVisible:i,focusProps:o}=Vt(),u=((s=e.sortDescriptor)==null?void 0:s.direction)==="ascending"?"▲":"▼";return g.jsxs("th",{...z(r,o),colSpan:t.colspan,className:L.csx("proton-Table__header",`proton-Table__header--${l}`,i?"proton-Table__header--focused":null),ref:n,children:[t.rendered,t.props.allowsSorting&&g.jsx("span",{"aria-hidden":"true",className:L.csx("proton-Table__headerSortIcon"),style:{visibility:((c=e.sortDescriptor)==null?void 0:c.column)===t.key?"visible":"hidden"},children:u})]})}function ii({type:t,children:e}){let{rowGroupProps:n}=Dp();return g.jsx(t,{...n,className:L.csx("proton-Table__rowGroup",t==="thead"?"proton-Table__rowGroup--header":"proton-Table__rowGroup--body"),children:e})}function Ch({item:t,children:e,state:n}){let r=a.useRef(),l=n.selectionManager.isSelected(t.key),{rowProps:i,isPressed:o}=Sp({node:t},n,r),{isFocusVisible:u,focusProps:s}=Vt();return g.jsx("tr",{className:L.csx("proton-Table__row",l?"proton-Table__row--selected":null,o?"proton-Table__row--pressed":null,u?"proton-Table__row--focused":null),...z(i,s),ref:r,children:e})}function Sh({cell:t,state:e,...n}){let r=a.useRef(),{gridCellProps:l}=Pp({node:t},e,r),{isFocusVisible:i,focusProps:o}=Vt();const{align:u}=t.props;return g.jsx("td",{...z(l,o),className:L.csx("proton-Table__cell",i?"proton-Table__cell--focused":null,`proton-Table__cell--${u}`),ref:r,children:t.rendered})}const wh=Wp,Ph=Yp;function Dh(t){let e=Vp({...t}),n=a.useRef(),{collection:r}=e,{gridProps:l}=xp({...t,"aria-label":t["aria-label"]||"Table"},e,n);return g.jsxs("table",{...l,ref:n,className:L.csx("proton-Table"),children:[g.jsx(ii,{type:"thead",children:r.headerRows.map(i=>g.jsx(xh,{item:i,state:e,children:Array.from(r.getChildren(i.key)).map(o=>g.jsx(Eh,{column:o,state:e},o.key))},i.key))}),g.jsx(ii,{type:"tbody",children:Array.from(r.body.childNodes).map(i=>g.jsx(Ch,{item:i,state:e,children:Array.from(r.getChildren(i.key)).map(o=>g.jsx(Sh,{cell:o,state:e},o.key))},i.key))})]})}function qa({children:t,arrow:e,...n}){const{style:r}=Ce();return g.jsxs(dh,{...n,className:"proton__Tooltip proton-Dialog",style:r,children:[e&&g.jsx(Qv,{className:"proton__TooltipArrow",children:g.jsx("svg",{width:8,height:8,viewBox:"0 0 8 8",children:g.jsx("path",{d:"M0 0 L4 4 L8 0"})})}),t]})}function Xa({children:t,delay:e=500,closeDelay:n=500,isDisabled:r,defaultOpen:l,onOpenChange:i,disableTriggerClick:o,content:u,...s}){const[c,d]=a.useState(!1),f=a.useRef(!1),p=a.useRef(!1);return g.jsxs(ah,{delay:e,closeDelay:n,isDisabled:r,isOpen:c,defaultOpen:l,onOpenChange:v=>{v&&!f.current&&(p.current=!0),i&&i(v),f.current||d(v),f.current=!1},children:[g.jsx(ja,{className:"proton__TooltipTrigger","aria-label":"Show tooltip",onPress:()=>{o||r||p.current||(f.current=!0,d(!c))},children:t}),g.jsx(qa,{...s,children:u})]})}const kh=({to:t,children:e,tooltipProps:n,"data-testid":r})=>{const{className:l}=Ce(),i=n?g.jsx(Xa,{delay:50,closeDelay:75,...n,children:e}):e;if(t){const o=L.isUrlExternal(t);return g.jsx("span",{className:L.csx("proton-TextEmphasis",n&&"proton-TextEmphasis--tooltip",l),children:g.jsx("a",{"data-testid":r,href:t,target:o?"_blank":void 0,rel:o?"noopener noreferrer":void 0,onClick:o?void 0:u=>L.handleInternalNavigation(u,t),children:i})})}return g.jsx("span",{className:L.csx("proton-TextEmphasis",n&&"proton-TextEmphasis--tooltip",l),"data-testid":r,children:i})};function Th({amplitude:t,isDisabled:e,isPlayed:n,isHovered:r,isVisible:l,hasAnimated:i,resolution:o,spacing:u,index:s}){const c=l?`${Math.max(t*100,4)}%`:"0%";return g.jsxs("div",{className:L.csx("proton-Waveform__bar-wrapper"),style:{width:`${o}px`,marginRight:`${u}px`},children:[g.jsx("div",{className:L.csx("proton-Waveform__bar","proton-Waveform__bar--upper",e&&"proton-Waveform__bar--disabled",n&&"proton-Waveform__bar--played",l&&"proton-Waveform__bar--visible",i&&"proton-Waveform__bar--animated"),style:{"--target-height":`calc(${c} / 2)`,"--index":s}}),g.jsx("div",{className:L.csx("proton-Waveform__bar","proton-Waveform__bar--lower",e&&"proton-Waveform__bar--disabled",n&&"proton-Waveform__bar--played",l&&"proton-Waveform__bar--visible",i&&"proton-Waveform__bar--animated"),style:{"--target-height":`calc(${c} / 2)`,"--index":s}}),r&&!e&&!n&&g.jsx("div",{className:"proton-Waveform__bar--hover",style:{"--hover-height":c}})]})}const Ah=Ih(100);function Bh({data:t,resolution:e=2,startDuration:n,endDuration:r,currentTime:l=0,showTimestamps:i=!1,totalDuration:o,onClick:u,"data-testid":s}){var S;const{className:c}=Ce(),d=a.useRef(null),[f,p]=a.useState([]),[v,b]=a.useState(null),[$,y]=a.useState(!1),[C,D]=a.useState(!1),x=t||Ah,k=e;a.useEffect(()=>{if(!d.current)return;const w=R=>{const A=Math.floor(R/(e+k)),j=Mh(x,A);p(j)},M=d.current.clientWidth;w(M);const E=new ResizeObserver(R=>{R&&R[0]&&w(R[0].contentRect.width)});return E.observe(d.current),()=>E.disconnect()},[x,e,k]),a.useEffect(()=>{const w=setTimeout(()=>y(!0),50),M=setTimeout(()=>D(!0),500);return()=>{clearTimeout(w),clearTimeout(M)}},[]);const P=w=>{if(!d.current)return;const M=d.current.getBoundingClientRect(),R=(w.clientX-M.left)/M.width*o;b(R)},T=()=>{b(null)},F=e+k,h=(w,M)=>{var A;const E=w/o*100;return(M==="start"?Math.floor(E/100*f.length):Math.ceil(E/100*f.length))*F/((A=d.current)==null?void 0:A.clientWidth)*100},B=(S=d.current)==null?void 0:S.clientWidth;return g.jsxs("div",{className:L.csx("proton-Waveform",c),"data-testid":s,children:[i&&g.jsx(oi,{direction:"left",seconds:l}),g.jsxs("div",{ref:d,className:"proton-Waveform__container",onMouseMove:P,onMouseLeave:T,onClick:w=>{if(!d.current)return;const M=d.current.getBoundingClientRect(),R=(w.clientX-M.left)/M.width*o;u==null||u(R,w)},children:[n!==void 0&&r!==void 0&&g.jsx("div",{className:"proton-Waveform__active-region",style:{left:d.current?`calc(${h(n,"start")}%`:"0%",right:d.current?`calc(${100-h(r,"end")}% - 2px)`:"0%"}}),v!==null&&g.jsx("div",{className:"proton-Waveform__hover-line",style:{left:`${v/o*100}%`}}),f.map((w,M)=>{const E=M/f.length*o,R=n!==void 0&&r!==void 0&&(E<n||E>r),A=l===0?!1:E<=l,j=v!==null&&E<=v;return g.jsx(Th,{amplitude:w,isDisabled:R,isPlayed:A,isHovered:j,isVisible:$,hasAnimated:C,resolution:e,spacing:k,index:M},M)})]}),!t&&g.jsx("div",{className:"proton-Waveform__bar-unavailable",style:{fontSize:B<325?"0.85rem":"1rem"},children:B<277?"Unavailable":"Waveform Unavailable"}),i&&g.jsx(oi,{direction:"right",seconds:o})]})}function oi({direction:t,seconds:e}){return g.jsx("div",{className:L.csx("proton-Waveform__timestamp",`proton-Waveform__timestamp--${t}`),children:Kh(e)})}function Kh(t){const e=Math.floor(t/60),n=Math.floor(t%60);return`${e}:${n<10?"0":""}${n.toFixed(0)}`}function Mh(t,e){const n=t.length,r=n/e,l=new Array(e).fill(0).map((i,o)=>{const u=o*r,s=Math.floor(u),c=Math.min(s+1,n-1),d=u-s;return t[s]*(1-d)+t[c]*d});return Rh(l)}function Rh(t){const e=Math.min(...t),n=Math.max(...t);return t.map(r=>{const l=(r-e)/(n-e);return Math.max(l*.8+.1,.1)})}function Ih(t){return Array.from({length:t},(e,n)=>{const l=n/(t-1)*6*2*Math.PI-Math.PI/2;return Math.sin(l)*.5+.5})}const Fh=t=>{const[e,n,r]=t,l=e+n+r;if(l<50){const i=l/100;return`rgba(255, 255, 255, ${Math.max(.1,.3-i)})`}return""};function _h({image:t,imageUrl:e="",onLoad:n}){const{palette:r}=Ce(),l=en.parseToRgba(r.BASE_COLOR),i=Fh(l);return g.jsxs(Yr,{fadeIn:!1,children:[t?g.jsx("div",{"aria-hidden":"true",children:t}):g.jsx("img",{alt:"",src:e,className:"proton-Backdrop__image",onLoad:o=>n==null?void 0:n(o.currentTarget),"aria-hidden":"true"}),g.jsx("div",{className:"proton-Backdrop__blur","aria-hidden":"true",style:{WebkitBackdropFilter:"blur(24px) brightness(75%)",backdropFilter:"blur(24px) brightness(75%)",filter:"brightness(50%)",background:i}})]})}exports.THEMES=Ie.THEMES;exports.COLORS=X.colors;exports.ActionMenu=qr;exports.Backdrop=Yr;exports.Badge=ov;exports.BadgeVariants=iv;exports.Banner=ke;exports.Button=Xr;exports.ButtonGroup=Ra;exports.Cell=Ph;exports.Column=wh;exports.Dialog=vv;exports.Icon=bv;exports.ImageBackdrop=_h;exports.Input=Ia;exports.Popover=kn;exports.ResponsiveMenuTrigger=vh;exports.ResponsiveSelect=yh;exports.Row=Gp;exports.SearchInput=gv;exports.Section=Of;exports.Select=bh;exports.Switch=$h;exports.Table=Dh;exports.TableBody=Up;exports.TableHeader=Hp;exports.TextEmphasis=kh;exports.ThemeProvider=rv;exports.Tooltip=qa;exports.TooltipTrigger=Xa;exports.Waveform=Bh;exports.usePopoverTrigger=yv;exports.useTheme=Ce;
48
48
  //# sourceMappingURL=index.cjs.js.map