@siberiacancode/reactuse 0.0.53 → 0.0.55

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 (234) hide show
  1. package/dist/cjs/{_rollupPluginBabelHelpers-D4KMnNuQ.js → _rollupPluginBabelHelpers-BteBusnh.js} +2 -2
  2. package/dist/cjs/_rollupPluginBabelHelpers-BteBusnh.js.map +1 -0
  3. package/dist/cjs/hooks/index.js +2 -2
  4. package/dist/cjs/hooks/useAsync/useAsync.js +3 -0
  5. package/dist/cjs/hooks/useAsync/useAsync.js.map +1 -0
  6. package/dist/cjs/hooks/useBattery/useBattery.js +2 -2
  7. package/dist/cjs/hooks/useBoolean/useBoolean.js +2 -2
  8. package/dist/cjs/hooks/useBreakpoints/constants/breakpoints.js +1 -1
  9. package/dist/cjs/hooks/useBreakpoints/useBreakpoints.js +2 -2
  10. package/dist/cjs/hooks/useBrowserLanguage/useBrowserLanguage.js +1 -1
  11. package/dist/cjs/hooks/useClickOutside/useClickOutside.js +2 -2
  12. package/dist/cjs/hooks/useClipboard/useClipboard.js +2 -2
  13. package/dist/cjs/hooks/useCounter/useCounter.js +2 -2
  14. package/dist/cjs/hooks/useCounter/useCounter.js.map +1 -1
  15. package/dist/cjs/hooks/useDebounceCallback/useDebounceCallback.js +1 -1
  16. package/dist/cjs/hooks/useDebounceValue/useDebounceValue.js +2 -2
  17. package/dist/cjs/hooks/useDefault/useDefault.js +2 -2
  18. package/dist/cjs/hooks/useDidUpdate/useDidUpdate.js +1 -1
  19. package/dist/cjs/hooks/useDisclosure/useDisclosure.js +2 -2
  20. package/dist/cjs/hooks/useDocumentEvent/useDocumentEvent.js +1 -1
  21. package/dist/cjs/hooks/useDocumentTitle/useDocumentTitle.js +2 -2
  22. package/dist/cjs/hooks/useDocumentVisibility/useDocumentVisibility.js +1 -1
  23. package/dist/cjs/hooks/useEvent/useEvent.js +1 -1
  24. package/dist/cjs/hooks/useEventListener/useEventListener.js +1 -1
  25. package/dist/cjs/hooks/useEyeDropper/useEyeDropper.js +2 -2
  26. package/dist/cjs/hooks/useFavicon/useFavicon.js +2 -2
  27. package/dist/cjs/hooks/useField/useField.js +2 -2
  28. package/dist/cjs/hooks/useFileDialog/useFileDialog.js +2 -2
  29. package/dist/cjs/hooks/useFps/useFps.js +2 -2
  30. package/dist/cjs/hooks/useFullscreen/useFullscreen.js +2 -2
  31. package/dist/cjs/hooks/useGeolocation/useGeolocation.js +2 -2
  32. package/dist/cjs/hooks/useHash/useHash.js +2 -2
  33. package/dist/cjs/hooks/useHotkeys/useHotkeys.js +2 -2
  34. package/dist/cjs/hooks/useHotkeys/useHotkeys.js.map +1 -1
  35. package/dist/cjs/hooks/useHover/useHover.js +2 -2
  36. package/dist/cjs/hooks/useIdle/useIdle.js +2 -2
  37. package/dist/cjs/hooks/useImage/useImage.js +2 -2
  38. package/dist/cjs/hooks/useInfiniteScroll/useInfiniteScroll.js +2 -2
  39. package/dist/cjs/hooks/useIntersectionObserver/useIntersectionObserver.js +2 -2
  40. package/dist/cjs/hooks/useInterval/useInterval.js +2 -2
  41. package/dist/cjs/hooks/useIsFirstRender/useIsFirstRender.js +1 -1
  42. package/dist/cjs/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js +1 -1
  43. package/dist/cjs/hooks/useKeyPress/useKeyPress.js +2 -2
  44. package/dist/cjs/hooks/useKeyPressEvent/useKeyPressEvent.js +1 -1
  45. package/dist/cjs/hooks/useKeyboard/useKeyboard.js +1 -1
  46. package/dist/cjs/hooks/useKeysPressed/useKeysPressed.js +2 -2
  47. package/dist/cjs/hooks/useKeysPressed/useKeysPressed.js.map +1 -1
  48. package/dist/cjs/hooks/useList/useList.js +2 -2
  49. package/dist/cjs/hooks/useLocalStorage/useLocalStorage.js +2 -2
  50. package/dist/cjs/hooks/useLocalStorage/useLocalStorage.js.map +1 -1
  51. package/dist/cjs/hooks/useLogger/useLogger.js +2 -2
  52. package/dist/cjs/hooks/useLongPress/useLongPress.js +2 -2
  53. package/dist/cjs/hooks/useMap/useMap.js +2 -2
  54. package/dist/cjs/hooks/useMeasure/useMeasure.js +2 -2
  55. package/dist/cjs/hooks/useMediaQuery/useMediaQuery.js +1 -1
  56. package/dist/cjs/hooks/useMemory/useMemory.js +2 -2
  57. package/dist/cjs/hooks/useMount/useMount.js +1 -1
  58. package/dist/cjs/hooks/useMouse/useMouse.js +2 -2
  59. package/dist/cjs/hooks/useMutation/useMutation.js +2 -2
  60. package/dist/cjs/hooks/useMutation/useMutation.js.map +1 -1
  61. package/dist/cjs/hooks/useMutationObserver.js +1 -1
  62. package/dist/cjs/hooks/useNetwork/useNetwork.js +2 -2
  63. package/dist/cjs/hooks/useOnline/useOnline.js +1 -1
  64. package/dist/cjs/hooks/useOperatingSystem/useOperatingSystem.js +1 -1
  65. package/dist/cjs/hooks/useOrientation/useOrientation.js +2 -2
  66. package/dist/cjs/hooks/usePageLeave/usePageLeave.js +2 -2
  67. package/dist/cjs/hooks/usePaint/helpers/Paint.js +2 -2
  68. package/dist/cjs/hooks/usePaint/helpers/Pointer.js +2 -2
  69. package/dist/cjs/hooks/usePaint/usePaint.js +2 -2
  70. package/dist/cjs/hooks/usePermission/usePermission.js +2 -2
  71. package/dist/cjs/hooks/usePreferredColorScheme/usePreferredColorScheme.js +1 -1
  72. package/dist/cjs/hooks/usePreferredContrast/usePreferredContrast.js +1 -1
  73. package/dist/cjs/hooks/usePreferredDark/usePreferredDark.js +1 -1
  74. package/dist/cjs/hooks/usePreferredLanguages/usePreferredLanguages.js +1 -1
  75. package/dist/cjs/hooks/usePreferredReducedMotion/usePreferredReducedMotion.js +1 -1
  76. package/dist/cjs/hooks/usePrevious/usePrevious.js +1 -1
  77. package/dist/cjs/hooks/useQuery/useQuery.js +2 -2
  78. package/dist/cjs/hooks/useQuery/useQuery.js.map +1 -1
  79. package/dist/cjs/hooks/useQueue/useQueue.js +2 -2
  80. package/dist/cjs/hooks/useRenderCount/useRenderCount.js +1 -1
  81. package/dist/cjs/hooks/useRenderInfo/useRenderInfo.js +1 -1
  82. package/dist/cjs/hooks/useRerender/useRerender.js +2 -2
  83. package/dist/cjs/hooks/useResizeObserver/useResizeObserver.js +2 -2
  84. package/dist/cjs/hooks/useScript/useScript.js +2 -2
  85. package/dist/cjs/hooks/useSessionStorage/useSessionStorage.js +2 -2
  86. package/dist/cjs/hooks/useSessionStorage/useSessionStorage.js.map +1 -1
  87. package/dist/cjs/hooks/useSet/useSet.js +2 -2
  88. package/dist/cjs/hooks/useShare/useShare.js +2 -2
  89. package/dist/cjs/hooks/useStep/useStep.js +2 -2
  90. package/dist/cjs/hooks/useStopwatch/useStopwatch.js +2 -2
  91. package/dist/cjs/hooks/useStopwatch/useStopwatch.js.map +1 -1
  92. package/dist/cjs/hooks/useStorage/useStorage.js +2 -2
  93. package/dist/cjs/hooks/useStorage/useStorage.js.map +1 -1
  94. package/dist/cjs/hooks/useTextSelection/useTextSelection.js +2 -2
  95. package/dist/cjs/hooks/useTime/useTime.js +2 -2
  96. package/dist/cjs/hooks/useTimeout/useTimeout.js +2 -2
  97. package/dist/cjs/hooks/useToggle/useToggle.js +2 -2
  98. package/dist/cjs/hooks/useUnmount/useUnmount.js +1 -1
  99. package/dist/cjs/hooks/useWebSocket/useWebSocket.js +2 -2
  100. package/dist/cjs/hooks/useWindowEvent/useWindowEvent.js +1 -1
  101. package/dist/cjs/hooks/useWindowScroll/useWindowScroll.js +2 -2
  102. package/dist/cjs/hooks/useWindowSize/useWindowSize.js +2 -2
  103. package/dist/cjs/hooks/useWizard/useWizard.js +2 -2
  104. package/dist/cjs/{index-DWXq2in2.js → index-96gzcInk.js} +2 -2
  105. package/dist/cjs/{index-DWXq2in2.js.map → index-96gzcInk.js.map} +1 -1
  106. package/dist/cjs/index.js +2 -2
  107. package/dist/cjs/utils/helpers/debounce.js +1 -1
  108. package/dist/cjs/utils/helpers/getRetry.js +1 -1
  109. package/dist/cjs/utils/helpers/getRetry.js.map +1 -1
  110. package/dist/cjs/utils/helpers/index.js +1 -1
  111. package/dist/cjs/utils/helpers/isClient.js +1 -1
  112. package/dist/cjs/utils/helpers/isPermissionAllowed.js +1 -1
  113. package/dist/cjs/utils/helpers/throttle.js +1 -1
  114. package/dist/cjs/utils/helpers/time/getDate.js +1 -1
  115. package/dist/cjs/utils/types/index.js +1 -1
  116. package/dist/esm/{_rollupPluginBabelHelpers-CIuCCT6y.js → _rollupPluginBabelHelpers--yEi7JQy.js} +2 -2
  117. package/dist/esm/_rollupPluginBabelHelpers--yEi7JQy.js.map +1 -0
  118. package/dist/esm/hooks/index.js +2 -2
  119. package/dist/esm/hooks/useAsync/useAsync.js +3 -0
  120. package/dist/esm/hooks/useAsync/useAsync.js.map +1 -0
  121. package/dist/esm/hooks/useBattery/useBattery.js +2 -2
  122. package/dist/esm/hooks/useBoolean/useBoolean.js +2 -2
  123. package/dist/esm/hooks/useBreakpoints/constants/breakpoints.js +1 -1
  124. package/dist/esm/hooks/useBreakpoints/useBreakpoints.js +2 -2
  125. package/dist/esm/hooks/useBrowserLanguage/useBrowserLanguage.js +1 -1
  126. package/dist/esm/hooks/useClickOutside/useClickOutside.js +2 -2
  127. package/dist/esm/hooks/useClipboard/useClipboard.js +2 -2
  128. package/dist/esm/hooks/useCounter/useCounter.js +2 -2
  129. package/dist/esm/hooks/useCounter/useCounter.js.map +1 -1
  130. package/dist/esm/hooks/useDebounceCallback/useDebounceCallback.js +1 -1
  131. package/dist/esm/hooks/useDebounceValue/useDebounceValue.js +2 -2
  132. package/dist/esm/hooks/useDefault/useDefault.js +2 -2
  133. package/dist/esm/hooks/useDidUpdate/useDidUpdate.js +1 -1
  134. package/dist/esm/hooks/useDisclosure/useDisclosure.js +2 -2
  135. package/dist/esm/hooks/useDocumentEvent/useDocumentEvent.js +1 -1
  136. package/dist/esm/hooks/useDocumentTitle/useDocumentTitle.js +2 -2
  137. package/dist/esm/hooks/useDocumentVisibility/useDocumentVisibility.js +1 -1
  138. package/dist/esm/hooks/useEvent/useEvent.js +1 -1
  139. package/dist/esm/hooks/useEventListener/useEventListener.js +1 -1
  140. package/dist/esm/hooks/useEyeDropper/useEyeDropper.js +2 -2
  141. package/dist/esm/hooks/useFavicon/useFavicon.js +2 -2
  142. package/dist/esm/hooks/useField/useField.js +2 -2
  143. package/dist/esm/hooks/useFileDialog/useFileDialog.js +2 -2
  144. package/dist/esm/hooks/useFps/useFps.js +2 -2
  145. package/dist/esm/hooks/useFullscreen/useFullscreen.js +2 -2
  146. package/dist/esm/hooks/useGeolocation/useGeolocation.js +2 -2
  147. package/dist/esm/hooks/useHash/useHash.js +2 -2
  148. package/dist/esm/hooks/useHotkeys/useHotkeys.js +2 -2
  149. package/dist/esm/hooks/useHotkeys/useHotkeys.js.map +1 -1
  150. package/dist/esm/hooks/useHover/useHover.js +2 -2
  151. package/dist/esm/hooks/useIdle/useIdle.js +2 -2
  152. package/dist/esm/hooks/useImage/useImage.js +2 -2
  153. package/dist/esm/hooks/useInfiniteScroll/useInfiniteScroll.js +2 -2
  154. package/dist/esm/hooks/useIntersectionObserver/useIntersectionObserver.js +2 -2
  155. package/dist/esm/hooks/useInterval/useInterval.js +2 -2
  156. package/dist/esm/hooks/useIsFirstRender/useIsFirstRender.js +1 -1
  157. package/dist/esm/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js +1 -1
  158. package/dist/esm/hooks/useKeyPress/useKeyPress.js +2 -2
  159. package/dist/esm/hooks/useKeyPressEvent/useKeyPressEvent.js +1 -1
  160. package/dist/esm/hooks/useKeyboard/useKeyboard.js +1 -1
  161. package/dist/esm/hooks/useKeysPressed/useKeysPressed.js +2 -2
  162. package/dist/esm/hooks/useKeysPressed/useKeysPressed.js.map +1 -1
  163. package/dist/esm/hooks/useList/useList.js +2 -2
  164. package/dist/esm/hooks/useLocalStorage/useLocalStorage.js +2 -2
  165. package/dist/esm/hooks/useLocalStorage/useLocalStorage.js.map +1 -1
  166. package/dist/esm/hooks/useLogger/useLogger.js +2 -2
  167. package/dist/esm/hooks/useLongPress/useLongPress.js +2 -2
  168. package/dist/esm/hooks/useMap/useMap.js +2 -2
  169. package/dist/esm/hooks/useMeasure/useMeasure.js +2 -2
  170. package/dist/esm/hooks/useMediaQuery/useMediaQuery.js +1 -1
  171. package/dist/esm/hooks/useMemory/useMemory.js +2 -2
  172. package/dist/esm/hooks/useMount/useMount.js +1 -1
  173. package/dist/esm/hooks/useMouse/useMouse.js +2 -2
  174. package/dist/esm/hooks/useMutation/useMutation.js +2 -2
  175. package/dist/esm/hooks/useMutation/useMutation.js.map +1 -1
  176. package/dist/esm/hooks/useMutationObserver.js +1 -1
  177. package/dist/esm/hooks/useNetwork/useNetwork.js +2 -2
  178. package/dist/esm/hooks/useOnline/useOnline.js +1 -1
  179. package/dist/esm/hooks/useOperatingSystem/useOperatingSystem.js +1 -1
  180. package/dist/esm/hooks/useOrientation/useOrientation.js +2 -2
  181. package/dist/esm/hooks/usePageLeave/usePageLeave.js +2 -2
  182. package/dist/esm/hooks/usePaint/helpers/Paint.js +2 -2
  183. package/dist/esm/hooks/usePaint/helpers/Pointer.js +2 -2
  184. package/dist/esm/hooks/usePaint/usePaint.js +2 -2
  185. package/dist/esm/hooks/usePermission/usePermission.js +2 -2
  186. package/dist/esm/hooks/usePreferredColorScheme/usePreferredColorScheme.js +1 -1
  187. package/dist/esm/hooks/usePreferredContrast/usePreferredContrast.js +1 -1
  188. package/dist/esm/hooks/usePreferredDark/usePreferredDark.js +1 -1
  189. package/dist/esm/hooks/usePreferredLanguages/usePreferredLanguages.js +1 -1
  190. package/dist/esm/hooks/usePreferredReducedMotion/usePreferredReducedMotion.js +1 -1
  191. package/dist/esm/hooks/usePrevious/usePrevious.js +1 -1
  192. package/dist/esm/hooks/useQuery/useQuery.js +2 -2
  193. package/dist/esm/hooks/useQuery/useQuery.js.map +1 -1
  194. package/dist/esm/hooks/useQueue/useQueue.js +2 -2
  195. package/dist/esm/hooks/useRenderCount/useRenderCount.js +1 -1
  196. package/dist/esm/hooks/useRenderInfo/useRenderInfo.js +1 -1
  197. package/dist/esm/hooks/useRerender/useRerender.js +2 -2
  198. package/dist/esm/hooks/useResizeObserver/useResizeObserver.js +2 -2
  199. package/dist/esm/hooks/useScript/useScript.js +2 -2
  200. package/dist/esm/hooks/useSessionStorage/useSessionStorage.js +2 -2
  201. package/dist/esm/hooks/useSessionStorage/useSessionStorage.js.map +1 -1
  202. package/dist/esm/hooks/useSet/useSet.js +2 -2
  203. package/dist/esm/hooks/useShare/useShare.js +2 -2
  204. package/dist/esm/hooks/useStep/useStep.js +2 -2
  205. package/dist/esm/hooks/useStopwatch/useStopwatch.js +2 -2
  206. package/dist/esm/hooks/useStopwatch/useStopwatch.js.map +1 -1
  207. package/dist/esm/hooks/useStorage/useStorage.js +2 -2
  208. package/dist/esm/hooks/useStorage/useStorage.js.map +1 -1
  209. package/dist/esm/hooks/useTextSelection/useTextSelection.js +2 -2
  210. package/dist/esm/hooks/useTime/useTime.js +2 -2
  211. package/dist/esm/hooks/useTimeout/useTimeout.js +2 -2
  212. package/dist/esm/hooks/useToggle/useToggle.js +2 -2
  213. package/dist/esm/hooks/useUnmount/useUnmount.js +1 -1
  214. package/dist/esm/hooks/useWebSocket/useWebSocket.js +2 -2
  215. package/dist/esm/hooks/useWindowEvent/useWindowEvent.js +1 -1
  216. package/dist/esm/hooks/useWindowScroll/useWindowScroll.js +2 -2
  217. package/dist/esm/hooks/useWindowSize/useWindowSize.js +2 -2
  218. package/dist/esm/hooks/useWizard/useWizard.js +2 -2
  219. package/dist/esm/{index-ngJHDSj5.js → index-5OKmysyE.js} +2 -2
  220. package/dist/esm/{index-ngJHDSj5.js.map → index-5OKmysyE.js.map} +1 -1
  221. package/dist/esm/index.js +2 -2
  222. package/dist/esm/utils/helpers/debounce.js +1 -1
  223. package/dist/esm/utils/helpers/getRetry.js +1 -1
  224. package/dist/esm/utils/helpers/getRetry.js.map +1 -1
  225. package/dist/esm/utils/helpers/index.js +1 -1
  226. package/dist/esm/utils/helpers/isClient.js +1 -1
  227. package/dist/esm/utils/helpers/isPermissionAllowed.js +1 -1
  228. package/dist/esm/utils/helpers/throttle.js +1 -1
  229. package/dist/esm/utils/helpers/time/getDate.js +1 -1
  230. package/dist/esm/utils/types/index.js +1 -1
  231. package/dist/index.d.ts +63 -13
  232. package/package.json +1 -1
  233. package/dist/cjs/_rollupPluginBabelHelpers-D4KMnNuQ.js.map +0 -1
  234. package/dist/esm/_rollupPluginBabelHelpers-CIuCCT6y.js.map +0 -1
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.53 */
1
+ /* @license @siberiacancode/reactuse v0.0.55 */
2
2
  import{useRef as r,useEffect as n}from"react";function t(t,e,u){var c=r(),o=r(null);return n((function(){var r="function"==typeof u?u():u;return(r||o.current)&&(c.current=new MutationObserver(t),c.current.observe(r||o.current,e)),function(){var r;null===(r=c.current)||void 0===r||r.disconnect()}}),[t,e]),o}export{t as useMutationObserver};
