import{__exports as t}from"../../../_virtual/ButtonToggle.js";import e from"react";import{p as r}from"../../prop-types/index.js";import{c as n}from"../../classnames/index.js";import"./Button.js";import"./utils.js";import{__exports as o}from"../../../_virtual/Button.js";import{__exports as u}from"../../../_virtual/utils.js";!function(t){function l(t){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l(t)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=function(t,e){if(!e&&t&&t.__esModule)return t;if(null===t||"object"!==l(t)&&"function"!=typeof t)return{default:t};var r=d(e);if(r&&r.has(t))return r.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in t)if("default"!==u&&Object.prototype.hasOwnProperty.call(t,u)){var a=o?Object.getOwnPropertyDescriptor(t,u):null;a&&(a.get||a.set)?Object.defineProperty(n,u,a):n[u]=t[u]}n.default=t,r&&r.set(t,n);return n}(e),f=y(r),i=y(n),c=y(o),s=u,p=["className"];function y(t){return t&&t.__esModule?t:{default:t}}function d(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,r=new WeakMap;return(d=function(t){return t?r:e})(t)}function m(){return m=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},m.apply(this,arguments)}function b(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r,n,o={},u=Object.keys(t);for(n=0;n<u.length;n++)r=u[n],e.indexOf(r)>=0||(o[r]=t[r]);return o}(t,e);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(t);for(n=0;n<u.length;n++)r=u[n],e.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function v(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,o,u=[],l=!0,a=!1;try{for(r=r.call(t);!(l=(n=r.next()).done)&&(u.push(n.value),!e||u.length!==e);l=!0);}catch(t){a=!0,o=t}finally{try{l||null==r.return||r.return()}finally{if(a)throw o}}return u}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return j(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return j(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function j(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var O={onClick:f.default.func,onBlur:f.default.func,onFocus:f.default.func,defaultValue:f.default.bool,className:f.default.string,cssModule:f.default.object};function g(t){var e=v((0,a.useState)(t.defaultValue),2),r=e[0],n=e[1],o=v((0,a.useState)(!1),2),u=o[0],l=o[1],f=(0,a.useCallback)((function(e){t.onBlur&&t.onBlur(e),l(!1)}),[t.onBlur]),y=(0,a.useCallback)((function(e){t.onFocus&&t.onFocus(e),l(!0)}),[t.onFocus]),d=(0,a.useCallback)((function(e){t.onClick&&t.onClick(e),n(!r)}),[t.onClick]),j=t.className,O=b(t,p),g=(0,s.mapToCssModules)((0,i.default)(j,{focus:u}),t.cssModule);return a.default.createElement(c.default,m({active:r,onBlur:f,onFocus:y,onClick:d,className:g},O))}g.propTypes=O,g.defaultProps={defaultValue:!1};var h=g;t.default=h}(t);
//# sourceMappingURL=ButtonToggle.js.map
