@ccheever/exact-ibex-runtime 0.1.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 (161) hide show
  1. package/package.json +63 -0
  2. package/src/abort/AbortController.ts +23 -0
  3. package/src/abort/AbortSignal.ts +152 -0
  4. package/src/abort/index.ts +2 -0
  5. package/src/accessibility.ts +12 -0
  6. package/src/arraybuffer-detach.ts +109 -0
  7. package/src/base64/base64.ts +168 -0
  8. package/src/base64/index.ts +1 -0
  9. package/src/blob/Blob.ts +259 -0
  10. package/src/blob/File.ts +59 -0
  11. package/src/blob/FormData.ts +323 -0
  12. package/src/blob/index.ts +3 -0
  13. package/src/bootstrap.ts +1946 -0
  14. package/src/broadcast/BroadcastChannel.ts +280 -0
  15. package/src/broadcast/index.ts +5 -0
  16. package/src/cache/Cache.ts +349 -0
  17. package/src/cache/CacheStorage.ts +89 -0
  18. package/src/cache/index.ts +27 -0
  19. package/src/camera/index.ts +6202 -0
  20. package/src/camera/processor.worker.ts +194 -0
  21. package/src/camera/scene.ts +195 -0
  22. package/src/clipboard/Clipboard.ts +129 -0
  23. package/src/clipboard/ClipboardItem.ts +97 -0
  24. package/src/clipboard/index.ts +6 -0
  25. package/src/clone/index.ts +1 -0
  26. package/src/clone/structuredClone.ts +389 -0
  27. package/src/clone/transferableSymbols.ts +2 -0
  28. package/src/compression/CompressionStream.ts +146 -0
  29. package/src/compression/DecompressionStream.ts +342 -0
  30. package/src/compression/index.ts +4 -0
  31. package/src/console/Console.ts +341 -0
  32. package/src/console/index.ts +2 -0
  33. package/src/core/accessibility-state.ts +263 -0
  34. package/src/core/accessibility.ts +184 -0
  35. package/src/core/agent-state.ts +37 -0
  36. package/src/core/diagnostics-logs.ts +144 -0
  37. package/src/core/host-call-bridge.ts +16 -0
  38. package/src/core/i18n-helpers.ts +189 -0
  39. package/src/core/locale-state.ts +253 -0
  40. package/src/core/locale.ts +95 -0
  41. package/src/crypto/Crypto.ts +2743 -0
  42. package/src/crypto/index.ts +1 -0
  43. package/src/diagnostics/logs.ts +7 -0
  44. package/src/encoding/TextDecoder.ts +1181 -0
  45. package/src/encoding/TextDecoderStream.ts +58 -0
  46. package/src/encoding/TextEncoder.ts +180 -0
  47. package/src/encoding/TextEncoderStream.ts +39 -0
  48. package/src/encoding/index.ts +8 -0
  49. package/src/events/CloseEvent.ts +91 -0
  50. package/src/events/DOMException.ts +409 -0
  51. package/src/events/ErrorEvent.ts +39 -0
  52. package/src/events/Event.ts +151 -0
  53. package/src/events/EventTarget.ts +280 -0
  54. package/src/events/FocusEvent.ts +27 -0
  55. package/src/events/KeyboardEvent.ts +46 -0
  56. package/src/events/MessageEvent.ts +61 -0
  57. package/src/events/ProgressEvent.ts +33 -0
  58. package/src/events/PromiseRejectionEvent.ts +31 -0
  59. package/src/events/index.ts +52 -0
  60. package/src/eventsource/EventSource.ts +371 -0
  61. package/src/eventsource/index.ts +2 -0
  62. package/src/fetch/Headers.ts +642 -0
  63. package/src/fetch/Request.ts +760 -0
  64. package/src/fetch/Response.ts +543 -0
  65. package/src/fetch/body.ts +1256 -0
  66. package/src/fetch/cookie-jar.ts +566 -0
  67. package/src/fetch/demo.ts +207 -0
  68. package/src/fetch/errors.ts +101 -0
  69. package/src/fetch/fetch.ts +2610 -0
  70. package/src/fetch/index.ts +101 -0
  71. package/src/fetch/native-bridge.ts +65 -0
  72. package/src/fetch/types.ts +258 -0
  73. package/src/filereader/FileReader.ts +236 -0
  74. package/src/filereader/index.ts +1 -0
  75. package/src/fs/Dirent.ts +39 -0
  76. package/src/fs/ExactFile.ts +450 -0
  77. package/src/fs/Stats.ts +80 -0
  78. package/src/fs/index.ts +944 -0
  79. package/src/fs/promises.ts +386 -0
  80. package/src/fs/shared.ts +328 -0
  81. package/src/http-server/index.js +697 -0
  82. package/src/http-server/index.ts +27 -0
  83. package/src/identity.generated.ts +14 -0
  84. package/src/index.ts +283 -0
  85. package/src/indexeddb/IDBCursor.ts +188 -0
  86. package/src/indexeddb/IDBDatabase.ts +343 -0
  87. package/src/indexeddb/IDBFactory.ts +269 -0
  88. package/src/indexeddb/IDBIndex.ts +194 -0
  89. package/src/indexeddb/IDBKeyRange.ts +109 -0
  90. package/src/indexeddb/IDBObjectStore.ts +468 -0
  91. package/src/indexeddb/IDBRequest.ts +163 -0
  92. package/src/indexeddb/IDBTransaction.ts +207 -0
  93. package/src/indexeddb/index.ts +34 -0
  94. package/src/indexeddb/utils.ts +52 -0
  95. package/src/inspect/index.ts +1 -0
  96. package/src/inspect/inspect.ts +465 -0
  97. package/src/internal/detect.ts +104 -0
  98. package/src/locale.ts +10 -0
  99. package/src/location/index.ts +1059 -0
  100. package/src/locks/LockManager.ts +460 -0
  101. package/src/locks/index.ts +12 -0
  102. package/src/media/VideoFrame.ts +58 -0
  103. package/src/messaging/MessageChannel.ts +31 -0
  104. package/src/messaging/MessagePort.ts +180 -0
  105. package/src/messaging/index.ts +2 -0
  106. package/src/messaging.ts +247 -0
  107. package/src/native/NativeModules.ts +354 -0
  108. package/src/native/index.ts +1 -0
  109. package/src/navigator/Navigator.ts +351 -0
  110. package/src/navigator/index.ts +1 -0
  111. package/src/node/Buffer.ts +1786 -0
  112. package/src/node/index.ts +4 -0
  113. package/src/node/path.ts +495 -0
  114. package/src/node/process.ts +2528 -0
  115. package/src/performance/Performance.ts +532 -0
  116. package/src/performance/index.ts +21 -0
  117. package/src/polyfills/array.ts +236 -0
  118. package/src/polyfills/arraybuffer.ts +172 -0
  119. package/src/polyfills/groupby.ts +85 -0
  120. package/src/polyfills/index.ts +85 -0
  121. package/src/polyfills/intl.ts +1956 -0
  122. package/src/polyfills/iterator.ts +479 -0
  123. package/src/polyfills/promise.ts +37 -0
  124. package/src/polyfills/set.ts +245 -0
  125. package/src/polyfills/string.ts +85 -0
  126. package/src/polyfills/typedarray.ts +110 -0
  127. package/src/promise-rejection-tracking.ts +464 -0
  128. package/src/react-native/index.ts +388 -0
  129. package/src/runtime-entry.ts +55 -0
  130. package/src/scheduling/AnimationFrame.ts +105 -0
  131. package/src/scheduling/IdleCallback.ts +167 -0
  132. package/src/scheduling/index.ts +13 -0
  133. package/src/security/Capabilities.ts +1146 -0
  134. package/src/security/Permissions.ts +392 -0
  135. package/src/security/capability-bits.generated.ts +63 -0
  136. package/src/security/index.ts +16 -0
  137. package/src/sqlite/Database.ts +456 -0
  138. package/src/sqlite/Statement.ts +206 -0
  139. package/src/sqlite/constants.ts +79 -0
  140. package/src/sqlite/errors.ts +25 -0
  141. package/src/sqlite/index.ts +34 -0
  142. package/src/sqlite/module.js +438 -0
  143. package/src/storage/Storage.ts +291 -0
  144. package/src/storage/StorageManager.ts +91 -0
  145. package/src/storage/index.ts +3 -0
  146. package/src/stream-compat.ts +47 -0
  147. package/src/streams/ReadableStream.ts +4131 -0
  148. package/src/streams/TransformStream.ts +375 -0
  149. package/src/streams/WritableStream.ts +866 -0
  150. package/src/streams/index.ts +41 -0
  151. package/src/timers/Timers.ts +296 -0
  152. package/src/timers/index.ts +11 -0
  153. package/src/url/URL.ts +656 -0
  154. package/src/url/URLPattern.ts +850 -0
  155. package/src/url/URLSearchParams.ts +244 -0
  156. package/src/url/index.ts +9 -0
  157. package/src/websocket/WebSocket.ts +770 -0
  158. package/src/websocket/WebSocketError.ts +52 -0
  159. package/src/websocket/WebSocketStream.ts +628 -0
  160. package/src/websocket/index.ts +7 -0
  161. package/src/window/index.ts +872 -0