3
3
  //# sourceMappingURL=useMutationObserver.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.53 */
2
- import{_ as n}from"../../_rollupPluginBabelHelpers-CIuCCT6y.js";import{useState as e,useEffect as i}from"react";import{isClient as o}from"../../utils/helpers/isClient.js";var t=function(){var n,e,i;return(null===(n=navigator)||void 0===n?void 0:n.connection)||(null===(e=navigator)||void 0===e?void 0:e.mozConnection)||(null===(i=navigator)||void 0===i?void 0:i.webkitConnection)},l=function(){var l=e((function(){if(!o)return{online:!1,type:void 0,effectiveType:void 0,saveData:!1,downlink:0,downlinkMax:0,rtt:0};var n=navigator.onLine,e=t();return{online:n,downlink:null==e?void 0:e.downlink,downlinkMax:null==e?void 0:e.downlinkMax,effectiveType:null==e?void 0:e.effectiveType,rtt:null==e?void 0:e.rtt,saveData:null==e?void 0:e.saveData,type:null==e?void 0:e.type}})),v=n(l,2),a=v[0],r=v[1];return i((function(){var n=function(){var n=navigator.onLine,e=t();r({online:n,downlink:null==e?void 0:e.downlink,downlinkMax:null==e?void 0:e.downlinkMax,effectiveType:null==e?void 0:e.effectiveType,rtt:null==e?void 0:e.rtt,saveData:null==e?void 0:e.saveData,type:null==e?void 0:e.type})};window.addEventListener("online",n,{passive:!0}),window.addEventListener("offline",n,{passive:!0});var e=t();return e&&e.addEventListener("change",n,{passive:!0}),function(){window.removeEventListener("online",n),window.removeEventListener("offline",n),e&&e.removeEventListener("change",n)}})),a};export{t as getConnection,l as useNetwork};
1
+ /* @license @siberiacancode/reactuse v0.0.55 */
2
+ import{_ as n}from"../../_rollupPluginBabelHelpers--yEi7JQy.js";import{useState as e,useEffect as i}from"react";import{isClient as o}from"../../utils/helpers/isClient.js";var t=function(){var n,e,i;return(null===(n=navigator)||void 0===n?void 0:n.connection)||(null===(e=navigator)||void 0===e?void 0:e.mozConnection)||(null===(i=navigator)||void 0===i?void 0:i.webkitConnection)},l=function(){var l=e((function(){if(!o)return{online:!1,type:void 0,effectiveType:void 0,saveData:!1,downlink:0,downlinkMax:0,rtt:0};var n=navigator.onLine,e=t();return{online:n,downlink:null==e?void 0:e.downlink,downlinkMax:null==e?void 0:e.downlinkMax,effectiveType:null==e?void 0:e.effectiveType,rtt:null==e?void 0:e.rtt,saveData:null==e?void 0:e.saveData,type:null==e?void 0:e.type}})),v=n(l,2),a=v[0],r=v[1];return i((function(){var n=function(){var n=navigator.onLine,e=t();r({online:n,downlink:null==e?void 0:e.downlink,downlinkMax:null==e?void 0:e.downlinkMax,effectiveType:null==e?void 0:e.effectiveType,rtt:null==e?void 0:e.rtt,saveData:null==e?void 0:e.saveData,type:null==e?void 0:e.type})};window.addEventListener("online",n,{passive:!0}),window.addEventListener("offline",n,{passive:!0});var e=t();return e&&e.addEventListener("change",n,{passive:!0}),function(){window.removeEventListener("online",n),window.removeEventListener("offline",n),e&&e.removeEventListener("change",n)}})),a};export{t as getConnection,l as useNetwork};
3
3
  //# sourceMappingURL=useNetwork.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.53 */
1
+ /* @license @siberiacancode/reactuse v0.0.55 */
2
2
  import{useSyncExternalStore as n}from"react";var e=function(){return navigator.onLine},t=function(){return!1},i=function(n){return window.addEventListener("online",n),window.addEventListener("offline",n),function(){window.removeEventListener("online",n),window.removeEventListener("offline",n)}},o=function(){return n(i,e,t)};export{o as useOnline};
3
3
  //# sourceMappingURL=useOnline.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.53 */
1
+ /* @license @siberiacancode/reactuse v0.0.55 */
2
2
  import{useRef as n}from"react";var i=function(){if("undefined"==typeof window)return"undetermined";var n=window.navigator.userAgent;return/(Macintosh)|(MacIntel)|(MacPPC)|(Mac68K)/i.test(n)?"macos":/(iPhone)|(iPad)|(iPod)/i.test(n)?"ios":/(Win32)|(Win64)|(Windows)|(WinCE)/i.test(n)?"windows":/Android/i.test(n)?"android":/Linux/i.test(n)?"linux":"undetermined"},t=function(){return n(i()).current};export{i as getOperatingSystem,t as useOperatingSystem};
3
3
  //# sourceMappingURL=useOperatingSystem.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.53 */
2
- import{_ as e}from"../../_rollupPluginBabelHelpers-CIuCCT6y.js";import{useState as n}from"react";import{useIsomorphicLayoutEffect as r}from"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../../utils/helpers/isClient.js";var o=function(){var o=n({angle:0,type:"landscape-primary"}),t=e(o,2),i=t[0],a=t[1];return r((function(){var e,n=function(){var e=window.screen.orientation,n=e.angle,r=e.type;a({angle:n,type:r})};return null===(e=window.screen.orientation)||void 0===e||e.addEventListener("change",n),function(){var e;return null===(e=window.screen.orientation)||void 0===e?void 0:e.removeEventListener("change",n)}}),[]),i};export{o as useOrientation};
1
+ /* @license @siberiacancode/reactuse v0.0.55 */
2
+ import{_ as e}from"../../_rollupPluginBabelHelpers--yEi7JQy.js";import{useState as n}from"react";import{useIsomorphicLayoutEffect as r}from"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";import"../../utils/helpers/isClient.js";var o=function(){var o=n({angle:0,type:"landscape-primary"}),t=e(o,2),i=t[0],a=t[1];return r((function(){var e,n=function(){var e=window.screen.orientation,n=e.angle,r=e.type;a({angle:n,type:r})};return null===(e=window.screen.orientation)||void 0===e||e.addEventListener("change",n),function(){var e;return null===(e=window.screen.orientation)||void 0===e?void 0:e.removeEventListener("change",n)}}),[]),i};export{o as useOrientation};
3
3
  //# sourceMappingURL=useOrientation.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.53 */
2
- import{_ as e}from"../../_rollupPluginBabelHelpers-CIuCCT6y.js";import{useState as n,useEffect as t}from"react";import{useEvent as r}from"../useEvent/useEvent.js";var o=function(o){var u=n(!1),s=e(u,2),m=s[0],i=s[1],v=r((function(){if(m)return i(!1);null==o||o(),i(!0)}));return t((function(){return document.addEventListener("mouseleave",v,{passive:!0}),document.addEventListener("mouseenter",v,{passive:!0}),function(){document.removeEventListener("mouseenter",v),document.removeEventListener("mouseleave",v)}}),[]),m};export{o as usePageLeave};
1
+ /* @license @siberiacancode/reactuse v0.0.55 */
2
+ import{_ as e}from"../../_rollupPluginBabelHelpers--yEi7JQy.js";import{useState as n,useEffect as t}from"react";import{useEvent as r}from"../useEvent/useEvent.js";var o=function(o){var u=n(!1),s=e(u,2),m=s[0],i=s[1],v=r((function(){if(m)return i(!1);null==o||o(),i(!0)}));return t((function(){return document.addEventListener("mouseleave",v,{passive:!0}),document.addEventListener("mouseenter",v,{passive:!0}),function(){document.removeEventListener("mouseenter",v),document.removeEventListener("mouseleave",v)}}),[]),m};export{o as usePageLeave};
3
3
  //# sourceMappingURL=usePageLeave.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.53 */
2
- import{g as t,h as s,i}from"../../../_rollupPluginBabelHelpers-CIuCCT6y.js";import{Pointer as r}from"./Pointer.js";var h=function(){return t((function t(h){var e=h.x,o=h.y,n=h.radius,u=h.smooth;s(this,t),i(this,"smooth",!1),i(this,"points",[]),i(this,"lines",[]),this.smooth=u,this.pointer=new r(e,o),this.brush=new r(e,o),this.radius=n,this.points=[],this.lines=[]}),[{key:"getBrushCoordinates",value:function(){return{x:this.brush.x,y:this.brush.y}}},{key:"getPointerCoordinates",value:function(){return{x:this.pointer.x,y:this.pointer.y}}},{key:"update",value:function(t){if(this.pointer.equalsTo(t))return!1;if(this.pointer.update(t),!this.smooth)return this.brush.update(t),this.points.push(this.getBrushCoordinates()),!0;var s=this.pointer.getDistanceTo(this.brush),i=this.pointer.getAngleTo(this.brush);if(Math.round(10*(s-this.radius))/10>0){var r=i+Math.PI/2;return this.brush.update({x:this.brush.x+Math.sin(r)*(s-this.radius),y:this.brush.y-Math.cos(r)*(s-this.radius)}),this.points.push(this.getBrushCoordinates()),!0}return!1}}])}();export{h as Paint};
1
+ /* @license @siberiacancode/reactuse v0.0.55 */
2
+ import{g as t,h as s,i}from"../../../_rollupPluginBabelHelpers--yEi7JQy.js";import{Pointer as r}from"./Pointer.js";var h=function(){return t((function t(h){var e=h.x,o=h.y,n=h.radius,u=h.smooth;s(this,t),i(this,"smooth",!1),i(this,"points",[]),i(this,"lines",[]),this.smooth=u,this.pointer=new r(e,o),this.brush=new r(e,o),this.radius=n,this.points=[],this.lines=[]}),[{key:"getBrushCoordinates",value:function(){return{x:this.brush.x,y:this.brush.y}}},{key:"getPointerCoordinates",value:function(){return{x:this.pointer.x,y:this.pointer.y}}},{key:"update",value:function(t){if(this.pointer.equalsTo(t))return!1;if(this.pointer.update(t),!this.smooth)return this.brush.update(t),this.points.push(this.getBrushCoordinates()),!0;var s=this.pointer.getDistanceTo(this.brush),i=this.pointer.getAngleTo(this.brush);if(Math.round(10*(s-this.radius))/10>0){var r=i+Math.PI/2;return this.brush.update({x:this.brush.x+Math.sin(r)*(s-this.radius),y:this.brush.y-Math.cos(r)*(s-this.radius)}),this.points.push(this.getBrushCoordinates()),!0}return!1}}])}();export{h as Paint};
3
3
  //# sourceMappingURL=Paint.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.53 */
2
- import{g as t,h as e}from"../../../_rollupPluginBabelHelpers-CIuCCT6y.js";var n=function(){function n(t,i){e(this,n),this.x=t,this.y=i}return t(n,[{key:"update",value:function(t){this.x=t.x,this.y=t.y}},{key:"getDifferenceTo",value:function(t){return new n(this.x-t.x,this.y-t.y)}},{key:"getDistanceTo",value:function(t){var e=this.getDifferenceTo(t);return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}},{key:"getAngleTo",value:function(t){var e=this.getDifferenceTo(t);return Math.atan2(e.y,e.x)}},{key:"equalsTo",value:function(t){return this.x===t.x&&this.y===t.y}},{key:"moveByAngle",value:function(t,e){var n=t+Math.PI/2;return this.x+=Math.sin(n)*e,this.y-=Math.cos(n)*e,this}}])}();export{n as Pointer};
1
+ /* @license @siberiacancode/reactuse v0.0.55 */
2
+ import{g as t,h as e}from"../../../_rollupPluginBabelHelpers--yEi7JQy.js";var n=function(){function n(t,i){e(this,n),this.x=t,this.y=i}return t(n,[{key:"update",value:function(t){this.x=t.x,this.y=t.y}},{key:"getDifferenceTo",value:function(t){return new n(this.x-t.x,this.y-t.y)}},{key:"getDistanceTo",value:function(t){var e=this.getDifferenceTo(t);return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}},{key:"getAngleTo",value:function(t){var e=this.getDifferenceTo(t);return Math.atan2(e.y,e.x)}},{key:"equalsTo",value:function(t){return this.x===t.x&&this.y===t.y}},{key:"moveByAngle",value:function(t,e){var n=t+Math.PI/2;return this.x+=Math.sin(n)*e,this.y-=Math.cos(n)*e,this}}])}();export{n as Pointer};
3
3
  //# sourceMappingURL=Pointer.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.53 */
