@protonradio/proton-ui 0.6.18-beta.19 → 0.6.18-beta.20
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 +2 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +220 -220
- package/dist/index.es.js.map +1 -1
- package/dist/{utils-DAupKByO.mjs → utils-BBEUZeME.mjs} +45 -42
- package/dist/utils-BBEUZeME.mjs.map +1 -0
- package/dist/utils-D3Qu5ziO.js +2 -0
- package/dist/utils-D3Qu5ziO.js.map +1 -0
- package/dist/utils.cjs.js +1 -1
- package/dist/utils.es.js +1 -1
- package/package.json +1 -1
- package/dist/utils-DAupKByO.mjs.map +0 -1
- package/dist/utils-DaN5ULjj.js +0 -2
- package/dist/utils-DaN5ULjj.js.map +0 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react"),ot=require("react-dom"),j=require("./utils-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react"),ot=require("react-dom"),j=require("./utils-D3Qu5ziO.js"),ve=require("./constants.cjs.js"),Pe=require("color2k"),Y=require("./colors-BdogYmJi.js");var er={exports:{}},Dt={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -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 ei;function wv(){return ei||(ei=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 T=arguments.length,w=new Array(T>1?T-1:0),D=1;D<T;D++)w[D-1]=arguments[D];r("error",x,w)}}function r(x,T,w){{var D=e.ReactDebugCurrentFrame,I=D.getStackAddendum();I!==""&&(T+="%s",w=w.concat([I]));var h=w.map(function(B){return String(B)});h.unshift("Warning: "+T),Function.prototype.apply.call(console[x],console,h)}}function l(x,T){return x===T&&(x!==0||1/x===1/T)||x!==x&&T!==T}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,T,w){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 D=T();if(!f){var I=T();i(D,I)||(n("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}var h=o({inst:{value:D,getSnapshot:T}}),B=h[0].inst,P=h[1];return s(function(){B.value=D,B.getSnapshot=T,v(B)&&P({inst:B})},[x,D,T]),u(function(){v(B)&&P({inst:B});var A=function(){v(B)&&P({inst:B})};return x(A)},[x]),c(D),D}function v(x){var T=x.getSnapshot,w=x.value;try{var D=T();return!i(w,D)}catch{return!0}}function b(x,T,w){return T()}var y=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",$=!y,C=$?b:p,S=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:C;Qn.useSyncExternalStore=S,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=Sv():Cr.exports=wv();var Pv=Cr.exports;const _a=a.createContext(!1),Ot=a.createContext(null);function Dv(t){if(a.useContext(Ot))return t.content;let{collection:n,document:r}=Bv(t.createCollection);return a.createElement(a.Fragment,null,a.createElement(Ev,null,a.createElement(Ot.Provider,{value:r},t.content)),a.createElement(kv,{render:t.children,collection:n}))}function kv({collection:t,render:e}){return e(t)}function Tv(t,e,n){let r=Ze(),l=a.useRef(r);l.current=r;let i=a.useCallback(()=>l.current?n():e(),[e,n]);return Pv.useSyncExternalStore(t,i)}const Av=typeof a.useSyncExternalStore=="function"?a.useSyncExternalStore:Tv;function Bv(t){let[e]=a.useState(()=>new yv((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=Av(n,r,l);return G(()=>(e.isMounted=!0,()=>{e.isMounted=!1}),[e]),{collection:i,document:e}}const Sr=a.createContext(null);function Kv(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 Mv(t,e){let n=({node:l})=>e(l.props,l.props.ref,l),r=a.forwardRef((l,i)=>{if(!a.useContext(_a)){if(e.length>=3)throw new Error(e.name+" cannot be rendered outside a collection.");return e(l,i)}return Kv(t,l,i,"children"in l?l.children:null,null,u=>a.createElement(n,{node:u}))});return r.displayName=e.name,r}function Rv(t){return Na({...t,addIdAndValue:!0})}const ti=a.createContext(null);function Iv(t){let e=a.useContext(ti),n=((e==null?void 0:e.dependencies)||[]).concat(t.dependencies),r=t.idScope||(e==null?void 0:e.idScope),l=Rv({...t,idScope:r,dependencies:n});return a.useContext(Ot)&&(l=a.createElement(Fv,null,l)),e=a.useMemo(()=>({dependencies:n,idScope:r}),[r,...n]),a.createElement(ti.Provider,{value:e},l)}function Fv({children:t}){let e=a.useContext(Ot),n=a.useMemo(()=>a.createElement(Ot.Provider,{value:null},a.createElement(_a.Provider,{value:!0},t)),[t]);return Ze()?a.createElement(Sr.Provider,{value:e},n):ot.createPortal(n,e)}const Nv=a.createContext(null),_v={CollectionRoot({collection:t,renderDropIndicator:e}){return ni(t,null,e)},CollectionBranch({collection:t,parent:e,renderDropIndicator:n}){return ni(t,e,n)}};function ni(t,e,n){return Na({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(_v);function Lv(t){return a.useMemo(()=>t!=null?new Set([t]):null,[t])}const ri=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 St(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 za(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[ri])throw new Error(`A slot prop is required. Valid slot names are ${r}.`);let l=e||ri;if(!n.slots[l])throw new Error(`Invalid slot "${e}". Valid slot names are ${r}.`);return n.slots[l]}return n}function Wt(t,e,n){let r=za(n,t.slot)||{},{ref:l,...i}=r,o=mn(a.useMemo(()=>Ic(e,l),[e,l])),u=O(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 G(()=>{n.current||e(!1)},[]),[r,t]}function Ov(t,e=!0){let[n,r]=a.useState(!0);return Oa(t,n&&e,a.useCallback(()=>r(!1),[])),n&&e}function jv(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"),Oa(t,n,a.useCallback(()=>{i("exited"),r(!1)},[])),n}function Oa(t,e,n){let r=a.useRef(null);e&&t.current&&(r.current=window.getComputedStyle(t.current).animation),G(()=>{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),ot.flushSync(()=>{n()}))},o=t.current;return o.addEventListener("animationend",i),()=>{o.removeEventListener("animationend",i)}}else n()}},[t,e,n])}const Vv=a.createContext(null),Hv=new Set(["form","formAction","formEncType","formMethod","formNoValidate","formTarget","name","value"]),Wv=a.createContext({});function Uv(t,e){[t,e]=Wt(t,e,Wv),t=Gv(t);let n=t,{isPending:r}=n,{buttonProps:l,isPressed:i}=Sn(t,e),{focusProps:o,isFocused:u,isFocusVisible:s}=Ht(t),{hoverProps:c,isHovered:d}=Et({...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=St({...t,values:f,defaultClassName:"react-aria-Button"}),v=de(l.id),b=de(),y=l["aria-labelledby"];r&&(y?y=`${y} ${b}`:l["aria-label"]&&(y=`${v} ${b}`));let $=a.useRef(r);return a.useEffect(()=>{let C={"aria-labelledby":y||v};(!$.current&&u&&r||$.current&&u&&!r)&&dn(C,"assertive"),$.current=r},[r,u,y,v]),a.createElement("button",{...se(t,{propNames:Hv}),...O(l,o,c),...p,id:v,ref:e,"aria-labelledby":y,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(Vv.Provider,{value:{id:b}},p.children))}function Gv(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=Cv(Uv),Yv=a.createContext({}),qv=a.createContext({}),Xv=a.createContext({}),Va=a.createContext({placement:"bottom"});function Zv(t,e){[t,e]=Wt(t,e,Va);let n=t.placement,r={position:"absolute",[n]:"100%",transform:n==="top"||n==="bottom"?"translateX(-50%)":"translateY(-50%)"},l=St({...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 Jv=a.forwardRef(Zv),wr=a.createContext(null),Qv=a.createContext(null),eh=a.createContext({}),Ha=a.createContext(null),Zr=a.createContext(null),Wa=a.createContext(null);function th(t){let e=Kp(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}],[Qv,e],[Wa,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 nh=a.createContext(null);function rh(t,e){return[t,e]=Wt(t,e,Ha),a.createElement(Dv,{content:a.createElement(Iv,t)},n=>n.size>0&&a.createElement(lh,{props:t,collection:n,menuRef:e}))}function lh({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(Wa),d=a.useContext(wr),f=(d==null?void 0:d.trigger)==="SubmenuTrigger";wi({ref:n,onInteractOutside:$=>{c&&!(l!=null&&l.contains($.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:$}=l.getBoundingClientRect();b({left:-1*$})}},[v,l]);let y=St({defaultClassName:"react-aria-Menu",className:t.className,style:t.style,values:{}});return a.createElement(xn,null,a.createElement("div",{...se(t),...s,...y,ref:n,slot:t.slot||void 0,onScroll:t.onScroll},a.createElement(Tn,{values:[[Zr,r],[Xv,{elementType:"div"}],[wr,{UNSTABLE_portalContainer:l||void 0}],[Nv,{render:oh}],[nh,{parentMenuRef:n}],[Pr,null]]},a.createElement(u,{collection:e,persistedKeys:Lv(r.selectionManager.focusedKey),scrollRef:n}))),a.createElement("div",{ref:i,style:{width:"100vw",position:"absolute",top:0,...v}}))}const ih=a.forwardRef(rh);function oh(t,e,n){var r,l;let i=a.useContext(Zr),{CollectionBranch:o}=a.useContext(La),[u,s]=zv();var c;let{headingProps:d,groupProps:f}=Hf({heading:s,"aria-label":(c=n.props["aria-label"])!==null&&c!==void 0?c:void 0}),p=St({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",{...se(t),...f,...p,ref:e},a.createElement(qv.Provider,{value:{...d,ref:u}},a.createElement(o,{collection:i.collection,parent:n})))}const Pr=a.createContext(null),uh=Mv("item",function(e,n,r){var l;[e,n]=Wt(e,n,Pr);let i=(l=za(Pr))===null||l===void 0?void 0:l.id,o=a.useContext(Zr),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}=Ht(),{hoverProps:y,isHovered:$}=Et({isDisabled:p.isDisabled}),C=St({...e,id:void 0,children:r.rendered,defaultClassName:"react-aria-MenuItem",values:{...p,isHovered:$,isFocusVisible:v,selectionMode:o.selectionManager.selectionMode,selectionBehavior:o.selectionManager.selectionBehavior,hasSubmenu:!!e["aria-haspopup"],isOpen:e["aria-expanded"]==="true"}}),S=e.href?"a":"div";return a.createElement(S,{...O(s,b,y),...C,ref:u,"data-disabled":p.isDisabled||void 0,"data-hovered":$||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:[[Yv,{slots:{label:c,description:d}}],[eh,f]]},C.children))}),Jr=a.createContext(null),Ua=a.createContext(null);function sh(t){let e=Ta(t),n=a.useRef(null),{triggerProps:r,tooltipProps:l}=kp(t,e,n);return a.createElement(Tn,{values:[[Jr,e],[Ua,{...l,triggerRef:n}]]},a.createElement(Id,{...r,ref:n},t.children))}function ah({UNSTABLE_portalContainer:t,...e},n){[e,n]=Wt(e,n,Ua);let r=a.useContext(Jr),l=Ta(e),i=e.isOpen!=null||e.defaultOpen!=null||!r?l:r,o=jv(n,i.isOpen)||e.isExiting||!1;return!i.isOpen&&!o?null:a.createElement(Sf,{portalContainer:t},a.createElement(dh,{...e,tooltipRef:n,isExiting:o}))}const ch=a.forwardRef(ah);function dh(t){let e=a.useContext(Jr),n=a.useRef(null),[r,l]=a.useState(0);G(()=>{n.current&&e.isOpen&&l(n.current.getBoundingClientRect().width)},[e.isOpen,n]);let{overlayProps:i,arrowProps:o,placement:u}=Oi({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=Ov(t.tooltipRef,!!u)||t.isEntering||!1,c=St({...t,defaultClassName:"react-aria-Tooltip",values:{placement:u,isEntering:s,isExiting:t.isExiting,state:e}});t=O(t,i);let{tooltipProps:d}=Dp(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 fh=({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 ph({renderTrigger:t,menuId:e,size:n=24,actions:r,disabled:l,onClose:i,testId:o,menuTestId:u}){const{className:s}=Te(),c=Ga(ve.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($=>!$),isDisabled:l,className:`proton-ResponsiveMenuTrigger__button ${s}`,children:g.jsx(fh,{size:n})}),y=t?t({...v,onClick:()=>f($=>!$)},d):b;return a.useEffect(()=>()=>{d&&(i==null||i())},[d,i]),c?g.jsxs(g.Fragment,{children:[y,d&&g.jsx(Yr,{id:e,actions:r,isOpen:d,onClose:()=>{f(!1)},showCancel:!0,"data-testid":u})]}):g.jsxs(th,{children:[y,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(ih,{className:"proton-ListBox proton-ResponsiveMenuTrigger__menu",id:e,autoFocus:!0,"data-testid":u,children:r.map($=>g.jsx(uh,{href:$.to,target:"_blank",rel:"noopener noreferrer",onAction:()=>{var C;(C=$.onAction)==null||C.call($,$.key),setTimeout(()=>{f(!1)},200)},className:"proton-ListBox__item proton-ResponsiveMenuTrigger__menu-item",children:$.label},$.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(vh,{item:l,state:n},l.key))})})};function vh({item:t,state:e}){let n=a.useRef(null),{optionProps:r,isSelected:l,isFocused:i,isDisabled:o}=jf({key:t.key},e,n);return g.jsx("li",{...r,className:j.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:j.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 hh({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:y,triggerProps:$,valueProps:C,menuProps:S}=zs({...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",{...y,className:"proton-Select__label","data-testid":"select-label",children:t}):g.jsx("div",{...y}),g.jsx(Os,{isDisabled:n,state:p,triggerRef:v,label:t||e,name:e,"data-testid":"hidden-select-container"}),g.jsxs(Ya,{...$,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:j.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,{state:p,triggerRef:v,popoverRef:b,placement:"bottom start","data-testid":"select-popover",children:g.jsx(Dr,{...S,state:p})})})]})}const mh={Menu:hh,Option:Lr};function bh({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:T=>{T?o==null||o():u==null||u()},items:s,"data-testid":c,children:d},p=Ca(f),v=Ga(ve.BREAKPOINTS.MEDIUM),b=a.useRef(null),y=a.useRef(null),{labelProps:$,triggerProps:C,valueProps:S,menuProps:x}=zs({...f,label:t||e},p,b);return a.useEffect(()=>{p.isOpen&&y.current&&b.current&&!y.current.style.minWidth&&(y.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",{...$,className:"proton-Select__label","data-testid":"select-label",children:t}):g.jsx("div",{...$}),g.jsx(Os,{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",{...S,children:p.selectedItem?p.selectedItem.rendered:"Select an option"}),g.jsx("div",{className:j.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(Yr,{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:y,placement:"bottom start","data-testid":"select-popover",children:g.jsx(Dr,{...x,state:p})})})})]})}const gh={Menu:bh,Option:Lr};function $h(t){let e={...t,isSelected:t.isOn,"data-testid":void 0},n=a.useRef(null),r=lf(e),{inputProps:l}=vp(e,r,n);return g.jsxs("label",{className:j.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(Nr,{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 yh({item:t,state:e,children:n}){let r=a.useRef(),{rowProps:l}=Sp({node:t},e);return g.jsx("tr",{className:j.csx("proton-Table__headerRow"),...l,ref:r,children:n})}function xh({column:t,state:e}){var s,c;let n=a.useRef(),{columnHeaderProps:r}=Ep({node:t},e,n);const{align:l="left"}=t.props;let{isFocusVisible:i,focusProps:o}=Ht(),u=((s=e.sortDescriptor)==null?void 0:s.direction)==="ascending"?"▲":"▼";return g.jsxs("th",{...O(r,o),colSpan:t.colspan,className:j.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:j.csx("proton-Table__headerSortIcon"),style:{visibility:((c=e.sortDescriptor)==null?void 0:c.column)===t.key?"visible":"hidden"},children:u})]})}function li({type:t,children:e}){let{rowGroupProps:n}=Pp();return g.jsx(t,{...n,className:j.csx("proton-Table__rowGroup",t==="thead"?"proton-Table__rowGroup--header":"proton-Table__rowGroup--body"),children:e})}function Eh({item:t,children:e,state:n}){let r=a.useRef(),l=n.selectionManager.isSelected(t.key),{rowProps:i,isPressed:o}=Cp({node:t},n,r),{isFocusVisible:u,focusProps:s}=Ht();return g.jsx("tr",{className:j.csx("proton-Table__row",l?"proton-Table__row--selected":null,o?"proton-Table__row--pressed":null,u?"proton-Table__row--focused":null),...O(i,s),ref:r,children:e})}function Ch({cell:t,state:e,...n}){let r=a.useRef(),{gridCellProps:l}=wp({node:t},e,r),{isFocusVisible:i,focusProps:o}=Ht();const{align:u}=t.props;return g.jsx("td",{...O(l,o),className:j.csx("proton-Table__cell",i?"proton-Table__cell--focused":null,`proton-Table__cell--${u}`),ref:r,children:t.rendered})}const Sh=Wp,wh=Gp;function Ph(t){let e=jp({...t}),n=a.useRef(),{collection:r}=e,{gridProps:l}=yp({...t,"aria-label":t["aria-label"]||"Table"},e,n);return g.jsxs("table",{...l,ref:n,className:j.csx("proton-Table"),children:[g.jsx(li,{type:"thead",children:r.headerRows.map(i=>g.jsx(yh,{item:i,state:e,children:Array.from(r.getChildren(i.key)).map(o=>g.jsx(xh,{column:o,state:e},o.key))},i.key))}),g.jsx(li,{type:"tbody",children:Array.from(r.body.childNodes).map(i=>g.jsx(Eh,{item:i,state:e,children:Array.from(r.getChildren(i.key)).map(o=>g.jsx(Ch,{cell:o,state:e},o.key))},i.key))})]})}function qa({children:t,arrow:e,...n}){const{palette:r,theme:l,style:i}=Te(),o={"--tooltip-background":(()=>{switch(l){case ve.THEMES.CUSTOM_DARK:return r.PRIMARY.PRIMARY_MEDIUM;case ve.THEMES.DARK:return r.PRIMARY.PRIMARY_DARK;default:return Y.GRAYSCALE.WHITE}})(),...i};return g.jsxs(ch,{...n,className:"proton__Tooltip proton-Dialog",style:o,children:[e&&g.jsx(Jv,{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(sh,{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 Dh=({to:t,children:e,tooltipProps:n,"data-testid":r})=>{const{className:l,palette:i,theme:o}=Te(),u=n?g.jsx(Xa,{delay:50,closeDelay:75,...n,children:e}):e,s={"--text-emphasis-highlight":o===ve.THEMES.CUSTOM_DARK?Pe.transparentize(i.SECONDARY.SECONDARY_LIGHT,.3):Pe.transparentize(Y.BRAND.PRIMARY,.5)};if(t){const c=j.isUrlExternal(t);return g.jsx("span",{className:j.csx("proton-TextEmphasis",n&&"proton-TextEmphasis--tooltip",l),style:s,children:g.jsx("a",{"data-testid":r,href:t,target:c?"_blank":void 0,rel:c?"noopener noreferrer":void 0,onClick:c?void 0:d=>j.handleInternalNavigation(d,t),children:u})})}return g.jsx("span",{className:j.csx("proton-TextEmphasis",n&&"proton-TextEmphasis--tooltip",l),style:s,"data-testid":r,children:u})};function kh({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:j.csx("proton-Waveform__bar-wrapper"),style:{width:`${o}px`,marginRight:`${u}px`},children:[g.jsx("div",{className:j.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:j.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 Th=Rh(100);function Ah({data:t,resolution:e=2,startDuration:n,endDuration:r,currentTime:l=0,showTimestamps:i=!1,totalDuration:o,onClick:u,timestampColor:s,"data-testid":c}){var N;const{className:d,palette:f,theme:p}=Te(),v=a.useRef(null),[b,y]=a.useState([]),[$,C]=a.useState(null),[S,x]=a.useState(!1),[T,w]=a.useState(!1),D=t||Th,I=s||(p==="custom-dark"?f.BRAND.PRIMARY_LIGHT:void 0),h=e;a.useEffect(()=>{if(!v.current)return;const k=W=>{const ne=Math.floor(W/(e+h)),oe=Kh(D,ne);y(oe)},L=v.current.clientWidth;k(L);const M=new ResizeObserver(W=>{W&&W[0]&&k(W[0].contentRect.width)});return M.observe(v.current),()=>M.disconnect()},[D,e,h]),a.useEffect(()=>{const k=setTimeout(()=>x(!0),50),L=setTimeout(()=>w(!0),500);return()=>{clearTimeout(k),clearTimeout(L)}},[]);const B=k=>{if(!v.current)return;const L=v.current.getBoundingClientRect(),W=(k.clientX-L.left)/L.width*o;C(W)},P=()=>{C(null)},A=e+h,R=(k,L)=>{var ne;const M=k/o*100;return(L==="start"?Math.floor(M/100*b.length):Math.ceil(M/100*b.length))*A/((ne=v.current)==null?void 0:ne.clientWidth)*100},E=(N=v.current)==null?void 0:N.clientWidth;return g.jsxs("div",{className:j.csx("proton-Waveform",d),"data-testid":c,children:[i&&g.jsx(ii,{direction:"left",seconds:l,color:I}),g.jsxs("div",{ref:v,className:"proton-Waveform__container",onMouseMove:B,onMouseLeave:P,onClick:k=>{if(!v.current)return;const L=v.current.getBoundingClientRect(),W=(k.clientX-L.left)/L.width*o;u==null||u(W,k)},children:[n!==void 0&&r!==void 0&&g.jsx("div",{className:"proton-Waveform__active-region",style:{left:v.current?`calc(${R(n,"start")}%`:"0%",right:v.current?`calc(${100-R(r,"end")}% - 2px)`:"0%"}}),$!==null&&g.jsx("div",{className:"proton-Waveform__hover-line",style:{left:`${$/o*100}%`}}),b.map((k,L)=>{const M=L/b.length*o,W=n!==void 0&&r!==void 0&&(M<n||M>r),ne=l===0?!1:M<=l,oe=$!==null&&M<=$;return g.jsx(kh,{amplitude:k,isDisabled:W,isPlayed:ne,isHovered:oe,isVisible:S,hasAnimated:T,resolution:e,spacing:h,index:L},L)})]}),!t&&g.jsx("div",{className:"proton-Waveform__bar-unavailable",style:{backgroundColor:I,fontSize:E<325?"0.85rem":"1rem"},children:E<277?"Unavailable":"Waveform Unavailable"}),i&&g.jsx(ii,{direction:"right",seconds:o,color:I})]})}function ii({direction:t,color:e,seconds:n}){return g.jsx("div",{className:j.csx("proton-Waveform__timestamp",`proton-Waveform__timestamp--${t}`),style:{backgroundColor:e},children:Bh(n)})}function Bh(t){const e=Math.floor(t/60),n=Math.floor(t%60);return`${e}:${n<10?"0":""}${n.toFixed(0)}`}function Kh(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 Mh(l)}function Mh(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 Rh(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})}exports.THEMES=ve.THEMES;exports.COLORS=Y.colors;exports.ActionMenu=Yr;exports.Badge=iv;exports.BadgeVariants=lv;exports.Banner=Ae;exports.Button=qr;exports.ButtonGroup=Ra;exports.Cell=wh;exports.Column=Sh;exports.Dialog=pv;exports.Icon=mv;exports.Input=Ia;exports.Popover=kn;exports.ResponsiveMenuTrigger=ph;exports.ResponsiveSelect=gh;exports.Row=Up;exports.SearchInput=bv;exports.Section=Lf;exports.Select=mh;exports.Switch=$h;exports.Table=Ph;exports.TableBody=Hp;exports.TableHeader=Vp;exports.TextEmphasis=Dh;exports.ThemeProvider=nv;exports.Tooltip=qa;exports.TooltipTrigger=Xa;exports.Waveform=Ah;exports.usePopoverTrigger=gv;exports.useTheme=Te;
|
|
47
|
+
*/var ei;function wv(){return ei||(ei=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 T=arguments.length,w=new Array(T>1?T-1:0),D=1;D<T;D++)w[D-1]=arguments[D];r("error",x,w)}}function r(x,T,w){{var D=e.ReactDebugCurrentFrame,I=D.getStackAddendum();I!==""&&(T+="%s",w=w.concat([I]));var h=w.map(function(B){return String(B)});h.unshift("Warning: "+T),Function.prototype.apply.call(console[x],console,h)}}function l(x,T){return x===T&&(x!==0||1/x===1/T)||x!==x&&T!==T}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,T,w){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 D=T();if(!f){var I=T();i(D,I)||(n("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}var h=o({inst:{value:D,getSnapshot:T}}),B=h[0].inst,P=h[1];return s(function(){B.value=D,B.getSnapshot=T,v(B)&&P({inst:B})},[x,D,T]),u(function(){v(B)&&P({inst:B});var A=function(){v(B)&&P({inst:B})};return x(A)},[x]),c(D),D}function v(x){var T=x.getSnapshot,w=x.value;try{var D=T();return!i(w,D)}catch{return!0}}function b(x,T,w){return T()}var y=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",$=!y,C=$?b:p,S=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:C;Qn.useSyncExternalStore=S,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=Sv():Cr.exports=wv();var Pv=Cr.exports;const _a=a.createContext(!1),Ot=a.createContext(null);function Dv(t){if(a.useContext(Ot))return t.content;let{collection:n,document:r}=Bv(t.createCollection);return a.createElement(a.Fragment,null,a.createElement(Ev,null,a.createElement(Ot.Provider,{value:r},t.content)),a.createElement(kv,{render:t.children,collection:n}))}function kv({collection:t,render:e}){return e(t)}function Tv(t,e,n){let r=Ze(),l=a.useRef(r);l.current=r;let i=a.useCallback(()=>l.current?n():e(),[e,n]);return Pv.useSyncExternalStore(t,i)}const Av=typeof a.useSyncExternalStore=="function"?a.useSyncExternalStore:Tv;function Bv(t){let[e]=a.useState(()=>new yv((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=Av(n,r,l);return G(()=>(e.isMounted=!0,()=>{e.isMounted=!1}),[e]),{collection:i,document:e}}const Sr=a.createContext(null);function Kv(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 Mv(t,e){let n=({node:l})=>e(l.props,l.props.ref,l),r=a.forwardRef((l,i)=>{if(!a.useContext(_a)){if(e.length>=3)throw new Error(e.name+" cannot be rendered outside a collection.");return e(l,i)}return Kv(t,l,i,"children"in l?l.children:null,null,u=>a.createElement(n,{node:u}))});return r.displayName=e.name,r}function Rv(t){return Na({...t,addIdAndValue:!0})}const ti=a.createContext(null);function Iv(t){let e=a.useContext(ti),n=((e==null?void 0:e.dependencies)||[]).concat(t.dependencies),r=t.idScope||(e==null?void 0:e.idScope),l=Rv({...t,idScope:r,dependencies:n});return a.useContext(Ot)&&(l=a.createElement(Fv,null,l)),e=a.useMemo(()=>({dependencies:n,idScope:r}),[r,...n]),a.createElement(ti.Provider,{value:e},l)}function Fv({children:t}){let e=a.useContext(Ot),n=a.useMemo(()=>a.createElement(Ot.Provider,{value:null},a.createElement(_a.Provider,{value:!0},t)),[t]);return Ze()?a.createElement(Sr.Provider,{value:e},n):ot.createPortal(n,e)}const Nv=a.createContext(null),_v={CollectionRoot({collection:t,renderDropIndicator:e}){return ni(t,null,e)},CollectionBranch({collection:t,parent:e,renderDropIndicator:n}){return ni(t,e,n)}};function ni(t,e,n){return Na({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(_v);function Lv(t){return a.useMemo(()=>t!=null?new Set([t]):null,[t])}const ri=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 St(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 za(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[ri])throw new Error(`A slot prop is required. Valid slot names are ${r}.`);let l=e||ri;if(!n.slots[l])throw new Error(`Invalid slot "${e}". Valid slot names are ${r}.`);return n.slots[l]}return n}function Wt(t,e,n){let r=za(n,t.slot)||{},{ref:l,...i}=r,o=mn(a.useMemo(()=>Ic(e,l),[e,l])),u=O(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 G(()=>{n.current||e(!1)},[]),[r,t]}function Ov(t,e=!0){let[n,r]=a.useState(!0);return Oa(t,n&&e,a.useCallback(()=>r(!1),[])),n&&e}function jv(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"),Oa(t,n,a.useCallback(()=>{i("exited"),r(!1)},[])),n}function Oa(t,e,n){let r=a.useRef(null);e&&t.current&&(r.current=window.getComputedStyle(t.current).animation),G(()=>{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),ot.flushSync(()=>{n()}))},o=t.current;return o.addEventListener("animationend",i),()=>{o.removeEventListener("animationend",i)}}else n()}},[t,e,n])}const Vv=a.createContext(null),Hv=new Set(["form","formAction","formEncType","formMethod","formNoValidate","formTarget","name","value"]),Wv=a.createContext({});function Uv(t,e){[t,e]=Wt(t,e,Wv),t=Gv(t);let n=t,{isPending:r}=n,{buttonProps:l,isPressed:i}=Sn(t,e),{focusProps:o,isFocused:u,isFocusVisible:s}=Ht(t),{hoverProps:c,isHovered:d}=Et({...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=St({...t,values:f,defaultClassName:"react-aria-Button"}),v=de(l.id),b=de(),y=l["aria-labelledby"];r&&(y?y=`${y} ${b}`:l["aria-label"]&&(y=`${v} ${b}`));let $=a.useRef(r);return a.useEffect(()=>{let C={"aria-labelledby":y||v};(!$.current&&u&&r||$.current&&u&&!r)&&dn(C,"assertive"),$.current=r},[r,u,y,v]),a.createElement("button",{...se(t,{propNames:Hv}),...O(l,o,c),...p,id:v,ref:e,"aria-labelledby":y,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(Vv.Provider,{value:{id:b}},p.children))}function Gv(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=Cv(Uv),Yv=a.createContext({}),qv=a.createContext({}),Xv=a.createContext({}),Va=a.createContext({placement:"bottom"});function Zv(t,e){[t,e]=Wt(t,e,Va);let n=t.placement,r={position:"absolute",[n]:"100%",transform:n==="top"||n==="bottom"?"translateX(-50%)":"translateY(-50%)"},l=St({...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 Jv=a.forwardRef(Zv),wr=a.createContext(null),Qv=a.createContext(null),eh=a.createContext({}),Ha=a.createContext(null),Zr=a.createContext(null),Wa=a.createContext(null);function th(t){let e=Kp(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}],[Qv,e],[Wa,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 nh=a.createContext(null);function rh(t,e){return[t,e]=Wt(t,e,Ha),a.createElement(Dv,{content:a.createElement(Iv,t)},n=>n.size>0&&a.createElement(lh,{props:t,collection:n,menuRef:e}))}function lh({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(Wa),d=a.useContext(wr),f=(d==null?void 0:d.trigger)==="SubmenuTrigger";wi({ref:n,onInteractOutside:$=>{c&&!(l!=null&&l.contains($.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:$}=l.getBoundingClientRect();b({left:-1*$})}},[v,l]);let y=St({defaultClassName:"react-aria-Menu",className:t.className,style:t.style,values:{}});return a.createElement(xn,null,a.createElement("div",{...se(t),...s,...y,ref:n,slot:t.slot||void 0,onScroll:t.onScroll},a.createElement(Tn,{values:[[Zr,r],[Xv,{elementType:"div"}],[wr,{UNSTABLE_portalContainer:l||void 0}],[Nv,{render:oh}],[nh,{parentMenuRef:n}],[Pr,null]]},a.createElement(u,{collection:e,persistedKeys:Lv(r.selectionManager.focusedKey),scrollRef:n}))),a.createElement("div",{ref:i,style:{width:"100vw",position:"absolute",top:0,...v}}))}const ih=a.forwardRef(rh);function oh(t,e,n){var r,l;let i=a.useContext(Zr),{CollectionBranch:o}=a.useContext(La),[u,s]=zv();var c;let{headingProps:d,groupProps:f}=Hf({heading:s,"aria-label":(c=n.props["aria-label"])!==null&&c!==void 0?c:void 0}),p=St({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",{...se(t),...f,...p,ref:e},a.createElement(qv.Provider,{value:{...d,ref:u}},a.createElement(o,{collection:i.collection,parent:n})))}const Pr=a.createContext(null),uh=Mv("item",function(e,n,r){var l;[e,n]=Wt(e,n,Pr);let i=(l=za(Pr))===null||l===void 0?void 0:l.id,o=a.useContext(Zr),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}=Ht(),{hoverProps:y,isHovered:$}=Et({isDisabled:p.isDisabled}),C=St({...e,id:void 0,children:r.rendered,defaultClassName:"react-aria-MenuItem",values:{...p,isHovered:$,isFocusVisible:v,selectionMode:o.selectionManager.selectionMode,selectionBehavior:o.selectionManager.selectionBehavior,hasSubmenu:!!e["aria-haspopup"],isOpen:e["aria-expanded"]==="true"}}),S=e.href?"a":"div";return a.createElement(S,{...O(s,b,y),...C,ref:u,"data-disabled":p.isDisabled||void 0,"data-hovered":$||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:[[Yv,{slots:{label:c,description:d}}],[eh,f]]},C.children))}),Jr=a.createContext(null),Ua=a.createContext(null);function sh(t){let e=Ta(t),n=a.useRef(null),{triggerProps:r,tooltipProps:l}=kp(t,e,n);return a.createElement(Tn,{values:[[Jr,e],[Ua,{...l,triggerRef:n}]]},a.createElement(Id,{...r,ref:n},t.children))}function ah({UNSTABLE_portalContainer:t,...e},n){[e,n]=Wt(e,n,Ua);let r=a.useContext(Jr),l=Ta(e),i=e.isOpen!=null||e.defaultOpen!=null||!r?l:r,o=jv(n,i.isOpen)||e.isExiting||!1;return!i.isOpen&&!o?null:a.createElement(Sf,{portalContainer:t},a.createElement(dh,{...e,tooltipRef:n,isExiting:o}))}const ch=a.forwardRef(ah);function dh(t){let e=a.useContext(Jr),n=a.useRef(null),[r,l]=a.useState(0);G(()=>{n.current&&e.isOpen&&l(n.current.getBoundingClientRect().width)},[e.isOpen,n]);let{overlayProps:i,arrowProps:o,placement:u}=Oi({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=Ov(t.tooltipRef,!!u)||t.isEntering||!1,c=St({...t,defaultClassName:"react-aria-Tooltip",values:{placement:u,isEntering:s,isExiting:t.isExiting,state:e}});t=O(t,i);let{tooltipProps:d}=Dp(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 fh=({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 ph({renderTrigger:t,menuId:e,size:n=24,actions:r,disabled:l,onClose:i,testId:o,menuTestId:u}){const{className:s}=Te(),c=Ga(ve.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($=>!$),isDisabled:l,className:`proton-ResponsiveMenuTrigger__button ${s}`,children:g.jsx(fh,{size:n})}),y=t?t({...v,onClick:()=>f($=>!$)},d):b;return a.useEffect(()=>()=>{d&&(i==null||i())},[d,i]),c?g.jsxs(g.Fragment,{children:[y,d&&g.jsx(Yr,{id:e,actions:r,isOpen:d,onClose:()=>{f(!1)},showCancel:!0,"data-testid":u})]}):g.jsxs(th,{children:[y,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(ih,{className:"proton-ListBox proton-ResponsiveMenuTrigger__menu",id:e,autoFocus:!0,"data-testid":u,children:r.map($=>g.jsx(uh,{href:$.to,target:"_blank",rel:"noopener noreferrer",onAction:()=>{var C;(C=$.onAction)==null||C.call($,$.key),setTimeout(()=>{f(!1)},200)},className:"proton-ListBox__item proton-ResponsiveMenuTrigger__menu-item",children:$.label},$.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(vh,{item:l,state:n},l.key))})})};function vh({item:t,state:e}){let n=a.useRef(null),{optionProps:r,isSelected:l,isFocused:i,isDisabled:o}=jf({key:t.key},e,n);return g.jsx("li",{...r,className:j.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:j.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 hh({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:y,triggerProps:$,valueProps:C,menuProps:S}=zs({...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",{...y,className:"proton-Select__label","data-testid":"select-label",children:t}):g.jsx("div",{...y}),g.jsx(Os,{isDisabled:n,state:p,triggerRef:v,label:t||e,name:e,"data-testid":"hidden-select-container"}),g.jsxs(Ya,{...$,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:j.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,{state:p,triggerRef:v,popoverRef:b,placement:"bottom start","data-testid":"select-popover",children:g.jsx(Dr,{...S,state:p})})})]})}const mh={Menu:hh,Option:Lr};function bh({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:T=>{T?o==null||o():u==null||u()},items:s,"data-testid":c,children:d},p=Ca(f),v=Ga(ve.BREAKPOINTS.MEDIUM),b=a.useRef(null),y=a.useRef(null),{labelProps:$,triggerProps:C,valueProps:S,menuProps:x}=zs({...f,label:t||e},p,b);return a.useEffect(()=>{p.isOpen&&y.current&&b.current&&!y.current.style.minWidth&&(y.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",{...$,className:"proton-Select__label","data-testid":"select-label",children:t}):g.jsx("div",{...$}),g.jsx(Os,{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",{...S,children:p.selectedItem?p.selectedItem.rendered:"Select an option"}),g.jsx("div",{className:j.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(Yr,{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:y,placement:"bottom start","data-testid":"select-popover",children:g.jsx(Dr,{...x,state:p})})})})]})}const gh={Menu:bh,Option:Lr};function $h(t){let e={...t,isSelected:t.isOn,"data-testid":void 0},n=a.useRef(null),r=lf(e),{inputProps:l}=vp(e,r,n);return g.jsxs("label",{className:j.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(Nr,{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 yh({item:t,state:e,children:n}){let r=a.useRef(),{rowProps:l}=Sp({node:t},e);return g.jsx("tr",{className:j.csx("proton-Table__headerRow"),...l,ref:r,children:n})}function xh({column:t,state:e}){var s,c;let n=a.useRef(),{columnHeaderProps:r}=Ep({node:t},e,n);const{align:l="left"}=t.props;let{isFocusVisible:i,focusProps:o}=Ht(),u=((s=e.sortDescriptor)==null?void 0:s.direction)==="ascending"?"▲":"▼";return g.jsxs("th",{...O(r,o),colSpan:t.colspan,className:j.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:j.csx("proton-Table__headerSortIcon"),style:{visibility:((c=e.sortDescriptor)==null?void 0:c.column)===t.key?"visible":"hidden"},children:u})]})}function li({type:t,children:e}){let{rowGroupProps:n}=Pp();return g.jsx(t,{...n,className:j.csx("proton-Table__rowGroup",t==="thead"?"proton-Table__rowGroup--header":"proton-Table__rowGroup--body"),children:e})}function Eh({item:t,children:e,state:n}){let r=a.useRef(),l=n.selectionManager.isSelected(t.key),{rowProps:i,isPressed:o}=Cp({node:t},n,r),{isFocusVisible:u,focusProps:s}=Ht();return g.jsx("tr",{className:j.csx("proton-Table__row",l?"proton-Table__row--selected":null,o?"proton-Table__row--pressed":null,u?"proton-Table__row--focused":null),...O(i,s),ref:r,children:e})}function Ch({cell:t,state:e,...n}){let r=a.useRef(),{gridCellProps:l}=wp({node:t},e,r),{isFocusVisible:i,focusProps:o}=Ht();const{align:u}=t.props;return g.jsx("td",{...O(l,o),className:j.csx("proton-Table__cell",i?"proton-Table__cell--focused":null,`proton-Table__cell--${u}`),ref:r,children:t.rendered})}const Sh=Wp,wh=Gp;function Ph(t){let e=jp({...t}),n=a.useRef(),{collection:r}=e,{gridProps:l}=yp({...t,"aria-label":t["aria-label"]||"Table"},e,n);return g.jsxs("table",{...l,ref:n,className:j.csx("proton-Table"),children:[g.jsx(li,{type:"thead",children:r.headerRows.map(i=>g.jsx(yh,{item:i,state:e,children:Array.from(r.getChildren(i.key)).map(o=>g.jsx(xh,{column:o,state:e},o.key))},i.key))}),g.jsx(li,{type:"tbody",children:Array.from(r.body.childNodes).map(i=>g.jsx(Eh,{item:i,state:e,children:Array.from(r.getChildren(i.key)).map(o=>g.jsx(Ch,{cell:o,state:e},o.key))},i.key))})]})}function qa({children:t,arrow:e,...n}){const{palette:r,theme:l,style:i}=Te(),o={"--tooltip-background":(()=>{switch(l){case ve.THEMES.CUSTOM_DARK:return r.PRIMARY.PRIMARY_MEDIUM;case ve.THEMES.DARK:return r.PRIMARY.PRIMARY_DARK;default:return Y.GRAYSCALE.WHITE}})(),...i};return g.jsxs(ch,{...n,className:"proton__Tooltip proton-Dialog",style:o,children:[e&&g.jsx(Jv,{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(sh,{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 Dh=({to:t,children:e,tooltipProps:n,"data-testid":r})=>{const{className:l,palette:i,theme:o}=Te(),u=n?g.jsx(Xa,{delay:50,closeDelay:75,...n,children:e}):e,s={"--text-emphasis-highlight":o===ve.THEMES.CUSTOM_DARK?Pe.transparentize(i.SECONDARY.SECONDARY_LIGHT,.3):Pe.transparentize(Y.BRAND.PRIMARY,.5)};if(t){const c=j.isUrlExternal(t);return g.jsx("span",{className:j.csx("proton-TextEmphasis",n&&"proton-TextEmphasis--tooltip",l),style:s,children:g.jsx("a",{"data-testid":r,href:t,target:c?"_blank":void 0,rel:c?"noopener noreferrer":void 0,onClick:c?void 0:d=>j.handleInternalNavigation(d,t),children:u})})}return g.jsx("span",{className:j.csx("proton-TextEmphasis",n&&"proton-TextEmphasis--tooltip",l),style:s,"data-testid":r,children:u})};function kh({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:j.csx("proton-Waveform__bar-wrapper"),style:{width:`${o}px`,marginRight:`${u}px`},children:[g.jsx("div",{className:j.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:j.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 Th=Rh(100);function Ah({data:t,resolution:e=2,startDuration:n,endDuration:r,currentTime:l=0,showTimestamps:i=!1,totalDuration:o,onClick:u,timestampColor:s,"data-testid":c}){var N;const{className:d,palette:f,theme:p}=Te(),v=a.useRef(null),[b,y]=a.useState([]),[$,C]=a.useState(null),[S,x]=a.useState(!1),[T,w]=a.useState(!1),D=t||Th,I=s||(p==="custom-dark"?f.PRIMARY.PRIMARY_SUPER_DARK:void 0),h=e;a.useEffect(()=>{if(!v.current)return;const k=W=>{const ne=Math.floor(W/(e+h)),oe=Kh(D,ne);y(oe)},L=v.current.clientWidth;k(L);const M=new ResizeObserver(W=>{W&&W[0]&&k(W[0].contentRect.width)});return M.observe(v.current),()=>M.disconnect()},[D,e,h]),a.useEffect(()=>{const k=setTimeout(()=>x(!0),50),L=setTimeout(()=>w(!0),500);return()=>{clearTimeout(k),clearTimeout(L)}},[]);const B=k=>{if(!v.current)return;const L=v.current.getBoundingClientRect(),W=(k.clientX-L.left)/L.width*o;C(W)},P=()=>{C(null)},A=e+h,R=(k,L)=>{var ne;const M=k/o*100;return(L==="start"?Math.floor(M/100*b.length):Math.ceil(M/100*b.length))*A/((ne=v.current)==null?void 0:ne.clientWidth)*100},E=(N=v.current)==null?void 0:N.clientWidth;return g.jsxs("div",{className:j.csx("proton-Waveform",d),"data-testid":c,children:[i&&g.jsx(ii,{direction:"left",seconds:l,color:I}),g.jsxs("div",{ref:v,className:"proton-Waveform__container",onMouseMove:B,onMouseLeave:P,onClick:k=>{if(!v.current)return;const L=v.current.getBoundingClientRect(),W=(k.clientX-L.left)/L.width*o;u==null||u(W,k)},children:[n!==void 0&&r!==void 0&&g.jsx("div",{className:"proton-Waveform__active-region",style:{left:v.current?`calc(${R(n,"start")}%`:"0%",right:v.current?`calc(${100-R(r,"end")}% - 2px)`:"0%"}}),$!==null&&g.jsx("div",{className:"proton-Waveform__hover-line",style:{left:`${$/o*100}%`}}),b.map((k,L)=>{const M=L/b.length*o,W=n!==void 0&&r!==void 0&&(M<n||M>r),ne=l===0?!1:M<=l,oe=$!==null&&M<=$;return g.jsx(kh,{amplitude:k,isDisabled:W,isPlayed:ne,isHovered:oe,isVisible:S,hasAnimated:T,resolution:e,spacing:h,index:L},L)})]}),!t&&g.jsx("div",{className:"proton-Waveform__bar-unavailable",style:{backgroundColor:I,fontSize:E<325?"0.85rem":"1rem"},children:E<277?"Unavailable":"Waveform Unavailable"}),i&&g.jsx(ii,{direction:"right",seconds:o,color:I})]})}function ii({direction:t,color:e,seconds:n}){return g.jsx("div",{className:j.csx("proton-Waveform__timestamp",`proton-Waveform__timestamp--${t}`),style:{backgroundColor:e},children:Bh(n)})}function Bh(t){const e=Math.floor(t/60),n=Math.floor(t%60);return`${e}:${n<10?"0":""}${n.toFixed(0)}`}function Kh(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 Mh(l)}function Mh(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 Rh(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})}exports.THEMES=ve.THEMES;exports.COLORS=Y.colors;exports.ActionMenu=Yr;exports.Badge=iv;exports.BadgeVariants=lv;exports.Banner=Ae;exports.Button=qr;exports.ButtonGroup=Ra;exports.Cell=wh;exports.Column=Sh;exports.Dialog=pv;exports.Icon=mv;exports.Input=Ia;exports.Popover=kn;exports.ResponsiveMenuTrigger=ph;exports.ResponsiveSelect=gh;exports.Row=Up;exports.SearchInput=bv;exports.Section=Lf;exports.Select=mh;exports.Switch=$h;exports.Table=Ph;exports.TableBody=Hp;exports.TableHeader=Vp;exports.TextEmphasis=Dh;exports.ThemeProvider=nv;exports.Tooltip=qa;exports.TooltipTrigger=Xa;exports.Waveform=Ah;exports.usePopoverTrigger=gv;exports.useTheme=Te;
|
|
48
48
|
//# sourceMappingURL=index.cjs.js.map
|