@itwin/core-bentley 4.10.0-dev.8 → 5.0.0-dev.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 (73) hide show
  1. package/CHANGELOG.md +23 -1
  2. package/lib/cjs/Assert.js +1 -2
  3. package/lib/cjs/Assert.js.map +1 -1
  4. package/lib/cjs/BeSQLite.d.ts.map +1 -1
  5. package/lib/cjs/BeSQLite.js +0 -2
  6. package/lib/cjs/BeSQLite.js.map +1 -1
  7. package/lib/cjs/ByteStream.js +2 -2
  8. package/lib/cjs/ByteStream.js.map +1 -1
  9. package/lib/cjs/ClassUtils.js +2 -3
  10. package/lib/cjs/ClassUtils.js.map +1 -1
  11. package/lib/cjs/Compare.js +9 -10
  12. package/lib/cjs/Compare.js.map +1 -1
  13. package/lib/cjs/CompressedId64Set.d.ts +1 -1
  14. package/lib/cjs/Disposable.d.ts.map +1 -1
  15. package/lib/cjs/Disposable.js +5 -6
  16. package/lib/cjs/Disposable.js.map +1 -1
  17. package/lib/cjs/Id.js +1 -1
  18. package/lib/cjs/Id.js.map +1 -1
  19. package/lib/cjs/JsonUtils.d.ts +1 -1
  20. package/lib/cjs/JsonUtils.js.map +1 -1
  21. package/lib/cjs/ObservableSet.js.map +1 -1
  22. package/lib/cjs/ProcessDetector.js +1 -1
  23. package/lib/cjs/ProcessDetector.js.map +1 -1
  24. package/lib/cjs/SortedArray.js +3 -3
  25. package/lib/cjs/SortedArray.js.map +1 -1
  26. package/lib/cjs/StringUtils.js +3 -4
  27. package/lib/cjs/StringUtils.js.map +1 -1
  28. package/lib/cjs/Time.d.ts.map +1 -1
  29. package/lib/cjs/Tracing.js +3 -3
  30. package/lib/cjs/Tracing.js.map +1 -1
  31. package/lib/cjs/UnexpectedErrors.d.ts +0 -1
  32. package/lib/cjs/UnexpectedErrors.d.ts.map +1 -1
  33. package/lib/cjs/UnexpectedErrors.js +1 -1
  34. package/lib/cjs/UnexpectedErrors.js.map +1 -1
  35. package/lib/cjs/UtilityTypes.d.ts +7 -3
  36. package/lib/cjs/UtilityTypes.d.ts.map +1 -1
  37. package/lib/cjs/UtilityTypes.js +3 -4
  38. package/lib/cjs/UtilityTypes.js.map +1 -1
  39. package/lib/cjs/internal/staticLoggerMetadata.d.ts +1 -1
  40. package/lib/cjs/internal/staticLoggerMetadata.js.map +1 -1
  41. package/lib/cjs/partitionArray.js +1 -2
  42. package/lib/cjs/partitionArray.js.map +1 -1
  43. package/lib/esm/BeSQLite.d.ts.map +1 -1
  44. package/lib/esm/BeSQLite.js +0 -2
  45. package/lib/esm/BeSQLite.js.map +1 -1
  46. package/lib/esm/ByteStream.js +2 -2
  47. package/lib/esm/ByteStream.js.map +1 -1
  48. package/lib/esm/CompressedId64Set.d.ts +1 -1
  49. package/lib/esm/Disposable.d.ts.map +1 -1
  50. package/lib/esm/Disposable.js +0 -1
  51. package/lib/esm/Disposable.js.map +1 -1
  52. package/lib/esm/Id.js +1 -1
  53. package/lib/esm/Id.js.map +1 -1
  54. package/lib/esm/JsonUtils.d.ts +1 -1
  55. package/lib/esm/JsonUtils.js.map +1 -1
  56. package/lib/esm/ObservableSet.js.map +1 -1
  57. package/lib/esm/ProcessDetector.js +1 -1
  58. package/lib/esm/ProcessDetector.js.map +1 -1
  59. package/lib/esm/StringUtils.js +1 -1
  60. package/lib/esm/StringUtils.js.map +1 -1
  61. package/lib/esm/Time.d.ts.map +1 -1
  62. package/lib/esm/Tracing.js +3 -3
  63. package/lib/esm/Tracing.js.map +1 -1
  64. package/lib/esm/UnexpectedErrors.d.ts +0 -1
  65. package/lib/esm/UnexpectedErrors.d.ts.map +1 -1
  66. package/lib/esm/UnexpectedErrors.js +1 -1
  67. package/lib/esm/UnexpectedErrors.js.map +1 -1
  68. package/lib/esm/UtilityTypes.d.ts +7 -3
  69. package/lib/esm/UtilityTypes.d.ts.map +1 -1
  70. package/lib/esm/UtilityTypes.js.map +1 -1
  71. package/lib/esm/internal/staticLoggerMetadata.d.ts +1 -1
  72. package/lib/esm/internal/staticLoggerMetadata.js.map +1 -1
  73. package/package.json +10 -15