2
- import{c as n,_ as r}from"../../_rollupPluginBabelHelpers-CIuCCT6y.js";import{useRef as e,useState as t,useEffect as o}from"react";import{useEvent as u}from"../useEvent/useEvent.js";import{Paint as i}from"./helpers/Paint.js";import"./helpers/Pointer.js";var c=function(n){return"function"==typeof n?n():n instanceof Element?n:n.current},l=function(){var l,s,a,v,d,f="object"!==n(arguments.length<=0?void 0:arguments[0])||"current"in(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:void 0,p=f?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0],h=null!==(l=null==p?void 0:p.color)&&void 0!==l?l:"black",m=null!==(s=null==p?void 0:p.opacity)&&void 0!==s?s:1,y=null!==(a=null==p?void 0:p.radius)&&void 0!==a?a:10,g=e(new i({x:0,y:0,radius:null!==(v=null==p?void 0:p.radius)&&void 0!==v?v:10,smooth:null!==(d=null==p?void 0:p.smooth)&&void 0!==d&&d})),x=t(!1),E=r(x,2),w=E[0],L=E[1],b=e(null),j=e(null),M=function(n,r,e,t){if(j.current){j.current.globalAlpha=e,j.current.strokeStyle=r,j.current.lineWidth=2*t,j.current.lineCap="round",j.current.lineJoin="round";var o=n[0],u=n[1];j.current.beginPath();for(var i=1;i<n.length;i+=1){var c={x:o.x+(u.x-o.x)/2,y:o.y+(u.y-o.y)/2};j.current.quadraticCurveTo(o.x,o.y,c.x,c.y),o=n[i],u=n[i+1]}j.current.lineTo(o.x,o.y),j.current.stroke()}},P=function(){j.current&&j.current.clearRect(0,0,j.current.canvas.width,j.current.canvas.height)},k=u((function(n){var r;if(w){null==p||null===(r=p.onMouseMove)||void 0===r||r.call(p,n,g.current);var e={x:n.offsetX,y:n.offsetY};g.current.update(e)&&j.current&&(P(),j.current.clearRect(0,0,j.current.canvas.width,j.current.canvas.height),g.current.lines.forEach((function(n){var r=n.points,e=n.color,t=n.opacity,o=n.radius;return M(r,e,t,o)})),M(g.current.points,h,m,y))}})),C=u((function(n){var r;if(j.current){var e={x:n.offsetX,y:n.offsetY};g.current.brush.update(e),g.current.points.push(e),M(g.current.points,h,m,y),null==p||null===(r=p.onMouseDown)||void 0===r||r.call(p,n,g.current),L(!0)}})),R=u((function(n){var r;j.current&&(g.current.points.length&&(g.current.lines.push({points:g.current.points,color:h,opacity:m,radius:y}),g.current.points=[]),null==p||null===(r=p.onMouseUp)||void 0===r||r.call(p,n,g.current),L(!1))})),T=function(){j.current&&(P(),g.current.lines=[],g.current.points=[])},X=function(){j.current&&(P(),g.current.lines.pop(),g.current.lines.forEach((function(n){var r=n.points,e=n.color,t=n.opacity,o=n.radius;return M(r,e,t,o)})))};return o((function(){var n=f?c(f):b.current;if(n)return j.current=n.getContext("2d"),null!=p&&p.initialLines&&(g.current.lines=p.initialLines,p.initialLines.forEach((function(n){var r=n.points,e=n.color,t=n.opacity,o=n.radius;return M(r,e,t,o)}))),n.addEventListener("mousedown",C),n.addEventListener("mousemove",k),n.addEventListener("mouseup",R),function(){n&&(n.removeEventListener("mousedown",C),n.removeEventListener("mousemove",k),n.removeEventListener("mouseup",R))}}),[]),f?{drawing:w,clear:T,undo:X,draw:M,lines:g.current.lines}:{ref:b,drawing:w,clear:T,undo:X,draw:M,lines:g.current.lines}};export{c as getElement,l as usePaint};
1
+ /* @license @siberiacancode/reactuse v0.0.55 */
2
+ import{c as n,_ as r}from"../../_rollupPluginBabelHelpers--yEi7JQy.js";import{useRef as e,useState as t,useEffect as o}from"react";import{useEvent as u}from"../useEvent/useEvent.js";import{Paint as i}from"./helpers/Paint.js";import"./helpers/Pointer.js";var c=function(n){return"function"==typeof n?n():n instanceof Element?n:n.current},l=function(){var l,s,a,v,d,f="object"!==n(arguments.length<=0?void 0:arguments[0])||"current"in(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:void 0,p=f?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0],h=null!==(l=null==p?void 0:p.color)&&void 0!==l?l:"black",m=null!==(s=null==p?void 0:p.opacity)&&void 0!==s?s:1,y=null!==(a=null==p?void 0:p.radius)&&void 0!==a?a:10,g=e(new i({x:0,y:0,radius:null!==(v=null==p?void 0:p.radius)&&void 0!==v?v:10,smooth:null!==(d=null==p?void 0:p.smooth)&&void 0!==d&&d})),x=t(!1),E=r(x,2),w=E[0],L=E[1],b=e(null),j=e(null),M=function(n,r,e,t){if(j.current){j.current.globalAlpha=e,j.current.strokeStyle=r,j.current.lineWidth=2*t,j.current.lineCap="round",j.current.lineJoin="round";var o=n[0],u=n[1];j.current.beginPath();for(var i=1;i<n.length;i+=1){var c={x:o.x+(u.x-o.x)/2,y:o.y+(u.y-o.y)/2};j.current.quadraticCurveTo(o.x,o.y,c.x,c.y),o=n[i],u=n[i+1]}j.current.lineTo(o.x,o.y),j.current.stroke()}},P=function(){j.current&&j.current.clearRect(0,0,j.current.canvas.width,j.current.canvas.height)},k=u((function(n){var r;if(w){null==p||null===(r=p.onMouseMove)||void 0===r||r.call(p,n,g.current);var e={x:n.offsetX,y:n.offsetY};g.current.update(e)&&j.current&&(P(),j.current.clearRect(0,0,j.current.canvas.width,j.current.canvas.height),g.current.lines.forEach((function(n){var r=n.points,e=n.color,t=n.opacity,o=n.radius;return M(r,e,t,o)})),M(g.current.points,h,m,y))}})),C=u((function(n){var r;if(j.current){var e={x:n.offsetX,y:n.offsetY};g.current.brush.update(e),g.current.points.push(e),M(g.current.points,h,m,y),null==p||null===(r=p.onMouseDown)||void 0===r||r.call(p,n,g.current),L(!0)}})),R=u((function(n){var r;j.current&&(g.current.points.length&&(g.current.lines.push({points:g.current.points,color:h,opacity:m,radius:y}),g.current.points=[]),null==p||null===(r=p.onMouseUp)||void 0===r||r.call(p,n,g.current),L(!1))})),T=function(){j.current&&(P(),g.current.lines=[],g.current.points=[])},X=function(){j.current&&(P(),g.current.lines.pop(),g.current.lines.forEach((function(n){var r=n.points,e=n.color,t=n.opacity,o=n.radius;return M(r,e,t,o)})))};return o((function(){var n=f?c(f):b.current;if(n)return j.current=n.getContext("2d"),null!=p&&p.initialLines&&(g.current.lines=p.initialLines,p.initialLines.forEach((function(n){var r=n.points,e=n.color,t=n.opacity,o=n.radius;return M(r,e,t,o)}))),n.addEventListener("mousedown",C),n.addEventListener("mousemove",k),n.addEventListener("mouseup",R),function(){n&&(n.removeEventListener("mousedown",C),n.removeEventListener("mousemove",k),n.removeEventListener("mouseup",R))}}),[]),f?{drawing:w,clear:T,undo:X,draw:M,lines:g.current.lines}:{ref:b,drawing:w,clear:T,undo:X,draw:M,lines:g.current.lines}};export{c as getElement,l as usePaint};
3
3
  //# sourceMappingURL=usePaint.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.53 */
2
- import{_ as r,d as e,e as t}from"../../_rollupPluginBabelHelpers-CIuCCT6y.js";import{useState as n,useEffect as a}from"react";import{useEvent as s}from"../useEvent/useEvent.js";var o=function(o){var u=n("prompt"),i=r(u,2),p=i[0],c=i[1],m=navigator&&"permissions"in navigator,v={name:o},f=s(e(t().mark((function r(){var e;return t().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,navigator.permissions.query(v);case 3:return e=r.sent,c(e.state),r.abrupt("return",e.state);case 8:return r.prev=8,r.t0=r.catch(0),c("prompt"),r.abrupt("return","prompt");case 12:case"end":return r.stop()}}),r,null,[[0,8]])}))));return a((function(){if(m)return f(),window.addEventListener("change",f),function(){window.removeEventListener("change",f)}}),[o]),{state:p,supported:m,query:f}};export{o as usePermission};
1
+ /* @license @siberiacancode/reactuse v0.0.55 */
2
+ import{_ as r,d as e,e as t}from"../../_rollupPluginBabelHelpers--yEi7JQy.js";import{useState as n,useEffect as a}from"react";import{useEvent as s}from"../useEvent/useEvent.js";var o=function(o){var u=n("prompt"),i=r(u,2),p=i[0],c=i[1],m=navigator&&"permissions"in navigator,v={name:o},f=s(e(t().mark((function r(){var e;return t().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,navigator.permissions.query(v);case 3:return e=r.sent,c(e.state),r.abrupt("return",e.state);case 8:return r.prev=8,r.t0=r.catch(0),c("prompt"),r.abrupt("return","prompt");case 12:case"end":return r.stop()}}),r,null,[[0,8]])}))));return a((function(){if(m)return f(),window.addEventListener("change",f),function(){window.removeEventListener("change",f)}}),[o]),{state:p,supported:m,query:f}};export{o as usePermission};
3
3
  //# sourceMappingURL=usePermission.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.53 */
1
+ /* @license @siberiacancode/reactuse v0.0.55 */
2
2
  import{useMediaQuery as e}from"../useMediaQuery/useMediaQuery.js";import"react";var r=function(){var r=e("(prefers-color-scheme: light)"),o=e("(prefers-color-scheme: dark)");return r?"light":o?"dark":"no-preference"};export{r as usePreferredColorScheme};
3
3
  //# sourceMappingURL=usePreferredColorScheme.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.53 */
1
+ /* @license @siberiacancode/reactuse v0.0.55 */
2
2
  import{useMediaQuery as r}from"../useMediaQuery/useMediaQuery.js";import"react";var e=function(){var e=r("(prefers-contrast: more)"),s=r("(prefers-contrast: less)"),t=r("(prefers-contrast: custom)");return e?"more":s?"less":t?"custom":"no-preference"};export{e as usePreferredContrast};
3
3
  //# sourceMappingURL=usePreferredContrast.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.53 */
1
+ /* @license @siberiacancode/reactuse v0.0.55 */
2
2
  import{useMediaQuery as r}from"../useMediaQuery/useMediaQuery.js";import"react";var e=function(){return r("(prefers-color-scheme: dark)")};export{e as usePreferredDark};
3
3
  //# sourceMappingURL=usePreferredDark.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.53 */
1
+ /* @license @siberiacancode/reactuse v0.0.55 */
2
2
  import{useSyncExternalStore as n}from"react";var e=function(){return window.navigator.languages},r=function(){return[]},t=function(n){return window.addEventListener("languagechange",n),function(){window.removeEventListener("languagechange",n)}},a=function(){return n(t,e,r)};export{a as usePreferredLanguages};
3
3
  //# sourceMappingURL=usePreferredLanguages.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.53 */
1
+ /* @license @siberiacancode/reactuse v0.0.55 */
2
2
  import{useMediaQuery as e}from"../useMediaQuery/useMediaQuery.js";import"react";var r=function(){return e("(prefers-reduced-motion: reduce)")?"reduce":"no-preference"};export{r as usePreferredReducedMotion};
3
3
  //# sourceMappingURL=usePreferredReducedMotion.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.53 */
1
+ /* @license @siberiacancode/reactuse v0.0.55 */
2
2
  import{useRef as r,useEffect as t}from"react";var n=function(n){var c=r();return t((function(){c.current=n})),c.current};export{n as usePrevious};
3
3
  //# sourceMappingURL=usePrevious.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.53 */
2
- import{_ as e,a as r}from"../../_rollupPluginBabelHelpers-CIuCCT6y.js";import{useRef as t,useState as l,useEffect as n}from"react";import{getRetry as i}from"../../utils/helpers/getRetry.js";import"../../utils/helpers/isClient.js";import{useDidUpdate as u}from"../useDidUpdate/useDidUpdate.js";import{useMount as o}from"../useMount/useMount.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";var c=function(c,a){var f,s,v=t(null!=a&&a.retry?i(a.retry):0),d=l(!1),h=e(d,2),p=h[0],m=h[1],y=l(!1),I=e(y,2),D=I[0],j=I[1],g=l(!1),E=e(g,2),L=E[0],k=E[1],M=l(!(null==a||!a.initialData)),R=e(M,2),S=R[0],U=R[1],_=l(void 0),b=e(_,2),x=b[0],B=b[1],C=l(null==a?void 0:a.initialData),F=e(C,2),H=F[0],P=F[1],q=t(),w=function e(r){m(!0),"refetch"===r&&k(!0),c().then((function(e){var t,l=null!=a&&a.select?null==a?void 0:a.select(e):e;null==a||null===(t=a.onSuccess)||void 0===t||t.call(a,l),P(l),U(!0),m(!1),B(void 0),j(!1),"refetch"===r&&k(!1)})).catch((function(t){var l;if(v.current>0)return v.current-=1,e(r);null==a||null===(l=a.onError)||void 0===l||l.call(a,t),P(void 0),U(!1),m(!1),B(t),j(!0),"refetch"===r&&k(!1),v.current=null!=a&&a.retry?i(a.retry):0})).finally((function(){if(null!=a&&a.refetchInterval){var r=setInterval((function(){clearInterval(r),e("refetch")}),null==a?void 0:a.refetchInterval);q.current=r}}))};n((function(){if(null!=a&&a.refetchInterval)return function(){null!=a&&a.refetchInterval&&clearInterval(q.current)}}),[null==a?void 0:a.refetchInterval,null==a?void 0:a.retry].concat(r(null!==(f=null==a?void 0:a.keys)&&void 0!==f?f:[]))),o((function(){null!=a&&a.initialData||w("init")})),u((function(){return w("refetch")}),null!==(s=null==a?void 0:a.keys)&&void 0!==s?s:[]);var z=(null==a?void 0:a.placeholderData)instanceof Function?null==a?void 0:a.placeholderData():null==a?void 0:a.placeholderData;return{data:null!=H?H:z,error:x,refetch:function(){return w("refetch")},isLoading:p,isError:D,isSuccess:S,isRefetching:L}};export{c as useQuery};
1
+ /* @license @siberiacancode/reactuse v0.0.55 */
2
+ import{_ as e,a as r}from"../../_rollupPluginBabelHelpers--yEi7JQy.js";import{useRef as l,useState as t,useEffect as n}from"react";import{getRetry as i}from"../../utils/helpers/getRetry.js";import"../../utils/helpers/isClient.js";import{useDidUpdate as o}from"../useDidUpdate/useDidUpdate.js";import{useMount as u}from"../useMount/useMount.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";var c=function(c,a){var s,f,v,d=null===(s=null==a?void 0:a.enabled)||void 0===s||s,h=l(null!=a&&a.retry?i(a.retry):0),p=t(!1),m=e(p,2),y=m[0],I=m[1],D=t(!1),j=e(D,2),g=j[0],E=j[1],L=t(!1),b=e(L,2),k=b[0],M=b[1],R=t(!(null==a||!a.initialData)),S=e(R,2),U=S[0],_=S[1],x=t(void 0),B=e(x,2),C=B[0],F=B[1],H=t(null==a?void 0:a.initialData),P=e(H,2),q=P[0],w=P[1],z=l(),A=function e(r){I(!0),"refetch"===r&&M(!0),c().then((function(e){var l,t=null!=a&&a.select?null==a?void 0:a.select(e):e;null==a||null===(l=a.onSuccess)||void 0===l||l.call(a,t),w(t),_(!0),I(!1),F(void 0),E(!1),"refetch"===r&&M(!1)})).catch((function(l){var t;if(h.current>0)return h.current-=1,e(r);null==a||null===(t=a.onError)||void 0===t||t.call(a,l),w(void 0),_(!1),I(!1),F(l),E(!0),"refetch"===r&&M(!1),h.current=null!=a&&a.retry?i(a.retry):0})).finally((function(){if(null!=a&&a.refetchInterval){var r=setInterval((function(){clearInterval(r),e("refetch")}),null==a?void 0:a.refetchInterval);z.current=r}}))};u((function(){d&&A("init")})),o((function(){d&&A("refetch")}),[d].concat(r(null!==(f=null==a?void 0:a.keys)&&void 0!==f?f:[]))),n((function(){return function(){clearInterval(z.current)}}),[d,null==a?void 0:a.refetchInterval,null==a?void 0:a.retry].concat(r(null!==(v=null==a?void 0:a.keys)&&void 0!==v?v:[])));var G=(null==a?void 0:a.placeholderData)instanceof Function?null==a?void 0:a.placeholderData():null==a?void 0:a.placeholderData;return{data:null!=q?q:G,error:C,refetch:function(){return A("refetch")},isLoading:y,isError:g,isSuccess:U,isRefetching:k}};export{c as useQuery};
3
3
  //# sourceMappingURL=useQuery.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useQuery.js","sources":["../../../../src/hooks/useQuery/useQuery.ts"],"sourcesContent":["import type { DependencyList } from 'react';\nimport { useEffect, useRef, useState } from 'react';\n\nimport { getRetry } from '@/utils/helpers';\n\nimport { useDidUpdate } from '../useDidUpdate/useDidUpdate';\nimport { useMount } from '../useMount/useMount';\n\n/* The use query return type */\nexport interface UseQueryOptions<QueryData, Data> {\n /* The depends for the hook */\n keys?: DependencyList;\n /* The callback function to be invoked on success */\n onSuccess?: (data: Data) => void;\n /* The callback function to be invoked on error */\n onError?: (error: Error) => void;\n /* The select function to be invoked */\n select?: (data: QueryData) => Data;\n /* The initial data for the hook */\n initialData?: Data | (() => Data);\n /* The placeholder data for the hook */\n placeholderData?: Data | (() => Data);\n /* The retry count of requests */\n retry?: boolean | number;\n /* The refetch interval */\n refetchInterval?: number;\n}\n\n/* The use query return type */\nexport interface UseQueryReturn<Data> {\n /* The state of the query */\n data?: Data;\n /* The loading state of the query */\n isLoading: boolean;\n /* The error state of the query */\n isError: boolean;\n /* The success state of the query */\n isSuccess: boolean;\n /* The success state of the query */\n error?: Error;\n /* The refetch function */\n refetch: () => void;\n /* The refetching state of the query */\n isRefetching: boolean;\n}\n\n/**\n * @name useQuery\n * @description - Hook that defines the logic when query data\n * @category Utilities\n *\n * @template Data The type of the data\n * @param {() => Promise<Data>} callback The callback function to be invoked\n * @param {DependencyList} [options.keys] The dependencies for the hook\n * @param {(data: Data) => void} [options.onSuccess] The callback function to be invoked on success\n * @param {(error: Error) => void} [options.onError] The callback function to be invoked on error\n * @param {UseQueryOptionsSelect<Data>} [options.select] The select function to be invoked\n * @param {Data | (() => Data)} [options.initialData] The initial data for the hook\n * @param {Data | (() => Data)} [options.placeholderData] The placeholder data for the hook\n * @param {number} [options.refetchInterval] The refetch interval\n * @param {boolean | number} [options.retry] The retry count of requests\n * @returns {UseQueryReturn<Data>} An object with the state of the query\n *\n * @example\n * const { data, isLoading, isError, isSuccess, error, refetch, isRefetching } = useQuery(() => fetch('https://example.com/data'));\n */\nexport const useQuery = <QueryData, Data = QueryData>(\n callback: () => Promise<QueryData>,\n options?: UseQueryOptions<QueryData, Data>\n): UseQueryReturn<Data> => {\n const retryCountRef = useRef(options?.retry ? getRetry(options.retry) : 0);\n\n const [isLoading, setIsLoading] = useState(false);\n const [isError, setIsError] = useState(false);\n const [isRefetching, setIsRefetching] = useState(false);\n const [isSuccess, setIsSuccess] = useState(!!options?.initialData);\n\n const [error, setError] = useState<Error | undefined>(undefined);\n const [data, setData] = useState<Data | undefined>(options?.initialData);\n\n const intervalIdRef = useRef<ReturnType<typeof setInterval>>();\n\n const request = (action: 'init' | 'refetch') => {\n setIsLoading(true);\n if (action === 'refetch') setIsRefetching(true);\n\n callback()\n .then((response) => {\n const data = options?.select ? options?.select(response) : response;\n options?.onSuccess?.(data as Data);\n setData(data as Data);\n setIsSuccess(true);\n setIsLoading(false);\n setError(undefined);\n setIsError(false);\n if (action === 'refetch') setIsRefetching(false);\n })\n .catch((error: Error) => {\n if (retryCountRef.current > 0) {\n retryCountRef.current -= 1;\n return request(action);\n }\n options?.onError?.(error);\n setData(undefined);\n setIsSuccess(false);\n setIsLoading(false);\n setError(error);\n setIsError(true);\n if (action === 'refetch') setIsRefetching(false);\n retryCountRef.current = options?.retry ? getRetry(options.retry) : 0;\n })\n .finally(() => {\n if (options?.refetchInterval) {\n const interval = setInterval(() => {\n clearInterval(interval);\n request('refetch');\n }, options?.refetchInterval);\n intervalIdRef.current = interval;\n }\n });\n };\n\n useEffect(() => {\n if (!options?.refetchInterval) return;\n\n return () => {\n if (options?.refetchInterval) {\n clearInterval(intervalIdRef.current);\n }\n };\n }, [options?.refetchInterval, options?.retry, ...(options?.keys ?? [])]);\n\n useMount(() => {\n if (options?.initialData) return;\n request('init');\n });\n\n useDidUpdate(() => request('refetch'), options?.keys ?? []);\n\n const refetch = () => request('refetch');\n\n const placeholderData =\n options?.placeholderData instanceof Function\n ? options?.placeholderData()\n : options?.placeholderData;\n\n return {\n data: data ?? placeholderData,\n error,\n refetch,\n isLoading,\n isError,\n isSuccess,\n isRefetching\n };\n};\n"],"names":["useQuery","callback","options","_options$keys","_options$keys2","retryCountRef","useRef","retry","getRetry","_useState","useState","_useState2","_slicedToArray","isLoading","setIsLoading","_useState3","_useState4","isError","setIsError","_useState5","_useState6","isRefetching","setIsRefetching","_useState7","initialData","_useState8","isSuccess","setIsSuccess","_useState9","undefined","_useState10","error","setError","_useState11","_useState12","data","setData","intervalIdRef","request","action","then","response","_options$onSuccess","select","onSuccess","call","_options$onError","current","onError","refetchInterval","interval","setInterval","clearInterval","useEffect","concat","_toConsumableArray","keys","useMount","useDidUpdate","placeholderData","Function","refetch"],"mappings":";0ZAkEO,IAAMA,EAAW,SACtBC,EACAC,GACyB,IAAAC,EAAAC,EACnBC,EAAgBC,EAAOJ,SAAAA,EAASK,MAAQC,EAASN,EAAQK,OAAS,GAExEE,EAAkCC,GAAS,GAAMC,EAAAC,EAAAH,EAAA,GAA1CI,EAASF,EAAA,GAAEG,EAAYH,EAAA,GAC9BI,EAA8BL,GAAS,GAAMM,EAAAJ,EAAAG,EAAA,GAAtCE,EAAOD,EAAA,GAAEE,EAAUF,EAAA,GAC1BG,EAAwCT,GAAS,GAAMU,EAAAR,EAAAO,EAAA,GAAhDE,EAAYD,EAAA,GAAEE,EAAeF,EAAA,GACpCG,EAAkCb,IAAWR,UAAAA,EAASsB,cAAYC,EAAAb,EAAAW,EAAA,GAA3DG,EAASD,EAAA,GAAEE,EAAYF,EAAA,GAE9BG,EAA0BlB,OAA4BmB,GAAUC,EAAAlB,EAAAgB,EAAA,GAAzDG,EAAKD,EAAA,GAAEE,EAAQF,EAAA,GACtBG,EAAwBvB,EAA2BR,aAAAA,EAAAA,EAASsB,aAAYU,EAAAtB,EAAAqB,EAAA,GAAjEE,EAAID,EAAA,GAAEE,EAAOF,EAAA,GAEdG,EAAgB/B,IAEhBgC,EAAU,SAAVA,EAAWC,GACfzB,GAAa,GACE,YAAXyB,GAAsBjB,GAAgB,GAE1CrB,IACGuC,MAAK,SAACC,GAAa,IAAAC,EACZP,EAAOjC,SAAAA,EAASyC,OAASzC,eAAAA,EAASyC,OAAOF,GAAYA,EAC3DvC,SAAkB,QAAXwC,EAAPxC,EAAS0C,iBAAS,IAAAF,GAAlBA,EAAAG,KAAA3C,EAAqBiC,GACrBC,EAAQD,GACRR,GAAa,GACbb,GAAa,GACbkB,OAASH,GACTX,GAAW,GACI,YAAXqB,GAAsBjB,GAAgB,EAC5C,IAAE,OACK,SAACS,GAAiB,IAAAe,EACvB,GAAIzC,EAAc0C,QAAU,EAE1B,OADA1C,EAAc0C,SAAW,EAClBT,EAAQC,GAEjBrC,SAAgB,QAAT4C,EAAP5C,EAAS8C,eAAO,IAAAF,GAAhBA,EAAAD,KAAA3C,EAAmB6B,GACnBK,OAAQP,GACRF,GAAa,GACbb,GAAa,GACbkB,EAASD,GACTb,GAAW,GACI,YAAXqB,GAAsBjB,GAAgB,GAC1CjB,EAAc0C,QAAU7C,SAAAA,EAASK,MAAQC,EAASN,EAAQK,OAAS,KAE7D,SAAC,WACP,GAAIL,SAAAA,EAAS+C,gBAAiB,CAC5B,IAAMC,EAAWC,aAAY,WAC3BC,cAAcF,GACdZ,EAAQ,aACPpC,eAAAA,EAAS+C,iBACZZ,EAAcU,QAAUG,CAC1B,CACF,KAGJG,GAAU,WACR,GAAKnD,SAAAA,EAAS+C,gBAEd,OAAO,WACD/C,SAAAA,EAAS+C,iBACXG,cAAcf,EAAcU,SAGlC,IAAI7C,aAAO,EAAPA,EAAS+C,gBAAiB/C,aAAO,EAAPA,EAASK,OAAK+C,OAAAC,UAAApD,EAAMD,aAAAA,EAAAA,EAASsD,YAAI,IAAArD,EAAAA,EAAI,MAEnEsD,GAAS,WACHvD,SAAAA,EAASsB,aACbc,EAAQ,OACV,IAEAoB,GAAa,WAAA,OAAMpB,EAAQ,UAAU,WAAAlC,EAAEF,aAAAA,EAAAA,EAASsD,YAAI,IAAApD,EAAAA,EAAI,IAExD,IAEMuD,GACJzD,aAAAA,EAAAA,EAASyD,2BAA2BC,SAChC1D,aAAAA,EAAAA,EAASyD,kBACTzD,aAAAA,EAAAA,EAASyD,gBAEf,MAAO,CACLxB,KAAMA,QAAAA,EAAQwB,EACd5B,MAAAA,EACA8B,QAVc,WAAH,OAASvB,EAAQ,UAAU,EAWtCzB,UAAAA,EACAI,QAAAA,EACAS,UAAAA,EACAL,aAAAA,EAEJ"}
