@opensite/hooks 0.1.1 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/README.md +191 -45
  2. package/dist/browser/opensite-hooks.umd.cjs +1 -1
  3. package/dist/browser/opensite-hooks.umd.js +1 -1
  4. package/dist/browser/opensite-hooks.umd.js.map +1 -1
  5. package/dist/core/index.cjs +7 -0
  6. package/dist/core/index.d.ts +13 -0
  7. package/dist/core/index.js +7 -0
  8. package/dist/core/useOpenGraphExtractor.cjs +59 -0
  9. package/dist/core/useOpenGraphExtractor.d.ts +64 -0
  10. package/dist/core/useOpenGraphExtractor.js +59 -0
  11. package/dist/core/useWebsiteExtractorBase.cjs +153 -0
  12. package/dist/core/useWebsiteExtractorBase.d.ts +9 -0
  13. package/dist/core/useWebsiteExtractorBase.js +153 -0
  14. package/dist/core/useWebsiteLinksExtractor.cjs +16 -0
  15. package/dist/core/useWebsiteLinksExtractor.d.ts +14 -0
  16. package/dist/core/useWebsiteLinksExtractor.js +16 -0
  17. package/dist/core/useWebsiteMetaExtractor.cjs +20 -0
  18. package/dist/core/useWebsiteMetaExtractor.d.ts +12 -0
  19. package/dist/core/useWebsiteMetaExtractor.js +20 -0
  20. package/dist/core/useWebsiteRssExtractor.cjs +15 -0
  21. package/dist/core/useWebsiteRssExtractor.d.ts +12 -0
  22. package/dist/core/useWebsiteRssExtractor.js +15 -0
  23. package/dist/core/useWebsiteSchemaExtractor.cjs +15 -0
  24. package/dist/core/useWebsiteSchemaExtractor.d.ts +11 -0
  25. package/dist/core/useWebsiteSchemaExtractor.js +15 -0
  26. package/dist/core/websiteExtractorService.cjs +66 -0
  27. package/dist/core/websiteExtractorService.d.ts +3 -0
  28. package/dist/core/websiteExtractorService.js +66 -0
  29. package/dist/core/websiteExtractorTypes.cjs +25 -0
  30. package/dist/core/websiteExtractorTypes.d.ts +65 -0
  31. package/dist/core/websiteExtractorTypes.js +25 -0
  32. package/package.json +90 -139
  33. package/dist/hooks/index.cjs +0 -16
  34. package/dist/hooks/index.d.ts +0 -24
  35. package/dist/hooks/index.js +0 -16
  36. package/dist/hooks/useBoolean.cjs +0 -1
  37. package/dist/hooks/useBoolean.d.ts +0 -2
  38. package/dist/hooks/useBoolean.js +0 -1
  39. package/dist/hooks/useCopyToClipboard.cjs +0 -1
  40. package/dist/hooks/useCopyToClipboard.d.ts +0 -2
  41. package/dist/hooks/useCopyToClipboard.js +0 -1
  42. package/dist/hooks/useDebounceCallback.cjs +0 -1
  43. package/dist/hooks/useDebounceCallback.d.ts +0 -2
  44. package/dist/hooks/useDebounceCallback.js +0 -1
  45. package/dist/hooks/useDebounceValue.cjs +0 -1
  46. package/dist/hooks/useDebounceValue.d.ts +0 -2
  47. package/dist/hooks/useDebounceValue.js +0 -1
  48. package/dist/hooks/useEventListener.cjs +0 -1
  49. package/dist/hooks/useEventListener.d.ts +0 -1
  50. package/dist/hooks/useEventListener.js +0 -1
  51. package/dist/hooks/useHover.cjs +0 -1
  52. package/dist/hooks/useHover.d.ts +0 -1
  53. package/dist/hooks/useHover.js +0 -1
  54. package/dist/hooks/useIsClient.cjs +0 -1
  55. package/dist/hooks/useIsClient.d.ts +0 -1
  56. package/dist/hooks/useIsClient.js +0 -1
  57. package/dist/hooks/useIsomorphicLayoutEffect.cjs +0 -1
  58. package/dist/hooks/useIsomorphicLayoutEffect.d.ts +0 -1
  59. package/dist/hooks/useIsomorphicLayoutEffect.js +0 -1
  60. package/dist/hooks/useLocalStorage.cjs +0 -1
  61. package/dist/hooks/useLocalStorage.d.ts +0 -2
  62. package/dist/hooks/useLocalStorage.js +0 -1
  63. package/dist/hooks/useMap.cjs +0 -1
  64. package/dist/hooks/useMap.d.ts +0 -2
  65. package/dist/hooks/useMap.js +0 -1
  66. package/dist/hooks/useMediaQuery.cjs +0 -1
  67. package/dist/hooks/useMediaQuery.d.ts +0 -2
  68. package/dist/hooks/useMediaQuery.js +0 -1
  69. package/dist/hooks/useOnClickOutside.cjs +0 -1
  70. package/dist/hooks/useOnClickOutside.d.ts +0 -1
  71. package/dist/hooks/useOnClickOutside.js +0 -1
  72. package/dist/hooks/usePrevious.cjs +0 -1
  73. package/dist/hooks/usePrevious.d.ts +0 -1
  74. package/dist/hooks/usePrevious.js +0 -1
  75. package/dist/hooks/useResizeObserver.cjs +0 -1
  76. package/dist/hooks/useResizeObserver.d.ts +0 -1
  77. package/dist/hooks/useResizeObserver.js +0 -1
  78. package/dist/hooks/useSessionStorage.cjs +0 -1
  79. package/dist/hooks/useSessionStorage.d.ts +0 -2
  80. package/dist/hooks/useSessionStorage.js +0 -1
  81. package/dist/hooks/useThrottle.cjs +0 -1
  82. package/dist/hooks/useThrottle.d.ts +0 -2
  83. package/dist/hooks/useThrottle.js +0 -1
