@nejs/basic-extensions 1.10.0 → 2.0.1

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/README.md CHANGED
@@ -177,27 +177,29 @@ import { FunctionExtensions } from '@nejs/basic-extensions';
177
177
  * [Parameters](#parameters-44)
178
178
  * [applyTo](#applyto)
179
179
  * [Parameters](#parameters-45)
180
- * [toPrimitive](#toprimitive)
180
+ * [toObject](#toobject)
181
181
  * [Parameters](#parameters-46)
182
+ * [toPrimitive](#toprimitive)
183
+ * [Parameters](#parameters-47)
182
184
  * [toStringTag](#tostringtag)
183
185
  * [for](#for-1)
184
- * [Parameters](#parameters-47)
185
- * [getData](#getdata)
186
186
  * [Parameters](#parameters-48)
187
- * [getAccessor](#getaccessor)
187
+ * [getData](#getdata)
188
188
  * [Parameters](#parameters-49)
189
- * [base](#base)
189
+ * [getAccessor](#getaccessor)
190
190
  * [Parameters](#parameters-50)
191
- * [accessor](#accessor)
191
+ * [base](#base)
192
192
  * [Parameters](#parameters-51)
193
- * [data](#data)
193
+ * [accessor](#accessor)
194
194
  * [Parameters](#parameters-52)
195
- * [isDescriptor](#isdescriptor-1)
195
+ * [data](#data)
196
196
  * [Parameters](#parameters-53)
197
- * [isData](#isdata-1)
197
+ * [isDescriptor](#isdescriptor-1)
198
198
  * [Parameters](#parameters-54)
199
- * [isAccessor](#isaccessor-1)
199
+ * [isData](#isdata-1)
200
200
  * [Parameters](#parameters-55)
201
+ * [isAccessor](#isaccessor-1)
202
+ * [Parameters](#parameters-56)
201
203
  * [flexible](#flexible)
202
204
  * [enigmatic](#enigmatic)
203
205
  * [intrinsic](#intrinsic)
@@ -206,100 +208,100 @@ import { FunctionExtensions } from '@nejs/basic-extensions';
206
208
  * [ACCESSOR\_KEYS](#accessor_keys)
207
209
  * [DATA\_KEYS](#data_keys)
208
210
  * [maskAs](#maskas)
209
- * [Parameters](#parameters-56)
210
- * [maskAsString](#maskasstring)
211
211
  * [Parameters](#parameters-57)
212
- * [maskAsNumber](#maskasnumber)
212
+ * [maskAsString](#maskasstring)
213
213
  * [Parameters](#parameters-58)
214
- * [GenericMask](#genericmask)
214
+ * [maskAsNumber](#maskasnumber)
215
215
  * [Parameters](#parameters-59)
216
- * [StringMask](#stringmask)
216
+ * [GenericMask](#genericmask)
217
217
  * [Parameters](#parameters-60)
218
- * [NumberMask](#numbermask)
218
+ * [StringMask](#stringmask)
219
219
  * [Parameters](#parameters-61)
220
+ * [NumberMask](#numbermask)
221
+ * [Parameters](#parameters-62)
220
222
  * [RefSet](#refset)
221
223
  * [objectifying](#objectifying)
222
- * [Parameters](#parameters-62)
224
+ * [Parameters](#parameters-63)
223
225
  * [objectifyValues](#objectifyvalues)
224
226
  * [objectifyValues](#objectifyvalues-1)
225
- * [Parameters](#parameters-63)
226
- * [add](#add)
227
227
  * [Parameters](#parameters-64)
228
- * [addAll](#addall)
228
+ * [add](#add)
229
229
  * [Parameters](#parameters-65)
230
+ * [addAll](#addall)
231
+ * [Parameters](#parameters-66)
230
232
  * [clean](#clean)
231
233
  * [entries](#entries-1)
232
- * [Parameters](#parameters-66)
233
- * [forEach](#foreach)
234
234
  * [Parameters](#parameters-67)
235
+ * [forEach](#foreach)
236
+ * [Parameters](#parameters-68)
235
237
  * [values](#values-1)
236
238
  * [keys](#keys)
237
239
  * [has](#has)
238
- * [Parameters](#parameters-68)
239
- * [contains](#contains-2)
240
240
  * [Parameters](#parameters-69)
241
- * [filter](#filter)
241
+ * [contains](#contains-2)
242
242
  * [Parameters](#parameters-70)
243
- * [find](#find-1)
243
+ * [filter](#filter)
244
244
  * [Parameters](#parameters-71)
245
- * [map](#map-1)
245
+ * [find](#find-1)
246
246
  * [Parameters](#parameters-72)
247
+ * [map](#map-1)
248
+ * [Parameters](#parameters-73)
247
249
  * [toStringTag](#tostringtag-1)
248
250
  * [RefMap](#refmap)
249
- * [Parameters](#parameters-73)
251
+ * [Parameters](#parameters-74)
250
252
  * [objectifying](#objectifying-1)
251
- * [Parameters](#parameters-74)
253
+ * [Parameters](#parameters-75)
252
254
  * [asObject](#asobject)
253
255
  * [objectifyValues](#objectifyvalues-2)
254
256
  * [objectifyValues](#objectifyvalues-3)
255
- * [Parameters](#parameters-75)
256
- * [get](#get-2)
257
257
  * [Parameters](#parameters-76)
258
- * [set](#set-2)
258
+ * [get](#get-2)
259
259
  * [Parameters](#parameters-77)
260
- * [setAll](#setall)
260
+ * [set](#set-2)
261
261
  * [Parameters](#parameters-78)
262
+ * [setAll](#setall)
263
+ * [Parameters](#parameters-79)
262
264
  * [clean](#clean-1)
263
265
  * [entries](#entries-2)
264
- * [Parameters](#parameters-79)
265
- * [forEach](#foreach-1)
266
266
  * [Parameters](#parameters-80)
267
+ * [forEach](#foreach-1)
268
+ * [Parameters](#parameters-81)
267
269
  * [values](#values-2)
268
270
  * [hasValue](#hasvalue)
269
- * [Parameters](#parameters-81)
270
- * [filter](#filter-1)
271
271
  * [Parameters](#parameters-82)
272
- * [find](#find-2)
272
+ * [filter](#filter-1)
273
273
  * [Parameters](#parameters-83)
274
- * [map](#map-2)
274
+ * [find](#find-2)
275
275
  * [Parameters](#parameters-84)
276
+ * [map](#map-2)
277
+ * [Parameters](#parameters-85)
276
278
  * [iterator](#iterator)
277
279
  * [toStringTag](#tostringtag-2)
278
280
  * [isValidReference](#isvalidreference)
279
- * [Parameters](#parameters-85)
280
- * [Deferred](#deferred)
281
281
  * [Parameters](#parameters-86)
282
+ * [Deferred](#deferred)
283
+ * [Parameters](#parameters-87)
282
284
  * [value](#value-2)
283
285
  * [reason](#reason)
284
286
  * [settled](#settled)
285
287
  * [promise](#promise)
286
288
  * [resolve](#resolve)
287
- * [Parameters](#parameters-87)
288
- * [reject](#reject)
289
289
  * [Parameters](#parameters-88)
290
+ * [reject](#reject)
291
+ * [Parameters](#parameters-89)
290
292
  * [species](#species)
291
293
  * [promise](#promise-1)
292
294
  * [reject](#reject-1)
293
295
  * [resolve](#resolve-1)
294
296
  * [settled](#settled-1)
295
297
  * [AsyncIterable](#asynciterable)
296
- * [Parameters](#parameters-89)
298
+ * [Parameters](#parameters-90)
297
299
  * [asyncIterator](#asynciterator)
298
300
  * [toStringTag](#tostringtag-3)
299
301
  * [isAsyncIterable](#isasynciterable)
300
- * [Parameters](#parameters-90)
302
+ * [Parameters](#parameters-91)
301
303
  * [AsyncIterator](#asynciterator-1)
302
- * [Parameters](#parameters-91)
304
+ * [Parameters](#parameters-92)
303
305
  * [asArray](#asarray)
304
306
  * [asyncIterable](#asynciterable-1)
305
307
  * [next](#next)
@@ -307,14 +309,14 @@ import { FunctionExtensions } from '@nejs/basic-extensions';
307
309
  * [asyncIterator](#asynciterator-2)
308
310
  * [toStringTag](#tostringtag-4)
309
311
  * [Iterable](#iterable)
310
- * [Parameters](#parameters-92)
312
+ * [Parameters](#parameters-93)
311
313
  * [iterator](#iterator-1)
312
314
  * [asArray](#asarray-1)
313
315
  * [toStringTag](#tostringtag-5)
314
316
  * [isIterable](#isiterable)
315
- * [Parameters](#parameters-93)
317
+ * [Parameters](#parameters-94)
316
318
  * [Iterator](#iterator-2)
317
- * [Parameters](#parameters-94)
319
+ * [Parameters](#parameters-95)
318
320
  * [asArray](#asarray-2)
319
321
  * [iterable](#iterable-1)
320
322
  * [next](#next-1)
@@ -1056,15 +1058,25 @@ Type: [object](#object)
1056
1058
 
1057
1059
  ### constructor
1058
1060
 
1059
- Creates a new instance of Descriptor either from another object or
1060
- around the supplied object descriptor value.
1061
+ Constructs a Descriptor instance which wraps and manages an object
1062
+ property descriptor. The constructor can handle an existing descriptor
1063
+ object or create a new one based on an object and a property key.
1061
1064
 
1062
1065
  #### Parameters
1063
1066
 
1064
- * `object` **[object](#object)** either an object descriptor or the object
1065
- from which to get the descriptor
1066
- * `key` **([symbol](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Symbol) | [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String))** a valid key for accessing the descriptor
1067
- on the aforesupplied object.
1067
+ * `object` **([object](#object) | Descriptor)** The target object or an existing
1068
+ Descriptor instance. If it's an object, it is used in conjunction with
1069
+ `key` to create a descriptor. If it's a Descriptor instance, it is used
1070
+ directly as the descriptor.
1071
+ * `key` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [symbol](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Symbol))?** The property key for which the descriptor
1072
+ is to be created. This parameter is ignored if `object` is a Descriptor
1073
+ instance. If `key` is an object and `object` is a valid descriptor, `key`
1074
+ is treated as the associated object.
1075
+
1076
+ <!---->
1077
+
1078
+ * Throws **[Error](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error)** Throws an error if the constructed descriptor is not
1079
+ valid.
1068
1080
 
1069
1081
  ### isAccessor
1070
1082
 
@@ -1270,6 +1282,24 @@ the specified object using the specified key.
1270
1282
  * `object` **[object](#object)** the object to apply this descriptor to
1271
1283
  * `forKey` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [symbol](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Symbol))** the string or symbol for which this
1272
1284
  descriptor will abe applied
1285
+ * `bindAccessors` (optional, default `false`)
1286
+
1287
+ ### toObject
1288
+
1289
+ Converts this Descriptor class instance into a basic object descriptor
1290
+ that is accepted by all the standard JavaScript runtime methods that
1291
+ deal with object descriptors.
1292
+
1293
+ #### Parameters
1294
+
1295
+ * `bindAccessors` **([boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean) | [object](#object))** if `true`, a non-fatal attempt to
1296
+ bind accessor getter and setter methods is made before returning the
1297
+ object. If `bindAccessors` is truthy and is also an object, this is the
1298
+ object the accessors will be bound to. If the value is falsy or if the
1299
+ descriptor instance represents a data descriptor, nothing happens. (optional, default `false`)
1300
+
1301
+ Returns **[object](#object)** the object instance's basic object representation as
1302
+ a descriptor.
1273
1303
 
1274
1304
  ### toPrimitive
1275
1305
 
@@ -2267,10 +2297,10 @@ arrives over time.
2267
2297
 
2268
2298
  #### Parameters
2269
2299
 
2270
- * `elementsOrFirstElement` **([Iterable](#iterable) | [Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise) | any)** An iterable object,
2271
- a Promise, or the first element.
2300
+ * `elementsOrFirstElement` **([Iterable](#iterable) | AsyncGeneratorFunction | [Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise) | any)** An iterable object, an async generator function, a Promise, or the first
2301
+ element.
2272
2302
  * `moreElements` **...([Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise) | any)** Additional elements if the first
2273
- argument is not an iterable.
2303
+ argument is not an iterable or an async generator function.
2274
2304
 
2275
2305
  #### asyncIterator
2276
2306
 
@@ -2317,8 +2347,9 @@ function.
2317
2347
 
2318
2348
  #### Parameters
2319
2349
 
2320
- * `asyncIterable` **[object](#object)** any object that has a
2321
- `[Symbol.asyncIterable]` property assigned to a generator function.
2350
+ * `asyncIterable` **([object](#object) | AsyncGeneratorFunction)** any object that has a
2351
+ `[Symbol.asyncIterable]` property assigned to a generator function or an
2352
+ async generator function itself.
2322
2353
 
2323
2354
  #### asArray
2324
2355
 
@@ -0,0 +1,8 @@
1
+ var nejsBasicExtensions=(()=>{var I=Object.defineProperty;var ft=Object.getOwnPropertyDescriptor;var ut=Object.getOwnPropertyNames;var lt=Object.prototype.hasOwnProperty;var pt=(r,t)=>{for(var e in t)I(r,e,{get:t[e],enumerable:!0})},ht=(r,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ut(t))!lt.call(r,n)&&n!==e&&I(r,n,{get:()=>t[n],enumerable:!(s=ft(t,n))||s.enumerable});return r};var dt=r=>ht(I({},"__esModule",{value:!0}),r);var Rt={};pt(Rt,{Controls:()=>y,Extensions:()=>E,GlobalFunctionsAndProps:()=>b,InstancePatches:()=>w,Patches:()=>v,StaticPatches:()=>x,all:()=>at,default:()=>jt});var yt=r=>/(\w+)]/.exec(Object.prototype.toString.call(r))[1],O=class extends Error{constructor(t,e){super(`${yt(t)} disallows tampering with ${e}.`),Object.assign(this,{owner:t,key:e})}get[Symbol.toStringTag](){return this.constructor.name}};var mt=r=>/(\w+)]/.exec(Object.prototype.toString.call(r))[1],j=class extends Error{constructor(t,e){super(`${mt(t)} does not have a property named '${e}'.`),Object.assign(this,{owner:t,key:e})}get[Symbol.toStringTag](){return this.constructor.name}};var R=class{constructor(t,e=!1){this.started=!1,this.preventRevert=e,this.patch=t,this.patchName=t.owner?.name??t.owner?.constructor?.name??/(\w+)]/.exec(Object.prototype.toString.call(t.owner))[1],this.state={needsApplication:!1,needsReversion:!1}}start(){return this.started||(this.state.needsApplication=!this.patch.applied,this.state.needsReversion=this.patch.applied,this.started=!0,this.state.needsApplication&&this.patch.apply()),this}stop(){return this.started&&((this.preventRevert||this.patch.applied)&&this.patch.revert(),this.state.needsApplication=!1,this.state.needsReversion=!1,this.started=!1),this}get[Symbol.toStringTag](){return`${this.constructor.name}:${this.patchName}`}[Symbol.for("nodejs.util.inspect.custom")](t,e,s){let n=this[Symbol.toStringTag],o=`(started: ${this.started} needed: ${this.state.needsApplication})`;return s(`${n} ${o}`,{...e,depth:t})}};var m=class{constructor(t,e=globalThis,s=void 0){let n=c=>c==null,o=(c,f=["string","symbol"])=>!n(c)&&!!f.find(l=>l===typeof c),i=c=>o(c,["object"]);if(!o(t))throw console.error("Property",t,`(type: ${typeof t})`,"owningObject",e,`(type: ${typeof e})`,"condition",s,`(type: ${typeof s})`),new TypeError("Property must be non-null and either a string or symbol");if(!i(e))throw new TypeError("Cannot create Patch entry as owning object is invalid");Object.assign(this,{key:t,descriptor:Object.getOwnPropertyDescriptor(e,t),owner:e,condition:typeof s=="function"?s:void 0})}get computed(){return this.isAccessor?this.descriptor.get.bind(this.owner).call():this.descriptor.value}get isData(){return Reflect.has(this.descriptor,"value")}get isAccessor(){return Reflect.has(this.descriptor,"get")}get isReadOnly(){return Reflect.has(this.descriptor,"configurable")&&!this.descriptor.configurable||Reflect.has(this.descriptor,"writable")&&!this.descriptor.writable}get isAllowed(){return this.condition&&typeof this.condition=="function"?this.condition():!0}get[Symbol.toStringTag](){return this.constructor.name}[Symbol.for("nodejs.util.inspect.custom")](t,e,s){let n=this.isData?" Data":" Accessor",o=this.isReadOnly?" [ReadOnly]":"";return`PatchEntry<${this.key}${n}${o}>`}};var a=class r{patchConflicts={};patchEntries={};patchesOwner=void 0;patchCount=0;patchesApplied=0;constructor(t,e,s={}){Object.assign(this,{owner:t,options:s}),this.patchesOwner=e;let n=this?.options.condition;Reflect.ownKeys(e).forEach(o=>{let i=this?.options?.conditions?.[o]??n;try{this.patchEntries[o]=new m(o,this.patchesOwner,i),this.patchCount+=1}catch(c){console.error(`Failed to process patch for ${o}
2
+ `,c)}if(Reflect.has(this.owner,o))try{this.patchConflicts[o]=new m(o,this.owner)}catch(c){console.error(`Cannot capture conflicting patch key ${o}
3
+ `,c)}}),r.patches.has(t)||r.patches.set(t,[]),r.patches.get(t).push(this)}get entries(){return Reflect.ownKeys(this.patchEntries).map(t=>[t,this.patchEntries[t]])}get patches(){return this.entries.reduce((t,[e,s])=>(t[e]=s.computed,t),{})}get patchKeys(){return this.entries.map(([t,e])=>t)}get conflicts(){return Reflect.ownKeys(this.patchConflicts).map(t=>[t,this.patchConflicts[t]])}get applied(){return this.patchesApplied>0}get isPartiallyPatched(){return this.applied}get isFullyPatched(){return this.patchCount==this.patchesApplied}apply(t){let e=this.entries,s={patches:e.length,applied:0,errors:[],notApplied:e.length};e.forEach(([,n])=>{if(n.isAllowed){Object.defineProperty(this.owner,n.key,n.descriptor);let o=Object.getOwnPropertyDescriptor(this.owner,n.key);this.#t(o,n.descriptor)?(s.applied+=1,s.notApplied-=1):s.errors.push([n,new Error(`Could not apply patch for key ${n.key}`)])}}),this.patchesApplied=s.applied,typeof t=="function"&&t(s)}createToggle(t=!1){return new R(this,t)}revert(t){if(!this.applied)return;let e=this.entries,s=this.conflicts,n={patches:e.length,reverted:0,restored:0,conflicts:s.length,errors:[],stillApplied:0};e.forEach(([,o])=>{delete this.owner[o.key]?(this.patchesApplied-=1,n.reverted+=1):n.errors.push([o,new Error(`Failed to revert patch ${o.key}`)])}),s.forEach(([,o])=>{Object.defineProperty(this.owner,o.key,o.descriptor);let i=Object.getOwnPropertyDescriptor(this.owner,o.key);this.#t(o.descriptor,i)?n.restored+=1:n.errors.push([o,new Error(`Failed to restore original ${o.key}`)])}),n.stillApplied=this.patchesApplied,typeof t=="function"&&t(n)}release(){let t=r.patches.get(this.owner);t.splice(t.find(e=>e===this),1)}owner=null;options=null;[Symbol.iterator](){return this.entries.values()}#t(t,e){return!t||!e?!1:t.configurable===e.configurable&&t.enumerable===e.enumerable&&t.value===e.value&&t.writable===e.writable&&t.get===e.get&&t.set===e.set}[Symbol.for("nodejs.util.inspect.custom")](t,e,s){let n={get quotes(){return/^(\x1B\[\d+m)?['"]|["'](\x1B\[\d+m)?$/g},get arrays(){return/^(\x1B\[\d+m)?\[ | \](\x1B\[\d+m)?$/g}},o={...e,depth:t},i=this.owner?.name??"",c=i.length?`[${s(i,e).replaceAll(n.quotes,"$1$2")}]`:"",f=s(this.patchKeys,o).replaceAll(n.arrays,"$1$2").replaceAll(/'(.*?)'/g,"$1");return`${this.constructor.name}${c} { ${f} }`}static patches=new Map;static enableFor(t){if(r.patches.has(t))for(let e of r.patches.get(t))e.apply()}static disableFor(t){if(r.patches.has(t))for(let e of r.patches.get(t))e.revert()}static get CustomInspect(){return Symbol.for("nodejs.util.inspect.custom")}static stripExtras(t){return t.replaceAll(/^(\x1B\[\d+m)?[\[\{]\s?|\s?[\]\}](\x1B\[\d+m)?$/gm,"$1$2").replaceAll(/['"](.*?)['"]/gm,"$1")}};var gt=["number","boolean","bigint","string","symbol"],u=class r extends a{constructor(t,e,s=globalThis,n={}){let o=r.determineInput(t),{key:i,extension:c,valid:f}=o;if(c=e||c,!f)throw new j(s,i);let l=Object.getOwnPropertyDescriptor(s,i);if(l&&(Reflect.has(l,"writable")&&!l.writable||Reflect.has(l,"configurable")&&!l.configurable))throw new O(s,i);super(s,{[i]:c},n),this.key=i,this.class=o.class,this.function=o.function}get isFunction(){return!!this.function}get isClass(){return!!this.class}get isPrimitive(){return~gt.indexOf(typeof this.value)}get isObject(){return Object(this.value)===this.value}static determineInput(t){let e={key:null,extension:null,valid:!1};return t instanceof Function?(e={key:t.name,extension:t,valid:!0},/^class .*/.exec(t.toString())&&(e.class=t),/^(async )?function .*/.exec(t.toString())&&(e.function=t)):(typeof t=="string"||t instanceof String)&&(e={key:t,extension:null,valid:!0}),e}[Symbol.for("nodejs.util.inspect.custom")](t,e,s){let n={get braces(){return/^(\x1B\[\d+m)?[\[\{]|[\]\}](\x1B\[\d+m)?$/g},get quotes(){return/^(\x1B\[\d+m)?['"]|["'](\x1B\[\d+m)?$/g}},o=s(this.key,e).replaceAll(n.quotes,"$1$2"),i=s(this.patches[this.key],e).replaceAll(n.braces,"$1$2");return`Extension[${o}:${i}]`}get[Symbol.toStringTag](){return this.constructor.name}static createSet(t,...e){return new r.ExtensionSet(t,...e)}static ExtensionSet=class{constructor(e,...s){this.name=e,this.extensionObjects=new Set,this.extensions=new Set;for(let n of s)n instanceof r?(this.extensions.add(n),this.extensionObjects.add(n.patches[n.key])):n instanceof Function&&(this.extensionObjects.add(n),this.extensions.add(new r(n)))}apply(){for(let e of this.extensions)e.apply()}revert(){for(let e of this.extensions)e.revert()}}};var p=new a(Object,{isNullDefined(r){return r==null},hasStringTag(r){return Object.isObject(r)&&Reflect.has(r,Symbol.toStringTag)},getStringTag(r,t=!1){if(Object.hasStringTag(r))return r[Symbol.toStringTag];if(!t)return r&&typeof r=="function"?r.name:/\s(.+)]/.exec(Object.prototype.toString.call(r))[1]},getType(r,t=globalThis){let e=Object.getStringTag(r);switch(e){case"Null":return null;case"Undefined":return;default:return t[e]}},isObject(r){return r&&(r instanceof Object||typeof r=="object")},isPrimitive(r){if(r===null)return!0;switch(typeof r){case"string":case"number":case"bigint":case"boolean":case"undefined":case"symbol":return!0;default:return!1}},isValidKey(r){return typeof r=="string"||typeof r=="symbol"},stripTo(r,t,e=!0){if(!r||typeof r!="object")throw new TypeError("Object.stripTo requires an object to strip. Received",r);let s={};if(!Array.isArray(t))return s;for(let n of t)if(Reflect.has(r,n)){let i={...Object.getOwnPropertyDescriptor(r,n)};(typeof i.get=="function"||typeof i.set=="function")&&e&&(i.get=i.get?.bind(r),i.set=i.set?.bind(r)),Object.defineProperty(s,n,i)}return s}}),Z=new a(Object.prototype,{stripTo(r,t=!0){return Object.stripTo(this,r,t)}});var{getStringTag:_}=p.patches,$=new a(Function,{isAsync(r){let t=/(\w+)]/g.exec(Object.prototype.toString.call(r))[1];return r instanceof Function&&t.includes("Async")},isAsyncGenerator(r){let t=_(r);return r instanceof Function&&t=="AsyncGeneratorFunction"},isBigArrow(r){return r instanceof Function&&String(r).includes("=>")&&!String(r).startsWith("bound")&&!Reflect.has(r,"prototype")},isBound(r){return r instanceof Function&&String(r).startsWith("bound")&&!Reflect.has(r,"prototype")},isClass(r){return r instanceof Function&&!!/^class\s/.exec(String(r))},isFunction(r){return r instanceof Function&&!Function.isClass(r)},isGenerator(r){let t=_(r);return r instanceof Function&&t=="GeneratorFunction"}}),tt=new a(Function.prototype,{get isAsync(){return Function.isAsync(this)},get isAsyncGenerator(){return Function.isAsyncGenerator(this)},get isBigArrow(){return Function.isBigArrow(this)},get isBound(){return Function.isBound(this)},get isClass(){return Function.isClass(this)},get isFunction(){return Function.isFunction(this)},get isGenerator(){return Function.isGenerator(this)}});var et=new a(Map.prototype,{getKey(r,t=!0){for(let[e,s]of this)return t&&r===s&&!t&&r==s?e:null}});var rt=new a(Set.prototype,{concat(...r){for(let t of r){if(typeof t=="string"||!Reflect.has(t,Symbol.iterator)){this.add(t);continue}for(let e of t)this.add(e)}},contains(r){for(let t of this)if(r==t)return!0;return!1},every(r,t){if(typeof r!="function")throw new TypeError(`everyFn must be a function! Received ${String(r)}`);let e=0;for(let s of this)r.call(t,s,NaN,this)&&e++;return e===this.size},find(r,t){if(typeof r!="function")throw new TypeError(`findFn must be a function! Received ${String(r)}`);for(let e of this)if(r.call(t,e,NaN,this))return e},findLast(r,t){if(typeof r!="function")throw new TypeError(`findFn must be a function! Received ${String(r)}`);let e=[];for(let s of this)r.call(t,s,NaN,this)&&e.push(s);if(e.length)return e[e.length-1]},get length(){return this.size},map(r,t){if(typeof r!="function")throw new TypeError(`mapFn must be a function! Received ${String(r)}`);let e=[];for(let s of this)e.push(r.call(t,s,NaN,this));return e},reduce(r,t,e){if(typeof r!="function")throw new TypeError(`reduceFn must be a Function! Received ${String(r)}`);let s=t;for(let n of this)s=r.call(e,s,n,NaN,this);return s},some(r,t){if(typeof r!="function")throw new TypeError(`someFn must be a function! Received ${String(r)}`);for(let e of this)if(r.call(t,e,NaN,this))return!0;return!1}});var{isObject:st}=p.patches,D=new a(Reflect,{hasAll(r,...t){return Object.isObject(r)&&t.flat(1/0).map(e=>Reflect.has(r,e)).every(e=>e)},ownDescriptors(r){if(!st(r))throw new TypeError("The supplied object must be non-null and an object");let t={},e=Reflect.ownKeys(r);for(let s of e)t[s]=Object.getOwnPropertyDescriptor(s);return t},hasSome(r,...t){return st(r)&&t.flat(1/0).map(e=>Reflect.has(r,e)).some(e=>e)},entries(r){return!r||typeof r!="object"?[]:Reflect.ownKeys(r).map(t=>[t,Object.getOwnPropertyDescriptor(r,t)])},values(r){return Reflect.entries.map(([,t])=>t)}});var nt=new a(String,{isString(r){return r&&(typeof r=="string"||r instanceof String)?r.length>0:!1}});var k=new a(Symbol,{isSymbol(r){return r&&typeof r=="symbol"},isRegistered(r,t=!1){if(!Symbol.isSymbol(r)){if(t)throw new TypeError("allowOnlySymbols specified; value is not a symbol");return!1}return Symbol.keyFor(r)!==void 0},isNonRegistered(r,t=!1){return!Symbol.isRegistered(r,t)}});var ot=new a(Array.prototype,{contains(r){return!!this.find(t=>t===r)},findEntry(r){let t=this.entries(),e=1;for(let s of t)if(r(s[e]))return s},get first(){return this[0]},get last(){return this[this.length-1]}});var{isObject:h,isValidKey:V}=p.patches,{hasSome:G}=D.patches,g=class r{#t=void 0;#e=void 0;constructor(t,e){if((t??e)===void 0?this.#t=r.enigmatic:r.isDescriptor(t)?(this.#t=t,this.#e=h(e)?e:void 0):h(t)&&V(e)&&(this.#t=Object.getOwnPropertyDescriptor(t,e),this.#e=t),!this.isDescriptor)throw console.error(`
4
+ Descriptor(object,key) FAILED:
5
+ object: ${t===globalThis?"[GLOBAL]":typeof e=="object"?JSON.stringify(t):String(t)}
6
+ key: ${e===globalThis?"[GLOBAL]":typeof e=="object"?JSON.stringify(e):String(e)}
7
+ descriptor: `,this.#t),new Error("Not a valid descriptor:",this.#t)}get isAccessor(){return r.isAccessor(this.#t)}get isData(){return r.isData(this.#t)}get isDescriptor(){return r.isDescriptor(this.#t)}get configurable(){return!!this.#t?.configurable}set configurable(t){(this.#t||{}).configurable=!!t}get enumerable(){return this.#t?.enumerable}set enumerable(t){(this.#t||{}).enumerable=t}get writable(){return this.#t?.writable}set writable(t){(this.#t||{}).writable=t}get value(){return this.#t?.value}set value(t){(this.#t||{}).value=t}get get(){return this.#t?.get}get boundGet(){return h(this.#e)?this.get?.bind(this.#e):this.get}set get(t){(this.#t||{}).get=t}get set(){return(this.#t||{}).set}get boundSet(){return h(this.#e)?this.set?.bind(this.#e):this.set}set set(t){(this.#t||{}).set=t}get hasObject(){return h(this.#e)}get object(){return this.#e}set object(t){this.#e=Object(t)}[Symbol.for("nodejs.util.inspect.custom")](t,e,s){return`Descriptor${this.isAccessor?" (Accessor)":this.isData?" (Data)":""} ${s(this.#t,{...e,depth:t})}`}static for(t,e,s=!1){return!h(t)||!V(e)||!Reflect.has(t,e)?null:s?new r(Object.getOwnPropertyDescriptor(t,e)):Object.getOwnPropertyDescriptor(t,e)}applyTo(t,e,s=!1){if(!h(t)||!V(e))throw new Error("Cannot apply descriptor to non-object or invalid key");return Object.defineProperty(t,e,this.toObject(s))}toObject(t=!1){let e={...this.#t};return t&&this.isAccessor&&(this.hasObject?e={...e,get:this.boundGet,set:this.boundSet}:h(t)&&(e={...e,get:this.get?.bind(t),set:this.set?.bind(t)})),e}[Symbol.toPrimitive](t){switch(t){case"string":if(this.isAccessor){let e=Reflect.has(this.#t,"get")?"getter":"",s=Reflect.has(this.#t,"set")?"setter":"";return`Accessor (${e}${e&&s?", ":""}${s})`}else if(this.isData){let e=Reflect.has(this.#t,"value")?"value":"",s=Reflect.has(this.#t,"writable")?"writable":"";return`Data (${e}${e&&s?", ":""}${s})`}break;case"number":return NaN;default:return this.toObject()}}get[Symbol.toStringTag](){return this.constructor.name}static getData(t,e){if(!h(t)||!Reflect.has(t,e))return;let s=r.for(t,e,!0);return s.isData?s.value:null}static getAccessor(t,e){if(!h(t)||!Reflect.has(t,e))return;let s=r.for(t,e,!0);return s.isAccessor?s.get.bind(t)():null}static base(t=!1,e=!1){return{enumerable:t,configurable:e}}static accessor(t,e,{enumerable:s,configurable:n}=r.base()){return{get:t,set:e,enumerable:s,configurable:n}}static data(t,e=!0,{enumerable:s,configurable:n}=r.base()){return{value:t,enumerable:s,writable:e,configurable:n}}static isDescriptor(t){let e=[...r.SHARED_KEYS,...r.ACCESSOR_KEYS,...r.DATA_KEYS];return G(t,e)}static isData(t,e){let n=(typeof t=="object"||t instanceof Object)&&e instanceof String?r.for(t,e):t,{DATA_KEYS:o}=this,i=!1;return G(n,o)&&(i=!0),i}static isAccessor(t,e){let n=t&&e&&(typeof t=="object"||t instanceof Object)&&(e instanceof String||typeof e=="symbol")?r.for(t,e):t,{ACCESSOR_KEYS:o}=this,i=!1;return G(n,o)&&(i=!0),i}static get flexible(){return this.base(!0,!0)}static get enigmatic(){return this.base(!1,!0)}static get intrinsic(){return this.base(!1,!1)}static get transparent(){return this.base(!0,!1)}static get SHARED_KEYS(){return["configurable","enumerable"]}static get ACCESSOR_KEYS(){return["get","set"]}static get DATA_KEYS(){return["value","writable"]}},M=new u(g);var{isClass:bt,isFunction:N}=$.patches,St=Symbol.for("nodejs.util.inspect.custom"),b=new a(globalThis,{maskAs(r,t,e){let{prototype:s,toPrimitive:n}=GenericMask({...e,prototype:t}),o={configurable:!0,enumerable:!1},i=N(s)?s.prototype:s,c=bt(s)?s:i?.constructor;return!c&&!i?null:(Object.setPrototypeOf(r,i),Object.defineProperties(r,{valueOf:{value(){return String(n("default",r))},...o},[Symbol.toPrimitive]:{value(f){return n(f,r)},...o},[Symbol.toStringTag]:{value:c.name,...o},[Symbol.species]:{get(){return c},...o},[St]:{...o,value(f,l,d){return d(this[Symbol.toPrimitive](),{...l,depth:f})}}}),r)},maskAsString(r,t,e){return r&&Reflect.has(r,t)?maskAs(r,StringMask(t??"value",e)):null},maskAsNumber(r,t,e){return r&&Reflect.has(r,t)?maskAs(r,NumberMask(t??"value",e)):null},GenericMask({prototype:r,targetKey:t="value",toPrimitive:e}){let s={targetKey:t,toPrimitive:e,prototype:r};return N(e)||(s.toPrimitive=(n,o)=>{let i=o[t],c=typeof i=="number"&&Number.isFinite(i)||typeof i=="string"&&!isNaN(parseFloat(i))&&isFinite(i);switch(n){case"string":return c?String(i):i??String(o);case"number":return c?Number(i):NaN;case"default":default:return c?Number(i):i}}),s},StringMask(r,t){let e={targetKey:r,toPrimitive:t,prototype:String.prototype};return N(t)||(e.toPrimitive=function(n,o){switch(n){case"default":return o[r];case"number":return parseInt(o[r],36);case"string":return String(o[r]);default:return o}}),e},NumberMask(r,t){let e={targetKey:r,toPrimitive:t,prototype:Number.prototype};return N(t)||(e.toPrimitive=function(n,o){switch(n){case"default":return o[r];case"number":return Number(o[r]);case"string":return String(o[r]);default:return o}}),e}});var B=class r extends Set{#t=!1;objectifying(t=!0){return this.objectifyValues=t,this}get objectifyValues(){return this.#t}set objectifyValues(t){this.#t=!!t}add(t){if(this.#t&&(typeof t=="number"||typeof t=="string"||typeof t=="boolean"||typeof t=="bigint")&&(t=Object(t)),typeof t=="symbol"&&Symbol.keyFor(t)!==void 0)throw new TypeError("RefSet cannot accept registered symbols as values");if(typeof t!="object"&&typeof t!="symbol")throw new TypeError("RefSet values must be objects, non-registered symbols, or objectified primitives");if(t==null)throw new TypeError("RefSet values cannot be null or undefined");super.add(new WeakRef(t))}addAll(t){if(!t||typeof t!="object"||!Reflect.has(t,Symbol.iterator))throw new TypeError("The supplied values are either falsey or non-iterable");for(let e of t)this.add(e)}clean(){for(let t of this)t.deref()||this.delete(t);return this}entries(){return Array.from(super.entries()).map(([e,s])=>[s.deref(),s.deref()]).filter(([e,s])=>!!s)}forEach(t,e){let s=this;super.forEach(function(n){let o=n.deref();o&&t.call(e,o,o,s)})}values(){let t=[];for(let e of this){let s=e.deref();s&&t.push(s)}return t}keys(){return this.values()}has(t){if(this.#t)return this.contains(t);for(let e of this.values())if(e===t)return!0;return!1}contains(t){return!!Array.from(this.values()).filter(e=>t==e).length}filter(t,e){let s=[];for(let n of this){let o=n?.deref();o&&t.call(e,o,NaN,this)&&s.push(o)}return s}find(t,e){for(let s of this){let n=s?.deref();if(n&&t.call(e,n,NaN,this))return n}}map(t,e,s,n){let o=[],i=!0,c=!0;for(let f of this){let l=f?.deref();if(l){let d=t.call(e,l,NaN,this);(i||c)&&(this.#e(d)||(i=!1,c&&(c=this.#e(Object(d))))),o.push(d)}}if(s){if(i)return new r(o).objectifying(n?this.objectifyValues:!1);if(c)return new r(o.map(f=>this.#e(f)?f:Object(f))).objectifying()}return o}get[Symbol.toStringTag](){return this.constructor.name}#e(t){return!(typeof t=="symbol"&&Symbol.keyFor(t)===void 0||typeof t!="object"&&typeof t!="symbol"||t==null)}},C=new u(B);var it=new a(WeakRef,{isValidReference(r){return!(typeof r=="symbol"&&Symbol.keyFor(r)===void 0||typeof r!="object"&&typeof r!="symbol"||r==null)}});var T=class{#t=[];constructor(t,...e){t!=null&&typeof t[Symbol.iterator]=="function"?this.#t=[...t,...e]:this.#t=[t,...e]}*[Symbol.iterator](){for(let t of this.#t)yield t}get asArray(){return this.#t}get[Symbol.toStringTag](){return this.constructor.name}static isIterable(t){return Object.prototype.toString.call(t?.[Symbol.iterator])==="[object GeneratorFunction]"}},S=class{#t=void 0;constructor(t,e){if(!t||!Reflect.has(t,Symbol.iterator))throw new TypeError("Value used to instantiate Iterator is not iterable");this.#e=t,this.#r=t[Symbol.iterator](),this.#t=typeof e=="function"?e:void 0}get asArray(){return Array.from(this.#e)}get iterable(){return this.#e}next(){let t=this.#r.next(),e=t;return e.done?{value:void 0,done:!0}:(this.#t&&typeof this.#t=="function"&&(e.value=this.#t(t.value)),{value:e.value,done:!1})}reset(){this.#r=this.#e[Symbol.iterator]()}[Symbol.iterator](){return this}get[Symbol.toStringTag](){return this.constructor.name}#e=null;#r=null},K=new u(T),W=new u(S);var{isObject:xt,isNullDefined:wt,isValidKey:Et}=p.patches,{isRegistered:At}=k.patches,{isValidReference:ct}=it.patches,L=class r extends Map{#t=!1;constructor(...t){super(...t)}objectifying(t=!0){return this.objectifyValues=t,this}asObject(){let t={};for(let[e,s]of this){let n=Et(e)?e:String(e),o=s?.valueOf()||s;t[n]=o}return t}get objectifyValues(){return this.#t}get(t,e){let s=super.get(t);return!s||!s?.deref()?e:s?.deref()}set objectifyValues(t){this.#t=!!t}set(t,e){let s=e;if(this.#t&&(typeof s=="number"||typeof s=="string"||typeof s=="boolean"||typeof s=="bigint")&&(s=Object(s)),typeof s=="symbol"&&Symbol.keyFor(s)!==void 0)throw new TypeError("RefMap cannot accept registered symbols as values");if(typeof s!="object"&&typeof s!="symbol")throw new TypeError("RefMap values must be objects, non-registered symbols, or objectified primitives");if(s==null)throw new TypeError("RefMap values cannot be null or undefined");let n=new WeakRef(s);super.set(t,n)}setAll(t){if(!T.isIterable(t))throw new TypeError("The supplied list of entries must be an array of arrays in the format [[key1, value1], [key2, value2], ...].");let e=s=>{let[n,o]=s;!n||!xt(o)||!At(o)||this.set(n,o)};for(let s of t)e(s);return this}clean(){for(let[t,e]of this)e||this.delete(t);return this}entries(){let t=super.entries();return new S(t,s=>{if(s){let[n,o]=s,i=o?.deref();return[n,i]}return s})}forEach(t,e){for(let[s,n]of super.entries()){let o=n?.deref();o&&t.call(e,o,s,this)}}values(){return new S(super.values(),function(e){return e?.deref()||e})}hasValue(t,e=!0){if(wt(t))return!1;this.#t&&(e=!1);for(let[s,n]of this)if(e&&t===n||!e&&t==n)return!0;return!1}filter(t,e){let s=[];for(let[n,o]of this)t.call(e,o,n,this)&&s.push([n,o]);return s}find(t,e){for(let[s,n]of this){let o=super.get(s),i=t.call(e,o,s,map);if(i||(i=t.call(e,n,s,map)),i)return n}return null}map(t,e,s,n){if(typeof t!="function")throw new TypeError("mapFn must be a function! Received",t);let o=[],i=[],c=n&&this.objectifyValues,f=n===void 0,l=c;for(let[d,X]of this){let[,P]=[0,1],A=t.call(e,[d,X],d,this);ct(A[P])||ct(Object(A[P]))&&(c=!0,f&&!l&&(l=!0,A[P]=Object(A[P]))),o.push(A)}return s?new r(o).objectifying(l):o}*[Symbol.iterator](){for(let[t,e]of this.entries())yield[t,e]}get[Symbol.toStringTag](){return this.constructor.name}},Y=new u(L);var q=class r extends Promise{#t=null;#e=null;#r=null;value=null;reason=null;#s=!1;constructor(t){let e=t&&typeof t=="object"?t:{};if(e?.resolve&&e?.reject)throw new TypeError("resolve and reject options cannot be simultaneously provided");let s,n;super((o,i)=>{s=o,n=i,e?.executor&&typeof e?.executor=="function"&&e?.executor(o,i)}),this.#r=o=>(e?.doNotTrackAnswers!==!0&&(this.value=o),this.#s=!0,s(o)),this.#e=async o=>(e?.doNotTrackAnswers!==!0&&(this.reason=o),this.#s=!0,n(o)),this.#t=this,e?.resolve?this.#r(e?.resolve):e?.reject&&this.#e(e?.reject)}get settled(){return this.#s}get promise(){return this.#t}resolve(t){return this.#r(t)}reject(t){return this.#e(t)}static get[Symbol.species](){return class extends r{constructor(e){super({executor:e})}}}},U=new u(q);var z=class{#t=[];constructor(t,...e){t!=null&&(typeof t[Symbol.iterator]=="function"||typeof t[Symbol.asyncIterator]=="function")?this.#t=[...t,...e]:typeof t=="function"&&t.constructor.name==="AsyncGeneratorFunction"?this.#t=t():this.#t=[t,...e]}async*[Symbol.asyncIterator](){for await(let t of this.#t)yield t}get[Symbol.toStringTag](){return this.constructor.name}static isAsyncIterable(t){return Object.prototype.toString.call(t?.[Symbol.asyncIterator])==="[object AsyncGeneratorFunction]"}},H=class{constructor(t){if(typeof t=="function"&&t.constructor.name==="AsyncGeneratorFunction")this.#t=t();else{if(!t||!Reflect.has(t,Symbol.asyncIterator))throw new TypeError("Value used to instantiate AsyncIterator is not an async iterable");this.#t=t}this.#e=this.#t[Symbol.asyncIterator]()}async asArray(){let t=[];for await(let e of this)t.push(e);return t}get asyncIterable(){return this.#t}async next(){let t=await this.#e.next();return t.done?{value:void 0,done:!0}:{value:t.value,done:!1}}async reset(){this.#e=this.#t[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this}get[Symbol.toStringTag](){return this.constructor.name}#t=null;#e=null},J=new u(z),Q=new u(H);var x=[[Object,p,Object.name],[Function,$,Function.name],[Reflect,D,"Reflect"],[String,nt,String.name],[Symbol,k,"Symbol"]],w=[[Object.prototype,Z,Object.name],[Function.prototype,tt,Function.name],[Array.prototype,ot,Array.name],[Map.prototype,et,Map.name],[Set.prototype,rt,Set.name]],v=new Map([...x,...w]),E={[J.key]:J,[Q.key]:Q,[U.key]:U,[M.key]:M,[K.key]:K,[W.key]:W,[Y.key]:Y,[C.key]:C},y={};Object.assign(y,{enableAll(){y.enablePatches(),y.enableExtensions()},enablePatches(){v.forEach(r=>{r.apply()})},enableStaticPatches(r=([t,e])=>!0){let t=x.filter(F(r));return t.forEach(([e,s])=>s.apply()),t},enableInstancePatches(r=([t,e])=>!0){let t=w.filter(F(r));return t.forEach(([e,s])=>s.apply()),t},enableExtensions(){Object.values(E).forEach(r=>{r.apply()}),b.apply()},disableAll(){y.disablePatches(),y.disableExtensions()},disablePatches(){v.forEach(r=>{r.revert()})},disableStaticPatches(r=([t,e])=>!0){let t=x.filter(F(r));return t.forEach(([e,s])=>s.revert()),t},disableInstancePatches(r=([t,e])=>!0){let t=w.filter(F(r));return t.forEach(([e,s])=>s.revert()),t},disableExtensions(){Object.values(E).forEach(r=>{r.revert()}),b.revert()}});var at=(()=>{let r={patches:{},classes:{},global:{}},t=(n,[o,i])=>(new g(i.descriptor,i.owner).applyTo(n,o,!0),n),e=(n,[o,i,c])=>(n?.[c]||(n[c]={}),[...i].reduce(t,n[c]),n),s=(n,[o,i,c])=>(n?.[c]||(n[c]={}),n[c]?.prototype||(n[c].prototype={}),[...i].reduce(t,n[c].prototype),n);x.reduce(e,r.patches),w.reduce(s,r.patches),Object.values(E).flatMap(n=>[...n]).reduce(t,r.classes);for(let[n,o]of b){let i=new g(o.descriptor,o.owner);Object.defineProperty(r.global,n,i.toObject(!0))}return r})(),Ot={...y,Extensions:E,Patches:v,GlobalFunctionsAndProps:b,StaticPatches:x,InstancePatches:w,Controls:y,extensions:E,patches:v,all:at},jt=Ot;function F(r=([t,e])=>!0){let t=r;if(typeof t!="function"){let e=Array.isArray(r)?r:[r];t=([s,n])=>{for(let o of e){let i=String(o);if(i.startsWith("^")&&(s?.name??s)!=i.substring(1)||(s?.name??s)==i)return!0}return!1}}return t}return dt(Rt);})();
8
+ //# sourceMappingURL=basic-extensions.bundle.2.0.0.js.map