1
+ {"version":3,"file":"useQuery.js","sources":["../../../../src/hooks/useQuery/useQuery.ts"],"sourcesContent":["import type { DependencyList } from 'react';\nimport { useEffect, useRef, useState } from 'react';\n\nimport { getRetry } from '@/utils/helpers';\n\nimport { useDidUpdate } from '../useDidUpdate/useDidUpdate';\nimport { useMount } from '../useMount/useMount';\n\n/* The use query return type */\nexport interface UseQueryOptions<QueryData, Data> {\n /* The depends for the hook */\n keys?: DependencyList;\n /* The callback function to be invoked on success */\n onSuccess?: (data: Data) => void;\n /* The callback function to be invoked on error */\n onError?: (error: Error) => void;\n /* The select function to be invoked */\n select?: (data: QueryData) => Data;\n /* The initial data for the hook */\n initialData?: Data | (() => Data);\n /* The placeholder data for the hook */\n placeholderData?: Data | (() => Data);\n /* The retry count of requests */\n retry?: boolean | number;\n /* The refetch interval */\n refetchInterval?: number;\n /* The enabled state of the query */\n enabled?: boolean;\n}\n\n/* The use query return type */\nexport interface UseQueryReturn<Data> {\n /* The state of the query */\n data?: Data;\n /* The loading state of the query */\n isLoading: boolean;\n /* The error state of the query */\n isError: boolean;\n /* The success state of the query */\n isSuccess: boolean;\n /* The success state of the query */\n error?: Error;\n /* The refetch function */\n refetch: () => void;\n /* The refetching state of the query */\n isRefetching: boolean;\n}\n\n/**\n * @name useQuery\n * @description - Hook that defines the logic when query data\n * @category Utilities\n *\n * @template Data The type of the data\n * @param {() => Promise<Data>} callback The callback function to be invoked\n * @param {DependencyList} [options.keys] The dependencies for the hook\n * @param {(data: Data) => void} [options.onSuccess] The callback function to be invoked on success\n * @param {(error: Error) => void} [options.onError] The callback function to be invoked on error\n * @param {UseQueryOptionsSelect<Data>} [options.select] The select function to be invoked\n * @param {Data | (() => Data)} [options.initialData] The initial data for the hook\n * @param {Data | (() => Data)} [options.placeholderData] The placeholder data for the hook\n * @param {number} [options.refetchInterval] The refetch interval\n * @param {boolean | number} [options.retry] The retry count of requests\n * @returns {UseQueryReturn<Data>} An object with the state of the query\n *\n * @example\n * const { data, isLoading, isError, isSuccess, error, refetch, isRefetching } = useQuery(() => fetch('url'));\n */\nexport const useQuery = <QueryData, Data = QueryData>(\n callback: () => Promise<QueryData>,\n options?: UseQueryOptions<QueryData, Data>\n): UseQueryReturn<Data> => {\n const enabled = options?.enabled ?? true;\n const retryCountRef = useRef(options?.retry ? getRetry(options.retry) : 0);\n\n const [isLoading, setIsLoading] = useState(false);\n const [isError, setIsError] = useState(false);\n const [isRefetching, setIsRefetching] = useState(false);\n const [isSuccess, setIsSuccess] = useState(!!options?.initialData);\n\n const [error, setError] = useState<Error | undefined>(undefined);\n const [data, setData] = useState<Data | undefined>(options?.initialData);\n\n const intervalIdRef = useRef<ReturnType<typeof setInterval>>();\n\n const request = (action: 'init' | 'refetch') => {\n setIsLoading(true);\n if (action === 'refetch') setIsRefetching(true);\n callback()\n .then((response) => {\n const data = options?.select ? options?.select(response) : response;\n options?.onSuccess?.(data as Data);\n setData(data as Data);\n setIsSuccess(true);\n setIsLoading(false);\n setError(undefined);\n setIsError(false);\n if (action === 'refetch') setIsRefetching(false);\n })\n .catch((error: Error) => {\n if (retryCountRef.current > 0) {\n retryCountRef.current -= 1;\n return request(action);\n }\n options?.onError?.(error);\n setData(undefined);\n setIsSuccess(false);\n setIsLoading(false);\n setError(error);\n setIsError(true);\n if (action === 'refetch') setIsRefetching(false);\n retryCountRef.current = options?.retry ? getRetry(options.retry) : 0;\n })\n .finally(() => {\n if (options?.refetchInterval) {\n const interval = setInterval(() => {\n clearInterval(interval);\n request('refetch');\n }, options?.refetchInterval);\n intervalIdRef.current = interval;\n }\n });\n };\n\n useMount(() => {\n if (!enabled) return;\n request('init');\n });\n\n useDidUpdate(() => {\n if (!enabled) return;\n request('refetch');\n }, [enabled, ...(options?.keys ?? [])]);\n\n useEffect(() => {\n return () => {\n clearInterval(intervalIdRef.current);\n };\n }, [enabled, options?.refetchInterval, options?.retry, ...(options?.keys ?? [])]);\n\n const refetch = () => request('refetch');\n\n const placeholderData =\n options?.placeholderData instanceof Function\n ? options?.placeholderData()\n : options?.placeholderData;\n\n return {\n data: data ?? placeholderData,\n error,\n refetch,\n isLoading,\n isError,\n isSuccess,\n isRefetching\n };\n};\n"],"names":["useQuery","callback","options","_options$enabled","_options$keys","_options$keys2","enabled","retryCountRef","useRef","retry","getRetry","_useState","useState","_useState2","_slicedToArray","isLoading","setIsLoading","_useState3","_useState4","isError","setIsError","_useState5","_useState6","isRefetching","setIsRefetching","_useState7","initialData","_useState8","isSuccess","setIsSuccess","_useState9","undefined","_useState10","error","setError","_useState11","_useState12","data","setData","intervalIdRef","request","action","then","response","_options$onSuccess","select","onSuccess","call","_options$onError","current","onError","refetchInterval","interval","setInterval","clearInterval","useMount","useDidUpdate","concat","_toConsumableArray","keys","useEffect","placeholderData","Function","refetch"],"mappings":";0ZAoEO,IAAMA,EAAW,SACtBC,EACAC,GACyB,IAAAC,EAAAC,EAAAC,EACnBC,EAA0BH,QAAnBA,EAAGD,aAAO,EAAPA,EAASI,eAAOH,IAAAA,GAAAA,EAC1BI,EAAgBC,EAAON,SAAAA,EAASO,MAAQC,EAASR,EAAQO,OAAS,GAExEE,EAAkCC,GAAS,GAAMC,EAAAC,EAAAH,EAAA,GAA1CI,EAASF,EAAA,GAAEG,EAAYH,EAAA,GAC9BI,EAA8BL,GAAS,GAAMM,EAAAJ,EAAAG,EAAA,GAAtCE,EAAOD,EAAA,GAAEE,EAAUF,EAAA,GAC1BG,EAAwCT,GAAS,GAAMU,EAAAR,EAAAO,EAAA,GAAhDE,EAAYD,EAAA,GAAEE,EAAeF,EAAA,GACpCG,EAAkCb,IAAWV,UAAAA,EAASwB,cAAYC,EAAAb,EAAAW,EAAA,GAA3DG,EAASD,EAAA,GAAEE,EAAYF,EAAA,GAE9BG,EAA0BlB,OAA4BmB,GAAUC,EAAAlB,EAAAgB,EAAA,GAAzDG,EAAKD,EAAA,GAAEE,EAAQF,EAAA,GACtBG,EAAwBvB,EAA2BV,aAAAA,EAAAA,EAASwB,aAAYU,EAAAtB,EAAAqB,EAAA,GAAjEE,EAAID,EAAA,GAAEE,EAAOF,EAAA,GAEdG,EAAgB/B,IAEhBgC,EAAU,SAAVA,EAAWC,GACfzB,GAAa,GACE,YAAXyB,GAAsBjB,GAAgB,GAC1CvB,IACGyC,MAAK,SAACC,GAAa,IAAAC,EACZP,EAAOnC,SAAAA,EAAS2C,OAAS3C,eAAAA,EAAS2C,OAAOF,GAAYA,EAC3DzC,SAAkB,QAAX0C,EAAP1C,EAAS4C,iBAAS,IAAAF,GAAlBA,EAAAG,KAAA7C,EAAqBmC,GACrBC,EAAQD,GACRR,GAAa,GACbb,GAAa,GACbkB,OAASH,GACTX,GAAW,GACI,YAAXqB,GAAsBjB,GAAgB,EAC5C,IAAE,OACK,SAACS,GAAiB,IAAAe,EACvB,GAAIzC,EAAc0C,QAAU,EAE1B,OADA1C,EAAc0C,SAAW,EAClBT,EAAQC,GAEjBvC,SAAgB,QAAT8C,EAAP9C,EAASgD,eAAO,IAAAF,GAAhBA,EAAAD,KAAA7C,EAAmB+B,GACnBK,OAAQP,GACRF,GAAa,GACbb,GAAa,GACbkB,EAASD,GACTb,GAAW,GACI,YAAXqB,GAAsBjB,GAAgB,GAC1CjB,EAAc0C,QAAU/C,SAAAA,EAASO,MAAQC,EAASR,EAAQO,OAAS,KAE7D,SAAC,WACP,GAAIP,SAAAA,EAASiD,gBAAiB,CAC5B,IAAMC,EAAWC,aAAY,WAC3BC,cAAcF,GACdZ,EAAQ,aACPtC,eAAAA,EAASiD,iBACZZ,EAAcU,QAAUG,CAC1B,CACF,KAGJG,GAAS,WACFjD,GACLkC,EAAQ,OACV,IAEAgB,GAAa,WACNlD,GACLkC,EAAQ,aACT,CAAGlC,GAAOmD,OAAAC,EAAmBtD,QAAnBA,EAAMF,aAAAA,EAAAA,EAASyD,gBAAIvD,EAAAA,EAAI,MAElCwD,GAAU,WACR,OAAO,WACLN,cAAcf,EAAcU,SAEhC,IAAI3C,EAASJ,aAAAA,EAAAA,EAASiD,gBAAiBjD,aAAAA,EAAAA,EAASO,OAAKgD,OAAAC,UAAArD,EAAMH,aAAAA,EAAAA,EAASyD,YAAI,IAAAtD,EAAAA,EAAI,MAE5E,IAEMwD,GACJ3D,aAAAA,EAAAA,EAAS2D,2BAA2BC,SAChC5D,aAAAA,EAAAA,EAAS2D,kBACT3D,aAAAA,EAAAA,EAAS2D,gBAEf,MAAO,CACLxB,KAAMA,QAAAA,EAAQwB,EACd5B,MAAAA,EACA8B,QAVc,WAAH,OAASvB,EAAQ,UAAU,EAWtCzB,UAAAA,EACAI,QAAAA,EACAS,UAAAA,EACAL,aAAAA,EAEJ"}
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.53 */
2
- import{_ as r,a as n,f as t}from"../../_rollupPluginBabelHelpers-CIuCCT6y.js";import{useState as e}from"react";import{flushSync as o}from"react-dom";var u=function(){var u=e(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]),a=r(u,2),i=a[0],c=a[1];return{add:function(r){return c((function(t){return[].concat(n(t),[r])}))},remove:function(){var r;return o((function(){c((function(n){var e=t(n),o=e[0],u=e.slice(1);return r=o,u}))})),r},clear:function(){return c([])},first:i[0],last:i[i.length-1],size:i.length,queue:i}};export{u as useQueue};
1
+ /* @license @siberiacancode/reactuse v0.0.55 */
2
+ import{_ as r,a as n,f as t}from"../../_rollupPluginBabelHelpers--yEi7JQy.js";import{useState as e}from"react";import{flushSync as o}from"react-dom";var u=function(){var u=e(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]),a=r(u,2),i=a[0],c=a[1];return{add:function(r){return c((function(t){return[].concat(n(t),[r])}))},remove:function(){var r;return o((function(){c((function(n){var e=t(n),o=e[0],u=e.slice(1);return r=o,u}))})),r},clear:function(){return c([])},first:i[0],last:i[i.length-1],size:i.length,queue:i}};export{u as useQueue};
3
3
  //# sourceMappingURL=useQueue.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.53 */