package/README.md CHANGED
@@ -1,79 +1,225 @@
1
1
  ![Opensite AI Utility Hooks](https://octane.cdn.ing/api/v1/images/transform?url=https://cdn.ing/assets/i/r/285728/knsbi168qz1imlat2aq042c10rw8/opensite-react-hooks.png&q=90&f=webp)
2
2
 
3
- # OpenSite React Hooks Library
3
+ # @opensite/hooks
4
4
 
5
- High-performance React hooks for state management, storage, and more.
5
+ Performance-first React hooks for UI state, storage, events, and responsive behavior.
6
+
7
+ [![npm version](https://img.shields.io/npm/v/@opensite/hooks.svg)](https://www.npmjs.com/package/@opensite/hooks)
8
+ [![bundle size](https://img.shields.io/bundlephobia/minzip/@opensite/hooks)](https://bundlephobia.com/package/@opensite/hooks)
9
+ [![license](https://img.shields.io/npm/l/@opensite/hooks.svg)](./LICENSE)
6
10
 
7
11
  ## Overview
8
12
 
9
- The OpenSite React Hooks Library provides a suite of high-performance hooks designed to enhance React applications with efficient state management, storage, and event handling capabilities. This library is part of OpenSite AI's open-source ecosystem, emphasizing modularity, performance, and developer-friendly design. Learn more at [OpenSite AI](https://opensite.ai).
13
+ `@opensite/hooks` provides a suite of zero-dependency, tree-shakable React hooks designed for high-performance marketing sites and web applications. All hooks are SSR-safe and optimized for Core Web Vitals.
10
14
 
11
- ## Key Features
15
+ **Key Features:**
12
16
 
13
- - **Performance-Optimized Hooks**: Built to ensure minimal impact on your application's performance.
14
- - **Modular Design**: Use only what you need with tree-shakable exports and hook-level entry points.
15
- - **SEO-Friendly**: Designed with best practices to ensure high performance and accessibility.
16
- - **Wide Range of Capabilities**: Includes hooks for event handling, storage management, responsive utilities, and more.
17
+ - 🚀 **Zero dependencies** Only React as a peer dependency
18
+ - 🌳 **Tree-shakable** Import only what you use with flat exports
19
+ - 🔒 **SSR-safe** All hooks handle server-side rendering correctly
20
+ - **Performance-first** Memoized callbacks, minimal re-renders
21
+ - 📦 **Multiple formats** – ESM, CJS, and UMD builds included
17
22
 
18
23
  ## Installation
19
24
 
20
- To use the OpenSite React Hooks Library, ensure you have Node.js installed. Then, add the library to your project:
25
+ ```bash
26
+ # npm
27
+ npm install @opensite/hooks
28
+
29
+ # pnpm
30
+ pnpm add @opensite/hooks
21
31
 
32
+ # yarn
33
+ yarn add @opensite/hooks
22
34
  ```
23
- npm install @opensite-ai/react-hooks
35
+
36
+ ### Requirements
37
+
38
+ - React 17.0.0 or higher
39
+ - React DOM 17.0.0 or higher
40
+
41
+ ## Quick Start
42
+
43
+ ### Barrel Import
44
+
45
+ Import multiple hooks from the main entry point:
46
+
47
+ ```typescript
48
+ import { useBoolean, useLocalStorage, useMediaQuery } from '@opensite/hooks';
24
49
  ```
25
50
 
26
- ### Dependencies
51
+ ### Direct Import (Recommended for Bundle Size)
52
+
53
+ Import individual hooks for optimal tree-shaking:
54
+
55
+ ```typescript
56
+ import { useBoolean } from '@opensite/hooks/useBoolean';
57
+ import { useLocalStorage } from '@opensite/hooks/useLocalStorage';
58
+ import { useMediaQuery } from '@opensite/hooks/useMediaQuery';
59
+ ```
27
60
 
28
- - React and React DOM (version 16.8 or higher)
61
+ ### CDN Usage (UMD)
29
62
 
63
+ ```html
64
+ <script src="https://cdn.jsdelivr.net/npm/@opensite/hooks/dist/browser/opensite-hooks.umd.js"></script>
65
+ <script>
66
+ const { useBoolean, useDebounceValue } = window.OpensiteHooks;
67
+ </script>
68
+ ```
30
69
 
31
70
  ## Available Hooks
32
71
 
33
- | Hook | Description | Documentation |
34
- |------|-------------|---------------|
35
- | [useBoolean](./docs/useBoolean.md) | Manage boolean state with convenient helper methods | [View Docs](./docs/useBoolean.md) |
36
- | [useCopyToClipboard](./docs/useCopyToClipboard.md) | Copy text to clipboard with automatic reset and browser compatibility | [View Docs](./docs/useCopyToClipboard.md) |
37
- | [useDebounceCallback](./docs/useDebounceCallback.md) | Debounce callback functions with advanced options | [View Docs](./docs/useDebounceCallback.md) |
38
- | [useDebounceValue](./docs/useDebounceValue.md) | Debounce state values with configurable delay | [View Docs](./docs/useDebounceValue.md) |
39
- | [useEventListener](./docs/useEventListener.md) | Attach event listeners to DOM elements with automatic cleanup | [View Docs](./docs/useEventListener.md) |
40
- | [useHover](./docs/useHover.md) | Detect hover state on elements using pointer events | [View Docs](./docs/useHover.md) |
41
- | [useIsClient](./docs/useIsClient.md) | Detect if code is running on client-side or server-side | [View Docs](./docs/useIsClient.md) |
42
- | [useIsomorphicLayoutEffect](./docs/useIsomorphicLayoutEffect.md) | SSR-safe layout effect hook | [View Docs](./docs/useIsomorphicLayoutEffect.md) |
43
- | [useLocalStorage](./docs/useLocalStorage.md) | Manage state synchronized with localStorage | [View Docs](./docs/useLocalStorage.md) |
44
- | [useMap](./docs/useMap.md) | Manage Map state with convenient helper methods | [View Docs](./docs/useMap.md) |
45
- | [useMediaQuery](./docs/useMediaQuery.md) | Responsive design using CSS media queries | [View Docs](./docs/useMediaQuery.md) |
46
- | [useOnClickOutside](./docs/useOnClickOutside.md) | Detect clicks outside of specified elements | [View Docs](./docs/useOnClickOutside.md) |
47
- | [usePrevious](./docs/usePrevious.md) | Access the previous value of a state or prop | [View Docs](./docs/usePrevious.md) |
48
- | [useResizeObserver](./docs/useResizeObserver.md) | Observe element size changes using ResizeObserver API | [View Docs](./docs/useResizeObserver.md) |
49
- | [useSessionStorage](./docs/useSessionStorage.md) | Manage state synchronized with sessionStorage | [View Docs](./docs/useSessionStorage.md) |
50
- | [useThrottle](./docs/useThrottle.md) | Throttle value changes with configurable options | [View Docs](./docs/useThrottle.md) |
51
-
52
- ## Configuration or Advanced Usage
53
-
54
- Customize the behavior of `useThrottle` with various options:
55
-
56
- ```javascript
57
- import { useThrottle } from '@opensite-ai/react-hooks';
58
-
59
- const throttledValue = useThrottle(value, 300, { leading: true, trailing: false });
72
+ | Hook | Description | Docs |
73
+ |------|-------------|------|
74
+ | **State Management** | | |
75
+ | [`useBoolean`](./docs/useBoolean.md) | Boolean state with toggle, setTrue, setFalse helpers | [View](./docs/useBoolean.md) |
76
+ | [`useMap`](./docs/useMap.md) | Map state with set, remove, clear helpers | [View](./docs/useMap.md) |
77
+ | [`usePrevious`](./docs/usePrevious.md) | Access the previous value of a state or prop | [View](./docs/usePrevious.md) |
78
+ | **Storage** | | |
79
+ | [`useLocalStorage`](./docs/useLocalStorage.md) | Synchronized state with localStorage + cross-tab sync | [View](./docs/useLocalStorage.md) |
80
+ | [`useSessionStorage`](./docs/useSessionStorage.md) | Synchronized state with sessionStorage | [View](./docs/useSessionStorage.md) |
81
+ | **Timing** | | |
82
+ | [`useDebounceValue`](./docs/useDebounceValue.md) | Debounce value changes with configurable delay | [View](./docs/useDebounceValue.md) |
83
+ | [`useDebounceCallback`](./docs/useDebounceCallback.md) | Debounce callbacks with cancel/flush controls | [View](./docs/useDebounceCallback.md) |
84
+ | [`useThrottle`](./docs/useThrottle.md) | Throttle value changes with leading/trailing options | [View](./docs/useThrottle.md) |
85
+ | **DOM & Events** | | |
86
+ | [`useEventListener`](./docs/useEventListener.md) | Attach event listeners with automatic cleanup | [View](./docs/useEventListener.md) |
87
+ | [`useOnClickOutside`](./docs/useOnClickOutside.md) | Detect clicks outside specified elements | [View](./docs/useOnClickOutside.md) |
88
+ | [`useHover`](./docs/useHover.md) | Detect hover state using pointer events | [View](./docs/useHover.md) |
89
+ | [`useResizeObserver`](./docs/useResizeObserver.md) | Observe element size changes | [View](./docs/useResizeObserver.md) |
90
+ | **Responsive** | | |
91
+ | [`useMediaQuery`](./docs/useMediaQuery.md) | Reactive CSS media query matching | [View](./docs/useMediaQuery.md) |
92
+ | **Utilities** | | |
93
+ | [`useCopyToClipboard`](./docs/useCopyToClipboard.md) | Copy text to clipboard with feedback state | [View](./docs/useCopyToClipboard.md) |
94
+ | [`useIsClient`](./docs/useIsClient.md) | Detect client-side vs server-side rendering | [View](./docs/useIsClient.md) |
95
+ | [`useIsomorphicLayoutEffect`](./docs/useIsomorphicLayoutEffect.md) | SSR-safe useLayoutEffect | [View](./docs/useIsomorphicLayoutEffect.md) |
96
+
97
+ ## Examples
98
+
99
+ ### useBoolean
100
+
101
+ ```typescript
102
+ import { useBoolean } from '@opensite/hooks/useBoolean';
103
+
104
+ function Modal() {
105
+ const { value: isOpen, setTrue: open, setFalse: close, toggle } = useBoolean(false);
106
+
107
+ return (
108
+ <>
109
+ <button onClick={open}>Open Modal</button>
110
+ {isOpen && (
111
+ <dialog open>
112
+ <p>Modal content</p>
113
+ <button onClick={close}>Close</button>
114
+ </dialog>
115
+ )}
116
+ </>
117
+ );
118
+ }
119
+ ```
120
+
121
+ ### useDebounceValue
122
+
123
+ ```typescript
124
+ import { useState } from 'react';
125
+ import { useDebounceValue } from '@opensite/hooks/useDebounceValue';
126
+
127
+ function SearchInput() {
128
+ const [query, setQuery] = useState('');
129
+ const debouncedQuery = useDebounceValue(query, 300);
130
+
131
+ // API call only triggers when debouncedQuery changes
132
+ useEffect(() => {
133
+ if (debouncedQuery) {
134
+ searchAPI(debouncedQuery);
135
+ }
136
+ }, [debouncedQuery]);
137
+
138
+ return <input value={query} onChange={(e) => setQuery(e.target.value)} />;
139
+ }
140
+ ```
141
+
142
+ ### useMediaQuery
143
+
144
+ ```typescript
145
+ import { useMediaQuery } from '@opensite/hooks/useMediaQuery';
146
+
147
+ function ResponsiveComponent() {
148
+ const isMobile = useMediaQuery('(max-width: 768px)');
149
+ const prefersDark = useMediaQuery('(prefers-color-scheme: dark)');
150
+
151
+ return (
152
+ <div className={prefersDark ? 'dark' : 'light'}>
153
+ {isMobile ? <MobileNav /> : <DesktopNav />}
154
+ </div>
155
+ );
156
+ }
157
+ ```
158
+
159
+ ### useLocalStorage
160
+
161
+ ```typescript
162
+ import { useLocalStorage } from '@opensite/hooks/useLocalStorage';
163
+
164
+ function ThemeToggle() {
165
+ const [theme, setTheme] = useLocalStorage('theme', 'light');
166
+
167
+ return (
168
+ <button onClick={() => setTheme(theme === 'light' ? 'dark' : 'light')}>
169
+ Current: {theme}
170
+ </button>
171
+ );
172
+ }
173
+ ```
174
+
175
+ ## Migration from v1.x
176
+
177
+ Version 2.0.0 simplifies import paths. Update your imports:
178
+
179
+ ```diff
180
+ - import { useBoolean } from '@opensite/hooks/core/useBoolean';
181
+ - import { useBoolean } from '@opensite/hooks/hooks/useBoolean';
182
+ + import { useBoolean } from '@opensite/hooks/useBoolean';
60
183
  ```
61
184
 
62
- ## Performance Notes
185
+ The `/core/*` and `/hooks/*` paths have been removed. Use flat paths (`/useBoolean`) or barrel imports (`@opensite/hooks`) instead.
186
+
187
+ ## TypeScript
63
188
 
64
- Performance is a core facet of everything we build. The OpenSite React Hooks Library makes use of advanced techniques to optimize rendering and state updates, ensuring that your applications remain fast and responsive.
189
+ All hooks are written in TypeScript and include full type definitions. Types are exported alongside hooks:
190
+
191
+ ```typescript
192
+ import { useBoolean, type UseBooleanResult } from '@opensite/hooks/useBoolean';
193
+ import { useLocalStorage, type StorageOptions } from '@opensite/hooks/useLocalStorage';
194
+ ```
65
195
 
66
196
  ## Contributing
67
197
 
68
- We welcome contributions from the community. For contribution guidelines, visit our [GitHub repository](https://github.com/opensite-ai).
198
+ We welcome contributions! Please see our [Contributing Guide](./CONTRIBUTING.md) for details.
199
+
200
+ ```bash
201
+ # Clone the repo
202
+ git clone https://github.com/opensite-ai/opensite-hooks.git
203
+ cd opensite-hooks
204
+
205
+ # Install dependencies
206
+ pnpm install
207
+
208
+ # Run tests
209
+ pnpm test
210
+
211
+ # Build
212
+ pnpm build
213
+ ```
69
214
 
70
215
  ## License
71
216
 
72
- This project is licensed under the BSD 3-Clause License. See the [LICENSE](./LICENSE) file for more details.
217
+ [BSD-3-Clause](./LICENSE) © [OpenSite AI](https://opensite.ai)
73
218
 
74
219
  ## Related Projects
75
220
 
76
- - [OpenSite Domain Extractor](https://github.com/opensite-ai/domain_extractor): A high-performance Rust utility for domain extraction.
77
- - [OpenSite Page Speed Hooks](https://github.com/opensite-ai/page-speed-hooks): Tools to enhance page load performance.
221
+ - [@opensite/ui](https://github.com/opensite-ai/opensite-ui) React component library for OpenSite
222
+ - [@opensite/blocks](https://github.com/opensite-ai/opensite-blocks) Semantic page blocks for site builders
223
+ - [@page-speed/forms](https://github.com/opensite-ai/page-speed-forms) – Framework-agnostic form handling
78
224
 
79
225
  Visit [OpenSite AI](https://opensite.ai) for more projects and information.
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).OpensiteHooks={},e.React)}(this,function(e,t){"use strict";const n="undefined"!=typeof window?t.useLayoutEffect:t.useEffect;function r(e,r,u={}){const c=t.useRef(e),o=t.useRef(null),s=t.useRef(null),i=t.useRef(null),a=u.leading??!1,l=u.trailing??!0,f=u.maxWait,d=Math.max(0,r);n(()=>{c.current=e},[e]);const p=t.useCallback(()=>{o.current&&(clearTimeout(o.current),o.current=null),s.current&&(clearTimeout(s.current),s.current=null)},[]),m=t.useCallback(()=>{if(!i.current)return;const e=i.current;i.current=null,c.current(...e)},[]),y=t.useCallback((...e)=>{i.current=e;if(a&&null===o.current&&null===s.current&&m(),o.current&&clearTimeout(o.current),l&&(o.current=setTimeout(()=>{o.current=null,i.current&&m(),s.current&&(clearTimeout(s.current),s.current=null)},d)),null!=f&&l&&!s.current){const e=Math.max(0,f);s.current=setTimeout(()=>{s.current=null,o.current&&(clearTimeout(o.current),o.current=null),i.current&&m()},e)}},[m,a,l,f,d]),w=t.useCallback(()=>{p(),i.current=null},[p]),v=t.useCallback(()=>{i.current&&(p(),m())},[p,m]);return t.useEffect(()=>()=>w(),[w]),{debouncedCallback:y,cancel:w,flush:v}}function u(e,r,u,c){const o=t.useRef(r);n(()=>{o.current=r},[r]),t.useEffect(()=>{const t="undefined"!=typeof Window&&u instanceof Window,n="undefined"!=typeof Document&&u instanceof Document,r=void 0===u?"undefined"!=typeof window?window:null:t||n||"undefined"!=typeof HTMLElement&&u instanceof HTMLElement?u:(s=u)&&"object"==typeof s&&"current"in s?u.current:null;var s;if(!(null==r?void 0:r.addEventListener))return;const i=e=>{const t=o.current;"function"==typeof t?t(e):t.handleEvent(e)};return r.addEventListener(e,i,c),()=>{r.removeEventListener(e,i,c)}},[e,u,c])}e.useBoolean=function(e=!1){const[n,r]=t.useState(e),u=t.useCallback(()=>r(!0),[]),c=t.useCallback(()=>r(!1),[]),o=t.useCallback(()=>r(e=>!e),[]);return{value:n,setValue:r,setTrue:u,setFalse:c,toggle:o}},e.useCopyToClipboard=function(e={}){const n=e.resetDelay??2e3,r=t.useRef(null),[u,c]=t.useState(null),o=t.useMemo(()=>!("undefined"==typeof navigator||!navigator.clipboard)||"undefined"!=typeof document&&("function"==typeof document.queryCommandSupported&&document.queryCommandSupported("copy")),[]),s=t.useCallback(()=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{c(null)},n)},[n]),i=t.useCallback(async e=>{if(!o)return!1;const t="undefined"!=typeof navigator&&!!navigator.clipboard;try{if(t)await navigator.clipboard.writeText(e);else if("undefined"!=typeof document){const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.left="-9999px",t.style.top="0",document.body.appendChild(t),t.focus(),t.select();const n=document.execCommand("copy");if(document.body.removeChild(t),!n)return!1}return c(e),s(),!0}catch{return!1}},[o,s]);return t.useEffect(()=>()=>{r.current&&clearTimeout(r.current)},[]),{copy:i,copiedText:u,isSupported:o}},e.useDebounceCallback=r,e.useDebounceValue=function(e,n,u){const[c,o]=t.useState(e),{debouncedCallback:s,cancel:i}=r(e=>{o(e)},n,u);return t.useEffect(()=>{s(e)},[s,e]),t.useEffect(()=>()=>i(),[i]),c},e.useEventListener=u,e.useHover=function(e){const[n,r]=t.useState(!1),c=t.useCallback(()=>{r(!0)},[]),o=t.useCallback(()=>{r(!1)},[]);return u("pointerenter",c,e),u("pointerleave",o,e),n},e.useIsClient=function(){const[e,n]=t.useState(!1);return t.useEffect(()=>{n(!0)},[]),e},e.useIsomorphicLayoutEffect=n,e.useLocalStorage=function(e,n,r={}){const{initializeWithValue:u=!0,serialize:c=JSON.stringify,deserialize:o=JSON.parse,listenToStorageChanges:s=!0}=r,i=t.useRef(n),a=t.useCallback(()=>{if("undefined"==typeof window)return i.current;if(!u)return i.current;try{const t=window.localStorage.getItem(e);return t?o(t):i.current}catch{return i.current}},[o,u,e]),[l,f]=t.useState(()=>a()),d=t.useCallback(t=>{f(n=>{const r="function"==typeof t?t(n):t;if("undefined"!=typeof window)try{window.localStorage.setItem(e,c(r))}catch{}return r})},[e,c]);return t.useEffect(()=>{f(a())},[a]),t.useEffect(()=>{if("undefined"==typeof window||!s)return;const t=t=>{if(t.key===e)if(null!==t.newValue)try{f(o(t.newValue))}catch{f(i.current)}else f(i.current)};return window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)},[o,e,s]),[l,d]},e.useMap=function(e){const[n,r]=t.useState(()=>e instanceof Map||Array.isArray(e)?new Map(e):new Map),u=t.useRef(n);t.useEffect(()=>{u.current=n},[n]);const c=t.useMemo(()=>({set:(e,t)=>{r(n=>{const r=new Map(n);return r.set(e,t),r})},setAll:e=>{r((Map,new Map(e)))},remove:e=>{r(t=>{const n=new Map(t);return n.delete(e),n})},clear:()=>r(new Map),get:e=>u.current.get(e),has:e=>u.current.has(e)}),[]);return[n,c]},e.useMediaQuery=function(e,n={}){const[r,u]=t.useState(()=>"undefined"==typeof window||"function"!=typeof window.matchMedia?n.defaultValue??!1:window.matchMedia(e).matches);return t.useEffect(()=>{if("undefined"==typeof window||"function"!=typeof window.matchMedia)return;const t=window.matchMedia(e),n=e=>{u(e.matches)};return u(t.matches),t.addEventListener?(t.addEventListener("change",n),()=>t.removeEventListener("change",n)):(t.addListener(n),()=>t.removeListener(n))},[e]),r},e.useOnClickOutside=function(e,n,r="mousedown",u){const c=t.useRef(n);t.useEffect(()=>{c.current=n},[n]),t.useEffect(()=>{if("undefined"==typeof document)return;const t=Array.isArray(e)?e:[e],n=e=>{const n=e.target;if("undefined"==typeof Node||!(n instanceof Node))return;t.some(e=>{const t=e.current;return!!t&&t.contains(n)})||c.current(e)};return document.addEventListener(r,n,u),()=>{document.removeEventListener(r,n,u)}},[r,u,e])},e.usePrevious=function(e){const n=t.useRef();return t.useEffect(()=>{n.current=e},[e]),n.current},e.useResizeObserver=function(e,r,u){const c=t.useRef(r),o=t.useRef(null),[s,i]=t.useState(null);return n(()=>{c.current=r},[r]),t.useEffect(()=>{if("undefined"==typeof ResizeObserver)return;const t="undefined"!=typeof Element&&e instanceof Element?e:(n=e)&&"object"==typeof n&&"current"in n?e.current:null;var n;if(!t)return;const r=new ResizeObserver(e=>{const t=e[0];o.current=t,c.current?c.current(t):i(t)});return r.observe(t,u),()=>r.disconnect()},[u,e]),c.current?o.current:s},e.useSessionStorage=function(e,n,r={}){const{initializeWithValue:u=!0,serialize:c=JSON.stringify,deserialize:o=JSON.parse,listenToStorageChanges:s=!1}=r,i=t.useRef(n),a=t.useCallback(()=>{if("undefined"==typeof window)return i.current;if(!u)return i.current;try{const t=window.sessionStorage.getItem(e);return t?o(t):i.current}catch{return i.current}},[o,u,e]),[l,f]=t.useState(()=>a()),d=t.useCallback(t=>{f(n=>{const r="function"==typeof t?t(n):t;if("undefined"!=typeof window)try{window.sessionStorage.setItem(e,c(r))}catch{}return r})},[e,c]);return t.useEffect(()=>{f(a())},[a]),t.useEffect(()=>{if("undefined"==typeof window||!s)return;const t=t=>{if(t.key===e)if(null!==t.newValue)try{f(o(t.newValue))}catch{f(i.current)}else f(i.current)};return window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)},[o,e,s]),[l,d]},e.useThrottle=function(e,n,r={}){const u=r.leading??!0,c=r.trailing??!0,o=Math.max(0,n),[s,i]=t.useState(e),a=t.useRef(0),l=t.useRef(null),f=t.useRef(null);return t.useEffect(()=>{if(0===o)return void i(e);const t=Date.now();if(0===a.current)return a.current=t,u?void i(e):void(c&&!l.current&&(f.current=e,l.current=setTimeout(()=>{l.current=null,null!==f.current&&(i(f.current),f.current=null,a.current=Date.now())},o)));const n=t-a.current;if(n>=o&&u)return i(e),a.current=t,void(f.current=null);if(c&&(f.current=e,!l.current)){const e=Math.max(o-n,0);l.current=setTimeout(()=>{l.current=null,null!==f.current&&(i(f.current),f.current=null,a.current=Date.now())},e)}},[u,c,e,o]),t.useEffect(()=>()=>{l.current&&clearTimeout(l.current)},[]),s},Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).OpensiteHooks={},e.React)}(this,function(e,t){"use strict";const n="undefined"!=typeof window?t.useLayoutEffect:t.useEffect;function r(e,r,u={}){const o=t.useRef(e),i=t.useRef(null),s=t.useRef(null),c=t.useRef(null),a=u.leading??!1,l=u.trailing??!0,d=u.maxWait,f=Math.max(0,r);n(()=>{o.current=e},[e]);const p=t.useCallback(()=>{i.current&&(clearTimeout(i.current),i.current=null),s.current&&(clearTimeout(s.current),s.current=null)},[]),m=t.useCallback(()=>{if(!c.current)return;const e=c.current;c.current=null,o.current(...e)},[]),v=t.useCallback((...e)=>{c.current=e;if(a&&null===i.current&&null===s.current&&m(),i.current&&clearTimeout(i.current),l&&(i.current=setTimeout(()=>{i.current=null,c.current&&m(),s.current&&(clearTimeout(s.current),s.current=null)},f)),null!=d&&l&&!s.current){const e=Math.max(0,d);s.current=setTimeout(()=>{s.current=null,i.current&&(clearTimeout(i.current),i.current=null),c.current&&m()},e)}},[m,a,l,d,f]),y=t.useCallback(()=>{p(),c.current=null},[p]),g=t.useCallback(()=>{c.current&&(p(),m())},[p,m]);return t.useEffect(()=>()=>y(),[y]),{debouncedCallback:v,cancel:y,flush:g}}function u(e,n,u){const[o,i]=t.useState(e),{debouncedCallback:s,cancel:c}=r(e=>{i(e)},n,u);return t.useEffect(()=>{s(e)},[s,e]),t.useEffect(()=>()=>c(),[c]),o}function o(e,r,u,o){const i=t.useRef(r);n(()=>{i.current=r},[r]),t.useEffect(()=>{const t="undefined"!=typeof Window&&u instanceof Window,n="undefined"!=typeof Document&&u instanceof Document,r=void 0===u?"undefined"!=typeof window?window:null:t||n||"undefined"!=typeof HTMLElement&&u instanceof HTMLElement?u:(s=u)&&"object"==typeof s&&"current"in s?u.current:null;var s;if(!(null==r?void 0:r.addEventListener))return;const c=e=>{const t=i.current;"function"==typeof t?t(e):t.handleEvent(e)};return r.addEventListener(e,c,o),()=>{r.removeEventListener(e,c,o)}},[e,u,o])}function i(){const[e,n]=t.useState(!1);return t.useEffect(()=>{n(!0)},[]),e}function s(e){const[n,r]=t.useState(()=>e instanceof Map||Array.isArray(e)?new Map(e):new Map),u=t.useRef(n);t.useEffect(()=>{u.current=n},[n]);const o=t.useMemo(()=>({set:(e,t)=>{r(n=>{const r=new Map(n);return r.set(e,t),r})},setAll:e=>{r((Map,new Map(e)))},remove:e=>{r(t=>{const n=new Map(t);return n.delete(e),n})},clear:()=>r(new Map),get:e=>u.current.get(e),has:e=>u.current.has(e)}),[]);return[n,o]}const c="https://octane.buzz";function a(e){const t=function(e){return e.replace(/\/+$/,"")}(e.baseUrl??c),n=new URLSearchParams;return e.apiKey&&n.set("api_key",e.apiKey),n.set("url",e.url),`${t}/api/v1/extract/${e.endpoint}?${n.toString()}`}async function l(e){var t;if(!e.url||0===e.url.trim().length)return{ok:!1,error:{message:"URL is required."}};const n=a(e);try{const t=await fetch(n,{method:"GET",signal:e.signal});let r=null;try{r=await t.json()}catch{r=null}if(!t.ok){const e=r;return{ok:!1,error:{message:(null==e?void 0:e.error)??`Request failed with status ${t.status}.`,status:(null==e?void 0:e.status)??t.status,raw:r}}}return{ok:!0,response:r}}catch(r){return(null==(t=e.signal)?void 0:t.aborted)?{ok:!1,error:{message:"Request aborted."}}:{ok:!1,error:{message:r instanceof Error?r.message:"Request failed unexpectedly.",raw:r}}}}function d(e){const{endpoint:n,options:o,selectData:a,shouldSkip:d}=e,f=i(),[p,m]=t.useState({loading:!1}),[,v]=s(),y=o.cache??true,g=o.enabled??true,b=o.debounceMs??250,w=o.refreshDebounceMs??150,h=u(t.useMemo(()=>{var e;return(null==(e=o.url)?void 0:e.trim())??""},[o.url]),b),E=t.useRef(0),k=t.useRef(0),[C,T]=t.useState(0),{debouncedCallback:S,cancel:R}=r(()=>{E.current+=1,T(E.current)},w),M=t.useCallback(()=>{S()},[S]);t.useEffect(()=>()=>R(),[R]);const x=t.useMemo(()=>{if(!h)return"";const e=o.baseUrl??c,t=o.apiKey??"";return`${n}:${e}:${t}:${h}`},[n,o.apiKey,o.baseUrl,h]),L=t.useRef(null);return t.useEffect(()=>{var e;if(!f)return;if(!g||!h)return void m({loading:!1});if(null==d?void 0:d(h))return void m({loading:!1});const t=C!==k.current;if(t&&(k.current=C),y&&!t){const e=v.get(x);if(e)return void m({loading:!1,data:e.data,raw:e.raw,meta:e.meta})}null==(e=L.current)||e.abort();const r=new AbortController;return L.current=r,m(e=>({...e,loading:!0,error:void 0})),l({endpoint:n,url:h,apiKey:o.apiKey,baseUrl:o.baseUrl,signal:r.signal}).then(e=>{if(r.signal.aborted)return;if(!e.ok)return void m(t=>({...t,loading:!1,error:e.error}));const t=e.response,n=function(e){const{requestedUrl:t,finalUrl:n,url:r,normalizedUrl:u,status:o,contentType:i,fetchedAt:s,bodyBytes:c,bodyTruncated:a,maxBodyBytes:l,cache:d}=e;return{requestedUrl:t,finalUrl:n,url:r,normalizedUrl:u,status:o,contentType:i,fetchedAt:s,bodyBytes:c,bodyTruncated:a,maxBodyBytes:l,cache:d}}(t),u=function(e){const{requestedUrl:t,finalUrl:n,url:r,normalizedUrl:u,status:o,contentType:i,fetchedAt:s,bodyBytes:c,bodyTruncated:a,maxBodyBytes:l,cache:d,...f}=e;return f}(t),o=a(u,t,n);y&&v.set(x,{data:o,raw:t,meta:n}),m({loading:!1,data:o,raw:t,meta:n})}).catch(e=>{r.signal.aborted||m(t=>({...t,loading:!1,error:{message:e instanceof Error?e.message:"Request failed unexpectedly.",raw:e}}))}),()=>{r.abort()}},[v,y,h,g,n,f,o.apiKey,o.baseUrl,x,C,a,d]),t.useMemo(()=>({...p,refresh:M}),[M,p])}const f=[/search\.google\.com\/local\/reviews/i,/google\.com\/maps\/place/i,/maps\.google\.com/i,/opentable\.com/i],p=(...e)=>{for(const t of e)if("string"==typeof t&&t.trim().length>0)return t},m=e=>{if(e)try{return new URL(e).hostname}catch{return}};e.buildWebsiteExtractorUrl=a,e.fetchWebsiteExtractor=l,e.useBoolean=function(e=!1){const[n,r]=t.useState(e),u=t.useCallback(()=>r(!0),[]),o=t.useCallback(()=>r(!1),[]),i=t.useCallback(()=>r(e=>!e),[]);return{value:n,setValue:r,setTrue:u,setFalse:o,toggle:i}},e.useCopyToClipboard=function(e={}){const n=e.resetDelay??2e3,r=t.useRef(null),[u,o]=t.useState(null),i=t.useMemo(()=>!("undefined"==typeof navigator||!navigator.clipboard)||"undefined"!=typeof document&&("function"==typeof document.queryCommandSupported&&document.queryCommandSupported("copy")),[]),s=t.useCallback(()=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{o(null)},n)},[n]),c=t.useCallback(async e=>{if(!i)return!1;const t="undefined"!=typeof navigator&&!!navigator.clipboard;try{if(t)await navigator.clipboard.writeText(e);else if("undefined"!=typeof document){const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.left="-9999px",t.style.top="0",document.body.appendChild(t),t.focus(),t.select();const n=document.execCommand("copy");if(document.body.removeChild(t),!n)return!1}return o(e),s(),!0}catch{return!1}},[i,s]);return t.useEffect(()=>()=>{r.current&&clearTimeout(r.current)},[]),{copy:c,copiedText:u,isSupported:i}},e.useDebounceCallback=r,e.useDebounceValue=u,e.useEventListener=o,e.useHover=function(e){const[n,r]=t.useState(!1),u=t.useCallback(()=>{r(!0)},[]),i=t.useCallback(()=>{r(!1)},[]);return o("pointerenter",u,e),o("pointerleave",i,e),n},e.useIsClient=i,e.useIsomorphicLayoutEffect=n,e.useLocalStorage=function(e,n,r={}){const{initializeWithValue:u=!0,serialize:o=JSON.stringify,deserialize:i=JSON.parse,listenToStorageChanges:s=!0}=r,c=t.useRef(n),a=t.useCallback(()=>{if("undefined"==typeof window)return c.current;if(!u)return c.current;try{const t=window.localStorage.getItem(e);return t?i(t):c.current}catch{return c.current}},[i,u,e]),[l,d]=t.useState(()=>a()),f=t.useCallback(t=>{d(n=>{const r="function"==typeof t?t(n):t;if("undefined"!=typeof window)try{window.localStorage.setItem(e,o(r))}catch{}return r})},[e,o]);return t.useEffect(()=>{d(a())},[a]),t.useEffect(()=>{if("undefined"==typeof window||!s)return;const t=t=>{if(t.key===e)if(null!==t.newValue)try{d(i(t.newValue))}catch{d(c.current)}else d(c.current)};return window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)},[i,e,s]),[l,f]},e.useMap=s,e.useMediaQuery=function(e,n={}){const[r,u]=t.useState(()=>"undefined"==typeof window||"function"!=typeof window.matchMedia?n.defaultValue??!1:window.matchMedia(e).matches);return t.useEffect(()=>{if("undefined"==typeof window||"function"!=typeof window.matchMedia)return;const t=window.matchMedia(e),n=e=>{u(e.matches)};return u(t.matches),t.addEventListener?(t.addEventListener("change",n),()=>t.removeEventListener("change",n)):(t.addListener(n),()=>t.removeListener(n))},[e]),r},e.useOnClickOutside=function(e,n,r="mousedown",u){const o=t.useRef(n);t.useEffect(()=>{o.current=n},[n]),t.useEffect(()=>{if("undefined"==typeof document)return;const t=Array.isArray(e)?e:[e],n=e=>{const n=e.target;if("undefined"==typeof Node||!(n instanceof Node))return;t.some(e=>{const t=e.current;return!!t&&t.contains(n)})||o.current(e)};return document.addEventListener(r,n,u),()=>{document.removeEventListener(r,n,u)}},[r,u,e])},e.useOpenGraphExtractor=function(e){const n=t.useMemo(()=>e.skipPatterns??f,[e.skipPatterns]),r=t.useCallback(e=>n.some(t=>t.test(e)),[n]),u=t.useCallback((e,t,n)=>{var r,u,o;const{openGraph:i,htmlInferred:s,hybridGraph:c}=e,a=p(null==i?void 0:i.description,null==c?void 0:c.description,null==s?void 0:s.description),l=p(null==i?void 0:i.title,null==c?void 0:c.title,null==s?void 0:s.title),d=p(null==i?void 0:i.site_name,null==c?void 0:c.site_name,null==s?void 0:s.site_name),f=p(null==c?void 0:c.favicon,null==s?void 0:s.favicon),v=p((null==(r=null==i?void 0:i.image)?void 0:r.url)??void 0,(null==c?void 0:c.image)??void 0,(null==s?void 0:s.image)??void 0,null==(u=null==s?void 0:s.images)?void 0:u[0]),y=p((null==(o=null==i?void 0:i.video)?void 0:o.url)??void 0,(null==c?void 0:c.video)??void 0),g=p(null==c?void 0:c.videoType,null==s?void 0:s.videoType),b=p(n.url,(null==i?void 0:i.url)??void 0,(null==c?void 0:c.url)??void 0,(null==s?void 0:s.url)??void 0,n.finalUrl,n.normalizedUrl,n.requestedUrl)??"";return{description:a,favicon:f,image:v,video:y,videoType:g,siteName:d,title:l,url:b,siteHost:m(b)}},[]);return d({endpoint:"open-graph",options:e,selectData:u,shouldSkip:r})},e.usePrevious=function(e){const n=t.useRef();return t.useEffect(()=>{n.current=e},[e]),n.current},e.useResizeObserver=function(e,r,u){const o=t.useRef(r),i=t.useRef(null),[s,c]=t.useState(null);return n(()=>{o.current=r},[r]),t.useEffect(()=>{if("undefined"==typeof ResizeObserver)return;const t="undefined"!=typeof Element&&e instanceof Element?e:(n=e)&&"object"==typeof n&&"current"in n?e.current:null;var n;if(!t)return;const r=new ResizeObserver(e=>{const t=e[0];i.current=t,o.current?o.current(t):c(t)});return r.observe(t,u),()=>r.disconnect()},[u,e]),o.current?i.current:s},e.useSessionStorage=function(e,n,r={}){const{initializeWithValue:u=!0,serialize:o=JSON.stringify,deserialize:i=JSON.parse,listenToStorageChanges:s=!1}=r,c=t.useRef(n),a=t.useCallback(()=>{if("undefined"==typeof window)return c.current;if(!u)return c.current;try{const t=window.sessionStorage.getItem(e);return t?i(t):c.current}catch{return c.current}},[i,u,e]),[l,d]=t.useState(()=>a()),f=t.useCallback(t=>{d(n=>{const r="function"==typeof t?t(n):t;if("undefined"!=typeof window)try{window.sessionStorage.setItem(e,o(r))}catch{}return r})},[e,o]);return t.useEffect(()=>{d(a())},[a]),t.useEffect(()=>{if("undefined"==typeof window||!s)return;const t=t=>{if(t.key===e)if(null!==t.newValue)try{d(i(t.newValue))}catch{d(c.current)}else d(c.current)};return window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)},[i,e,s]),[l,f]},e.useThrottle=function(e,n,r={}){const u=r.leading??!0,o=r.trailing??!0,i=Math.max(0,n),[s,c]=t.useState(e),a=t.useRef(0),l=t.useRef(null),d=t.useRef(null);return t.useEffect(()=>{if(0===i)return void c(e);const t=Date.now();if(0===a.current)return a.current=t,u?void c(e):void(o&&!l.current&&(d.current=e,l.current=setTimeout(()=>{l.current=null,null!==d.current&&(c(d.current),d.current=null,a.current=Date.now())},i)));const n=t-a.current;if(n>=i&&u)return c(e),a.current=t,void(d.current=null);if(o&&(d.current=e,!l.current)){const e=Math.max(i-n,0);l.current=setTimeout(()=>{l.current=null,null!==d.current&&(c(d.current),d.current=null,a.current=Date.now())},e)}},[u,o,e,i]),t.useEffect(()=>()=>{l.current&&clearTimeout(l.current)},[]),s},e.useWebsiteLinksExtractor=function(e){return d({endpoint:"links",options:e,selectData:t.useCallback(e=>({totalLinks:e.totalLinks??0,uniqueDomains:e.uniqueDomains??0,links:e.links??[]}),[])})},e.useWebsiteMetaExtractor=function(e){return d({endpoint:"meta",options:e,selectData:t.useCallback(e=>({title:e.title??void 0,description:e.description??void 0,language:e.language??void 0,canonicalUrl:e.canonicalUrl??void 0,feedUrl:e.feedUrl??null,textContentLength:e.textContentLength??void 0,metaTags:e.metaTags??{}}),[])})},e.useWebsiteRssExtractor=function(e){return d({endpoint:"rss",options:e,selectData:t.useCallback(e=>({feedUrl:e.feedUrl??null,feeds:e.feeds??[]}),[])})},e.useWebsiteSchemaExtractor=function(e){return d({endpoint:"schema",options:e,selectData:t.useCallback(e=>({schema:e.schema??[],schemaTypes:e.schemaTypes??[]}),[])})},Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
2
2
  //# sourceMappingURL=opensite-hooks.umd.js.map
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).OpensiteHooks={},e.React)}(this,function(e,t){"use strict";const n="undefined"!=typeof window?t.useLayoutEffect:t.useEffect;function r(e,r,u={}){const c=t.useRef(e),o=t.useRef(null),s=t.useRef(null),i=t.useRef(null),a=u.leading??!1,l=u.trailing??!0,f=u.maxWait,d=Math.max(0,r);n(()=>{c.current=e},[e]);const p=t.useCallback(()=>{o.current&&(clearTimeout(o.current),o.current=null),s.current&&(clearTimeout(s.current),s.current=null)},[]),m=t.useCallback(()=>{if(!i.current)return;const e=i.current;i.current=null,c.current(...e)},[]),y=t.useCallback((...e)=>{i.current=e;if(a&&null===o.current&&null===s.current&&m(),o.current&&clearTimeout(o.current),l&&(o.current=setTimeout(()=>{o.current=null,i.current&&m(),s.current&&(clearTimeout(s.current),s.current=null)},d)),null!=f&&l&&!s.current){const e=Math.max(0,f);s.current=setTimeout(()=>{s.current=null,o.current&&(clearTimeout(o.current),o.current=null),i.current&&m()},e)}},[m,a,l,f,d]),w=t.useCallback(()=>{p(),i.current=null},[p]),v=t.useCallback(()=>{i.current&&(p(),m())},[p,m]);return t.useEffect(()=>()=>w(),[w]),{debouncedCallback:y,cancel:w,flush:v}}function u(e,r,u,c){const o=t.useRef(r);n(()=>{o.current=r},[r]),t.useEffect(()=>{const t="undefined"!=typeof Window&&u instanceof Window,n="undefined"!=typeof Document&&u instanceof Document,r=void 0===u?"undefined"!=typeof window?window:null:t||n||"undefined"!=typeof HTMLElement&&u instanceof HTMLElement?u:(s=u)&&"object"==typeof s&&"current"in s?u.current:null;var s;if(!(null==r?void 0:r.addEventListener))return;const i=e=>{const t=o.current;"function"==typeof t?t(e):t.handleEvent(e)};return r.addEventListener(e,i,c),()=>{r.removeEventListener(e,i,c)}},[e,u,c])}e.useBoolean=function(e=!1){const[n,r]=t.useState(e),u=t.useCallback(()=>r(!0),[]),c=t.useCallback(()=>r(!1),[]),o=t.useCallback(()=>r(e=>!e),[]);return{value:n,setValue:r,setTrue:u,setFalse:c,toggle:o}},e.useCopyToClipboard=function(e={}){const n=e.resetDelay??2e3,r=t.useRef(null),[u,c]=t.useState(null),o=t.useMemo(()=>!("undefined"==typeof navigator||!navigator.clipboard)||"undefined"!=typeof document&&("function"==typeof document.queryCommandSupported&&document.queryCommandSupported("copy")),[]),s=t.useCallback(()=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{c(null)},n)},[n]),i=t.useCallback(async e=>{if(!o)return!1;const t="undefined"!=typeof navigator&&!!navigator.clipboard;try{if(t)await navigator.clipboard.writeText(e);else if("undefined"!=typeof document){const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.left="-9999px",t.style.top="0",document.body.appendChild(t),t.focus(),t.select();const n=document.execCommand("copy");if(document.body.removeChild(t),!n)return!1}return c(e),s(),!0}catch{return!1}},[o,s]);return t.useEffect(()=>()=>{r.current&&clearTimeout(r.current)},[]),{copy:i,copiedText:u,isSupported:o}},e.useDebounceCallback=r,e.useDebounceValue=function(e,n,u){const[c,o]=t.useState(e),{debouncedCallback:s,cancel:i}=r(e=>{o(e)},n,u);return t.useEffect(()=>{s(e)},[s,e]),t.useEffect(()=>()=>i(),[i]),c},e.useEventListener=u,e.useHover=function(e){const[n,r]=t.useState(!1),c=t.useCallback(()=>{r(!0)},[]),o=t.useCallback(()=>{r(!1)},[]);return u("pointerenter",c,e),u("pointerleave",o,e),n},e.useIsClient=function(){const[e,n]=t.useState(!1);return t.useEffect(()=>{n(!0)},[]),e},e.useIsomorphicLayoutEffect=n,e.useLocalStorage=function(e,n,r={}){const{initializeWithValue:u=!0,serialize:c=JSON.stringify,deserialize:o=JSON.parse,listenToStorageChanges:s=!0}=r,i=t.useRef(n),a=t.useCallback(()=>{if("undefined"==typeof window)return i.current;if(!u)return i.current;try{const t=window.localStorage.getItem(e);return t?o(t):i.current}catch{return i.current}},[o,u,e]),[l,f]=t.useState(()=>a()),d=t.useCallback(t=>{f(n=>{const r="function"==typeof t?t(n):t;if("undefined"!=typeof window)try{window.localStorage.setItem(e,c(r))}catch{}return r})},[e,c]);return t.useEffect(()=>{f(a())},[a]),t.useEffect(()=>{if("undefined"==typeof window||!s)return;const t=t=>{if(t.key===e)if(null!==t.newValue)try{f(o(t.newValue))}catch{f(i.current)}else f(i.current)};return window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)},[o,e,s]),[l,d]},e.useMap=function(e){const[n,r]=t.useState(()=>e instanceof Map||Array.isArray(e)?new Map(e):new Map),u=t.useRef(n);t.useEffect(()=>{u.current=n},[n]);const c=t.useMemo(()=>({set:(e,t)=>{r(n=>{const r=new Map(n);return r.set(e,t),r})},setAll:e=>{r((Map,new Map(e)))},remove:e=>{r(t=>{const n=new Map(t);return n.delete(e),n})},clear:()=>r(new Map),get:e=>u.current.get(e),has:e=>u.current.has(e)}),[]);return[n,c]},e.useMediaQuery=function(e,n={}){const[r,u]=t.useState(()=>"undefined"==typeof window||"function"!=typeof window.matchMedia?n.defaultValue??!1:window.matchMedia(e).matches);return t.useEffect(()=>{if("undefined"==typeof window||"function"!=typeof window.matchMedia)return;const t=window.matchMedia(e),n=e=>{u(e.matches)};return u(t.matches),t.addEventListener?(t.addEventListener("change",n),()=>t.removeEventListener("change",n)):(t.addListener(n),()=>t.removeListener(n))},[e]),r},e.useOnClickOutside=function(e,n,r="mousedown",u){const c=t.useRef(n);t.useEffect(()=>{c.current=n},[n]),t.useEffect(()=>{if("undefined"==typeof document)return;const t=Array.isArray(e)?e:[e],n=e=>{const n=e.target;if("undefined"==typeof Node||!(n instanceof Node))return;t.some(e=>{const t=e.current;return!!t&&t.contains(n)})||c.current(e)};return document.addEventListener(r,n,u),()=>{document.removeEventListener(r,n,u)}},[r,u,e])},e.usePrevious=function(e){const n=t.useRef();return t.useEffect(()=>{n.current=e},[e]),n.current},e.useResizeObserver=function(e,r,u){const c=t.useRef(r),o=t.useRef(null),[s,i]=t.useState(null);return n(()=>{c.current=r},[r]),t.useEffect(()=>{if("undefined"==typeof ResizeObserver)return;const t="undefined"!=typeof Element&&e instanceof Element?e:(n=e)&&"object"==typeof n&&"current"in n?e.current:null;var n;if(!t)return;const r=new ResizeObserver(e=>{const t=e[0];o.current=t,c.current?c.current(t):i(t)});return r.observe(t,u),()=>r.disconnect()},[u,e]),c.current?o.current:s},e.useSessionStorage=function(e,n,r={}){const{initializeWithValue:u=!0,serialize:c=JSON.stringify,deserialize:o=JSON.parse,listenToStorageChanges:s=!1}=r,i=t.useRef(n),a=t.useCallback(()=>{if("undefined"==typeof window)return i.current;if(!u)return i.current;try{const t=window.sessionStorage.getItem(e);return t?o(t):i.current}catch{return i.current}},[o,u,e]),[l,f]=t.useState(()=>a()),d=t.useCallback(t=>{f(n=>{const r="function"==typeof t?t(n):t;if("undefined"!=typeof window)try{window.sessionStorage.setItem(e,c(r))}catch{}return r})},[e,c]);return t.useEffect(()=>{f(a())},[a]),t.useEffect(()=>{if("undefined"==typeof window||!s)return;const t=t=>{if(t.key===e)if(null!==t.newValue)try{f(o(t.newValue))}catch{f(i.current)}else f(i.current)};return window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)},[o,e,s]),[l,d]},e.useThrottle=function(e,n,r={}){const u=r.leading??!0,c=r.trailing??!0,o=Math.max(0,n),[s,i]=t.useState(e),a=t.useRef(0),l=t.useRef(null),f=t.useRef(null);return t.useEffect(()=>{if(0===o)return void i(e);const t=Date.now();if(0===a.current)return a.current=t,u?void i(e):void(c&&!l.current&&(f.current=e,l.current=setTimeout(()=>{l.current=null,null!==f.current&&(i(f.current),f.current=null,a.current=Date.now())},o)));const n=t-a.current;if(n>=o&&u)return i(e),a.current=t,void(f.current=null);if(c&&(f.current=e,!l.current)){const e=Math.max(o-n,0);l.current=setTimeout(()=>{l.current=null,null!==f.current&&(i(f.current),f.current=null,a.current=Date.now())},e)}},[u,c,e,o]),t.useEffect(()=>()=>{l.current&&clearTimeout(l.current)},[]),s},Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).OpensiteHooks={},e.React)}(this,function(e,t){"use strict";const n="undefined"!=typeof window?t.useLayoutEffect:t.useEffect;function r(e,r,u={}){const o=t.useRef(e),i=t.useRef(null),s=t.useRef(null),c=t.useRef(null),a=u.leading??!1,l=u.trailing??!0,d=u.maxWait,f=Math.max(0,r);n(()=>{o.current=e},[e]);const p=t.useCallback(()=>{i.current&&(clearTimeout(i.current),i.current=null),s.current&&(clearTimeout(s.current),s.current=null)},[]),m=t.useCallback(()=>{if(!c.current)return;const e=c.current;c.current=null,o.current(...e)},[]),v=t.useCallback((...e)=>{c.current=e;if(a&&null===i.current&&null===s.current&&m(),i.current&&clearTimeout(i.current),l&&(i.current=setTimeout(()=>{i.current=null,c.current&&m(),s.current&&(clearTimeout(s.current),s.current=null)},f)),null!=d&&l&&!s.current){const e=Math.max(0,d);s.current=setTimeout(()=>{s.current=null,i.current&&(clearTimeout(i.current),i.current=null),c.current&&m()},e)}},[m,a,l,d,f]),y=t.useCallback(()=>{p(),c.current=null},[p]),g=t.useCallback(()=>{c.current&&(p(),m())},[p,m]);return t.useEffect(()=>()=>y(),[y]),{debouncedCallback:v,cancel:y,flush:g}}function u(e,n,u){const[o,i]=t.useState(e),{debouncedCallback:s,cancel:c}=r(e=>{i(e)},n,u);return t.useEffect(()=>{s(e)},[s,e]),t.useEffect(()=>()=>c(),[c]),o}function o(e,r,u,o){const i=t.useRef(r);n(()=>{i.current=r},[r]),t.useEffect(()=>{const t="undefined"!=typeof Window&&u instanceof Window,n="undefined"!=typeof Document&&u instanceof Document,r=void 0===u?"undefined"!=typeof window?window:null:t||n||"undefined"!=typeof HTMLElement&&u instanceof HTMLElement?u:(s=u)&&"object"==typeof s&&"current"in s?u.current:null;var s;if(!(null==r?void 0:r.addEventListener))return;const c=e=>{const t=i.current;"function"==typeof t?t(e):t.handleEvent(e)};return r.addEventListener(e,c,o),()=>{r.removeEventListener(e,c,o)}},[e,u,o])}function i(){const[e,n]=t.useState(!1);return t.useEffect(()=>{n(!0)},[]),e}function s(e){const[n,r]=t.useState(()=>e instanceof Map||Array.isArray(e)?new Map(e):new Map),u=t.useRef(n);t.useEffect(()=>{u.current=n},[n]);const o=t.useMemo(()=>({set:(e,t)=>{r(n=>{const r=new Map(n);return r.set(e,t),r})},setAll:e=>{r((Map,new Map(e)))},remove:e=>{r(t=>{const n=new Map(t);return n.delete(e),n})},clear:()=>r(new Map),get:e=>u.current.get(e),has:e=>u.current.has(e)}),[]);return[n,o]}const c="https://octane.buzz";function a(e){const t=function(e){return e.replace(/\/+$/,"")}(e.baseUrl??c),n=new URLSearchParams;return e.apiKey&&n.set("api_key",e.apiKey),n.set("url",e.url),`${t}/api/v1/extract/${e.endpoint}?${n.toString()}`}async function l(e){var t;if(!e.url||0===e.url.trim().length)return{ok:!1,error:{message:"URL is required."}};const n=a(e);try{const t=await fetch(n,{method:"GET",signal:e.signal});let r=null;try{r=await t.json()}catch{r=null}if(!t.ok){const e=r;return{ok:!1,error:{message:(null==e?void 0:e.error)??`Request failed with status ${t.status}.`,status:(null==e?void 0:e.status)??t.status,raw:r}}}return{ok:!0,response:r}}catch(r){return(null==(t=e.signal)?void 0:t.aborted)?{ok:!1,error:{message:"Request aborted."}}:{ok:!1,error:{message:r instanceof Error?r.message:"Request failed unexpectedly.",raw:r}}}}function d(e){const{endpoint:n,options:o,selectData:a,shouldSkip:d}=e,f=i(),[p,m]=t.useState({loading:!1}),[,v]=s(),y=o.cache??true,g=o.enabled??true,b=o.debounceMs??250,w=o.refreshDebounceMs??150,h=u(t.useMemo(()=>{var e;return(null==(e=o.url)?void 0:e.trim())??""},[o.url]),b),E=t.useRef(0),k=t.useRef(0),[C,T]=t.useState(0),{debouncedCallback:S,cancel:R}=r(()=>{E.current+=1,T(E.current)},w),M=t.useCallback(()=>{S()},[S]);t.useEffect(()=>()=>R(),[R]);const x=t.useMemo(()=>{if(!h)return"";const e=o.baseUrl??c,t=o.apiKey??"";return`${n}:${e}:${t}:${h}`},[n,o.apiKey,o.baseUrl,h]),L=t.useRef(null);return t.useEffect(()=>{var e;if(!f)return;if(!g||!h)return void m({loading:!1});if(null==d?void 0:d(h))return void m({loading:!1});const t=C!==k.current;if(t&&(k.current=C),y&&!t){const e=v.get(x);if(e)return void m({loading:!1,data:e.data,raw:e.raw,meta:e.meta})}null==(e=L.current)||e.abort();const r=new AbortController;return L.current=r,m(e=>({...e,loading:!0,error:void 0})),l({endpoint:n,url:h,apiKey:o.apiKey,baseUrl:o.baseUrl,signal:r.signal}).then(e=>{if(r.signal.aborted)return;if(!e.ok)return void m(t=>({...t,loading:!1,error:e.error}));const t=e.response,n=function(e){const{requestedUrl:t,finalUrl:n,url:r,normalizedUrl:u,status:o,contentType:i,fetchedAt:s,bodyBytes:c,bodyTruncated:a,maxBodyBytes:l,cache:d}=e;return{requestedUrl:t,finalUrl:n,url:r,normalizedUrl:u,status:o,contentType:i,fetchedAt:s,bodyBytes:c,bodyTruncated:a,maxBodyBytes:l,cache:d}}(t),u=function(e){const{requestedUrl:t,finalUrl:n,url:r,normalizedUrl:u,status:o,contentType:i,fetchedAt:s,bodyBytes:c,bodyTruncated:a,maxBodyBytes:l,cache:d,...f}=e;return f}(t),o=a(u,t,n);y&&v.set(x,{data:o,raw:t,meta:n}),m({loading:!1,data:o,raw:t,meta:n})}).catch(e=>{r.signal.aborted||m(t=>({...t,loading:!1,error:{message:e instanceof Error?e.message:"Request failed unexpectedly.",raw:e}}))}),()=>{r.abort()}},[v,y,h,g,n,f,o.apiKey,o.baseUrl,x,C,a,d]),t.useMemo(()=>({...p,refresh:M}),[M,p])}const f=[/search\.google\.com\/local\/reviews/i,/google\.com\/maps\/place/i,/maps\.google\.com/i,/opentable\.com/i],p=(...e)=>{for(const t of e)if("string"==typeof t&&t.trim().length>0)return t},m=e=>{if(e)try{return new URL(e).hostname}catch{return}};e.buildWebsiteExtractorUrl=a,e.fetchWebsiteExtractor=l,e.useBoolean=function(e=!1){const[n,r]=t.useState(e),u=t.useCallback(()=>r(!0),[]),o=t.useCallback(()=>r(!1),[]),i=t.useCallback(()=>r(e=>!e),[]);return{value:n,setValue:r,setTrue:u,setFalse:o,toggle:i}},e.useCopyToClipboard=function(e={}){const n=e.resetDelay??2e3,r=t.useRef(null),[u,o]=t.useState(null),i=t.useMemo(()=>!("undefined"==typeof navigator||!navigator.clipboard)||"undefined"!=typeof document&&("function"==typeof document.queryCommandSupported&&document.queryCommandSupported("copy")),[]),s=t.useCallback(()=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{o(null)},n)},[n]),c=t.useCallback(async e=>{if(!i)return!1;const t="undefined"!=typeof navigator&&!!navigator.clipboard;try{if(t)await navigator.clipboard.writeText(e);else if("undefined"!=typeof document){const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.left="-9999px",t.style.top="0",document.body.appendChild(t),t.focus(),t.select();const n=document.execCommand("copy");if(document.body.removeChild(t),!n)return!1}return o(e),s(),!0}catch{return!1}},[i,s]);return t.useEffect(()=>()=>{r.current&&clearTimeout(r.current)},[]),{copy:c,copiedText:u,isSupported:i}},e.useDebounceCallback=r,e.useDebounceValue=u,e.useEventListener=o,e.useHover=function(e){const[n,r]=t.useState(!1),u=t.useCallback(()=>{r(!0)},[]),i=t.useCallback(()=>{r(!1)},[]);return o("pointerenter",u,e),o("pointerleave",i,e),n},e.useIsClient=i,e.useIsomorphicLayoutEffect=n,e.useLocalStorage=function(e,n,r={}){const{initializeWithValue:u=!0,serialize:o=JSON.stringify,deserialize:i=JSON.parse,listenToStorageChanges:s=!0}=r,c=t.useRef(n),a=t.useCallback(()=>{if("undefined"==typeof window)return c.current;if(!u)return c.current;try{const t=window.localStorage.getItem(e);return t?i(t):c.current}catch{return c.current}},[i,u,e]),[l,d]=t.useState(()=>a()),f=t.useCallback(t=>{d(n=>{const r="function"==typeof t?t(n):t;if("undefined"!=typeof window)try{window.localStorage.setItem(e,o(r))}catch{}return r})},[e,o]);return t.useEffect(()=>{d(a())},[a]),t.useEffect(()=>{if("undefined"==typeof window||!s)return;const t=t=>{if(t.key===e)if(null!==t.newValue)try{d(i(t.newValue))}catch{d(c.current)}else d(c.current)};return window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)},[i,e,s]),[l,f]},e.useMap=s,e.useMediaQuery=function(e,n={}){const[r,u]=t.useState(()=>"undefined"==typeof window||"function"!=typeof window.matchMedia?n.defaultValue??!1:window.matchMedia(e).matches);return t.useEffect(()=>{if("undefined"==typeof window||"function"!=typeof window.matchMedia)return;const t=window.matchMedia(e),n=e=>{u(e.matches)};return u(t.matches),t.addEventListener?(t.addEventListener("change",n),()=>t.removeEventListener("change",n)):(t.addListener(n),()=>t.removeListener(n))},[e]),r},e.useOnClickOutside=function(e,n,r="mousedown",u){const o=t.useRef(n);t.useEffect(()=>{o.current=n},[n]),t.useEffect(()=>{if("undefined"==typeof document)return;const t=Array.isArray(e)?e:[e],n=e=>{const n=e.target;if("undefined"==typeof Node||!(n instanceof Node))return;t.some(e=>{const t=e.current;return!!t&&t.contains(n)})||o.current(e)};return document.addEventListener(r,n,u),()=>{document.removeEventListener(r,n,u)}},[r,u,e])},e.useOpenGraphExtractor=function(e){const n=t.useMemo(()=>e.skipPatterns??f,[e.skipPatterns]),r=t.useCallback(e=>n.some(t=>t.test(e)),[n]),u=t.useCallback((e,t,n)=>{var r,u,o;const{openGraph:i,htmlInferred:s,hybridGraph:c}=e,a=p(null==i?void 0:i.description,null==c?void 0:c.description,null==s?void 0:s.description),l=p(null==i?void 0:i.title,null==c?void 0:c.title,null==s?void 0:s.title),d=p(null==i?void 0:i.site_name,null==c?void 0:c.site_name,null==s?void 0:s.site_name),f=p(null==c?void 0:c.favicon,null==s?void 0:s.favicon),v=p((null==(r=null==i?void 0:i.image)?void 0:r.url)??void 0,(null==c?void 0:c.image)??void 0,(null==s?void 0:s.image)??void 0,null==(u=null==s?void 0:s.images)?void 0:u[0]),y=p((null==(o=null==i?void 0:i.video)?void 0:o.url)??void 0,(null==c?void 0:c.video)??void 0),g=p(null==c?void 0:c.videoType,null==s?void 0:s.videoType),b=p(n.url,(null==i?void 0:i.url)??void 0,(null==c?void 0:c.url)??void 0,(null==s?void 0:s.url)??void 0,n.finalUrl,n.normalizedUrl,n.requestedUrl)??"";return{description:a,favicon:f,image:v,video:y,videoType:g,siteName:d,title:l,url:b,siteHost:m(b)}},[]);return d({endpoint:"open-graph",options:e,selectData:u,shouldSkip:r})},e.usePrevious=function(e){const n=t.useRef();return t.useEffect(()=>{n.current=e},[e]),n.current},e.useResizeObserver=function(e,r,u){const o=t.useRef(r),i=t.useRef(null),[s,c]=t.useState(null);return n(()=>{o.current=r},[r]),t.useEffect(()=>{if("undefined"==typeof ResizeObserver)return;const t="undefined"!=typeof Element&&e instanceof Element?e:(n=e)&&"object"==typeof n&&"current"in n?e.current:null;var n;if(!t)return;const r=new ResizeObserver(e=>{const t=e[0];i.current=t,o.current?o.current(t):c(t)});return r.observe(t,u),()=>r.disconnect()},[u,e]),o.current?i.current:s},e.useSessionStorage=function(e,n,r={}){const{initializeWithValue:u=!0,serialize:o=JSON.stringify,deserialize:i=JSON.parse,listenToStorageChanges:s=!1}=r,c=t.useRef(n),a=t.useCallback(()=>{if("undefined"==typeof window)return c.current;if(!u)return c.current;try{const t=window.sessionStorage.getItem(e);return t?i(t):c.current}catch{return c.current}},[i,u,e]),[l,d]=t.useState(()=>a()),f=t.useCallback(t=>{d(n=>{const r="function"==typeof t?t(n):t;if("undefined"!=typeof window)try{window.sessionStorage.setItem(e,o(r))}catch{}return r})},[e,o]);return t.useEffect(()=>{d(a())},[a]),t.useEffect(()=>{if("undefined"==typeof window||!s)return;const t=t=>{if(t.key===e)if(null!==t.newValue)try{d(i(t.newValue))}catch{d(c.current)}else d(c.current)};return window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)},[i,e,s]),[l,f]},e.useThrottle=function(e,n,r={}){const u=r.leading??!0,o=r.trailing??!0,i=Math.max(0,n),[s,c]=t.useState(e),a=t.useRef(0),l=t.useRef(null),d=t.useRef(null);return t.useEffect(()=>{if(0===i)return void c(e);const t=Date.now();if(0===a.current)return a.current=t,u?void c(e):void(o&&!l.current&&(d.current=e,l.current=setTimeout(()=>{l.current=null,null!==d.current&&(c(d.current),d.current=null,a.current=Date.now())},i)));const n=t-a.current;if(n>=i&&u)return c(e),a.current=t,void(d.current=null);if(o&&(d.current=e,!l.current)){const e=Math.max(i-n,0);l.current=setTimeout(()=>{l.current=null,null!==d.current&&(c(d.current),d.current=null,a.current=Date.now())},e)}},[u,o,e,i]),t.useEffect(()=>()=>{l.current&&clearTimeout(l.current)},[]),s},e.useWebsiteLinksExtractor=function(e){return d({endpoint:"links",options:e,selectData:t.useCallback(e=>({totalLinks:e.totalLinks??0,uniqueDomains:e.uniqueDomains??0,links:e.links??[]}),[])})},e.useWebsiteMetaExtractor=function(e){return d({endpoint:"meta",options:e,selectData:t.useCallback(e=>({title:e.title??void 0,description:e.description??void 0,language:e.language??void 0,canonicalUrl:e.canonicalUrl??void 0,feedUrl:e.feedUrl??null,textContentLength:e.textContentLength??void 0,metaTags:e.metaTags??{}}),[])})},e.useWebsiteRssExtractor=function(e){return d({endpoint:"rss",options:e,selectData:t.useCallback(e=>({feedUrl:e.feedUrl??null,feeds:e.feeds??[]}),[])})},e.useWebsiteSchemaExtractor=function(e){return d({endpoint:"schema",options:e,selectData:t.useCallback(e=>({schema:e.schema??[],schemaTypes:e.schemaTypes??[]}),[])})},Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
2
2
  //# sourceMappingURL=opensite-hooks.umd.js.map