{"ast":null,"code":"'use client';\n\nimport _extends from \"@babel/runtime/helpers/esm/extends\";\nimport * as React from 'react';\nimport { unstable_useControlled as useControlled, unstable_useForkRef as useForkRef, unstable_useIsFocusVisible as useIsFocusVisible } from '@mui/utils';\n/**\n * The basic building block for creating custom switches.\n *\n * Demos:\n *\n * - [Switch](https://mui.com/base-ui/react-switch/#hook)\n *\n * API:\n *\n * - [useSwitch API](https://mui.com/base-ui/react-switch/hooks-api/#use-switch)\n */\nexport function useSwitch(props) {\n const {\n checked: checkedProp,\n defaultChecked,\n disabled,\n onBlur,\n onChange,\n onFocus,\n onFocusVisible,\n readOnly,\n required\n } = props;\n const [checked, setCheckedState] = useControlled({\n controlled: checkedProp,\n default: Boolean(defaultChecked),\n name: 'Switch',\n state: 'checked'\n });\n const createHandleInputChange = otherProps => event => {\n var _otherProps$onChange;\n // Workaround for https://github.com/facebook/react/issues/9023\n if (event.nativeEvent.defaultPrevented) {\n return;\n }\n setCheckedState(event.target.checked);\n onChange == null || onChange(event);\n (_otherProps$onChange = otherProps.onChange) == null || _otherProps$onChange.call(otherProps, event);\n };\n const {\n isFocusVisibleRef,\n onBlur: handleBlurVisible,\n onFocus: handleFocusVisible,\n ref: focusVisibleRef\n } = useIsFocusVisible();\n const [focusVisible, setFocusVisible] = React.useState(false);\n if (disabled && focusVisible) {\n setFocusVisible(false);\n }\n React.useEffect(() => {\n isFocusVisibleRef.current = focusVisible;\n }, [focusVisible, isFocusVisibleRef]);\n const inputRef = React.useRef(null);\n const createHandleFocus = otherProps => event => {\n var _otherProps$onFocus;\n // Fix for https://github.com/facebook/react/issues/7769\n if (!inputRef.current) {\n inputRef.current = event.currentTarget;\n }\n handleFocusVisible(event);\n if (isFocusVisibleRef.current === true) {\n setFocusVisible(true);\n onFocusVisible == null || onFocusVisible(event);\n }\n onFocus == null || onFocus(event);\n (_otherProps$onFocus = otherProps.onFocus) == null || _otherProps$onFocus.call(otherProps, event);\n };\n const createHandleBlur = otherProps => event => {\n var _otherProps$onBlur;\n handleBlurVisible(event);\n if (isFocusVisibleRef.current === false) {\n setFocusVisible(false);\n }\n onBlur == null || onBlur(event);\n (_otherProps$onBlur = otherProps.onBlur) == null || _otherProps$onBlur.call(otherProps, event);\n };\n const handleInputRef = useForkRef(focusVisibleRef, inputRef);\n const getInputProps = (otherProps = {}) => _extends({\n checked: checkedProp,\n defaultChecked,\n disabled,\n readOnly,\n ref: handleInputRef,\n required,\n type: 'checkbox',\n role: 'switch',\n 'aria-checked': checkedProp\n }, otherProps, {\n onChange: createHandleInputChange(otherProps),\n onFocus: createHandleFocus(otherProps),\n onBlur: createHandleBlur(otherProps)\n });\n return {\n checked,\n disabled: Boolean(disabled),\n focusVisible,\n getInputProps,\n inputRef: handleInputRef,\n readOnly: Boolean(readOnly)\n };\n}","map":{"version":3,"names":["_extends","React","unstable_useControlled","useControlled","unstable_useForkRef","useForkRef","unstable_useIsFocusVisible","useIsFocusVisible","useSwitch","props","checked","checkedProp","defaultChecked","disabled","onBlur","onChange","onFocus","onFocusVisible","readOnly","required","setCheckedState","controlled","default","Boolean","name","state","createHandleInputChange","otherProps","event","_otherProps$onChange","nativeEvent","defaultPrevented","target","call","isFocusVisibleRef","handleBlurVisible","handleFocusVisible","ref","focusVisibleRef","focusVisible","setFocusVisible","useState","useEffect","current","inputRef","useRef","createHandleFocus","_otherProps$onFocus","currentTarget","createHandleBlur","_otherProps$onBlur","handleInputRef","getInputProps","type","role"],"sources":["/home/gnx/Desktop/ETB/ETB-FrontEnd/node_modules/@mui/base/useSwitch/useSwitch.js"],"sourcesContent":["'use client';\n\nimport _extends from \"@babel/runtime/helpers/esm/extends\";\nimport * as React from 'react';\nimport { unstable_useControlled as useControlled, unstable_useForkRef as useForkRef, unstable_useIsFocusVisible as useIsFocusVisible } from '@mui/utils';\n/**\n * The basic building block for creating custom switches.\n *\n * Demos:\n *\n * - [Switch](https://mui.com/base-ui/react-switch/#hook)\n *\n * API:\n *\n * - [useSwitch API](https://mui.com/base-ui/react-switch/hooks-api/#use-switch)\n */\nexport function useSwitch(props) {\n const {\n checked: checkedProp,\n defaultChecked,\n disabled,\n onBlur,\n onChange,\n onFocus,\n onFocusVisible,\n readOnly,\n required\n } = props;\n const [checked, setCheckedState] = useControlled({\n controlled: checkedProp,\n default: Boolean(defaultChecked),\n name: 'Switch',\n state: 'checked'\n });\n const createHandleInputChange = otherProps => event => {\n var _otherProps$onChange;\n // Workaround for https://github.com/facebook/react/issues/9023\n if (event.nativeEvent.defaultPrevented) {\n return;\n }\n setCheckedState(event.target.checked);\n onChange == null || onChange(event);\n (_otherProps$onChange = otherProps.onChange) == null || _otherProps$onChange.call(otherProps, event);\n };\n const {\n isFocusVisibleRef,\n onBlur: handleBlurVisible,\n onFocus: handleFocusVisible,\n ref: focusVisibleRef\n } = useIsFocusVisible();\n const [focusVisible, setFocusVisible] = React.useState(false);\n if (disabled && focusVisible) {\n setFocusVisible(false);\n }\n React.useEffect(() => {\n isFocusVisibleRef.current = focusVisible;\n }, [focusVisible, isFocusVisibleRef]);\n const inputRef = React.useRef(null);\n const createHandleFocus = otherProps => event => {\n var _otherProps$onFocus;\n // Fix for https://github.com/facebook/react/issues/7769\n if (!inputRef.current) {\n inputRef.current = event.currentTarget;\n }\n handleFocusVisible(event);\n if (isFocusVisibleRef.current === true) {\n setFocusVisible(true);\n onFocusVisible == null || onFocusVisible(event);\n }\n onFocus == null || onFocus(event);\n (_otherProps$onFocus = otherProps.onFocus) == null || _otherProps$onFocus.call(otherProps, event);\n };\n const createHandleBlur = otherProps => event => {\n var _otherProps$onBlur;\n handleBlurVisible(event);\n if (isFocusVisibleRef.current === false) {\n setFocusVisible(false);\n }\n onBlur == null || onBlur(event);\n (_otherProps$onBlur = otherProps.onBlur) == null || _otherProps$onBlur.call(otherProps, event);\n };\n const handleInputRef = useForkRef(focusVisibleRef, inputRef);\n const getInputProps = (otherProps = {}) => _extends({\n checked: checkedProp,\n defaultChecked,\n disabled,\n readOnly,\n ref: handleInputRef,\n required,\n type: 'checkbox',\n role: 'switch',\n 'aria-checked': checkedProp\n }, otherProps, {\n onChange: createHandleInputChange(otherProps),\n onFocus: createHandleFocus(otherProps),\n onBlur: createHandleBlur(otherProps)\n });\n return {\n checked,\n disabled: Boolean(disabled),\n focusVisible,\n getInputProps,\n inputRef: handleInputRef,\n readOnly: Boolean(readOnly)\n };\n}"],"mappings":"AAAA,YAAY;;AAEZ,OAAOA,QAAQ,MAAM,oCAAoC;AACzD,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,sBAAsB,IAAIC,aAAa,EAAEC,mBAAmB,IAAIC,UAAU,EAAEC,0BAA0B,IAAIC,iBAAiB,QAAQ,YAAY;AACxJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,SAASA,CAACC,KAAK,EAAE;EAC/B,MAAM;IACJC,OAAO,EAAEC,WAAW;IACpBC,cAAc;IACdC,QAAQ;IACRC,MAAM;IACNC,QAAQ;IACRC,OAAO;IACPC,cAAc;IACdC,QAAQ;IACRC;EACF,CAAC,GAAGV,KAAK;EACT,MAAM,CAACC,OAAO,EAAEU,eAAe,CAAC,GAAGjB,aAAa,CAAC;IAC/CkB,UAAU,EAAEV,WAAW;IACvBW,OAAO,EAAEC,OAAO,CAACX,cAAc,CAAC;IAChCY,IAAI,EAAE,QAAQ;IACdC,KAAK,EAAE;EACT,CAAC,CAAC;EACF,MAAMC,uBAAuB,GAAGC,UAAU,IAAIC,KAAK,IAAI;IACrD,IAAIC,oBAAoB;IACxB;IACA,IAAID,KAAK,CAACE,WAAW,CAACC,gBAAgB,EAAE;MACtC;IACF;IACAX,eAAe,CAACQ,KAAK,CAACI,MAAM,CAACtB,OAAO,CAAC;IACrCK,QAAQ,IAAI,IAAI,IAAIA,QAAQ,CAACa,KAAK,CAAC;IACnC,CAACC,oBAAoB,GAAGF,UAAU,CAACZ,QAAQ,KAAK,IAAI,IAAIc,oBAAoB,CAACI,IAAI,CAACN,UAAU,EA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