export namespace Reflect { type HashMap < V > = Record < string , V > ; interface BufferLike { [ offset ] : number ; length : number ; } type IteratorResult < T > = { value : T ; done : false ; } | { value : never ; done : true ; } ; interface Iterator < T > { next ( value ? ) : IteratorResult < T > ; throw ? ( value ) : IteratorResult < T > ; return ? ( value ? ) : IteratorResult < T > ; } interface Iterable < T > { "@@iterator" ( ) : Iterator < T > ; } interface IterableIterator < T > extends Iterator < T > { "@@iterator" ( ) : IterableIterator < T > ; } interface Map < K , V > extends Iterable < [ K , V ] > { size : number ; has ( key ) : boolean ; get ( key ) : V ; set ( key , value ? ) : this ; delete ( key ) : boolean ; clear ( ) : void ; keys ( ) : IterableIterator < K > ; values ( ) : IterableIterator < V > ; entries ( ) : IterableIterator < [ K , V ] > ; } interface MapConstructor { new ( ) : Map < any , any > ; new < K , V > ( ) : Map < K , V > ; prototype : Map < any , any > ; } interface Set < T > extends Iterable < T > { size : number ; has ( value ) : boolean ; add ( value ) : this ; delete ( value ) : boolean ; clear ( ) : void ; keys ( ) : IterableIterator < T > ; values ( ) : IterableIterator < T > ; entries ( ) : IterableIterator < [ T , T ] > ; } interface SetConstructor { new ( ) : Set < any > ; new < T > ( ) : Set < T > ; prototype : Set < any > ; } interface WeakMap < K , V > { clear ( ) : void ; delete ( key ) : boolean ; get ( key ) : V ; has ( key ) : boolean ; set ( key , value ? ) : WeakMap < K , V > ; } interface WeakMapConstructor { new ( ) : WeakMap < any , any > ; new < K , V > ( ) : WeakMap < K , V > ; prototype : WeakMap < any , any > ; } type MemberDecorator = < T > ( target : Object , propertyKey : string | symbol , descriptor ? : TypedPropertyDescriptor < T > ) => TypedPropertyDescriptor < T > | void ; declare const Symbol ; declare const Set ; declare const WeakMap ; declare const Map ; declare const global ; declare const crypto ; declare const msCrypto ; declare const process ; param decorators param target returns remarks example export declare function decorate ( decorators , target ) ; param decorators param target param propertyKey param attributes remarks example export declare function decorate ( decorators , target , propertyKey , attributes ? ) ; param decorators param target param propertyKey param attributes remarks example export declare function decorate ( decorators , target , propertyKey , attributes ) ; param metadataKey param metadataValue returns remarks example Reflect Reflect Reflect Reflect Reflect export declare function metadata ( metadataKey , metadataValue ) ; param metadataKey param metadataValue param target example export declare function defineMetadata ( metadataKey , metadataValue , target ) ; param metadataKey param metadataValue param target param propertyKey example export declare function defineMetadata ( metadataKey , metadataValue , target , propertyKey ) ; param metadataKey param target returns example export declare function hasMetadata ( metadataKey , target ) ; param metadataKey param target param propertyKey returns example export declare function hasMetadata ( metadataKey , target , propertyKey ) ; param metadataKey param target returns example export declare function hasOwnMetadata ( metadataKey , target ) ; param metadataKey param target param propertyKey returns example export declare function hasOwnMetadata ( metadataKey , target , propertyKey ) ; param metadataKey param target returns example export declare function getMetadata ( metadataKey , target ) ; param metadataKey param target param propertyKey returns example export declare function getMetadata ( metadataKey , target , propertyKey ) ; param metadataKey param target returns example export declare function getOwnMetadata ( metadataKey , target ) ; param metadataKey param target param propertyKey returns example export declare function getOwnMetadata ( metadataKey , target , propertyKey ) ; param target returns example export declare function getMetadataKeys ( target ) ; param target param propertyKey returns example export declare function getMetadataKeys ( target , propertyKey ) ; param target returns example export declare function getOwnMetadataKeys ( target ) ; param target param propertyKey returns example export declare function getOwnMetadataKeys ( target , propertyKey ) ; param metadataKey param target returns example export declare function deleteMetadata ( metadataKey , target ) ; param metadataKey param target param propertyKey returns example export declare function deleteMetadata ( metadataKey , target , propertyKey ) ; declare var self ; ( function ( this , factory ) { const root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : Function ( "return this;" ) ( ) ; let exporter = makeExporter ( Reflect ) ; if ( typeof root . Reflect === "undefined" ) { root . Reflect = Reflect ; } else { exporter = makeExporter ( root . Reflect , exporter ) ; } factory ( exporter ) ; function makeExporter ( target , previous ? ) { return < K extends keyof typeof Reflect > ( key , value ) => { if ( typeof target [ key ] !== "function" ) { Object . defineProperty ( target , key , { configurable : true , writable : true , value } ) ; } if ( previous ) previous ( key , value ) ; } ; } } ) ( function ( exporter ) { const hasOwn = Object . prototype . hasOwnProperty ; const supportsSymbol = typeof Symbol === "function" ; const toPrimitiveSymbol = supportsSymbol && typeof Symbol . toPrimitive !== "undefined" ? Symbol . toPrimitive : "@@toPrimitive" ; const iteratorSymbol = supportsSymbol && typeof Symbol . iterator !== "undefined" ? Symbol . iterator : "@@iterator" ; const supportsCreate = typeof Object . create === "function" ; const supportsProto = { __proto__ : [ ] } instanceof Array ; const downLevel = ! supportsCreate && ! supportsProto ; const HashMap = { create : supportsCreate ? < V > ( ) => MakeDictionary ( Object . create ( null ) as HashMap < V > ) : supportsProto ? < V > ( ) => MakeDictionary ( { __proto__ : null as any } as HashMap < V > ) : < V > ( ) => MakeDictionary ( { } as HashMap < V > ) , has : downLevel ? < V > ( map , key ) => hasOwn . call ( map , key ) : < V > ( map , key ) => key in map , get : downLevel ? < V > ( map , key ) : V | undefined => hasOwn . call ( map , key ) ? map [ key as string | number ] : undefined : < V > ( map , key ) : V | undefined => map [ key as string | number ] } ; const functionPrototype = Object . getPrototypeOf ( Function ) ; const usePolyfill = typeof process === "object" && process . env && process . env [ "REFLECT_METADATA_USE_MAP_POLYFILL" ] === "true" ; const _Map = ! usePolyfill && typeof Map === "function" && typeof Map . prototype . entries === "function" ? Map : CreateMapPolyfill ( ) ; const _Set = ! usePolyfill && typeof Set === "function" && typeof Set . prototype . entries === "function" ? Set : CreateSetPolyfill ( ) ; const _WeakMap = ! usePolyfill && typeof WeakMap === "function" ? WeakMap : CreateWeakMapPolyfill ( ) ; const Metadata = new _WeakMap < any , Map < string | symbol | undefined , Map < any , any > > > ( ) ; param decorators param target param propertyKey param attributes remarks example function decorate ( decorators , target , propertyKey ? , attributes ? ) { if ( ! IsUndefined ( propertyKey ) ) { if ( ! IsArray ( decorators ) ) throw new TypeError ( ) ; if ( ! IsObject ( target ) ) throw new TypeError ( ) ; if ( ! IsObject ( attributes ) && ! IsUndefined ( attributes ) && ! IsNull ( attributes ) ) { throw new TypeError ( ) ; } if ( IsNull ( attributes ) ) attributes = undefined ; propertyKey = ToPropertyKey ( propertyKey ) ; return DecorateProperty ( < MemberDecorator [ ] > decorators , target , propertyKey , attributes ) ; } else { if ( ! IsArray ( decorators ) ) throw new TypeError ( ) ; if ( ! IsConstructor ( target ) ) throw new TypeError ( ) ; return DecorateConstructor ( < ClassDecorator [ ] > decorators , < Function > target ) ; } } exporter ( "decorate" , < any > decorate ) ; param metadataKey param metadataValue returns remarks example Reflect Reflect Reflect Reflect Reflect function metadata ( metadataKey , metadataValue ) { function decorator ( target ) ; function decorator ( target , propertyKey ) ; function decorator ( target , propertyKey ? ) { if ( ! IsObject ( target ) ) throw new TypeError ( ) ; if ( ! IsUndefined ( propertyKey ) && ! IsPropertyKey ( propertyKey ) ) { throw new TypeError ( ) ; } OrdinaryDefineOwnMetadata ( metadataKey , metadataValue , target , propertyKey ) ; } return decorator ; } exporter ( "metadata" , metadata ) ; function defineMetadata ( metadataKey , metadataValue , target ) ; function defineMetadata ( metadataKey , metadataValue , target , propertyKey ) ; param metadataKey param metadataValue param target param propertyKey example function defineMetadata ( metadataKey , metadataValue , target , propertyKey ? ) { if ( ! IsObject ( target ) ) throw new TypeError ( ) ; if ( ! IsUndefined ( propertyKey ) ) propertyKey = ToPropertyKey ( propertyKey ) ; return OrdinaryDefineOwnMetadata ( metadataKey , metadataValue , target , propertyKey ) ; } exporter ( "defineMetadata" , defineMetadata ) ; function hasMetadata ( metadataKey , target ) ; function hasMetadata ( metadataKey , target , propertyKey ) ; param metadataKey param target param propertyKey returns example function hasMetadata ( metadataKey , target , propertyKey ? ) { if ( ! IsObject ( target ) ) throw new TypeError ( ) ; if ( ! IsUndefined ( propertyKey ) ) propertyKey = ToPropertyKey ( propertyKey ) ; return OrdinaryHasMetadata ( metadataKey , target , propertyKey ) ; } exporter ( "hasMetadata" , hasMetadata ) ; function hasOwnMetadata ( metadataKey , target ) ; function hasOwnMetadata ( metadataKey , target , propertyKey ) ; param metadataKey param target param propertyKey returns example function hasOwnMetadata ( metadataKey , target , propertyKey ? ) { if ( ! IsObject ( target ) ) throw new TypeError ( ) ; if ( ! IsUndefined ( propertyKey ) ) propertyKey = ToPropertyKey ( propertyKey ) ; return OrdinaryHasOwnMetadata ( metadataKey , target , propertyKey ) ; } exporter ( "hasOwnMetadata" , hasOwnMetadata ) ; function getMetadata ( metadataKey , target ) ; function getMetadata ( metadataKey , target , propertyKey ) ; param metadataKey param target param propertyKey returns example function getMetadata ( metadataKey , target , propertyKey ? ) { if ( ! IsObject ( target ) ) throw new TypeError ( ) ; if ( ! IsUndefined ( propertyKey ) ) propertyKey = ToPropertyKey ( propertyKey ) ; return OrdinaryGetMetadata ( metadataKey , target , propertyKey ) ; } exporter ( "getMetadata" , getMetadata ) ; function getOwnMetadata ( metadataKey , target ) ; function getOwnMetadata ( metadataKey , target , propertyKey ) ; param metadataKey param target param propertyKey returns example function getOwnMetadata ( metadataKey , target , propertyKey ? ) { if ( ! IsObject ( target ) ) throw new TypeError ( ) ; if ( ! IsUndefined ( propertyKey ) ) propertyKey = ToPropertyKey ( propertyKey ) ; return OrdinaryGetOwnMetadata ( metadataKey , target , propertyKey ) ; } exporter ( "getOwnMetadata" , getOwnMetadata ) ; function getMetadataKeys ( target ) ; function getMetadataKeys ( target , propertyKey ) ; param target param propertyKey returns example function getMetadataKeys ( target , propertyKey ? ) { if ( ! IsObject ( target ) ) throw new TypeError ( ) ; if ( ! IsUndefined ( propertyKey ) ) propertyKey = ToPropertyKey ( propertyKey ) ; return OrdinaryMetadataKeys ( target , propertyKey ) ; } exporter ( "getMetadataKeys" , getMetadataKeys ) ; function getOwnMetadataKeys ( target ) ; function getOwnMetadataKeys ( target , propertyKey ) ; param target param propertyKey returns example function getOwnMetadataKeys ( target , propertyKey ? ) { if ( ! IsObject ( target ) ) throw new TypeError ( ) ; if ( ! IsUndefined ( propertyKey ) ) propertyKey = ToPropertyKey ( propertyKey ) ; return OrdinaryOwnMetadataKeys ( target , propertyKey ) ; } exporter ( "getOwnMetadataKeys" , getOwnMetadataKeys ) ; function deleteMetadata ( metadataKey , target ) ; function deleteMetadata ( metadataKey , target , propertyKey ) ; param metadataKey param target param propertyKey returns example function deleteMetadata ( metadataKey , target , propertyKey ? ) { if ( ! IsObject ( target ) ) throw new TypeError ( ) ; if ( ! IsUndefined ( propertyKey ) ) propertyKey = ToPropertyKey ( propertyKey ) ; const metadataMap = GetOrCreateMetadataMap ( target , propertyKey , false ) ; if ( IsUndefined ( metadataMap ) ) return false ; if ( ! metadataMap . delete ( metadataKey ) ) return false ; if ( metadataMap . size > 0 ) return true ; const targetMetadata = Metadata . get ( target ) ; targetMetadata . delete ( propertyKey ) ; if ( targetMetadata . size > 0 ) return true ; Metadata . delete ( target ) ; return true ; } exporter ( "deleteMetadata" , deleteMetadata ) ; function DecorateConstructor ( decorators , target ) { for ( let i = decorators . length - 1 ; i >= 0 ; -- i ) { const decorator = decorators [ i ] ; const decorated = decorator ( target ) ; if ( ! IsUndefined ( decorated ) && ! IsNull ( decorated ) ) { if ( ! IsConstructor ( decorated ) ) throw new TypeError ( ) ; target = < Function > decorated ; } } return target ; } function DecorateProperty ( decorators , target , propertyKey , descriptor ) { for ( let i = decorators . length - 1 ; i >= 0 ; -- i ) { const decorator = decorators [ i ] ; const decorated = decorator ( target , propertyKey , descriptor ) ; if ( ! IsUndefined ( decorated ) && ! IsNull ( decorated ) ) { if ( ! IsObject ( decorated ) ) throw new TypeError ( ) ; descriptor = < PropertyDescriptor > decorated ; } } return descriptor ; } function GetOrCreateMetadataMap ( O , P , Create ) ; function GetOrCreateMetadataMap ( O , P , Create ) ; function GetOrCreateMetadataMap ( O , P , Create ) { let targetMetadata = Metadata . get ( O ) ; if ( IsUndefined ( targetMetadata ) ) { if ( ! Create ) return undefined ; targetMetadata = new _Map < string | symbol | undefined , Map < any , any > > ( ) ; Metadata . set ( O , targetMetadata ) ; } let metadataMap = targetMetadata . get ( P ) ; if ( IsUndefined ( metadataMap ) ) { if ( ! Create ) return undefined ; metadataMap = new _Map < any , any > ( ) ; targetMetadata . set ( P , metadataMap ) ; } return metadataMap ; } function OrdinaryHasMetadata ( MetadataKey , O , P ) { const hasOwn = OrdinaryHasOwnMetadata ( MetadataKey , O , P ) ; if ( hasOwn ) return true ; const parent = OrdinaryGetPrototypeOf ( O ) ; if ( ! IsNull ( parent ) ) return OrdinaryHasMetadata ( MetadataKey , parent , P ) ; return false ; } function OrdinaryHasOwnMetadata ( MetadataKey , O , P ) { const metadataMap = GetOrCreateMetadataMap ( O , P , false ) ; if ( IsUndefined ( metadataMap ) ) return false ; return ToBoolean ( metadataMap . has ( MetadataKey ) ) ; } function OrdinaryGetMetadata ( MetadataKey , O , P ) { const hasOwn = OrdinaryHasOwnMetadata ( MetadataKey , O , P ) ; if ( hasOwn ) return OrdinaryGetOwnMetadata ( MetadataKey , O , P ) ; const parent = OrdinaryGetPrototypeOf ( O ) ; if ( ! IsNull ( parent ) ) return OrdinaryGetMetadata ( MetadataKey , parent , P ) ; return undefined ; } function OrdinaryGetOwnMetadata ( MetadataKey , O , P ) { const metadataMap = GetOrCreateMetadataMap ( O , P , false ) ; if ( IsUndefined ( metadataMap ) ) return undefined ; return metadataMap . get ( MetadataKey ) ; } function OrdinaryDefineOwnMetadata ( MetadataKey , MetadataValue , O , P ) { const metadataMap = GetOrCreateMetadataMap ( O , P , true ) ; metadataMap . set ( MetadataKey , MetadataValue ) ; } function OrdinaryMetadataKeys ( O , P ) { const ownKeys = OrdinaryOwnMetadataKeys ( O , P ) ; const parent = OrdinaryGetPrototypeOf ( O ) ; if ( parent === null ) return ownKeys ; const parentKeys = OrdinaryMetadataKeys ( parent , P ) ; if ( parentKeys . length <= 0 ) return ownKeys ; if ( ownKeys . length <= 0 ) return parentKeys ; const set = new _Set < any > ( ) ; const keys = [ ] ; for ( const key of ownKeys ) { const hasKey = set . has ( key ) ; if ( ! hasKey ) { set . add ( key ) ; keys . push ( key ) ; } } for ( const key of parentKeys ) { const hasKey = set . has ( key ) ; if ( ! hasKey ) { set . add ( key ) ; keys . push ( key ) ; } } return keys ; } function OrdinaryOwnMetadataKeys ( O , P ) { const keys = [ ] ; const metadataMap = GetOrCreateMetadataMap ( O , P , false ) ; if ( IsUndefined ( metadataMap ) ) return keys ; const keysObj = metadataMap . keys ( ) ; const iterator = GetIterator ( keysObj ) ; let k = 0 ; while ( true ) { const next = IteratorStep ( iterator ) ; if ( ! next ) { keys . length = k ; return keys ; } const nextValue = IteratorValue ( next ) ; try { keys [ k ] = nextValue ; } catch ( e ) { try { IteratorClose ( iterator ) ; } finally { throw e ; } } k ++ ; } } function Type ( x ) { if ( x === null ) return Tag . Null ; switch ( typeof x ) { case "undefined" : return Tag . Undefined ; case "boolean" : return Tag . Boolean ; case "string" : return Tag . String ; case "symbol" : return Tag . Symbol ; case "number" : return Tag . Number ; case "object" : return x === null ? Tag . Null : Tag . Object ; default : return Tag . Object ; } } const enum Tag { Undefined , Null , Boolean , String , Symbol , Number , Object } function IsUndefined ( x ) { return x === undefined ; } function IsNull ( x ) { return x === null ; } function IsSymbol ( x ) { return typeof x === "symbol" ; } function IsObject < T > ( x ) { return typeof x === "object" ? x !== null : typeof x === "function" ; } function ToPrimitive ( input , PreferredType ? ) { switch ( Type ( input ) ) { case Tag . Undefined : return input ; case Tag . Null : return input ; case Tag . Boolean : return input ; case Tag . String : return input ; case Tag . Symbol : return input ; case Tag . Number : return input ; } const hint = PreferredType === Tag . String ? "string" : PreferredType === Tag . Number ? "number" : "default" ; const exoticToPrim = GetMethod ( input , toPrimitiveSymbol ) ; if ( exoticToPrim !== undefined ) { const result = exoticToPrim . call ( input , hint ) ; if ( IsObject ( result ) ) throw new TypeError ( ) ; return result ; } return OrdinaryToPrimitive ( input , hint === "default" ? "number" : hint ) ; } function OrdinaryToPrimitive ( O , hint ) { if ( hint === "string" ) { const toString = O . toString ; if ( IsCallable ( toString ) ) { const result = toString . call ( O ) ; if ( ! IsObject ( result ) ) return result ; } const valueOf = O . valueOf ; if ( IsCallable ( valueOf ) ) { const result = valueOf . call ( O ) ; if ( ! IsObject ( result ) ) return result ; } } else { const valueOf = O . valueOf ; if ( IsCallable ( valueOf ) ) { const result = valueOf . call ( O ) ; if ( ! IsObject ( result ) ) return result ; } const toString = O . toString ; if ( IsCallable ( toString ) ) { const result = toString . call ( O ) ; if ( ! IsObject ( result ) ) return result ; } } throw new TypeError ( ) ; } function ToBoolean ( argument ) { return ! ! argument ; } function ToString ( argument ) { return "" + argument ; } function ToPropertyKey ( argument ) { const key = ToPrimitive ( argument , Tag . String ) ; if ( IsSymbol ( key ) ) return key ; return ToString ( key ) ; } function IsArray ( argument ) { return Array . isArray ? Array . isArray ( argument ) : argument instanceof Object ? argument instanceof Array : Object . prototype . toString . call ( argument ) === "[object Array]" ; } function IsCallable ( argument ) { return typeof argument === "function" ; } function IsConstructor ( argument ) { return typeof argument === "function" ; } function IsPropertyKey ( argument ) { switch ( Type ( argument ) ) { case Tag . String : return true ; case Tag . Symbol : return true ; default : return false ; } } function GetMethod ( V , P ) { const func = V [ P ] ; if ( func === undefined || func === null ) return undefined ; if ( ! IsCallable ( func ) ) throw new TypeError ( ) ; return func ; } function GetIterator < T > ( obj ) { const method = GetMethod ( obj , iteratorSymbol ) ; if ( ! IsCallable ( method ) ) throw new TypeError ( ) ; const iterator = method . call ( obj ) ; if ( ! IsObject ( iterator ) ) throw new TypeError ( ) ; return iterator ; } function IteratorValue < T > ( iterResult ) { return iterResult . value ; } function IteratorStep < T > ( iterator ) { const result = iterator . next ( ) ; return result . done ? false : result ; } function IteratorClose < T > ( iterator ) { const f = iterator [ "return" ] ; if ( f ) f . call ( iterator ) ; } function OrdinaryGetPrototypeOf ( O ) { const proto = Object . getPrototypeOf ( O ) ; if ( typeof O !== "function" || O === functionPrototype ) return proto ; if ( proto !== functionPrototype ) return proto ; const prototype = O . prototype ; const prototypeProto = prototype && Object . getPrototypeOf ( prototype ) ; if ( prototypeProto == null || prototypeProto === Object . prototype ) { return proto ; } const constructor = prototypeProto . constructor ; if ( typeof constructor !== "function" ) return proto ; if ( constructor === O ) return proto ; return constructor ; } function CreateMapPolyfill ( ) { const cacheSentinel = { } ; const arraySentinel = [ ] ; class MapIterator < K , V , R extends ( K | V | [ K , V ] ) > implements IterableIterator < R > { private _keys : K [ ] ; private _values : V [ ] ; private _index = 0 ; private _selector : ( key : K , value : V ) => R ; constructor ( keys , values , selector ) { this . _keys = keys ; this . _values = values ; this . _selector = selector ; } "@@iterator" ( ) { return this ; } [ iteratorSymbol ] ( ) { return this ; } next ( ) { const index = this . _index ; if ( index >= 0 && index < this . _keys . length ) { const result = this . _selector ( this . _keys [ index ] , this . _values [ index ] ) ; if ( index + 1 >= this . _keys . length ) { this . _index = - 1 ; this . _keys = arraySentinel ; this . _values = arraySentinel ; } else { this . _index ++ ; } return { value : result , done : false } ; } return { value : < never > undefined , done : true } ; } throw ( error ) { if ( this . _index >= 0 ) { this . _index = - 1 ; this . _keys = arraySentinel ; this . _values = arraySentinel ; } throw error ; } return ( value ? ) { if ( this . _index >= 0 ) { this . _index = - 1 ; this . _keys = arraySentinel ; this . _values = arraySentinel ; } return { value : < never > value , done : true } ; } } return class Map < K , V > { private _keys : K [ ] = [ ] ; private _values : ( V | undefined ) [ ] = [ ] ; private _cacheKey = cacheSentinel ; private _cacheIndex = - 2 ; get size ( ) { return this . _keys . length ; } has ( key ) { return this . _find ( key , false ) >= 0 ; } get ( key ) { const index = this . _find ( key , false ) ; return index >= 0 ? this . _values [ index ] : undefined ; } set ( key , value ) { const index = this . _find ( key , true ) ; this . _values [ index ] = value ; return this ; } delete ( key ) { const index = this . _find ( key , false ) ; if ( index >= 0 ) { const size = this . _keys . length ; for ( let i = index + 1 ; i < size ; i ++ ) { this . _keys [ i - 1 ] = this . _keys [ i ] ; this . _values [ i - 1 ] = this . _values [ i ] ; } this . _keys . length -- ; this . _values . length -- ; if ( key === this . _cacheKey ) { this . _cacheKey = cacheSentinel ; this . _cacheIndex = - 2 ; } return true ; } return false ; } clear ( ) { this . _keys . length = 0 ; this . _values . length = 0 ; this . _cacheKey = cacheSentinel ; this . _cacheIndex = - 2 ; } keys ( ) { return new MapIterator ( this . _keys , this . _values , getKey ) ; } values ( ) { return new MapIterator ( this . _keys , this . _values , getValue ) ; } entries ( ) { return new MapIterator ( this . _keys , this . _values , getEntry ) ; } "@@iterator" ( ) { return this . entries ( ) ; } [ iteratorSymbol ] ( ) { return this . entries ( ) ; } private _find ( key , insert ? ) { if ( this . _cacheKey !== key ) { this . _cacheIndex = this . _keys . indexOf ( this . _cacheKey = key ) ; } if ( this . _cacheIndex < 0 && insert ) { this . _cacheIndex = this . _keys . length ; this . _keys . push ( key ) ; this . _values . push ( undefined ) ; } return this . _cacheIndex ; } } ; function getKey < K , V > ( key , _ ) { return key ; } function getValue < K , V > ( _ , value ) { return value ; } function getEntry < K , V > ( key , value ) { return [ key , value ] as [ K , V ] ; } } function CreateSetPolyfill ( ) { return class Set < T > { private _map = new _Map < any , any > ( ) ; get size ( ) { return this . _map . size ; } has ( value ) { return this . _map . has ( value ) ; } add ( value ) { return this . _map . set ( value , value ) , this ; } delete ( value ) { return this . _map . delete ( value ) ; } clear ( ) { this . _map . clear ( ) ; } keys ( ) { return this . _map . keys ( ) ; } values ( ) { return this . _map . values ( ) ; } entries ( ) { return this . _map . entries ( ) ; } "@@iterator" ( ) { return this . keys ( ) ; } [ iteratorSymbol ] ( ) { return this . keys ( ) ; } } ; } function CreateWeakMapPolyfill ( ) { const UUID_SIZE = 16 ; const keys = HashMap . create < boolean > ( ) ; const rootKey = CreateUniqueKey ( ) ; return class WeakMap < K , V > { private _key = CreateUniqueKey ( ) ; has ( target ) { const table = GetOrCreateWeakMapTable < K > ( target , false ) ; return table !== undefined ? HashMap . has ( table , this . _key ) : false ; } get ( target ) { const table = GetOrCreateWeakMapTable < K > ( target , false ) ; return table !== undefined ? HashMap . get ( table , this . _key ) : undefined ; } set ( target , value ) { const table = GetOrCreateWeakMapTable < K > ( target , true ) ; table [ this . _key ] = value ; return this ; } delete ( target ) { const table = GetOrCreateWeakMapTable < K > ( target , false ) ; return table !== undefined ? delete table [ this . _key ] : false ; } clear ( ) { this . _key = CreateUniqueKey ( ) ; } } ; function CreateUniqueKey ( ) { let key ; do key = "@@WeakMap@@" + CreateUUID ( ) ; while ( HashMap . has ( keys , key ) ) ; keys [ key ] = true ; return key ; } function GetOrCreateWeakMapTable < K > ( target , create ) ; function GetOrCreateWeakMapTable < K > ( target , create ) ; function GetOrCreateWeakMapTable < K > ( target , create ) { if ( ! hasOwn . call ( target , rootKey ) ) { if ( ! create ) return undefined ; Object . defineProperty ( target , rootKey , { value : HashMap . create < any > ( ) } ) ; } return ( < any > target ) [ rootKey ] ; } function FillRandomBytes ( buffer , size ) { for ( let i = 0 ; i < size ; ++ i ) buffer [ i ] = Math . random ( ) * 0xff | 0 ; return buffer ; } function GenRandomBytes ( size ) { if ( typeof Uint8Array === "function" ) { if ( typeof crypto !== "undefined" ) { return crypto . getRandomValues ( new Uint8Array ( size ) ) as Uint8Array ; } if ( typeof msCrypto !== "undefined" ) { return msCrypto . getRandomValues ( new Uint8Array ( size ) ) as Uint8Array ; } return FillRandomBytes ( new Uint8Array ( size ) , size ) ; } return FillRandomBytes ( new Array ( size ) , size ) ; } function CreateUUID ( ) { const data = GenRandomBytes ( UUID_SIZE ) ; data [ 6 ] = data [ 6 ] & 0x4f | 0x40 ; data [ 8 ] = data [ 8 ] & 0xbf | 0x80 ; let result = "" ; for ( let offset = 0 ; offset < UUID_SIZE ; ++ offset ) { const byte = data [ offset ] ; if ( offset === 4 || offset === 6 || offset === 8 ) result += "-" ; if ( byte < 16 ) result += "0" ; result += byte . toString ( 16 ) . toLowerCase ( ) ; } return result ; } } function MakeDictionary < T > ( obj ) { ( < any > obj ) . __ = undefined ; delete ( < any > obj ) . __ ; return obj ; } } ) ; }