@multiplatform.one/test-utils 7.83.1 → 7.84.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.
@@ -0,0 +1,957 @@
1
+ "use strict";
2
+
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key3 of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key3) && key3 !== except) __defProp(to, key3, {
12
+ get: () => from[key3],
13
+ enumerable: !(desc = __getOwnPropDesc(from, key3)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
19
+ // If the importer is in node compatibility mode or this is not an ESM
20
+ // file that has been converted to a CommonJS file using a Babel-
21
+ // compatible transform (i.e. "__esModule" has not been set), then set
22
+ // "default" to the CommonJS "module.exports" for node compatibility.
23
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
24
+ value: mod,
25
+ enumerable: true
26
+ }) : target, mod));
27
+ var import_jest_dom = require("@testing-library/jest-dom");
28
+ var import_matchmedia_polyfill = require("matchmedia-polyfill");
29
+ var import_config = require("@tamagui/config");
30
+ var import_react = require("@testing-library/react");
31
+ var import_tamagui = require("tamagui");
32
+ var import_vitest = require("vitest");
33
+ var import_frames = require("./frames.native.js");
34
+ function _assert_this_initialized(self1) {
35
+ if (self1 === void 0) {
36
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
37
+ }
38
+ return self1;
39
+ }
40
+ function _call_super(_this, derived, args) {
41
+ derived = _get_prototype_of(derived);
42
+ return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
43
+ }
44
+ function _class_call_check(instance, Constructor) {
45
+ if (!(instance instanceof Constructor)) {
46
+ throw new TypeError("Cannot call a class as a function");
47
+ }
48
+ }
49
+ function _construct(Parent, args, Class) {
50
+ if (_is_native_reflect_construct()) {
51
+ _construct = Reflect.construct;
52
+ } else {
53
+ _construct = function construct(Parent2, args2, Class2) {
54
+ var a = [null];
55
+ a.push.apply(a, args2);
56
+ var Constructor = Function.bind.apply(Parent2, a);
57
+ var instance = new Constructor();
58
+ if (Class2) _set_prototype_of(instance, Class2.prototype);
59
+ return instance;
60
+ };
61
+ }
62
+ return _construct.apply(null, arguments);
63
+ }
64
+ function _defineProperties(target, props) {
65
+ for (var i = 0; i < props.length; i++) {
66
+ var descriptor = props[i];
67
+ descriptor.enumerable = descriptor.enumerable || false;
68
+ descriptor.configurable = true;
69
+ if ("value" in descriptor) descriptor.writable = true;
70
+ Object.defineProperty(target, descriptor.key, descriptor);
71
+ }
72
+ }
73
+ function _create_class(Constructor, protoProps, staticProps) {
74
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
75
+ if (staticProps) _defineProperties(Constructor, staticProps);
76
+ return Constructor;
77
+ }
78
+ function _define_property(obj, key3, value) {
79
+ if (key3 in obj) {
80
+ Object.defineProperty(obj, key3, {
81
+ value,
82
+ enumerable: true,
83
+ configurable: true,
84
+ writable: true
85
+ });
86
+ } else {
87
+ obj[key3] = value;
88
+ }
89
+ return obj;
90
+ }
91
+ function _get_prototype_of(o) {
92
+ _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o2) {
93
+ return o2.__proto__ || Object.getPrototypeOf(o2);
94
+ };
95
+ return _get_prototype_of(o);
96
+ }
97
+ function _inherits(subClass, superClass) {
98
+ if (typeof superClass !== "function" && superClass !== null) {
99
+ throw new TypeError("Super expression must either be null or a function");
100
+ }
101
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
102
+ constructor: {
103
+ value: subClass,
104
+ writable: true,
105
+ configurable: true
106
+ }
107
+ });
108
+ if (superClass) _set_prototype_of(subClass, superClass);
109
+ }
110
+ function _instanceof(left, right) {
111
+ "@swc/helpers - instanceof";
112
+
113
+ if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
114
+ return !!right[Symbol.hasInstance](left);
115
+ } else {
116
+ return left instanceof right;
117
+ }
118
+ }
119
+ function _is_native_function(fn) {
120
+ return Function.toString.call(fn).indexOf("[native code]") !== -1;
121
+ }
122
+ function _possible_constructor_return(self1, call) {
123
+ if (call && (_type_of(call) === "object" || typeof call === "function")) {
124
+ return call;
125
+ }
126
+ return _assert_this_initialized(self1);
127
+ }
128
+ function _set_prototype_of(o, p) {
129
+ _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o2, p2) {
130
+ o2.__proto__ = p2;
131
+ return o2;
132
+ };
133
+ return _set_prototype_of(o, p);
134
+ }
135
+ function _type_of(obj) {
136
+ "@swc/helpers - typeof";
137
+
138
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
139
+ }
140
+ function _wrap_native_super(Class) {
141
+ var _cache = typeof Map === "function" ? /* @__PURE__ */new Map() : void 0;
142
+ _wrap_native_super = function wrapNativeSuper(Class2) {
143
+ if (Class2 === null || !_is_native_function(Class2)) return Class2;
144
+ if (typeof Class2 !== "function") {
145
+ throw new TypeError("Super expression must either be null or a function");
146
+ }
147
+ if (typeof _cache !== "undefined") {
148
+ if (_cache.has(Class2)) return _cache.get(Class2);
149
+ _cache.set(Class2, Wrapper);
150
+ }
151
+ function Wrapper() {
152
+ return _construct(Class2, arguments, _get_prototype_of(this).constructor);
153
+ }
154
+ Wrapper.prototype = Object.create(Class2.prototype, {
155
+ constructor: {
156
+ value: Wrapper,
157
+ enumerable: false,
158
+ writable: true,
159
+ configurable: true
160
+ }
161
+ });
162
+ return _set_prototype_of(Wrapper, Class2);
163
+ };
164
+ return _wrap_native_super(Class);
165
+ }
166
+ function _is_native_reflect_construct() {
167
+ try {
168
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
169
+ } catch (_) {}
170
+ return (_is_native_reflect_construct = function () {
171
+ return !!result;
172
+ })();
173
+ }
174
+ var _noopStorage = {
175
+ getItem: function getItem() {
176
+ return null;
177
+ },
178
+ setItem: function setItem() {},
179
+ removeItem: function removeItem() {},
180
+ clear: function clear() {},
181
+ get length() {
182
+ return 0;
183
+ },
184
+ key: function key() {
185
+ return null;
186
+ }
187
+ };
188
+ if (typeof globalThis !== "undefined" && typeof globalThis.localStorage === "undefined") {
189
+ Object.defineProperty(globalThis, "localStorage", {
190
+ value: _noopStorage,
191
+ writable: true
192
+ });
193
+ }
194
+ if (typeof global !== "undefined" && !("localStorage" in global)) {
195
+ Object.defineProperty(global, "localStorage", {
196
+ value: _noopStorage,
197
+ writable: true
198
+ });
199
+ }
200
+ if (typeof window !== "undefined" && typeof document !== "undefined") {
201
+ if (typeof CSSStyleDeclaration !== "undefined" && CSSStyleDeclaration.prototype) {
202
+ for (var i = 0; i <= 64; i++) {
203
+ var key3 = String(i);
204
+ var desc = Object.getOwnPropertyDescriptor(CSSStyleDeclaration.prototype, key3);
205
+ if (!desc || desc.set == null) {
206
+ Object.defineProperty(CSSStyleDeclaration.prototype, key3, {
207
+ configurable: true,
208
+ enumerable: false,
209
+ get() {
210
+ return "";
211
+ },
212
+ set() {}
213
+ });
214
+ }
215
+ }
216
+ }
217
+ if (typeof NodeList !== "undefined" && NodeList.prototype) {
218
+ if (!NodeList.prototype.forEach) {
219
+ NodeList.prototype.forEach = Array.prototype.forEach;
220
+ }
221
+ }
222
+ if (typeof HTMLCollection !== "undefined" && HTMLCollection.prototype) {
223
+ if (!HTMLCollection.prototype.forEach) {
224
+ HTMLCollection.prototype.forEach = Array.prototype.forEach;
225
+ }
226
+ }
227
+ var matchesImpl = function matchesImpl2(selector) {
228
+ if (!this || _type_of(this) !== "object") return false;
229
+ if (this.nodeType === 1) {
230
+ if (this.webkitMatchesSelector) return this.webkitMatchesSelector(selector);
231
+ if (this.mozMatchesSelector) return this.mozMatchesSelector(selector);
232
+ if (this.msMatchesSelector) return this.msMatchesSelector(selector);
233
+ var matches = (this.ownerDocument || document).querySelectorAll(selector);
234
+ var i = matches.length;
235
+ while (--i >= 0 && matches[i] !== this) {}
236
+ return i > -1;
237
+ }
238
+ return false;
239
+ };
240
+ if (Element.prototype && !Element.prototype.matches) {
241
+ Object.defineProperty(Element.prototype, "matches", {
242
+ value: matchesImpl,
243
+ writable: true,
244
+ configurable: true,
245
+ enumerable: false
246
+ });
247
+ }
248
+ if (typeof HTMLElement !== "undefined" && HTMLElement.prototype && !HTMLElement.prototype.matches) {
249
+ Object.defineProperty(HTMLElement.prototype, "matches", {
250
+ value: matchesImpl,
251
+ writable: true,
252
+ configurable: true,
253
+ enumerable: false
254
+ });
255
+ }
256
+ var hasAttributeImpl = function hasAttributeImpl2(name) {
257
+ if (!this || this.nodeType !== 1) return false;
258
+ if (Element.prototype.hasAttribute && _instanceof(this, Element)) {
259
+ return Element.prototype.hasAttribute.call(this, name);
260
+ }
261
+ if (this.attributes) {
262
+ for (var i = 0; i < this.attributes.length; i++) {
263
+ if (this.attributes[i].name === name) return true;
264
+ }
265
+ }
266
+ return false;
267
+ };
268
+ var getAttributeImpl = function getAttributeImpl2(name) {
269
+ if (!this || this.nodeType !== 1) return null;
270
+ if (Element.prototype.getAttribute && _instanceof(this, Element)) {
271
+ return Element.prototype.getAttribute.call(this, name);
272
+ }
273
+ if (this.attributes) {
274
+ for (var i = 0; i < this.attributes.length; i++) {
275
+ if (this.attributes[i].name === name) return this.attributes[i].value;
276
+ }
277
+ }
278
+ return null;
279
+ };
280
+ var nodeTypes = [typeof Node !== "undefined" && Node, typeof Element !== "undefined" && Element, typeof HTMLElement !== "undefined" && HTMLElement, typeof HTMLDivElement !== "undefined" && HTMLDivElement, typeof HTMLSpanElement !== "undefined" && HTMLSpanElement, typeof HTMLInputElement !== "undefined" && HTMLInputElement, typeof HTMLButtonElement !== "undefined" && HTMLButtonElement, typeof HTMLFormElement !== "undefined" && HTMLFormElement, typeof HTMLLabelElement !== "undefined" && HTMLLabelElement, typeof Text !== "undefined" && Text, typeof Comment !== "undefined" && Comment, typeof Document !== "undefined" && Document, typeof DocumentFragment !== "undefined" && DocumentFragment].filter(Boolean);
281
+ var _iteratorNormalCompletion = true,
282
+ _didIteratorError = false,
283
+ _iteratorError = void 0;
284
+ try {
285
+ for (var _iterator = nodeTypes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
286
+ var NodeType = _step.value;
287
+ if (NodeType === null || NodeType === void 0 ? void 0 : NodeType.prototype) {
288
+ if (!NodeType.prototype.hasAttribute) {
289
+ Object.defineProperty(NodeType.prototype, "hasAttribute", {
290
+ value: hasAttributeImpl,
291
+ writable: true,
292
+ configurable: true,
293
+ enumerable: false
294
+ });
295
+ }
296
+ if (!NodeType.prototype.getAttribute) {
297
+ Object.defineProperty(NodeType.prototype, "getAttribute", {
298
+ value: getAttributeImpl,
299
+ writable: true,
300
+ configurable: true,
301
+ enumerable: false
302
+ });
303
+ }
304
+ if (!NodeType.prototype.setAttribute) {
305
+ Object.defineProperty(NodeType.prototype, "setAttribute", {
306
+ value: function value(name, value) {
307
+ if (this.nodeType === 1 && Element.prototype.setAttribute) {
308
+ Element.prototype.setAttribute.call(this, name, value);
309
+ }
310
+ },
311
+ writable: true,
312
+ configurable: true,
313
+ enumerable: false
314
+ });
315
+ }
316
+ }
317
+ }
318
+ } catch (err) {
319
+ _didIteratorError = true;
320
+ _iteratorError = err;
321
+ } finally {
322
+ try {
323
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
324
+ _iterator.return();
325
+ }
326
+ } finally {
327
+ if (_didIteratorError) {
328
+ throw _iteratorError;
329
+ }
330
+ }
331
+ }
332
+ if (typeof HTMLFormElement !== "undefined") {
333
+ Object.defineProperty(HTMLFormElement.prototype, "requestSubmit", {
334
+ value: function value(submitter) {
335
+ if (submitter) {
336
+ if (submitter.type !== "submit") {
337
+ throw new TypeError("The specified element is not a submit button");
338
+ }
339
+ if (submitter.form !== this) {
340
+ throw new DOMException("The specified element is not owned by this form element", "NotFoundError");
341
+ }
342
+ }
343
+ var submitEvent = new Event("submit", {
344
+ bubbles: true,
345
+ cancelable: true
346
+ });
347
+ this.dispatchEvent(submitEvent);
348
+ },
349
+ writable: true,
350
+ configurable: true,
351
+ enumerable: false
352
+ });
353
+ }
354
+ }
355
+ var floatingUiPatched = import("@floating-ui/react/utils").then(function (floatingUiUtils) {
356
+ if (floatingUiUtils === null || floatingUiUtils === void 0 ? void 0 : floatingUiUtils.enableFocusInside) {
357
+ var originalEnableFocusInside = floatingUiUtils.enableFocusInside;
358
+ floatingUiUtils.enableFocusInside = function (container) {
359
+ if (!container || !container.querySelectorAll) return;
360
+ var elements = container.querySelectorAll("[data-tabindex]");
361
+ if (!elements.forEach) {
362
+ elements.forEach = Array.prototype.forEach;
363
+ }
364
+ return originalEnableFocusInside(container);
365
+ };
366
+ }
367
+ }).catch(function () {});
368
+ (0, import_vitest.beforeAll)(function () {
369
+ return floatingUiPatched;
370
+ });
371
+ (0, import_tamagui.createTamagui)(import_config.config);
372
+ var noopStorage = {
373
+ getItem: function getItem2() {
374
+ return null;
375
+ },
376
+ setItem: function setItem2() {},
377
+ removeItem: function removeItem2() {},
378
+ clear: function clear2() {},
379
+ get length() {
380
+ return 0;
381
+ },
382
+ key: function key2() {
383
+ return null;
384
+ }
385
+ };
386
+ import_vitest.vi.stubGlobal("localStorage", noopStorage);
387
+ Object.defineProperty(globalThis, "localStorage", {
388
+ value: noopStorage,
389
+ writable: true
390
+ });
391
+ if (typeof global !== "undefined") {
392
+ Object.defineProperty(global, "localStorage", {
393
+ value: noopStorage,
394
+ writable: true
395
+ });
396
+ }
397
+ if (typeof globalThis !== "undefined" && typeof globalThis.BroadcastChannel === "undefined") {
398
+ globalThis.BroadcastChannel = /* @__PURE__ */function () {
399
+ "use strict";
400
+
401
+ function BroadcastChannelMock(name) {
402
+ _class_call_check(this, BroadcastChannelMock);
403
+ _define_property(this, "name", void 0);
404
+ _define_property(this, "onmessage", null);
405
+ this.name = name;
406
+ }
407
+ _create_class(BroadcastChannelMock, [{
408
+ key: "postMessage",
409
+ value: function postMessage(_message) {}
410
+ }, {
411
+ key: "close",
412
+ value: function close() {}
413
+ }]);
414
+ return BroadcastChannelMock;
415
+ }();
416
+ }
417
+ if (typeof window !== "undefined" && !window.indexedDB) {
418
+ Object.defineProperty(window, "indexedDB", {
419
+ value: {
420
+ open: function open() {
421
+ return {
422
+ onsuccess: null,
423
+ onerror: null,
424
+ onupgradeneeded: null,
425
+ result: null
426
+ };
427
+ },
428
+ deleteDatabase: function deleteDatabase() {
429
+ return {
430
+ onsuccess: null,
431
+ onerror: null
432
+ };
433
+ }
434
+ },
435
+ writable: true
436
+ });
437
+ }
438
+ import_vitest.vi.stubGlobal("fetch", import_vitest.vi.fn(function () {
439
+ return Promise.resolve(new Response(JSON.stringify({
440
+ data: []
441
+ }), {
442
+ status: 200,
443
+ headers: {
444
+ "Content-Type": "application/json"
445
+ }
446
+ }));
447
+ }));
448
+ window.matchMedia = window.matchMedia || function () {
449
+ return {
450
+ matches: false,
451
+ addListener: function addListener() {},
452
+ removeListener: function removeListener() {}
453
+ };
454
+ };
455
+ var animationFrames = (0, import_frames.createAnimationFrames)();
456
+ global.requestAnimationFrame = animationFrames.request;
457
+ global.cancelAnimationFrame = animationFrames.cancel;
458
+ (0, import_vitest.afterAll)(animationFrames.close);
459
+ var MockResizeObserver = /* @__PURE__ */function () {
460
+ "use strict";
461
+
462
+ function MockResizeObserver2() {
463
+ _class_call_check(this, MockResizeObserver2);
464
+ }
465
+ _create_class(MockResizeObserver2, [{
466
+ key: "observe",
467
+ value: function observe() {}
468
+ }, {
469
+ key: "unobserve",
470
+ value: function unobserve() {}
471
+ }, {
472
+ key: "disconnect",
473
+ value: function disconnect() {}
474
+ }]);
475
+ return MockResizeObserver2;
476
+ }();
477
+ window.ResizeObserver = MockResizeObserver;
478
+ var MockIntersectionObserver = /* @__PURE__ */function () {
479
+ "use strict";
480
+
481
+ function MockIntersectionObserver2() {
482
+ _class_call_check(this, MockIntersectionObserver2);
483
+ _define_property(this, "root", null);
484
+ _define_property(this, "rootMargin", "0px");
485
+ _define_property(this, "scrollMargin", "0px");
486
+ _define_property(this, "thresholds", [0]);
487
+ }
488
+ _create_class(MockIntersectionObserver2, [{
489
+ key: "observe",
490
+ value: function observe() {}
491
+ }, {
492
+ key: "unobserve",
493
+ value: function unobserve() {}
494
+ }, {
495
+ key: "disconnect",
496
+ value: function disconnect() {}
497
+ }, {
498
+ key: "takeRecords",
499
+ value: function takeRecords() {
500
+ return [];
501
+ }
502
+ }]);
503
+ return MockIntersectionObserver2;
504
+ }();
505
+ if (typeof window !== "undefined") {
506
+ Object.defineProperty(window, "IntersectionObserver", {
507
+ value: MockIntersectionObserver,
508
+ writable: true,
509
+ configurable: true
510
+ });
511
+ }
512
+ Object.defineProperty(globalThis, "IntersectionObserver", {
513
+ value: MockIntersectionObserver,
514
+ writable: true,
515
+ configurable: true
516
+ });
517
+ if (typeof global !== "undefined") {
518
+ Object.defineProperty(global, "IntersectionObserver", {
519
+ value: MockIntersectionObserver,
520
+ writable: true,
521
+ configurable: true
522
+ });
523
+ }
524
+ if (typeof self !== "undefined") {
525
+ Object.defineProperty(self, "IntersectionObserver", {
526
+ value: MockIntersectionObserver,
527
+ writable: true,
528
+ configurable: true
529
+ });
530
+ }
531
+ if (typeof DataTransfer === "undefined") {
532
+ global.DataTransfer = /* @__PURE__ */function () {
533
+ "use strict";
534
+
535
+ function DataTransfer1() {
536
+ _class_call_check(this, DataTransfer1);
537
+ _define_property(this, "data", void 0);
538
+ this.data = /* @__PURE__ */new Map();
539
+ }
540
+ _create_class(DataTransfer1, [{
541
+ key: "getData",
542
+ value: function getData(format) {
543
+ return this.data.get(format) || "";
544
+ }
545
+ }, {
546
+ key: "setData",
547
+ value: function setData(format, data) {
548
+ this.data.set(format, data);
549
+ }
550
+ }, {
551
+ key: "clearData",
552
+ value: function clearData(format) {
553
+ if (format) {
554
+ this.data.delete(format);
555
+ } else {
556
+ this.data.clear();
557
+ }
558
+ }
559
+ }]);
560
+ return DataTransfer1;
561
+ }();
562
+ }
563
+ if (typeof ClipboardEvent === "undefined") {
564
+ global.ClipboardEvent = /* @__PURE__ */function (Event1) {
565
+ "use strict";
566
+
567
+ _inherits(ClipboardEvent1, Event1);
568
+ function ClipboardEvent1(type, options) {
569
+ _class_call_check(this, ClipboardEvent1);
570
+ var _this;
571
+ _this = _call_super(this, ClipboardEvent1, [type, options]), _define_property(_this, "clipboardData", void 0);
572
+ _this.clipboardData = (options === null || options === void 0 ? void 0 : options.clipboardData) || {
573
+ getData: function getData() {
574
+ return "";
575
+ },
576
+ setData: function setData() {}
577
+ };
578
+ return _this;
579
+ }
580
+ return ClipboardEvent1;
581
+ }(_wrap_native_super(Event));
582
+ }
583
+ var ESBuildAndJSDOMCompatibleTextEncoder = /* @__PURE__ */function (TextEncoder1) {
584
+ "use strict";
585
+
586
+ _inherits(ESBuildAndJSDOMCompatibleTextEncoder2, TextEncoder1);
587
+ function ESBuildAndJSDOMCompatibleTextEncoder2() {
588
+ _class_call_check(this, ESBuildAndJSDOMCompatibleTextEncoder2);
589
+ return _call_super(this, ESBuildAndJSDOMCompatibleTextEncoder2, arguments);
590
+ }
591
+ _create_class(ESBuildAndJSDOMCompatibleTextEncoder2, [{
592
+ key: "encode",
593
+ value: function encode(input) {
594
+ if (typeof input !== "string") throw new TypeError("`input` must be a string");
595
+ var decodedURI = decodeURIComponent(encodeURIComponent(input));
596
+ var arr = new Uint8Array(decodedURI.length);
597
+ var chars = decodedURI.split("");
598
+ for (var i = 0; i < chars.length; i++) {
599
+ arr[i] = (decodedURI[i] || "").charCodeAt(0);
600
+ }
601
+ return arr;
602
+ }
603
+ }]);
604
+ return ESBuildAndJSDOMCompatibleTextEncoder2;
605
+ }(_wrap_native_super(TextEncoder));
606
+ Object.defineProperty(global, "TextEncoder", {
607
+ value: ESBuildAndJSDOMCompatibleTextEncoder,
608
+ writable: true
609
+ });
610
+ import_vitest.vi.mock("@multiplatform.one/theme", async function (importOriginal) {
611
+ var actual = await importOriginal();
612
+ var getSizeClass = actual.getLayoutSizeClass;
613
+ var getPaneBudget = actual.defaultMaxPanes;
614
+ var fallbackWidth = actual.layoutBreakpoints.medium;
615
+ var viewportWidth = function viewportWidth2() {
616
+ return typeof window === "undefined" ? fallbackWidth : window.innerWidth;
617
+ };
618
+ return {
619
+ ...actual,
620
+ // Real useLayoutSizeClass subscribes via matchMedia().addEventListener,
621
+ // which test matchMedia polyfills / per-spec vi.fn mocks routinely lack;
622
+ // resolve from window.innerWidth at render (the same value the real hook
623
+ // computes at mount) through the real getLayoutSizeClass.
624
+ useLayoutSizeClass: function useLayoutSizeClass() {
625
+ return getSizeClass(viewportWidth());
626
+ },
627
+ // Rides useLayoutSizeClass (same matchMedia dependency); derive the pane
628
+ // budget through the real defaultMaxPanes.
629
+ useMultiPane: function useMultiPane(maxPanes) {
630
+ var budget = getPaneBudget(getSizeClass(viewportWidth()));
631
+ return (maxPanes !== null && maxPanes !== void 0 ? maxPanes : budget) >= 2 && budget >= 2;
632
+ },
633
+ // Real tracker installs document-level capture listeners backed by module
634
+ // state, leaking "last input was keyboard" across tests in a file; noop.
635
+ ensureKeyboardModalityTracking: function ensureKeyboardModalityTracking() {},
636
+ // Pin pointer modality so manual focus-ring painting is deterministic.
637
+ wasKeyboardFocus: function wasKeyboardFocus() {
638
+ return false;
639
+ }
640
+ };
641
+ });
642
+ import_vitest.vi.mock("one", function () {
643
+ return {
644
+ default: {},
645
+ SafeAreaView: function SafeAreaView(param) {
646
+ var {
647
+ children
648
+ } = param;
649
+ return children;
650
+ },
651
+ Head: function Head(param) {
652
+ var {
653
+ children
654
+ } = param;
655
+ return children;
656
+ },
657
+ useRouter: function useRouter() {
658
+ return {
659
+ push: import_vitest.vi.fn(),
660
+ replace: import_vitest.vi.fn(),
661
+ back: import_vitest.vi.fn()
662
+ };
663
+ }
664
+ };
665
+ });
666
+ import_vitest.vi.mock("@tamagui/animations-reanimated", function () {
667
+ return {
668
+ createAnimations: function createAnimations(config2) {
669
+ return {
670
+ ...config2,
671
+ View: void 0,
672
+ Text: void 0,
673
+ isReactNative: false,
674
+ animations: config2,
675
+ useAnimatedNumber: function useAnimatedNumber(initial) {
676
+ return {
677
+ value: initial,
678
+ setValue: function setValue() {}
679
+ };
680
+ },
681
+ useAnimatedNumberReaction: function useAnimatedNumberReaction() {},
682
+ useAnimatedNumberStyle: function useAnimatedNumberStyle() {
683
+ return {};
684
+ },
685
+ AnimatedView: function AnimatedView(param) {
686
+ var {
687
+ children
688
+ } = param;
689
+ return children;
690
+ },
691
+ AnimatedText: function AnimatedText(param) {
692
+ var {
693
+ children
694
+ } = param;
695
+ return children;
696
+ }
697
+ };
698
+ }
699
+ };
700
+ });
701
+ import_vitest.vi.mock("react-native-reanimated", function () {
702
+ return {
703
+ default: {
704
+ useSharedValue: function useSharedValue(init) {
705
+ return {
706
+ value: init
707
+ };
708
+ },
709
+ useAnimatedStyle: function useAnimatedStyle() {
710
+ return {};
711
+ },
712
+ withTiming: function withTiming(val) {
713
+ return val;
714
+ },
715
+ withSpring: function withSpring(val) {
716
+ return val;
717
+ },
718
+ withDecay: function withDecay(val) {
719
+ return val;
720
+ },
721
+ withSequence: function withSequence() {
722
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
723
+ args[_key] = arguments[_key];
724
+ }
725
+ return args[args.length - 1];
726
+ },
727
+ withDelay: function withDelay(_, val) {
728
+ return val;
729
+ },
730
+ createAnimatedComponent: function createAnimatedComponent(component) {
731
+ return component;
732
+ },
733
+ useDerivedValue: function useDerivedValue(fn) {
734
+ return {
735
+ value: fn()
736
+ };
737
+ },
738
+ useAnimatedRef: function useAnimatedRef() {
739
+ return {
740
+ current: null
741
+ };
742
+ },
743
+ runOnJS: function runOnJS(fn) {
744
+ return fn;
745
+ },
746
+ runOnUI: function runOnUI(fn) {
747
+ return fn;
748
+ },
749
+ Extrapolation: {
750
+ CLAMP: "clamp"
751
+ },
752
+ Layout: {
753
+ duration: function duration() {
754
+ return {};
755
+ }
756
+ },
757
+ FadeIn: {
758
+ duration: function duration() {
759
+ return {};
760
+ }
761
+ },
762
+ FadeOut: {
763
+ duration: function duration() {
764
+ return {};
765
+ }
766
+ },
767
+ Easing: {
768
+ linear: function linear(v) {
769
+ return v;
770
+ },
771
+ ease: function ease(v) {
772
+ return v;
773
+ },
774
+ bezier: function bezier() {
775
+ return function (v) {
776
+ return v;
777
+ };
778
+ }
779
+ },
780
+ measure: function measure() {
781
+ return null;
782
+ },
783
+ scrollTo: function scrollTo() {},
784
+ makeMutable: function makeMutable(init) {
785
+ return {
786
+ value: init
787
+ };
788
+ }
789
+ },
790
+ useSharedValue: function useSharedValue(init) {
791
+ return {
792
+ value: init
793
+ };
794
+ },
795
+ useAnimatedStyle: function useAnimatedStyle() {
796
+ return {};
797
+ },
798
+ withTiming: function withTiming(val) {
799
+ return val;
800
+ },
801
+ withSpring: function withSpring(val) {
802
+ return val;
803
+ },
804
+ createAnimatedComponent: function createAnimatedComponent(component) {
805
+ return component;
806
+ },
807
+ runOnJS: function runOnJS(fn) {
808
+ return fn;
809
+ },
810
+ runOnUI: function runOnUI(fn) {
811
+ return fn;
812
+ },
813
+ useDerivedValue: function useDerivedValue(fn) {
814
+ return {
815
+ value: fn()
816
+ };
817
+ },
818
+ useAnimatedRef: function useAnimatedRef() {
819
+ return {
820
+ current: null
821
+ };
822
+ },
823
+ Easing: {
824
+ linear: function linear(v) {
825
+ return v;
826
+ },
827
+ ease: function ease(v) {
828
+ return v;
829
+ },
830
+ bezier: function bezier() {
831
+ return function (v) {
832
+ return v;
833
+ };
834
+ }
835
+ },
836
+ FadeIn: {
837
+ duration: function duration() {
838
+ return {};
839
+ }
840
+ },
841
+ FadeOut: {
842
+ duration: function duration() {
843
+ return {};
844
+ }
845
+ },
846
+ Layout: {
847
+ duration: function duration() {
848
+ return {};
849
+ }
850
+ }
851
+ };
852
+ });
853
+ import_vitest.vi.mock("@react-navigation/native", function () {
854
+ return {
855
+ NavigationContainer: function NavigationContainer(param) {
856
+ var {
857
+ children
858
+ } = param;
859
+ return children;
860
+ },
861
+ useNavigation: function useNavigation() {
862
+ return {};
863
+ },
864
+ useRoute: function useRoute() {
865
+ return {};
866
+ },
867
+ useFocusEffect: function useFocusEffect() {}
868
+ };
869
+ });
870
+ if (typeof document !== "undefined") {
871
+ var style = document.createElement("style");
872
+ style.textContent = "html { pointer-events: auto !important; }";
873
+ document.head.appendChild(style);
874
+ }
875
+ var ignoredTestWarnings = ["React does not recognize the `scaleIcon` prop on a DOM element", "React does not recognize the `pressTheme` prop on a DOM element", "React does not recognize the `marginLeft` prop on a DOM element", "Received `true` for a non-boolean attribute `editable`", "non-boolean attribute `editable`", "Received `true` for a non-boolean attribute `elevate`", "Received `true` for a non-boolean attribute `bordered`", "react-i18next:: useTranslation: You will need to pass in an i18next instance"];
876
+ var originalConsoleWarn = console.warn.bind(console);
877
+ var originalConsoleError = console.error.bind(console);
878
+ var shouldIgnoreTestWarning = function shouldIgnoreTestWarning2(args) {
879
+ var message = args.map(function (arg) {
880
+ if (typeof arg === "string") return arg;
881
+ if (_instanceof(arg, Error)) return arg.message;
882
+ return String(arg);
883
+ }).join(" ");
884
+ if (ignoredTestWarnings.some(function (pattern) {
885
+ return message.includes(pattern);
886
+ })) {
887
+ return true;
888
+ }
889
+ var firstArg = typeof args[0] === "string" ? args[0] : "";
890
+ var hasNonBooleanTemplate = firstArg.includes("non-boolean attribute");
891
+ if (hasNonBooleanTemplate) {
892
+ var tokens = args.map(function (arg) {
893
+ return String(arg);
894
+ });
895
+ if (tokens.includes("editable") || tokens.includes("elevate") || tokens.includes("bordered")) {
896
+ return true;
897
+ }
898
+ }
899
+ return false;
900
+ };
901
+ var consoleWarnSpy = null;
902
+ var consoleErrorSpy = null;
903
+ (0, import_vitest.beforeEach)(function () {
904
+ Object.defineProperty(globalThis, "IntersectionObserver", {
905
+ value: MockIntersectionObserver,
906
+ writable: true,
907
+ configurable: true
908
+ });
909
+ if (typeof window !== "undefined") {
910
+ Object.defineProperty(window, "IntersectionObserver", {
911
+ value: MockIntersectionObserver,
912
+ writable: true,
913
+ configurable: true
914
+ });
915
+ }
916
+ if (typeof global !== "undefined") {
917
+ Object.defineProperty(global, "IntersectionObserver", {
918
+ value: MockIntersectionObserver,
919
+ writable: true,
920
+ configurable: true
921
+ });
922
+ }
923
+ consoleWarnSpy = import_vitest.vi.spyOn(console, "warn").mockImplementation(function () {
924
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
925
+ args[_key] = arguments[_key];
926
+ }
927
+ if (shouldIgnoreTestWarning(args)) return;
928
+ originalConsoleWarn(...args);
929
+ });
930
+ consoleErrorSpy = import_vitest.vi.spyOn(console, "error").mockImplementation(function () {
931
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
932
+ args[_key] = arguments[_key];
933
+ }
934
+ if (shouldIgnoreTestWarning(args)) return;
935
+ originalConsoleError(...args);
936
+ });
937
+ });
938
+ (0, import_vitest.afterEach)(function () {
939
+ Object.defineProperty(globalThis, "IntersectionObserver", {
940
+ value: MockIntersectionObserver,
941
+ writable: true,
942
+ configurable: true
943
+ });
944
+ if (typeof window !== "undefined") {
945
+ Object.defineProperty(window, "IntersectionObserver", {
946
+ value: MockIntersectionObserver,
947
+ writable: true,
948
+ configurable: true
949
+ });
950
+ }
951
+ consoleWarnSpy === null || consoleWarnSpy === void 0 ? void 0 : consoleWarnSpy.mockRestore();
952
+ consoleErrorSpy === null || consoleErrorSpy === void 0 ? void 0 : consoleErrorSpy.mockRestore();
953
+ consoleWarnSpy = null;
954
+ consoleErrorSpy = null;
955
+ (0, import_react.cleanup)();
956
+ });
957
+ //# sourceMappingURL=setup.native.js.map