{"version":3,"file":"SoundToggle.DqZHTkm9.mjs","names":["useState","startTransition","_Fragment"],"sources":["https:/framerusercontent.com/modules/qIL11ueJqXbvH2tN4k8d/IiMYVhxb8GEaP98a1Qqt/SoundToggle.js"],"sourcesContent":["// Sound toggle component that controls global sound state for the website\nimport{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,Data}from\"framer\";import{useState,useEffect,startTransition}from\"react\";// Global sound state that can be accessed by other components\nexport const soundState=Data({enabled:true});/**\n * Sound Toggle Component\n *\n * Controls global sound state for the website. Other components can check\n * soundState.enabled before playing sounds.\n *\n * @framerIntrinsicWidth auto\n * @framerIntrinsicHeight auto\n *\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function SoundToggle(props){const{label,enabledLabel,disabledLabel,backgroundColor,activeColor,textColor,activeTextColor,stateColor,hoverTextColor,activeHoverTextColor,hoverBackgroundColor,activeHoverBackgroundColor,borderRadius,showIcon,font,defaultEnabled,paddingTop,paddingRight,paddingBottom,paddingLeft,iconType,phosphorIcon,iconPosition,iconGap,phosphorIconEnabled,phosphorIconDisabled,textShadow}=props;// Local state that tracks the global sound state\nconst[isEnabled,setIsEnabled]=useState(defaultEnabled);const[isHovered,setIsHovered]=useState(false);// Initialize sound state on mount\nuseEffect(()=>{if(typeof soundState.enabled===\"undefined\"){soundState.enabled=defaultEnabled;}setIsEnabled(soundState.enabled);window.__soundEnabled=soundState.enabled;},[defaultEnabled]);// Subscribe to sound state changes\nuseEffect(()=>{const updateState=()=>{startTransition(()=>{setIsEnabled(soundState.enabled);});};// Check for changes periodically (Framer Data doesn't have built-in subscriptions)\nconst interval=setInterval(updateState,100);return()=>clearInterval(interval);},[]);// Control all audio elements on the page\nuseEffect(()=>{if(typeof window===\"undefined\")return;const controlAllAudio=()=>{const audioElements=document.querySelectorAll(\"audio, video\");audioElements.forEach(element=>{if(element instanceof HTMLMediaElement){element.muted=!isEnabled;}});};// Control existing audio elements\ncontrolAllAudio();// Watch for new audio elements being added to the page\nconst observer=new MutationObserver(controlAllAudio);observer.observe(document.body,{childList:true,subtree:true});return()=>observer.disconnect();},[isEnabled]);const handleToggle=()=>{const newState=!soundState.enabled;soundState.enabled=newState;window.__soundEnabled=newState;startTransition(()=>{setIsEnabled(newState);});};const handleMouseEnter=()=>startTransition(()=>setIsHovered(true));const handleMouseLeave=()=>startTransition(()=>setIsHovered(false));const getBackgroundColor=()=>{if(isHovered&&isEnabled&&activeHoverBackgroundColor)return activeHoverBackgroundColor;if(isHovered&&!isEnabled&&hoverBackgroundColor)return hoverBackgroundColor;if(isEnabled)return activeColor;return backgroundColor;};const getTextColor=()=>{if(isHovered&&isEnabled&&activeHoverTextColor){return activeHoverTextColor;}if(isHovered&&!isEnabled&&hoverTextColor){return hoverTextColor;}return isEnabled?activeTextColor:textColor;};return /*#__PURE__*/_jsxs(\"button\",{onClick:handleToggle,onMouseEnter:handleMouseEnter,onMouseLeave:handleMouseLeave,style:{display:\"flex\",alignItems:\"center\",justifyContent:\"center\",gap:iconGap,width:\"fit-content\",height:\"auto\",backgroundColor:getBackgroundColor(),color:isEnabled?activeTextColor:textColor,border:\"none\",borderRadius,cursor:\"pointer\",paddingTop,paddingRight,paddingBottom,paddingLeft,transition:\"all 0.3s ease\",flexDirection:iconPosition===\"right\"?\"row\":\"row\",...font},\"aria-label\":isEnabled?\"Disable sounds\":\"Enable sounds\",\"aria-pressed\":isEnabled,children:[showIcon&&iconPosition===\"left\"&&iconType===\"phosphor\"&&/*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",alignItems:\"center\"},children:isEnabled?phosphorIconEnabled:phosphorIconDisabled}),showIcon&&iconPosition===\"left\"&&iconType===\"built-in\"&&/*#__PURE__*/_jsx(\"svg\",{width:\"20\",height:\"20\",viewBox:\"0 0 24 24\",fill:\"none\",stroke:\"currentColor\",strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\",children:isEnabled?/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"polygon\",{points:\"11 5 6 9 2 9 2 15 6 15 11 19 11 5\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M15.54 8.46a5 5 0 0 1 0 7.07\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M19.07 4.93a10 10 0 0 1 0 14.14\"})]}):/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"polygon\",{points:\"11 5 6 9 2 9 2 15 6 15 11 19 11 5\"}),/*#__PURE__*/_jsx(\"line\",{x1:\"23\",y1:\"9\",x2:\"17\",y2:\"15\"}),/*#__PURE__*/_jsx(\"line\",{x1:\"17\",y1:\"9\",x2:\"23\",y2:\"15\"})]})}),/*#__PURE__*/_jsxs(\"span\",{style:{display:\"inline-flex\",whiteSpace:\"nowrap\",textShadow},children:[/*#__PURE__*/_jsx(\"span\",{style:{color:isHovered?hoverTextColor:textColor,transition:\"color 0.3s ease\"},children:label?`${label} [`:\"[\"}),/*#__PURE__*/_jsx(\"span\",{style:{color:isHovered?isEnabled?activeHoverTextColor:hoverTextColor:stateColor,transition:\"color 0.3s ease\"},children:isEnabled?enabledLabel:disabledLabel}),/*#__PURE__*/_jsx(\"span\",{style:{color:isHovered?hoverTextColor:textColor,transition:\"color 0.3s ease\"},children:\"]\"})]}),showIcon&&iconPosition===\"right\"&&iconType===\"phosphor\"&&/*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",alignItems:\"center\"},children:isEnabled?phosphorIconEnabled:phosphorIconDisabled}),showIcon&&iconPosition===\"right\"&&iconType===\"built-in\"&&/*#__PURE__*/_jsx(\"svg\",{width:\"20\",height:\"20\",viewBox:\"0 0 24 24\",fill:\"none\",stroke:\"currentColor\",strokeWidth:\"2\",strokeLinecap:\"round\",strokeLinejoin:\"round\",children:isEnabled?/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"polygon\",{points:\"11 5 6 9 2 9 2 15 6 15 11 19 11 5\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M15.54 8.46a5 5 0 0 1 0 7.07\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M19.07 4.93a10 10 0 0 1 0 14.14\"})]}):/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"polygon\",{points:\"11 5 6 9 2 9 2 15 6 15 11 19 11 5\"}),/*#__PURE__*/_jsx(\"line\",{x1:\"23\",y1:\"9\",x2:\"17\",y2:\"15\"}),/*#__PURE__*/_jsx(\"line\",{x1:\"17\",y1:\"9\",x2:\"23\",y2:\"15\"})]})})]});}addPropertyControls(SoundToggle,{label:{type:ControlType.String,title:\"Label\",defaultValue:\"Sound\"},enabledLabel:{type:ControlType.String,title:\"Enabled Label\",defaultValue:\"Sound On\"},disabledLabel:{type:ControlType.String,title:\"Disabled Label\",defaultValue:\"Sound Off\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#EEEEEE\"},activeColor:{type:ControlType.Color,title:\"Active Color\",defaultValue:\"#000000\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},activeTextColor:{type:ControlType.Color,title:\"Active Text\",defaultValue:\"#FFFFFF\"},stateColor:{type:ControlType.Color,title:\"State Color\",defaultValue:\"#000000\"},hoverTextColor:{type:ControlType.Color,title:\"Hover Text\",defaultValue:\"#666666\"},activeHoverTextColor:{type:ControlType.Color,title:\"Active Hover Text\",defaultValue:\"#CCCCCC\"},hoverBackgroundColor:{type:ControlType.Color,title:\"Hover Background\",defaultValue:\"#DDDDDD\"},activeHoverBackgroundColor:{type:ControlType.Color,title:\"Active Hover BG\",defaultValue:\"#222222\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:8,min:0,max:50,step:1},paddingTop:{type:ControlType.Number,title:\"Padding Top\",defaultValue:12,min:0,max:100,step:1},paddingRight:{type:ControlType.Number,title:\"Padding Right\",defaultValue:20,min:0,max:100,step:1},paddingBottom:{type:ControlType.Number,title:\"Padding Bottom\",defaultValue:12,min:0,max:100,step:1},paddingLeft:{type:ControlType.Number,title:\"Padding Left\",defaultValue:20,min:0,max:100,step:1},showIcon:{type:ControlType.Boolean,title:\"Show Icon\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},iconType:{type:ControlType.Enum,title:\"Icon Type\",options:[\"phosphor\",\"built-in\"],optionTitles:[\"Phosphor\",\"Built-in\"],defaultValue:\"phosphor\",hidden:({showIcon})=>!showIcon},iconPosition:{type:ControlType.Enum,title:\"Icon Position\",options:[\"left\",\"right\"],optionTitles:[\"Left\",\"Right\"],defaultValue:\"left\",displaySegmentedControl:true,hidden:({showIcon})=>!showIcon},iconGap:{type:ControlType.Number,title:\"Icon Gap\",defaultValue:8,min:0,max:32,step:1,hidden:({showIcon})=>!showIcon},phosphorIconEnabled:{type:ControlType.ComponentInstance,title:\"Icon (Enabled)\",hidden:({showIcon,iconType})=>!showIcon||iconType!==\"phosphor\"},phosphorIconDisabled:{type:ControlType.ComponentInstance,title:\"Icon (Disabled)\",hidden:({showIcon,iconType})=>!showIcon||iconType!==\"phosphor\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"14px\",variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1em\"}},defaultEnabled:{type:ControlType.Boolean,title:\"Default State\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},textShadow:{type:ControlType.String,title:\"Text Shadow\",defaultValue:\"0px 0.5px 0px rgba(255,255,255,0.8)\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"soundState\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"default\":{\"type\":\"reactComponent\",\"name\":\"SoundToggle\",\"slots\":[\"phosphorIcon\",\"phosphorIconEnabled\",\"phosphorIconDisabled\"],\"annotations\":{\"framerIntrinsicHeight\":\"auto\",\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\",\"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