@visulima/pagination 3.0.22 → 3.0.24

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,26 @@
1
+ ## @visulima/pagination [3.0.24](https://github.com/visulima/visulima/compare/@visulima/pagination@3.0.23...@visulima/pagination@3.0.24) (2024-12-12)
2
+
3
+ ### Bug Fixes
4
+
5
+ * allow node v23 ([8ca929a](https://github.com/visulima/visulima/commit/8ca929af311ce8036cbbfde68b6db05381b860a5))
6
+ * allowed node 23, updated dev dependencies ([f99d34e](https://github.com/visulima/visulima/commit/f99d34e01f6b13be8586a1b5d37dc8b8df0a5817))
7
+ * updated packem to v1.8.2 ([23f869b](https://github.com/visulima/visulima/commit/23f869b4120856cc97e2bffa6d508e2ae30420ea))
8
+ * updated packem to v1.9.2 ([47bdc2d](https://github.com/visulima/visulima/commit/47bdc2dfaeca4e7014dbe7772eae2fdf8c8b35bb))
9
+
10
+ ### Styles
11
+
12
+ * cs fixes ([46d31e0](https://github.com/visulima/visulima/commit/46d31e082e1865262bf380859c14fabd28ff456d))
13
+
14
+ ### Miscellaneous Chores
15
+
16
+ * updated dev dependencies ([a916944](https://github.com/visulima/visulima/commit/a916944b888bb34c34b0c54328b38d29e4399857))
17
+
18
+ ## @visulima/pagination [3.0.23](https://github.com/visulima/visulima/compare/@visulima/pagination@3.0.22...@visulima/pagination@3.0.23) (2024-10-05)
19
+
20
+ ### Bug Fixes
21
+
22
+ * updated dev dependencies, updated packem to v1.0.7, fixed naming of some lint config files ([c071a9c](https://github.com/visulima/visulima/commit/c071a9c8e129014a962ff654a16f302ca18a5c67))
23
+
1
24
  ## @visulima/pagination [3.0.22](https://github.com/visulima/visulima/compare/@visulima/pagination@3.0.21...@visulima/pagination@3.0.22) (2024-09-24)
2
25
 
3
26
  ### Bug Fixes
package/LICENSE.md CHANGED
@@ -23,14 +23,11 @@ SOFTWARE.
23
23
  <!-- DEPENDENCIES -->
24
24
 
25
25
  # Licenses of bundled dependencies
26
-
27
26
  The published @visulima/pagination artifact additionally contains code with the following licenses:
28
27
  BSD-3-Clause
29
28
 
30
29
  # Bundled dependencies:
31
-
32
30
  ## qs-esm
33
-
34
31
  License: BSD-3-Clause
35
32
  By: Jordan Harband
36
33
  Repository: https://github.com/payloadcms/qs-esm.git
@@ -45,9 +42,11 @@ Repository: https://github.com/payloadcms/qs-esm.git
45
42
  >
46
43
  > 1. Redistributions of source code must retain the above copyright notice, this
47
44
  > list of conditions and the following disclaimer.
45
+ >
48
46
  > 2. Redistributions in binary form must reproduce the above copyright notice,
49
47
  > this list of conditions and the following disclaimer in the documentation
50
48
  > and/or other materials provided with the distribution.
49
+ >
51
50
  > 3. Neither the name of the copyright holder nor the names of its
52
51
  > contributors may be used to endorse or promote products derived from
53
52
  > this software without specific prior written permission.
@@ -63,19 +62,16 @@ Repository: https://github.com/payloadcms/qs-esm.git
63
62
  > OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
64
63
  > OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
65
64
 
66
- <!-- DEPENDENCIES -->
65
+ <!-- /DEPENDENCIES -->
67
66
 
68
67
  <!-- TYPE_DEPENDENCIES -->
69
68
 
70
69
  # Licenses of bundled types
71
-
72
70
  The published @visulima/pagination artifact additionally contains code with the following licenses:
73
71
  MIT
74
72
 
75
73
  # Bundled types:
76
-
77
74
  ## openapi-types
78
-
79
75
  License: MIT
80
76
  By: Joseph Spencer
81
77
  Repository: https://github.com/kogosoftwarellc/open-api/tree/master/packages/openapi-types
@@ -102,4 +98,4 @@ Repository: https://github.com/kogosoftwarellc/open-api/tree/master/packages/ope
102
98
  > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
103
99
  > THE SOFTWARE.
104
100
 
105
- <!-- TYPE_DEPENDENCIES -->
101
+ <!-- /TYPE_DEPENDENCIES -->
package/README.md CHANGED
@@ -82,8 +82,8 @@ If you would like to help take a look at the [list of issues](https://github.com
82
82
 
83
83
  ## Credits
84
84
 
85
- - [Daniel Bannert](https://github.com/prisis)
86
- - [All Contributors](https://github.com/visulima/visulima/graphs/contributors)
85
+ - [Daniel Bannert](https://github.com/prisis)
86
+ - [All Contributors](https://github.com/visulima/visulima/graphs/contributors)
87
87
 
88
88
  ## License
89
89
 
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var o=Object.defineProperty;var t=(e,a)=>o(e,"name",{value:a,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./packem_shared/Paginator-DEUcrtkG.cjs"),c=require("./packem_shared/createPaginationMetaSchemaObject-D-0GFE4M.cjs");var g=Object.defineProperty,b=t((e,a)=>g(e,"name",{value:a,configurable:!0}),"e");const m=b((e,a,i,r)=>new n(i,Number(a),Number(e),...r),"paginate");exports.Paginator=n;exports.createPaginationMetaSchemaObject=c.createPaginationMetaSchemaObject;exports.createPaginationSchemaObject=c.createPaginationSchemaObject;exports.paginate=m;
1
+ "use strict";var o=Object.defineProperty;var t=(e,a)=>o(e,"name",{value:a,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./packem_shared/Paginator-dO9FtCU3.cjs"),i=require("./packem_shared/createPaginationMetaSchemaObject-D-0GFE4M.cjs");var g=Object.defineProperty,b=t((e,a)=>g(e,"name",{value:a,configurable:!0}),"e");const m=b((e,a,r,c)=>new n(r,Number(a),Number(e),...c),"paginate");exports.Paginator=n;exports.createPaginationMetaSchemaObject=i.createPaginationMetaSchemaObject;exports.createPaginationSchemaObject=i.createPaginationSchemaObject;exports.paginate=m;
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- var o=Object.defineProperty;var t=(e,a)=>o(e,"name",{value:a,configurable:!0});import i from"./packem_shared/Paginator-DevEsY78.mjs";import{createPaginationMetaSchemaObject as P,createPaginationSchemaObject as j}from"./packem_shared/createPaginationMetaSchemaObject-6bBOLPmK.mjs";var c=Object.defineProperty,m=t((e,a)=>c(e,"name",{value:a,configurable:!0}),"e");const p=m((e,a,r,n)=>new i(r,Number(a),Number(e),...n),"paginate");export{i as Paginator,P as createPaginationMetaSchemaObject,j as createPaginationSchemaObject,p as paginate};
1
+ var o=Object.defineProperty;var t=(e,a)=>o(e,"name",{value:a,configurable:!0});import i from"./packem_shared/Paginator-DI6QB_Ve.mjs";import{createPaginationMetaSchemaObject as P,createPaginationSchemaObject as j}from"./packem_shared/createPaginationMetaSchemaObject-6bBOLPmK.mjs";var c=Object.defineProperty,m=t((e,a)=>c(e,"name",{value:a,configurable:!0}),"e");const p=m((e,a,r,n)=>new i(r,Number(a),Number(e),...n),"paginate");export{i as Paginator,P as createPaginationMetaSchemaObject,j as createPaginationSchemaObject,p as paginate};
@@ -0,0 +1 @@
1
+ var Y=Object.defineProperty;var w=(t,e)=>Y(t,"name",{value:e,configurable:!0});var Z=Object.defineProperty,H=w((t,e)=>Z(t,"name",{value:e,configurable:!0}),"e");const tt=String.prototype.replace,et=/%20/g,q={RFC1738:"RFC1738",RFC3986:"RFC3986"},K={RFC1738:H(function(t){return tt.call(t,et,"+")},"RFC1738"),RFC3986:H(function(t){return String(t)},"RFC3986")},rt=q.RFC1738,W=q.RFC3986;var ot=Object.defineProperty,h=w((t,e)=>ot(t,"name",{value:e,configurable:!0}),"u$1");const k=Object.prototype.hasOwnProperty,O=Array.isArray,d=function(){const t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),nt=h(function(t){for(;t.length>1;){const e=t.pop(),o=e.obj[e.prop];if(O(o)){const r=[];for(let a=0;a<o.length;++a)typeof o[a]<"u"&&r.push(o[a]);e.obj[e.prop]=r}}},"compactQueue"),it=h(function(t,e){const o=e&&e.plainObjects?Object.create(null):{};for(let r=0;r<t.length;++r)typeof t[r]<"u"&&(o[r]=t[r]);return o},"arrayToObject");h(w(function t(e,o,r){if(!o)return e;if(typeof o!="object"){if(O(e))e.push(o);else if(e&&typeof e=="object")(r&&(r.plainObjects||r.allowPrototypes)||!k.call(Object.prototype,o))&&(e[o]=!0);else return[e,o];return e}if(!e||typeof e!="object")return[e].concat(o);let a=e;return O(e)&&!O(o)&&(a=it(e,r)),O(e)&&O(o)?(o.forEach(function(n,s){if(k.call(e,s)){const c=e[s];c&&typeof c=="object"&&n&&typeof n=="object"?e[s]=t(c,n,r):e.push(n)}else e[s]=n}),e):Object.keys(o).reduce(function(n,s){const c=o[s];return k.call(n,s)?n[s]=t(n[s],c,r):n[s]=c,n},a)},"i"),"merge");h(function(t,e){return Object.keys(e).reduce(function(o,r){return o[r]=e[r],o},t)},"assignSingleSource");h(function(t,e,o){const r=t.replace(/\+/g," ");if(o==="iso-8859-1")return r.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(r)}catch{return r}},"decode");const I=1024,at=h(function(t,e,o,r,a){if(t.length===0)return t;let n=t;if(typeof t=="symbol"?n=Symbol.prototype.toString.call(t):typeof t!="string"&&(n=String(t)),o==="iso-8859-1")return escape(n).replace(/%u[0-9a-f]{4}/gi,function(c){return"%26%23"+parseInt(c.slice(2),16)+"%3B"});let s="";for(let c=0;c<n.length;c+=I){const p=n.length>=I?n.slice(c,c+I):n,u=[];for(let g=0;g<p.length;++g){let i=p.charCodeAt(g);if(i===45||i===46||i===95||i===126||i>=48&&i<=57||i>=65&&i<=90||i>=97&&i<=122||a===rt&&(i===40||i===41)){u[u.length]=p.charAt(g);continue}if(i<128){u[u.length]=d[i];continue}if(i<2048){u[u.length]=d[192|i>>6]+d[128|i&63];continue}if(i<55296||i>=57344){u[u.length]=d[224|i>>12]+d[128|i>>6&63]+d[128|i&63];continue}g+=1,i=65536+((i&1023)<<10|p.charCodeAt(g)&1023),u[u.length]=d[240|i>>18]+d[128|i>>12&63]+d[128|i>>6&63]+d[128|i&63]}s+=u.join("")}return s},"encode");h(function(t){const e=[{obj:{o:t},prop:"o"}],o=[];for(let r=0;r<e.length;++r){const a=e[r],n=a.obj[a.prop],s=Object.keys(n);for(let c=0;c<s.length;++c){const p=s[c],u=n[p];typeof u=="object"&&u!==null&&o.indexOf(u)===-1&&(e.push({obj:n,prop:p}),o.push(u))}}return nt(e),t},"compact");h(function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},"isRegExp");const lt=h(function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},"isBuffer");h(function(t,e){return[].concat(t,e)},"combine");const V=h(function(t,e){if(O(t)){const o=[];for(let r=0;r<t.length;r+=1)o.push(e(t[r]));return o}return e(t)},"maybeMap");var st=Object.defineProperty,b=w((t,e)=>st(t,"name",{value:e,configurable:!0}),"u");const ct=Object.prototype.hasOwnProperty,J={brackets:b(function(t){return t+"[]"},"brackets"),comma:"comma",indices:b(function(t,e){return t+"["+e+"]"},"indices"),repeat:b(function(t){return t},"repeat")},m=Array.isArray,ut=Array.prototype.push,G=b(function(t,e){ut.apply(t,m(e)?e:[e])},"pushToArray"),ft=Date.prototype.toISOString,$=W,f={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:at,encodeValuesOnly:!1,format:$,formatter:K[$],indices:!1,serializeDate:b(function(t){return ft.call(t)},"serializeDate"),skipNulls:!1,strictNullHandling:!1},pt=b(function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},"isNonNullishPrimitive"),T={},_=b(function(t,e,o,r,a,n,s,c,p,u,g,i,j,P,E,N,D,C){let l=t,A=C,U=0,M=!1;for(;(A=A.get(T))!==void 0&&!M;){const y=A.get(t);if(U+=1,typeof y<"u"){if(y===U)throw new RangeError("Cyclic object value");M=!0}typeof A.get(T)>"u"&&(U=0)}if(typeof u=="function"?l=u(e,l):l instanceof Date?l=j(l):o==="comma"&&m(l)&&(l=V(l,function(y){return y instanceof Date?j(y):y})),l===null){if(n)return p&&!N?p(e,f.encoder,D,"key",P):e;l=""}if(pt(l)||lt(l)){if(p){const y=N?e:p(e,f.encoder,D,"key",P);return[E(y)+"="+E(p(l,f.encoder,D,"value",P))]}return[E(e)+"="+E(String(l))]}const S=[];if(typeof l>"u")return S;let R;if(o==="comma"&&m(l))N&&p&&(l=V(l,p)),R=[{value:l.length>0?l.join(",")||null:void 0}];else if(m(u))R=u;else{const y=Object.keys(l);R=g?y.sort(g):y}const z=c?e.replace(/\./g,"%2E"):e,F=r&&m(l)&&l.length===1?z+"[]":z;if(a&&m(l)&&l.length===0)return F+"[]";for(let y=0;y<R.length;++y){const v=R[y],Q=typeof v=="object"&&typeof v.value<"u"?v.value:l[v];if(s&&Q===null)continue;const x=i&&c?v.replace(/\./g,"%2E"):v,X=m(l)?typeof o=="function"?o(F,x):F:F+(i?"."+x:"["+x+"]");C.set(t,U);const B=new WeakMap;B.set(T,C),G(S,_(Q,X,o,r,a,n,s,c,o==="comma"&&N&&m(l)?null:p,u,g,i,j,P,E,N,D,B))}return S},"stringify"),yt=b(function(t){if(!t)return f;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");const e=t.charset||f.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let o=W;if(typeof t.format<"u"){if(!ct.call(K,t.format))throw new TypeError("Unknown format option provided.");o=t.format}const r=K[o];let a=f.filter;(typeof t.filter=="function"||m(t.filter))&&(a=t.filter);let n;if(t.arrayFormat in J?n=t.arrayFormat:"indices"in t?n=t.indices?"indices":"repeat":n=f.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");const s=typeof t.allowDots>"u"?t.encodeDotInKeys===!0?!0:f.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:f.addQueryPrefix,allowDots:s,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:f.allowEmptyArrays,arrayFormat:n,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:f.charsetSentinel,commaRoundTrip:t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?f.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:f.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:f.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:f.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:f.encodeValuesOnly,filter:a,format:o,formatter:r,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:f.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:f.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:f.strictNullHandling}},"normalizeStringifyOptions");function L(t,e){let o=t;const r=yt(e);let a,n;typeof r.filter=="function"?(n=r.filter,o=n("",o)):m(r.filter)&&(n=r.filter,a=n);const s=[];if(typeof o!="object"||o===null)return"";const c=J[r.arrayFormat],p=c==="comma"&&r.commaRoundTrip;a||(a=Object.keys(o)),r.sort&&a.sort(r.sort);const u=new WeakMap;for(let j=0;j<a.length;++j){const P=a[j];r.skipNulls&&o[P]===null||G(s,_(o[P],P,c,p,r.allowEmptyArrays,r.strictNullHandling,r.skipNulls,r.encodeDotInKeys,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.format,r.formatter,r.encodeValuesOnly,r.charset,u))}const g=s.join(r.delimiter);let i=r.addQueryPrefix===!0?"?":"";return r.charsetSentinel&&(r.charset==="iso-8859-1"?i+="utf8=%26%2310003%3B&":i+="utf8=%E2%9C%93&"),g.length>0?i+g:""}w(L,"stringify");b(L,"stringify");var gt=Object.defineProperty,ht=w((t,e)=>gt(t,"name",{value:e,configurable:!0}),"n");class mt extends Array{static{w(this,"g")}constructor(e,o,r,...a){super(...a),this.totalNumber=e,this.perPage=o,this.currentPage=r,this.totalNumber=Number(e),this.rows=a,this.isEmpty=this.rows.length===0}static{ht(this,"Paginator")}firstPage=1;isEmpty;qs={};rows;url="/";all(){return this.rows}baseUrl(e){return this.url=e,this}getMeta(){return{firstPage:this.firstPage,firstPageUrl:this.getUrl(1),lastPage:this.lastPage,lastPageUrl:this.getUrl(this.lastPage),nextPageUrl:this.getNextPageUrl(),page:this.currentPage,perPage:this.perPage,previousPageUrl:this.getPreviousPageUrl(),total:this.total}}getNextPageUrl(){return this.hasMorePages?this.getUrl(this.currentPage+1):null}getPreviousPageUrl(){return this.currentPage>1?this.getUrl(this.currentPage-1):null}getUrl(e){const o=L({...this.qs,page:e<1?1:e});return`${this.url}?${o}`}getUrlsForRange(e,o){const r=[];for(let a=e;a<=o;a++)r.push({isActive:a===this.currentPage,page:a,url:this.getUrl(a)});return r}queryString(e){return this.qs=e,this}toJSON(){return{data:this.all(),meta:this.getMeta()}}get hasMorePages(){return this.lastPage>this.currentPage}get hasPages(){return this.lastPage!==1}get hasTotal(){return this.total>0}get lastPage(){return Math.max(Math.ceil(this.total/this.perPage),1)}get total(){return Number(this.totalNumber)}}export{mt as default};
@@ -0,0 +1 @@
1
+ "use strict";var Y=Object.defineProperty;var w=(t,e)=>Y(t,"name",{value:e,configurable:!0});var Z=Object.defineProperty,H=w((t,e)=>Z(t,"name",{value:e,configurable:!0}),"e");const tt=String.prototype.replace,et=/%20/g,q={RFC1738:"RFC1738",RFC3986:"RFC3986"},K={RFC1738:H(function(t){return tt.call(t,et,"+")},"RFC1738"),RFC3986:H(function(t){return String(t)},"RFC3986")},rt=q.RFC1738,W=q.RFC3986;var ot=Object.defineProperty,h=w((t,e)=>ot(t,"name",{value:e,configurable:!0}),"u$1");const k=Object.prototype.hasOwnProperty,O=Array.isArray,d=function(){const t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),nt=h(function(t){for(;t.length>1;){const e=t.pop(),o=e.obj[e.prop];if(O(o)){const r=[];for(let a=0;a<o.length;++a)typeof o[a]<"u"&&r.push(o[a]);e.obj[e.prop]=r}}},"compactQueue"),it=h(function(t,e){const o=e&&e.plainObjects?Object.create(null):{};for(let r=0;r<t.length;++r)typeof t[r]<"u"&&(o[r]=t[r]);return o},"arrayToObject");h(w(function t(e,o,r){if(!o)return e;if(typeof o!="object"){if(O(e))e.push(o);else if(e&&typeof e=="object")(r&&(r.plainObjects||r.allowPrototypes)||!k.call(Object.prototype,o))&&(e[o]=!0);else return[e,o];return e}if(!e||typeof e!="object")return[e].concat(o);let a=e;return O(e)&&!O(o)&&(a=it(e,r)),O(e)&&O(o)?(o.forEach(function(n,s){if(k.call(e,s)){const c=e[s];c&&typeof c=="object"&&n&&typeof n=="object"?e[s]=t(c,n,r):e.push(n)}else e[s]=n}),e):Object.keys(o).reduce(function(n,s){const c=o[s];return k.call(n,s)?n[s]=t(n[s],c,r):n[s]=c,n},a)},"i"),"merge");h(function(t,e){return Object.keys(e).reduce(function(o,r){return o[r]=e[r],o},t)},"assignSingleSource");h(function(t,e,o){const r=t.replace(/\+/g," ");if(o==="iso-8859-1")return r.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(r)}catch{return r}},"decode");const I=1024,at=h(function(t,e,o,r,a){if(t.length===0)return t;let n=t;if(typeof t=="symbol"?n=Symbol.prototype.toString.call(t):typeof t!="string"&&(n=String(t)),o==="iso-8859-1")return escape(n).replace(/%u[0-9a-f]{4}/gi,function(c){return"%26%23"+parseInt(c.slice(2),16)+"%3B"});let s="";for(let c=0;c<n.length;c+=I){const p=n.length>=I?n.slice(c,c+I):n,u=[];for(let g=0;g<p.length;++g){let i=p.charCodeAt(g);if(i===45||i===46||i===95||i===126||i>=48&&i<=57||i>=65&&i<=90||i>=97&&i<=122||a===rt&&(i===40||i===41)){u[u.length]=p.charAt(g);continue}if(i<128){u[u.length]=d[i];continue}if(i<2048){u[u.length]=d[192|i>>6]+d[128|i&63];continue}if(i<55296||i>=57344){u[u.length]=d[224|i>>12]+d[128|i>>6&63]+d[128|i&63];continue}g+=1,i=65536+((i&1023)<<10|p.charCodeAt(g)&1023),u[u.length]=d[240|i>>18]+d[128|i>>12&63]+d[128|i>>6&63]+d[128|i&63]}s+=u.join("")}return s},"encode");h(function(t){const e=[{obj:{o:t},prop:"o"}],o=[];for(let r=0;r<e.length;++r){const a=e[r],n=a.obj[a.prop],s=Object.keys(n);for(let c=0;c<s.length;++c){const p=s[c],u=n[p];typeof u=="object"&&u!==null&&o.indexOf(u)===-1&&(e.push({obj:n,prop:p}),o.push(u))}}return nt(e),t},"compact");h(function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},"isRegExp");const lt=h(function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},"isBuffer");h(function(t,e){return[].concat(t,e)},"combine");const V=h(function(t,e){if(O(t)){const o=[];for(let r=0;r<t.length;r+=1)o.push(e(t[r]));return o}return e(t)},"maybeMap");var st=Object.defineProperty,b=w((t,e)=>st(t,"name",{value:e,configurable:!0}),"u");const ct=Object.prototype.hasOwnProperty,J={brackets:b(function(t){return t+"[]"},"brackets"),comma:"comma",indices:b(function(t,e){return t+"["+e+"]"},"indices"),repeat:b(function(t){return t},"repeat")},m=Array.isArray,ut=Array.prototype.push,G=b(function(t,e){ut.apply(t,m(e)?e:[e])},"pushToArray"),ft=Date.prototype.toISOString,$=W,f={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:at,encodeValuesOnly:!1,format:$,formatter:K[$],indices:!1,serializeDate:b(function(t){return ft.call(t)},"serializeDate"),skipNulls:!1,strictNullHandling:!1},pt=b(function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},"isNonNullishPrimitive"),T={},_=b(function(t,e,o,r,a,n,s,c,p,u,g,i,j,P,E,N,D,C){let l=t,A=C,U=0,M=!1;for(;(A=A.get(T))!==void 0&&!M;){const y=A.get(t);if(U+=1,typeof y<"u"){if(y===U)throw new RangeError("Cyclic object value");M=!0}typeof A.get(T)>"u"&&(U=0)}if(typeof u=="function"?l=u(e,l):l instanceof Date?l=j(l):o==="comma"&&m(l)&&(l=V(l,function(y){return y instanceof Date?j(y):y})),l===null){if(n)return p&&!N?p(e,f.encoder,D,"key",P):e;l=""}if(pt(l)||lt(l)){if(p){const y=N?e:p(e,f.encoder,D,"key",P);return[E(y)+"="+E(p(l,f.encoder,D,"value",P))]}return[E(e)+"="+E(String(l))]}const S=[];if(typeof l>"u")return S;let R;if(o==="comma"&&m(l))N&&p&&(l=V(l,p)),R=[{value:l.length>0?l.join(",")||null:void 0}];else if(m(u))R=u;else{const y=Object.keys(l);R=g?y.sort(g):y}const z=c?e.replace(/\./g,"%2E"):e,F=r&&m(l)&&l.length===1?z+"[]":z;if(a&&m(l)&&l.length===0)return F+"[]";for(let y=0;y<R.length;++y){const v=R[y],Q=typeof v=="object"&&typeof v.value<"u"?v.value:l[v];if(s&&Q===null)continue;const x=i&&c?v.replace(/\./g,"%2E"):v,X=m(l)?typeof o=="function"?o(F,x):F:F+(i?"."+x:"["+x+"]");C.set(t,U);const B=new WeakMap;B.set(T,C),G(S,_(Q,X,o,r,a,n,s,c,o==="comma"&&N&&m(l)?null:p,u,g,i,j,P,E,N,D,B))}return S},"stringify"),yt=b(function(t){if(!t)return f;if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");const e=t.charset||f.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let o=W;if(typeof t.format<"u"){if(!ct.call(K,t.format))throw new TypeError("Unknown format option provided.");o=t.format}const r=K[o];let a=f.filter;(typeof t.filter=="function"||m(t.filter))&&(a=t.filter);let n;if(t.arrayFormat in J?n=t.arrayFormat:"indices"in t?n=t.indices?"indices":"repeat":n=f.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");const s=typeof t.allowDots>"u"?t.encodeDotInKeys===!0?!0:f.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:f.addQueryPrefix,allowDots:s,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:f.allowEmptyArrays,arrayFormat:n,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:f.charsetSentinel,commaRoundTrip:t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?f.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:f.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:f.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:f.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:f.encodeValuesOnly,filter:a,format:o,formatter:r,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:f.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:f.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:f.strictNullHandling}},"normalizeStringifyOptions");function L(t,e){let o=t;const r=yt(e);let a,n;typeof r.filter=="function"?(n=r.filter,o=n("",o)):m(r.filter)&&(n=r.filter,a=n);const s=[];if(typeof o!="object"||o===null)return"";const c=J[r.arrayFormat],p=c==="comma"&&r.commaRoundTrip;a||(a=Object.keys(o)),r.sort&&a.sort(r.sort);const u=new WeakMap;for(let j=0;j<a.length;++j){const P=a[j];r.skipNulls&&o[P]===null||G(s,_(o[P],P,c,p,r.allowEmptyArrays,r.strictNullHandling,r.skipNulls,r.encodeDotInKeys,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.format,r.formatter,r.encodeValuesOnly,r.charset,u))}const g=s.join(r.delimiter);let i=r.addQueryPrefix===!0?"?":"";return r.charsetSentinel&&(r.charset==="iso-8859-1"?i+="utf8=%26%2310003%3B&":i+="utf8=%E2%9C%93&"),g.length>0?i+g:""}w(L,"stringify");b(L,"stringify");var gt=Object.defineProperty,ht=w((t,e)=>gt(t,"name",{value:e,configurable:!0}),"n");class dt extends Array{static{w(this,"g")}constructor(e,o,r,...a){super(...a),this.totalNumber=e,this.perPage=o,this.currentPage=r,this.totalNumber=Number(e),this.rows=a,this.isEmpty=this.rows.length===0}static{ht(this,"Paginator")}firstPage=1;isEmpty;qs={};rows;url="/";all(){return this.rows}baseUrl(e){return this.url=e,this}getMeta(){return{firstPage:this.firstPage,firstPageUrl:this.getUrl(1),lastPage:this.lastPage,lastPageUrl:this.getUrl(this.lastPage),nextPageUrl:this.getNextPageUrl(),page:this.currentPage,perPage:this.perPage,previousPageUrl:this.getPreviousPageUrl(),total:this.total}}getNextPageUrl(){return this.hasMorePages?this.getUrl(this.currentPage+1):null}getPreviousPageUrl(){return this.currentPage>1?this.getUrl(this.currentPage-1):null}getUrl(e){const o=L({...this.qs,page:e<1?1:e});return`${this.url}?${o}`}getUrlsForRange(e,o){const r=[];for(let a=e;a<=o;a++)r.push({isActive:a===this.currentPage,page:a,url:this.getUrl(a)});return r}queryString(e){return this.qs=e,this}toJSON(){return{data:this.all(),meta:this.getMeta()}}get hasMorePages(){return this.lastPage>this.currentPage}get hasPages(){return this.lastPage!==1}get hasTotal(){return this.total>0}get lastPage(){return Math.max(Math.ceil(this.total/this.perPage),1)}get total(){return Number(this.totalNumber)}}module.exports=dt;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/pagination",
3
- "version": "3.0.22",
3
+ "version": "3.0.24",
4
4
  "description": "Simple Pagination for Node.",
5
5
  "keywords": [
6
6
  "anolilab",
@@ -65,15 +65,15 @@
65
65
  "devDependencies": {
66
66
  "@anolilab/eslint-config": "^15.0.3",
67
67
  "@anolilab/prettier-config": "^5.0.14",
68
- "@anolilab/semantic-release-pnpm": "^1.1.3",
69
- "@anolilab/semantic-release-preset": "^9.0.0",
70
- "@arethetypeswrong/cli": "^0.16.4",
71
- "@babel/core": "^7.25.2",
68
+ "@anolilab/semantic-release-pnpm": "^1.1.5",
69
+ "@anolilab/semantic-release-preset": "^9.0.2",
70
+ "@arethetypeswrong/cli": "^0.17.1",
71
+ "@babel/core": "^7.26.0",
72
72
  "@rushstack/eslint-plugin-security": "^0.8.3",
73
73
  "@types/node": "18.19.15",
74
- "@visulima/packem": "1.0.1",
75
- "@vitest/coverage-v8": "^2.1.1",
76
- "@vitest/ui": "^2.1.1",
74
+ "@visulima/packem": "1.9.2",
75
+ "@vitest/coverage-v8": "^2.1.8",
76
+ "@vitest/ui": "^2.1.8",
77
77
  "conventional-changelog-conventionalcommits": "8.0.0",
78
78
  "cross-env": "^7.0.3",
79
79
  "esbuild": "0.24.0",
@@ -85,15 +85,15 @@
85
85
  "eslint-plugin-vitest": "^0.4.1",
86
86
  "eslint-plugin-vitest-globals": "^1.5.0",
87
87
  "openapi-types": "^12.1.3",
88
- "prettier": "^3.3.3",
88
+ "prettier": "^3.4.2",
89
89
  "qs-esm": "^7.0.2",
90
90
  "rimraf": "5.0.9",
91
91
  "semantic-release": "24.0.0",
92
92
  "typescript": "5.4.5",
93
- "vitest": "^2.1.1"
93
+ "vitest": "^2.1.8"
94
94
  },
95
95
  "engines": {
96
- "node": ">=18.* <=22.*"
96
+ "node": ">=18.* <=23.*"
97
97
  },
98
98
  "os": [
99
99
  "darwin",
@@ -122,11 +122,11 @@
122
122
  "clean": "rimraf node_modules dist .eslintcache",
123
123
  "dev": "pnpm run build --watch",
124
124
  "lint:attw": "attw --pack",
125
- "lint:eslint": "eslint . --ext js,cjs,mjs,jsx,ts,tsx,json,yaml,yml,md,mdx --max-warnings=0 --config .eslintrc.js",
126
- "lint:eslint:fix": "eslint . --ext js,cjs,mjs,jsx,ts,tsx,json,yaml,yml,md,mdx --max-warnings=0 --config .eslintrc.js --fix",
125
+ "lint:eslint": "eslint . --ext js,cjs,mjs,jsx,ts,tsx,json,yaml,yml,md,mdx --max-warnings=0 --config .eslintrc.cjs",
126
+ "lint:eslint:fix": "eslint . --ext js,cjs,mjs,jsx,ts,tsx,json,yaml,yml,md,mdx --max-warnings=0 --config .eslintrc.cjs --fix",
127
127
  "lint:package-json": "publint --strict",
128
- "lint:prettier": "prettier --config=.prettierrc.js --check .",
129
- "lint:prettier:fix": "prettier --config=.prettierrc.js --write .",
128
+ "lint:prettier": "prettier --config=.prettierrc.cjs --check .",
129
+ "lint:prettier:fix": "prettier --config=.prettierrc.cjs --write .",
130
130
  "lint:types": "tsc --noEmit",
131
131
  "test": "vitest run",
132
132
  "test:coverage": "vitest run --coverage",
@@ -1 +0,0 @@
1
- "use strict";var W=Object.defineProperty;var a=(i,t)=>W(i,"name",{value:t,configurable:!0});const G=String.prototype.replace,H=/%20/g,I={RFC1738:"RFC1738",RFC3986:"RFC3986"},J={RFC1738:a(function(i){return G.call(i,H,"+")},"RFC1738"),RFC3986:a(function(i){return String(i)},"RFC3986")},_=I.RFC1738,L=I.RFC3986,X=Array.isArray,p=function(){const i=[];for(let t=0;t<256;++t)i.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return i}(),A=1024,Y=a(function(t,r,e,o,y){if(t.length===0)return t;let g=t;if(typeof t=="symbol"?g=Symbol.prototype.toString.call(t):typeof t!="string"&&(g=String(t)),e==="iso-8859-1")return escape(g).replace(/%u[0-9a-f]{4}/gi,function(h){return"%26%23"+parseInt(h.slice(2),16)+"%3B"});let m="";for(let h=0;h<g.length;h+=A){const u=g.length>=A?g.slice(h,h+A):g,l=[];for(let f=0;f<u.length;++f){let n=u.charCodeAt(f);if(n===45||n===46||n===95||n===126||n>=48&&n<=57||n>=65&&n<=90||n>=97&&n<=122||y===_&&(n===40||n===41)){l[l.length]=u.charAt(f);continue}if(n<128){l[l.length]=p[n];continue}if(n<2048){l[l.length]=p[192|n>>6]+p[128|n&63];continue}if(n<55296||n>=57344){l[l.length]=p[224|n>>12]+p[128|n>>6&63]+p[128|n&63];continue}f+=1,n=65536+((n&1023)<<10|u.charCodeAt(f)&1023),l[l.length]=p[240|n>>18]+p[128|n>>12&63]+p[128|n>>6&63]+p[128|n&63]}m+=l.join("")}return m},"encode"),Z=a(function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},"isBuffer"),O=a(function(t,r){if(X(t)){const e=[];for(let o=0;o<t.length;o+=1)e.push(r(t[o]));return e}return r(t)},"maybeMap"),V={brackets:a(function(t){return t+"[]"},"brackets"),comma:"comma",indices:a(function(t,r){return t+"["+r+"]"},"indices"),repeat:a(function(t){return t},"repeat")},d=Array.isArray,tt=Array.prototype.push,K=a(function(i,t){tt.apply(i,d(t)?t:[t])},"pushToArray"),et=Date.prototype.toISOString,z=L,j={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Y,encodeValuesOnly:!1,format:z,formatter:J[z],indices:!1,serializeDate:a(function(t){return et.call(t)},"serializeDate"),skipNulls:!1,strictNullHandling:!1},nt=a(function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},"isNonNullishPrimitive"),E={},$=a(function(t,r,e,o,y,g,m,h,u,l,f,n,P,U,b,S,F,w){let s=t,N=w,C=0,B=!1;for(;(N=N.get(E))!==void 0&&!B;){const c=N.get(t);if(C+=1,typeof c<"u"){if(c===C)throw new RangeError("Cyclic object value");B=!0}typeof N.get(E)>"u"&&(C=0)}if(typeof l=="function"?s=l(r,s):s instanceof Date?s=P(s):e==="comma"&&d(s)&&(s=O(s,function(c){return c instanceof Date?P(c):c})),s===null){if(g)return u&&!S?u(r,j.encoder,F,"key",U):r;s=""}if(nt(s)||Z(s)){if(u){const c=S?r:u(r,j.encoder,F,"key",U);return[b(c)+"="+b(u(s,j.encoder,F,"value",U))]}return[b(r)+"="+b(String(s))]}const M=[];if(typeof s>"u")return M;let k;if(e==="comma"&&d(s))S&&u&&(s=O(s,u)),k=[{value:s.length>0?s.join(",")||null:void 0}];else if(d(l))k=l;else{const c=Object.keys(s);k=f?c.sort(f):c}const T=h?r.replace(/\./g,"%2E"):r,R=o&&d(s)&&s.length===1?T+"[]":T;if(y&&d(s)&&s.length===0)return R+"[]";for(let c=0;c<k.length;++c){const x=k[c],q=typeof x=="object"&&typeof x.value<"u"?x.value:s[x];if(m&&q===null)continue;const v=n&&h?x.replace(/\./g,"%2E"):x,Q=d(s)?typeof e=="function"?e(R,v):R:R+(n?"."+v:"["+v+"]");w.set(t,C);const D=new WeakMap;D.set(E,w),K(M,$(q,Q,e,o,y,g,m,h,e==="comma"&&S&&d(s)?null:u,l,f,n,P,U,b,S,F,D))}return M},"stringify"),rt=a(function(t){return j},"normalizeStringifyOptions");function st(i,t){let r=i;const e=rt();let o,y;typeof e.filter=="function"?(y=e.filter,r=y("",r)):d(e.filter)&&(y=e.filter,o=y);const g=[];if(typeof r!="object"||r===null)return"";const m=V[e.arrayFormat],h=m==="comma"&&e.commaRoundTrip;o||(o=Object.keys(r)),e.sort&&o.sort(e.sort);const u=new WeakMap;for(let n=0;n<o.length;++n){const P=o[n];e.skipNulls&&r[P]===null||K(g,$(r[P],P,m,h,e.allowEmptyArrays,e.strictNullHandling,e.skipNulls,e.encodeDotInKeys,e.encode?e.encoder:null,e.filter,e.sort,e.allowDots,e.serializeDate,e.format,e.formatter,e.encodeValuesOnly,e.charset,u))}const l=g.join(e.delimiter);let f=e.addQueryPrefix===!0?"?":"";return e.charsetSentinel&&(e.charset==="iso-8859-1"?f+="utf8=%26%2310003%3B&":f+="utf8=%E2%9C%93&"),l.length>0?f+l:""}a(st,"stringify");var it=Object.defineProperty,ot=a((i,t)=>it(i,"name",{value:t,configurable:!0}),"n");class lt extends Array{static{a(this,"g")}constructor(t,r,e,...o){super(...o),this.totalNumber=t,this.perPage=r,this.currentPage=e,this.totalNumber=Number(t),this.rows=o,this.isEmpty=this.rows.length===0}static{ot(this,"Paginator")}firstPage=1;isEmpty;qs={};rows;url="/";all(){return this.rows}baseUrl(t){return this.url=t,this}getMeta(){return{firstPage:this.firstPage,firstPageUrl:this.getUrl(1),lastPage:this.lastPage,lastPageUrl:this.getUrl(this.lastPage),nextPageUrl:this.getNextPageUrl(),page:this.currentPage,perPage:this.perPage,previousPageUrl:this.getPreviousPageUrl(),total:this.total}}getNextPageUrl(){return this.hasMorePages?this.getUrl(this.currentPage+1):null}getPreviousPageUrl(){return this.currentPage>1?this.getUrl(this.currentPage-1):null}getUrl(t){const r=st({...this.qs,page:t<1?1:t});return`${this.url}?${r}`}getUrlsForRange(t,r){const e=[];for(let o=t;o<=r;o++)e.push({isActive:o===this.currentPage,page:o,url:this.getUrl(o)});return e}queryString(t){return this.qs=t,this}toJSON(){return{data:this.all(),meta:this.getMeta()}}get hasMorePages(){return this.lastPage>this.currentPage}get hasPages(){return this.lastPage!==1}get hasTotal(){return this.total>0}get lastPage(){return Math.max(Math.ceil(this.total/this.perPage),1)}get total(){return Number(this.totalNumber)}}module.exports=lt;
@@ -1 +0,0 @@
1
- var W=Object.defineProperty;var a=(i,t)=>W(i,"name",{value:t,configurable:!0});const G=String.prototype.replace,H=/%20/g,I={RFC1738:"RFC1738",RFC3986:"RFC3986"},J={RFC1738:a(function(i){return G.call(i,H,"+")},"RFC1738"),RFC3986:a(function(i){return String(i)},"RFC3986")},_=I.RFC1738,L=I.RFC3986,X=Array.isArray,p=function(){const i=[];for(let t=0;t<256;++t)i.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return i}(),A=1024,Y=a(function(t,r,e,o,y){if(t.length===0)return t;let g=t;if(typeof t=="symbol"?g=Symbol.prototype.toString.call(t):typeof t!="string"&&(g=String(t)),e==="iso-8859-1")return escape(g).replace(/%u[0-9a-f]{4}/gi,function(h){return"%26%23"+parseInt(h.slice(2),16)+"%3B"});let m="";for(let h=0;h<g.length;h+=A){const u=g.length>=A?g.slice(h,h+A):g,l=[];for(let f=0;f<u.length;++f){let n=u.charCodeAt(f);if(n===45||n===46||n===95||n===126||n>=48&&n<=57||n>=65&&n<=90||n>=97&&n<=122||y===_&&(n===40||n===41)){l[l.length]=u.charAt(f);continue}if(n<128){l[l.length]=p[n];continue}if(n<2048){l[l.length]=p[192|n>>6]+p[128|n&63];continue}if(n<55296||n>=57344){l[l.length]=p[224|n>>12]+p[128|n>>6&63]+p[128|n&63];continue}f+=1,n=65536+((n&1023)<<10|u.charCodeAt(f)&1023),l[l.length]=p[240|n>>18]+p[128|n>>12&63]+p[128|n>>6&63]+p[128|n&63]}m+=l.join("")}return m},"encode"),Z=a(function(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},"isBuffer"),O=a(function(t,r){if(X(t)){const e=[];for(let o=0;o<t.length;o+=1)e.push(r(t[o]));return e}return r(t)},"maybeMap"),V={brackets:a(function(t){return t+"[]"},"brackets"),comma:"comma",indices:a(function(t,r){return t+"["+r+"]"},"indices"),repeat:a(function(t){return t},"repeat")},d=Array.isArray,tt=Array.prototype.push,K=a(function(i,t){tt.apply(i,d(t)?t:[t])},"pushToArray"),et=Date.prototype.toISOString,z=L,j={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Y,encodeValuesOnly:!1,format:z,formatter:J[z],indices:!1,serializeDate:a(function(t){return et.call(t)},"serializeDate"),skipNulls:!1,strictNullHandling:!1},nt=a(function(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"},"isNonNullishPrimitive"),E={},$=a(function(t,r,e,o,y,g,m,h,u,l,f,n,P,U,b,S,F,w){let s=t,N=w,C=0,B=!1;for(;(N=N.get(E))!==void 0&&!B;){const c=N.get(t);if(C+=1,typeof c<"u"){if(c===C)throw new RangeError("Cyclic object value");B=!0}typeof N.get(E)>"u"&&(C=0)}if(typeof l=="function"?s=l(r,s):s instanceof Date?s=P(s):e==="comma"&&d(s)&&(s=O(s,function(c){return c instanceof Date?P(c):c})),s===null){if(g)return u&&!S?u(r,j.encoder,F,"key",U):r;s=""}if(nt(s)||Z(s)){if(u){const c=S?r:u(r,j.encoder,F,"key",U);return[b(c)+"="+b(u(s,j.encoder,F,"value",U))]}return[b(r)+"="+b(String(s))]}const M=[];if(typeof s>"u")return M;let k;if(e==="comma"&&d(s))S&&u&&(s=O(s,u)),k=[{value:s.length>0?s.join(",")||null:void 0}];else if(d(l))k=l;else{const c=Object.keys(s);k=f?c.sort(f):c}const T=h?r.replace(/\./g,"%2E"):r,R=o&&d(s)&&s.length===1?T+"[]":T;if(y&&d(s)&&s.length===0)return R+"[]";for(let c=0;c<k.length;++c){const x=k[c],q=typeof x=="object"&&typeof x.value<"u"?x.value:s[x];if(m&&q===null)continue;const v=n&&h?x.replace(/\./g,"%2E"):x,Q=d(s)?typeof e=="function"?e(R,v):R:R+(n?"."+v:"["+v+"]");w.set(t,C);const D=new WeakMap;D.set(E,w),K(M,$(q,Q,e,o,y,g,m,h,e==="comma"&&S&&d(s)?null:u,l,f,n,P,U,b,S,F,D))}return M},"stringify"),rt=a(function(t){return j},"normalizeStringifyOptions");function st(i,t){let r=i;const e=rt();let o,y;typeof e.filter=="function"?(y=e.filter,r=y("",r)):d(e.filter)&&(y=e.filter,o=y);const g=[];if(typeof r!="object"||r===null)return"";const m=V[e.arrayFormat],h=m==="comma"&&e.commaRoundTrip;o||(o=Object.keys(r)),e.sort&&o.sort(e.sort);const u=new WeakMap;for(let n=0;n<o.length;++n){const P=o[n];e.skipNulls&&r[P]===null||K(g,$(r[P],P,m,h,e.allowEmptyArrays,e.strictNullHandling,e.skipNulls,e.encodeDotInKeys,e.encode?e.encoder:null,e.filter,e.sort,e.allowDots,e.serializeDate,e.format,e.formatter,e.encodeValuesOnly,e.charset,u))}const l=g.join(e.delimiter);let f=e.addQueryPrefix===!0?"?":"";return e.charsetSentinel&&(e.charset==="iso-8859-1"?f+="utf8=%26%2310003%3B&":f+="utf8=%E2%9C%93&"),l.length>0?f+l:""}a(st,"stringify");var it=Object.defineProperty,ot=a((i,t)=>it(i,"name",{value:t,configurable:!0}),"n");class at extends Array{static{a(this,"g")}constructor(t,r,e,...o){super(...o),this.totalNumber=t,this.perPage=r,this.currentPage=e,this.totalNumber=Number(t),this.rows=o,this.isEmpty=this.rows.length===0}static{ot(this,"Paginator")}firstPage=1;isEmpty;qs={};rows;url="/";all(){return this.rows}baseUrl(t){return this.url=t,this}getMeta(){return{firstPage:this.firstPage,firstPageUrl:this.getUrl(1),lastPage:this.lastPage,lastPageUrl:this.getUrl(this.lastPage),nextPageUrl:this.getNextPageUrl(),page:this.currentPage,perPage:this.perPage,previousPageUrl:this.getPreviousPageUrl(),total:this.total}}getNextPageUrl(){return this.hasMorePages?this.getUrl(this.currentPage+1):null}getPreviousPageUrl(){return this.currentPage>1?this.getUrl(this.currentPage-1):null}getUrl(t){const r=st({...this.qs,page:t<1?1:t});return`${this.url}?${r}`}getUrlsForRange(t,r){const e=[];for(let o=t;o<=r;o++)e.push({isActive:o===this.currentPage,page:o,url:this.getUrl(o)});return e}queryString(t){return this.qs=t,this}toJSON(){return{data:this.all(),meta:this.getMeta()}}get hasMorePages(){return this.lastPage>this.currentPage}get hasPages(){return this.lastPage!==1}get hasTotal(){return this.total>0}get lastPage(){return Math.max(Math.ceil(this.total/this.perPage),1)}get total(){return Number(this.totalNumber)}}export{at as default};