Comparing version 1.1.5 to 1.1.6
/*! For license information please see bundle.js.LICENSE.txt */ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports["6pp"]=e(require("react")):t["6pp"]=e(t.react)}(self,(t=>(()=>{"use strict";var e={156:e=>{e.exports=t}},r={};function n(t){var o=r[t];if(void 0!==o)return o.exports;var i=r[t]={exports:{}};return e[t](i,i.exports,n),i.exports}n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};return(()=>{n.r(o),n.d(o,{PageStepper:()=>N,Pagination:()=>R,isDateBetween:()=>j,isIncludeCapitalLetter:()=>h,isIncludeLowercaseLetter:()=>p,isIncludeNumber:()=>s,isIncludeSpecialChar:()=>y,isValidDate:()=>b,isValidDateTime:()=>S,isValidEmail:()=>d,isValidPhoneNumber:()=>g,isValidTime:()=>w,isValidUrl:()=>m,isValidUsername:()=>v,useFetchData:()=>f,useFileHandler:()=>P,useInputValidation:()=>k,useStrongPassword:()=>L});var t=n(156),e=new Map;function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function i(){i=function(){return e};var t,e={},n=Object.prototype,o=n.hasOwnProperty,a=Object.defineProperty||function(t,e,r){t[e]=r.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",l=u.asyncIterator||"@@asyncIterator",f=u.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function y(t,e,r,n){var o=e&&e.prototype instanceof b?e:b,i=Object.create(o.prototype),u=new T(n||[]);return a(i,"_invoke",{value:L(t,r,u)}),i}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=y;var p="suspendedStart",d="suspendedYield",v="executing",m="completed",g={};function b(){}function w(){}function S(){}var j={};s(j,c,(function(){return this}));var E=Object.getPrototypeOf,O=E&&E(E(_([])));O&&O!==n&&o.call(O,c)&&(j=O);var x=S.prototype=b.prototype=Object.create(j);function A(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function P(t,e){function n(i,a,u,c){var l=h(t[i],t,a);if("throw"!==l.type){var f=l.arg,s=f.value;return s&&"object"==r(s)&&o.call(s,"__await")?e.resolve(s.__await).then((function(t){n("next",t,u,c)}),(function(t){n("throw",t,u,c)})):e.resolve(s).then((function(t){f.value=t,u(f)}),(function(t){return n("throw",t,u,c)}))}c(l.arg)}var i;a(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function L(e,r,n){var o=p;return function(i,a){if(o===v)throw new Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var c=k(u,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var l=h(e,r,n);if("normal"===l.type){if(o=n.done?m:d,l.arg===g)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=m,n.method="throw",n.arg=l.arg)}}}function k(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=h(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function I(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(I,this),this.reset(!0)}function _(e){if(e||""===e){var n=e[c];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function r(){for(;++i<e.length;)if(o.call(e,i))return r.value=e[i],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(r(e)+" is not iterable")}return w.prototype=S,a(x,"constructor",{value:S,configurable:!0}),a(S,"constructor",{value:w,configurable:!0}),w.displayName=s(S,f,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,S):(t.__proto__=S,s(t,f,"GeneratorFunction")),t.prototype=Object.create(x),t},e.awrap=function(t){return{__await:t}},A(P.prototype),s(P.prototype,l,(function(){return this})),e.AsyncIterator=P,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new P(y(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},A(x),s(x,f,"Generator"),s(x,c,(function(){return this})),s(x,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=_,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(C),!e)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return u.type="throw",u.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var c=o.call(a,"catchLoc"),l=o.call(a,"finallyLoc");if(c&&l){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),C(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;C(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:_(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function a(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function u(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||c(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(t,e){if(t){if("string"==typeof t)return l(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(t,e):void 0}}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var f=function(r,n){var o,f=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],s=u((0,t.useState)(),2),y=s[0],h=s[1],p=u((0,t.useState)(!1),2),d=p[0],v=p[1],m=u((0,t.useState)(""),2),g=m[0],b=m[1],w=u((0,t.useState)(0),2),S=w[0],j=w[1];return(0,t.useEffect)((function(){var t=new AbortController;if(!e.has(n))return v(!0),fetch(r,{credentials:"include",signal:t.signal}).then(function(){var t,r=(t=i().mark((function t(r){var o;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.json();case 2:if(o=t.sent,r.ok){t.next=7;break}throw new Error(o.message||"Errro while fetching!");case 7:h(o),e.set(n,JSON.stringify(o));case 9:case"end":return t.stop()}}),t)})),function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function u(t){a(i,n,o,u,c,"next",t)}function c(t){a(i,n,o,u,c,"throw",t)}u(void 0)}))});return function(t){return r.apply(this,arguments)}}()).catch((function(t){"AbortError"!==t.name&&b(t.message||"Something went wrong!")})).finally((function(){return v(!1)})),function(){t.abort()};h(JSON.parse(e.get(n)))}),[S].concat(function(t){if(Array.isArray(t))return l(t)}(o=f)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(o)||c(o)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())),{data:y,loading:d,error:g,refetch:function(){e.delete(n),j((function(t){return t+1}))},clearCache:function(){e.delete(n)}}},s=function(t){return/\d/.test(t)},y=function(t){return/[ `!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/.test(t)},h=function(t){return/[A-Z]/.test(t)},p=function(t){return/[a-z]/.test(t)},d=function(t){return/\S+@\S+\.\S+/.test(t)},v=function(t){return/^[a-zA-Z0-9]+$/.test(t)},m=function(t){try{return new URL(t),!0}catch(t){return!1}},g=function(t){return/^\d{10}$/.test(t)},b=function(t){return/^\d{4}-\d{2}-\d{2}$/.test(t)},w=function(t){return/^\d{2}:\d{2}$/.test(t)},S=function(t){return/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}$/.test(t)},j=function(t,e,r){var n=new Date(t),o=new Date(e),i=new Date(r);return o<=n&&n<=i};function E(t){return function(t){if(Array.isArray(t))return A(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||x(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function O(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||x(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function x(t,e){if(t){if("string"==typeof t)return A(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?A(t,e):void 0}}function A(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var P=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,o="multiple"===e?[]:null,i="multiple"===e?[]:null,a=O((0,t.useState)(null),2),u=a[0],c=a[1],l=O((0,t.useState)(o),2),f=l[0],s=l[1],y=O((0,t.useState)(i),2),h=y[0],p=y[1];return{file:f,preview:h,error:u,changeHandler:function(t){if(t.target.files){if("single"===e){var o=t.target.files[0];if(t.target.files.length>1)return c("Cannot upload more than 1 file, please select type as 'Multiple'");if(o.size>1048576*r)return c("File size too large");var i=new FileReader;i.readAsDataURL(o),i.onloadend=function(){p(i.result)},s(o)}if("multiple"===e){var a=Array.from(t.target.files);if(n&&a.length>n)return c("Maximum ".concat(n," files allowed"));for(var u,l=function(){var t=y[f];if(t.size>1048576*r)return c("File size too large"),{v:void 0};var e=new FileReader;e.readAsDataURL(t),e.onloadend=function(){p((function(t){return Array.isArray(t)?[].concat(E(t),[e.result]):[e.result]}))},s((function(e){return Array.isArray(e)?[].concat(E(e),[t]):[t]}))},f=0,y=a;f<y.length;f++)if(u=l())return u.v}}}}},L=function(){var e=O((0,t.useState)(""),2),r=e[0],n=e[1],o=O((0,t.useState)(""),2),i=o[0],a=o[1];return{error:r,value:i,changeHandler:function(t){var e=t.target.value;a(e);var r=[];e.length<8&&r.push("at least 8 characters"),s(e)||r.push("a number"),y(e)||r.push("a special"),h(e)||r.push("a capital"),p(e)||r.push("a lowercase"),n(r.length>0?"Password must include ".concat(r.join(", ")," character"):"")}}},k=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},n=O((0,t.useState)(e),2),o=n[0],i=n[1],a=O((0,t.useState)(""),2),u=a[0],c=a[1];return{value:o,changeHandler:function(t){var e;e="number"==typeof o?Number(t.target.value):t.target.value,i(e);var n=r(e);c(n?n.errorMessage:"")},error:u}};function I(t){return I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},I(t)}function C(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function T(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function _(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?T(Object(r),!0).forEach((function(e){var n,o,i,a;n=t,o=e,i=r[e],a=function(t,e){if("object"!=I(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=I(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(o),(o="symbol"==I(a)?a:String(a))in n?Object.defineProperty(n,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[o]=i})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):T(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var R=function(e){var r,n,o=e.totalPages,i=void 0===o?1:o,a=e.currPage,u=e.setCurrPage,c=e.activeButtonStyle,l=void 0===c?{backgroundColor:"black",color:"white"}:c,f=e.Button,s=void 0===f?function(t){var e=t.children,r=t.onClick,n=t.style;return React.createElement("button",{style:_({padding:"0.5rem 1rem",outline:"none",border:"none",borderRadius:"0.5rem",cursor:"pointer",backgroundColor:"#e2e8f0"},n),onClick:r},e)}:f,y=e.Container,h=void 0===y?function(t){var e=t.children;return React.createElement("ul",{style:{display:"flex",gap:"1rem",listStyle:"none"}},e)}:y,p=(r=(0,t.useState)(1),n=2,function(t){if(Array.isArray(t))return t}(r)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(r,n)||function(t,e){if(t){if("string"==typeof t)return C(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?C(t,e):void 0}}(r,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),d=p[0],v=p[1];return React.createElement(h,null,React.createElement(React.Fragment,null,d>1&&React.createElement("li",null,React.createElement(s,{onClick:function(){return v((function(t){return t-4}))}},"Prev")),Array.from({length:Math.min(4,i)},(function(t,e){return d+e})).map((function(t){return React.createElement("li",{key:t},React.createElement(s,{style:a===t?l:{},onClick:function(){return function(t){u(t),t>d+4-1?v(t):t<d&&v(t-4+1)}(t)}},t))})),i>d+4-1&&React.createElement("li",null,React.createElement(s,{onClick:function(){return v((function(t){return t+4}))}},"Next"))))},N=function(e){var r=e.totalPages,n=void 0===r?1:r,o=e.currPage,i=e.setCurrPage,a=e.Typography,u=void 0===a?function(e){var r=e.children;return t.createElement("code",null,r)}:a,c=e.Button,l=e.Container,f=void 0===l?function(e){var r=e.children;return t.createElement("nav",{style:{display:"flex",alignItems:"center",gap:"1rem",padding:"1rem 0"}},r)}:l,s=1===o,y=o===n;return t.createElement(f,null,t.createElement(t.Fragment,null,t.createElement(c,{disabled:s,onClick:function(){1!==o&&i((function(t){return t-1}))}},"Previous"),t.createElement(u,null,o," of ",n),t.createElement(c,{disabled:y,onClick:function(){o!==n&&i((function(t){return t+1}))}},"Next")))}})(),o})())); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports["6pp"]=e(require("react")):t["6pp"]=e(t.react)}(self,(t=>(()=>{"use strict";var e={156:e=>{e.exports=t}},r={};function n(t){var o=r[t];if(void 0!==o)return o.exports;var i=r[t]={exports:{}};return e[t](i,i.exports,n),i.exports}n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};return(()=>{n.r(o),n.d(o,{PageStepper:()=>q,Pagination:()=>H,isDateBetween:()=>E,isIncludeCapitalLetter:()=>y,isIncludeLowercaseLetter:()=>p,isIncludeNumber:()=>s,isIncludeSpecialChar:()=>h,isValidDate:()=>b,isValidDateTime:()=>S,isValidEmail:()=>v,isValidPhoneNumber:()=>g,isValidTime:()=>w,isValidUrl:()=>m,isValidUsername:()=>d,useFetchData:()=>f,useFileHandler:()=>A,useInfiniteScrollDown:()=>D,useInfiniteScrollTop:()=>M,useInputValidation:()=>k,useStrongPassword:()=>P});var t=n(156),e=new Map;function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function i(){i=function(){return e};var t,e={},n=Object.prototype,o=n.hasOwnProperty,a=Object.defineProperty||function(t,e,r){t[e]=r.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",l=u.asyncIterator||"@@asyncIterator",f=u.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function h(t,e,r,n){var o=e&&e.prototype instanceof b?e:b,i=Object.create(o.prototype),u=new _(n||[]);return a(i,"_invoke",{value:P(t,r,u)}),i}function y(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=h;var p="suspendedStart",v="suspendedYield",d="executing",m="completed",g={};function b(){}function w(){}function S(){}var E={};s(E,c,(function(){return this}));var x=Object.getPrototypeOf,j=x&&x(x(R([])));j&&j!==n&&o.call(j,c)&&(E=j);var O=S.prototype=b.prototype=Object.create(E);function L(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function n(i,a,u,c){var l=y(t[i],t,a);if("throw"!==l.type){var f=l.arg,s=f.value;return s&&"object"==r(s)&&o.call(s,"__await")?e.resolve(s.__await).then((function(t){n("next",t,u,c)}),(function(t){n("throw",t,u,c)})):e.resolve(s).then((function(t){f.value=t,u(f)}),(function(t){return n("throw",t,u,c)}))}c(l.arg)}var i;a(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function P(e,r,n){var o=p;return function(i,a){if(o===d)throw new Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var c=k(u,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var l=y(e,r,n);if("normal"===l.type){if(o=n.done?m:v,l.arg===g)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=m,n.method="throw",n.arg=l.arg)}}}function k(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=y(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function I(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function R(e){if(e||""===e){var n=e[c];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function r(){for(;++i<e.length;)if(o.call(e,i))return r.value=e[i],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(r(e)+" is not iterable")}return w.prototype=S,a(O,"constructor",{value:S,configurable:!0}),a(S,"constructor",{value:w,configurable:!0}),w.displayName=s(S,f,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,S):(t.__proto__=S,s(t,f,"GeneratorFunction")),t.prototype=Object.create(O),t},e.awrap=function(t){return{__await:t}},L(A.prototype),s(A.prototype,l,(function(){return this})),e.AsyncIterator=A,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new A(h(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},L(O),s(O,f,"Generator"),s(O,c,(function(){return this})),s(O,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=R,_.prototype={constructor:_,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(I),!e)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return u.type="throw",u.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var c=o.call(a,"catchLoc"),l=o.call(a,"finallyLoc");if(c&&l){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),I(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;I(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:R(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function a(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function u(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||c(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(t,e){if(t){if("string"==typeof t)return l(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(t,e):void 0}}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var f=function(r,n){var o,f=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],s=u((0,t.useState)(),2),h=s[0],y=s[1],p=u((0,t.useState)(!1),2),v=p[0],d=p[1],m=u((0,t.useState)(""),2),g=m[0],b=m[1],w=u((0,t.useState)(0),2),S=w[0],E=w[1];return(0,t.useEffect)((function(){var t=new AbortController;if(!e.has(n))return d(!0),fetch(r,{credentials:"include",signal:t.signal}).then(function(){var t,r=(t=i().mark((function t(r){var o;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.json();case 2:if(o=t.sent,r.ok){t.next=7;break}throw new Error(o.message||"Errro while fetching!");case 7:y(o),e.set(n,JSON.stringify(o));case 9:case"end":return t.stop()}}),t)})),function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function u(t){a(i,n,o,u,c,"next",t)}function c(t){a(i,n,o,u,c,"throw",t)}u(void 0)}))});return function(t){return r.apply(this,arguments)}}()).catch((function(t){"AbortError"!==t.name&&b(t.message||"Something went wrong!")})).finally((function(){return d(!1)})),function(){t.abort()};y(JSON.parse(e.get(n)))}),[S].concat(function(t){if(Array.isArray(t))return l(t)}(o=f)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(o)||c(o)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())),{data:h,loading:v,error:g,refetch:function(){e.delete(n),E((function(t){return t+1}))},clearCache:function(){e.delete(n)}}},s=function(t){return/\d/.test(t)},h=function(t){return/[ `!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/.test(t)},y=function(t){return/[A-Z]/.test(t)},p=function(t){return/[a-z]/.test(t)},v=function(t){return/\S+@\S+\.\S+/.test(t)},d=function(t){return/^[a-zA-Z0-9]+$/.test(t)},m=function(t){try{return new URL(t),!0}catch(t){return!1}},g=function(t){return/^\d{10}$/.test(t)},b=function(t){return/^\d{4}-\d{2}-\d{2}$/.test(t)},w=function(t){return/^\d{2}:\d{2}$/.test(t)},S=function(t){return/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}$/.test(t)},E=function(t,e,r){var n=new Date(t),o=new Date(e),i=new Date(r);return o<=n&&n<=i};function x(t){return function(t){if(Array.isArray(t))return L(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||O(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function j(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||O(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function O(t,e){if(t){if("string"==typeof t)return L(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?L(t,e):void 0}}function L(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var A=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,o="multiple"===e?[]:null,i="multiple"===e?[]:null,a=j((0,t.useState)(null),2),u=a[0],c=a[1],l=j((0,t.useState)(o),2),f=l[0],s=l[1],h=j((0,t.useState)(i),2),y=h[0],p=h[1];return{file:f,preview:y,error:u,changeHandler:function(t){if(t.target.files){if("single"===e){var o=t.target.files[0];if(t.target.files.length>1)return c("Cannot upload more than 1 file, please select type as 'Multiple'");if(o.size>1048576*r)return c("File size too large");var i=new FileReader;i.readAsDataURL(o),i.onloadend=function(){p(i.result)},s(o)}if("multiple"===e){var a=Array.from(t.target.files);if(n&&a.length>n)return c("Maximum ".concat(n," files allowed"));for(var u,l=function(){var t=h[f];if(t.size>1048576*r)return c("File size too large"),{v:void 0};var e=new FileReader;e.readAsDataURL(t),e.onloadend=function(){p((function(t){return Array.isArray(t)?[].concat(x(t),[e.result]):[e.result]}))},s((function(e){return Array.isArray(e)?[].concat(x(e),[t]):[t]}))},f=0,h=a;f<h.length;f++)if(u=l())return u.v}}}}},P=function(){var e=j((0,t.useState)(""),2),r=e[0],n=e[1],o=j((0,t.useState)(""),2),i=o[0],a=o[1];return{error:r,value:i,changeHandler:function(t){var e=t.target.value;a(e);var r=[];e.length<8&&r.push("at least 8 characters"),s(e)||r.push("a number"),h(e)||r.push("a special"),y(e)||r.push("a capital"),p(e)||r.push("a lowercase"),n(r.length>0?"Password must include ".concat(r.join(", ")," character"):"")}}},k=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},n=j((0,t.useState)(e),2),o=n[0],i=n[1],a=j((0,t.useState)(""),2),u=a[0],c=a[1];return{value:o,changeHandler:function(t){var e;e="number"==typeof o?Number(t.target.value):t.target.value,i(e);var n=r(e);c(n?n.errorMessage:"")},error:u}};function T(t){return T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},T(t)}function I(){I=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),u=new _(n||[]);return o(a,"_invoke",{value:L(t,r,u)}),a}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var h="suspendedStart",y="suspendedYield",p="executing",v="completed",d={};function m(){}function g(){}function b(){}var w={};l(w,a,(function(){return this}));var S=Object.getPrototypeOf,E=S&&S(S(R([])));E&&E!==r&&n.call(E,a)&&(w=E);var x=b.prototype=m.prototype=Object.create(w);function j(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function O(t,e){function r(o,i,a,u){var c=s(t[o],t,i);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==T(f)&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,a,u)}),(function(t){r("throw",t,a,u)})):e.resolve(f).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,u)}))}u(c.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function L(e,r,n){var o=h;return function(i,a){if(o===p)throw new Error("Generator is already running");if(o===v){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var c=A(u,n);if(c){if(c===d)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=p;var l=s(e,r,n);if("normal"===l.type){if(o=n.done?v:y,l.arg===d)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=v,n.method="throw",n.arg=l.arg)}}}function A(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,A(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;var i=s(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,d;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,d):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function R(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(T(e)+" is not iterable")}return g.prototype=b,o(x,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:g,configurable:!0}),g.displayName=l(b,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,l(t,c,"GeneratorFunction")),t.prototype=Object.create(x),t},e.awrap=function(t){return{__await:t}},j(O.prototype),l(O.prototype,u,(function(){return this})),e.AsyncIterator=O,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new O(f(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},j(x),l(x,c,"Generator"),l(x,a,(function(){return this})),l(x,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=R,_.prototype={constructor:_,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(k),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return u.type="throw",u.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(c&&l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),k(r),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;k(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:R(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),d}},e}function _(t){return function(t){if(Array.isArray(t))return G(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||F(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function R(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function C(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){R(i,n,o,a,u,"next",t)}function u(t){R(i,n,o,a,u,"throw",t)}a(void 0)}))}}function N(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||F(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function F(t,e){if(t){if("string"==typeof t)return G(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?G(t,e):void 0}}function G(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var D=function(e,r,n,o,i){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,u=N((0,t.useState)([]),2),c=u[0],l=u[1],f=N((0,t.useState)(1),2),s=f[0],h=f[1],y=N((0,t.useState)(!0),2),p=y[0],v=y[1],d=N((0,t.useState)(!1),2),m=d[0],g=d[1],b=N((0,t.useState)(),2),w=b[0],S=b[1],E=(0,t.useRef)(null),x=(0,t.useCallback)(C(I().mark((function t(){var i,a;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,g(!0),t.next=4,fetch("".concat(e,"?").concat(r,"=").concat(s,"&").concat(n,"=").concat(o),{credentials:"include"});case 4:if((i=t.sent).ok){t.next=7;break}throw new Error("Something went wrong");case 7:return t.next=9,i.json();case 9:a=t.sent,l((function(t){return[].concat(_(t),_(a))})),v(a.length>0),t.next=17;break;case 14:t.prev=14,t.t0=t.catch(0),S(t.t0||"Something went wrong");case 17:return t.prev=17,g(!1),t.finish(17);case 20:case"end":return t.stop()}}),t,null,[[0,14,17,20]])}))),[s,o,e,r,n]);return(0,t.useEffect)((function(){x()}),[x]),(0,t.useEffect)((function(){var t=new IntersectionObserver((function(t){t[0].isIntersecting&&p&&!m&&(E.current&&clearTimeout(E.current),E.current=setTimeout((function(){a!==s&&h((function(t){return t+1}))}),200))}),{rootMargin:"100px"}),e=document.querySelector(".".concat(i,":last-of-type"));return e&&t.observe(e),function(){t.disconnect(),E.current&&clearTimeout(E.current)}}),[a,s,p,m]),{loading:m,hasMore:p,page:s,error:w,data:c}},M=function(e,r,n,o,i){var a=N((0,t.useState)([]),2),u=a[0],c=a[1],l=(0,t.useRef)(null),f=(0,t.useCallback)((function(){l.current&&clearTimeout(l.current),l.current=setTimeout((function(){if(e.current&&0===e.current.scrollTop){if(r===n)return;o((function(t){return t+1}))}}),200)}),[r,n]);return(0,t.useEffect)((function(){var t=e.current;return t&&t.addEventListener("scroll",f),function(){t&&t.removeEventListener("scroll",f)}}),[f,u]),(0,t.useEffect)((function(){var t=0,r=0;e.current&&(t=e.current.scrollHeight,r=e.current.scrollTop),i&&c((function(t){return[].concat(_(i.reverse()),_(t))})),requestAnimationFrame((function(){if(e.current){var n=r+e.current.scrollHeight-t;e.current.scrollTop=n}}))}),[i]),u};function $(t){return $="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$(t)}function U(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function V(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function z(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?V(Object(r),!0).forEach((function(e){var n,o,i,a;n=t,o=e,i=r[e],a=function(t,e){if("object"!=$(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=$(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(o),(o="symbol"==$(a)?a:String(a))in n?Object.defineProperty(n,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[o]=i})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):V(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var H=function(e){var r,n,o=e.totalPages,i=void 0===o?1:o,a=e.currPage,u=e.setCurrPage,c=e.activeButtonStyle,l=void 0===c?{backgroundColor:"black",color:"white"}:c,f=e.Button,s=void 0===f?function(t){var e=t.children,r=t.onClick,n=t.style;return React.createElement("button",{style:z({padding:"0.5rem 1rem",outline:"none",border:"none",borderRadius:"0.5rem",cursor:"pointer",backgroundColor:"#e2e8f0"},n),onClick:r},e)}:f,h=e.Container,y=void 0===h?function(t){var e=t.children;return React.createElement("ul",{style:{display:"flex",gap:"1rem",listStyle:"none"}},e)}:h,p=(r=(0,t.useState)(1),n=2,function(t){if(Array.isArray(t))return t}(r)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(r,n)||function(t,e){if(t){if("string"==typeof t)return U(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?U(t,e):void 0}}(r,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),v=p[0],d=p[1];return React.createElement(y,null,React.createElement(React.Fragment,null,v>1&&React.createElement("li",null,React.createElement(s,{onClick:function(){return d((function(t){return t-4}))}},"Prev")),Array.from({length:Math.min(4,i)},(function(t,e){return v+e})).map((function(t){return React.createElement("li",{key:t},React.createElement(s,{style:a===t?l:{},onClick:function(){return function(t){u(t),t>v+4-1?d(t):t<v&&d(t-4+1)}(t)}},t))})),i>v+4-1&&React.createElement("li",null,React.createElement(s,{onClick:function(){return d((function(t){return t+4}))}},"Next"))))},q=function(t){var e=t.totalPages,r=void 0===e?1:e,n=t.currPage,o=t.setCurrPage,i=t.Typography,a=void 0===i?function(t){var e=t.children;return React.createElement("code",null,e)}:i,u=t.Button,c=t.Container,l=void 0===c?function(t){var e=t.children;return React.createElement("nav",{style:{display:"flex",alignItems:"center",gap:"1rem",padding:"1rem 0"}},e)}:c,f=1===n,s=n===r;return React.createElement(l,null,React.createElement(React.Fragment,null,React.createElement(u,{disabled:f,onClick:function(){1!==n&&o((function(t){return t-1}))}},"Previous"),React.createElement(a,null,n," of ",r),React.createElement(u,{disabled:s,onClick:function(){n!==r&&o((function(t){return t+1}))}},"Next")))}})(),o})())); |
@@ -8,2 +8,4 @@ import { | ||
UseInputValidationType, | ||
UseInfiniteScrollDownType, | ||
UseInfiniteScrollUpType, | ||
PageStepperType, | ||
@@ -34,2 +36,6 @@ PaginationType, | ||
export const useInfiniteScrollDown: UseInfiniteScrollDownType; | ||
export const useInfiniteScrollUp: UseInfiniteScrollUpType; | ||
export const PageStepper: PageStepperType; | ||
@@ -36,0 +42,0 @@ |
{ | ||
"name": "6pp", | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "./dist/bundle.js", |
export * from "./hooks/fetching"; | ||
export * from "./hooks/forms"; | ||
export * from "./hooks/useInfinityScroll"; | ||
export * from "./components/PaginationWithCount"; | ||
@@ -4,0 +5,0 @@ export * from "./components/PageStepper"; |
@@ -6,2 +6,3 @@ import { | ||
Dispatch, | ||
MutableRefObject, | ||
ReactNode, | ||
@@ -68,2 +69,25 @@ SetStateAction, | ||
type UseInfiniteScrollDownType = <T>( | ||
urlWithEndpoint: string, | ||
pageQueryKeyword: string, | ||
limitQueryKeyword: string, | ||
limit: number, | ||
listClassName: string, | ||
totalPages?: number | ||
) => { | ||
loading: boolean; | ||
hasMore: boolean; | ||
page: number; | ||
error: string | undefined; | ||
data: T[]; | ||
}; | ||
type UseInfiniteScrollUpType = <T>( | ||
containerRef: MutableRefObject<HTMLElement | null>, | ||
totalPages: number, | ||
page: number, | ||
setPage: Dispatch<SetStateAction<number>>, | ||
newData: T[] | ||
) => T[]; | ||
// -----------------------------Component Types-------------------------------- | ||
@@ -145,2 +169,4 @@ | ||
UseInputValidationType, | ||
UseInfiniteScrollDownType, | ||
UseInfiniteScrollUpType, | ||
PageStepperProps, | ||
@@ -147,0 +173,0 @@ PageStepperType, |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
57538
18
826
2