1
+ /* @license @siberiacancode/reactuse v0.0.55 */
2
2
  import{useRef as r,useEffect as t}from"react";var n=function(){var n=r(0);return t((function(){n.current+=1})),n.current};export{n as useRenderCount};
3
3
  //# sourceMappingURL=useRenderCount.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.53 */
1
+ /* @license @siberiacancode/reactuse v0.0.55 */
2
2
  import{useRef as e}from"react";var n=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Unknown",r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],t=e({component:n,renders:0,timestamp:Date.now(),sinceLast:0}),c=Date.now();return t.current.renders+=1,t.current.sinceLast=t.current.timestamp?c-t.current.timestamp:0,t.current.timestamp=c,r&&(console.group("".concat(n," info, render number: ").concat(t.current.renders)),console.log("Timestamp: ".concat(t.current.timestamp)),console.log("Since last render: ".concat(t.current.sinceLast)),console.log("Renders: ".concat(t.current.renders)),console.dir(t.current),console.groupEnd()),t.current};export{n as useRenderInfo};
3
3
  //# sourceMappingURL=useRenderInfo.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.53 */
2
- import{_ as r}from"../../_rollupPluginBabelHelpers-CIuCCT6y.js";import{useId as t,useState as o}from"react";var n=function(){var n=t(),a=o(n),e=r(a,2),i=e[0],u=e[1];return{id:i,update:function(){return u(Math.random().toString())}}};export{n as useRerender};
1
+ /* @license @siberiacancode/reactuse v0.0.55 */
2
+ import{_ as r}from"../../_rollupPluginBabelHelpers--yEi7JQy.js";import{useId as t,useState as o}from"react";var n=function(){var n=t(),a=o(n),e=r(a,2),i=e[0],u=e[1];return{id:i,update:function(){return u(Math.random().toString())}}};export{n as useRerender};
3
3
  //# sourceMappingURL=useRerender.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.53 */
2
- import{c as n,_ as r}from"../../_rollupPluginBabelHelpers-CIuCCT6y.js";import{useState as e,useRef as t,useEffect as o}from"react";import{useRerender as i}from"../useRerender/useRerender.js";var u=function(n){return"function"==typeof n?n():n instanceof Element?n:n.current},c=function(){var c,l=i(),v="object"!==n(arguments.length<=0?void 0:arguments[0])||"current"in(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:void 0,a=v?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0],f=null===(c=null==a?void 0:a.enabled)||void 0===c||c,s=e([]),d=r(s,2),b=d[0],g=d[1],h=t(),p=t();return p.current=null==a?void 0:a.onChange,o((function(){if(f){if(Array.isArray(v)){if(!v.length)return;var n=new ResizeObserver((function(r){var e;g(r),null===(e=p.current)||void 0===e||e.call(p,r,n)}));return v.forEach((function(r){var e=u(r);e&&n.observe(e,a)})),function(){n.disconnect()}}var r=v?u(v):h.current;if(r){var e=new ResizeObserver((function(n){var r;g(n),null===(r=p.current)||void 0===r||r.call(p,n,e)}));return e.observe(r,a),function(){e.disconnect()}}}}),[h.current,v,null==a?void 0:a.box,f]),v?{entries:b}:{ref:function(n){h.current||(h.current=n,l.update())},entries:b}};export{c as useResizeObserver};
1
+ /* @license @siberiacancode/reactuse v0.0.55 */
2
+ import{c as n,_ as r}from"../../_rollupPluginBabelHelpers--yEi7JQy.js";import{useState as e,useRef as t,useEffect as o}from"react";import{useRerender as i}from"../useRerender/useRerender.js";var u=function(n){return"function"==typeof n?n():n instanceof Element?n:n.current},c=function(){var c,l=i(),v="object"!==n(arguments.length<=0?void 0:arguments[0])||"current"in(arguments.length<=0?void 0:arguments[0])?arguments.length<=0?void 0:arguments[0]:void 0,a=v?arguments.length<=1?void 0:arguments[1]:arguments.length<=0?void 0:arguments[0],f=null===(c=null==a?void 0:a.enabled)||void 0===c||c,s=e([]),d=r(s,2),b=d[0],g=d[1],h=t(),p=t();return p.current=null==a?void 0:a.onChange,o((function(){if(f){if(Array.isArray(v)){if(!v.length)return;var n=new ResizeObserver((function(r){var e;g(r),null===(e=p.current)||void 0===e||e.call(p,r,n)}));return v.forEach((function(r){var e=u(r);e&&n.observe(e,a)})),function(){n.disconnect()}}var r=v?u(v):h.current;if(r){var e=new ResizeObserver((function(n){var r;g(n),null===(r=p.current)||void 0===r||r.call(p,n,e)}));return e.observe(r,a),function(){e.disconnect()}}}}),[h.current,v,null==a?void 0:a.box,f]),v?{entries:b}:{ref:function(n){h.current||(h.current=n,l.update())},entries:b}};export{c as useResizeObserver};
3
3
  //# sourceMappingURL=useResizeObserver.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.53 */
2
- import{_ as r}from"../../_rollupPluginBabelHelpers-CIuCCT6y.js";import{useState as t,useEffect as e}from"react";var n="script-status",o=function(o){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=t((function(){var r=document.querySelector('script[src="'.concat(o,'"]')),t=null==r?void 0:r.getAttribute(n);return t||(r?"unknown":"loading")})),c=r(u,2),a=c[0],s=c[1],d=i.removeOnUnmount,v=void 0===d||d,l=i.async,m=void 0===l||l;return e((function(){var t=document.querySelector('script[src="'.concat(o,'"]')),e=null==t?void 0:t.getAttribute(n);if(e)return s(e);if(t)return s("unknown");var u=document.createElement("script");u.src=o,u.async=m;for(var c=0,a=Object.entries(i);c<a.length;c++){var d=r(a[c],2),l=d[0],f=d[1];u.setAttribute(l,String(f))}u.setAttribute(n,"loading"),document.body.appendChild(u);var p=function(){u.setAttribute(n,"ready"),s("ready")},b=function(){u.setAttribute(n,"error"),s("error")};return u.addEventListener("load",p),u.addEventListener("error",b),function(){v&&(u.remove(),u.removeEventListener("load",p),u.removeEventListener("error",b))}}),[o,v]),a};export{n as SCRIPT_STATUS_ATTRIBUTE_NAME,o as useScript};
1
+ /* @license @siberiacancode/reactuse v0.0.55 */
2
+ import{_ as r}from"../../_rollupPluginBabelHelpers--yEi7JQy.js";import{useState as t,useEffect as e}from"react";var n="script-status",o=function(o){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=t((function(){var r=document.querySelector('script[src="'.concat(o,'"]')),t=null==r?void 0:r.getAttribute(n);return t||(r?"unknown":"loading")})),c=r(u,2),a=c[0],s=c[1],d=i.removeOnUnmount,v=void 0===d||d,l=i.async,m=void 0===l||l;return e((function(){var t=document.querySelector('script[src="'.concat(o,'"]')),e=null==t?void 0:t.getAttribute(n);if(e)return s(e);if(t)return s("unknown");var u=document.createElement("script");u.src=o,u.async=m;for(var c=0,a=Object.entries(i);c<a.length;c++){var d=r(a[c],2),l=d[0],f=d[1];u.setAttribute(l,String(f))}u.setAttribute(n,"loading"),document.body.appendChild(u);var p=function(){u.setAttribute(n,"ready"),s("ready")},b=function(){u.setAttribute(n,"error"),s("error")};return u.addEventListener("load",p),u.addEventListener("error",b),function(){v&&(u.remove(),u.removeEventListener("load",p),u.removeEventListener("error",b))}}),[o,v]),a};export{n as SCRIPT_STATUS_ATTRIBUTE_NAME,o as useScript};
3
3
  //# sourceMappingURL=useScript.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.53 */
2
- import{b as o}from"../../_rollupPluginBabelHelpers-CIuCCT6y.js";import{useStorage as e}from"../useStorage/useStorage.js";import"react";import"../../utils/helpers/isClient.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";var r=function(r,t,s){return e(r,o({initialValue:t,storage:window.sessionStorage},s))};export{r as useSessionStorage};
1
+ /* @license @siberiacancode/reactuse v0.0.55 */
2
+ import{b as o}from"../../_rollupPluginBabelHelpers--yEi7JQy.js";import{useStorage as e}from"../useStorage/useStorage.js";import"react";import"../../utils/helpers/isClient.js";import"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";var r=function(r,t,s){return e(r,o({initialValue:t,storage:window.sessionStorage},s))};export{r as useSessionStorage};
3
3
  //# sourceMappingURL=useSessionStorage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSessionStorage.js","sources":["../../../../src/hooks/useSessionStorage/useSessionStorage.ts"],"sourcesContent":["import type { UseStorageInitialValue, UseStorageOptions } from '../useStorage/useStorage';\nimport { useStorage } from '../useStorage/useStorage';\n\n/**\n * @name useSessionStorage\n * @description - Hook that manages session storage value\n * @category Browser\n *\n * @template Value The type of the value\n * @param {string} key The key of the storage\n * @param {UseStorageInitialValue<Value>} [initialValue] The initial value of the storage\n * @param {UseStorageOptions<Value>} [options] The options of the storage\n *\n * @example\n * const [value, setValue, removeValue] = useSessionStorage('key', 'value');\n */\nexport const useSessionStorage = <Value>(\n key: string,\n initialValue?: UseStorageInitialValue<Value>,\n options?: UseStorageOptions<Value>\n) => useStorage(key, { initialValue, storage: window.sessionStorage, ...options });\n"],"names":["useSessionStorage","key","initialValue","options","useStorage","_objectSpread","storage","window","sessionStorage"],"mappings":";iPAgBO,IAAMA,EAAoB,SAC/BC,EACAC,EACAC,GAAkC,OAC/BC,EAAWH,EAAGI,EAAA,CAAIH,aAAAA,EAAcI,QAASC,OAAOC,gBAAmBL,GAAU"}
1
+ {"version":3,"file":"useSessionStorage.js","sources":["../../../../src/hooks/useSessionStorage/useSessionStorage.ts"],"sourcesContent":["import type { UseStorageInitialValue, UseStorageOptions } from '../useStorage/useStorage';\nimport { useStorage } from '../useStorage/useStorage';\n\n/**\n * @name useSessionStorage\n * @description - Hook that manages session storage value\n * @category Browser\n *\n * @template Value The type of the value\n * @param {string} key The key of the storage\n * @param {UseStorageInitialValue<Value>} [initialValue] The initial value of the storage\n * @param {UseStorageOptions<Value>} [options] The options of the storage\n *\n * @example\n * const { value, set, remove } = useSessionStorage('key', 'value');\n */\nexport const useSessionStorage = <Value>(\n key: string,\n initialValue?: UseStorageInitialValue<Value>,\n options?: UseStorageOptions<Value>\n) => useStorage(key, { initialValue, storage: window.sessionStorage, ...options });\n"],"names":["useSessionStorage","key","initialValue","options","useStorage","_objectSpread","storage","window","sessionStorage"],"mappings":";iPAgBO,IAAMA,EAAoB,SAC/BC,EACAC,EACAC,GAAkC,OAC/BC,EAAWH,EAAGI,EAAA,CAAIH,aAAAA,EAAcI,QAASC,OAAOC,gBAAmBL,GAAU"}
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.53 */
2
- import{_ as e}from"../../_rollupPluginBabelHelpers-CIuCCT6y.js";import{useState as n}from"react";var r=function(r){var t=n(new Set(r)),u=e(t,2),i=u[0],f=u[1];return{value:i,size:i.size,has:function(e){return i.has(e)},add:function(e){return f((function(n){return new Set(n).add(e)}))},remove:function(e){return f((function(n){if(!n.has(e))return n;var r=new Set(n);return r.delete(e),r}))},clear:function(){return f(new Set)},reset:function(){return f(new Set(r))},toggle:function(e){return f((function(n){if(!n.has(e))return new Set(n).add(e);var r=new Set(n);return r.delete(e),r}))},union:function(e){return f(i.union(e))},difference:function(e){return f(i.difference(e))},symmetricDifference:function(e){return f(i.symmetricDifference(e))},intersection:function(e){return f(i.intersection(e))}}};export{r as useSet};
1
+ /* @license @siberiacancode/reactuse v0.0.55 */
2
+ import{_ as e}from"../../_rollupPluginBabelHelpers--yEi7JQy.js";import{useState as n}from"react";var r=function(r){var t=n(new Set(r)),u=e(t,2),i=u[0],f=u[1];return{value:i,size:i.size,has:function(e){return i.has(e)},add:function(e){return f((function(n){return new Set(n).add(e)}))},remove:function(e){return f((function(n){if(!n.has(e))return n;var r=new Set(n);return r.delete(e),r}))},clear:function(){return f(new Set)},reset:function(){return f(new Set(r))},toggle:function(e){return f((function(n){if(!n.has(e))return new Set(n).add(e);var r=new Set(n);return r.delete(e),r}))},union:function(e){return f(i.union(e))},difference:function(e){return f(i.difference(e))},symmetricDifference:function(e){return f(i.symmetricDifference(e))},intersection:function(e){return f(i.intersection(e))}}};export{r as useSet};
3
3
  //# sourceMappingURL=useSet.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.53 */
2
- import{d as r,e as a,b as e}from"../../_rollupPluginBabelHelpers-CIuCCT6y.js";var n=function(n){var t=navigator&&"share"in navigator,s=function(){var s=r(a().mark((function r(s){var i;return a().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(t){r.next=2;break}return r.abrupt("return");case 2:return(i=e(e({},n),s)).files&&navigator.canShare({files:i.files})&&navigator.share(i),r.abrupt("return",navigator.share(i));case 5:case"end":return r.stop()}}),r)})));return function(r){return s.apply(this,arguments)}}();return{share:s,supported:t}};export{n as useShare};
1
+ /* @license @siberiacancode/reactuse v0.0.55 */
2
+ import{d as r,e as a,b as e}from"../../_rollupPluginBabelHelpers--yEi7JQy.js";var n=function(n){var t=navigator&&"share"in navigator,s=function(){var s=r(a().mark((function r(s){var i;return a().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(t){r.next=2;break}return r.abrupt("return");case 2:return(i=e(e({},n),s)).files&&navigator.canShare({files:i.files})&&navigator.share(i),r.abrupt("return",navigator.share(i));case 5:case"end":return r.stop()}}),r)})));return function(r){return s.apply(this,arguments)}}();return{share:s,supported:t}};export{n as useShare};
3
3
  //# sourceMappingURL=useShare.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.53 */
2
- import{c as t,_ as r}from"../../_rollupPluginBabelHelpers-CIuCCT6y.js";import{useRef as n,useState as e}from"react";var i=function(i){var u="object"===t(i)?i.max:i,o="object"===t(i)?i.initial:1,c=n(o>u||o<1?1:o),s=e(o),a=r(s,2),f=a[0],l=a[1],p=1===f,m=f===u;return{counts:u,currentStep:f,isFirst:p,isLast:m,next:function(){m||l((function(t){return t+1}))},back:function(){p||l((function(t){return t-1}))},reset:function(){return l(c.current)},set:function(t){return"first"===t?l(c.current):"last"===t||t>=u?l(u):t<=1?l(1):void l(t)}}};export{i as useStep};
1
+ /* @license @siberiacancode/reactuse v0.0.55 */
2
+ import{c as t,_ as r}from"../../_rollupPluginBabelHelpers--yEi7JQy.js";import{useRef as n,useState as e}from"react";var i=function(i){var u="object"===t(i)?i.max:i,o="object"===t(i)?i.initial:1,c=n(o>u||o<1?1:o),s=e(o),a=r(s,2),f=a[0],l=a[1],p=1===f,m=f===u;return{counts:u,currentStep:f,isFirst:p,isLast:m,next:function(){m||l((function(t){return t+1}))},back:function(){p||l((function(t){return t-1}))},reset:function(){return l(c.current)},set:function(t){return"first"===t?l(c.current):"last"===t||t>=u?l(u):t<=1?l(1):void l(t)}}};export{i as useStep};
3
3
  //# sourceMappingURL=useStep.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.53 */
