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 ScrollTo_exports = {};
__export(ScrollTo_exports, {
  ScrollTo: () => ScrollTo,
  useScrollTo: () => useScrollTo,
  useScrollToSection: () => useScrollToSection
});
module.exports = __toCommonJS(ScrollTo_exports);
var import_jsx_runtime = require("react/jsx-runtime"), import_lucide_icons = require("@tamagui/lucide-icons"), import_react = require("react"), import_react_native = require("react-native"), import_tamagui = require("tamagui"), import_Chip = require("./Chip");
function ScrollTo(param) {
  var { listRef, offset } = param, show = offset > 300;
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.AnimatePresence, {
    children: show && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.View, {
      position: "absolute",
      bottom: 10,
      zIndex: 999,
      animation: "bouncy",
      left: 0,
      right: 0,
      enterStyle: {
        opacity: 0,
        y: -10,
        scale: 0.9
      },
      exitStyle: {
        opacity: 0,
        y: 10,
        scale: 0.9
      },
      display: "flex",
      flexDirection: "row",
      justifyContent: "center",
      pointerEvents: "none",
      children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_Chip.Chip, {
        pointerEvents: "auto",
        variant: "filter",
        onPress: function() {
          var _listRef_current, _listRef_current1;
          listRef.current instanceof import_react_native.FlatList && ((_listRef_current = listRef.current) === null || _listRef_current === void 0 || _listRef_current.scrollToOffset({
            offset: 0,
            animated: !0
          })), listRef.current instanceof import_react_native.SectionList && ((_listRef_current1 = listRef.current) === null || _listRef_current1 === void 0 || _listRef_current1.scrollToLocation({
            animated: !0,
            itemIndex: 0,
            sectionIndex: 0
          }));
        },
        children: [
          /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Chip.Chip.Icon, {
            Icon: import_lucide_icons.ChevronUp
          }),
          /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Chip.Chip.Text, {
            children: "Scroll To Top"
          })
        ]
      })
    })
  });
}
var useScrollTo = function() {
  var [offset, setOffset] = (0, import_react.useState)(0), listRef = (0, import_react.useRef)(null);
  return [
    listRef,
    offset,
    setOffset
  ];
}, useScrollToSection = function() {
  var [offset, setOffset] = (0, import_react.useState)(0), listRef = (0, import_react.useRef)(null);
  return [
    listRef,
    offset,
    setOffset
  ];
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  ScrollTo,
  useScrollTo,
  useScrollToSection
});
//# sourceMappingURL=ScrollTo.js.map
