param version param store returns export function createDuplexId ( version , store ) { let vc = version & 0xffff ; let vb = ( ( ( version - vc ) / 0x10000 ) | 0 ) & 0xffff ; let va = ( ( ( version - vb - vc ) / 0x100000000 ) | 0 ) & 0xffff ; let sb = store & 0xffff ; let sa = ( ( ( store - sb ) / 0x10000 ) | 0 ) & 0xffff ; return String . fromCharCode ( va , vb , vc , sa , sb ) ; } param version param store param lower param upper returns export function createTriplexId ( version , store , lower , upper ) { const MAX_PATH = 0xffffffffffff ; let id = '' ; let lowerCount = lower ? Private . idTripletCount ( lower ) : 0 ; let upperCount = upper ? Private . idTripletCount ( upper ) : 0 ; for ( let i = 0 , n = Math . max ( lowerCount , upperCount ) ; i < n ; ++ i ) { let lp ; let lc ; let ls ; if ( i >= lowerCount ) { lp = 0 ; lc = 0 ; ls = 0 ; } else { lp = Private . idPathAt ( lower , i ) ; lc = Private . idVersionAt ( lower , i ) ; ls = Private . idStoreAt ( lower , i ) ; } let up ; let uc ; let us ; if ( i >= upperCount ) { up = upperCount === 0 ? MAX_PATH + 1 : 0 ; uc = 0 ; us = 0 ; } else { up = Private . idPathAt ( upper , i ) ; uc = Private . idVersionAt ( upper , i ) ; us = Private . idStoreAt ( upper , i ) ; } if ( lp === up && lc === uc && ls === us ) { id += Private . createTriplet ( lp , lc , ls ) ; continue ; } if ( up - lp > 1 ) { let np = Private . randomPath ( lp + 1 , up - 1 ) ; id += Private . createTriplet ( np , version , store ) ; return id . slice ( ) ; } id += Private . createTriplet ( lp , lc , ls ) ; upperCount = 0 ; } let np = Private . randomPath ( 1 , MAX_PATH ) ; id += Private . createTriplet ( np , version , store ) ; return id . slice ( ) ; } param n param version param store param lower param uppper returns export function createTriplexIds ( n , version , store , lower , upper ) { let ids = [ ] ; while ( ids . length < n ) { let id = createTriplexId ( version , store , lower , upper ) ; ids . push ( id ) ; lower = id ; } return ids ; } /**
 * The namespace for the module implementation details.
 */ namespace Private { param path param version param store returns export function createTriplet ( path , version , store ) { let pc = path & 0xffff ; let pb = ( ( ( path - pc ) / 0x10000 ) | 0 ) & 0xffff ; let pa = ( ( ( path - pb - pc ) / 0x100000000 ) | 0 ) & 0xffff ; let vc = version & 0xffff ; let vb = ( ( ( version - vc ) / 0x10000 ) | 0 ) & 0xffff ; let va = ( ( ( version - vb - vc ) / 0x100000000 ) | 0 ) & 0xffff ; let sb = store & 0xffff ; let sa = ( ( ( store - sb ) / 0x10000 ) | 0 ) & 0xffff ; return String . fromCharCode ( pa , pb , pc , va , vb , vc , sa , sb ) ; } param id returns export function idTripletCount ( id ) { return id . length >> 3 ; } param id param i returns export function idPathAt ( id , i ) { let j = i << 3 ; let a = id . charCodeAt ( j + 0 ) ; let b = id . charCodeAt ( j + 1 ) ; let c = id . charCodeAt ( j + 2 ) ; return a * 0x100000000 + b * 0x10000 + c ; } param id param i returns export function idVersionAt ( id , i ) { let j = i << 3 ; let a = id . charCodeAt ( j + 3 ) ; let b = id . charCodeAt ( j + 4 ) ; let c = id . charCodeAt ( j + 5 ) ; return a * 0x100000000 + b * 0x10000 + c ; } param id param i returns export function idStoreAt ( id , i ) { let j = i << 3 ; let a = id . charCodeAt ( j + 6 ) ; let b = id . charCodeAt ( j + 7 ) ; return a * 0x10000 + b ; } param min param max returns export function randomPath ( min , max ) { return min + Math . round ( Math . random ( ) * Math . sqrt ( max - min ) ) ; } }