2
- import{_ as n,b as t}from"../../_rollupPluginBabelHelpers-CIuCCT6y.js";import{useState as r,useEffect as o}from"react";import"../../utils/helpers/isClient.js";import{useEvent as e}from"../useEvent/useEvent.js";import"../../index-ngJHDSj5.js";import"react-dom";var u=function(n){return n?{days:Math.floor(n/86400),hours:Math.floor(n%86400/3600),minutes:Math.floor(n%3600/60),seconds:Math.floor(n%60),count:n}:{days:0,hours:0,minutes:0,seconds:0,count:0}},s=function(){for(var s,i,c=arguments.length,a=new Array(c),l=0;l<c;l++)a[l]=arguments[l];var f=null!==(s="number"==typeof a[0]?a[0]:null===(i=a[0])||void 0===i?void 0:i.initialTime)&&void 0!==s?s:0,d="number"==typeof a[0]?a[1]:a[0],m=r(u(f)),p=n(m,2),v=p[0],h=p[1],y=r(!(null!=d&&d.enabled)),b=n(y,2),g=b[0],j=b[1],M=e((function(){var n=v.count+1;return n%60==0?h(t(t({},v),{},{minutes:v.minutes+1,seconds:0,count:n})):n%3600==0?h(t(t({},v),{},{hours:v.hours+1,minutes:0,seconds:0,count:n})):n%86400==0?h(t(t({},v),{},{days:v.days+1,hours:0,minutes:0,seconds:0,count:n})):void h(t(t({},v),{},{seconds:v.seconds+1,count:n}))}));return o((function(){if(!g){var n=setInterval((function(){return M()}),1e3);return function(){return clearInterval(n)}}}),[g]),t(t({},v),{},{paused:g,pause:function(){return j(!0)},start:function(){return j(!1)},reset:function(){return h(u(f))},toggle:function(){return j((function(n){return!n}))}})};export{s as useStopwatch};
1
+ /* @license @siberiacancode/reactuse v0.0.55 */
2
+ import{_ as n,b as t}from"../../_rollupPluginBabelHelpers--yEi7JQy.js";import{useState as r,useEffect as o}from"react";import"../../utils/helpers/isClient.js";import{useEvent as e}from"../useEvent/useEvent.js";import"../../index-5OKmysyE.js";import"react-dom";var u=function(n){return n?{days:Math.floor(n/86400),hours:Math.floor(n%86400/3600),minutes:Math.floor(n%3600/60),seconds:Math.floor(n%60),count:n}:{days:0,hours:0,minutes:0,seconds:0,count:0}},s=function(){for(var s,i,c=arguments.length,a=new Array(c),l=0;l<c;l++)a[l]=arguments[l];var f=null!==(s="number"==typeof a[0]?a[0]:null===(i=a[0])||void 0===i?void 0:i.initialTime)&&void 0!==s?s:0,d="number"==typeof a[0]?a[1]:a[0],m=r(u(f)),p=n(m,2),v=p[0],h=p[1],y=r(!(null!=d&&d.enabled)),b=n(y,2),g=b[0],j=b[1],M=e((function(){var n=v.count+1;return n%60==0?h(t(t({},v),{},{minutes:v.minutes+1,seconds:0,count:n})):n%3600==0?h(t(t({},v),{},{hours:v.hours+1,minutes:0,seconds:0,count:n})):n%86400==0?h(t(t({},v),{},{days:v.days+1,hours:0,minutes:0,seconds:0,count:n})):void h(t(t({},v),{},{seconds:v.seconds+1,count:n}))}));return o((function(){if(!g){var n=setInterval((function(){return M()}),1e3);return function(){return clearInterval(n)}}}),[g]),t(t({},v),{},{paused:g,pause:function(){return j(!0)},start:function(){return j(!1)},reset:function(){return h(u(f))},toggle:function(){return j((function(n){return!n}))}})};export{s as useStopwatch};
3
3
  //# sourceMappingURL=useStopwatch.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useStopwatch.js","sources":["../../../../src/hooks/useStopwatch/useStopwatch.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\nimport { useEvent } from '@/hooks';\n\nconst getStopwatchTime = (time: number) => {\n if (!time)\n return {\n days: 0,\n hours: 0,\n minutes: 0,\n seconds: 0,\n count: 0\n };\n\n const days = Math.floor(time / 86400);\n const hours = Math.floor((time % 86400) / 3600);\n const minutes = Math.floor((time % 3600) / 60);\n const seconds = Math.floor(time % 60);\n\n return { days, hours, minutes, seconds, count: time };\n};\n\n/** The use stopwatch return type */\nexport interface UseStopwatchReturn {\n /** The paused state of the stopwatch */\n paused: boolean;\n /** The over state of the stopwatch */\n over: boolean;\n /** The day count of the stopwatch */\n days: number;\n /** The hour count of the stopwatch */\n hours: number;\n /** The minute count of the stopwatch */\n minutes: number;\n /** The second count of the stopwatch */\n seconds: number;\n /** The total count of the stopwatch */\n count: number;\n /** The function to pause the stopwatch */\n pause: () => void;\n /** The function to start the stopwatch */\n start: () => void;\n /** The function to reset the stopwatch */\n reset: () => void;\n /** The function to toggle the stopwatch */\n toggle: () => void;\n}\n\n/** The use stopwatch options */\nexport interface UseStopwatchOptions {\n /** The enabled state of the timer */\n enabled?: boolean;\n}\n\ntype UseStopwatch = {\n (initialTime?: number, options?: UseStopwatchOptions): UseStopwatchReturn;\n (options?: UseStopwatchOptions & { initialTime?: number }): UseStopwatchReturn;\n};\n/**\n * @name useStopwatch\n * @description - Hook that creates a stopwatch functionality\n *\n * @overload\n * @param {number} [initialTime=0] The initial time of the timer\n * @param {boolean} [options.enabled=true] The enabled state of the timer\n * @returns {UseStopwatchReturn} An object containing the current time and functions to interact with the timer\n *\n * @example\n * const { seconds, minutes, start, pause, reset } = useStopwatch(1000, { enabled: false });\n *\n * @overload\n * @param {number} [options.initialTime=0] -The initial time of the timer\n * @param {boolean} [options.enabled=true] The enabled state of the timer\n * @returns {UseStopwatchReturn} An object containing the current time and functions to interact with the timer\n *\n * @example\n * const { seconds, minutes, start, pause, reset } = useStopwatch({ initialTime: 1000, enabled: false });\n */\nexport const useStopwatch = ((...params: any[]) => {\n const initialTime =\n (typeof params[0] === 'number'\n ? (params[0] as number | undefined)\n : (params[0] as UseStopwatchOptions & { initialTime?: number })?.initialTime) ?? 0;\n\n const options =\n typeof params[0] === 'number'\n ? (params[1] as UseStopwatchOptions | undefined)\n : (params[0] as (UseStopwatchOptions & { initialTime?: number }) | undefined);\n\n const [time, setTime] = useState(getStopwatchTime(initialTime));\n const [paused, setPaused] = useState(!options?.enabled);\n\n const onInterval = useEvent(() => {\n const updatedCount = time.count + 1;\n\n if (updatedCount % 60 === 0) {\n return setTime({\n ...time,\n minutes: time.minutes + 1,\n seconds: 0,\n count: updatedCount\n });\n }\n\n if (updatedCount % (60 * 60) === 0) {\n return setTime({\n ...time,\n hours: time.hours + 1,\n minutes: 0,\n seconds: 0,\n count: updatedCount\n });\n }\n\n if (updatedCount % (60 * 60 * 24) === 0) {\n return setTime({\n ...time,\n days: time.days + 1,\n hours: 0,\n minutes: 0,\n seconds: 0,\n count: updatedCount\n });\n }\n\n setTime({\n ...time,\n seconds: time.seconds + 1,\n count: updatedCount\n });\n });\n\n useEffect(() => {\n if (paused) return;\n const interval = setInterval(() => onInterval(), 1000);\n return () => clearInterval(interval);\n }, [paused]);\n\n return {\n ...time,\n paused,\n pause: () => setPaused(true),\n start: () => setPaused(false),\n reset: () => setTime(getStopwatchTime(initialTime)),\n toggle: () => setPaused((prevPause) => !prevPause)\n };\n}) as UseStopwatch;\n"],"names":["getStopwatchTime","time","days","Math","floor","hours","minutes","seconds","count","useStopwatch","_ref","_params$","_len","arguments","length","params","Array","_key","initialTime","options","_useState","useState","_useState2","_slicedToArray","setTime","_useState3","enabled","_useState4","paused","setPaused","onInterval","useEvent","updatedCount","_objectSpread","useEffect","interval","setInterval","clearInterval","pause","start","reset","toggle","prevPause"],"mappings":";oQAIA,IAAMA,EAAmB,SAACC,GACxB,OAAKA,EAcE,CAAEC,KALIC,KAAKC,MAAMH,EAAO,OAKhBI,MAJDF,KAAKC,MAAOH,EAAO,MAAS,MAIpBK,QAHNH,KAAKC,MAAOH,EAAO,KAAQ,IAGZM,QAFfJ,KAAKC,MAAMH,EAAO,IAEMO,MAAOP,GAbtC,CACLC,KAAM,EACNG,MAAO,EACPC,QAAS,EACTC,QAAS,EACTC,MAAO,EASb,EA0DaC,EAAgB,WAAsB,IAAA,IAAAC,EAAAC,EAAAC,EAAAC,UAAAC,OAAlBC,EAAMC,IAAAA,MAAAJ,GAAAK,EAAA,EAAAA,EAAAL,EAAAK,IAANF,EAAME,GAAAJ,UAAAI,GACrC,IAAMC,EAG0ER,QAH/DA,EACO,iBAAdK,EAAO,GACVA,EAAO,WAAEJ,EACTI,EAAO,UAAE,IAAAJ,OAAA,EAAVA,EAA+DO,mBAAWR,IAAAA,EAAAA,EAAK,EAE/ES,EACiB,iBAAdJ,EAAO,GACTA,EAAO,GACPA,EAAO,GAEdK,EAAwBC,EAASrB,EAAiBkB,IAAaI,EAAAC,EAAAH,EAAA,GAAxDnB,EAAIqB,EAAA,GAAEE,EAAOF,EAAA,GACpBG,EAA4BJ,IAAUF,SAAAA,EAASO,UAAQC,EAAAJ,EAAAE,EAAA,GAAhDG,EAAMD,EAAA,GAAEE,EAASF,EAAA,GAElBG,EAAaC,GAAS,WAC1B,IAAMC,EAAe/B,EAAKO,MAAQ,EAElC,OAAIwB,EAAe,IAAO,EACjBR,EAAOS,EAAAA,KACThC,GAAI,GAAA,CACPK,QAASL,EAAKK,QAAU,EACxBC,QAAS,EACTC,MAAOwB,KAIPA,EAAgB,MAAa,EACxBR,EAAOS,EAAAA,KACThC,GAAI,GAAA,CACPI,MAAOJ,EAAKI,MAAQ,EACpBC,QAAS,EACTC,QAAS,EACTC,MAAOwB,KAIPA,EAAY,OAAsB,EAC7BR,EAAOS,EAAAA,KACThC,GAAI,GAAA,CACPC,KAAMD,EAAKC,KAAO,EAClBG,MAAO,EACPC,QAAS,EACTC,QAAS,EACTC,MAAOwB,UAIXR,EAAOS,EAAAA,KACFhC,GAAI,CAAA,EAAA,CACPM,QAASN,EAAKM,QAAU,EACxBC,MAAOwB,IAEX,IAQA,OANAE,GAAU,WACR,IAAIN,EAAJ,CACA,IAAMO,EAAWC,aAAY,WAAA,OAAMN,GAAY,GAAE,KACjD,OAAO,WAAA,OAAMO,cAAcF,EAAS,CAFxB,CAGd,GAAG,CAACP,IAEJK,EAAAA,EAAA,CAAA,EACKhC,GAAI,CAAA,EAAA,CACP2B,OAAAA,EACAU,MAAO,WAAA,OAAMT,GAAU,EAAK,EAC5BU,MAAO,WAAA,OAAMV,GAAU,EAAM,EAC7BW,MAAO,WAAA,OAAMhB,EAAQxB,EAAiBkB,GAAa,EACnDuB,OAAQ,WAAA,OAAMZ,GAAU,SAACa,GAAS,OAAMA,IAAU,GAEtD"}