@@ -0,0 +1,245 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * ES2025 Set methods polyfills for Hermes engine
4
+ *
5
+ * - Set.prototype.union()
6
+ * - Set.prototype.intersection()
7
+ * - Set.prototype.difference()
8
+ * - Set.prototype.symmetricDifference()
9
+ * - Set.prototype.isSubsetOf()
10
+ * - Set.prototype.isSupersetOf()
11
+ * - Set.prototype.isDisjointFrom()
12
+ */
13
+
14
+ /**
15
+ * Helper: get the size of a Set-like object.
16
+ */
17
+ function getSetLikeSize(other: any): number {
18
+ if (typeof other.size === 'number') return other.size;
19
+ if (typeof other.size === 'function') return other.size();
20
+ throw new TypeError('Set-like object must have a size property');
21
+ }
22
+
23
+ /**
24
+ * Helper: ensure a Set-like has the minimum required interface.
25
+ */
26
+ function requireSetLike(other: any): void {
27
+ if (other == null || typeof other !== 'object') {
28
+ throw new TypeError('The argument must be a Set-like object');
29
+ }
30
+ if (typeof other.has !== 'function') {
31
+ throw new TypeError('Set-like object must have a has method');
32
+ }
33
+ }
34
+
35
+ export function installSetPolyfills(): void {
36
+ // --------------------------------------------------------------------------
37
+ // Set.prototype.union
38
+ // Returns a new Set containing all elements from both this and other.
39
+ // --------------------------------------------------------------------------
40
+ if (typeof Set.prototype.union !== 'function') {
41
+ Object.defineProperty(Set.prototype, 'union', {
42
+ value: function union<T>(this: Set<T>, other: Set<T>): Set<T> {
43
+ requireSetLike(other);
44
+ const result = new Set<T>(this);
45
+ if (typeof other[Symbol.iterator] === 'function') {
46
+ for (const value of other) {
47
+ result.add(value);
48
+ }
49
+ } else if (typeof other.forEach === 'function') {
50
+ other.forEach((value: T) => result.add(value));
51
+ } else {
52
+ throw new TypeError('Set-like object must be iterable or have forEach');
53
+ }
54
+ return result;
55
+ },
56
+ writable: true,
57
+ enumerable: false,
58
+ configurable: true,
59
+ });
60
+ }
61
+
62
+ // --------------------------------------------------------------------------
63
+ // Set.prototype.intersection
64
+ // Returns a new Set containing elements present in both this and other.
65
+ // --------------------------------------------------------------------------
66
+ if (typeof Set.prototype.intersection !== 'function') {
67
+ Object.defineProperty(Set.prototype, 'intersection', {
68
+ value: function intersection<T>(this: Set<T>, other: Set<T>): Set<T> {
69
+ requireSetLike(other);
70
+ const result = new Set<T>();
71
+ const otherSize = getSetLikeSize(other);
72
+
73
+ // Iterate the smaller set for performance
74
+ if (this.size <= otherSize) {
75
+ for (const value of this) {
76
+ if (other.has(value)) {
77
+ result.add(value);
78
+ }
79
+ }
80
+ } else {
81
+ if (typeof other[Symbol.iterator] === 'function') {
82
+ for (const value of other) {
83
+ if (this.has(value)) {
84
+ result.add(value);
85
+ }
86
+ }
87
+ } else if (typeof other.forEach === 'function') {
88
+ other.forEach((value: T) => {
89
+ if (this.has(value)) {
90
+ result.add(value);
91
+ }
92
+ });
93
+ }
94
+ }
95
+
96
+ return result;
97
+ },
98
+ writable: true,
99
+ enumerable: false,
100
+ configurable: true,
101
+ });
102
+ }
103
+
104
+ // --------------------------------------------------------------------------
105
+ // Set.prototype.difference
106
+ // Returns a new Set containing elements in this but not in other.
107
+ // --------------------------------------------------------------------------
108
+ if (typeof Set.prototype.difference !== 'function') {
109
+ Object.defineProperty(Set.prototype, 'difference', {
110
+ value: function difference<T>(this: Set<T>, other: Set<T>): Set<T> {
111
+ requireSetLike(other);
112
+ const result = new Set<T>();
113
+ for (const value of this) {
114
+ if (!other.has(value)) {
115
+ result.add(value);
116
+ }
117
+ }
118
+ return result;
119
+ },
120
+ writable: true,
121
+ enumerable: false,
122
+ configurable: true,
123
+ });
124
+ }
125
+
126
+ // --------------------------------------------------------------------------
127
+ // Set.prototype.symmetricDifference
128
+ // Returns a new Set containing elements in either this or other, but not both.
129
+ // --------------------------------------------------------------------------
130
+ if (typeof Set.prototype.symmetricDifference !== 'function') {
131
+ Object.defineProperty(Set.prototype, 'symmetricDifference', {
132
+ value: function symmetricDifference<T>(this: Set<T>, other: Set<T>): Set<T> {
133
+ requireSetLike(other);
134
+ const result = new Set<T>(this);
135
+ if (typeof other[Symbol.iterator] === 'function') {
136
+ for (const value of other) {
137
+ if (result.has(value)) {
138
+ result.delete(value);
139
+ } else {
140
+ result.add(value);
141
+ }
142
+ }
143
+ } else if (typeof other.forEach === 'function') {
144
+ other.forEach((value: T) => {
145
+ if (result.has(value)) {
146
+ result.delete(value);
147
+ } else {
148
+ result.add(value);
149
+ }
150
+ });
151
+ }
152
+ return result;
153
+ },
154
+ writable: true,
155
+ enumerable: false,
156
+ configurable: true,
157
+ });
158
+ }
159
+
160
+ // --------------------------------------------------------------------------
161
+ // Set.prototype.isSubsetOf
162
+ // Returns true if every element of this is in other.
163
+ // --------------------------------------------------------------------------
164
+ if (typeof Set.prototype.isSubsetOf !== 'function') {
165
+ Object.defineProperty(Set.prototype, 'isSubsetOf', {
166
+ value: function isSubsetOf<T>(this: Set<T>, other: Set<T>): boolean {
167
+ requireSetLike(other);
168
+ const otherSize = getSetLikeSize(other);
169
+ if (this.size > otherSize) return false;
170
+ for (const value of this) {
171
+ if (!other.has(value)) return false;
172
+ }
173
+ return true;
174
+ },
175
+ writable: true,
176
+ enumerable: false,
177
+ configurable: true,
178
+ });
179
+ }
180
+
181
+ // --------------------------------------------------------------------------
182
+ // Set.prototype.isSupersetOf
183
+ // Returns true if every element of other is in this.
184
+ // --------------------------------------------------------------------------
185
+ if (typeof Set.prototype.isSupersetOf !== 'function') {
186
+ Object.defineProperty(Set.prototype, 'isSupersetOf', {
187
+ value: function isSupersetOf<T>(this: Set<T>, other: Set<T>): boolean {
188
+ requireSetLike(other);
189
+ const otherSize = getSetLikeSize(other);
190
+ if (this.size < otherSize) return false;
191
+ if (typeof other[Symbol.iterator] === 'function') {
192
+ for (const value of other) {
193
+ if (!this.has(value)) return false;
194
+ }
195
+ } else if (typeof other.forEach === 'function') {
196
+ let allPresent = true;
197
+ other.forEach((value: T) => {
198
+ if (!this.has(value)) allPresent = false;
199
+ });
200
+ return allPresent;
201
+ }
202
+ return true;
203
+ },
204
+ writable: true,
205
+ enumerable: false,
206
+ configurable: true,
207
+ });
208
+ }
209
+
210
+ // --------------------------------------------------------------------------
211
+ // Set.prototype.isDisjointFrom
212
+ // Returns true if this and other have no elements in common.
213
+ // --------------------------------------------------------------------------
214
+ if (typeof Set.prototype.isDisjointFrom !== 'function') {
215
+ Object.defineProperty(Set.prototype, 'isDisjointFrom', {
216
+ value: function isDisjointFrom<T>(this: Set<T>, other: Set<T>): boolean {
217
+ requireSetLike(other);
218
+ const otherSize = getSetLikeSize(other);
219
+
220
+ // Iterate the smaller set
221
+ if (this.size <= otherSize) {
222
+ for (const value of this) {
223
+ if (other.has(value)) return false;
224
+ }
225
+ } else {
226
+ if (typeof other[Symbol.iterator] === 'function') {
227
+ for (const value of other) {
228
+ if (this.has(value)) return false;
229
+ }
230
+ } else if (typeof other.forEach === 'function') {
231
+ let disjoint = true;
232
+ other.forEach((value: T) => {
233
+ if (this.has(value)) disjoint = false;
234
+ });
235
+ return disjoint;
236
+ }
237
+ }
238
+ return true;
239
+ },
240
+ writable: true,
241
+ enumerable: false,
242
+ configurable: true,
243
+ });
244
+ }
245
+ }
@@ -0,0 +1,85 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * ES2024 String well-formed polyfills for Hermes engine
4
+ *
5
+ * - String.prototype.isWellFormed()
6
+ * - String.prototype.toWellFormed()
7
+ */
8
+
9
+ export function installStringPolyfills(): void {
10
+ // --------------------------------------------------------------------------
11
+ // String.prototype.isWellFormed (ES2024)
12
+ // Returns true if the string contains no lone surrogates.
13
+ // A lone surrogate is a code unit in the range 0xD800-0xDBFF (high surrogate)
14
+ // not followed by 0xDC00-0xDFFF (low surrogate), or a low surrogate not
15
+ // preceded by a high surrogate.
16
+ // --------------------------------------------------------------------------
17
+ if (typeof String.prototype.isWellFormed !== 'function') {
18
+ Object.defineProperty(String.prototype, 'isWellFormed', {
19
+ value: function isWellFormed(this: string): boolean {
20
+ if (this == null) {
21
+ throw new TypeError('String.prototype.isWellFormed called on null or undefined');
22
+ }
23
+ const str = String(this);
24
+ for (let i = 0; i < str.length; i++) {
25
+ const code = str.charCodeAt(i);
26
+ // High surrogate
27
+ if (code >= 0xD800 && code <= 0xDBFF) {
28
+ const next = str.charCodeAt(i + 1);
29
+ // Must be followed by a low surrogate
30
+ if (next < 0xDC00 || next > 0xDFFF || i + 1 >= str.length) {
31
+ return false;
32
+ }
33
+ i++; // Skip the low surrogate
34
+ } else if (code >= 0xDC00 && code <= 0xDFFF) {
35
+ // Lone low surrogate
36
+ return false;
37
+ }
38
+ }
39
+ return true;
40
+ },
41
+ writable: true,
42
+ enumerable: false,
43
+ configurable: true,
44
+ });
45
+ }
46
+
47
+ // --------------------------------------------------------------------------
48
+ // String.prototype.toWellFormed (ES2024)
49
+ // Returns a new string with lone surrogates replaced by U+FFFD.
50
+ // --------------------------------------------------------------------------
51
+ if (typeof String.prototype.toWellFormed !== 'function') {
52
+ Object.defineProperty(String.prototype, 'toWellFormed', {
53
+ value: function toWellFormed(this: string): string {
54
+ if (this == null) {
55
+ throw new TypeError('String.prototype.toWellFormed called on null or undefined');
56
+ }
57
+ const str = String(this);
58
+ const result: string[] = [];
59
+ for (let i = 0; i < str.length; i++) {
60
+ const code = str.charCodeAt(i);
61
+ if (code >= 0xD800 && code <= 0xDBFF) {
62
+ const next = str.charCodeAt(i + 1);
63
+ if (next >= 0xDC00 && next <= 0xDFFF && i + 1 < str.length) {
64
+ // Valid surrogate pair
65
+ result.push(str[i], str[i + 1]);
66
+ i++;
67
+ } else {
68
+ // Lone high surrogate
69
+ result.push('\uFFFD');
70
+ }
71
+ } else if (code >= 0xDC00 && code <= 0xDFFF) {
72
+ // Lone low surrogate
73
+ result.push('\uFFFD');
74
+ } else {
75
+ result.push(str[i]);
76
+ }
77
+ }
78
+ return result.join('');
79
+ },
80
+ writable: true,
81
+ enumerable: false,
82
+ configurable: true,
83
+ });
84
+ }
85
+ }
@@ -0,0 +1,110 @@
1
+ function normalizeTypedArrayIndex(index: number | undefined, length: number): number {
2
+ if (index === undefined) {
3
+ return 0;
4
+ }
5
+
6
+ let value = Number(index);
7
+ if (!Number.isFinite(value) || value === 0) {
8
+ return 0;
9
+ }
10
+
11
+ value = value < 0 ? Math.ceil(value) : Math.floor(value);
12
+ if (value < 0) {
13
+ return Math.max(length + value, 0);
14
+ }
15
+ return Math.min(value, length);
16
+ }
17
+
18
+ export function installTypedArrayPolyfills(): void {
19
+ const typedArrayNames = [
20
+ 'Int8Array',
21
+ 'Uint8Array',
22
+ 'Uint8ClampedArray',
23
+ 'Int16Array',
24
+ 'Uint16Array',
25
+ 'Int32Array',
26
+ 'Uint32Array',
27
+ 'Float32Array',
28
+ 'Float64Array',
29
+ ];
30
+ if (typeof (globalThis as any).BigInt64Array === 'function') {
31
+ typedArrayNames.push('BigInt64Array');
32
+ }
33
+ if (typeof (globalThis as any).BigUint64Array === 'function') {
34
+ typedArrayNames.push('BigUint64Array');
35
+ }
36
+
37
+ for (const ctorName of typedArrayNames) {
38
+ const TypedArrayCtor = (globalThis as any)[ctorName] as
39
+ | {
40
+ prototype: { subarray?: (begin?: number, end?: number) => ArrayBufferView };
41
+ BYTES_PER_ELEMENT?: number;
42
+ }
43
+ | undefined;
44
+ if (!TypedArrayCtor || typeof TypedArrayCtor.prototype?.subarray !== 'function') {
45
+ continue;
46
+ }
47
+
48
+ const originalSubarray = TypedArrayCtor.prototype.subarray as typeof Uint8Array.prototype.subarray & {
49
+ __exactZeroLengthWrapped?: boolean;
50
+ };
51
+ if (originalSubarray.__exactZeroLengthWrapped) {
52
+ continue;
53
+ }
54
+
55
+ const bytesPerElement =
56
+ TypedArrayCtor.BYTES_PER_ELEMENT ??
57
+ (TypedArrayCtor.prototype as { BYTES_PER_ELEMENT?: number }).BYTES_PER_ELEMENT ??
58
+ 1;
59
+
60
+ const patchedSubarray = function (
61
+ this: { buffer: ArrayBufferLike; byteOffset: number; byteLength: number; length?: number },
62
+ begin?: number,
63
+ end?: number
64
+ ): ArrayBufferView {
65
+ const result = originalSubarray.call(this as any, begin, end);
66
+ if (
67
+ result.byteLength !== 0 ||
68
+ result.buffer !== this.buffer ||
69
+ !(this.buffer instanceof ArrayBuffer)
70
+ ) {
71
+ return result;
72
+ }
73
+
74
+ const length = typeof this.length === 'number'
75
+ ? this.length
76
+ : Math.floor(this.byteLength / bytesPerElement);
77
+ const start = normalizeTypedArrayIndex(begin, length);
78
+ const finish = end === undefined ? length : normalizeTypedArrayIndex(end, length);
79
+ if (finish !== start) {
80
+ return result;
81
+ }
82
+
83
+ const correctedByteOffset = this.byteOffset + start * bytesPerElement;
84
+ try {
85
+ Object.defineProperty(result, 'byteOffset', {
86
+ value: correctedByteOffset,
87
+ configurable: true,
88
+ });
89
+ return result;
90
+ } catch (_error) {
91
+ return new (TypedArrayCtor as any)(
92
+ this.buffer,
93
+ correctedByteOffset,
94
+ 0
95
+ );
96
+ }
97
+ };
98
+
99
+ Object.defineProperty(patchedSubarray, '__exactZeroLengthWrapped', {
100
+ value: true,
101
+ configurable: true,
102
+ });
103
+ Object.defineProperty(TypedArrayCtor.prototype, 'subarray', {
104
+ value: patchedSubarray,
105
+ writable: true,
106
+ enumerable: false,
107
+ configurable: true,
108
+ });
109
+ }
110
+ }