@develia/commons 0.3.43 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. package/dist/cjs/array.js +44 -0
  2. package/dist/cjs/array.js.map +1 -0
  3. package/dist/cjs/async-pool-executor.js +49 -0
  4. package/dist/cjs/async-pool-executor.js.map +1 -0
  5. package/dist/cjs/cache-dictionary.js +67 -0
  6. package/dist/cjs/cache-dictionary.js.map +1 -0
  7. package/dist/cjs/clean-url-search-params.js +10 -0
  8. package/dist/cjs/clean-url-search-params.js.map +1 -0
  9. package/dist/cjs/collections/default-map.js +21 -0
  10. package/dist/cjs/collections/default-map.js.map +1 -0
  11. package/dist/cjs/collections/lazy-map.js +22 -0
  12. package/dist/cjs/collections/lazy-map.js.map +1 -0
  13. package/dist/cjs/collections.js +11 -0
  14. package/dist/cjs/collections.js.map +1 -0
  15. package/dist/cjs/from.js +504 -0
  16. package/dist/cjs/from.js.map +1 -0
  17. package/dist/cjs/index.js +73 -0
  18. package/dist/cjs/index.js.map +1 -0
  19. package/dist/cjs/key-value-pair.js +16 -0
  20. package/dist/cjs/key-value-pair.js.map +1 -0
  21. package/dist/cjs/lazy.js +25 -0
  22. package/dist/cjs/lazy.js.map +1 -0
  23. package/dist/cjs/math.js +15 -0
  24. package/dist/cjs/math.js.map +1 -0
  25. package/dist/cjs/order.js +9 -0
  26. package/dist/cjs/order.js.map +1 -0
  27. package/dist/cjs/patch.js +44 -0
  28. package/dist/cjs/patch.js.map +1 -0
  29. package/dist/cjs/stopwatch.js +36 -0
  30. package/dist/cjs/stopwatch.js.map +1 -0
  31. package/dist/cjs/string.js +29 -0
  32. package/dist/cjs/string.js.map +1 -0
  33. package/dist/cjs/timer.js +50 -0
  34. package/dist/cjs/timer.js.map +1 -0
  35. package/dist/cjs/timespan.js +152 -0
  36. package/dist/cjs/timespan.js.map +1 -0
  37. package/dist/cjs/type.js +16 -0
  38. package/dist/cjs/type.js.map +1 -0
  39. package/dist/cjs/types.js +3 -0
  40. package/dist/cjs/types.js.map +1 -0
  41. package/dist/cjs/utilities.js +309 -0
  42. package/dist/cjs/utilities.js.map +1 -0
  43. package/dist/esm/array.js +38 -0
  44. package/dist/esm/array.js.map +1 -0
  45. package/dist/esm/async-pool-executor.js +46 -0
  46. package/dist/esm/async-pool-executor.js.map +1 -0
  47. package/dist/esm/cache-dictionary.js +64 -0
  48. package/dist/esm/cache-dictionary.js.map +1 -0
  49. package/dist/esm/clean-url-search-params.js +7 -0
  50. package/dist/esm/clean-url-search-params.js.map +1 -0
  51. package/dist/esm/collections/default-map.js +18 -0
  52. package/dist/esm/collections/default-map.js.map +1 -0
  53. package/dist/esm/collections/lazy-map.js +19 -0
  54. package/dist/esm/collections/lazy-map.js.map +1 -0
  55. package/dist/esm/collections.js +3 -0
  56. package/dist/esm/collections.js.map +1 -0
  57. package/dist/esm/from.js +495 -0
  58. package/dist/esm/from.js.map +1 -0
  59. package/dist/esm/index.js +19 -0
  60. package/dist/esm/index.js.map +1 -0
  61. package/dist/esm/key-value-pair.js +13 -0
  62. package/dist/esm/key-value-pair.js.map +1 -0
  63. package/dist/esm/lazy.js +22 -0
  64. package/dist/esm/lazy.js.map +1 -0
  65. package/dist/esm/math.js +11 -0
  66. package/dist/esm/math.js.map +1 -0
  67. package/dist/esm/order.js +7 -0
  68. package/dist/esm/order.js.map +1 -0
  69. package/dist/esm/patch.js +40 -0
  70. package/dist/esm/patch.js.map +1 -0
  71. package/dist/esm/stopwatch.js +30 -0
  72. package/dist/esm/stopwatch.js.map +1 -0
  73. package/dist/esm/string.js +24 -0
  74. package/dist/esm/string.js.map +1 -0
  75. package/dist/esm/timer.js +47 -0
  76. package/dist/esm/timer.js.map +1 -0
  77. package/dist/esm/timespan.js +150 -0
  78. package/dist/esm/timespan.js.map +1 -0
  79. package/dist/esm/type.js +14 -0
  80. package/dist/esm/type.js.map +1 -0
  81. package/dist/esm/types.js +2 -0
  82. package/dist/esm/types.js.map +1 -0
  83. package/dist/esm/utilities.js +277 -0
  84. package/dist/esm/utilities.js.map +1 -0
  85. package/dist/types/array.d.ts +6 -0
  86. package/dist/types/array.d.ts.map +1 -0
  87. package/dist/types/async-pool-executor.d.ts +14 -0
  88. package/dist/types/async-pool-executor.d.ts.map +1 -0
  89. package/dist/types/cache-dictionary.d.ts +16 -0
  90. package/dist/types/cache-dictionary.d.ts.map +1 -0
  91. package/dist/types/clean-url-search-params.d.ts +4 -0
  92. package/dist/types/clean-url-search-params.d.ts.map +1 -0
  93. package/dist/types/collections/default-map.d.ts +7 -0
  94. package/dist/types/collections/default-map.d.ts.map +1 -0
  95. package/dist/types/collections/lazy-map.d.ts +6 -0
  96. package/dist/types/collections/lazy-map.d.ts.map +1 -0
  97. package/dist/types/collections.d.ts +3 -0
  98. package/dist/types/collections.d.ts.map +1 -0
  99. package/dist/types/from.d.ts +59 -0
  100. package/dist/types/from.d.ts.map +1 -0
  101. package/dist/types/index.d.ts +19 -0
  102. package/dist/types/index.d.ts.map +1 -0
  103. package/dist/types/key-value-pair.d.ts +8 -0
  104. package/dist/types/key-value-pair.d.ts.map +1 -0
  105. package/dist/types/lazy.d.ts +11 -0
  106. package/dist/types/lazy.d.ts.map +1 -0
  107. package/dist/types/math.d.ts +3 -0
  108. package/dist/types/math.d.ts.map +1 -0
  109. package/dist/types/order.d.ts +6 -0
  110. package/dist/types/order.d.ts.map +1 -0
  111. package/dist/types/patch.d.ts +8 -0
  112. package/dist/types/patch.d.ts.map +1 -0
  113. package/dist/types/stopwatch.d.ts +10 -0
  114. package/dist/types/stopwatch.d.ts.map +1 -0
  115. package/dist/types/string.d.ts +4 -0
  116. package/dist/types/string.d.ts.map +1 -0
  117. package/dist/types/timer.d.ts +15 -0
  118. package/dist/types/timer.d.ts.map +1 -0
  119. package/dist/types/timespan.d.ts +47 -0
  120. package/dist/types/timespan.d.ts.map +1 -0
  121. package/dist/types/type.d.ts +13 -0
  122. package/dist/types/type.d.ts.map +1 -0
  123. package/dist/types/types.d.ts +14 -0
  124. package/dist/types/types.d.ts.map +1 -0
  125. package/dist/types/utilities.d.ts +31 -0
  126. package/dist/types/utilities.d.ts.map +1 -0
  127. package/dist/web/array.js +38 -0
  128. package/dist/web/array.js.map +1 -0
  129. package/dist/web/async-pool-executor.js +46 -0
  130. package/dist/web/async-pool-executor.js.map +1 -0
  131. package/dist/web/cache-dictionary.js +64 -0
  132. package/dist/web/cache-dictionary.js.map +1 -0
  133. package/dist/web/clean-url-search-params.js +7 -0
  134. package/dist/web/clean-url-search-params.js.map +1 -0
  135. package/dist/web/collections/default-map.js +18 -0
  136. package/dist/web/collections/default-map.js.map +1 -0
  137. package/dist/web/collections/lazy-map.js +19 -0
  138. package/dist/web/collections/lazy-map.js.map +1 -0
  139. package/dist/web/collections.js +3 -0
  140. package/dist/web/collections.js.map +1 -0
  141. package/dist/web/from.js +496 -0
  142. package/dist/web/from.js.map +1 -0
  143. package/dist/web/index.js +19 -0
  144. package/dist/web/index.js.map +1 -0
  145. package/dist/web/key-value-pair.js +13 -0
  146. package/dist/web/key-value-pair.js.map +1 -0
  147. package/dist/web/lazy.js +22 -0
  148. package/dist/web/lazy.js.map +1 -0
  149. package/dist/web/math.js +11 -0
  150. package/dist/web/math.js.map +1 -0
  151. package/dist/web/order.js +7 -0
  152. package/dist/web/order.js.map +1 -0
  153. package/dist/web/patch.js +40 -0
  154. package/dist/web/patch.js.map +1 -0
  155. package/dist/web/stopwatch.js +30 -0
  156. package/dist/web/stopwatch.js.map +1 -0
  157. package/dist/web/string.js +24 -0
  158. package/dist/web/string.js.map +1 -0
  159. package/dist/web/timer.js +47 -0
  160. package/dist/web/timer.js.map +1 -0
  161. package/dist/web/timespan.js +150 -0
  162. package/dist/web/timespan.js.map +1 -0
  163. package/dist/web/type.js +14 -0
  164. package/dist/web/type.js.map +1 -0
  165. package/dist/web/types.js +2 -0
  166. package/dist/web/types.js.map +1 -0
  167. package/dist/web/utilities.js +277 -0
  168. package/dist/web/utilities.js.map +1 -0
  169. package/package.json +25 -12
  170. package/src/array.ts +49 -0
  171. package/src/async-pool-executor.ts +2 -2
  172. package/src/collections/default-map.ts +42 -0
  173. package/src/collections/lazy-map.ts +24 -0
  174. package/src/collections.ts +2 -24
  175. package/src/from.ts +4 -4
  176. package/src/index.ts +28 -22
  177. package/src/lazy.ts +1 -1
  178. package/src/patch.ts +80 -0
  179. package/src/stopwatch.ts +1 -1
  180. package/src/{typing.ts → type.ts} +3 -1
  181. package/src/types.ts +4 -1
  182. package/src/utilities.ts +23 -3
  183. package/dist/develia-commons.js +0 -1670
  184. package/dist/develia-commons.min.js +0 -1
  185. package/dist/index.cjs.js +0 -1668
  186. package/dist/index.cjs.js.map +0 -1
  187. package/dist/index.esm.js +0 -1622
  188. package/dist/index.esm.js.map +0 -1
  189. package/src/array-manipulator.ts +0 -159