1
+ {"version":3,"file":"useStopwatch.js","sources":["../../../../src/hooks/useStopwatch/useStopwatch.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\nimport { useEvent } from '@/hooks';\n\nconst getStopwatchTime = (time: number) => {\n if (!time)\n return {\n days: 0,\n hours: 0,\n minutes: 0,\n seconds: 0,\n count: 0\n };\n\n const days = Math.floor(time / 86400);\n const hours = Math.floor((time % 86400) / 3600);\n const minutes = Math.floor((time % 3600) / 60);\n const seconds = Math.floor(time % 60);\n\n return { days, hours, minutes, seconds, count: time };\n};\n\n/** The use stopwatch return type */\nexport interface UseStopwatchReturn {\n /** The paused state of the stopwatch */\n paused: boolean;\n /** The over state of the stopwatch */\n over: boolean;\n /** The day count of the stopwatch */\n days: number;\n /** The hour count of the stopwatch */\n hours: number;\n /** The minute count of the stopwatch */\n minutes: number;\n /** The second count of the stopwatch */\n seconds: number;\n /** The total count of the stopwatch */\n count: number;\n /** The function to pause the stopwatch */\n pause: () => void;\n /** The function to start the stopwatch */\n start: () => void;\n /** The function to reset the stopwatch */\n reset: () => void;\n /** The function to toggle the stopwatch */\n toggle: () => void;\n}\n\n/** The use stopwatch options */\nexport interface UseStopwatchOptions {\n /** The enabled state of the timer */\n enabled?: boolean;\n}\n\ntype UseStopwatch = {\n (initialTime?: number, options?: UseStopwatchOptions): UseStopwatchReturn;\n (options?: UseStopwatchOptions & { initialTime?: number }): UseStopwatchReturn;\n};\n/**\n * @name useStopwatch\n * @description - Hook that creates a stopwatch functionality\n * @category Time\n *\n * @overload\n * @param {number} [initialTime=0] The initial time of the timer\n * @param {boolean} [options.enabled=true] The enabled state of the timer\n * @returns {UseStopwatchReturn} An object containing the current time and functions to interact with the timer\n *\n * @example\n * const { seconds, minutes, start, pause, reset } = useStopwatch(1000, { enabled: false });\n *\n * @overload\n * @param {number} [options.initialTime=0] -The initial time of the timer\n * @param {boolean} [options.enabled=true] The enabled state of the timer\n * @returns {UseStopwatchReturn} An object containing the current time and functions to interact with the timer\n *\n * @example\n * const { seconds, minutes, start, pause, reset } = useStopwatch({ initialTime: 1000, enabled: false });\n */\nexport const useStopwatch = ((...params: any[]) => {\n const initialTime =\n (typeof params[0] === 'number'\n ? (params[0] as number | undefined)\n : (params[0] as UseStopwatchOptions & { initialTime?: number })?.initialTime) ?? 0;\n\n const options =\n typeof params[0] === 'number'\n ? (params[1] as UseStopwatchOptions | undefined)\n : (params[0] as (UseStopwatchOptions & { initialTime?: number }) | undefined);\n\n const [time, setTime] = useState(getStopwatchTime(initialTime));\n const [paused, setPaused] = useState(!options?.enabled);\n\n const onInterval = useEvent(() => {\n const updatedCount = time.count + 1;\n\n if (updatedCount % 60 === 0) {\n return setTime({\n ...time,\n minutes: time.minutes + 1,\n seconds: 0,\n count: updatedCount\n });\n }\n\n if (updatedCount % (60 * 60) === 0) {\n return setTime({\n ...time,\n hours: time.hours + 1,\n minutes: 0,\n seconds: 0,\n count: updatedCount\n });\n }\n\n if (updatedCount % (60 * 60 * 24) === 0) {\n return setTime({\n ...time,\n days: time.days + 1,\n hours: 0,\n minutes: 0,\n seconds: 0,\n count: updatedCount\n });\n }\n\n setTime({\n ...time,\n seconds: time.seconds + 1,\n count: updatedCount\n });\n });\n\n useEffect(() => {\n if (paused) return;\n const interval = setInterval(() => onInterval(), 1000);\n return () => clearInterval(interval);\n }, [paused]);\n\n return {\n ...time,\n paused,\n pause: () => setPaused(true),\n start: () => setPaused(false),\n reset: () => setTime(getStopwatchTime(initialTime)),\n toggle: () => setPaused((prevPause) => !prevPause)\n };\n}) as UseStopwatch;\n"],"names":["getStopwatchTime","time","days","Math","floor","hours","minutes","seconds","count","useStopwatch","_ref","_params$","_len","arguments","length","params","Array","_key","initialTime","options","_useState","useState","_useState2","_slicedToArray","setTime","_useState3","enabled","_useState4","paused","setPaused","onInterval","useEvent","updatedCount","_objectSpread","useEffect","interval","setInterval","clearInterval","pause","start","reset","toggle","prevPause"],"mappings":";oQAIA,IAAMA,EAAmB,SAACC,GACxB,OAAKA,EAcE,CAAEC,KALIC,KAAKC,MAAMH,EAAO,OAKhBI,MAJDF,KAAKC,MAAOH,EAAO,MAAS,MAIpBK,QAHNH,KAAKC,MAAOH,EAAO,KAAQ,IAGZM,QAFfJ,KAAKC,MAAMH,EAAO,IAEMO,MAAOP,GAbtC,CACLC,KAAM,EACNG,MAAO,EACPC,QAAS,EACTC,QAAS,EACTC,MAAO,EASb,EA2DaC,EAAgB,WAAsB,IAAA,IAAAC,EAAAC,EAAAC,EAAAC,UAAAC,OAAlBC,EAAMC,IAAAA,MAAAJ,GAAAK,EAAA,EAAAA,EAAAL,EAAAK,IAANF,EAAME,GAAAJ,UAAAI,GACrC,IAAMC,EAG0ER,QAH/DA,EACO,iBAAdK,EAAO,GACVA,EAAO,WAAEJ,EACTI,EAAO,UAAE,IAAAJ,OAAA,EAAVA,EAA+DO,mBAAWR,IAAAA,EAAAA,EAAK,EAE/ES,EACiB,iBAAdJ,EAAO,GACTA,EAAO,GACPA,EAAO,GAEdK,EAAwBC,EAASrB,EAAiBkB,IAAaI,EAAAC,EAAAH,EAAA,GAAxDnB,EAAIqB,EAAA,GAAEE,EAAOF,EAAA,GACpBG,EAA4BJ,IAAUF,SAAAA,EAASO,UAAQC,EAAAJ,EAAAE,EAAA,GAAhDG,EAAMD,EAAA,GAAEE,EAASF,EAAA,GAElBG,EAAaC,GAAS,WAC1B,IAAMC,EAAe/B,EAAKO,MAAQ,EAElC,OAAIwB,EAAe,IAAO,EACjBR,EAAOS,EAAAA,KACThC,GAAI,GAAA,CACPK,QAASL,EAAKK,QAAU,EACxBC,QAAS,EACTC,MAAOwB,KAIPA,EAAgB,MAAa,EACxBR,EAAOS,EAAAA,KACThC,GAAI,GAAA,CACPI,MAAOJ,EAAKI,MAAQ,EACpBC,QAAS,EACTC,QAAS,EACTC,MAAOwB,KAIPA,EAAY,OAAsB,EAC7BR,EAAOS,EAAAA,KACThC,GAAI,GAAA,CACPC,KAAMD,EAAKC,KAAO,EAClBG,MAAO,EACPC,QAAS,EACTC,QAAS,EACTC,MAAOwB,UAIXR,EAAOS,EAAAA,KACFhC,GAAI,CAAA,EAAA,CACPM,QAASN,EAAKM,QAAU,EACxBC,MAAOwB,IAEX,IAQA,OANAE,GAAU,WACR,IAAIN,EAAJ,CACA,IAAMO,EAAWC,aAAY,WAAA,OAAMN,GAAY,GAAE,KACjD,OAAO,WAAA,OAAMO,cAAcF,EAAS,CAFxB,CAGd,GAAG,CAACP,IAEJK,EAAAA,EAAA,CAAA,EACKhC,GAAI,CAAA,EAAA,CACP2B,OAAAA,EACAU,MAAO,WAAA,OAAMT,GAAU,EAAK,EAC5BU,MAAO,WAAA,OAAMV,GAAU,EAAM,EAC7BW,MAAO,WAAA,OAAMhB,EAAQxB,EAAiBkB,GAAa,EACnDuB,OAAQ,WAAA,OAAMZ,GAAU,SAACa,GAAS,OAAMA,IAAU,GAEtD"}
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.53 */
2
- import{c as e}from"../../_rollupPluginBabelHelpers-CIuCCT6y.js";import{useSyncExternalStore as n}from"react";import{isClient as t}from"../../utils/helpers/isClient.js";import{useIsomorphicLayoutEffect as r}from"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";var i=function(e){return window.dispatchEvent(new StorageEvent("storage",e))},o=function(e,n,t){var r=e.getItem(n);e.setItem(n,t),i({key:n,oldValue:r,newValue:t,storageArea:e})},u=function(e,n){var t=e.getItem(n);e.removeItem(n),i({key:n,oldValue:t,newValue:null,storageArea:e})},a=function(e,n){var t=e.getItem(n);if(t)return t},l=function(e){return window.addEventListener("storage",e),function(){return window.removeEventListener("storage",e)}},f=function(){},s=function(i,s){var c,d="object"===e(s)?s:void 0,v=d?null==d?void 0:d.initialValue:s,m=null!==(c=null==d?void 0:d.storage)&&void 0!==c?c:window.localStorage,g=function(e){return null!=d&&d.serializer?d.serializer(e):JSON.stringify(e)},p=n(l,(function(){return a(m,i)}),f),w=function(e){if(null===e)return u(m,i);o(m,i,g(e))};r((function(){(void 0===a(m,i)||v)&&o(m,i,g(v instanceof Function?v():v))}),[i]);var I=function(){return u(m,i)};return t?[p?function(e){if(null!=d&&d.deserializer)return d.deserializer(e);if("undefined"!==e)try{return JSON.parse(e)}catch(n){return e}}(p):void 0,w,I]:[v instanceof Function?v():v,w,I]};export{i as dispatchStorageEvent,s as useStorage};
1
+ /* @license @siberiacancode/reactuse v0.0.55 */
2
+ import{c as e}from"../../_rollupPluginBabelHelpers--yEi7JQy.js";import{useSyncExternalStore as n}from"react";import{isClient as t}from"../../utils/helpers/isClient.js";import{useIsomorphicLayoutEffect as r}from"../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js";var o=function(e){return window.dispatchEvent(new StorageEvent("storage",e))},i=function(e,n,t){var r=e.getItem(n);e.setItem(n,t),o({key:n,oldValue:r,newValue:t,storageArea:e})},u=function(e,n){var t=e.getItem(n);e.removeItem(n),o({key:n,oldValue:t,newValue:null,storageArea:e})},a=function(e,n){var t=e.getItem(n);if(t)return t},l=function(e){return window.addEventListener("storage",e),function(){return window.removeEventListener("storage",e)}},s=function(){},f=function(o,f){var c,v="object"===e(f)?f:void 0,d=v?null==v?void 0:v.initialValue:f,m=null!==(c=null==v?void 0:v.storage)&&void 0!==c?c:window.localStorage,g=function(e){return null!=v&&v.serializer?v.serializer(e):JSON.stringify(e)},p=n(l,(function(){return a(m,o)}),s),w=function(e){if(null===e)return u(m,o);i(m,o,g(e))};r((function(){void 0===a(m,o)&&void 0!==d&&i(m,o,g(d instanceof Function?d():d))}),[o]);var I=function(){return u(m,o)};return t?{value:p?function(e){if(null!=v&&v.deserializer)return v.deserializer(e);if("undefined"!==e)try{return JSON.parse(e)}catch(n){return e}}(p):void 0,set:w,remove:I}:{value:d instanceof Function?d():d,set:w,remove:I}};export{o as dispatchStorageEvent,f as useStorage};
3
3
  //# sourceMappingURL=useStorage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useStorage.js","sources":["../../../../src/hooks/useStorage/useStorage.ts"],"sourcesContent":["import { useSyncExternalStore } from 'react';\n\nimport { isClient } from '@/utils/helpers';\n\nimport { useIsomorphicLayoutEffect } from '../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect';\n\nexport type UseStorageInitialValue<Value> = Value | (() => Value);\nexport interface UseStorageOptions<Value> {\n serializer?: (value: Value) => string;\n deserializer?: (value: string) => Value;\n storage?: Storage;\n initialValue?: UseStorageInitialValue<Value>;\n}\n\nexport type UseStorageReturn<Value> = [\n value: Value,\n set: (value: Value) => void,\n remove: () => void\n];\n\nexport const dispatchStorageEvent = (params: Partial<StorageEvent>) =>\n window.dispatchEvent(new StorageEvent('storage', params));\n\nconst setStorageItem = (storage: Storage, key: string, value: string) => {\n const oldValue = storage.getItem(key);\n\n storage.setItem(key, value);\n dispatchStorageEvent({ key, oldValue, newValue: value, storageArea: storage });\n};\n\nconst removeStorageItem = (storage: Storage, key: string) => {\n const oldValue = storage.getItem(key);\n\n storage.removeItem(key);\n dispatchStorageEvent({ key, oldValue, newValue: null, storageArea: storage });\n};\n\nconst getStorageItem = (storage: Storage, key: string) => {\n const value = storage.getItem(key);\n if (!value) return undefined;\n return value;\n};\n\nconst storageSubscribe = (callback: () => void) => {\n window.addEventListener('storage', callback);\n return () => window.removeEventListener('storage', callback);\n};\n\nconst getServerSnapshot = () => undefined;\n\nexport const useStorage = <Value>(\n key: string,\n params?: UseStorageInitialValue<Value> | UseStorageOptions<Value>\n) => {\n const options = (typeof params === 'object' ? params : undefined) as UseStorageOptions<Value>;\n const initialValue = (options ? options?.initialValue : params) as UseStorageInitialValue<Value>;\n\n const storage = options?.storage ?? window.localStorage;\n const serializer = (value: Value) => {\n if (options?.serializer) return options.serializer(value);\n return JSON.stringify(value);\n };\n\n const deserializer = (value: string) => {\n if (options?.deserializer) return options.deserializer(value);\n\n if (value === 'undefined') {\n return undefined as unknown as Value;\n }\n\n try {\n return JSON.parse(value) as Value;\n } catch (error) {\n return value as Value;\n }\n };\n\n const getSnapshot = () => getStorageItem(storage, key);\n const store = useSyncExternalStore(storageSubscribe, getSnapshot, getServerSnapshot);\n\n const set = (value: Value) => {\n if (value === null) return removeStorageItem(storage, key);\n setStorageItem(storage, key, serializer(value));\n };\n\n useIsomorphicLayoutEffect(() => {\n const value = getStorageItem(storage, key);\n if (value !== undefined && !initialValue) return;\n\n setStorageItem(\n storage,\n key,\n serializer(initialValue instanceof Function ? initialValue() : initialValue)\n );\n }, [key]);\n\n const remove = () => removeStorageItem(storage, key);\n\n if (!isClient)\n return [initialValue instanceof Function ? initialValue() : initialValue, set, remove] as const;\n return [store ? deserializer(store) : undefined, set, remove] as const;\n};\n"],"names":["dispatchStorageEvent","params","window","dispatchEvent","StorageEvent","setStorageItem","storage","key","value","oldValue","getItem","setItem","newValue","storageArea","removeStorageItem","removeItem","getStorageItem","storageSubscribe","callback","addEventListener","removeEventListener","getServerSnapshot","useStorage","_options$storage","options","_typeof","undefined","initialValue","localStorage","serializer","JSON","stringify","store","useSyncExternalStore","set","useIsomorphicLayoutEffect","Function","remove","isClient","deserializer","parse","error"],"mappings":";kRAoBaA,EAAuB,SAACC,GAA6B,OAChEC,OAAOC,cAAc,IAAIC,aAAa,UAAWH,GAAQ,EAErDI,EAAiB,SAACC,EAAkBC,EAAaC,GACrD,IAAMC,EAAWH,EAAQI,QAAQH,GAEjCD,EAAQK,QAAQJ,EAAKC,GACrBR,EAAqB,CAAEO,IAAAA,EAAKE,SAAAA,EAAUG,SAAUJ,EAAOK,YAAaP,GACtE,EAEMQ,EAAoB,SAACR,EAAkBC,GAC3C,IAAME,EAAWH,EAAQI,QAAQH,GAEjCD,EAAQS,WAAWR,GACnBP,EAAqB,CAAEO,IAAAA,EAAKE,SAAAA,EAAUG,SAAU,KAAMC,YAAaP,GACrE,EAEMU,EAAiB,SAACV,EAAkBC,GACxC,IAAMC,EAAQF,EAAQI,QAAQH,GAC9B,GAAKC,EACL,OAAOA,CACT,EAEMS,EAAmB,SAACC,GAExB,OADAhB,OAAOiB,iBAAiB,UAAWD,GAC5B,WAAA,OAAMhB,OAAOkB,oBAAoB,UAAWF,EAAS,CAC9D,EAEMG,EAAoB,WAAe,EAE5BC,EAAa,SACxBf,EACAN,GACG,IAAAsB,EACGC,EAA6B,WAAlBC,EAAOxB,GAAsBA,OAASyB,EACjDC,EAAgBH,EAAUA,aAAO,EAAPA,EAASG,aAAe1B,EAElDK,UAAOiB,EAAGC,aAAAA,EAAAA,EAASlB,eAAO,IAAAiB,EAAAA,EAAIrB,OAAO0B,aACrCC,EAAa,SAACrB,GAClB,OAAIgB,SAAAA,EAASK,WAAmBL,EAAQK,WAAWrB,GAC5CsB,KAAKC,UAAUvB,IAkBlBwB,EAAQC,EAAqBhB,GADf,WAAH,OAASD,EAAeV,EAASC,EAAI,GACYc,GAE5Da,EAAM,SAAC1B,GACX,GAAc,OAAVA,EAAgB,OAAOM,EAAkBR,EAASC,GACtDF,EAAeC,EAASC,EAAKsB,EAAWrB,KAG1C2B,GAA0B,iBAEVT,IADAV,EAAeV,EAASC,IACVoB,IAE5BtB,EACEC,EACAC,EACAsB,EAAWF,aAAwBS,SAAWT,IAAiBA,GAEnE,GAAG,CAACpB,IAEJ,IAAM8B,EAAS,WAAH,OAASvB,EAAkBR,EAASC,EAAI,EAEpD,OAAK+B,EAEE,CAACN,EArCa,SAACxB,GACpB,GAAIgB,SAAAA,EAASe,aAAc,OAAOf,EAAQe,aAAa/B,GAEvD,GAAc,cAAVA,EAIJ,IACE,OAAOsB,KAAKU,MAAMhC,EACnB,CAAC,MAAOiC,GACP,OAAOjC,CACT,EA0Bc+B,CAAaP,QAASN,EAAWQ,EAAKG,GAD7C,CAACV,aAAwBS,SAAWT,IAAiBA,EAAcO,EAAKG,EAEnF"}
1
+ {"version":3,"file":"useStorage.js","sources":["../../../../src/hooks/useStorage/useStorage.ts"],"sourcesContent":["import { useSyncExternalStore } from 'react';\n\nimport { isClient } from '@/utils/helpers';\n\nimport { useIsomorphicLayoutEffect } from '../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect';\n\n/* The use storage initial value type */\nexport type UseStorageInitialValue<Value> = Value | (() => Value);\n\n/* The use storage options type */\nexport interface UseStorageOptions<Value> {\n /* The serializer function to be invoked */\n serializer?: (value: Value) => string;\n /* The deserializer function to be invoked */\n deserializer?: (value: string) => Value;\n /* The storage to be used */\n storage?: Storage;\n /* The initial value of the storage */\n initialValue?: UseStorageInitialValue<Value>;\n}\n\n/* The use storage return type */\nexport type UseStorageReturn<Value> = {\n /* The value of the storage */\n value: Value;\n /* The loading state of the storage */\n set: (value: Value) => void;\n /* The error state of the storage */\n remove: () => void;\n};\n\nexport const dispatchStorageEvent = (params: Partial<StorageEvent>) =>\n window.dispatchEvent(new StorageEvent('storage', params));\n\nconst setStorageItem = (storage: Storage, key: string, value: string) => {\n const oldValue = storage.getItem(key);\n\n storage.setItem(key, value);\n dispatchStorageEvent({ key, oldValue, newValue: value, storageArea: storage });\n};\n\nconst removeStorageItem = (storage: Storage, key: string) => {\n const oldValue = storage.getItem(key);\n\n storage.removeItem(key);\n dispatchStorageEvent({ key, oldValue, newValue: null, storageArea: storage });\n};\n\nconst getStorageItem = (storage: Storage, key: string) => {\n const value = storage.getItem(key);\n if (!value) return undefined;\n return value;\n};\n\nconst storageSubscribe = (callback: () => void) => {\n window.addEventListener('storage', callback);\n return () => window.removeEventListener('storage', callback);\n};\n\nconst getServerSnapshot = () => undefined;\n\n/**\n * @name useStorage\n * @description - Hook that manages storage value\n * @category Utilities\n *\n * @param {string} key The key of the storage\n * @param {(value: Value) => string} [params.serializer] The serializer function\n * @param {(value: string) => Value} [params.deserializer] The deserializer function\n * @param {Storage} [params.storage] The storage\n * @param {UseStorageInitialValue<Value>} [params.initialValue] The initial value of the storage\n * @returns {UseStorageReturn<Value>} The value and the set function\n *\n * @example\n * const { value, set, remove } = useStorage('key', 'value');\n */\nexport const useStorage = <Value>(\n key: string,\n params?: UseStorageInitialValue<Value> | UseStorageOptions<Value>\n) => {\n const options = (typeof params === 'object' ? params : undefined) as UseStorageOptions<Value>;\n const initialValue = (options ? options?.initialValue : params) as UseStorageInitialValue<Value>;\n\n const storage = options?.storage ?? window.localStorage;\n const serializer = (value: Value) => {\n if (options?.serializer) return options.serializer(value);\n return JSON.stringify(value);\n };\n\n const deserializer = (value: string) => {\n if (options?.deserializer) return options.deserializer(value);\n\n if (value === 'undefined') {\n return undefined as unknown as Value;\n }\n\n try {\n return JSON.parse(value) as Value;\n } catch (error) {\n return value as Value;\n }\n };\n\n const getSnapshot = () => getStorageItem(storage, key);\n const store = useSyncExternalStore(storageSubscribe, getSnapshot, getServerSnapshot);\n\n const set = (value: Value) => {\n if (value === null) return removeStorageItem(storage, key);\n setStorageItem(storage, key, serializer(value));\n };\n\n useIsomorphicLayoutEffect(() => {\n const value = getStorageItem(storage, key);\n if (value === undefined && initialValue !== undefined) {\n setStorageItem(\n storage,\n key,\n serializer(initialValue instanceof Function ? initialValue() : initialValue)\n );\n }\n }, [key]);\n\n const remove = () => removeStorageItem(storage, key);\n\n if (!isClient)\n return {\n value: initialValue instanceof Function ? initialValue() : initialValue,\n set,\n remove\n };\n return {\n value: store ? deserializer(store) : undefined,\n set,\n remove\n };\n};\n"],"names":["dispatchStorageEvent","params","window","dispatchEvent","StorageEvent","setStorageItem","storage","key","value","oldValue","getItem","setItem","newValue","storageArea","removeStorageItem","removeItem","getStorageItem","storageSubscribe","callback","addEventListener","removeEventListener","getServerSnapshot","useStorage","_options$storage","options","_typeof","undefined","initialValue","localStorage","serializer","JSON","stringify","store","useSyncExternalStore","set","useIsomorphicLayoutEffect","Function","remove","isClient","deserializer","parse","error"],"mappings":";kRA+BaA,EAAuB,SAACC,GAA6B,OAChEC,OAAOC,cAAc,IAAIC,aAAa,UAAWH,GAAQ,EAErDI,EAAiB,SAACC,EAAkBC,EAAaC,GACrD,IAAMC,EAAWH,EAAQI,QAAQH,GAEjCD,EAAQK,QAAQJ,EAAKC,GACrBR,EAAqB,CAAEO,IAAAA,EAAKE,SAAAA,EAAUG,SAAUJ,EAAOK,YAAaP,GACtE,EAEMQ,EAAoB,SAACR,EAAkBC,GAC3C,IAAME,EAAWH,EAAQI,QAAQH,GAEjCD,EAAQS,WAAWR,GACnBP,EAAqB,CAAEO,IAAAA,EAAKE,SAAAA,EAAUG,SAAU,KAAMC,YAAaP,GACrE,EAEMU,EAAiB,SAACV,EAAkBC,GACxC,IAAMC,EAAQF,EAAQI,QAAQH,GAC9B,GAAKC,EACL,OAAOA,CACT,EAEMS,EAAmB,SAACC,GAExB,OADAhB,OAAOiB,iBAAiB,UAAWD,GAC5B,WAAA,OAAMhB,OAAOkB,oBAAoB,UAAWF,EAAS,CAC9D,EAEMG,EAAoB,WAAe,EAiB5BC,EAAa,SACxBf,EACAN,GACG,IAAAsB,EACGC,EAA6B,WAAlBC,EAAOxB,GAAsBA,OAASyB,EACjDC,EAAgBH,EAAUA,aAAO,EAAPA,EAASG,aAAe1B,EAElDK,UAAOiB,EAAGC,aAAAA,EAAAA,EAASlB,eAAO,IAAAiB,EAAAA,EAAIrB,OAAO0B,aACrCC,EAAa,SAACrB,GAClB,OAAIgB,SAAAA,EAASK,WAAmBL,EAAQK,WAAWrB,GAC5CsB,KAAKC,UAAUvB,IAkBlBwB,EAAQC,EAAqBhB,GADf,WAAH,OAASD,EAAeV,EAASC,EAAI,GACYc,GAE5Da,EAAM,SAAC1B,GACX,GAAc,OAAVA,EAAgB,OAAOM,EAAkBR,EAASC,GACtDF,EAAeC,EAASC,EAAKsB,EAAWrB,KAG1C2B,GAA0B,gBAEVT,IADAV,EAAeV,EAASC,SACMmB,IAAjBC,GACzBtB,EACEC,EACAC,EACAsB,EAAWF,aAAwBS,SAAWT,IAAiBA,GAGrE,GAAG,CAACpB,IAEJ,IAAM8B,EAAS,WAAH,OAASvB,EAAkBR,EAASC,EAAI,EAEpD,OAAK+B,EAME,CACL9B,MAAOwB,EA1CY,SAACxB,GACpB,GAAIgB,SAAAA,EAASe,aAAc,OAAOf,EAAQe,aAAa/B,GAEvD,GAAc,cAAVA,EAIJ,IACE,OAAOsB,KAAKU,MAAMhC,EACnB,CAAC,MAAOiC,GACP,OAAOjC,CACT,EA+Be+B,CAAaP,QAASN,EACrCQ,IAAAA,EACAG,OAAAA,GARO,CACL7B,MAAOmB,aAAwBS,SAAWT,IAAiBA,EAC3DO,IAAAA,EACAG,OAAAA,EAON"}
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.53 */
2
- import{_ as e}from"../../_rollupPluginBabelHelpers-CIuCCT6y.js";import{useState as n,useEffect as t}from"react";import{isClient as r}from"../../utils/helpers/isClient.js";import{useRerender as o}from"../useRerender/useRerender.js";var u=function(e){var n,t=null!==(n=e.rangeCount)&&void 0!==n?n:0;return Array.from({length:t},(function(n,t){return e.getRangeAt(t)}))},i=function(){var i,l=o(),c=n(r?document.getSelection():null),a=e(c,2),s=a[0],m=a[1];t((function(){var e=function(){m(document.getSelection()),l.update()};return document.addEventListener("selectionchange",e),function(){return document.removeEventListener("selectionchange",e)}}),[]);var d=null!==(i=null==s?void 0:s.toString())&&void 0!==i?i:"",g=s?u(s):[],f=g.map((function(e){return e.getBoundingClientRect()}));return{text:d,ranges:g,rects:f,selection:s}};export{u as getRangesSelection,i as useTextSelection};
1
+ /* @license @siberiacancode/reactuse v0.0.55 */
2
+ import{_ as e}from"../../_rollupPluginBabelHelpers--yEi7JQy.js";import{useState as n,useEffect as t}from"react";import{isClient as r}from"../../utils/helpers/isClient.js";import{useRerender as o}from"../useRerender/useRerender.js";var u=function(e){var n,t=null!==(n=e.rangeCount)&&void 0!==n?n:0;return Array.from({length:t},(function(n,t){return e.getRangeAt(t)}))},i=function(){var i,l=o(),c=n(r?document.getSelection():null),a=e(c,2),s=a[0],m=a[1];t((function(){var e=function(){m(document.getSelection()),l.update()};return document.addEventListener("selectionchange",e),function(){return document.removeEventListener("selectionchange",e)}}),[]);var d=null!==(i=null==s?void 0:s.toString())&&void 0!==i?i:"",g=s?u(s):[],f=g.map((function(e){return e.getBoundingClientRect()}));return{text:d,ranges:g,rects:f,selection:s}};export{u as getRangesSelection,i as useTextSelection};
3
3
  //# sourceMappingURL=useTextSelection.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.53 */
