(function(r,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],u):(r=typeof globalThis<"u"?globalThis:r||self,u(r.ReactHooksPlus={},r.React))})(this,function(r,u){"use strict";function S(){return Math.floor(Math.random()*1e4)}function y(e){const n=Math.pow(10,e)-1,t=Math.pow(10,e-1);return Math.floor(Math.random()*(n-t+1)+t)}function E(e,n){return Math.floor(Math.random()*(n-e)+e)}function v(e,n,t){let o=Math.floor(Math.random()*(t-n+1))+n;return(e&&o%2!==0||!e&&o%2===0)&&o++,o}function w(){let e="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",t=n.length;for(let o=0;o<5;o++)e+=n.charAt(Math.floor(Math.random()*t));return e}function M(e){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";let t="";for(let o=0;on&&(n=e[o],t=o);return t}function C(e,n){const t=[];for(let o=0;o[...n,...t],[])}function P(e){return[...new Set(e)]}function D(e,n){return e.sort((t,o)=>t[n]>o[n]?1:-1)}function O(e){for(let n=e.length-1;n>0;n--){const t=Math.floor(Math.random()*(n+1));[e[n],e[t]]=[e[t],e[n]]}return e}function f(e){return e.reduce((n,t)=>n+t,0)}function F(e){return e.length===0}function H(e){return Math.max(...e)}function R(e){return Math.min(...e)}function j(e,n){return e.includes(n)}function k(e,n){return e.filter(t=>t!==n)}function V(e){if(e.length!==0)return f(e)/e.length}function B(e,n){return e.includes(n)||e.push(n),e}function J(e,n,t){return e.some(o=>o[t]==n[t])||e.push(n),e}function q(e){return e.sort((n,t)=>t-n)}function G(e){return e.sort((n,t)=>n-t)}function z(e,n){return e.filter((t,o,i)=>o===i.findIndex(s=>s[n]===t[n]))}function m(e){const n=["۰","۱","۲","۳","۴","۵","۶","۷","۸","۹"];let t="";typeof e=="number"&&(e=e.toString());for(let o=0;on(!1),1500)}return{copied:e,copyToClipboard:t}}function Q(e,n){const[t,o]=u.useState(()=>{try{const s=window.localStorage.getItem(e);return s?JSON.parse(s):n}catch(s){return console.log(s),n}});return[t,s=>{try{const c=s instanceof Function?s(t):s;o(c),window.localStorage.setItem(e,JSON.stringify(c))}catch(c){console.log(c)}}]}const X=e=>{u.useEffect(()=>{document.title=e},[e])};function Y(e,n){u.useEffect(()=>{const t=o=>{const i=e==null?void 0:e.current;!i||i.contains((o==null?void 0:o.target)||null)||n(o)};return document.addEventListener("mousedown",t),document.addEventListener("touchstart",t),()=>{document.removeEventListener("mousedown",t),document.removeEventListener("touchstart",t)}},[e,n])}function K(){const[e,n]=u.useState(!1),t=u.useRef(null);function o(){n(!0)}function i(){n(!1)}return u.useEffect(()=>{const s=t.current;if(s)return s.addEventListener("mouseover",o),s.addEventListener("mouseout",i),()=>{s.removeEventListener("mouseover",o),s.removeEventListener("mouseout",i)}},[t.current]),[t,e]}const U={data:null,isLoading:!1,error:null},Z=(e,n)=>{const[t,o]=u.useState(U);return u.useEffect(()=>{(async()=>{try{o({data:null,isLoading:!0,error:null});const c=await(await fetch(e,n)).json();o({data:c,isLoading:!1,error:null})}catch(s){o({data:null,isLoading:!1,error:s})}})()},[e,n]),t};function _(...e){u.useEffect(()=>{console.log(...e)},[e])}const p=(e,n="My Console Group")=>{u.useEffect(()=>{console.groupCollapsed(n),console.log(e),console.groupEnd()},[n,e])};function x(e,n){u.useEffect(()=>{console.table(e,n)},[e,n])}const ee=(e="Time Taken: ")=>{const[n,t]=u.useState({start:0,end:0});return u.useEffect(()=>{if(n.start!==null&&n.end!==null){const s=n.end-n.start;console.log(`${e}${d(s,3)}ms`)}},[n]),{startConsole:()=>{t(s=>({...s,start:performance.now()}))},endConsole:()=>{t(s=>({...s,end:performance.now()}))}}};function ne(e,n,t){const o=e.map(a=>window.matchMedia(a)),i=()=>{const a=o.findIndex(l=>l.matches);return typeof n[a]<"u"?n[a]:t},[s,c]=u.useState(i);return u.useEffect(()=>{const a=()=>c(i);return o.forEach(l=>l.addListener(a)),()=>o.forEach(l=>l.removeListener(a))},[]),s}const te=()=>{const[e,n]=u.useState({x:0,y:0});return u.useEffect(()=>{const t=()=>{n({x:window.scrollX,y:window.scrollY})};return document.addEventListener("scroll",t),()=>document.removeEventListener("scroll",t)},[]),e},oe=()=>{const[e,n]=u.useState({width:window.innerWidth,height:window.innerHeight});return u.useEffect(()=>{const t=()=>{n({width:window.innerWidth,height:window.innerHeight})};return window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t)}},[]),e};function re(e){const[n,t]=u.useState(!1);return u.useEffect(()=>{const o=new IntersectionObserver(([i])=>{t(i.isIntersecting)});return e.current&&o.observe(e.current),()=>{o.disconnect()}},[e]),n}r.addElementToArrayIfNotExist=B,r.addObjectToArrayIfPropNotExist=J,r.average=V,r.chunk=C,r.convertToEnglishNumber=h,r.convertToPersianNumber=m,r.findMaxIndex=A,r.flattenArray=I,r.getFromLocalStorage=N,r.getMaxElement=H,r.getMinElement=R,r.hasElement=j,r.isArrayEmpty=F,r.isPersianNumber=g,r.randomNumber=S,r.randomNumberDigit=y,r.randomNumberEven=v,r.randomNumberRange=E,r.randomString=w,r.randomStringLength=M,r.randomStringSymbols=b,r.randomStringSymbolsLength=L,r.removeDuplicatesByProperty=z,r.removeElement=k,r.saveToLocalStorage=T,r.separateNumbers=W,r.setPrecisionForDecimal=d,r.shuffleArray=O,r.sortArrayAsc=G,r.sortArrayDesc=q,r.sortByProperty=D,r.sum=f,r.uniqueArray=P,r.useConGroup=p,r.useConLog=_,r.useConTable=x,r.useConTime=ee,r.useCopyToClipboard=$,r.useDocTitle=X,r.useFetch=Z,r.useHover=K,r.useLocalStorage=Q,r.useMedia=ne,r.useOnClickOutside=Y,r.useOnScreen=re,r.useScreen=oe,r.useScroll=te,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})});