package/lib/cjs/Id.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Id.js","sourceRoot":"","sources":["../../src/Id.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AA4BH,SAAS,KAAK,CAAC,GAAW;IACxB,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IAC5B,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACjC,CAAC;AAED,SAAS,0BAA0B,CAAC,GAAW,EAAE,KAAa;IAC5D,OAAO,mBAAmB,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AAChD,CAAC;AAED,SAAS,mBAAmB,CAAC,GAAW,EAAE,KAAa,EAAE,YAAqB,IAAI;IAChF,MAAM,QAAQ,GAAG,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACvC,MAAM,eAAe,GAAG,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,gBAAgB;IACjE,OAAO,CAAC,QAAQ,IAAI,eAAe,IAAI,QAAQ,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,IAAI,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,oBAAoB;AAC1H,CAAC;AAED,SAAS,gBAAgB,CAAC,EAAU,EAAE,UAAkB,EAAE,GAAW;IACnE,IAAI,GAAG,KAAK,CAAC;QACX,OAAO,KAAK,CAAC;IAEf,uBAAuB;IACvB,IAAI,CAAC,0BAA0B,CAAC,EAAE,EAAE,UAAU,CAAC;QAC7C,OAAO,KAAK,CAAC;IAEf,qDAAqD;IACrD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE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CAAC,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC;YAC1C,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACxB,CAAC,CAAC,CAAC;IACL,CAAC;IAPe,gBAAW,cAO1B,CAAA;IAED;;;;;;;OAOG;IACH,SAAgB,SAAS,CAAC,KAAiB;QACzC,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;QAE9C,gDAAgD;QAChD,IAAI,MAAM,CAAC,UAAU,CAAC;YACpB,OAAO,UAAU,CAAC;QAEpB,gHAAgH;QAChH,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACjD,MAAM,aAAa,GAAG,sEAAsE,CAAC;QAC7F,IAAI,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;YACpC,OAAO,WAAW,CAAC,OAAO,CAAC,aAAa,EACtC,CAAC,MAAc,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAE,CAC7E,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;QACvC,CAAC;QAED,8DAA8D;QAC9D,OAAO,KAAK,CAAC;IACf,CAAC;IAlBe,cAAS,YAkBxB,CAAA;AACH,CAAC,EAvDgB,IAAI,oBAAJ,IAAI,QAuDpB","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Ids\r\n */\r\n\r\n/** A string containing a well-formed string representation of an [Id64]($core-bentley).\r\n * See [Working with Ids]($docs/learning/common/Id64.md).\r\n * @public\r\n */\r\nexport type Id64String = string;\r\n\r\n/** A string containing a well-formed string representation of a [Guid]($core-bentley).\r\n * @public\r\n */\r\nexport type GuidString = string;\r\n\r\n/** A set of [[Id64String]]s.\r\n * @public\r\n */\r\nexport type Id64Set = Set<Id64String>;\r\n\r\n/** An array of [[Id64String]]s.\r\n * @public\r\n */\r\nexport type Id64Array = Id64String[];\r\n\r\n/** Used as an argument to a function that can accept one or more [[Id64String]]s.\r\n * @public\r\n */\r\nexport type Id64Arg = Id64String | Id64Set | Id64Array;\r\n\r\nfunction toHex(str: string): number {\r\n const v = parseInt(str, 16);\r\n return Number.isNaN(v) ? 0 : v;\r\n}\r\n\r\nfunction isLowerCaseNonZeroHexDigit(str: string, index: number) {\r\n return isLowerCaseHexDigit(str, index, false);\r\n}\r\n\r\nfunction isLowerCaseHexDigit(str: string, index: number, allowZero: boolean = true): boolean {\r\n const charCode = str.charCodeAt(index);\r\n const minDecimalDigit = allowZero ? 0x30 : 0x31; // '0' or '1'...\r\n return (charCode >= minDecimalDigit && charCode <= 0x39) || (charCode >= 0x61 && charCode <= 0x66); // '0'-'9, 'a' -'f'\r\n}\r\n\r\nfunction isValidHexString(id: string, startIndex: number, len: number) {\r\n if (len === 0)\r\n return false;\r\n\r\n // No leading zeroes...\r\n if (!isLowerCaseNonZeroHexDigit(id, startIndex))\r\n return false;\r\n\r\n // ...followed by len-1 lowercase hexadecimal digits.\r\n for (let i = 1; i < len; i++)\r\n if (!isLowerCaseHexDigit(id, startIndex + i))\r\n return false;\r\n\r\n return true;\r\n}\r\n\r\n/**\r\n * The Id64 namespace provides facilities for working with 64-bit identifiers. These Ids are stored as 64-bit integers inside an [[IModelDb]], but must be represented\r\n * as strings in JavaScript because JavaScript does not intrinsically support 64-bit integers.\r\n *\r\n * The [[Id64String]] type alias is used to indicate function arguments, return types, and variables which are known to contain a well-formed representation of a 64-bit Id.\r\n *\r\n * See [Working with Ids]($docs/learning/common/Id64.md) for a detailed description and code examples.\r\n * @public\r\n */\r\nexport namespace Id64 {\r\n /** Extract the \"local\" Id portion of an Id64String, contained in the lower 40 bits of the 64-bit value. */\r\n export function getLocalId(id: Id64String): number {\r\n if (isInvalid(id))\r\n return 0;\r\n\r\n const len = id.length;\r\n const start = (len > 12) ? (len - 10) : 2;\r\n return toHex(id.slice(start));\r\n }\r\n\r\n /** Extract the briefcase Id portion of an Id64String, contained in the upper 24 bits of the 64-bit value. */\r\n export function getBriefcaseId(id: Id64String): number {\r\n if (isInvalid(id))\r\n return 0;\r\n\r\n const len = id.length;\r\n return (len <= 12) ? 0 : toHex(id.slice(2, len - 10));\r\n }\r\n\r\n /** Create an Id64String from its JSON representation.\r\n * @param prop The JSON representation of an Id.\r\n * @returns A well-formed Id string.\r\n * @note if the input is undefined, the result is \"0\", indicating an invalid Id.\r\n * @note if the input is not undefined, the result is the same as that of [[Id64.fromString]].\r\n */\r\n export function fromJSON(prop?: string): Id64String {\r\n return typeof prop === \"string\" ? Id64.fromString(prop) : Id64.invalid;\r\n }\r\n\r\n /** Given a string value, attempt to normalize it into a well-formed Id string.\r\n * If the input is already a well-formed Id string, it is returned unmodified.\r\n * Otherwise, the input is trimmed of leading and trailing whitespace, converted to lowercase, and an attempt is made to parse it as a 64-bit hexadecimal integer.\r\n * If parsing succeeds the normalized result is returned; otherwise the result is \"0\", indicating an invalid Id.\r\n *\r\n * For a description of \"well-formed\", see [Working with Ids]($docs/learning/common/Id64.md).\r\n */\r\n export function fromString(val: string): Id64String {\r\n // NB: in case this is called from JavaScript, we must check the run-time type...\r\n if (typeof val !== \"string\")\r\n return invalid;\r\n\r\n // Skip the common case in which the input is already a well-formed Id string\r\n if (Id64.isId64(val))\r\n return val;\r\n\r\n // Attempt to normalize the input into a well-formed Id string\r\n val = val.toLowerCase().trim();\r\n const len = val.length;\r\n if (len < 2 || val[0] !== \"0\" || val[1] !== \"x\")\r\n return invalid;\r\n\r\n let low = 0;\r\n let high = 0;\r\n let start = 2;\r\n if (len > 12) {\r\n start = (len - 10);\r\n high = toHex(val.slice(2, start));\r\n }\r\n\r\n low = toHex(val.slice(start));\r\n return fromLocalAndBriefcaseIds(low, high);\r\n }\r\n\r\n // Used when constructing local ID portion of Id64String. Performance optimization.\r\n const _localIdPrefixByLocalIdLength = [ // eslint-disable-line @typescript-eslint/naming-convention\r\n \"0000000000\",\r\n \"000000000\",\r\n \"00000000\",\r\n \"0000000\",\r\n \"000000\",\r\n \"00000\",\r\n \"0000\",\r\n \"000\",\r\n \"00\",\r\n \"0\",\r\n \"\",\r\n ];\r\n\r\n /** Produce an Id string from a local and briefcase Id.\r\n * @param localId The non-zero local Id as an unsigned 40-bit integer.\r\n * @param briefcaseId The briefcase Id as an unsigned 24-bit integer.\r\n * @returns an Id64String containing the hexadecimal string representation of the unsigned 64-bit integer which would result from the\r\n * operation `localId | (briefcaseId << 40)`, or an invalid Id \"0\" if the inputs are invalid.\r\n */\r\n export function fromLocalAndBriefcaseIds(localId: number, briefcaseId: number): Id64String {\r\n // NB: Yes, we must check the run-time type...\r\n if (typeof localId !== \"number\" || typeof briefcaseId !== \"number\")\r\n return invalid;\r\n\r\n localId = Math.floor(localId);\r\n if (0 === localId)\r\n return invalid;\r\n\r\n briefcaseId = Math.floor(briefcaseId);\r\n const lowStr = localId.toString(16);\r\n return `0x${(briefcaseId === 0) ? lowStr : (briefcaseId.toString(16) + (_localIdPrefixByLocalIdLength[lowStr.length] + lowStr))}`;\r\n }\r\n\r\n // Used as a buffer when converting a pair of 32-bit integers to an Id64String. Significant performance optimization.\r\n const scratchCharCodes = [\r\n 0x30, // \"0\"\r\n 0x78, // \"x\"\r\n 0x30, // \"0\"\r\n 0x30,\r\n 0x30,\r\n 0x30,\r\n 0x30,\r\n 0x30,\r\n 0x30,\r\n 0x30,\r\n 0x30,\r\n 0x30,\r\n 0x30,\r\n 0x30,\r\n 0x30,\r\n 0x30,\r\n 0x30,\r\n 0x30,\r\n ];\r\n\r\n // Convert 4-bit unsigned integer to char code representing lower-case hexadecimal digit.\r\n function uint4ToCharCode(uint4: number): number {\r\n return uint4 + (uint4 < 10 ? 0x30 : 0x57);\r\n }\r\n\r\n // Convert char code representing lower-case hexadecimal digit to 4-bit unsigned integer.\r\n function charCodeToUint4(char: number): number {\r\n return char - (char >= 0x57 ? 0x57 : 0x30);\r\n }\r\n\r\n // Convert a substring to a uint32. This is twice as fast as using Number.parseInt().\r\n function substringToUint32(id: Id64String, start: number, end: number): number {\r\n let uint32 = 0;\r\n for (let i = start; i < end; i++) {\r\n const uint4 = charCodeToUint4(id.charCodeAt(i));\r\n const shift = (end - i - 1) << 2;\r\n const mask = uint4 << shift;\r\n uint32 = (uint32 | mask) >>> 0; // >>> 0 to force unsigned because javascript\r\n }\r\n\r\n return uint32;\r\n }\r\n\r\n /** Create an Id64String from a pair of unsigned 32-bit integers.\r\n * @param lowBytes The lower 4 bytes of the Id\r\n * @param highBytes The upper 4 bytes of the Id\r\n * @returns an Id64String containing the hexadecimal string representation of the unsigned 64-bit integer which would result from the\r\n * operation `lowBytes | (highBytes << 32)`.\r\n * @see [[Id64.fromUint32PairObject]] if you have a [[Id64.Uint32Pair]] object.\r\n */\r\n export function fromUint32Pair(lowBytes: number, highBytes: number): Id64String {\r\n const localIdLow = lowBytes >>> 0;\r\n const localIdHigh = (highBytes & 0x000000ff) * (0xffffffff + 1); // aka (highBytes & 0xff) << 32\r\n const localId = localIdLow + localIdHigh; // aka localIdLow | localIdHigh\r\n if (0 === localId)\r\n return invalid;\r\n\r\n // Need to omit or preserve leading zeroes...\r\n const buffer = scratchCharCodes;\r\n let index = 2;\r\n for (let i = 7; i >= 0; i--) {\r\n const shift = i << 2;\r\n const mask = 0xf << shift;\r\n const uint4 = (highBytes & mask) >>> shift;\r\n if (index > 2 || 0 !== uint4)\r\n buffer[index++] = uint4ToCharCode(uint4);\r\n }\r\n\r\n for (let i = 7; i >= 0; i--) {\r\n const shift = i << 2;\r\n const mask = 0xf << shift;\r\n const uint4 = (lowBytes & mask) >>> shift;\r\n if (index > 2 || 0 !== uint4)\r\n buffer[index++] = uint4ToCharCode(uint4);\r\n }\r\n\r\n if (buffer.length !== index)\r\n buffer.length = index;\r\n\r\n return String.fromCharCode(...scratchCharCodes);\r\n }\r\n\r\n /** Create an Id64String from a [[Id64.Uint32Pair]].\r\n * @see [[Id64.fromUint32Pair]].\r\n */\r\n export function fromUint32PairObject(pair: Uint32Pair): Id64String {\r\n return fromUint32Pair(pair.lower, pair.upper);\r\n }\r\n\r\n /** Returns true if the inputs represent two halves of a valid 64-bit Id.\r\n * @see [[Id64.Uint32Pair]].\r\n */\r\n export function isValidUint32Pair(lowBytes: number, highBytes: number): boolean {\r\n // Detect local ID of zero\r\n return 0 !== lowBytes || 0 !== (highBytes & 0x000000ff);\r\n }\r\n\r\n /** Represents an [[Id64]] as a pair of unsigned 32-bit integers. Because Javascript lacks efficient support for 64-bit integers,\r\n * this representation can be useful in performance-sensitive code like the render loop.\r\n * @see [[Id64.getUint32Pair]] to convert an [[Id64String]] to a Uint32Pair.\r\n * @see [[Id64.fromUint32Pair]] to convert a Uint32Pair to an [[Id64String]].\r\n * @see [[Id64.Uint32Set]] and [[Id64.Uint32Map]] for collections based on Uint32Pairs.\r\n */\r\n export interface Uint32Pair {\r\n /** The lower 4 bytes of the 64-bit integer. */\r\n lower: number;\r\n /** The upper 4 bytes of the 64-bit integer. */\r\n upper: number;\r\n }\r\n\r\n /** Convert an Id64String to a 64-bit unsigned integer represented as a pair of unsigned 32-bit integers.\r\n * @param id The well-formed string representation of a 64-bit Id.\r\n * @param out Used as the return value if supplied; otherwise a new object is returned.\r\n * @returns An object containing the parsed lower and upper 32-bit integers comprising the 64-bit Id.\r\n */\r\n export function getUint32Pair(id: Id64String, out?: Uint32Pair): Uint32Pair {\r\n if (!out)\r\n out = { lower: 0, upper: 0 };\r\n\r\n out.lower = getLowerUint32(id);\r\n out.upper = getUpperUint32(id);\r\n return out;\r\n }\r\n\r\n /** Extract an unsigned 32-bit integer from the lower 4 bytes of an Id64String. */\r\n export function getLowerUint32(id: Id64String): number {\r\n if (isInvalid(id))\r\n return 0;\r\n\r\n const end = id.length;\r\n const start = end > 10 ? end - 8 : 2;\r\n return substringToUint32(id, start, end);\r\n }\r\n\r\n /** Extract an unsigned 32-bit integer from the upper 4 bytes of an Id64String. */\r\n export function getUpperUint32(id: Id64String): number {\r\n const len = id.length;\r\n if (len <= 10 || isInvalid(id))\r\n return 0;\r\n\r\n return substringToUint32(id, 2, len - 8);\r\n }\r\n\r\n /** Convert an [[Id64Arg]] into an [[Id64Set]].\r\n *\r\n * This method can be used by functions that accept an Id64Arg to conveniently process the value(s). For example:\r\n * ```ts\r\n * public addCategories(arg: Id64Arg) { Id64.toIdSet(arg).forEach((id) => this.categories.add(id)); }\r\n * ```\r\n *\r\n * Alternatively, to avoid allocating a new Id64Set, use [[Id64.iterable]].\r\n *\r\n * @param arg The Ids to convert to an Id64Set.\r\n * @param makeCopy If true, and the input is already an Id64Set, returns a deep copy of the input.\r\n * @returns An Id64Set containing the set of [[Id64String]]s represented by the Id64Arg.\r\n */\r\n export function toIdSet(arg: Id64Arg, makeCopy: boolean = false): Id64Set {\r\n if (arg instanceof Set)\r\n return makeCopy ? new Set<string>(arg) : arg;\r\n\r\n const ids = new Set<Id64String>();\r\n if (typeof arg === \"string\")\r\n ids.add(arg);\r\n else if (Array.isArray(arg)) {\r\n arg.forEach((id: Id64String) => {\r\n if (typeof id === \"string\")\r\n ids.add(id);\r\n });\r\n }\r\n\r\n return ids;\r\n }\r\n\r\n /** Obtain iterator over the specified Ids.\r\n * @see [[Id64.iterable]].\r\n */\r\n export function* iterator(ids: Id64Arg): Iterator<Id64String> {\r\n if (typeof ids === \"string\") {\r\n yield ids;\r\n } else {\r\n for (const id of ids)\r\n yield id;\r\n }\r\n }\r\n\r\n /** Obtain an iterable over the specified Ids. Example usage:\r\n * ```ts\r\n * const ids = [\"0x123\", \"0xfed\"];\r\n * for (const id of Id64.iterable(ids))\r\n * console.log(id);\r\n * ```\r\n */\r\n export function iterable(ids: Id64Arg): Iterable<Id64String> {\r\n return {\r\n [Symbol.iterator]: () => iterator(ids),\r\n };\r\n }\r\n\r\n /** Return the first [[Id64String]] of an [[Id64Arg]]. */\r\n export function getFirst(arg: Id64Arg): Id64String {\r\n return typeof arg === \"string\" ? arg : (Array.isArray(arg) ? arg[0] : arg.values().next().value);\r\n }\r\n\r\n /** Return the number of [[Id64String]]s represented by an [[Id64Arg]]. */\r\n export function sizeOf(arg: Id64Arg): number {\r\n return typeof arg === \"string\" ? 1 : (Array.isArray(arg) ? arg.length : arg.size);\r\n }\r\n\r\n /** Returns true if the [[Id64Arg]] contains the specified Id. */\r\n export function has(arg: Id64Arg, id: Id64String): boolean {\r\n if (typeof arg === \"string\")\r\n return arg === id;\r\n if (Array.isArray(arg))\r\n return -1 !== arg.indexOf(id);\r\n\r\n return arg.has(id);\r\n }\r\n\r\n /** The string representation of an invalid Id. */\r\n export const invalid = \"0\";\r\n\r\n /** Determine if the supplied id string represents a transient Id.\r\n * @param id A well-formed Id string.\r\n * @returns true if the Id represents a transient Id.\r\n * @note This method assumes the input is a well-formed Id string.\r\n * @see [[Id64.isTransientId64]]\r\n * @see [[TransientIdSequence]]\r\n */\r\n export function isTransient(id: Id64String): boolean {\r\n // A transient Id is of the format \"0xffffffxxxxxxxxxx\" where the leading 6 digits indicate an invalid briefcase Id.\r\n return 18 === id.length && id.startsWith(\"0xffffff\");\r\n }\r\n\r\n /** Determine if the input is a well-formed [[Id64String]] and represents a transient Id.\r\n * @see [[Id64.isTransient]]\r\n * @see [[Id64.isId64]]\r\n * @see [[TransientIdSequence]]\r\n */\r\n export function isTransientId64(id: string): boolean {\r\n return isValidId64(id) && isTransient(id);\r\n }\r\n\r\n /** Determine if the input is a well-formed [[Id64String]].\r\n *\r\n * For a description of \"well-formed\", see [Working with Ids]($docs/learning/common/Id64.md).\r\n * @see [[Id64.isValidId64]]\r\n */\r\n export function isId64(id: string): boolean {\r\n const len = id.length;\r\n if (0 === len || 18 < len)\r\n return false;\r\n\r\n if (\"0\" !== id[0])\r\n return false;\r\n\r\n // Well-formed invalid Id: \"0\"\r\n if (1 === len)\r\n return true;\r\n\r\n // Valid Ids begin with \"0x\" followed by at least one lower-case hexadecimal digit.\r\n if (2 === len || \"x\" !== id[1])\r\n return false;\r\n\r\n // If briefcase Id is present, it occupies at least one digit, followed by 10 digits for local Id\r\n let localIdStart = 2;\r\n if (len > 12) {\r\n localIdStart = len - 10;\r\n\r\n // Verify briefcase Id\r\n if (!isValidHexString(id, 2, localIdStart - 2))\r\n return false;\r\n\r\n // Skip leading zeroes in local Id\r\n for (let i = localIdStart; i < len; i++) {\r\n if (0x30 !== id.charCodeAt(i)) // '0'\r\n break;\r\n else\r\n localIdStart++;\r\n }\r\n\r\n if (localIdStart >= len)\r\n return false;\r\n }\r\n\r\n return isValidHexString(id, localIdStart, len - localIdStart);\r\n }\r\n\r\n /** Returns true if the input is not equal to the representation of an invalid Id.\r\n * @note This method assumes the input is a well-formed Id string.\r\n * @see [[Id64.isInvalid]]\r\n * @see [[Id64.isValidId64]]\r\n */\r\n export function isValid(id: Id64String): boolean {\r\n return Id64.invalid !== id;\r\n }\r\n\r\n /** Returns true if the input is a well-formed [[Id64String]] representing a valid Id.\r\n * @see [[Id64.isValid]]\r\n * @see [[Id64.isId64]]\r\n */\r\n export function isValidId64(id: string): boolean {\r\n return Id64.invalid !== id && Id64.isId64(id);\r\n }\r\n\r\n /** Returns true if the input is a well-formed [[Id64String]] representing an invalid Id.\r\n * @see [[Id64.isValid]]\r\n */\r\n export function isInvalid(id: Id64String): boolean {\r\n return Id64.invalid === id;\r\n }\r\n\r\n /** A specialized replacement for Set<Id64String> optimized for performance-critical code which represents large sets of [[Id64]]s as pairs of\r\n * 32-bit integers.\r\n * The internal representation is a Map<number, Set<number>> where the Map key is the upper 4 bytes of the IDs and the Set elements are the lower 4 bytes of the IDs.\r\n * Because the upper 4 bytes store the 24-bit briefcase ID plus the upper 8 bits of the local ID, there will be a very small distribution of unique Map keys.\r\n * To further optimize this data type, the following assumptions are made regarding the { lower, upper } inputs, and no validation is performed to confirm them:\r\n * - The inputs are unsigned 32-bit integers;\r\n * - The inputs represent a valid Id64String (e.g., local ID is not zero).\r\n * @see [[Id64.Uint32Map]] for a similarly-optimized replacement for Map<Id64String, T>\r\n * @public\r\n */\r\n export class Uint32Set {\r\n protected readonly _map = new Map<number, Set<number>>();\r\n\r\n /** Construct a new Uint32Set.\r\n * @param ids If supplied, all of the specified Ids will be added to the new set.\r\n */\r\n public constructor(ids?: Id64Arg) {\r\n if (undefined !== ids)\r\n this.addIds(ids);\r\n }\r\n\r\n /** Return true if `this` and `other` contain the same set of Ids. */\r\n public equals(other: Uint32Set): boolean {\r\n if (this === other) {\r\n return true;\r\n }\r\n\r\n if (this.size !== other.size) {\r\n return false;\r\n }\r\n\r\n for (const [key, thisValue] of this._map) {\r\n const otherValue = other._map.get(key);\r\n if (!otherValue || thisValue.size !== otherValue.size) {\r\n return false;\r\n }\r\n\r\n for (const value of thisValue) {\r\n if (!otherValue.has(value)) {\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /** Remove all contents of this set. */\r\n public clear(): void {\r\n this._map.clear();\r\n }\r\n\r\n /** Add an Id to the set. */\r\n public addId(id: Id64String): void {\r\n this.add(Id64.getLowerUint32(id), Id64.getUpperUint32(id));\r\n }\r\n\r\n /** Add any number of Ids to the set. */\r\n public addIds(ids: Id64Arg): void {\r\n for (const id of Id64.iterable(ids))\r\n this.addId(id);\r\n }\r\n\r\n /** Returns true if the set contains the specified Id. */\r\n public hasId(id: Id64String): boolean { return this.has(Id64.getLowerUint32(id), Id64.getUpperUint32(id)); }\r\n\r\n /** Add an Id to the set. */\r\n public add(low: number, high: number): void {\r\n let set = this._map.get(high);\r\n if (undefined === set) {\r\n set = new Set<number>();\r\n this._map.set(high, set);\r\n }\r\n\r\n set.add(low);\r\n }\r\n\r\n /** Remove an Id from the set. */\r\n public deleteId(id: Id64String): void {\r\n this.delete(Id64.getLowerUint32(id), Id64.getUpperUint32(id));\r\n }\r\n\r\n /** Remove any number of Ids from the set. */\r\n public deleteIds(ids: Id64Arg): void {\r\n for (const id of Id64.iterable(ids))\r\n this.deleteId(id);\r\n }\r\n\r\n /** Remove an Id from the set. */\r\n public delete(low: number, high: number): void {\r\n const set = this._map.get(high);\r\n if (undefined !== set)\r\n set.delete(low);\r\n }\r\n\r\n /** Returns true if the set contains the specified Id. */\r\n public has(low: number, high: number): boolean {\r\n const set = this._map.get(high);\r\n return undefined !== set && set.has(low);\r\n }\r\n\r\n /** Returns true if the set contains the Id specified by `pair`. */\r\n public hasPair(pair: Uint32Pair): boolean {\r\n return this.has(pair.lower, pair.upper);\r\n }\r\n\r\n /** Returns true if the set contains no Ids. */\r\n public get isEmpty(): boolean { return 0 === this._map.size; }\r\n\r\n /** Returns the number of Ids contained in the set. */\r\n public get size(): number {\r\n let size = 0;\r\n for (const entry of this._map)\r\n size += entry[1].size;\r\n\r\n return size;\r\n }\r\n\r\n /** Populates and returns an array of all Ids contained in the set. */\r\n public toId64Array(): Id64Array {\r\n const ids: Id64Array = [];\r\n for (const entry of this._map)\r\n for (const low of entry[1])\r\n ids.push(Id64.fromUint32Pair(low, entry[0]));\r\n\r\n return ids;\r\n }\r\n\r\n /** Populates and returns a set of all Ids contained in the set. */\r\n public toId64Set(): Id64Set {\r\n const ids = new Set<string>();\r\n for (const entry of this._map)\r\n for (const low of entry[1])\r\n ids.add(Id64.fromUint32Pair(low, entry[0]));\r\n\r\n return ids;\r\n }\r\n\r\n /** Execute a function against each Id in this set. */\r\n public forEach(func: (lo: number, hi: number) => void): void {\r\n for (const entry of this._map)\r\n for (const lo of entry[1])\r\n func(lo, entry[0]);\r\n }\r\n }\r\n\r\n /** A specialized replacement for Map<Id64String, T> optimized for performance-critical code.\r\n * @see [[Id64.Uint32Set]] for implementation details.\r\n * @public\r\n */\r\n export class Uint32Map<T> {\r\n protected readonly _map = new Map<number, Map<number, T>>();\r\n\r\n /** Remove all entries from the map. */\r\n public clear(): void { this._map.clear(); }\r\n /** Find an entry in the map by Id. */\r\n public getById(id: Id64String): T | undefined { return this.get(Id64.getLowerUint32(id), Id64.getUpperUint32(id)); }\r\n /** Set an entry in the map by Id. */\r\n public setById(id: Id64String, value: T): void { this.set(Id64.getLowerUint32(id), Id64.getUpperUint32(id), value); }\r\n\r\n /** Set an entry in the map by Id components. */\r\n public set(low: number, high: number, value: T): void {\r\n let map = this._map.get(high);\r\n if (undefined === map) {\r\n map = new Map<number, T>();\r\n this._map.set(high, map);\r\n }\r\n\r\n map.set(low, value);\r\n }\r\n\r\n /** Get an entry from the map by Id components. */\r\n public get(low: number, high: number): T | undefined {\r\n const map = this._map.get(high);\r\n return undefined !== map ? map.get(low) : undefined;\r\n }\r\n\r\n /** Returns true if the map contains no entries. */\r\n public get isEmpty(): boolean { return 0 === this._map.size; }\r\n /** Returns the number of entries in the map. */\r\n public get size(): number {\r\n let size = 0;\r\n for (const entry of this._map)\r\n size += entry[1].size;\r\n\r\n return size;\r\n }\r\n\r\n /** Execute a function against each entry in this map. */\r\n public forEach(func: (lo: number, hi: number, value: T) => void): void {\r\n for (const outerEntry of this._map)\r\n for (const innerEntry of outerEntry[1])\r\n func(innerEntry[0], outerEntry[0], innerEntry[1]);\r\n }\r\n }\r\n}\r\n\r\n/** JSON representation of a [[TransientIdSequence]], primarily useful for transferring sequences to and from a [Worker](https://developer.mozilla.org/en-US/docs/Web/API/Worker).\r\n * It stores two \"local\" 40-bit Ids describing the range of [Id64String]($docs/learning/common/Id64.md)s generated by the sequence.\r\n * @public\r\n */\r\nexport interface TransientIdSequenceProps {\r\n /** The starting local Id. The sequence begins at `initialLocalId + 1`. */\r\n initialLocalId: number;\r\n /** The maximum local Id generated by the sequence thus far. It is never less than [[initialLocalId]]. If it is equal to [[initialLocalId]], then the sequence has\r\n * not yet generated any Ids.\r\n * The next local Id generated by the sequence will be `currentLocalId + 1`.\r\n */\r\n currentLocalId: number;\r\n}\r\n\r\nfunction validateLocalId(num: number): void {\r\n if (num < 0 || Math.round(num) !== num) {\r\n throw new Error(\"Local Id must be a non-negative integer\");\r\n }\r\n}\r\n\r\n/** A function returned by [[TransientIdSequence.merge]] that remaps the local Id portion of an [Id64String]($docs/learning/common/Id64.md) generated by\r\n * the source sequence to the corresponding local Id in the target sequence.\r\n * It returns `sourceLocalId` if the input did not originate from the source sequence.\r\n* @public\r\n*/\r\nexport type RemapTransientLocalId = (sourceLocalId: number) => number;\r\n\r\n/**\r\n * Generates unique [[Id64String]] values in sequence, which are guaranteed not to conflict with Ids associated with persistent elements or models.\r\n * This is useful for associating stable, non-persistent identifiers with things like [Decorator]($frontend)s.\r\n * A TransientIdSequence can generate a maximum of (2^40)-2 unique Ids.\r\n * @public\r\n */\r\nexport class TransientIdSequence {\r\n /** The starting local Id provided to the constructor. The sequence begins at `initialLocalId + 1`. */\r\n public readonly initialLocalId: number;\r\n private _localId: number;\r\n\r\n /** Constructor.\r\n * @param initialLocalId The starting local Id. The local Id of the first [[Id64String]] generated by [[getNext]] will be `initialLocalId + 1`.\r\n */\r\n public constructor(initialLocalId = 0) {\r\n validateLocalId(initialLocalId);\r\n this.initialLocalId = initialLocalId;\r\n this._localId = initialLocalId;\r\n }\r\n\r\n /** The maximum local Id generated by the sequence thus far. It is never less than [[initialLocalId]]. If it is equal to [[initialLocalId]], then the sequence has\r\n * not yet generated any Ids.\r\n * Each call to [[getNext]] increments this by 1 and uses it as the local Id of the generated [[Id64String]].\r\n */\r\n public get currentLocalId(): number {\r\n return this._localId;\r\n }\r\n\r\n /** Generate and return the next transient Id64String in the sequence.\r\n * @deprecated in 3.x. Use [[getNext]].\r\n */\r\n public get next(): Id64String {\r\n return this.getNext();\r\n }\r\n\r\n /** Generate and return the next transient Id64String in the sequence. */\r\n public getNext(): Id64String {\r\n return Id64.fromLocalAndBriefcaseIds(++this._localId, 0xffffff);\r\n }\r\n\r\n /** Preview the transient Id64String that will be returned by the next call to [[getNext]].\r\n * This is primarily useful for tests.\r\n */\r\n public peekNext(): Id64String {\r\n return Id64.fromLocalAndBriefcaseIds(this._localId + 1, 0xffffff);\r\n }\r\n\r\n /** Convert this sequence to its JSON representation. */\r\n public toJSON(): TransientIdSequenceProps {\r\n return {\r\n initialLocalId: this.initialLocalId,\r\n currentLocalId: this.currentLocalId,\r\n };\r\n }\r\n\r\n /** Create a sequence from its JSON representation. */\r\n public static fromJSON(props: TransientIdSequenceProps): TransientIdSequence {\r\n validateLocalId(props.currentLocalId);\r\n const sequence = new TransientIdSequence(props.initialLocalId);\r\n sequence._localId = props.currentLocalId;\r\n return sequence;\r\n }\r\n\r\n /** Obtain the JSON representation of a new sequence that diverges from this sequence, with its [[initialLocalId]] set to this sequence's [[currentLocalId]].\r\n * The two sequences can generate Ids independently. Later, you can [[merge]] the sequences, resolving conflicts where the two sequences generated identical Ids.\r\n * This is chiefly useful when generating transient Ids on a [Worker](https://developer.mozilla.org/en-US/docs/Web/API/Worker).\r\n */\r\n public fork(): TransientIdSequenceProps {\r\n return {\r\n initialLocalId: this.currentLocalId,\r\n currentLocalId: this.currentLocalId,\r\n };\r\n }\r\n\r\n /** Integrate the Ids generated by a [[fork]] of this sequence. All of the Ids generated by `source` will be remapped to Ids at the end of this sequence.\r\n * This is chiefly useful when generating transient Ids on a [Worker](https://developer.mozilla.org/en-US/docs/Web/API/Worker).\r\n * @param source The JSON representation of the [[fork]]ed sequence to be merged with this one.\r\n * @returns a function that permits you to remap the local Ids generated by `source` into the corresponding local Ids assigned by this sequence.\r\n * @throws Error if `source` is not a fork of this sequence or is malformed (e.g., contains negative and/or non-integer local Ids).\r\n */\r\n public merge(source: TransientIdSequenceProps): (sourceLocalId: number) => number {\r\n const { initialLocalId, currentLocalId } = source;\r\n\r\n validateLocalId(initialLocalId);\r\n validateLocalId(currentLocalId);\r\n\r\n if (initialLocalId > this.currentLocalId) {\r\n throw new Error(\"Transient Id sequences do not intersect\");\r\n }\r\n\r\n if (initialLocalId > currentLocalId) {\r\n throw new Error(\"Current local Id cannot be less than initial local Id\");\r\n }\r\n\r\n const delta = this.currentLocalId - initialLocalId;\r\n this._localId += currentLocalId - initialLocalId;\r\n\r\n return (sourceLocalId: number) => {\r\n if (sourceLocalId > initialLocalId && sourceLocalId <= currentLocalId) {\r\n return sourceLocalId + delta;\r\n }\r\n\r\n return sourceLocalId;\r\n };\r\n }\r\n}\r\n\r\n/**\r\n * The Guid namespace provides facilities for working with GUID strings using the \"8-4-4-4-12\" pattern.\r\n *\r\n * The [[GuidString]] type alias is used to indicate function arguments, return types, and variables which are known to\r\n * be in the GUID format.\r\n * @public\r\n */\r\nexport namespace Guid {\r\n const uuidPattern = new RegExp(\"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$\");\r\n\r\n /** Represents the empty Guid 00000000-0000-0000-0000-000000000000 */\r\n export const empty: GuidString = \"00000000-0000-0000-0000-000000000000\";\r\n\r\n /** Determine whether the input string is \"guid-like\". That is, it follows the 8-4-4-4-12 pattern. This does not enforce\r\n * that the string is actually in valid UUID format.\r\n */\r\n export function isGuid(value: string): boolean {\r\n return uuidPattern.test(value);\r\n }\r\n\r\n /** Determine whether the input string is a valid V4 Guid string */\r\n export function isV4Guid(value: string): boolean {\r\n return /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/.test(value);\r\n }\r\n\r\n /** Create a new V4 Guid value */\r\n export function createValue(): GuidString {\r\n // https://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript\r\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, (c) => {\r\n const r = Math.random() * 16 | 0;\r\n const v = c === \"x\" ? r : (r & 0x3 | 0x8);\r\n return v.toString(16);\r\n });\r\n }\r\n\r\n /**\r\n * Normalize a Guid string if possible. Normalization consists of:\r\n * - Convert all characters to lower case\r\n * - Trim any leading or trailing whitespace\r\n * - Convert to the standard Guid format \"8-4-4-4-12\", repositioning the '-' characters as necessary, presuming there are exactly 32 hexadecimal digits.\r\n * @param value Input value that represents a Guid\r\n * @returns Normalized representation of the Guid string. If the normalization fails, return the *original* value unmodified (Note: it is *not* a valid Guid)\r\n */\r\n export function normalize(value: GuidString): GuidString {\r\n const lowerValue = value.toLowerCase().trim();\r\n\r\n // Return if it's already formatted to be a Guid\r\n if (isGuid(lowerValue))\r\n return lowerValue;\r\n\r\n // Remove any existing \"-\" characters and position them properly, if there remains exactly 32 hexadecimal digits\r\n const noDashValue = lowerValue.replace(/-/g, \"\");\r\n const noDashPattern = /^([0-9a-f]{8})([0-9a-f]{4})([0-9a-f]{4})([0-9a-f]{4})([0-9a-f]{12})$/;\r\n if (noDashPattern.test(noDashValue)) {\r\n return noDashValue.replace(noDashPattern,\r\n (_match: string, p1: string, p2: string, p3: string, p4: string, p5: string) =>\r\n `${p1}-${p2}-${p3}-${p4}-${p5}`);\r\n }\r\n\r\n // Return unmodified string - (note: it is *not* a valid Guid)\r\n return value;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"Id.js","sourceRoot":"","sources":["../../src/Id.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AA4BH,SAAS,KAAK,CAAC,GAAW;IACxB,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IAC5B,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACjC,CAAC;AAED,SAAS,0BAA0B,CAAC,GAAW,EAAE,KAAa;IAC5D,OAAO,mBAAmB,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AAChD,CAAC;AAED,SAAS,mBAAmB,CAAC,GAAW,EAAE,KAAa,EAAE,YAAqB,IAAI;IAChF,MAAM,QAAQ,GAAG,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACvC,MAAM,eAAe,GAAG,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EAAU,EAAE,EAAE,CAC7E,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;QACvC,CAAC;QAED,8DAA8D;QAC9D,OAAO,KAAK,CAAC;IACf,CAAC;IAlBe,cAAS,YAkBxB,CAAA;AACH,CAAC,EAvDgB,IAAI,oBAAJ,IAAI,QAuDpB","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Ids\r\n */\r\n\r\n/** A string containing a well-formed string representation of an [Id64]($core-bentley).\r\n * See [Working with Ids]($docs/learning/common/Id64.md).\r\n * @public\r\n */\r\nexport type Id64String = string;\r\n\r\n/** A string containing a well-formed string representation of a [Guid]($core-bentley).\r\n * @public\r\n */\r\nexport type GuidString = string;\r\n\r\n/** A set of [[Id64String]]s.\r\n * @public\r\n */\r\nexport type Id64Set = Set<Id64String>;\r\n\r\n/** An array of [[Id64String]]s.\r\n * @public\r\n */\r\nexport type Id64Array = Id64String[];\r\n\r\n/** Used as an argument to a function that can accept one or more [[Id64String]]s.\r\n * @public\r\n */\r\nexport type Id64Arg = Id64String | Id64Set | Id64Array;\r\n\r\nfunction toHex(str: string): number {\r\n const v = parseInt(str, 16);\r\n return Number.isNaN(v) ? 0 : v;\r\n}\r\n\r\nfunction isLowerCaseNonZeroHexDigit(str: string, index: number) {\r\n return isLowerCaseHexDigit(str, index, false);\r\n}\r\n\r\nfunction isLowerCaseHexDigit(str: string, index: number, allowZero: boolean = true): boolean {\r\n const charCode = str.charCodeAt(index);\r\n const minDecimalDigit = allowZero ? 0x30 : 0x31; // '0' or '1'...\r\n return (charCode >= minDecimalDigit && charCode <= 0x39) || (charCode >= 0x61 && charCode <= 0x66); // '0'-'9, 'a' -'f'\r\n}\r\n\r\nfunction isValidHexString(id: string, startIndex: number, len: number) {\r\n if (len === 0)\r\n return false;\r\n\r\n // No leading zeroes...\r\n if (!isLowerCaseNonZeroHexDigit(id, startIndex))\r\n return false;\r\n\r\n // ...followed by len-1 lowercase hexadecimal digits.\r\n for (let i = 1; i < len; i++)\r\n if (!isLowerCaseHexDigit(id, startIndex + i))\r\n return false;\r\n\r\n return true;\r\n}\r\n\r\n/**\r\n * The Id64 namespace provides facilities for working with 64-bit identifiers. These Ids are stored as 64-bit integers inside an [[IModelDb]], but must be represented\r\n * as strings in JavaScript because JavaScript does not intrinsically support 64-bit integers.\r\n *\r\n * The [[Id64String]] type alias is used to indicate function arguments, return types, and variables which are known to contain a well-formed representation of a 64-bit Id.\r\n *\r\n * See [Working with Ids]($docs/learning/common/Id64.md) for a detailed description and code examples.\r\n * @public\r\n */\r\nexport namespace Id64 {\r\n /** Extract the \"local\" Id portion of an Id64String, contained in the lower 40 bits of the 64-bit value. */\r\n export function getLocalId(id: Id64String): number {\r\n if (isInvalid(id))\r\n return 0;\r\n\r\n const len = id.length;\r\n const start = (len > 12) ? (len - 10) : 2;\r\n return toHex(id.slice(start));\r\n }\r\n\r\n /** Extract the briefcase Id portion of an Id64String, contained in the upper 24 bits of the 64-bit value. */\r\n export function getBriefcaseId(id: Id64String): number {\r\n if (isInvalid(id))\r\n return 0;\r\n\r\n const len = id.length;\r\n return (len <= 12) ? 0 : toHex(id.slice(2, len - 10));\r\n }\r\n\r\n /** Create an Id64String from its JSON representation.\r\n * @param prop The JSON representation of an Id.\r\n * @returns A well-formed Id string.\r\n * @note if the input is undefined, the result is \"0\", indicating an invalid Id.\r\n * @note if the input is not undefined, the result is the same as that of [[Id64.fromString]].\r\n */\r\n export function fromJSON(prop?: string): Id64String {\r\n return typeof prop === \"string\" ? Id64.fromString(prop) : Id64.invalid;\r\n }\r\n\r\n /** Given a string value, attempt to normalize it into a well-formed Id string.\r\n * If the input is already a well-formed Id string, it is returned unmodified.\r\n * Otherwise, the input is trimmed of leading and trailing whitespace, converted to lowercase, and an attempt is made to parse it as a 64-bit hexadecimal integer.\r\n * If parsing succeeds the normalized result is returned; otherwise the result is \"0\", indicating an invalid Id.\r\n *\r\n * For a description of \"well-formed\", see [Working with Ids]($docs/learning/common/Id64.md).\r\n */\r\n export function fromString(val: string): Id64String {\r\n // NB: in case this is called from JavaScript, we must check the run-time type...\r\n if (typeof val !== \"string\")\r\n return invalid;\r\n\r\n // Skip the common case in which the input is already a well-formed Id string\r\n if (Id64.isId64(val))\r\n return val;\r\n\r\n // Attempt to normalize the input into a well-formed Id string\r\n val = val.toLowerCase().trim();\r\n const len = val.length;\r\n if (len < 2 || val[0] !== \"0\" || val[1] !== \"x\")\r\n return invalid;\r\n\r\n let low = 0;\r\n let high = 0;\r\n let start = 2;\r\n if (len > 12) {\r\n start = (len - 10);\r\n high = toHex(val.slice(2, start));\r\n }\r\n\r\n low = toHex(val.slice(start));\r\n return fromLocalAndBriefcaseIds(low, high);\r\n }\r\n\r\n // Used when constructing local ID portion of Id64String. Performance optimization.\r\n const _localIdPrefixByLocalIdLength = [\r\n \"0000000000\",\r\n \"000000000\",\r\n \"00000000\",\r\n \"0000000\",\r\n \"000000\",\r\n \"00000\",\r\n \"0000\",\r\n \"000\",\r\n \"00\",\r\n \"0\",\r\n \"\",\r\n ];\r\n\r\n /** Produce an Id string from a local and briefcase Id.\r\n * @param localId The non-zero local Id as an unsigned 40-bit integer.\r\n * @param briefcaseId The briefcase Id as an unsigned 24-bit integer.\r\n * @returns an Id64String containing the hexadecimal string representation of the unsigned 64-bit integer which would result from the\r\n * operation `localId | (briefcaseId << 40)`, or an invalid Id \"0\" if the inputs are invalid.\r\n */\r\n export function fromLocalAndBriefcaseIds(localId: number, briefcaseId: number): Id64String {\r\n // NB: Yes, we must check the run-time type...\r\n if (typeof localId !== \"number\" || typeof briefcaseId !== \"number\")\r\n return invalid;\r\n\r\n localId = Math.floor(localId);\r\n if (0 === localId)\r\n return invalid;\r\n\r\n briefcaseId = Math.floor(briefcaseId);\r\n const lowStr = localId.toString(16);\r\n return `0x${(briefcaseId === 0) ? lowStr : (briefcaseId.toString(16) + (_localIdPrefixByLocalIdLength[lowStr.length] + lowStr))}`;\r\n }\r\n\r\n // Used as a buffer when converting a pair of 32-bit integers to an Id64String. Significant performance optimization.\r\n const scratchCharCodes = [\r\n 0x30, // \"0\"\r\n 0x78, // \"x\"\r\n 0x30, // \"0\"\r\n 0x30,\r\n 0x30,\r\n 0x30,\r\n 0x30,\r\n 0x30,\r\n 0x30,\r\n 0x30,\r\n 0x30,\r\n 0x30,\r\n 0x30,\r\n 0x30,\r\n 0x30,\r\n 0x30,\r\n 0x30,\r\n 0x30,\r\n ];\r\n\r\n // Convert 4-bit unsigned integer to char code representing lower-case hexadecimal digit.\r\n function uint4ToCharCode(uint4: number): number {\r\n return uint4 + (uint4 < 10 ? 0x30 : 0x57);\r\n }\r\n\r\n // Convert char code representing lower-case hexadecimal digit to 4-bit unsigned integer.\r\n function charCodeToUint4(char: number): number {\r\n return char - (char >= 0x57 ? 0x57 : 0x30);\r\n }\r\n\r\n // Convert a substring to a uint32. This is twice as fast as using Number.parseInt().\r\n function substringToUint32(id: Id64String, start: number, end: number): number {\r\n let uint32 = 0;\r\n for (let i = start; i < end; i++) {\r\n const uint4 = charCodeToUint4(id.charCodeAt(i));\r\n const shift = (end - i - 1) << 2;\r\n const mask = uint4 << shift;\r\n uint32 = (uint32 | mask) >>> 0; // >>> 0 to force unsigned because javascript\r\n }\r\n\r\n return uint32;\r\n }\r\n\r\n /** Create an Id64String from a pair of unsigned 32-bit integers.\r\n * @param lowBytes The lower 4 bytes of the Id\r\n * @param highBytes The upper 4 bytes of the Id\r\n * @returns an Id64String containing the hexadecimal string representation of the unsigned 64-bit integer which would result from the\r\n * operation `lowBytes | (highBytes << 32)`.\r\n * @see [[Id64.fromUint32PairObject]] if you have a [[Id64.Uint32Pair]] object.\r\n */\r\n export function fromUint32Pair(lowBytes: number, highBytes: number): Id64String {\r\n const localIdLow = lowBytes >>> 0;\r\n const localIdHigh = (highBytes & 0x000000ff) * (0xffffffff + 1); // aka (highBytes & 0xff) << 32\r\n const localId = localIdLow + localIdHigh; // aka localIdLow | localIdHigh\r\n if (0 === localId)\r\n return invalid;\r\n\r\n // Need to omit or preserve leading zeroes...\r\n const buffer = scratchCharCodes;\r\n let index = 2;\r\n for (let i = 7; i >= 0; i--) {\r\n const shift = i << 2;\r\n const mask = 0xf << shift;\r\n const uint4 = (highBytes & mask) >>> shift;\r\n if (index > 2 || 0 !== uint4)\r\n buffer[index++] = uint4ToCharCode(uint4);\r\n }\r\n\r\n for (let i = 7; i >= 0; i--) {\r\n const shift = i << 2;\r\n const mask = 0xf << shift;\r\n const uint4 = (lowBytes & mask) >>> shift;\r\n if (index > 2 || 0 !== uint4)\r\n buffer[index++] = uint4ToCharCode(uint4);\r\n }\r\n\r\n if (buffer.length !== index)\r\n buffer.length = index;\r\n\r\n return String.fromCharCode(...scratchCharCodes);\r\n }\r\n\r\n /** Create an Id64String from a [[Id64.Uint32Pair]].\r\n * @see [[Id64.fromUint32Pair]].\r\n */\r\n export function fromUint32PairObject(pair: Uint32Pair): Id64String {\r\n return fromUint32Pair(pair.lower, pair.upper);\r\n }\r\n\r\n /** Returns true if the inputs represent two halves of a valid 64-bit Id.\r\n * @see [[Id64.Uint32Pair]].\r\n */\r\n export function isValidUint32Pair(lowBytes: number, highBytes: number): boolean {\r\n // Detect local ID of zero\r\n return 0 !== lowBytes || 0 !== (highBytes & 0x000000ff);\r\n }\r\n\r\n /** Represents an [[Id64]] as a pair of unsigned 32-bit integers. Because Javascript lacks efficient support for 64-bit integers,\r\n * this representation can be useful in performance-sensitive code like the render loop.\r\n * @see [[Id64.getUint32Pair]] to convert an [[Id64String]] to a Uint32Pair.\r\n * @see [[Id64.fromUint32Pair]] to convert a Uint32Pair to an [[Id64String]].\r\n * @see [[Id64.Uint32Set]] and [[Id64.Uint32Map]] for collections based on Uint32Pairs.\r\n */\r\n export interface Uint32Pair {\r\n /** The lower 4 bytes of the 64-bit integer. */\r\n lower: number;\r\n /** The upper 4 bytes of the 64-bit integer. */\r\n upper: number;\r\n }\r\n\r\n /** Convert an Id64String to a 64-bit unsigned integer represented as a pair of unsigned 32-bit integers.\r\n * @param id The well-formed string representation of a 64-bit Id.\r\n * @param out Used as the return value if supplied; otherwise a new object is returned.\r\n * @returns An object containing the parsed lower and upper 32-bit integers comprising the 64-bit Id.\r\n */\r\n export function getUint32Pair(id: Id64String, out?: Uint32Pair): Uint32Pair {\r\n if (!out)\r\n out = { lower: 0, upper: 0 };\r\n\r\n out.lower = getLowerUint32(id);\r\n out.upper = getUpperUint32(id);\r\n return out;\r\n }\r\n\r\n /** Extract an unsigned 32-bit integer from the lower 4 bytes of an Id64String. */\r\n export function getLowerUint32(id: Id64String): number {\r\n if (isInvalid(id))\r\n return 0;\r\n\r\n const end = id.length;\r\n const start = end > 10 ? end - 8 : 2;\r\n return substringToUint32(id, start, end);\r\n }\r\n\r\n /** Extract an unsigned 32-bit integer from the upper 4 bytes of an Id64String. */\r\n export function getUpperUint32(id: Id64String): number {\r\n const len = id.length;\r\n if (len <= 10 || isInvalid(id))\r\n return 0;\r\n\r\n return substringToUint32(id, 2, len - 8);\r\n }\r\n\r\n /** Convert an [[Id64Arg]] into an [[Id64Set]].\r\n *\r\n * This method can be used by functions that accept an Id64Arg to conveniently process the value(s). For example:\r\n * ```ts\r\n * public addCategories(arg: Id64Arg) { Id64.toIdSet(arg).forEach((id) => this.categories.add(id)); }\r\n * ```\r\n *\r\n * Alternatively, to avoid allocating a new Id64Set, use [[Id64.iterable]].\r\n *\r\n * @param arg The Ids to convert to an Id64Set.\r\n * @param makeCopy If true, and the input is already an Id64Set, returns a deep copy of the input.\r\n * @returns An Id64Set containing the set of [[Id64String]]s represented by the Id64Arg.\r\n */\r\n export function toIdSet(arg: Id64Arg, makeCopy: boolean = false): Id64Set {\r\n if (arg instanceof Set)\r\n return makeCopy ? new Set<string>(arg) : arg;\r\n\r\n const ids = new Set<Id64String>();\r\n if (typeof arg === \"string\")\r\n ids.add(arg);\r\n else if (Array.isArray(arg)) {\r\n arg.forEach((id: Id64String) => {\r\n if (typeof id === \"string\")\r\n ids.add(id);\r\n });\r\n }\r\n\r\n return ids;\r\n }\r\n\r\n /** Obtain iterator over the specified Ids.\r\n * @see [[Id64.iterable]].\r\n */\r\n export function* iterator(ids: Id64Arg): Iterator<Id64String> {\r\n if (typeof ids === \"string\") {\r\n yield ids;\r\n } else {\r\n for (const id of ids)\r\n yield id;\r\n }\r\n }\r\n\r\n /** Obtain an iterable over the specified Ids. Example usage:\r\n * ```ts\r\n * const ids = [\"0x123\", \"0xfed\"];\r\n * for (const id of Id64.iterable(ids))\r\n * console.log(id);\r\n * ```\r\n */\r\n export function iterable(ids: Id64Arg): Iterable<Id64String> {\r\n return {\r\n [Symbol.iterator]: () => iterator(ids),\r\n };\r\n }\r\n\r\n /** Return the first [[Id64String]] of an [[Id64Arg]]. */\r\n export function getFirst(arg: Id64Arg): Id64String {\r\n return typeof arg === \"string\" ? arg : (Array.isArray(arg) ? arg[0] : arg.values().next().value) ?? Id64.invalid;\r\n }\r\n\r\n /** Return the number of [[Id64String]]s represented by an [[Id64Arg]]. */\r\n export function sizeOf(arg: Id64Arg): number {\r\n return typeof arg === \"string\" ? 1 : (Array.isArray(arg) ? arg.length : arg.size);\r\n }\r\n\r\n /** Returns true if the [[Id64Arg]] contains the specified Id. */\r\n export function has(arg: Id64Arg, id: Id64String): boolean {\r\n if (typeof arg === \"string\")\r\n return arg === id;\r\n if (Array.isArray(arg))\r\n return -1 !== arg.indexOf(id);\r\n\r\n return arg.has(id);\r\n }\r\n\r\n /** The string representation of an invalid Id. */\r\n export const invalid = \"0\";\r\n\r\n /** Determine if the supplied id string represents a transient Id.\r\n * @param id A well-formed Id string.\r\n * @returns true if the Id represents a transient Id.\r\n * @note This method assumes the input is a well-formed Id string.\r\n * @see [[Id64.isTransientId64]]\r\n * @see [[TransientIdSequence]]\r\n */\r\n export function isTransient(id: Id64String): boolean {\r\n // A transient Id is of the format \"0xffffffxxxxxxxxxx\" where the leading 6 digits indicate an invalid briefcase Id.\r\n return 18 === id.length && id.startsWith(\"0xffffff\");\r\n }\r\n\r\n /** Determine if the input is a well-formed [[Id64String]] and represents a transient Id.\r\n * @see [[Id64.isTransient]]\r\n * @see [[Id64.isId64]]\r\n * @see [[TransientIdSequence]]\r\n */\r\n export function isTransientId64(id: string): boolean {\r\n return isValidId64(id) && isTransient(id);\r\n }\r\n\r\n /** Determine if the input is a well-formed [[Id64String]].\r\n *\r\n * For a description of \"well-formed\", see [Working with Ids]($docs/learning/common/Id64.md).\r\n * @see [[Id64.isValidId64]]\r\n */\r\n export function isId64(id: string): boolean {\r\n const len = id.length;\r\n if (0 === len || 18 < len)\r\n return false;\r\n\r\n if (\"0\" !== id[0])\r\n return false;\r\n\r\n // Well-formed invalid Id: \"0\"\r\n if (1 === len)\r\n return true;\r\n\r\n // Valid Ids begin with \"0x\" followed by at least one lower-case hexadecimal digit.\r\n if (2 === len || \"x\" !== id[1])\r\n return false;\r\n\r\n // If briefcase Id is present, it occupies at least one digit, followed by 10 digits for local Id\r\n let localIdStart = 2;\r\n if (len > 12) {\r\n localIdStart = len - 10;\r\n\r\n // Verify briefcase Id\r\n if (!isValidHexString(id, 2, localIdStart - 2))\r\n return false;\r\n\r\n // Skip leading zeroes in local Id\r\n for (let i = localIdStart; i < len; i++) {\r\n if (0x30 !== id.charCodeAt(i)) // '0'\r\n break;\r\n else\r\n localIdStart++;\r\n }\r\n\r\n if (localIdStart >= len)\r\n return false;\r\n }\r\n\r\n return isValidHexString(id, localIdStart, len - localIdStart);\r\n }\r\n\r\n /** Returns true if the input is not equal to the representation of an invalid Id.\r\n * @note This method assumes the input is a well-formed Id string.\r\n * @see [[Id64.isInvalid]]\r\n * @see [[Id64.isValidId64]]\r\n */\r\n export function isValid(id: Id64String): boolean {\r\n return Id64.invalid !== id;\r\n }\r\n\r\n /** Returns true if the input is a well-formed [[Id64String]] representing a valid Id.\r\n * @see [[Id64.isValid]]\r\n * @see [[Id64.isId64]]\r\n */\r\n export function isValidId64(id: string): boolean {\r\n return Id64.invalid !== id && Id64.isId64(id);\r\n }\r\n\r\n /** Returns true if the input is a well-formed [[Id64String]] representing an invalid Id.\r\n * @see [[Id64.isValid]]\r\n */\r\n export function isInvalid(id: Id64String): boolean {\r\n return Id64.invalid === id;\r\n }\r\n\r\n /** A specialized replacement for Set<Id64String> optimized for performance-critical code which represents large sets of [[Id64]]s as pairs of\r\n * 32-bit integers.\r\n * The internal representation is a Map<number, Set<number>> where the Map key is the upper 4 bytes of the IDs and the Set elements are the lower 4 bytes of the IDs.\r\n * Because the upper 4 bytes store the 24-bit briefcase ID plus the upper 8 bits of the local ID, there will be a very small distribution of unique Map keys.\r\n * To further optimize this data type, the following assumptions are made regarding the { lower, upper } inputs, and no validation is performed to confirm them:\r\n * - The inputs are unsigned 32-bit integers;\r\n * - The inputs represent a valid Id64String (e.g., local ID is not zero).\r\n * @see [[Id64.Uint32Map]] for a similarly-optimized replacement for Map<Id64String, T>\r\n * @public\r\n */\r\n export class Uint32Set {\r\n protected readonly _map = new Map<number, Set<number>>();\r\n\r\n /** Construct a new Uint32Set.\r\n * @param ids If supplied, all of the specified Ids will be added to the new set.\r\n */\r\n public constructor(ids?: Id64Arg) {\r\n if (undefined !== ids)\r\n this.addIds(ids);\r\n }\r\n\r\n /** Return true if `this` and `other` contain the same set of Ids. */\r\n public equals(other: Uint32Set): boolean {\r\n if (this === other) {\r\n return true;\r\n }\r\n\r\n if (this.size !== other.size) {\r\n return false;\r\n }\r\n\r\n for (const [key, thisValue] of this._map) {\r\n const otherValue = other._map.get(key);\r\n if (!otherValue || thisValue.size !== otherValue.size) {\r\n return false;\r\n }\r\n\r\n for (const value of thisValue) {\r\n if (!otherValue.has(value)) {\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /** Remove all contents of this set. */\r\n public clear(): void {\r\n this._map.clear();\r\n }\r\n\r\n /** Add an Id to the set. */\r\n public addId(id: Id64String): void {\r\n this.add(Id64.getLowerUint32(id), Id64.getUpperUint32(id));\r\n }\r\n\r\n /** Add any number of Ids to the set. */\r\n public addIds(ids: Id64Arg): void {\r\n for (const id of Id64.iterable(ids))\r\n this.addId(id);\r\n }\r\n\r\n /** Returns true if the set contains the specified Id. */\r\n public hasId(id: Id64String): boolean { return this.has(Id64.getLowerUint32(id), Id64.getUpperUint32(id)); }\r\n\r\n /** Add an Id to the set. */\r\n public add(low: number, high: number): void {\r\n let set = this._map.get(high);\r\n if (undefined === set) {\r\n set = new Set<number>();\r\n this._map.set(high, set);\r\n }\r\n\r\n set.add(low);\r\n }\r\n\r\n /** Remove an Id from the set. */\r\n public deleteId(id: Id64String): void {\r\n this.delete(Id64.getLowerUint32(id), Id64.getUpperUint32(id));\r\n }\r\n\r\n /** Remove any number of Ids from the set. */\r\n public deleteIds(ids: Id64Arg): void {\r\n for (const id of Id64.iterable(ids))\r\n this.deleteId(id);\r\n }\r\n\r\n /** Remove an Id from the set. */\r\n public delete(low: number, high: number): void {\r\n const set = this._map.get(high);\r\n if (undefined !== set)\r\n set.delete(low);\r\n }\r\n\r\n /** Returns true if the set contains the specified Id. */\r\n public has(low: number, high: number): boolean {\r\n const set = this._map.get(high);\r\n return undefined !== set && set.has(low);\r\n }\r\n\r\n /** Returns true if the set contains the Id specified by `pair`. */\r\n public hasPair(pair: Uint32Pair): boolean {\r\n return this.has(pair.lower, pair.upper);\r\n }\r\n\r\n /** Returns true if the set contains no Ids. */\r\n public get isEmpty(): boolean { return 0 === this._map.size; }\r\n\r\n /** Returns the number of Ids contained in the set. */\r\n public get size(): number {\r\n let size = 0;\r\n for (const entry of this._map)\r\n size += entry[1].size;\r\n\r\n return size;\r\n }\r\n\r\n /** Populates and returns an array of all Ids contained in the set. */\r\n public toId64Array(): Id64Array {\r\n const ids: Id64Array = [];\r\n for (const entry of this._map)\r\n for (const low of entry[1])\r\n ids.push(Id64.fromUint32Pair(low, entry[0]));\r\n\r\n return ids;\r\n }\r\n\r\n /** Populates and returns a set of all Ids contained in the set. */\r\n public toId64Set(): Id64Set {\r\n const ids = new Set<string>();\r\n for (const entry of this._map)\r\n for (const low of entry[1])\r\n ids.add(Id64.fromUint32Pair(low, entry[0]));\r\n\r\n return ids;\r\n }\r\n\r\n /** Execute a function against each Id in this set. */\r\n public forEach(func: (lo: number, hi: number) => void): void {\r\n for (const entry of this._map)\r\n for (const lo of entry[1])\r\n func(lo, entry[0]);\r\n }\r\n }\r\n\r\n /** A specialized replacement for Map<Id64String, T> optimized for performance-critical code.\r\n * @see [[Id64.Uint32Set]] for implementation details.\r\n * @public\r\n */\r\n export class Uint32Map<T> {\r\n protected readonly _map = new Map<number, Map<number, T>>();\r\n\r\n /** Remove all entries from the map. */\r\n public clear(): void { this._map.clear(); }\r\n /** Find an entry in the map by Id. */\r\n public getById(id: Id64String): T | undefined { return this.get(Id64.getLowerUint32(id), Id64.getUpperUint32(id)); }\r\n /** Set an entry in the map by Id. */\r\n public setById(id: Id64String, value: T): void { this.set(Id64.getLowerUint32(id), Id64.getUpperUint32(id), value); }\r\n\r\n /** Set an entry in the map by Id components. */\r\n public set(low: number, high: number, value: T): void {\r\n let map = this._map.get(high);\r\n if (undefined === map) {\r\n map = new Map<number, T>();\r\n this._map.set(high, map);\r\n }\r\n\r\n map.set(low, value);\r\n }\r\n\r\n /** Get an entry from the map by Id components. */\r\n public get(low: number, high: number): T | undefined {\r\n const map = this._map.get(high);\r\n return undefined !== map ? map.get(low) : undefined;\r\n }\r\n\r\n /** Returns true if the map contains no entries. */\r\n public get isEmpty(): boolean { return 0 === this._map.size; }\r\n /** Returns the number of entries in the map. */\r\n public get size(): number {\r\n let size = 0;\r\n for (const entry of this._map)\r\n size += entry[1].size;\r\n\r\n return size;\r\n }\r\n\r\n /** Execute a function against each entry in this map. */\r\n public forEach(func: (lo: number, hi: number, value: T) => void): void {\r\n for (const outerEntry of this._map)\r\n for (const innerEntry of outerEntry[1])\r\n func(innerEntry[0], outerEntry[0], innerEntry[1]);\r\n }\r\n }\r\n}\r\n\r\n/** JSON representation of a [[TransientIdSequence]], primarily useful for transferring sequences to and from a [Worker](https://developer.mozilla.org/en-US/docs/Web/API/Worker).\r\n * It stores two \"local\" 40-bit Ids describing the range of [Id64String]($docs/learning/common/Id64.md)s generated by the sequence.\r\n * @public\r\n */\r\nexport interface TransientIdSequenceProps {\r\n /** The starting local Id. The sequence begins at `initialLocalId + 1`. */\r\n initialLocalId: number;\r\n /** The maximum local Id generated by the sequence thus far. It is never less than [[initialLocalId]]. If it is equal to [[initialLocalId]], then the sequence has\r\n * not yet generated any Ids.\r\n * The next local Id generated by the sequence will be `currentLocalId + 1`.\r\n */\r\n currentLocalId: number;\r\n}\r\n\r\nfunction validateLocalId(num: number): void {\r\n if (num < 0 || Math.round(num) !== num) {\r\n throw new Error(\"Local Id must be a non-negative integer\");\r\n }\r\n}\r\n\r\n/** A function returned by [[TransientIdSequence.merge]] that remaps the local Id portion of an [Id64String]($docs/learning/common/Id64.md) generated by\r\n * the source sequence to the corresponding local Id in the target sequence.\r\n * It returns `sourceLocalId` if the input did not originate from the source sequence.\r\n* @public\r\n*/\r\nexport type RemapTransientLocalId = (sourceLocalId: number) => number;\r\n\r\n/**\r\n * Generates unique [[Id64String]] values in sequence, which are guaranteed not to conflict with Ids associated with persistent elements or models.\r\n * This is useful for associating stable, non-persistent identifiers with things like [Decorator]($frontend)s.\r\n * A TransientIdSequence can generate a maximum of (2^40)-2 unique Ids.\r\n * @public\r\n */\r\nexport class TransientIdSequence {\r\n /** The starting local Id provided to the constructor. The sequence begins at `initialLocalId + 1`. */\r\n public readonly initialLocalId: number;\r\n private _localId: number;\r\n\r\n /** Constructor.\r\n * @param initialLocalId The starting local Id. The local Id of the first [[Id64String]] generated by [[getNext]] will be `initialLocalId + 1`.\r\n */\r\n public constructor(initialLocalId = 0) {\r\n validateLocalId(initialLocalId);\r\n this.initialLocalId = initialLocalId;\r\n this._localId = initialLocalId;\r\n }\r\n\r\n /** The maximum local Id generated by the sequence thus far. It is never less than [[initialLocalId]]. If it is equal to [[initialLocalId]], then the sequence has\r\n * not yet generated any Ids.\r\n * Each call to [[getNext]] increments this by 1 and uses it as the local Id of the generated [[Id64String]].\r\n */\r\n public get currentLocalId(): number {\r\n return this._localId;\r\n }\r\n\r\n /** Generate and return the next transient Id64String in the sequence.\r\n * @deprecated in 3.x. Use [[getNext]].\r\n */\r\n public get next(): Id64String {\r\n return this.getNext();\r\n }\r\n\r\n /** Generate and return the next transient Id64String in the sequence. */\r\n public getNext(): Id64String {\r\n return Id64.fromLocalAndBriefcaseIds(++this._localId, 0xffffff);\r\n }\r\n\r\n /** Preview the transient Id64String that will be returned by the next call to [[getNext]].\r\n * This is primarily useful for tests.\r\n */\r\n public peekNext(): Id64String {\r\n return Id64.fromLocalAndBriefcaseIds(this._localId + 1, 0xffffff);\r\n }\r\n\r\n /** Convert this sequence to its JSON representation. */\r\n public toJSON(): TransientIdSequenceProps {\r\n return {\r\n initialLocalId: this.initialLocalId,\r\n currentLocalId: this.currentLocalId,\r\n };\r\n }\r\n\r\n /** Create a sequence from its JSON representation. */\r\n public static fromJSON(props: TransientIdSequenceProps): TransientIdSequence {\r\n validateLocalId(props.currentLocalId);\r\n const sequence = new TransientIdSequence(props.initialLocalId);\r\n sequence._localId = props.currentLocalId;\r\n return sequence;\r\n }\r\n\r\n /** Obtain the JSON representation of a new sequence that diverges from this sequence, with its [[initialLocalId]] set to this sequence's [[currentLocalId]].\r\n * The two sequences can generate Ids independently. Later, you can [[merge]] the sequences, resolving conflicts where the two sequences generated identical Ids.\r\n * This is chiefly useful when generating transient Ids on a [Worker](https://developer.mozilla.org/en-US/docs/Web/API/Worker).\r\n */\r\n public fork(): TransientIdSequenceProps {\r\n return {\r\n initialLocalId: this.currentLocalId,\r\n currentLocalId: this.currentLocalId,\r\n };\r\n }\r\n\r\n /** Integrate the Ids generated by a [[fork]] of this sequence. All of the Ids generated by `source` will be remapped to Ids at the end of this sequence.\r\n * This is chiefly useful when generating transient Ids on a [Worker](https://developer.mozilla.org/en-US/docs/Web/API/Worker).\r\n * @param source The JSON representation of the [[fork]]ed sequence to be merged with this one.\r\n * @returns a function that permits you to remap the local Ids generated by `source` into the corresponding local Ids assigned by this sequence.\r\n * @throws Error if `source` is not a fork of this sequence or is malformed (e.g., contains negative and/or non-integer local Ids).\r\n */\r\n public merge(source: TransientIdSequenceProps): (sourceLocalId: number) => number {\r\n const { initialLocalId, currentLocalId } = source;\r\n\r\n validateLocalId(initialLocalId);\r\n validateLocalId(currentLocalId);\r\n\r\n if (initialLocalId > this.currentLocalId) {\r\n throw new Error(\"Transient Id sequences do not intersect\");\r\n }\r\n\r\n if (initialLocalId > currentLocalId) {\r\n throw new Error(\"Current local Id cannot be less than initial local Id\");\r\n }\r\n\r\n const delta = this.currentLocalId - initialLocalId;\r\n this._localId += currentLocalId - initialLocalId;\r\n\r\n return (sourceLocalId: number) => {\r\n if (sourceLocalId > initialLocalId && sourceLocalId <= currentLocalId) {\r\n return sourceLocalId + delta;\r\n }\r\n\r\n return sourceLocalId;\r\n };\r\n }\r\n}\r\n\r\n/**\r\n * The Guid namespace provides facilities for working with GUID strings using the \"8-4-4-4-12\" pattern.\r\n *\r\n * The [[GuidString]] type alias is used to indicate function arguments, return types, and variables which are known to\r\n * be in the GUID format.\r\n * @public\r\n */\r\nexport namespace Guid {\r\n const uuidPattern = new RegExp(\"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$\");\r\n\r\n /** Represents the empty Guid 00000000-0000-0000-0000-000000000000 */\r\n export const empty: GuidString = \"00000000-0000-0000-0000-000000000000\";\r\n\r\n /** Determine whether the input string is \"guid-like\". That is, it follows the 8-4-4-4-12 pattern. This does not enforce\r\n * that the string is actually in valid UUID format.\r\n */\r\n export function isGuid(value: string): boolean {\r\n return uuidPattern.test(value);\r\n }\r\n\r\n /** Determine whether the input string is a valid V4 Guid string */\r\n export function isV4Guid(value: string): boolean {\r\n return /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/.test(value);\r\n }\r\n\r\n /** Create a new V4 Guid value */\r\n export function createValue(): GuidString {\r\n // https://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript\r\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, (c) => {\r\n const r = Math.random() * 16 | 0;\r\n const v = c === \"x\" ? r : (r & 0x3 | 0x8);\r\n return v.toString(16);\r\n });\r\n }\r\n\r\n /**\r\n * Normalize a Guid string if possible. Normalization consists of:\r\n * - Convert all characters to lower case\r\n * - Trim any leading or trailing whitespace\r\n * - Convert to the standard Guid format \"8-4-4-4-12\", repositioning the '-' characters as necessary, presuming there are exactly 32 hexadecimal digits.\r\n * @param value Input value that represents a Guid\r\n * @returns Normalized representation of the Guid string. If the normalization fails, return the *original* value unmodified (Note: it is *not* a valid Guid)\r\n */\r\n export function normalize(value: GuidString): GuidString {\r\n const lowerValue = value.toLowerCase().trim();\r\n\r\n // Return if it's already formatted to be a Guid\r\n if (isGuid(lowerValue))\r\n return lowerValue;\r\n\r\n // Remove any existing \"-\" characters and position them properly, if there remains exactly 32 hexadecimal digits\r\n const noDashValue = lowerValue.replace(/-/g, \"\");\r\n const noDashPattern = /^([0-9a-f]{8})([0-9a-f]{4})([0-9a-f]{4})([0-9a-f]{4})([0-9a-f]{12})$/;\r\n if (noDashPattern.test(noDashValue)) {\r\n return noDashValue.replace(noDashPattern,\r\n (_match: string, p1: string, p2: string, p3: string, p4: string, p5: string) =>\r\n `${p1}-${p2}-${p3}-${p4}-${p5}`);\r\n }\r\n\r\n // Return unmodified string - (note: it is *not* a valid Guid)\r\n return value;\r\n }\r\n}\r\n"]}
@@ -69,7 +69,7 @@ export declare namespace JsonUtils {
69
69
  * @param value The value to test.
70
70
  * @returns true if `value` is an Object with at least one key.
71
71
  */
72
- function isNonEmptyObject(value: any): value is Object;
72
+ function isNonEmptyObject(value: any): value is object;
73
73
  /**
74
74
  * Convert the input object into a "pure" JavaScript object, with only instances of "object" or primitives in the returned value.
75
75
  * Works recursively for object members, and over arrays entries. Calls "toJSON" on any members that implement it.
@@ -1 +1 @@
1
- {"version":3,"file":"JsonUtils.js","sourceRoot":"","sources":["../../src/JsonUtils.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;GAEG;AACH,IAAiB,SAAS,CA2IzB;AA3ID,WAAiB,SAAS;IACxB;;;;OAIG;IACH,SAAgB,MAAM,CAAC,IAAS,EAAE,UAAU,GAAG,KAAK;QAClD,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACvD,CAAC;IAFe,gBAAM,SAErB,CAAA;IACD;;;;OAIG;IACH,SAAgB,KAAK,CAAC,IAAS,EAAE,UAAU,GAAG,CAAC;QAC7C,OAAO,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;IACpE,CAAC;IAFe,eAAK,QAEpB,CAAA;IACD;;;;OAIG;IACH,SAAgB,QAAQ,CAAC,IAAS,EAAE,UAAU,GAAG,CAAC;QAChD,OAAO,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC;IACxD,CAAC;IAFe,kBAAQ,WAEvB,CAAA;IACD;;;;OAIG;IACH,SAAgB,QAAQ,CAAC,IAAS,EAAE,UAAU,GAAG,EAAE;QACjD,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,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Y,CAAC;QAC7B,CAAC,CAAC,CAAC;QAEH,OAAO,GAAG,CAAC;IACb,CAAC;IA3Be,kBAAQ,WA2BvB,CAAA;AAEH,CAAC,EA3IgB,SAAS,yBAAT,SAAS,QA2IzB","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Json\r\n */\r\n\r\n/** Utility functions for converting from JSON objects, with default values.\r\n * @public\r\n */\r\nexport namespace JsonUtils {\r\n /** Get a value as a boolean.\r\n * @param json the input JSON object\r\n * @param defaultVal default value if json cannot be converted to boolean\r\n * @returns the value of json as a boolean, or default value\r\n */\r\n export function asBool(json: any, defaultVal = false): boolean {\r\n return isNullOrUndefined(json) ? defaultVal : !!json;\r\n }\r\n /** Get a value as an integer.\r\n * @param json the input JSON object\r\n * @param defaultVal default value if json cannot be converted to integer\r\n * @returns the value of json as an integer, or default value\r\n */\r\n export function asInt(json: any, defaultVal = 0): number {\r\n return (typeof json === \"number\") ? Math.trunc(json) : defaultVal;\r\n }\r\n /** Get a value as a double.\r\n * @param json the input JSON object\r\n * @param defaultVal default value if json cannot be converted to double\r\n * @returns the value of json as a double, or default value\r\n */\r\n export function asDouble(json: any, defaultVal = 0): number {\r\n return (typeof json === \"number\") ? json : defaultVal;\r\n }\r\n /** Get a value as a string.\r\n * @param json the input JSON object\r\n * @param defaultVal default value if json cannot be converted to string\r\n * @returns the value of json as a string, or default value\r\n */\r\n export function asString(json: any, defaultVal = \"\"): string {\r\n return isNullOrUndefined(json) ? defaultVal : json.toString();\r\n }\r\n\r\n /** Get a value as an array.\r\n * @param json the input JSON object\r\n * @returns the input JSON object if it is an array, otherwise undefined\r\n */\r\n export function asArray(json: any): any {\r\n return Array.isArray(json) ? json : undefined;\r\n }\r\n\r\n /** Get a value as an object.\r\n * @param json the input JSON object\r\n * @returns the input JSON object if it is an object, otherwise undefined\r\n */\r\n export function asObject(json: any): any {\r\n return \"object\" === typeof json ? json : undefined;\r\n }\r\n\r\n /** Set or remove a number on a json object, given a key name, a value, and a default value. Sets `json[key] = val` if val is *not* equal to the default,\r\n * otherwise `delete json[key]`. This is used to omit values from JSON strings that are of known defaults.\r\n * @param json the JSON object to affect\r\n * @param key the name of the member to set or remove\r\n * @param val the value to set\r\n * @param defaultVal the default value.\r\n */\r\n export function setOrRemoveNumber(json: any, key: string, val: number, defaultVal: number) {\r\n if (val === defaultVal)\r\n delete json[key];\r\n else\r\n json[key] = val;\r\n }\r\n\r\n /** Set or remove a boolean on a json object, given a key name, a value, and a default value. Sets `json[key] = val` if val is *not* equal to the default,\r\n * otherwise `delete json[key]`. This is used to omit values from JSON strings that are of known defaults.\r\n * @param json the JSON object to affect\r\n * @param key the name of the member to set or remove\r\n * @param val the value to set\r\n * @param defaultVal the default value.\r\n */\r\n export function setOrRemoveBoolean(json: any, key: string, val: boolean, defaultVal: boolean) {\r\n if (val === defaultVal)\r\n delete json[key];\r\n else\r\n json[key] = val;\r\n }\r\n\r\n /** Determine if a Javascript object is equivalent to `{}`.\r\n * @param json The JSON object to test.\r\n * @returns true if `json` is an Object with no keys.\r\n */\r\n export function isEmptyObject(json: any): boolean {\r\n return \"object\" === typeof json && 0 === Object.keys(json).length;\r\n }\r\n\r\n /** Determine if the input is undefined or an empty Javascript object.\r\n * @param json The JSON object to test.\r\n * @returns true if `json` is undefined or is an Object with no keys (equivalent to `{}`).\r\n */\r\n export function isEmptyObjectOrUndefined(json: any): boolean {\r\n return undefined === json || isEmptyObject(json);\r\n }\r\n\r\n function isNullOrUndefined(json: any): boolean {\r\n return null === json || undefined === json;\r\n }\r\n\r\n /** Determine if the input is a non-empty Javascript object.\r\n * @param value The value to test.\r\n * @returns true if `value` is an Object with at least one key.\r\n */\r\n export function isNonEmptyObject(value: any): value is Object {\r\n return !isEmptyObjectOrUndefined(value);\r\n }\r\n\r\n /**\r\n * Convert the input object into a \"pure\" JavaScript object, with only instances of \"object\" or primitives in the returned value.\r\n * Works recursively for object members, and over arrays entries. Calls \"toJSON\" on any members that implement it.\r\n */\r\n export function toObject(val: any): any {\r\n if (typeof val === \"boolean\" || typeof val === \"number\" || typeof val === \"string\")\r\n return val;\r\n\r\n if (typeof val !== \"object\")\r\n return undefined;\r\n\r\n // See if the object has toJSON() function defined.\r\n if (typeof val.toJSON !== \"undefined\")\r\n return toObject(val.toJSON());\r\n\r\n // if it's an array, convert each member.\r\n if (Array.isArray(val)) {\r\n const arr = new Array(val.length);\r\n val.forEach((el, i) => arr[i] = toObject(el));\r\n return arr;\r\n }\r\n\r\n // Convert each property\r\n const out: any = {};\r\n Object.getOwnPropertyNames(val).forEach((prop) => {\r\n const transformVal = toObject(val[prop]);\r\n if (transformVal !== undefined)\r\n out[prop] = transformVal;\r\n });\r\n\r\n return out;\r\n }\r\n\r\n}\r\n"]}
1
+ {"version":3,"file":"JsonUtils.js","sourceRoot":"","sources":["../../src/JsonUtils.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;GAEG;AACH,IAAiB,SAAS,CA2IzB;AA3ID,WAAiB,SAAS;IACxB;;;;OAIG;IACH,SAAgB,MAAM,CAAC,IAAS,EAAE,UAAU,GAAG,KAAK;QAClD,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACvD,CAAC;IAFe,gBAAM,SAErB,CAAA;IACD;;;;OAIG;IACH,SAAgB,KAAK,CAAC,IAAS,EAAE,UAAU,GAAG,CAAC;QAC7C,OAAO,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;IACpE,CAAC;IAFe,eAAK,QAEpB,CAAA;IACD;;;;OAIG;IACH,SAAgB,QAAQ,CA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C,EAAE,CAAC,CAAC,CAAC;YAC9C,OAAO,GAAG,CAAC;QACb,CAAC;QAED,wBAAwB;QACxB,MAAM,GAAG,GAAQ,EAAE,CAAC;QACpB,MAAM,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YAC/C,MAAM,YAAY,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;YACzC,IAAI,YAAY,KAAK,SAAS;gBAC5B,GAAG,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC;QAC7B,CAAC,CAAC,CAAC;QAEH,OAAO,GAAG,CAAC;IACb,CAAC;IA3Be,kBAAQ,WA2BvB,CAAA;AAEH,CAAC,EA3IgB,SAAS,yBAAT,SAAS,QA2IzB","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Json\r\n */\r\n\r\n/** Utility functions for converting from JSON objects, with default values.\r\n * @public\r\n */\r\nexport namespace JsonUtils {\r\n /** Get a value as a boolean.\r\n * @param json the input JSON object\r\n * @param defaultVal default value if json cannot be converted to boolean\r\n * @returns the value of json as a boolean, or default value\r\n */\r\n export function asBool(json: any, defaultVal = false): boolean {\r\n return isNullOrUndefined(json) ? defaultVal : !!json;\r\n }\r\n /** Get a value as an integer.\r\n * @param json the input JSON object\r\n * @param defaultVal default value if json cannot be converted to integer\r\n * @returns the value of json as an integer, or default value\r\n */\r\n export function asInt(json: any, defaultVal = 0): number {\r\n return (typeof json === \"number\") ? Math.trunc(json) : defaultVal;\r\n }\r\n /** Get a value as a double.\r\n * @param json the input JSON object\r\n * @param defaultVal default value if json cannot be converted to double\r\n * @returns the value of json as a double, or default value\r\n */\r\n export function asDouble(json: any, defaultVal = 0): number {\r\n return (typeof json === \"number\") ? json : defaultVal;\r\n }\r\n /** Get a value as a string.\r\n * @param json the input JSON object\r\n * @param defaultVal default value if json cannot be converted to string\r\n * @returns the value of json as a string, or default value\r\n */\r\n export function asString(json: any, defaultVal = \"\"): string {\r\n return isNullOrUndefined(json) ? defaultVal : json.toString();\r\n }\r\n\r\n /** Get a value as an array.\r\n * @param json the input JSON object\r\n * @returns the input JSON object if it is an array, otherwise undefined\r\n */\r\n export function asArray(json: any): any {\r\n return Array.isArray(json) ? json : undefined;\r\n }\r\n\r\n /** Get a value as an object.\r\n * @param json the input JSON object\r\n * @returns the input JSON object if it is an object, otherwise undefined\r\n */\r\n export function asObject(json: any): any {\r\n return \"object\" === typeof json ? json : undefined;\r\n }\r\n\r\n /** Set or remove a number on a json object, given a key name, a value, and a default value. Sets `json[key] = val` if val is *not* equal to the default,\r\n * otherwise `delete json[key]`. This is used to omit values from JSON strings that are of known defaults.\r\n * @param json the JSON object to affect\r\n * @param key the name of the member to set or remove\r\n * @param val the value to set\r\n * @param defaultVal the default value.\r\n */\r\n export function setOrRemoveNumber(json: any, key: string, val: number, defaultVal: number) {\r\n if (val === defaultVal)\r\n delete json[key];\r\n else\r\n json[key] = val;\r\n }\r\n\r\n /** Set or remove a boolean on a json object, given a key name, a value, and a default value. Sets `json[key] = val` if val is *not* equal to the default,\r\n * otherwise `delete json[key]`. This is used to omit values from JSON strings that are of known defaults.\r\n * @param json the JSON object to affect\r\n * @param key the name of the member to set or remove\r\n * @param val the value to set\r\n * @param defaultVal the default value.\r\n */\r\n export function setOrRemoveBoolean(json: any, key: string, val: boolean, defaultVal: boolean) {\r\n if (val === defaultVal)\r\n delete json[key];\r\n else\r\n json[key] = val;\r\n }\r\n\r\n /** Determine if a Javascript object is equivalent to `{}`.\r\n * @param json The JSON object to test.\r\n * @returns true if `json` is an Object with no keys.\r\n */\r\n export function isEmptyObject(json: any): boolean {\r\n return \"object\" === typeof json && 0 === Object.keys(json).length;\r\n }\r\n\r\n /** Determine if the input is undefined or an empty Javascript object.\r\n * @param json The JSON object to test.\r\n * @returns true if `json` is undefined or is an Object with no keys (equivalent to `{}`).\r\n */\r\n export function isEmptyObjectOrUndefined(json: any): boolean {\r\n return undefined === json || isEmptyObject(json);\r\n }\r\n\r\n function isNullOrUndefined(json: any): boolean {\r\n return null === json || undefined === json;\r\n }\r\n\r\n /** Determine if the input is a non-empty Javascript object.\r\n * @param value The value to test.\r\n * @returns true if `value` is an Object with at least one key.\r\n */\r\n export function isNonEmptyObject(value: any): value is object {\r\n return !isEmptyObjectOrUndefined(value);\r\n }\r\n\r\n /**\r\n * Convert the input object into a \"pure\" JavaScript object, with only instances of \"object\" or primitives in the returned value.\r\n * Works recursively for object members, and over arrays entries. Calls \"toJSON\" on any members that implement it.\r\n */\r\n export function toObject(val: any): any {\r\n if (typeof val === \"boolean\" || typeof val === \"number\" || typeof val === \"string\")\r\n return val;\r\n\r\n if (typeof val !== \"object\")\r\n return undefined;\r\n\r\n // See if the object has toJSON() function defined.\r\n if (typeof val.toJSON !== \"undefined\")\r\n return toObject(val.toJSON());\r\n\r\n // if it's an array, convert each member.\r\n if (Array.isArray(val)) {\r\n const arr = new Array(val.length);\r\n val.forEach((el, i) => arr[i] = toObject(el));\r\n return arr;\r\n }\r\n\r\n // Convert each property\r\n const out: any = {};\r\n Object.getOwnPropertyNames(val).forEach((prop) => {\r\n const transformVal = toObject(val[prop]);\r\n if (transformVal !== undefined)\r\n out[prop] = transformVal;\r\n });\r\n\r\n return out;\r\n }\r\n\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ObservableSet.js","sourceRoot":"","sources":["../../src/ObservableSet.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,uCAAoC;AAEpC;;GAEG;AACH,MAAa,aAAiB,SAAQ,GAAM;IAQ1C;;OAEG;IACH,YAAmB,QAAkC;QACnD,4EAA4E;QAC5E,KAAK,CAAC,QAAQ,CAAC,CAAC;QAZlB,iDAAiD;QACjC,YAAO,GAAG,IAAI,iBAAO,EAAqB,CAAC;QAC3D,qDAAqD;QACrC,cAAS,GAAG,IAAI,iBAAO,EAAqB,CAAC;QAC7D,qDAAqD;QACrC,cAAS,GAAG,IAAI,iBAAO,EAAc,CAAC;QASpD,IAAI,CAAC,GAAG,GAAG,CAAC,IAAO,EAAE,EAAE;YACrB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC;YAC3B,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC5B,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ;gBACxB,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAEhC,OAAO,GAAG,CAAC;QACb,CAAC,CAAC;IACJ,CAAC;IAED;;OAEG;IACa,MAAM,CAAC,IAAO;QAC5B,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC/B,IAAI,GAAG;YACL,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAElC,OAAO,GAAG,CAAC;IACb,CAAC;IAED;;OAEG;IACa,KAAK;QACnB,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;YACpB,KAAK,CAAC,KAAK,EAAE,CAAC;YACd,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;QAC9B,CAAC;IACH,CAAC;CACF;AA7CD,sCA6CC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Collections\r\n */\r\n\r\nimport { BeEvent } from \"./BeEvent\";\r\n\r\n/** A standard [Set<T>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) that emits events when its contents change.\r\n * @public\r\n */\r\nexport class ObservableSet<T> extends Set<T> {\r\n /** Emitted after `item` is added to this set. */\r\n public readonly onAdded = new BeEvent<(item: T) => void>();\r\n /** Emitted after `item` is deleted from this set. */\r\n public readonly onDeleted = new BeEvent<(item: T) => void>();\r\n /** Emitted after this set's contents are cleared. */\r\n public readonly onCleared = new BeEvent<() => void>();\r\n\r\n /** Construct a new ObservableSet.\r\n * @param elements Optional elements with which to populate the new set.\r\n */\r\n public constructor(elements?: Iterable<T> | undefined) {\r\n // NB: Set constructor will invoke add(). Do not override until initialized.\r\n super(elements);\r\n\r\n this.add = (item: T) => { // eslint-disable-line @typescript-eslint/unbound-method\r\n const prevSize = this.size;\r\n const ret = super.add(item);\r\n if (this.size !== prevSize)\r\n this.onAdded.raiseEvent(item);\r\n\r\n return ret;\r\n };\r\n }\r\n\r\n /** Invokes [Set.delete](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/delete), raising\r\n * the [[onDeleted]] event if the item was removed from the set.\r\n */\r\n public override delete(item: T): boolean {\r\n const ret = super.delete(item);\r\n if (ret)\r\n this.onDeleted.raiseEvent(item);\r\n\r\n return ret;\r\n }\r\n\r\n /** If this set is not already empty, invokes [Set.clear](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/clear)\r\n * and raises the [[onCleared]] event.\r\n */\r\n public override clear(): void {\r\n if (0 !== this.size) {\r\n super.clear();\r\n this.onCleared.raiseEvent();\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ObservableSet.js","sourceRoot":"","sources":["../../src/ObservableSet.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,uCAAoC;AAEpC;;GAEG;AACH,MAAa,aAAiB,SAAQ,GAAM;IAQ1C;;OAEG;IACH,YAAmB,QAAkC;QACnD,4EAA4E;QAC5E,KAAK,CAAC,QAAQ,CAAC,CAAC;QAZlB,iDAAiD;QACjC,YAAO,GAAG,IAAI,iBAAO,EAAqB,CAAC;QAC3D,qDAAqD;QACrC,cAAS,GAAG,IAAI,iBAAO,EAAqB,CAAC;QAC7D,qDAAqD;QACrC,cAAS,GAAG,IAAI,iBAAO,EAAc,CAAC;QASpD,IAAI,CAAC,GAAG,GAAG,CAAC,IAAO,EAAE,EAAE;YACrB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC;YAC3B,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC5B,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ;gBACxB,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAEhC,OAAO,GAAG,CAAC;QACb,CAAC,CAAC;IACJ,CAAC;IAED;;OAEG;IACa,MAAM,CAAC,IAAO;QAC5B,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC/B,IAAI,GAAG;YACL,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAElC,OAAO,GAAG,CAAC;IACb,CAAC;IAED;;OAEG;IACa,KAAK;QACnB,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;YACpB,KAAK,CAAC,KAAK,EAAE,CAAC;YACd,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;QAC9B,CAAC;IACH,CAAC;CACF;AA7CD,sCA6CC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Collections\r\n */\r\n\r\nimport { BeEvent } from \"./BeEvent\";\r\n\r\n/** A standard [Set<T>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) that emits events when its contents change.\r\n * @public\r\n */\r\nexport class ObservableSet<T> extends Set<T> {\r\n /** Emitted after `item` is added to this set. */\r\n public readonly onAdded = new BeEvent<(item: T) => void>();\r\n /** Emitted after `item` is deleted from this set. */\r\n public readonly onDeleted = new BeEvent<(item: T) => void>();\r\n /** Emitted after this set's contents are cleared. */\r\n public readonly onCleared = new BeEvent<() => void>();\r\n\r\n /** Construct a new ObservableSet.\r\n * @param elements Optional elements with which to populate the new set.\r\n */\r\n public constructor(elements?: Iterable<T> | undefined) {\r\n // NB: Set constructor will invoke add(). Do not override until initialized.\r\n super(elements);\r\n\r\n this.add = (item: T) => {\r\n const prevSize = this.size;\r\n const ret = super.add(item);\r\n if (this.size !== prevSize)\r\n this.onAdded.raiseEvent(item);\r\n\r\n return ret;\r\n };\r\n }\r\n\r\n /** Invokes [Set.delete](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/delete), raising\r\n * the [[onDeleted]] event if the item was removed from the set.\r\n */\r\n public override delete(item: T): boolean {\r\n const ret = super.delete(item);\r\n if (ret)\r\n this.onDeleted.raiseEvent(item);\r\n\r\n return ret;\r\n }\r\n\r\n /** If this set is not already empty, invokes [Set.clear](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/clear)\r\n * and raises the [[onCleared]] event.\r\n */\r\n public override clear(): void {\r\n if (0 !== this.size) {\r\n super.clear();\r\n this.onCleared.raiseEvent();\r\n }\r\n }\r\n}\r\n"]}
@@ -28,7 +28,7 @@ class ProcessDetector {
28
28
  * @note This method will return `true` for any frontend running on an iPad, whether it is a user-launched web browser (e.g. Safari) or the frontend of a mobile app.
29
29
  */
30
30
  static get isIPadBrowser() {
31
- return this.isBrowserProcess && window.navigator.platform === "iPad" || (window.navigator.platform === "MacIntel" && window.navigator.maxTouchPoints > 0 && !("MSStream" in window)); /* eslint-disable-line deprecation/deprecation */
31
+ return this.isBrowserProcess && window.navigator.platform === "iPad" || (window.navigator.platform === "MacIntel" && window.navigator.maxTouchPoints > 0 && !("MSStream" in window)); /* eslint-disable-line @typescript-eslint/no-deprecated */
32
32
  }
33
33
  /** Is this process running in a browser on an iPhone?
34
34
  * @note This method will return `true` for any frontend running on an iPhone, whether it is a user-launched web browser (e.g. Safari) or the frontend of a mobile app.
@@ -1 +1 @@
1
- {"version":3,"file":"ProcessDetector.js","sourceRoot":"","sources":["../../src/ProcessDetector.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;GAEG;AACH,MAAa,eAAe;IAE1B;;OAEG;IACI,MAAM,KAAK,gBAAgB,KAAK,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI,OAAO,MAAM,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC;IAEnH;;MAEE;IACK,MAAM,KAAK,aAAa,KAAK,OAAO,OAAO,OAAO,KAAK,QAAQ,IAAI,SAAS,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IAE3G,uDAAuD;IAChD,MAAM,KAAK,qBAAqB,KAAK,OAAO,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAEjJ,sDAAsD;IAC/C,MAAM,KAAK,oBAAoB,KAAK,OAAO,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAE/H;;OAEG;IACI,MAAM,KAAK,aAAa;QAC7B,OAAO,IAAI,CAAC,gBAAgB,IAAI,MAAM,CAAC,SAAS,CAAC,QAAQ,KAAK,MAAM,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,KAAK,UAAU,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,GAAG,CAAC,IAAI,CAAC,CAAC,UAAU,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,iDAAiD;IACzO,CAAC;IAED;;OAEG;IACI,MAAM,KAAK,eAAe,KAAK,OAAO,IAAI,CAAC,gBAAgB,IAAI,CAAC,gBAAgB,CAAC,IAAI,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E;IACzD,MAAM,KAAK,eAAe,KAAK,OAAO,IAAI,CAAC,aAAa,IAAK,OAAO,CAAC,QAAgB,KAAK,KAAK,CAAC,CAAC,CAAC;IAEzG,oEAAoE;IAC7D,MAAM,KAAK,mBAAmB,KAAK,OAAO,IAAI,CAAC,aAAa,IAAK,OAAO,CAAC,QAAgB,KAAK,SAAS,CAAC,CAAC,CAAC;IAEjH,6CAA6C;IACtC,MAAM,KAAK,kBAAkB,KAAK,OAAO,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAEnG,yEAAyE;IAClE,MAAM,KAAK,mBAAmB,KAAK,OAAO,IAAI,CAAC,qBAAqB,IAAI,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC;CAC3G;AAzED,0CAyEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module ProcessDetector\r\n */\r\n\r\n/** Functions to determine the type of JavaScript process currently executing.\r\n * @public\r\n */\r\nexport class ProcessDetector {\r\n\r\n /** Is this a browser process?\r\n * @note this method will also return `true` for the frontend of Electron or Mobile apps. They *are* browser processes.\r\n */\r\n public static get isBrowserProcess() { return typeof window === \"object\" && typeof window.navigator === \"object\"; }\r\n\r\n /** Is this a Node process?\r\n * @note this means \"is this a backend process\"? It will return `true` for all backend process, including Electron and mobile apps.\r\n */\r\n public static get isNodeProcess() { return typeof process === \"object\" && undefined !== process.platform; }\r\n\r\n /** Is this process the frontend of an Electron app? */\r\n public static get isElectronAppFrontend() { return typeof navigator === \"object\" && navigator.userAgent.toLowerCase().indexOf(\"electron\") >= 0; }\r\n\r\n /** Is this process the backend of an Electron app? */\r\n public static get isElectronAppBackend() { return typeof process === \"object\" && process.versions.hasOwnProperty(\"electron\"); }\r\n\r\n /** Is this process running in a browser on an iPad?\r\n * @note This method will return `true` for any frontend running on an iPad, whether it is a user-launched web browser (e.g. Safari) or the frontend of a mobile app.\r\n */\r\n public static get isIPadBrowser() {\r\n return this.isBrowserProcess && window.navigator.platform === \"iPad\" || (window.navigator.platform === \"MacIntel\" && window.navigator.maxTouchPoints > 0 && !(\"MSStream\" in window)); /* eslint-disable-line deprecation/deprecation */\r\n }\r\n\r\n /** Is this process running in a browser on an iPhone?\r\n * @note This method will return `true` for any frontend running on an iPhone, whether it is a user-launched web browser (e.g. Safari) or the frontend of a mobile app.\r\n */\r\n public static get isIPhoneBrowser() { return this.isBrowserProcess && (/(iphone|ipod)/i.test(window.navigator.userAgent)); }\r\n\r\n /** Is this process running in a browser on an iOS device?\r\n * @note This method will return `true` for any frontend running on an iOS device, whether it is a user-launched web browser (e.g. Safari) or the frontend of a mobile app.\r\n */\r\n public static get isIOSBrowser() { return this.isIPadBrowser || this.isIPhoneBrowser; }\r\n\r\n /** Is this process running in a browser on an Android device?\r\n * @note This method will return `true` for any frontend running on an Android device, whether it is a user-launched web browser (e.g. Chrome) or the frontend of a mobile app.\r\n */\r\n public static get isAndroidBrowser() { return this.isBrowserProcess && /android/i.test(window.navigator.userAgent); }\r\n\r\n /** Is this process running in a browser on a mobile device?\r\n * @note This method will return `true` for any frontend running on a mobile device, whether it is a user-launched web browser or the frontend of a mobile app.\r\n */\r\n public static get isMobileBrowser() { return this.isIOSBrowser || this.isAndroidBrowser; }\r\n\r\n /** Is this process running in a Chromium based browser (Chrome / new Edge / Electron front end)? */\r\n public static get isChromium() {\r\n return (this.isBrowserProcess && window.navigator.userAgent.indexOf(\"Chrome\") > -1 && window.navigator.userAgent.indexOf(\"OP\") === -1) || this.isElectronAppFrontend;\r\n }\r\n\r\n /** Is this process the frontend of an iTwin mobile application?\r\n * @note this indicates that this is a browser process started by an iTwin mobile application.\r\n * It will return `false` when running user-launched web browsers on a mobile device.\r\n */\r\n public static get isMobileAppFrontend() { return this.isAndroidAppFrontend || this.isIOSAppFrontend; }\r\n\r\n /** Is this process the frontend of an iOS mobile application? */\r\n public static get isIOSAppFrontend() { return this.isBrowserProcess && window.location.hash.indexOf(\"platform=ios\") !== -1; }\r\n\r\n /** Is this process the frontend of an Android mobile application? */\r\n public static get isAndroidAppFrontend() { return this.isBrowserProcess && window.location.hash.indexOf(\"platform=android\") !== -1; }\r\n\r\n /** Is this process the backend of an iOS mobile application? */\r\n public static get isIOSAppBackend() { return this.isNodeProcess && (process.platform as any) === \"ios\"; }\r\n\r\n /** Is this process the backend of an Android mobile application? */\r\n public static get isAndroidAppBackend() { return this.isNodeProcess && (process.platform as any) === \"android\"; }\r\n\r\n /** Is this process a mobile app backend? */\r\n public static get isMobileAppBackend() { return this.isIOSAppBackend || this.isAndroidAppBackend; }\r\n\r\n /** Is this process the frontend of a native (Electron or Mobile) app? */\r\n public static get isNativeAppFrontend() { return this.isElectronAppFrontend || this.isMobileAppFrontend; }\r\n}\r\n"]}
1
+ {"version":3,"file":"ProcessDetector.js","sourceRoot":"","sources":["../../src/ProcessDetector.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;GAEG;AACH,MAAa,eAAe;IAE1B;;OAEG;IACI,MAAM,KAAK,gBAAgB,KAAK,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI,OAAO,MAAM,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC;IAEnH;;MAEE;IACK,MAAM,KAAK,aAAa,KAAK,OAAO,OAAO,OAAO,KAAK,QAAQ,IAAI,SAAS,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IAE3G,uDAAuD;IAChD,MAAM,KAAK,qBAAqB,KAAK,OAAO,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAEjJ,sDAAsD;IAC/C,MAAM,KAAK,oBAAoB,KAAK,OAAO,OA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IACvK,CAAC;IAED;;;OAGG;IACI,MAAM,KAAK,mBAAmB,KAAK,OAAO,IAAI,CAAC,oBAAoB,IAAI,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAEtG,iEAAiE;IAC1D,MAAM,KAAK,gBAAgB,KAAK,OAAO,IAAI,CAAC,gBAAgB,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAE7H,qEAAqE;IAC9D,MAAM,KAAK,oBAAoB,KAAK,OAAO,IAAI,CAAC,gBAAgB,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAErI,gEAAgE;IACzD,MAAM,KAAK,eAAe,KAAK,OAAO,IAAI,CAAC,aAAa,IAAK,OAAO,CAAC,QAAgB,KAAK,KAAK,CAAC,CAAC,CAAC;IAEzG,oEAAoE;IAC7D,MAAM,KAAK,mBAAmB,KAAK,OAAO,IAAI,CAAC,aAAa,IAAK,OAAO,CAAC,QAAgB,KAAK,SAAS,CAAC,CAAC,CAAC;IAEjH,6CAA6C;IACtC,MAAM,KAAK,kBAAkB,KAAK,OAAO,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAEnG,yEAAyE;IAClE,MAAM,KAAK,mBAAmB,KAAK,OAAO,IAAI,CAAC,qBAAqB,IAAI,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC;CAC3G;AAzED,0CAyEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module ProcessDetector\r\n */\r\n\r\n/** Functions to determine the type of JavaScript process currently executing.\r\n * @public\r\n */\r\nexport class ProcessDetector {\r\n\r\n /** Is this a browser process?\r\n * @note this method will also return `true` for the frontend of Electron or Mobile apps. They *are* browser processes.\r\n */\r\n public static get isBrowserProcess() { return typeof window === \"object\" && typeof window.navigator === \"object\"; }\r\n\r\n /** Is this a Node process?\r\n * @note this means \"is this a backend process\"? It will return `true` for all backend process, including Electron and mobile apps.\r\n */\r\n public static get isNodeProcess() { return typeof process === \"object\" && undefined !== process.platform; }\r\n\r\n /** Is this process the frontend of an Electron app? */\r\n public static get isElectronAppFrontend() { return typeof navigator === \"object\" && navigator.userAgent.toLowerCase().indexOf(\"electron\") >= 0; }\r\n\r\n /** Is this process the backend of an Electron app? */\r\n public static get isElectronAppBackend() { return typeof process === \"object\" && process.versions.hasOwnProperty(\"electron\"); }\r\n\r\n /** Is this process running in a browser on an iPad?\r\n * @note This method will return `true` for any frontend running on an iPad, whether it is a user-launched web browser (e.g. Safari) or the frontend of a mobile app.\r\n */\r\n public static get isIPadBrowser() {\r\n return this.isBrowserProcess && window.navigator.platform === \"iPad\" || (window.navigator.platform === \"MacIntel\" && window.navigator.maxTouchPoints > 0 && !(\"MSStream\" in window)); /* eslint-disable-line @typescript-eslint/no-deprecated */\r\n }\r\n\r\n /** Is this process running in a browser on an iPhone?\r\n * @note This method will return `true` for any frontend running on an iPhone, whether it is a user-launched web browser (e.g. Safari) or the frontend of a mobile app.\r\n */\r\n public static get isIPhoneBrowser() { return this.isBrowserProcess && (/(iphone|ipod)/i.test(window.navigator.userAgent)); }\r\n\r\n /** Is this process running in a browser on an iOS device?\r\n * @note This method will return `true` for any frontend running on an iOS device, whether it is a user-launched web browser (e.g. Safari) or the frontend of a mobile app.\r\n */\r\n public static get isIOSBrowser() { return this.isIPadBrowser || this.isIPhoneBrowser; }\r\n\r\n /** Is this process running in a browser on an Android device?\r\n * @note This method will return `true` for any frontend running on an Android device, whether it is a user-launched web browser (e.g. Chrome) or the frontend of a mobile app.\r\n */\r\n public static get isAndroidBrowser() { return this.isBrowserProcess && /android/i.test(window.navigator.userAgent); }\r\n\r\n /** Is this process running in a browser on a mobile device?\r\n * @note This method will return `true` for any frontend running on a mobile device, whether it is a user-launched web browser or the frontend of a mobile app.\r\n */\r\n public static get isMobileBrowser() { return this.isIOSBrowser || this.isAndroidBrowser; }\r\n\r\n /** Is this process running in a Chromium based browser (Chrome / new Edge / Electron front end)? */\r\n public static get isChromium() {\r\n return (this.isBrowserProcess && window.navigator.userAgent.indexOf(\"Chrome\") > -1 && window.navigator.userAgent.indexOf(\"OP\") === -1) || this.isElectronAppFrontend;\r\n }\r\n\r\n /** Is this process the frontend of an iTwin mobile application?\r\n * @note this indicates that this is a browser process started by an iTwin mobile application.\r\n * It will return `false` when running user-launched web browsers on a mobile device.\r\n */\r\n public static get isMobileAppFrontend() { return this.isAndroidAppFrontend || this.isIOSAppFrontend; }\r\n\r\n /** Is this process the frontend of an iOS mobile application? */\r\n public static get isIOSAppFrontend() { return this.isBrowserProcess && window.location.hash.indexOf(\"platform=ios\") !== -1; }\r\n\r\n /** Is this process the frontend of an Android mobile application? */\r\n public static get isAndroidAppFrontend() { return this.isBrowserProcess && window.location.hash.indexOf(\"platform=android\") !== -1; }\r\n\r\n /** Is this process the backend of an iOS mobile application? */\r\n public static get isIOSAppBackend() { return this.isNodeProcess && (process.platform as any) === \"ios\"; }\r\n\r\n /** Is this process the backend of an Android mobile application? */\r\n public static get isAndroidAppBackend() { return this.isNodeProcess && (process.platform as any) === \"android\"; }\r\n\r\n /** Is this process a mobile app backend? */\r\n public static get isMobileAppBackend() { return this.isIOSAppBackend || this.isAndroidAppBackend; }\r\n\r\n /** Is this process the frontend of a native (Electron or Mobile) app? */\r\n public static get isNativeAppFrontend() { return this.isElectronAppFrontend || this.isMobileAppFrontend; }\r\n}\r\n"]}
@@ -7,7 +7,9 @@
7
7
  * @module Collections
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.SortedArray = exports.ReadonlySortedArray = exports.DuplicatePolicy = exports.lowerBound = exports.shallowClone = void 0;
10
+ exports.SortedArray = exports.ReadonlySortedArray = exports.DuplicatePolicy = void 0;
11
+ exports.shallowClone = shallowClone;
12
+ exports.lowerBound = lowerBound;
11
13
  /**
12
14
  * A [[CloneFunction]] that, given a value of type T, returns the same value.
13
15
  * Useful as a default argument for functions that can alternatively accept custom logic for cloning values of object type.
@@ -18,7 +20,6 @@ exports.SortedArray = exports.ReadonlySortedArray = exports.DuplicatePolicy = ex
18
20
  function shallowClone(value) {
19
21
  return value;
20
22
  }
21
- exports.shallowClone = shallowClone;
22
23
  /**
23
24
  * Given a sorted array, computes the position at which the specified value should be inserted into the array so that the array remains sorted.
24
25
  * @param value The value whose position is to be computed.
@@ -30,7 +31,6 @@ exports.shallowClone = shallowClone;
30
31
  function lowerBound(value, list, compare) {
31
32
  return lowerBoundOfEquivalent(list, (element) => compare(value, element));
32
33
  }
33
- exports.lowerBound = lowerBound;
34
34
  function lowerBoundOfEquivalent(list, criterion) {
35
35
  let low = 0;
36
36
  let high = list.length;
@@ -1 +1 @@
1
- {"version":3,"file":"SortedArray.js","sourceRoot":"","sources":["../../src/SortedArray.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAWH;;;;;;GAMG;AACH,SAAgB,YAAY,CAAI,KAAQ;IACtC,OAAO,KAAK,CAAC;AACf,CAAC;AAFD,oCAEC;AAED;;;;;;;GAOG;AACH,SAAgB,UAAU,CAAW,KAAQ,EAAE,IAAS,EAAE,OAAgC;IACxF,OAAO,sBAAsB,CAAC,IAAI,EAAE,CAAC,OAAU,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;AAC/E,CAAC;AAFD,gCAEC;AAED,SAAS,sBAAsB,CAAI,IAAS,EAAE,SAAiC;IAC7E,IAAI,GAAG,GAAG,CAAC,CAAC;IACZ,IAAI,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC;IACvB,OAAO,GAAG,GAAG,IAAI,EAAE,CAAC;QACl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K,EAAE,QAA0B,YAAY;QAC1I,KAAK,CAAC,OAAO,EAAE,eAAe,EAAE,KAAK,CAAC,CAAC;IACzC,CAAC;IAED,+CAA+C;IACxC,KAAK,KAAW,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAEvC;;OAEG;IACI,YAAY,KAAU,OAAO,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;IAE3D;;;;;;;;;;;;;;OAcG;IACI,MAAM,CAAC,KAAQ,EAAE,QAA4B,IAAY,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IAEvG;;;;OAIG;IACI,MAAM,CAAC,KAAQ,IAAY,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAE/D,qIAAqI;IACrH,KAAK,CAAC,KAAc,EAAE,GAAY;QAChD,MAAM,KAAK,GAAG,IAAI,WAAW,CAAI,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACpF,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAC7C,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAjDD,kCAiDC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Collections\r\n */\r\n\r\nimport { OrderedComparator } from \"./Compare\";\r\n\r\n/**\r\n * A function that, given a value of type T, returns a copy of that value. Such functions are used by various collection classes.\r\n * It is up to the function to decide how deeply or shallowly the value is cloned. For example, [[shallowClone]] simply returns the input.\r\n * @public\r\n */\r\nexport type CloneFunction<T> = (value: T) => T;\r\n\r\n/**\r\n * A [[CloneFunction]] that, given a value of type T, returns the same value.\r\n * Useful as a default argument for functions that can alternatively accept custom logic for cloning values of object type.\r\n * @param value The value to clone.\r\n * @returns the input value.\r\n * @public\r\n */\r\nexport function shallowClone<T>(value: T) {\r\n return value;\r\n}\r\n\r\n/**\r\n * Given a sorted array, computes the position at which the specified value should be inserted into the array so that the array remains sorted.\r\n * @param value The value whose position is to be computed.\r\n * @param list An array of U already sorted according to the comparison criterion.\r\n * @param compare The function used to compare the value with elements in `list`.\r\n * @returns an object with 'index' corresponding to the computed position and 'equal' set to true if an equivalent element already exists at that index.\r\n * @public\r\n */\r\nexport function lowerBound<T, U = T>(value: T, list: U[], compare: OrderedComparator<T, U>): { index: number, equal: boolean } {\r\n return lowerBoundOfEquivalent(list, (element: U) => compare(value, element));\r\n}\r\n\r\nfunction lowerBoundOfEquivalent<T>(list: T[], criterion: (element: T) => number): { index: number, equal: boolean } {\r\n let low = 0;\r\n let high = list.length;\r\n while (low < high) {\r\n const mid = Math.floor((low + high) / 2);\r\n const comp = criterion(list[mid]);\r\n if (0 === comp)\r\n return { index: mid, equal: true };\r\n else if (comp < 0)\r\n high = mid;\r\n else\r\n low = mid + 1;\r\n }\r\n\r\n return { index: low, equal: false };\r\n}\r\n\r\n/** Describes how duplicate values are handled when inserting into a [[SortedArray]].\r\n * A \"duplicate\" value is one that compares equal to a value already present in the array, per the array's comparison function.\r\n * @public\r\n */\r\nexport enum DuplicatePolicy {\r\n /** The array allows duplicate values to be inserted. All duplicate values will be adjacent in the array, but the ordering between duplicate values is unspecified.\r\n * @note In the presence of duplicate values, functions like [[SortedArray.indexOf]] and [[SortedArray.findEqual]] will return one of the values - exactly which one is unspecified.\r\n */\r\n Allow,\r\n /** Duplicate values are forbidden - when attempting to insert a value equivalent to one already present, the already-present value is retained. */\r\n Retain,\r\n /** Duplicate values are forbidden - when attempting to insert a value equivalent to one already present, the already-present value is replaced by the new value.\r\n * This can be useful when the value type carries additional data that is not evaluated by the comparison function.\r\n */\r\n Replace,\r\n}\r\n\r\n/**\r\n * A read-only view of an array of some type T sorted according to some user-supplied criterion.\r\n * Duplicate elements may be present, though sub-types may enforce uniqueness of elements.\r\n * In the absence of duplicates, a ReadonlySortedArray<T> can behave like a Set<T> where T is an object and equality is determined\r\n * by some criterion other than object identity.\r\n *\r\n * Because the array is always sorted, querying for the presence of an element is performed using binary\r\n * search, which is more efficient than a linear search for reasonably large arrays.\r\n *\r\n * The comparison function must meet the following criteria, given 'lhs' and 'rhs' of type T:\r\n * - If lhs is equal to rhs, returns 0\r\n * - If lhs is less than rhs, returns a negative value\r\n * - If lhs is greater than rhs, returns a positive value\r\n * - If compare(lhs, rhs) returns 0, then compare(rhs, lhs) must also return 0\r\n * - If compare(lhs, rhs) returns a negative value, then compare(rhs, lhs) must return a positive value, and vice versa.\r\n *\r\n * Note that the array is read-only only from the perspective of its public interface. Mutation methods are defined for internal use by sub-types.\r\n *\r\n * @see [[SortedArray]] for a general-purpose mutable sorted array.\r\n * @public\r\n */\r\nexport class ReadonlySortedArray<T> implements Iterable<T> {\r\n protected _array: T[] = [];\r\n protected readonly _compare: OrderedComparator<T>;\r\n protected readonly _clone: CloneFunction<T>;\r\n protected readonly _duplicatePolicy: DuplicatePolicy;\r\n\r\n /**\r\n * Construct a new ReadonlySortedArray<T>.\r\n * @param compare The function used to compare elements within the array.\r\n * @param duplicatePolicy Policy for handling attempts to insert a value when an equivalent value already exists. If the input is a boolean, then `true` indicates [[DuplicatePolicy.Allow]], and `false` indicates [[DuplicatePolicy.Retain]].\r\n * @param clone The function invoked to clone a new element for insertion into the array. The default implementation simply returns its input.\r\n */\r\n protected constructor(compare: OrderedComparator<T>, duplicatePolicy: DuplicatePolicy | boolean = false, clone: CloneFunction<T> = shallowClone) {\r\n this._compare = compare;\r\n this._clone = clone;\r\n if (typeof duplicatePolicy === \"boolean\")\r\n duplicatePolicy = duplicatePolicy ? DuplicatePolicy.Allow : DuplicatePolicy.Retain;\r\n\r\n this._duplicatePolicy = duplicatePolicy;\r\n }\r\n\r\n /** The number of elements in the array */\r\n public get length(): number { return this._array.length; }\r\n\r\n /** Returns true if the array contains no elements. */\r\n public get isEmpty(): boolean { return 0 === this.length; }\r\n\r\n /** Returns an iterator over the contents of the array in sorted order, suitable for use in `for-of` loops. */\r\n public [Symbol.iterator](): Iterator<T> { return this._array[Symbol.iterator](); }\r\n\r\n /**\r\n * Looks up the index of an element comparing equal to the specified value using binary search.\r\n * @param value The value to search for\r\n * @returns the index of the first equivalent element found in the array, or -1 if no such element exists.\r\n */\r\n public indexOf(value: T): number {\r\n const bound = this.lowerBound(value);\r\n return bound.equal ? bound.index : -1;\r\n }\r\n\r\n /**\r\n * Returns true if this array contains at least one value comparing equal to the specified value.\r\n * @param value The value to search for\r\n * @returns true if an equivalent element exists in the array.\r\n */\r\n public contains(value: T): boolean {\r\n return -1 !== this.indexOf(value);\r\n }\r\n\r\n /**\r\n * Looks up an element comparing equal to the specified value using binary search.\r\n * @param value The value to search for\r\n * @returns the first equivalent element found in the array, or undefined if no such element exists.\r\n */\r\n public findEqual(value: T): T | undefined {\r\n const index = this.indexOf(value);\r\n return -1 !== index ? this._array[index] : undefined;\r\n }\r\n\r\n /** Find an element that compares as equivalent based on some criterion. If multiple elements are equivalent, the specific one returned is unspecified.\r\n * As an example, consider a `SortedArray<ModelState>` which uses `ModelState.id` as its ordering criterion. To find a model by its Id,\r\n * use `sortedArray.findEquivalent((element) => compareStrings(element.id, modelId))` where `modelId` is an [[Id64String]].\r\n * @param criterion A function accepting an element and returning 0 if it compares as equivalent, a negative number if it compares as \"less-than\", or a positive value if it compares as \"greater-than\".\r\n * @returns The first element found that meets the criterion, or `undefined` if no elements meet the criterion.\r\n * @see [[indexOfEquivalent]].\r\n * @public\r\n */\r\n public findEquivalent(criterion: (element: T) => number): T | undefined {\r\n const index = this.indexOfEquivalent(criterion);\r\n return -1 !== index ? this._array[index] : undefined;\r\n }\r\n\r\n /** Find the index of an element that compares as equivalent based on some criterion. If multiple elements are equivalent, the specific one returned is unspecified.\r\n * As an example, consider a `SortedArray<ModelState>` which uses `ModelState.id` as its ordering criterion. To find the index of a model by its Id,\r\n * use `sortedArray.indexOfEquivalent((element) => compareStrings(element.id, modelId))` where `modelId` is an [[Id64String]].\r\n * @param criterion A function accepting an element and returning 0 if it compares as equivalent, a negative number if the element compares as \"less-than\", or a positive value if the element compares as \"greater-than\".\r\n * @returns The index of the first element found that meets the criterion, or -1 if no elements meet the criterion.\r\n * @public\r\n */\r\n public indexOfEquivalent(criterion: (element: T) => number): number {\r\n // NB: Must invert the ordering.\r\n const bound = lowerBoundOfEquivalent(this._array, (elem: T) => 0 - criterion(elem));\r\n return bound.equal ? bound.index : -1;\r\n }\r\n\r\n /**\r\n * Looks up an element by its index in the array.\r\n * @param index The array index\r\n * @returns the element corresponding to that position in the array, or undefined if the supplied index exceeds the length of the array.\r\n */\r\n public get(index: number): T | undefined { return index < this.length ? this._array[index] : undefined; }\r\n\r\n /** Apply a function to each element in the array, in sorted order.\r\n * @param func The function to be applied.\r\n */\r\n public forEach(func: (value: T) => void): void {\r\n for (let i = 0; i < this.length; i++)\r\n func(this._array[i]);\r\n }\r\n\r\n /** The equivalent of [Array.slice](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice). */\r\n public slice(start?: number, end?: number): ReadonlySortedArray<T> {\r\n const slice = new ReadonlySortedArray<T>(this._compare, this._duplicatePolicy, this._clone);\r\n slice._array = this._array.slice(start, end);\r\n return slice;\r\n }\r\n\r\n /**\r\n * Computes the position at which the specified value should be inserted to maintain sorted order.\r\n * @param value The value whose position is to be computed.\r\n * @returns an object with 'index' corresponding to the computed position and 'equal' set to true if an equivalent element already exists at that index.\r\n */\r\n protected lowerBound(value: T): { index: number, equal: boolean } { return lowerBound(value, this._array, this._compare); }\r\n\r\n /** Clears the contents of the sorted array. */\r\n protected _clear(): void { this._array.length = 0; }\r\n\r\n /** Extracts the sorted array as a T[] and empties the contents of this ReadonlySortedArray.\r\n * @returns the contents of this ReadonlySortedArray as a T[].\r\n */\r\n protected _extractArray(): T[] {\r\n const result = this._array;\r\n this._array = [];\r\n return result;\r\n }\r\n\r\n /**\r\n * Attempts to insert a new value into the array at a position determined by the ordering.\r\n * The behavior differs based on the array's [[DuplicatePolicy]]:\r\n * If duplicates are **not** permitted, then:\r\n * - If an equivalent element already exists in the array:\r\n * - [[DuplicatePolicy.Retain]]: nothing will be inserted and the index of the existing element will be returned.\r\n * - [[DuplicatePolicy.Replace]]: the input value will overwrite the existing element at the same index and that index will be returned.\r\n * - Otherwise, the element is inserted and its index is returned.\r\n * If duplicates **are** permitted, then:\r\n * - The element will be inserted in a correct position based on the sorting criterion;\r\n * - The position of the element relative to other elements comparing as equal to it is unspecified; and\r\n * - The actual index of the newly-inserted element is returned.\r\n * If the element is to be inserted, then the supplied value will be passed to the clone function supplied to the constructor and the result will be inserted into the array.\r\n * @param value The value to insert\r\n * @param onInsert The optional callback method to call if insertion occurs with the inserted value\r\n * @returns the index in the array of the newly-inserted value, or, if duplicates are not permitted and an equivalent value already exists, the index of the equivalent value.\r\n */\r\n protected _insert(value: T, onInsert?: (value: T) => any): number {\r\n const bound = this.lowerBound(value);\r\n\r\n if (bound.equal) {\r\n switch (this._duplicatePolicy) {\r\n case DuplicatePolicy.Retain:\r\n return bound.index;\r\n case DuplicatePolicy.Replace:\r\n this._array[bound.index] = this._clone(value);\r\n if (onInsert)\r\n onInsert(value);\r\n\r\n return bound.index;\r\n }\r\n }\r\n\r\n this._array.splice(bound.index, 0, this._clone(value));\r\n if (undefined !== onInsert)\r\n onInsert(value);\r\n\r\n return bound.index;\r\n }\r\n\r\n /**\r\n * Removes the first occurrence of a value comparing equal to the specified value from the array.\r\n * @param value The value of the element to delete\r\n * @returns the index of the deleted value, or -1 if no such element exists.\r\n */\r\n protected _remove(value: T): number {\r\n const bound = this.lowerBound(value);\r\n if (bound.equal) {\r\n this._array.splice(bound.index, 1);\r\n return bound.index;\r\n } else {\r\n return -1;\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Maintains an array of some type T in sorted order. The ordering is specified by a function supplied\r\n * by the user.\r\n * By default, only unique elements are permitted; attempting to insert a new element that compares\r\n * as equal to an element already in the array will not modify the contents of the array.\r\n *\r\n * This allows a SortedArray<T> to behave like a Set<T> where T is an object and equality is determined\r\n * by some criterion other than object identity.\r\n *\r\n * Because the array is always sorted, querying for the presence of an element is performed using binary\r\n * search, which is more efficient than a linear search for reasonably large arrays.\r\n *\r\n * The user can also specify how the SortedArray takes ownership of inserted values, e.g., by cloning them.\r\n *\r\n * The comparison function must meet the following criteria, given 'lhs' and 'rhs' of type T:\r\n * - If lhs is equal to rhs, returns 0\r\n * - If lhs is less than rhs, returns a negative value\r\n * - If lhs is greater than rhs, returns a positive value\r\n * - If compare(lhs, rhs) returns 0, then compare(rhs, lhs) must also return 0\r\n * - If compare(lhs, rhs) returns a negative value, then compare(rhs, lhs) must return a positive value, and vice versa.\r\n *\r\n * Modifying an element in a way that affects the comparison function will produce unpredictable results, the\r\n * most likely of which is that the array will cease to be sorted.\r\n * @public\r\n */\r\nexport class SortedArray<T> extends ReadonlySortedArray<T> {\r\n /**\r\n * Construct a new SortedArray<T>.\r\n * @param compare The function used to compare elements within the array.\r\n * @param duplicatePolicy Policy for handling attempts to insert a value when an equivalent value already exists. If the input is a boolean, then `true` indicates [[DuplicatePolicy.Allow]], and `false` indicates [[DuplicatePolicy.Retain]].\r\n * @param clone The function invoked to clone a new element for insertion into the array. The default implementation simply returns its input.\r\n */\r\n public constructor(compare: OrderedComparator<T>, duplicatePolicy: DuplicatePolicy | boolean = false, clone: CloneFunction<T> = shallowClone) {\r\n super(compare, duplicatePolicy, clone);\r\n }\r\n\r\n /** Clears the contents of the sorted array. */\r\n public clear(): void { this._clear(); }\r\n\r\n /** Extracts the sorted array as a T[] and empties the contents of this SortedArray.\r\n * @returns the contents of this SortedArray as a T[].\r\n */\r\n public extractArray(): T[] { return this._extractArray(); }\r\n\r\n /**\r\n * Attempts to insert a new value into the array at a position determined by the ordering.\r\n * The behavior differs based on whether or not duplicate elements are permitted.\r\n * If duplicates are **not** permitted, then:\r\n * - If an equivalent element already exists in the array, nothing will be inserted and the index of the existing element will be returned.\r\n * - Otherwise, the element is inserted and its index is returned.\r\n * If duplicates **are** permitted, then:\r\n * - The element will be inserted in a correct position based on the sorting criterion;\r\n * - The position of the element relative to other elements comparing as equal to it is unspecified; and\r\n * - The actual index of the newly-inserted element is returned.\r\n * If the element is to be inserted, then the supplied value will be passed to the clone function supplied to the constructor and the result will be inserted into the array.\r\n * @param value The value to insert\r\n * @param onInsert The optional callback method to call if insertion occurs with the inserted value\r\n * @returns the index in the array of the newly-inserted value, or, if duplicates are not permitted and an equivalent value already exists, the index of the equivalent value.\r\n */\r\n public insert(value: T, onInsert?: (value: T) => any): number { return this._insert(value, onInsert); }\r\n\r\n /**\r\n * Removes the first occurrence of a value comparing equal to the specified value from the array.\r\n * @param value The value of the element to delete\r\n * @returns the index of the deleted value, or -1 if no such element exists.\r\n */\r\n public remove(value: T): number { return this._remove(value); }\r\n\r\n /** The equivalent of [Array.slice](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice). */\r\n public override slice(start?: number, end?: number): SortedArray<T> {\r\n const slice = new SortedArray<T>(this._compare, this._duplicatePolicy, this._clone);\r\n slice._array = this._array.slice(start, end);\r\n return slice;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"SortedArray.js","sourceRoot":"","sources":["../../src/SortedArray.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAkBH,oCAEC;AAUD,gCAEC;AArBD;;;;;;GAMG;AACH,SAAgB,YAAY,CAAI,KAAQ;IACtC,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,UAAU,CAAW,KAAQ,EAAE,IAAS,EAAE,OAAgC;IACxF,OAAO,sBAAsB,CAAC,IAAI,EAAE,CAAC,OAAU,EAAE,EAAE,CAAC,OAAO,CAAC,KAA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QACrB,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,CAAC,CAAC;QACZ,CAAC;IACH,CAAC;CACF;AApLD,kDAoLC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAa,WAAe,SAAQ,mBAAsB;IACxD;;;;;OAKG;IACH,YAAmB,OAA6B,EAAE,kBAA6C,KAAK,EAAE,QAA0B,YAAY;QAC1I,KAAK,CAAC,OAAO,EAAE,eAAe,EAAE,KAAK,CAAC,CAAC;IACzC,CAAC;IAED,+CAA+C;IACxC,KAAK,KAAW,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAEvC;;OAEG;IACI,YAAY,KAAU,OAAO,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;IAE3D;;;;;;;;;;;;;;OAcG;IACI,MAAM,CAAC,KAAQ,EAAE,QAA4B,IAAY,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IAEvG;;;;OAIG;IACI,MAAM,CAAC,KAAQ,IAAY,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAE/D,qIAAqI;IACrH,KAAK,CAAC,KAAc,EAAE,GAAY;QAChD,MAAM,KAAK,GAAG,IAAI,WAAW,CAAI,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACpF,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAC7C,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAjDD,kCAiDC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Collections\r\n */\r\n\r\nimport { OrderedComparator } from \"./Compare\";\r\n\r\n/**\r\n * A function that, given a value of type T, returns a copy of that value. Such functions are used by various collection classes.\r\n * It is up to the function to decide how deeply or shallowly the value is cloned. For example, [[shallowClone]] simply returns the input.\r\n * @public\r\n */\r\nexport type CloneFunction<T> = (value: T) => T;\r\n\r\n/**\r\n * A [[CloneFunction]] that, given a value of type T, returns the same value.\r\n * Useful as a default argument for functions that can alternatively accept custom logic for cloning values of object type.\r\n * @param value The value to clone.\r\n * @returns the input value.\r\n * @public\r\n */\r\nexport function shallowClone<T>(value: T) {\r\n return value;\r\n}\r\n\r\n/**\r\n * Given a sorted array, computes the position at which the specified value should be inserted into the array so that the array remains sorted.\r\n * @param value The value whose position is to be computed.\r\n * @param list An array of U already sorted according to the comparison criterion.\r\n * @param compare The function used to compare the value with elements in `list`.\r\n * @returns an object with 'index' corresponding to the computed position and 'equal' set to true if an equivalent element already exists at that index.\r\n * @public\r\n */\r\nexport function lowerBound<T, U = T>(value: T, list: U[], compare: OrderedComparator<T, U>): { index: number, equal: boolean } {\r\n return lowerBoundOfEquivalent(list, (element: U) => compare(value, element));\r\n}\r\n\r\nfunction lowerBoundOfEquivalent<T>(list: T[], criterion: (element: T) => number): { index: number, equal: boolean } {\r\n let low = 0;\r\n let high = list.length;\r\n while (low < high) {\r\n const mid = Math.floor((low + high) / 2);\r\n const comp = criterion(list[mid]);\r\n if (0 === comp)\r\n return { index: mid, equal: true };\r\n else if (comp < 0)\r\n high = mid;\r\n else\r\n low = mid + 1;\r\n }\r\n\r\n return { index: low, equal: false };\r\n}\r\n\r\n/** Describes how duplicate values are handled when inserting into a [[SortedArray]].\r\n * A \"duplicate\" value is one that compares equal to a value already present in the array, per the array's comparison function.\r\n * @public\r\n */\r\nexport enum DuplicatePolicy {\r\n /** The array allows duplicate values to be inserted. All duplicate values will be adjacent in the array, but the ordering between duplicate values is unspecified.\r\n * @note In the presence of duplicate values, functions like [[SortedArray.indexOf]] and [[SortedArray.findEqual]] will return one of the values - exactly which one is unspecified.\r\n */\r\n Allow,\r\n /** Duplicate values are forbidden - when attempting to insert a value equivalent to one already present, the already-present value is retained. */\r\n Retain,\r\n /** Duplicate values are forbidden - when attempting to insert a value equivalent to one already present, the already-present value is replaced by the new value.\r\n * This can be useful when the value type carries additional data that is not evaluated by the comparison function.\r\n */\r\n Replace,\r\n}\r\n\r\n/**\r\n * A read-only view of an array of some type T sorted according to some user-supplied criterion.\r\n * Duplicate elements may be present, though sub-types may enforce uniqueness of elements.\r\n * In the absence of duplicates, a ReadonlySortedArray<T> can behave like a Set<T> where T is an object and equality is determined\r\n * by some criterion other than object identity.\r\n *\r\n * Because the array is always sorted, querying for the presence of an element is performed using binary\r\n * search, which is more efficient than a linear search for reasonably large arrays.\r\n *\r\n * The comparison function must meet the following criteria, given 'lhs' and 'rhs' of type T:\r\n * - If lhs is equal to rhs, returns 0\r\n * - If lhs is less than rhs, returns a negative value\r\n * - If lhs is greater than rhs, returns a positive value\r\n * - If compare(lhs, rhs) returns 0, then compare(rhs, lhs) must also return 0\r\n * - If compare(lhs, rhs) returns a negative value, then compare(rhs, lhs) must return a positive value, and vice versa.\r\n *\r\n * Note that the array is read-only only from the perspective of its public interface. Mutation methods are defined for internal use by sub-types.\r\n *\r\n * @see [[SortedArray]] for a general-purpose mutable sorted array.\r\n * @public\r\n */\r\nexport class ReadonlySortedArray<T> implements Iterable<T> {\r\n protected _array: T[] = [];\r\n protected readonly _compare: OrderedComparator<T>;\r\n protected readonly _clone: CloneFunction<T>;\r\n protected readonly _duplicatePolicy: DuplicatePolicy;\r\n\r\n /**\r\n * Construct a new ReadonlySortedArray<T>.\r\n * @param compare The function used to compare elements within the array.\r\n * @param duplicatePolicy Policy for handling attempts to insert a value when an equivalent value already exists. If the input is a boolean, then `true` indicates [[DuplicatePolicy.Allow]], and `false` indicates [[DuplicatePolicy.Retain]].\r\n * @param clone The function invoked to clone a new element for insertion into the array. The default implementation simply returns its input.\r\n */\r\n protected constructor(compare: OrderedComparator<T>, duplicatePolicy: DuplicatePolicy | boolean = false, clone: CloneFunction<T> = shallowClone) {\r\n this._compare = compare;\r\n this._clone = clone;\r\n if (typeof duplicatePolicy === \"boolean\")\r\n duplicatePolicy = duplicatePolicy ? DuplicatePolicy.Allow : DuplicatePolicy.Retain;\r\n\r\n this._duplicatePolicy = duplicatePolicy;\r\n }\r\n\r\n /** The number of elements in the array */\r\n public get length(): number { return this._array.length; }\r\n\r\n /** Returns true if the array contains no elements. */\r\n public get isEmpty(): boolean { return 0 === this.length; }\r\n\r\n /** Returns an iterator over the contents of the array in sorted order, suitable for use in `for-of` loops. */\r\n public [Symbol.iterator](): Iterator<T> { return this._array[Symbol.iterator](); }\r\n\r\n /**\r\n * Looks up the index of an element comparing equal to the specified value using binary search.\r\n * @param value The value to search for\r\n * @returns the index of the first equivalent element found in the array, or -1 if no such element exists.\r\n */\r\n public indexOf(value: T): number {\r\n const bound = this.lowerBound(value);\r\n return bound.equal ? bound.index : -1;\r\n }\r\n\r\n /**\r\n * Returns true if this array contains at least one value comparing equal to the specified value.\r\n * @param value The value to search for\r\n * @returns true if an equivalent element exists in the array.\r\n */\r\n public contains(value: T): boolean {\r\n return -1 !== this.indexOf(value);\r\n }\r\n\r\n /**\r\n * Looks up an element comparing equal to the specified value using binary search.\r\n * @param value The value to search for\r\n * @returns the first equivalent element found in the array, or undefined if no such element exists.\r\n */\r\n public findEqual(value: T): T | undefined {\r\n const index = this.indexOf(value);\r\n return -1 !== index ? this._array[index] : undefined;\r\n }\r\n\r\n /** Find an element that compares as equivalent based on some criterion. If multiple elements are equivalent, the specific one returned is unspecified.\r\n * As an example, consider a `SortedArray<ModelState>` which uses `ModelState.id` as its ordering criterion. To find a model by its Id,\r\n * use `sortedArray.findEquivalent((element) => compareStrings(element.id, modelId))` where `modelId` is an [[Id64String]].\r\n * @param criterion A function accepting an element and returning 0 if it compares as equivalent, a negative number if it compares as \"less-than\", or a positive value if it compares as \"greater-than\".\r\n * @returns The first element found that meets the criterion, or `undefined` if no elements meet the criterion.\r\n * @see [[indexOfEquivalent]].\r\n * @public\r\n */\r\n public findEquivalent(criterion: (element: T) => number): T | undefined {\r\n const index = this.indexOfEquivalent(criterion);\r\n return -1 !== index ? this._array[index] : undefined;\r\n }\r\n\r\n /** Find the index of an element that compares as equivalent based on some criterion. If multiple elements are equivalent, the specific one returned is unspecified.\r\n * As an example, consider a `SortedArray<ModelState>` which uses `ModelState.id` as its ordering criterion. To find the index of a model by its Id,\r\n * use `sortedArray.indexOfEquivalent((element) => compareStrings(element.id, modelId))` where `modelId` is an [[Id64String]].\r\n * @param criterion A function accepting an element and returning 0 if it compares as equivalent, a negative number if the element compares as \"less-than\", or a positive value if the element compares as \"greater-than\".\r\n * @returns The index of the first element found that meets the criterion, or -1 if no elements meet the criterion.\r\n * @public\r\n */\r\n public indexOfEquivalent(criterion: (element: T) => number): number {\r\n // NB: Must invert the ordering.\r\n const bound = lowerBoundOfEquivalent(this._array, (elem: T) => 0 - criterion(elem));\r\n return bound.equal ? bound.index : -1;\r\n }\r\n\r\n /**\r\n * Looks up an element by its index in the array.\r\n * @param index The array index\r\n * @returns the element corresponding to that position in the array, or undefined if the supplied index exceeds the length of the array.\r\n */\r\n public get(index: number): T | undefined { return index < this.length ? this._array[index] : undefined; }\r\n\r\n /** Apply a function to each element in the array, in sorted order.\r\n * @param func The function to be applied.\r\n */\r\n public forEach(func: (value: T) => void): void {\r\n for (let i = 0; i < this.length; i++)\r\n func(this._array[i]);\r\n }\r\n\r\n /** The equivalent of [Array.slice](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice). */\r\n public slice(start?: number, end?: number): ReadonlySortedArray<T> {\r\n const slice = new ReadonlySortedArray<T>(this._compare, this._duplicatePolicy, this._clone);\r\n slice._array = this._array.slice(start, end);\r\n return slice;\r\n }\r\n\r\n /**\r\n * Computes the position at which the specified value should be inserted to maintain sorted order.\r\n * @param value The value whose position is to be computed.\r\n * @returns an object with 'index' corresponding to the computed position and 'equal' set to true if an equivalent element already exists at that index.\r\n */\r\n protected lowerBound(value: T): { index: number, equal: boolean } { return lowerBound(value, this._array, this._compare); }\r\n\r\n /** Clears the contents of the sorted array. */\r\n protected _clear(): void { this._array.length = 0; }\r\n\r\n /** Extracts the sorted array as a T[] and empties the contents of this ReadonlySortedArray.\r\n * @returns the contents of this ReadonlySortedArray as a T[].\r\n */\r\n protected _extractArray(): T[] {\r\n const result = this._array;\r\n this._array = [];\r\n return result;\r\n }\r\n\r\n /**\r\n * Attempts to insert a new value into the array at a position determined by the ordering.\r\n * The behavior differs based on the array's [[DuplicatePolicy]]:\r\n * If duplicates are **not** permitted, then:\r\n * - If an equivalent element already exists in the array:\r\n * - [[DuplicatePolicy.Retain]]: nothing will be inserted and the index of the existing element will be returned.\r\n * - [[DuplicatePolicy.Replace]]: the input value will overwrite the existing element at the same index and that index will be returned.\r\n * - Otherwise, the element is inserted and its index is returned.\r\n * If duplicates **are** permitted, then:\r\n * - The element will be inserted in a correct position based on the sorting criterion;\r\n * - The position of the element relative to other elements comparing as equal to it is unspecified; and\r\n * - The actual index of the newly-inserted element is returned.\r\n * If the element is to be inserted, then the supplied value will be passed to the clone function supplied to the constructor and the result will be inserted into the array.\r\n * @param value The value to insert\r\n * @param onInsert The optional callback method to call if insertion occurs with the inserted value\r\n * @returns the index in the array of the newly-inserted value, or, if duplicates are not permitted and an equivalent value already exists, the index of the equivalent value.\r\n */\r\n protected _insert(value: T, onInsert?: (value: T) => any): number {\r\n const bound = this.lowerBound(value);\r\n\r\n if (bound.equal) {\r\n switch (this._duplicatePolicy) {\r\n case DuplicatePolicy.Retain:\r\n return bound.index;\r\n case DuplicatePolicy.Replace:\r\n this._array[bound.index] = this._clone(value);\r\n if (onInsert)\r\n onInsert(value);\r\n\r\n return bound.index;\r\n }\r\n }\r\n\r\n this._array.splice(bound.index, 0, this._clone(value));\r\n if (undefined !== onInsert)\r\n onInsert(value);\r\n\r\n return bound.index;\r\n }\r\n\r\n /**\r\n * Removes the first occurrence of a value comparing equal to the specified value from the array.\r\n * @param value The value of the element to delete\r\n * @returns the index of the deleted value, or -1 if no such element exists.\r\n */\r\n protected _remove(value: T): number {\r\n const bound = this.lowerBound(value);\r\n if (bound.equal) {\r\n this._array.splice(bound.index, 1);\r\n return bound.index;\r\n } else {\r\n return -1;\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Maintains an array of some type T in sorted order. The ordering is specified by a function supplied\r\n * by the user.\r\n * By default, only unique elements are permitted; attempting to insert a new element that compares\r\n * as equal to an element already in the array will not modify the contents of the array.\r\n *\r\n * This allows a SortedArray<T> to behave like a Set<T> where T is an object and equality is determined\r\n * by some criterion other than object identity.\r\n *\r\n * Because the array is always sorted, querying for the presence of an element is performed using binary\r\n * search, which is more efficient than a linear search for reasonably large arrays.\r\n *\r\n * The user can also specify how the SortedArray takes ownership of inserted values, e.g., by cloning them.\r\n *\r\n * The comparison function must meet the following criteria, given 'lhs' and 'rhs' of type T:\r\n * - If lhs is equal to rhs, returns 0\r\n * - If lhs is less than rhs, returns a negative value\r\n * - If lhs is greater than rhs, returns a positive value\r\n * - If compare(lhs, rhs) returns 0, then compare(rhs, lhs) must also return 0\r\n * - If compare(lhs, rhs) returns a negative value, then compare(rhs, lhs) must return a positive value, and vice versa.\r\n *\r\n * Modifying an element in a way that affects the comparison function will produce unpredictable results, the\r\n * most likely of which is that the array will cease to be sorted.\r\n * @public\r\n */\r\nexport class SortedArray<T> extends ReadonlySortedArray<T> {\r\n /**\r\n * Construct a new SortedArray<T>.\r\n * @param compare The function used to compare elements within the array.\r\n * @param duplicatePolicy Policy for handling attempts to insert a value when an equivalent value already exists. If the input is a boolean, then `true` indicates [[DuplicatePolicy.Allow]], and `false` indicates [[DuplicatePolicy.Retain]].\r\n * @param clone The function invoked to clone a new element for insertion into the array. The default implementation simply returns its input.\r\n */\r\n public constructor(compare: OrderedComparator<T>, duplicatePolicy: DuplicatePolicy | boolean = false, clone: CloneFunction<T> = shallowClone) {\r\n super(compare, duplicatePolicy, clone);\r\n }\r\n\r\n /** Clears the contents of the sorted array. */\r\n public clear(): void { this._clear(); }\r\n\r\n /** Extracts the sorted array as a T[] and empties the contents of this SortedArray.\r\n * @returns the contents of this SortedArray as a T[].\r\n */\r\n public extractArray(): T[] { return this._extractArray(); }\r\n\r\n /**\r\n * Attempts to insert a new value into the array at a position determined by the ordering.\r\n * The behavior differs based on whether or not duplicate elements are permitted.\r\n * If duplicates are **not** permitted, then:\r\n * - If an equivalent element already exists in the array, nothing will be inserted and the index of the existing element will be returned.\r\n * - Otherwise, the element is inserted and its index is returned.\r\n * If duplicates **are** permitted, then:\r\n * - The element will be inserted in a correct position based on the sorting criterion;\r\n * - The position of the element relative to other elements comparing as equal to it is unspecified; and\r\n * - The actual index of the newly-inserted element is returned.\r\n * If the element is to be inserted, then the supplied value will be passed to the clone function supplied to the constructor and the result will be inserted into the array.\r\n * @param value The value to insert\r\n * @param onInsert The optional callback method to call if insertion occurs with the inserted value\r\n * @returns the index in the array of the newly-inserted value, or, if duplicates are not permitted and an equivalent value already exists, the index of the equivalent value.\r\n */\r\n public insert(value: T, onInsert?: (value: T) => any): number { return this._insert(value, onInsert); }\r\n\r\n /**\r\n * Removes the first occurrence of a value comparing equal to the specified value from the array.\r\n * @param value The value of the element to delete\r\n * @returns the index of the deleted value, or -1 if no such element exists.\r\n */\r\n public remove(value: T): number { return this._remove(value); }\r\n\r\n /** The equivalent of [Array.slice](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice). */\r\n public override slice(start?: number, end?: number): SortedArray<T> {\r\n const slice = new SortedArray<T>(this._compare, this._duplicatePolicy, this._clone);\r\n slice._array = this._array.slice(start, end);\r\n return slice;\r\n }\r\n}\r\n"]}
@@ -7,7 +7,8 @@
7
7
  * @module Utils
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.base64StringToUint8Array = exports.utf8ToString = void 0;
10
+ exports.utf8ToString = utf8ToString;
11
+ exports.base64StringToUint8Array = base64StringToUint8Array;
11
12
  /** Given an array of bytes containing a utf-8 string, convert to a string.
12
13
  * @param utf8: An array of utf-8 characters as a byte array
13
14
  * @returns An equivalent string, or undefined if the array does not contain a valid utf-8 string.
@@ -19,7 +20,6 @@ function utf8ToString(utf8) {
19
20
  const decoder = new TextDecoder("utf-8");
20
21
  return decoder.decode(utf8);
21
22
  }
22
- exports.utf8ToString = utf8ToString;
23
23
  /** Given a base-64-encoded string, decode it into an array of bytes.
24
24
  * @param base64 The base-64-encoded string.
25
25
  * @returns the decoded byte array.
@@ -27,7 +27,6 @@ exports.utf8ToString = utf8ToString;
27
27
  * @public
28
28
  */
29
29
  function base64StringToUint8Array(base64) {
30
- return new Uint8Array(atob(base64).split("").map((c) => c.charCodeAt(0))); // eslint-disable-line deprecation/deprecation
30
+ return new Uint8Array(atob(base64).split("").map((c) => c.charCodeAt(0)));
31
31
  }
32
- exports.base64StringToUint8Array = base64StringToUint8Array;
33
32
  //# sourceMappingURL=StringUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StringUtils.js","sourceRoot":"","sources":["../../src/StringUtils.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH;;;;;;GAMG;AACH,SAAgB,YAAY,CAAC,IAAgB;IAC3C,MAAM,OAAO,GAAG,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC;IACzC,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC;AAHD,oCAGC;AAED;;;;;GAKG;AACH,SAAgB,wBAAwB,CAAC,MAAc;IACrD,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,8CAA8C;AAC3H,CAAC;AAFD,4DAEC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Utils\r\n */\r\n\r\n/** Given an array of bytes containing a utf-8 string, convert to a string.\r\n * @param utf8: An array of utf-8 characters as a byte array\r\n * @returns An equivalent string, or undefined if the array does not contain a valid utf-8 string.\r\n * @note This function uses Javascript's TextDecoder if supported by the browser; otherwise, it\r\n * falls back to a less efficient polyfill.\r\n * @public\r\n */\r\nexport function utf8ToString(utf8: Uint8Array): string | undefined {\r\n const decoder = new TextDecoder(\"utf-8\");\r\n return decoder.decode(utf8);\r\n}\r\n\r\n/** Given a base-64-encoded string, decode it into an array of bytes.\r\n * @param base64 The base-64-encoded string.\r\n * @returns the decoded byte array.\r\n * @throws DOMException if the length of the input string is not a multiple of 4.\r\n * @public\r\n */\r\nexport function base64StringToUint8Array(base64: string): Uint8Array {\r\n return new Uint8Array(atob(base64).split(\"\").map((c) => c.charCodeAt(0))); // eslint-disable-line deprecation/deprecation\r\n}\r\n"]}
1
+ {"version":3,"file":"StringUtils.js","sourceRoot":"","sources":["../../src/StringUtils.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;AASH,oCAGC;AAQD,4DAEC;AApBD;;;;;;GAMG;AACH,SAAgB,YAAY,CAAC,IAAgB;IAC3C,MAAM,OAAO,GAAG,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC;IACzC,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC;AAED;;;;;GAKG;AACH,SAAgB,wBAAwB,CAAC,MAAc;IACrD,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5E,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Utils\r\n */\r\n\r\n/** Given an array of bytes containing a utf-8 string, convert to a string.\r\n * @param utf8: An array of utf-8 characters as a byte array\r\n * @returns An equivalent string, or undefined if the array does not contain a valid utf-8 string.\r\n * @note This function uses Javascript's TextDecoder if supported by the browser; otherwise, it\r\n * falls back to a less efficient polyfill.\r\n * @public\r\n */\r\nexport function utf8ToString(utf8: Uint8Array): string | undefined {\r\n const decoder = new TextDecoder(\"utf-8\");\r\n return decoder.decode(utf8);\r\n}\r\n\r\n/** Given a base-64-encoded string, decode it into an array of bytes.\r\n * @param base64 The base-64-encoded string.\r\n * @returns the decoded byte array.\r\n * @throws DOMException if the length of the input string is not a multiple of 4.\r\n * @public\r\n */\r\nexport function base64StringToUint8Array(base64: string): Uint8Array {\r\n return new Uint8Array(atob(base64).split(\"\").map((c) => c.charCodeAt(0)));\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Time.d.ts","sourceRoot":"","sources":["../../src/Time.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;;GAGG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;IACvC,OAAO;IAEP,mCAAmC;IACnC,IAAW,YAAY,WAAiC;IACxD,IAAW,OAAO,WAAwC;IAE1D;;OAEG;WACW,WAAW,CAAC,OAAO,EAAE,MAAM;IACzC;;OAEG;WACW,gBAAgB,CAAC,YAAY,EAAE,MAAM;IACnD,qDAAqD;IACrD,IAAW,MAAM,YAAuC;IACxD,8DAA8D;IAC9D,IAAW,eAAe,IAAI,OAAO,CAAmC;IACxE,4DAA4D;IAC5D,IAAW,aAAa,IAAI,OAAO,CAAmC;IACtE,8EAA8E;IACvE,KAAK,CAAC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