@@ -1 +0,0 @@
1
- !function(t){"use strict";var e,r;t.Type=void 0,(e=t.Type||(t.Type={})).Undefined="undefined",e.Number="number",e.String="string",e.Boolean="boolean",e.Object="object",e.Function="function",e.Symbol="symbol",e.BigInt="bigint",e.Null="null";class n{get value(){return this._value}get key(){return this._key}constructor(t,e){this._key=t,this._value=e}}function i(t){return"function"==typeof t}function s(t,e){if(t===e)return!0;if(null===t||null===e||typeof t!=typeof e)return!1;if(Array.isArray(t)&&Array.isArray(e))return t.length===e.length&&t.every(((t,r)=>t===e[r]));if("object"==typeof t&&"object"==typeof e){const r=Object.keys(t),n=Object.keys(e);return r.length===n.length&&r.every((r=>e.hasOwnProperty(r)&&t[r]===e[r]))}return!1}async function o(t){await new Promise((e=>setTimeout(e,t)))}async function l(t){const e="string"==typeof t?document.querySelector(t):t;if(!(e instanceof HTMLFormElement))throw new Error("Invalid element.");return await fetch(e.action,{method:e.method,body:new FormData(e)})}function a(t){let e=[];for(const r in t)e.push(new n(r,t[r]));return e}function u(t,e,r=""){for(const n in t)if(t.hasOwnProperty(n)){const i=t[n];i instanceof Date?e.append(r?`${r}[${n}]`:n,i.toISOString()):i instanceof File?e.append(r?`${r}[${n}]`:n,i):"object"!=typeof i||Array.isArray(i)?Array.isArray(i)?i.forEach(((t,i)=>{const s=`${r?`${r}[${n}]`:n}[${i}]`;"object"!=typeof t||Array.isArray(t)?e.append(s,t):u(t,e,s)})):e.append(r?`${r}[${n}]`:n,i):u(i,e,r?`${r}[${n}]`:n)}return e}!function(t){t.Ascending="asc",t.Descending="desc"}(r||(r={}));var c=r;class f{static object(t){return new f((function(){return a(t)}))}constructor(t){this._fn=t}static fn(t){return new f(t)}collect(){const t=Array.from(this);return f.iterable(t)}static iterable(t){return f.fn((function*(){for(const e of t)yield e}))}map(t){const e=this;return f.fn((function*(){for(let r of e)yield t(r)}))}*[Symbol.iterator](){yield*this._fn()}all(t){for(let e of this._fn())if(!t(e))return!1;return!0}any(t=void 0){for(let e of this)if(null==t||t(e))return!0;return!1}get length(){return this.count()}count(t=void 0){let e=0;for(let r of this)(null==t||t(r))&&e++;return e}filter(t){const e=this;return f.fn((function*(){for(let r of e)t(r)&&(yield r)}))}contains(t){for(let e of this)if(e===t)return!0;return!1}first(t){if(t){for(let e of this)if(t(e))return e}else for(let t of this)return t}single(t){let e=!1,r=null;if(t){for(let n of this)if(t(n)){if(e)throw new Error("Sequence contains more than one element.");e=!0,r=n}}else for(let t of this){if(e)throw new Error("Sequence contains more than one element.");e=!0,r=t}return r}append(t){const e=this;return f.fn((function*(){for(let t of e)yield t;yield t}))}prepend(t){const e=this;return f.fn((function*(){yield t;for(let t of e)yield t}))}at(t){let e=0;for(let r of this)if(e++===t)return r}last(t){let e;if(t)for(let r of this)t&&!t(r)||(e=r);else for(let t of this)e=t;return e}mapMany(t){const e=this;return f.fn((function*(){for(const r of e){const e=t(r);for(const t of e)yield t}}))}flatten(){const t=this;return f.fn((function*(){for(let e of t){let t=e;for(let e of t)yield e}}))}sum(t){let e=0;if(t)for(let r of this)e+=t(r);else for(let t of this)e+=t;return e}avg(t){let e=0,r=0;if(t)for(let n of this)e+=t(n),r++;else for(let t of this)e+=t,r++;return r>0?e/r:0}max(t){let e=-1/0;for(let r of this){let n=t(r);e=n>e?n:e}return e}min(t){let e=1/0;for(let r of this){let n=t(r);e=n<e?n:e}return e}maxBy(t){let e,r=-1/0;for(let n of this){let i=t(n);i>r&&(r=i,e=n)}return e}minBy(t){let e,r=1/0;for(let n of this){let i=t(n);i<r&&(r=i,e=n)}return e}orderBy(t,e=c.Ascending){const r=Array.from(this._fn());if(e==c.Ascending)r.sort(((e,r)=>{const n=t(e),i=t(r);return n>i?1:i>n?-1:0}));else{if(e!=c.Descending)throw new Error("invalid order argument");r.sort(((e,r)=>{const n=t(e),i=t(r);return n>i?1:i<n?-1:0}))}return f.iterable(r)}groupBy(t,e){e=null==e?s:e;const r=this;return f.fn((function*(){const n=[];for(let i of r){const r=t(i);let s=!1;for(let[t,o]of n)if(e(r,t)){o.push(i),s=!0;break}s||n.push([r,[i]])}yield*n.map((([t,e])=>new h(t,e)))}))}head(t){const e=this;return f.fn((function*(){let r=0;for(let n of e){if(!(r++<t))return;yield n}}))}tail(t){const e=this;return f.fn((function*(){let r=[];for(let n of e)r.push(n),r.length>t&&r.shift();yield*r}))}forEach(t){for(let e of this)t(e)}toArray(){return Array.from(this)}toRecord(t,e){const r={};for(let n of this)r[t(n)]=e(n);return r}toMap(t,e){const r=new Map;for(let n of this){const i=t(n),s=e(n);r.set(i,s)}return r}instancesOf(t){return this.filter((e=>typeof e===t))}allInstanceOf(t){for(let e of this)if(!(e instanceof t))return!1;return!0}distinct(t){null==t&&(t=s);const e=this;return f.fn((function*(){const r=[];for(let n of e)f.iterable(r).any((e=>t(e,n)))||(r.push(n),yield n)}))}insert(t,e){const r=this;return f.fn((function*(){let n=0,i=!1;for(let s of r)n===e&&(yield t,i=!0),yield s,n++;i||(yield t)}))}skip(t){const e=this;return f.fn((function*(){let r=0;for(let n of e)r>=t&&(yield n),r++}))}union(t){const e=this;return f.fn((function*(){yield*e,yield*t}))}innerJoin(t,e,r,n){const i=this;return f.fn((()=>{const s=new Map;for(let e of t)s.set(r(e),e);return Array.from(i).filter((t=>s.has(e(t)))).map((t=>n(t,s.get(e(t)))))}))}leftJoin(t,e,r,n){const i=this;return f.fn((()=>{const s=new Map;for(let e of t)s.set(r(e),e);return Array.from(i).map((t=>n(t,s.get(e(t)))))}))}leftGroupJoin(t,e,r,n){const i=this;return f.fn((()=>{const s=new Map;for(let e of t){const t=r(e);s.has(t)||s.set(t,[]),s.get(t).push(e)}return Array.from(i).map((t=>n(t,s.get(e(t))||[])))}))}rightGroupJoin(t,e,r,n){const i=this;return f.fn((()=>{const s=new Map;for(let t of i){const r=e(t);s.has(r)||s.set(r,[]),s.get(r).push(t)}return Array.from(t).map((t=>n(s.get(r(t))||[],t)))}))}rightJoin(t,e,r,n){const i=this;return f.fn((()=>{const s=new Map;for(let t of i)s.set(e(t),t);return Array.from(t).map((t=>n(s.get(r(t)),t)))}))}}class h extends f{get key(){return this._key}constructor(t,e){super((()=>e)),this._key=t}}class d{constructor(t){this.milliseconds=t}seconds(){return this.milliseconds/1e3}minutes(){return this.milliseconds/6e4}hours(){return this.milliseconds/36e5}days(){return this.milliseconds/864e5}weeks(){return this.milliseconds/6048e5}static fromMilliseconds(t){return new d(t)}static fromSeconds(t){return new d(1e3*t)}static fromMinutes(t){return new d(1e3*t*60)}static fromHours(t){return new d(1e3*t*60*60)}static fromDays(t){return new d(1e3*t*60*60*24)}static fromWeeks(t){return new d(1e3*t*60*60*24*7)}addMilliseconds(t){return new d(this.milliseconds+t)}addSeconds(t){return this.addMilliseconds(1e3*t)}addMinutes(t){return this.addMilliseconds(1e3*t*60)}addHours(t){return this.addMilliseconds(1e3*t*60*60)}addDays(t){return this.addMilliseconds(1e3*t*60*60*24)}addWeeks(t){return this.addMilliseconds(1e3*t*60*60*24*7)}subtractMilliseconds(t){return new d(this.milliseconds-t)}subtractSeconds(t){return this.subtractMilliseconds(1e3*t)}subtractMinutes(t){return this.subtractMilliseconds(1e3*t*60)}subtractHours(t){return this.subtractMilliseconds(1e3*t*60*60)}subtractDays(t){return this.subtractMilliseconds(1e3*t*60*60*24)}subtractWeeks(t){return this.subtractMilliseconds(1e3*t*60*60*24*7)}add(t){return new d(this.milliseconds+t.milliseconds)}subtract(t){return new d(this.milliseconds-t.milliseconds)}addTo(t){return new Date(t.getTime()+this.milliseconds)}subtractFrom(t){return new Date(t.getTime()-this.milliseconds)}static fromDifference(t,e){return new d(e.getTime()-t.getTime())}format(t="hh:mm:ss"){const e=t.toLowerCase(),r=e.includes("h"),n=e.includes("m");let i=0,s=0,o=Math.floor(this.milliseconds/1e3);r&&(i=Math.floor(o/3600),o-=3600*i),n&&(s=Math.floor(o/60),o-=60*s);const l=String(i).padStart(2,"0"),a=String(s).padStart(2,"0"),u=String(o).padStart(2,"0");return e.replace("hh",l).replace("h",i.toString()).replace("mm",a).replace("m",s.toString()).replace("ss",u).replace("s",o.toString())}eq(t){return this.milliseconds===t.milliseconds}le(t){return this.milliseconds<=t.milliseconds}lt(t){return this.milliseconds<t.milliseconds}ge(t){return this.milliseconds>=t.milliseconds}gt(t){return this.milliseconds>t.milliseconds}multiply(t){return new d(this.milliseconds*t)}divide(t){return new d(this.milliseconds/t)}abs(){return new d(Math.abs(this.milliseconds))}isInfinite(){return this.milliseconds===Number.POSITIVE_INFINITY||this.milliseconds===Number.NEGATIVE_INFINITY}isPositiveInfinite(){return this.milliseconds===Number.POSITIVE_INFINITY}isNegativeInfinite(){return this.milliseconds===Number.NEGATIVE_INFINITY}}d.INFINITE=new d(Number.POSITIVE_INFINITY),d.NEGATIVE_INFINITE=new d(Number.NEGATIVE_INFINITY);class y{constructor(t){this._array=t}[Symbol.iterator](){return this._array[Symbol.iterator]()}at(t,e=void 0){if(void 0===e)return this._array[t];this._array[t]=e}remove(t){const e=this._array.indexOf(t);return-1!==e&&this._array.splice(e,1),this}map(t){for(let e=0;e<this._array.length;e++)this._array[e]=t(this._array[e]);return this}filter(t){for(let e=0;e<this._array.length;e++)t(this._array[e])||(this._array.splice(e,1),e--);return this}head(t){return this._array.splice(t),this}slice(t,e=void 0){return this._array.splice(0,t),void 0!==e&&this._array.splice(e),this}mapMany(t){let e=0;for(;e<this._array.length;){let r=t(this._array[e]);Array.isArray(r)||(r=Array.from(r)),this._array.splice(e,1,...r),e+=r.length}return this}tail(t){const e=this._array.length-t;return this._array.splice(0,e),this}append(...t){return this._array.push(...t),this}prepend(...t){return this._array.unshift(...t),this}get array(){return this._array}}class m extends URLSearchParams{constructor(t){super(Object.fromEntries(Object.entries(t||{}).filter((([t,e])=>null!=e))))}}t.ArrayManipulator=y,t.AsyncPoolExecutor=class{get maxConcurrency(){return this._maxConcurrency}set maxConcurrency(t){this._maxConcurrency=t}constructor(t,e=50){this._taskQueue=[],this._maxConcurrency=t,this._checkIntervalMs=e,this._activeTasks=0}submit(t){this._taskQueue.push(t),null==this._proccess&&(this._proccess=setTimeout((async()=>{for(;this._taskQueue.length>0;){for(;this._activeTasks>=this._maxConcurrency;)await o(this._checkIntervalMs);const t=this._taskQueue.shift();t&&(this._activeTasks++,setTimeout((async()=>{try{await t()}finally{this._activeTasks--}})))}this._proccess=null}),0))}async shutdown(){for(;this._taskQueue.length>0||this._activeTasks>0;)await o(this._checkIntervalMs)}},t.CacheDictionary=class{constructor(t=null,e=null){this.fallback=t,this.cache={},this.defaultDuration=e,this.expiration={}}getExpiration(t){return this.expiration[t]}setExpiration(t,e){this.expiration[t]=e}setDuration(t,e){if(null===e)delete this.expiration[t];else{const r=new Date;r.setSeconds(r.getSeconds()+e),this.expiration[t]=r}}get(t){if(!this.cache.hasOwnProperty(t)){if(!this.fallback)return null;this.cache[t]=this.fallback(t),this.expiration[t]=this.calculateExpiration(this.defaultDuration)}return this.isExpired(t)?(this.remove(t),null):this.cache[t]}set(t,e,r=null){this.cache[t]=e,this.expiration[t]=this.calculateExpiration(r)}remove(t){delete this.cache[t],delete this.expiration[t]}isExpired(t){const e=this.expiration[t];return e instanceof Date&&e<new Date}calculateExpiration(t){if(null===t)return;const e=new Date;return e.setSeconds(e.getSeconds()+t),e}},t.CleanURLSearchParams=m,t.From=f,t.KeyValuePair=n,t.Lazy=class{constructor(t){this._valueCreated=!1,this._value=null,this._factoryMethod=t}get valueCreated(){return this._valueCreated}get value(){return this._valueCreated||(this._value=this._factoryMethod(),this._valueCreated=!0),this._value}reset(){this._valueCreated=!1,this._value=null}},t.Order=c,t.Stopwatch=class{constructor(){this.startTime=null,this.elapsedTime=null}start(){this.startTime=performance.now(),this.elapsedTime=null}stop(){null!==this.startTime&&(this.elapsedTime=performance.now()-this.startTime,this.startTime=null)}resume(){null!==this.elapsedTime&&(this.startTime=performance.now()-this.elapsedTime,this.elapsedTime=null)}getElapsedTime(){var t;return null!==this.startTime?d.fromMilliseconds(performance.now()-this.startTime):d.fromMilliseconds(null!==(t=this.elapsedTime)&&void 0!==t?t:0)}},t.TimeSpan=d,t.Timer=class{constructor(t,e){this._callback=t,this._interval=e,this._intervalId=null}get running(){return null!==this._intervalId&&void 0!==this._intervalId}get interval(){return this._interval}set interval(t){t!=this._interval&&(this._interval=t,this.running&&this.restart())}get callback(){return this._callback}set callback(t){t!=this._callback&&(this._callback=t)}start(){null===this._intervalId&&(this._intervalId=setInterval((()=>{null!=this._callback&&this._callback()}),this._interval))}stop(){null!==this._intervalId&&(clearInterval(this._intervalId),this._intervalId=null)}restart(){this.stop(),this.start()}},t.ajaxSubmission=function(t,e=void 0,r=void 0){const n="string"==typeof t?document.querySelector(t):t;n instanceof HTMLFormElement&&n.addEventListener("submit",(async t=>{t.preventDefault();let i=l(n);i&&(e&&(i=i.then(e)),r&&i.catch(r))}))},t.ajaxSubmit=l,t.array=function(t){return new y(t)},t.clamp=function(t,e,r){return t<=e?e:t>=r?r:t},t.deepClone=function t(e){if(null===e||"object"!=typeof e)return e;if(Array.isArray(e)){const r=[];for(const n of e)r.push(t(n));return r}const r={};for(const n in e)e.hasOwnProperty(n)&&(r[n]=t(e[n]));return r},t.deepEqual=function t(e,r){if(e===r)return!0;if(null===e||null===r||typeof e!=typeof r)return!1;if(Array.isArray(e)&&Array.isArray(r)){if(e.length!==r.length)return!1;for(let n=0;n<e.length;n++)if(!t(e[n],r[n]))return!1;return!0}if("object"==typeof e&&"object"==typeof r){const n=Object.keys(e),i=Object.keys(r);if(n.length!==i.length)return!1;for(const s of n)if(!i.includes(s)||!t(e[s],r[s]))return!1;return!0}return!1},t.delay=o,t.ensurePrefix=function(t,e){return t.startsWith(e)?t:e+t},t.ensureSuffix=function(t,e){return t.endsWith(e)?t:t+e},t.format=function(t,...e){let r;return 1===e.length&&"object"==typeof e[0]?(e=e[0],r=/{(.+?)}/g):r=/{(\d+?)}/g,t.replace(r,((t,r)=>void 0!==e[r]?e[r]:""))},t.from=function(t){if(null==t)throw"Source is null.";if("function"==typeof t)return f.fn(t);if("function"==typeof t[Symbol.iterator])return f.iterable(t);if("object"==typeof t)return f.object(t);throw"Invalid source."},t.getType=function(e){return null===e?t.Type.Null:t.Type[typeof e]},t.isArray=function(t){return Array.isArray(t)},t.isBigInt=function(t){return"bigint"==typeof t},t.isBoolean=function(t){return"boolean"==typeof t},t.isDefined=function(t){return void 0!==t},t.isEmpty=function(t){return Array.isArray(t)&&0===t.length||"string"==typeof t&&""===t||null==t},t.isEmptyOrWhitespace=function(t){return Array.isArray(t)&&0===t.length||"string"==typeof t&&""===t.trim()||null==t},t.isFunction=i,t.isIterable=function(t){return"function"===t[Symbol.iterator]},t.isNull=function(t){return null===t},t.isNullOrUndefined=function(t){return null==t},t.isNumber=function(t){return"number"==typeof t},t.isObject=function(t){return null!=t&&"object"==typeof t&&!Array.isArray(t)},t.isString=function(t){return"string"==typeof t},t.isSymbol=function(t){return"symbol"==typeof t},t.isUndefined=function(t){return void 0===t},t.lerp=function(t,e,r,n,i){return n+(t-e)/(r-e)*(i-n)},t.objectToFormData=function(t){return u(t,new FormData)},t.promisify=function(t){return t instanceof Promise?t:i(t)?new Promise(((e,r)=>{try{e(t())}catch(t){r(t)}})):Promise.resolve(t)},t.pull=function(t,...e){let r=0;for(const n of e){const e=t.indexOf(n);-1!==e&&(t.splice(e,1),r++)}return r},t.shallowEqual=s,t.submitForm=function(t,e,r="POST",n){const i=document.createElement("form");i.method=r.toUpperCase(),i.action=t,i.style.display="none",n&&(i.target=n);const s=(t,e)=>{if(Array.isArray(e))e.forEach((e=>{s(`${t}[]`,e)}));else if("object"==typeof e&&null!==e)for(const r in e)e.hasOwnProperty(r)&&s(`${t}[${r}]`,e[r]);else{const r=document.createElement("input");r.type="hidden",r.name=t,r.value=String(e),i.appendChild(r)}};for(const t in e)e.hasOwnProperty(t)&&s(t,e[t]);document.body.appendChild(i),i.submit()},t.toPairs=a}(this.window=this.window||{});