2
- import{_ as e}from"../../_rollupPluginBabelHelpers-CIuCCT6y.js";import{useState as r}from"react";import"../../utils/helpers/isClient.js";import{getDate as t}from"../../utils/helpers/time/getDate.js";import{useInterval as s}from"../useInterval/useInterval.js";import"../useEvent/useEvent.js";var i=function(){var i=r(t()),o=e(i,2),l=o[0],n=o[1];return s((function(){return n(t())}),1e3),l};export{i as useTime};
1
+ /* @license @siberiacancode/reactuse v0.0.55 */
2
+ import{_ as e}from"../../_rollupPluginBabelHelpers--yEi7JQy.js";import{useState as r}from"react";import"../../utils/helpers/isClient.js";import{getDate as t}from"../../utils/helpers/time/getDate.js";import{useInterval as s}from"../useInterval/useInterval.js";import"../useEvent/useEvent.js";var i=function(){var i=r(t()),o=e(i,2),l=o[0],n=o[1];return s((function(){return n(t())}),1e3),l};export{i as useTime};
3
3
  //# sourceMappingURL=useTime.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.53 */
2
- import{_ as r}from"../../_rollupPluginBabelHelpers-CIuCCT6y.js";import{useState as e,useRef as t,useEffect as n}from"react";import{useEvent as u}from"../useEvent/useEvent.js";function o(o,c){var i=e(!1),m=r(i,2),a=m[0],f=m[1],l=t(),s=u(o);n((function(){return l.current=setTimeout((function(){s(),f(!0)}),c),function(){clearTimeout(l.current)}}),[c]);return{ready:a,clear:function(){clearTimeout(l.current),f(!0)}}}export{o as useTimeout};
1
+ /* @license @siberiacancode/reactuse v0.0.55 */
2
+ import{_ as r}from"../../_rollupPluginBabelHelpers--yEi7JQy.js";import{useState as e,useRef as t,useEffect as n}from"react";import{useEvent as u}from"../useEvent/useEvent.js";function o(o,c){var i=e(!1),m=r(i,2),a=m[0],f=m[1],l=t(),s=u(o);n((function(){return l.current=setTimeout((function(){s(),f(!0)}),c),function(){clearTimeout(l.current)}}),[c]);return{ready:a,clear:function(){clearTimeout(l.current),f(!0)}}}export{o as useTimeout};
3
3
  //# sourceMappingURL=useTimeout.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.53 */
2
- import{_ as r}from"../../_rollupPluginBabelHelpers-CIuCCT6y.js";import{useReducer as n}from"react";var t=function(){var t=n((function(r,n){var t=n instanceof Function?n(r[0]):n,e=Math.abs(r.indexOf(t));return r.slice(e).concat(r.slice(0,e))}),arguments.length>0&&void 0!==arguments[0]?arguments[0]:[!1,!0]),e=r(t,2);return[r(e[0],1)[0],e[1]]};export{t as useToggle};
1
+ /* @license @siberiacancode/reactuse v0.0.55 */
2
+ import{_ as r}from"../../_rollupPluginBabelHelpers--yEi7JQy.js";import{useReducer as n}from"react";var t=function(){var t=n((function(r,n){var t=n instanceof Function?n(r[0]):n,e=Math.abs(r.indexOf(t));return r.slice(e).concat(r.slice(0,e))}),arguments.length>0&&void 0!==arguments[0]?arguments[0]:[!1,!0]),e=r(t,2);return[r(e[0],1)[0],e[1]]};export{t as useToggle};
3
3
  //# sourceMappingURL=useToggle.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.53 */
1
+ /* @license @siberiacancode/reactuse v0.0.55 */
2
2
  import{useRef as r,useEffect as n}from"react";var t=function(t){var c=r(t);c.current=t,n((function(){return function(){c.current()}}),[])};export{t as useUnmount};
3
3
  //# sourceMappingURL=useUnmount.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.53 */
2
- import{_ as n}from"../../_rollupPluginBabelHelpers-CIuCCT6y.js";import{useRef as r,useState as e,useEffect as o}from"react";import{getRetry as t}from"../../utils/helpers/getRetry.js";import"../../utils/helpers/isClient.js";import{useEvent as l}from"../useEvent/useEvent.js";var u=function(u,c){var i=r(),s=r(null!=c&&c.retry?t(c.retry):0),v=r(!1),a=e("connecting"),d=n(a,2),f=d[0],p=d[1],m=l((function(){i.current=new WebSocket("function"==typeof u?u():u,null==c?void 0:c.protocols),p("connecting");var n=i.current;n&&(n.onopen=function(){var r;p("connected"),null==c||null===(r=c.onConnected)||void 0===r||r.call(c,n)},n.onerror=function(r){var e;p("failed"),null==c||null===(e=c.onError)||void 0===e||e.call(c,r,n)},n.onmessage=function(r){var e;return null==c||null===(e=c.onMessage)||void 0===e?void 0:e.call(c,r,n)},n.onclose=function(r){var e;if(p("disconnected"),null==c||null===(e=c.onDisconnected)||void 0===e||e.call(c,r,n),!v.current)return s.current>0?(s.current-=1,m()):void(s.current=null!=c&&c.retry?t(c.retry):0)})}));o((function(){return m(),function(){i.current&&(i.current.close(),i.current=void 0)}}),[u]);return{client:i.current,close:function(){var n;v.current=!0,null===(n=i.current)||void 0===n||n.close()},open:function(){v.current=!1,m()},send:function(n){var r;return null===(r=i.current)||void 0===r?void 0:r.send(n)},status:f}};export{u as useWebSocket};
1
+ /* @license @siberiacancode/reactuse v0.0.55 */
2
+ import{_ as n}from"../../_rollupPluginBabelHelpers--yEi7JQy.js";import{useRef as r,useState as e,useEffect as o}from"react";import{getRetry as t}from"../../utils/helpers/getRetry.js";import"../../utils/helpers/isClient.js";import{useEvent as l}from"../useEvent/useEvent.js";var u=function(u,c){var i=r(),s=r(null!=c&&c.retry?t(c.retry):0),v=r(!1),a=e("connecting"),d=n(a,2),f=d[0],p=d[1],m=l((function(){i.current=new WebSocket("function"==typeof u?u():u,null==c?void 0:c.protocols),p("connecting");var n=i.current;n&&(n.onopen=function(){var r;p("connected"),null==c||null===(r=c.onConnected)||void 0===r||r.call(c,n)},n.onerror=function(r){var e;p("failed"),null==c||null===(e=c.onError)||void 0===e||e.call(c,r,n)},n.onmessage=function(r){var e;return null==c||null===(e=c.onMessage)||void 0===e?void 0:e.call(c,r,n)},n.onclose=function(r){var e;if(p("disconnected"),null==c||null===(e=c.onDisconnected)||void 0===e||e.call(c,r,n),!v.current)return s.current>0?(s.current-=1,m()):void(s.current=null!=c&&c.retry?t(c.retry):0)})}));o((function(){return m(),function(){i.current&&(i.current.close(),i.current=void 0)}}),[u]);return{client:i.current,close:function(){var n;v.current=!0,null===(n=i.current)||void 0===n||n.close()},open:function(){v.current=!1,m()},send:function(n){var r;return null===(r=i.current)||void 0===r?void 0:r.send(n)},status:f}};export{u as useWebSocket};
3
3
  //# sourceMappingURL=useWebSocket.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.53 */
1
+ /* @license @siberiacancode/reactuse v0.0.55 */
2
2
  import{useEventListener as e}from"../useEventListener/useEventListener.js";import"react";import"../useEvent/useEvent.js";var t=function(t,r,n){return e(window,t,r,n)};export{t as useWindowEvent};
3
3
  //# sourceMappingURL=useWindowEvent.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.53 */
2
- import{_ as r}from"../../_rollupPluginBabelHelpers-CIuCCT6y.js";import{useState as o,useEffect as e}from"react";import{isClient as n}from"../../utils/helpers/isClient.js";var i=function(r){var o=r.x,e=r.y,n=r.behavior,i={behavior:void 0===n?"smooth":n};"number"==typeof o&&(i.left=o),"number"==typeof e&&(i.top=e),window.scrollTo(i)},t=function(){var t=o({x:n?window.scrollX:Number.POSITIVE_INFINITY,y:n?window.scrollY:Number.POSITIVE_INFINITY}),l=r(t,2),s=l[0],w=l[1];return e((function(){var r=function(){return w({x:window.scrollX,y:window.scrollY})};return window.addEventListener("scroll",r),window.addEventListener("resize",r),function(){window.removeEventListener("scroll",r),window.removeEventListener("resize",r)}}),[]),{value:s,scrollTo:i}};export{i as scrollTo,t as useWindowScroll};
1
+ /* @license @siberiacancode/reactuse v0.0.55 */
2
+ import{_ as r}from"../../_rollupPluginBabelHelpers--yEi7JQy.js";import{useState as o,useEffect as e}from"react";import{isClient as n}from"../../utils/helpers/isClient.js";var i=function(r){var o=r.x,e=r.y,n=r.behavior,i={behavior:void 0===n?"smooth":n};"number"==typeof o&&(i.left=o),"number"==typeof e&&(i.top=e),window.scrollTo(i)},t=function(){var t=o({x:n?window.scrollX:Number.POSITIVE_INFINITY,y:n?window.scrollY:Number.POSITIVE_INFINITY}),l=r(t,2),s=l[0],w=l[1];return e((function(){var r=function(){return w({x:window.scrollX,y:window.scrollY})};return window.addEventListener("scroll",r),window.addEventListener("resize",r),function(){window.removeEventListener("scroll",r),window.removeEventListener("resize",r)}}),[]),{value:s,scrollTo:i}};export{i as scrollTo,t as useWindowScroll};
3
3
  //# sourceMappingURL=useWindowScroll.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.53 */
2
- import{_ as e}from"../../_rollupPluginBabelHelpers-CIuCCT6y.js";import{useState as n,useEffect as i}from"react";import{isClient as t}from"../../utils/helpers/isClient.js";var o=function(o){var r,d=null===(r=null==o?void 0:o.includeScrollbar)||void 0===r||r,l=n((function(){return t?{width:d?window.innerWidth:window.document.documentElement.clientWidth,height:d?window.innerHeight:window.document.documentElement.clientHeight}:{width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY}})),u=e(l,2),w=u[0],c=u[1];return i((function(){var e=function(){c(d?{width:window.innerWidth,height:window.innerHeight}:{width:window.document.documentElement.clientWidth,height:window.document.documentElement.clientHeight})};return window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[null==o?void 0:o.includeScrollbar]),w};export{o as useWindowSize};
1
+ /* @license @siberiacancode/reactuse v0.0.55 */
2
+ import{_ as e}from"../../_rollupPluginBabelHelpers--yEi7JQy.js";import{useState as n,useEffect as i}from"react";import{isClient as t}from"../../utils/helpers/isClient.js";var o=function(o){var r,d=null===(r=null==o?void 0:o.includeScrollbar)||void 0===r||r,l=n((function(){return t?{width:d?window.innerWidth:window.document.documentElement.clientWidth,height:d?window.innerHeight:window.document.documentElement.clientHeight}:{width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY}})),u=e(l,2),w=u[0],c=u[1];return i((function(){var e=function(){c(d?{width:window.innerWidth,height:window.innerHeight}:{width:window.document.documentElement.clientWidth,height:window.document.documentElement.clientHeight})};return window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[null==o?void 0:o.includeScrollbar]),w};export{o as useWindowSize};
3
3
  //# sourceMappingURL=useWindowSize.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.53 */
2
- import{_ as n,a as o}from"../../_rollupPluginBabelHelpers-CIuCCT6y.js";import{useState as t}from"react";var r=function(r,e){var c=null!=e?e:r[0].id,i=new Map(r.map((function(n){return[n.id,n]}))),l=t(c),a=n(l,2),u=a[0],f=a[1],s=t([c]),d=n(s,2),v=d[0],g=d[1];return{currentStepId:u,set:function(n){var t;if(null===(t=i.get(u))||void 0===t||null===(t=t.nodes)||void 0===t||!t.includes(n))throw new Error("Can't go to ".concat(n," from ").concat(u));g([].concat(o(v),[n])),f(n)},reset:function(){f(c),g([c])},back:function(){var n;if(1!==v.length){var o=v[v.length-2];if(null===(n=i.get(u))||void 0===n||null===(n=n.nodes)||void 0===n||!n.includes(o))throw new Error("Can't go to ".concat(o," from ").concat(u));g(v.slice(0,-1)),f(v[v.length-2])}},history:v}};export{r as useWizard};
1
+ /* @license @siberiacancode/reactuse v0.0.55 */
2
+ import{_ as n,a as o}from"../../_rollupPluginBabelHelpers--yEi7JQy.js";import{useState as t}from"react";var r=function(r,e){var c=null!=e?e:r[0].id,i=new Map(r.map((function(n){return[n.id,n]}))),l=t(c),a=n(l,2),u=a[0],f=a[1],s=t([c]),d=n(s,2),v=d[0],g=d[1];return{currentStepId:u,set:function(n){var t;if(null===(t=i.get(u))||void 0===t||null===(t=t.nodes)||void 0===t||!t.includes(n))throw new Error("Can't go to ".concat(n," from ").concat(u));g([].concat(o(v),[n])),f(n)},reset:function(){f(c),g([c])},back:function(){var n;if(1!==v.length){var o=v[v.length-2];if(null===(n=i.get(u))||void 0===n||null===(n=n.nodes)||void 0===n||!n.includes(o))throw new Error("Can't go to ".concat(o," from ").concat(u));g(v.slice(0,-1)),f(v[v.length-2])}},history:v}};export{r as useWizard};
3
3
  //# sourceMappingURL=useWizard.js.map
@@ -1,3 +1,3 @@
1
- /* @license @siberiacancode/reactuse v0.0.53 */
1
+ /* @license @siberiacancode/reactuse v0.0.55 */
2
2
  const e=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],n=(()=>{if("undefined"==typeof document)return!1;const n=e[0],l={};for(const r of e){const e=r?.[1];if(e in document){for(const[e,c]of r.entries())l[n[e]]=c;return l}}return!1})(),l={change:n.fullscreenchange,error:n.fullscreenerror};let r={request:(e=document.documentElement,l)=>new Promise(((c,t)=>{const s=()=>{r.off("change",s),c()};r.on("change",s);const o=e[n.requestFullscreen](l);o instanceof Promise&&o.then(s).catch(t)})),exit:()=>new Promise(((e,l)=>{if(!r.isFullscreen)return void e();const c=()=>{r.off("change",c),e()};r.on("change",c);const t=document[n.exitFullscreen]();t instanceof Promise&&t.then(c).catch(l)})),toggle:(e,n)=>r.isFullscreen?r.exit():r.request(e,n),onchange(e){r.on("change",e)},onerror(e){r.on("error",e)},on(e,n){const r=l[e];r&&document.addEventListener(r,n,!1)},off(e,n){const r=l[e];r&&document.removeEventListener(r,n,!1)},raw:n};Object.defineProperties(r,{isFullscreen:{get:()=>Boolean(document[n.fullscreenElement])},element:{enumerable:!0,get:()=>document[n.fullscreenElement]??void 0},isEnabled:{enumerable:!0,get:()=>Boolean(document[n.fullscreenEnabled])}}),n||(r={isEnabled:!1});var c=r;export{c as s};
3
- //# sourceMappingURL=index-ngJHDSj5.js.map
3
+ //# sourceMappingURL=index-5OKmysyE.js.map