"use strict";const r=require("./utils-BNYGVv6l.cjs.js"),P=require("./SelectionIndicator-Du7-bvy3.cjs.js"),f=require("./mergeProps-DD8aR8go.cjs.js"),x=require("./filterDOMProps-AbzzCIX-.cjs.js"),a=require("react"),y=require("./useControlledState-DLAEsTLd.cjs.js"),q=require("./useButton-Dp2NwAPA.cjs.js"),C=require("./useToolbar-xJrixYVd.cjs.js"),M=require("./useToggleState-CKQxC8Yz.cjs.js"),w=require("./useFocusRing-DScmIOhv.cjs.js"),E=require("./useHover-BCGp55jR.cjs.js");function D(t,e,s){const{isSelected:d}=e,{isPressed:i,buttonProps:c}=q.$701a24aa0da5b062$export$ea18c227d4417cc3({...t,onPress:f.$ff5963eb1fccf552$export$e08e3b67e392101e(e.toggle,t.onPress)},s);return{isPressed:i,isSelected:d,isDisabled:t.isDisabled||!1,buttonProps:f.$3ef42575df84b30b$export$9d1611c77c2fe928(c,{"aria-pressed":d})}}function F(t,e,s){let{isDisabled:d}=t,{toolbarProps:i}=C.$2680b1829e803644$export$fa142eb1681c520(t,s);return{groupProps:{...i,role:e.selectionMode==="single"?"radiogroup":i.role,"aria-disabled":d}}}function T(t,e,s){let d={isSelected:e.selectedKeys.has(t.id),defaultSelected:!1,setSelected(n){e.setSelected(t.id,n)},toggle(){e.toggleKey(t.id)}},{isPressed:i,isSelected:c,isDisabled:o,buttonProps:l}=D({...t,id:void 0,isDisabled:t.isDisabled||e.isDisabled},d,s);return e.selectionMode==="single"&&(l.role="radio",l["aria-checked"]=d.isSelected,delete l["aria-pressed"]),{isPressed:i,isSelected:c,isDisabled:o,buttonProps:l}}function B(t){let{selectionMode:e="single",disallowEmptySelection:s,isDisabled:d=!1}=t,[i,c]=y.$458b0a5536c1a7cf$export$40bfa8c7b0832715(a.useMemo(()=>t.selectedKeys?new Set(t.selectedKeys):void 0,[t.selectedKeys]),a.useMemo(()=>t.defaultSelectedKeys?new Set(t.defaultSelectedKeys):new Set,[t.defaultSelectedKeys]),t.onSelectionChange);return{selectionMode:e,isDisabled:d,selectedKeys:i,setSelectedKeys:c,toggleKey(o){let l;e==="multiple"?(l=new Set(i),l.has(o)&&(!s||l.size>1)?l.delete(o):l.add(o)):l=new Set(i.has(o)&&!s?[]:[o]),c(l)},setSelected(o,l){l!==i.has(o)&&this.toggleKey(o)}}}const H=a.createContext({}),h=a.createContext(null),R=a.forwardRef(function(e,s){[e,s]=r.$64fa3d84918910a7$export$29f1550f4b0d4415(e,s,H);let d=B(e),{groupProps:i}=F(e,d,s),c=r.$64fa3d84918910a7$export$4d86445c2cf5e3({...e,values:{orientation:e.orientation||"horizontal",isDisabled:d.isDisabled,state:d},defaultClassName:"react-aria-ToggleButtonGroup"}),o=x.$65484d02dcb7eb3e$export$457c3d6518dd4c6f(e,{global:!0});return a.createElement("div",{...f.$3ef42575df84b30b$export$9d1611c77c2fe928(o,c,i),ref:s,slot:e.slot||void 0,"data-orientation":e.orientation||"horizontal","data-disabled":e.isDisabled||void 0},a.createElement(h.Provider,{value:d},a.createElement(P.$c8a5a149f625efcf$export$758399f318e6385a,null,c.children)))}),z=a.createContext({}),O=a.forwardRef(function(e,s){[e,s]=r.$64fa3d84918910a7$export$29f1550f4b0d4415(e,s,z);let d=a.useContext(h),i=M.$3017fa7ffdddec74$export$8042c6c013fd5226(d&&e.id!=null?{isSelected:d.selectedKeys.has(e.id),onChange(m){d.setSelected(e.id,m)}}:e),{buttonProps:c,isPressed:o,isSelected:l,isDisabled:n}=d&&e.id!=null?T({...e,id:e.id},d,s):D({...e,id:e.id!=null?String(e.id):void 0},i,s),{focusProps:v,isFocused:$,isFocusVisible:b}=w.$f7dceffc5ad7768b$export$4e328f61c538687f(e),{hoverProps:K,isHovered:S}=E.$6179b936705e76d3$export$ae780daf29e6d456(e),g=r.$64fa3d84918910a7$export$4d86445c2cf5e3({...e,id:void 0,values:{isHovered:S,isPressed:o,isFocused:$,isSelected:i.isSelected,isFocusVisible:b,isDisabled:n,state:i},defaultClassName:"react-aria-ToggleButton"}),u=x.$65484d02dcb7eb3e$export$457c3d6518dd4c6f(e,{global:!0});return delete u.id,delete u.onClick,a.createElement("button",{...f.$3ef42575df84b30b$export$9d1611c77c2fe928(u,g,c,v,K),ref:s,slot:e.slot||void 0,"data-focused":$||void 0,"data-disabled":n||void 0,"data-pressed":o||void 0,"data-selected":l||void 0,"data-hovered":S||void 0,"data-focus-visible":b||void 0},a.createElement(P.$1d5b8b8664671ef2$export$c9549807523555e0.Provider,{value:{isSelected:l}},g.children))});exports.$84b7d8702d4ff4a8$export$40258cc1d95ff477=R;exports.$efde0372d7a700fe$export$d2b052e7b4be1756=O;
//# sourceMappingURL=ToggleButton-D3aar_By.cjs.js.map
