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AM,KAAE,KAAS,GAAS,GAAQ,CAAC,GAC5B,EAAK,GAAU,kCAAkC,GAClD,EAAY,QAAQ,EAAO,OAAO,iBACjC,EAAe,IAAoB,EAAI,cAAc,UAAU,GAItE,OAHI,GAAQ,IAAc,GACxB,GAAiB,GAEZ,CAAC,EAAK,IAAK,EAAQ,UAAW,EAAO,EAAgB,GAC9D,CACA,IAAI,6BAA+B","file":"/npm/react-intersection-observer-hook@4.0.1/dist/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/react-intersection-observer-hook@4.0.1/dist/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n  for (var name in all)\n    __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n  if (from && typeof from === \"object\" || typeof from === \"function\") {\n    for (let key of __getOwnPropNames(from))\n      if (!__hasOwnProp.call(to, key) && key !== except)\n        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n  }\n  return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\n\n// src/index.ts\nvar src_exports = {};\n__export(src_exports, {\n  useIntersectionObserver: () => use_intersection_observer_default,\n  useTrackVisibility: () => use_track_visibility_default\n});\nmodule.exports = __toCommonJS(src_exports);\n\n// src/use-intersection-observer.ts\nvar import_react = require(\"react\");\n\n// src/utils.ts\nfunction createObserverCache() {\n  const cachesByRoot = /* @__PURE__ */ new Map();\n  function getObserver({\n    root,\n    rootMargin,\n    threshold\n  }) {\n    let cacheByRoot = cachesByRoot.get(root);\n    if (!cacheByRoot) {\n      cacheByRoot = /* @__PURE__ */ new Map();\n      cachesByRoot.set(root, cacheByRoot);\n    }\n    const cacheKey = JSON.stringify({ rootMargin, threshold });\n    let cachedObserver = cacheByRoot.get(cacheKey);\n    if (!cachedObserver) {\n      const entryCallbacks = /* @__PURE__ */ new Map();\n      const observer = new IntersectionObserver(\n        (entries) => {\n          entries.forEach((entry) => {\n            const callback = entryCallbacks.get(entry.target);\n            callback?.(entry);\n          });\n        },\n        { root, rootMargin, threshold }\n      );\n      cachedObserver = { observer, entryCallbacks };\n      cacheByRoot.set(cacheKey, cachedObserver);\n    }\n    return {\n      observe: (node, callback) => {\n        cachedObserver.entryCallbacks.set(node, callback);\n        cachedObserver.observer.observe(node);\n      },\n      unobserve: (node) => {\n        cachedObserver.entryCallbacks.delete(node);\n        cachedObserver.observer.unobserve(node);\n      }\n    };\n  }\n  return { getObserver };\n}\n\n// src/use-intersection-observer.ts\nvar DEFAULT_ROOT_MARGIN = \"0px\";\nvar DEFAULT_THRESHOLD = [0];\nvar observerCache = createObserverCache();\nfunction useIntersectionObserver(args) {\n  const rootMargin = args?.rootMargin ?? DEFAULT_ROOT_MARGIN;\n  const threshold = args?.threshold ?? DEFAULT_THRESHOLD;\n  const nodeRef = (0, import_react.useRef)(null);\n  const rootRef = (0, import_react.useRef)(null);\n  const observerRef = (0, import_react.useRef)(null);\n  const [entry, setEntry] = (0, import_react.useState)();\n  const reinitializeObserver = (0, import_react.useCallback)(\n    ({ newNode, newRoot }) => {\n      function cleanupObserver() {\n        const observer = observerRef.current;\n        const node = nodeRef.current;\n        if (node) {\n          observer?.unobserve(node);\n          setEntry(void 0);\n        }\n        observerRef.current = null;\n      }\n      function initializeObserver() {\n        if (!newNode) return;\n        const newObserver = observerCache.getObserver({\n          root: newRoot,\n          rootMargin,\n          threshold\n        });\n        newObserver.observe(newNode, (observedEntry) => {\n          setEntry(observedEntry);\n        });\n        observerRef.current = newObserver;\n        nodeRef.current = newNode;\n        rootRef.current = newRoot;\n      }\n      cleanupObserver();\n      initializeObserver();\n    },\n    [rootMargin, threshold]\n  );\n  const refCallback = (0, import_react.useCallback)(\n    (node) => {\n      reinitializeObserver({ newNode: node, newRoot: rootRef.current });\n      return () => {\n        reinitializeObserver({ newNode: null, newRoot: rootRef.current });\n      };\n    },\n    [reinitializeObserver]\n  );\n  const rootRefCallback = (0, import_react.useCallback)(\n    (rootNode) => {\n      reinitializeObserver({ newNode: nodeRef.current, newRoot: rootNode });\n      return () => {\n        reinitializeObserver({ newNode: nodeRef.current, newRoot: null });\n      };\n    },\n    [reinitializeObserver]\n  );\n  return [refCallback, { entry, rootRef: rootRefCallback }];\n}\nvar use_intersection_observer_default = useIntersectionObserver;\n\n// src/use-track-visibility.ts\nvar import_react2 = require(\"react\");\nfunction useTrackVisibility(args) {\n  const { once, ...rest } = args ?? {};\n  const [ref, result] = use_intersection_observer_default(rest);\n  const isVisible = Boolean(result.entry?.isIntersecting);\n  const [isVisibleOnce, setIsVisibleOnce] = (0, import_react2.useState)(isVisible);\n  if (once && isVisible && !isVisibleOnce) {\n    setIsVisibleOnce(true);\n  }\n  return [ref, { ...result, isVisible: once ? isVisibleOnce : isVisible }];\n}\nvar use_track_visibility_default = useTrackVisibility;\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n  useIntersectionObserver,\n  useTrackVisibility\n});\n"]}