var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: !0 });
}, __copyProps = (to, from, except, desc) => {
  if (from && typeof from == "object" || typeof from == "function")
    for (let key of __getOwnPropNames(from))
      !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
var Switch_exports = {};
__export(Switch_exports, {
  Switch: () => Switch
});
module.exports = __toCommonJS(Switch_exports);
var import_jsx_runtime = require("react/jsx-runtime"), import_react_native = require("react-native"), import_tamagui = require("tamagui"), SwitchContext = (0, import_tamagui.createStyledContext)({
  active: !1
}), SwitchFrame = (0, import_tamagui.styled)(import_tamagui.ThemeableStack, {
  name: "Switch",
  context: SwitchContext,
  justifyContent: "center",
  alignItems: "center",
  width: 52,
  height: 32,
  borderRadius: "$shape.corner_full",
  cursor: "pointer",
  animateOnly: [
    "borderColor",
    "borderWidth"
  ],
  animation: "100ms",
  variants: {
    active: {
      true: {
        backgroundColor: "$primary"
      },
      false: {
        backgroundColor: "$surfaceContainerHighest",
        borderColor: "$outline",
        borderWidth: "$border.outline"
      }
    }
  }
}), SwitchThumb = (0, import_tamagui.styled)(import_tamagui.ThemeableStack, {
  name: "SwitchThumb",
  context: SwitchContext,
  justifyContent: "center",
  alignItems: "center",
  borderRadius: "$shape.corner_full",
  animateOnly: [
    "width",
    "height",
    "left"
  ],
  position: "absolute",
  animation: "100ms",
  variants: {
    active: {
      true: {
        left: 24,
        // Position when active
        width: 24,
        height: 24,
        backgroundColor: "$onPrimary"
      },
      false: {
        width: 16,
        height: 16,
        left: 2,
        // Position when inactive
        backgroundColor: "$outline"
      }
    }
  }
}), SwitchComposed = (0, import_tamagui.withStaticProperties)(SwitchFrame, {
  Props: SwitchContext.Provider,
  Thumb: SwitchThumb
});
function Switch(param) {
  var { active, onChange } = param;
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_native.Pressable, {
    onPress: function() {
      return onChange(!active);
    },
    children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SwitchComposed, {
      active,
      children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SwitchComposed.Thumb, {})
    })
  });
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  Switch
});
//# sourceMappingURL=Switch.js.map
