@tamagui/animations-reanimated 2.7.7 → 3.0.0-beta.643.1

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.
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+
3
4
  var __create = Object.create;
4
5
  var __defProp = Object.defineProperty;
5
6
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -7,36 +8,27 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
7
8
  var __getProtoOf = Object.getPrototypeOf;
8
9
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
10
  var __export = (target, all) => {
10
- for (var name in all) __defProp(target, name, {
11
- get: all[name],
12
- enumerable: true
13
- });
11
+ for (var name in all) __defProp(target, name, {
12
+ get: all[name],
13
+ enumerable: true
14
+ });
14
15
  };
15
16
  var __copyProps = (to, from, except, desc) => {
16
- if (from && typeof from === "object" || typeof from === "function") {
17
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
18
- get: () => from[key],
19
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
20
- });
21
- }
22
- return to;
17
+ if (from && typeof from === "object" || typeof from === "function") {
18
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
19
+ get: () => from[key],
20
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
21
+ });
22
+ }
23
+ return to;
23
24
  };
24
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25
- // If the importer is in node compatibility mode or this is not an ESM
26
- // file that has been converted to a CommonJS file using a Babel-
27
- // compatible transform (i.e. "__esModule" has not been set), then set
28
- // "default" to the CommonJS "module.exports" for node compatibility.
29
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
30
- value: mod,
31
- enumerable: true
25
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
+ value: mod,
27
+ enumerable: true
32
28
  }) : target, mod));
33
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
34
- value: true
35
- }), mod);
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
30
  var createAnimations_exports = {};
37
- __export(createAnimations_exports, {
38
- createAnimations: () => createAnimations
39
- });
31
+ __export(createAnimations_exports, { createAnimations: () => createAnimations });
40
32
  module.exports = __toCommonJS(createAnimations_exports);
41
33
  var import_jsx_runtime = require("react/jsx-runtime");
42
34
  var import_animation_helpers = require("@tamagui/animation-helpers");
@@ -46,1130 +38,1161 @@ var import_normalize_colors = __toESM(require("@react-native/normalize-colors"),
46
38
  var import_react = __toESM(require("react"), 1);
47
39
  var import_react_native_reanimated = __toESM(require("react-native-reanimated"), 1);
48
40
  function _type_of(obj) {
49
- "@swc/helpers - typeof";
50
-
51
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
41
+ "@swc/helpers - typeof";
42
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
52
43
  }
53
- var getDefaultExport = function (module2) {
54
- var mod = module2;
55
- if (mod.__esModule || mod[Symbol.toStringTag] === "Module") {
56
- return mod.default || mod;
57
- }
58
- return mod;
44
+ var getDefaultExport = function(module2) {
45
+ var mod = module2;
46
+ if (mod.__esModule || mod[Symbol.toStringTag] === "Module") {
47
+ return mod.default || mod;
48
+ }
49
+ return mod;
59
50
  };
60
51
  var Animated = getDefaultExport(import_react_native_reanimated.default);
61
- var silenceAnimatedComponentDevCheck = function (style) {
62
- if (process.env.NODE_ENV !== "development" || import_core.isWeb || !style || (typeof style === "undefined" ? "undefined" : _type_of(style)) !== "object") {
63
- return;
64
- }
65
- Object.defineProperty(style, "_requiresAnimatedComponent", {
66
- configurable: true,
67
- enumerable: false,
68
- value: true
69
- });
52
+ var silenceAnimatedComponentDevCheck = function(style) {
53
+ if (process.env.NODE_ENV !== "development" || import_core.isWeb || !style || (typeof style === "undefined" ? "undefined" : _type_of(style)) !== "object") {
54
+ return;
55
+ }
56
+ Object.defineProperty(style, "_requiresAnimatedComponent", {
57
+ configurable: true,
58
+ enumerable: false,
59
+ value: true
60
+ });
70
61
  };
71
- var resolveDynamicValue = function (value, isDark) {
72
- if (value !== null && (typeof value === "undefined" ? "undefined" : _type_of(value)) === "object" && "dynamic" in value && _type_of(value.dynamic) === "object") {
73
- var dynamic = value.dynamic;
74
- return isDark ? dynamic.dark : dynamic.light;
75
- }
76
- return value;
62
+ var resolveDynamicValue = function(value, isDark) {
63
+ if (value !== null && (typeof value === "undefined" ? "undefined" : _type_of(value)) === "object" && "dynamic" in value && _type_of(value.dynamic) === "object") {
64
+ var dynamic = value.dynamic;
65
+ return isDark ? dynamic.dark : dynamic.light;
66
+ }
67
+ return value;
77
68
  };
78
- var updateMapperState = import_core.isWeb ? function (state, emitted) {
79
- state.value.emitted = emitted;
80
- } : function (state, emitted) {
81
- "worklet";
82
-
83
- if (!globalThis._WORKLET) return;
84
- state.modify(function (current) {
85
- current.emitted = emitted;
86
- return current;
87
- }, false);
69
+ var updateMapperState = import_core.isWeb ? function(state, emitted) {
70
+ state.value.emitted = emitted;
71
+ } : function(state, emitted) {
72
+ "worklet";
73
+ if (!globalThis._WORKLET) return;
74
+ state.modify(function(current) {
75
+ current.emitted = emitted;
76
+ return current;
77
+ }, false);
88
78
  };
89
- var cloneAnimationValue = function (value) {
90
- if (Array.isArray(value)) {
91
- return value.map(cloneAnimationValue);
92
- }
93
- if (value && (typeof value === "undefined" ? "undefined" : _type_of(value)) === "object") {
94
- var next = {};
95
- for (var key in value) {
96
- next[key] = cloneAnimationValue(value[key]);
97
- }
98
- return next;
99
- }
100
- return value;
79
+ var cloneAnimationValue = function(value) {
80
+ if (Array.isArray(value)) {
81
+ return value.map(cloneAnimationValue);
82
+ }
83
+ if (value && (typeof value === "undefined" ? "undefined" : _type_of(value)) === "object") {
84
+ var next = {};
85
+ for (var key in value) {
86
+ next[key] = cloneAnimationValue(value[key]);
87
+ }
88
+ return next;
89
+ }
90
+ return value;
101
91
  };
102
- var cloneStyleRecord = function (style) {
103
- var next = {};
104
- for (var key in style) {
105
- next[key] = cloneAnimationValue(style[key]);
106
- }
107
- return next;
92
+ var cloneStyleRecord = function(style) {
93
+ var next = {};
94
+ for (var key in style) {
95
+ next[key] = cloneAnimationValue(style[key]);
96
+ }
97
+ return next;
108
98
  };
109
- var cloneTransitionConfig = function (config) {
110
- return cloneAnimationValue(config);
99
+ var cloneTransitionConfig = function(config) {
100
+ return cloneAnimationValue(config);
111
101
  };
112
- var getAnimatedTransforms = function (value) {
113
- if (!Array.isArray(value)) return [];
114
- return value.filter(function (item) {
115
- return item !== null && (typeof item === "undefined" ? "undefined" : _type_of(item)) === "object" && !Array.isArray(item);
116
- });
102
+ var getAnimatedTransforms = function(value) {
103
+ if (!Array.isArray(value)) return [];
104
+ return value.filter(function(item) {
105
+ return item !== null && (typeof item === "undefined" ? "undefined" : _type_of(item)) === "object" && !Array.isArray(item);
106
+ });
117
107
  };
118
- var getRemovedAnimatedKeys = function (current, previous) {
119
- var removedKeys = {};
120
- var _iteratorNormalCompletion = true,
121
- _didIteratorError = false,
122
- _iteratorError = void 0;
123
- try {
124
- for (var _iterator = previous[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
125
- var key = _step.value;
126
- if (!current.has(key)) removedKeys[key] = true;
127
- }
128
- } catch (err) {
129
- _didIteratorError = true;
130
- _iteratorError = err;
131
- } finally {
132
- try {
133
- if (!_iteratorNormalCompletion && _iterator.return != null) {
134
- _iterator.return();
135
- }
136
- } finally {
137
- if (_didIteratorError) {
138
- throw _iteratorError;
139
- }
140
- }
141
- }
142
- return removedKeys;
108
+ var getRemovedAnimatedKeys = function(current, previous) {
109
+ var removedKeys = {};
110
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
111
+ try {
112
+ for (var _iterator = previous[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
113
+ var key = _step.value;
114
+ if (!current.has(key)) removedKeys[key] = true;
115
+ }
116
+ } catch (err) {
117
+ _didIteratorError = true;
118
+ _iteratorError = err;
119
+ } finally {
120
+ try {
121
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
122
+ _iterator.return();
123
+ }
124
+ } finally {
125
+ if (_didIteratorError) {
126
+ throw _iteratorError;
127
+ }
128
+ }
129
+ }
130
+ return removedKeys;
143
131
  };
144
- var getImplicitDefault = function (key, targetValue) {
145
- "worklet";
146
-
147
- var value = key === "opacity" || key === "scale" || key === "scaleX" || key === "scaleY" ? 1 : 0;
148
- if (typeof targetValue !== "string") return value;
149
- var suffixIndex = 0;
150
- while (suffixIndex < targetValue.length) {
151
- var character = targetValue[suffixIndex];
152
- var code = character.charCodeAt(0);
153
- if (code >= 48 && code <= 57 || character === "." || character === "-" || character === "+") {
154
- suffixIndex++;
155
- } else {
156
- break;
157
- }
158
- }
159
- return suffixIndex > 0 ? `${value}${targetValue.slice(suffixIndex)}` : value;
132
+ var getImplicitDefault = function(key, targetValue) {
133
+ "worklet";
134
+ var value = key === "opacity" || key === "scale" || key === "scaleX" || key === "scaleY" ? 1 : 0;
135
+ if (typeof targetValue !== "string") return value;
136
+ var suffixIndex = 0;
137
+ while (suffixIndex < targetValue.length) {
138
+ var character = targetValue[suffixIndex];
139
+ var code = character.charCodeAt(0);
140
+ if (code >= 48 && code <= 57 || character === "." || character === "-" || character === "+") {
141
+ suffixIndex++;
142
+ } else {
143
+ break;
144
+ }
145
+ }
146
+ return suffixIndex > 0 ? `${value}${targetValue.slice(suffixIndex)}` : value;
160
147
  };
161
148
  var COLOR_STYLE_KEYS = {
162
- backgroundColor: true,
163
- borderColor: true,
164
- borderLeftColor: true,
165
- borderRightColor: true,
166
- borderTopColor: true,
167
- borderBottomColor: true,
168
- color: true
149
+ backgroundColor: true,
150
+ borderColor: true,
151
+ borderLeftColor: true,
152
+ borderRightColor: true,
153
+ borderTopColor: true,
154
+ borderBottomColor: true,
155
+ color: true
169
156
  };
170
- var toReanimatedColor = function (value) {
171
- "worklet";
172
-
173
- if (typeof value === "number") {
174
- var color = value >>> 0;
175
- var alpha = (color >>> 24 & 255) / 255;
176
- var red = color >>> 16 & 255;
177
- var green = color >>> 8 & 255;
178
- var blue = color & 255;
179
- return `rgba(${red}, ${green}, ${blue}, ${alpha})`;
180
- }
181
- if (typeof value !== "string") return value;
182
- var trimmed = value.trim();
183
- if (trimmed === "transparent") return "rgba(0, 0, 0, 0)";
184
- return trimmed;
157
+ var toReanimatedColor = function(value) {
158
+ "worklet";
159
+ if (typeof value === "number") {
160
+ var color = value >>> 0;
161
+ var alpha = (color >>> 24 & 255) / 255;
162
+ var red = color >>> 16 & 255;
163
+ var green = color >>> 8 & 255;
164
+ var blue = color & 255;
165
+ return `rgba(${red}, ${green}, ${blue}, ${alpha})`;
166
+ }
167
+ if (typeof value !== "string") return value;
168
+ var trimmed = value.trim();
169
+ if (trimmed === "transparent") return "rgba(0, 0, 0, 0)";
170
+ return trimmed;
185
171
  };
186
- var isReanimatedColorHistory = function (value) {
187
- "worklet";
188
-
189
- var normalized = toReanimatedColor(value);
190
- return typeof normalized === "string" && normalized.startsWith("rgba(");
172
+ var isReanimatedColorHistory = function(value) {
173
+ "worklet";
174
+ var normalized = toReanimatedColor(value);
175
+ return typeof normalized === "string" && normalized.startsWith("rgba(");
191
176
  };
192
- var normalizeAnimationColor = function (value) {
193
- if (typeof value === "number") {
194
- return toReanimatedColor(value);
195
- }
196
- if (typeof value !== "string") return;
197
- var color = (0, import_normalize_colors.default)(value);
198
- if (color == null) return;
199
- var red = Math.round((color & 4278190080) >>> 24);
200
- var green = Math.round((color & 16711680) >>> 16);
201
- var blue = Math.round((color & 65280) >>> 8);
202
- var alpha = (color & 255) / 255;
203
- return `rgba(${red}, ${green}, ${blue}, ${alpha})`;
177
+ var normalizeAnimationColor = function(value) {
178
+ if (typeof value === "number") {
179
+ return toReanimatedColor(value);
180
+ }
181
+ if (typeof value !== "string") return;
182
+ var color = (0, import_normalize_colors.default)(value);
183
+ if (color == null) return;
184
+ var red = Math.round((color & 4278190080) >>> 24);
185
+ var green = Math.round((color & 16711680) >>> 16);
186
+ var blue = Math.round((color & 65280) >>> 8);
187
+ var alpha = (color & 255) / 255;
188
+ return `rgba(${red}, ${green}, ${blue}, ${alpha})`;
204
189
  };
205
- var buildSnapshot = function (animated, statics, transforms, previousKeys, lastPainted) {
206
- var snapshotAnimated = {};
207
- var snapshotStatics = cloneStyleRecord(statics);
208
- for (var key in snapshotStatics) {
209
- if (!COLOR_STYLE_KEYS[key]) continue;
210
- var normalized = normalizeAnimationColor(snapshotStatics[key]);
211
- if (normalized !== void 0) snapshotStatics[key] = normalized;
212
- }
213
- for (var key1 in animated) {
214
- if (key1 === "transform") continue;
215
- var value = animated[key1];
216
- if (COLOR_STYLE_KEYS[key1]) {
217
- var normalized1 = normalizeAnimationColor(value);
218
- if (normalized1 === void 0) {
219
- snapshotStatics[key1] = cloneAnimationValue(value);
220
- continue;
221
- }
222
- snapshotAnimated[key1] = normalized1;
223
- } else {
224
- snapshotAnimated[key1] = cloneAnimationValue(value);
225
- }
226
- }
227
- var snapshotTransforms = transforms.map(cloneStyleRecord);
228
- var keys = new Set(Object.keys(snapshotAnimated));
229
- var _iteratorNormalCompletion = true,
230
- _didIteratorError = false,
231
- _iteratorError = void 0;
232
- try {
233
- for (var _iterator = snapshotTransforms[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
234
- var transform = _step.value;
235
- var key2 = Object.keys(transform)[0];
236
- var value1 = key2 ? transform[key2] : void 0;
237
- if (key2 && (typeof value1 === "number" || typeof value1 === "string")) {
238
- keys.add(`transform:${key2}`);
239
- }
240
- }
241
- } catch (err) {
242
- _didIteratorError = true;
243
- _iteratorError = err;
244
- } finally {
245
- try {
246
- if (!_iteratorNormalCompletion && _iterator.return != null) {
247
- _iterator.return();
248
- }
249
- } finally {
250
- if (_didIteratorError) {
251
- throw _iteratorError;
252
- }
253
- }
254
- }
255
- var seeds = {};
256
- var _iteratorNormalCompletion1 = true,
257
- _didIteratorError1 = false,
258
- _iteratorError1 = void 0;
259
- try {
260
- for (var _iterator1 = keys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
261
- var key3 = _step1.value;
262
- var value2 = lastPainted[key3];
263
- if (typeof value2 !== "number" && typeof value2 !== "string") continue;
264
- if (value2 === "auto" || typeof value2 === "string" && value2.startsWith("calc")) {
265
- continue;
266
- }
267
- if (COLOR_STYLE_KEYS[key3]) value2 = normalizeAnimationColor(value2);
268
- if (value2 !== void 0) seeds[key3] = value2;
269
- }
270
- } catch (err) {
271
- _didIteratorError1 = true;
272
- _iteratorError1 = err;
273
- } finally {
274
- try {
275
- if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
276
- _iterator1.return();
277
- }
278
- } finally {
279
- if (_didIteratorError1) {
280
- throw _iteratorError1;
281
- }
282
- }
283
- }
284
- var gatedKeys = {};
285
- var _iteratorNormalCompletion2 = true,
286
- _didIteratorError2 = false,
287
- _iteratorError2 = void 0;
288
- try {
289
- for (var _iterator2 = keys[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
290
- var key4 = _step2.value;
291
- gatedKeys[key4] = true;
292
- }
293
- } catch (err) {
294
- _didIteratorError2 = true;
295
- _iteratorError2 = err;
296
- } finally {
297
- try {
298
- if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
299
- _iterator2.return();
300
- }
301
- } finally {
302
- if (_didIteratorError2) {
303
- throw _iteratorError2;
304
- }
305
- }
306
- }
307
- var removedKeys = getRemovedAnimatedKeys(keys, previousKeys);
308
- var painted = {
309
- ...snapshotStatics,
310
- ...snapshotAnimated
311
- };
312
- var staticTransforms = getAnimatedTransforms(snapshotStatics.transform);
313
- delete painted.transform;
314
- var _iteratorNormalCompletion3 = true,
315
- _didIteratorError3 = false,
316
- _iteratorError3 = void 0;
317
- try {
318
- for (var _iterator3 = staticTransforms[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
319
- var transform1 = _step3.value;
320
- var key5 = Object.keys(transform1)[0];
321
- if (key5) painted[`transform:${key5}`] = transform1[key5];
322
- }
323
- } catch (err) {
324
- _didIteratorError3 = true;
325
- _iteratorError3 = err;
326
- } finally {
327
- try {
328
- if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
329
- _iterator3.return();
330
- }
331
- } finally {
332
- if (_didIteratorError3) {
333
- throw _iteratorError3;
334
- }
335
- }
336
- }
337
- var _iteratorNormalCompletion4 = true,
338
- _didIteratorError4 = false,
339
- _iteratorError4 = void 0;
340
- try {
341
- for (var _iterator4 = snapshotTransforms[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
342
- var transform2 = _step4.value;
343
- var key6 = Object.keys(transform2)[0];
344
- if (key6) painted[`transform:${key6}`] = transform2[key6];
345
- }
346
- } catch (err) {
347
- _didIteratorError4 = true;
348
- _iteratorError4 = err;
349
- } finally {
350
- try {
351
- if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
352
- _iterator4.return();
353
- }
354
- } finally {
355
- if (_didIteratorError4) {
356
- throw _iteratorError4;
357
- }
358
- }
359
- }
360
- return {
361
- value: {
362
- animated: snapshotAnimated,
363
- statics: snapshotStatics,
364
- transforms: snapshotTransforms,
365
- gatedKeys,
366
- seeds,
367
- removedKeys,
368
- removeTransform: Object.keys(removedKeys).some(function (key7) {
369
- return key7.startsWith("transform:");
370
- }),
371
- clearValue: import_core.isWeb ? "" : null
372
- },
373
- painted,
374
- keys
375
- };
190
+ var buildSnapshot = function(animated, statics, transforms, previousKeys, lastPainted) {
191
+ var snapshotAnimated = {};
192
+ var snapshotStatics = cloneStyleRecord(statics);
193
+ for (var key in snapshotStatics) {
194
+ if (!COLOR_STYLE_KEYS[key]) continue;
195
+ var normalized = normalizeAnimationColor(snapshotStatics[key]);
196
+ if (normalized !== void 0) snapshotStatics[key] = normalized;
197
+ }
198
+ for (var key1 in animated) {
199
+ if (key1 === "transform") continue;
200
+ var value = animated[key1];
201
+ if (COLOR_STYLE_KEYS[key1]) {
202
+ var normalized1 = normalizeAnimationColor(value);
203
+ if (normalized1 === void 0) {
204
+ snapshotStatics[key1] = cloneAnimationValue(value);
205
+ continue;
206
+ }
207
+ snapshotAnimated[key1] = normalized1;
208
+ } else {
209
+ snapshotAnimated[key1] = cloneAnimationValue(value);
210
+ }
211
+ }
212
+ var snapshotTransforms = transforms.map(cloneStyleRecord);
213
+ var keys = new Set(Object.keys(snapshotAnimated));
214
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
215
+ try {
216
+ for (var _iterator = snapshotTransforms[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
217
+ var transform = _step.value;
218
+ var key2 = Object.keys(transform)[0];
219
+ var value1 = key2 ? transform[key2] : void 0;
220
+ if (key2 && (typeof value1 === "number" || typeof value1 === "string")) {
221
+ keys.add(`transform:${key2}`);
222
+ }
223
+ }
224
+ } catch (err) {
225
+ _didIteratorError = true;
226
+ _iteratorError = err;
227
+ } finally {
228
+ try {
229
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
230
+ _iterator.return();
231
+ }
232
+ } finally {
233
+ if (_didIteratorError) {
234
+ throw _iteratorError;
235
+ }
236
+ }
237
+ }
238
+ var seeds = {};
239
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
240
+ try {
241
+ for (var _iterator1 = keys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
242
+ var key3 = _step1.value;
243
+ var value2 = lastPainted[key3];
244
+ if (typeof value2 !== "number" && typeof value2 !== "string") continue;
245
+ if (value2 === "auto" || typeof value2 === "string" && value2.startsWith("calc")) {
246
+ continue;
247
+ }
248
+ if (COLOR_STYLE_KEYS[key3]) value2 = normalizeAnimationColor(value2);
249
+ if (value2 !== void 0) seeds[key3] = value2;
250
+ }
251
+ } catch (err) {
252
+ _didIteratorError1 = true;
253
+ _iteratorError1 = err;
254
+ } finally {
255
+ try {
256
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
257
+ _iterator1.return();
258
+ }
259
+ } finally {
260
+ if (_didIteratorError1) {
261
+ throw _iteratorError1;
262
+ }
263
+ }
264
+ }
265
+ var gatedKeys = {};
266
+ var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = void 0;
267
+ try {
268
+ for (var _iterator2 = keys[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
269
+ var key4 = _step2.value;
270
+ gatedKeys[key4] = true;
271
+ }
272
+ } catch (err) {
273
+ _didIteratorError2 = true;
274
+ _iteratorError2 = err;
275
+ } finally {
276
+ try {
277
+ if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
278
+ _iterator2.return();
279
+ }
280
+ } finally {
281
+ if (_didIteratorError2) {
282
+ throw _iteratorError2;
283
+ }
284
+ }
285
+ }
286
+ var removedKeys = getRemovedAnimatedKeys(keys, previousKeys);
287
+ var painted = {
288
+ ...snapshotStatics,
289
+ ...snapshotAnimated
290
+ };
291
+ var staticTransforms = getAnimatedTransforms(snapshotStatics.transform);
292
+ delete painted.transform;
293
+ var _iteratorNormalCompletion3 = true, _didIteratorError3 = false, _iteratorError3 = void 0;
294
+ try {
295
+ for (var _iterator3 = staticTransforms[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
296
+ var transform1 = _step3.value;
297
+ var key5 = Object.keys(transform1)[0];
298
+ if (key5) painted[`transform:${key5}`] = transform1[key5];
299
+ }
300
+ } catch (err) {
301
+ _didIteratorError3 = true;
302
+ _iteratorError3 = err;
303
+ } finally {
304
+ try {
305
+ if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
306
+ _iterator3.return();
307
+ }
308
+ } finally {
309
+ if (_didIteratorError3) {
310
+ throw _iteratorError3;
311
+ }
312
+ }
313
+ }
314
+ var _iteratorNormalCompletion4 = true, _didIteratorError4 = false, _iteratorError4 = void 0;
315
+ try {
316
+ for (var _iterator4 = snapshotTransforms[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
317
+ var transform2 = _step4.value;
318
+ var key6 = Object.keys(transform2)[0];
319
+ if (key6) painted[`transform:${key6}`] = transform2[key6];
320
+ }
321
+ } catch (err) {
322
+ _didIteratorError4 = true;
323
+ _iteratorError4 = err;
324
+ } finally {
325
+ try {
326
+ if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
327
+ _iterator4.return();
328
+ }
329
+ } finally {
330
+ if (_didIteratorError4) {
331
+ throw _iteratorError4;
332
+ }
333
+ }
334
+ }
335
+ return {
336
+ value: {
337
+ animated: snapshotAnimated,
338
+ statics: snapshotStatics,
339
+ transforms: snapshotTransforms,
340
+ gatedKeys,
341
+ seeds,
342
+ removedKeys,
343
+ removeTransform: Object.keys(removedKeys).some(function(key7) {
344
+ return key7.startsWith("transform:");
345
+ }),
346
+ clearValue: import_core.isWeb ? "" : null
347
+ },
348
+ painted,
349
+ keys
350
+ };
376
351
  };
377
- var getGatedKeys = function (snapshot) {
378
- return Object.keys(snapshot.gatedKeys);
352
+ var getGatedKeys = function(snapshot) {
353
+ return Object.keys(snapshot.gatedKeys);
379
354
  };
380
- var createReanimatedConfig = function (config) {
381
- "worklet";
382
-
383
- var next = {};
384
- var source = config;
385
- for (var key in source) {
386
- if (key === "type" || key === "delay") continue;
387
- var value = source[key];
388
- if (value !== void 0) {
389
- next[key] = value;
390
- }
391
- }
392
- return next;
355
+ var createReanimatedConfig = function(config) {
356
+ "worklet";
357
+ var next = {};
358
+ var source = config;
359
+ for (var key in source) {
360
+ if (key === "type" || key === "delay") continue;
361
+ var value = source[key];
362
+ if (value !== void 0) {
363
+ next[key] = value;
364
+ }
365
+ }
366
+ return next;
393
367
  };
394
- var applyAnimation = function (targetValue, config, callback, seedValue) {
395
- "worklet";
396
-
397
- var validateStartAsColor = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : false;
398
- var delay = config.delay;
399
- var reanimatedConfig = createReanimatedConfig(config);
400
- var animatedValue;
401
- if (config.type === "timing") {
402
- animatedValue = (0, import_react_native_reanimated.withTiming)(targetValue, reanimatedConfig, callback);
403
- } else {
404
- animatedValue = (0, import_react_native_reanimated.withSpring)(targetValue, reanimatedConfig, callback);
405
- }
406
- if (seedValue !== void 0 || validateStartAsColor) {
407
- var innerOnStart = animatedValue.onStart;
408
- animatedValue.onStart = function (animation, value, timestamp, previousAnimation) {
409
- "worklet";
410
-
411
- var startValue = validateStartAsColor ? isReanimatedColorHistory(value) ? toReanimatedColor(value) : seedValue !== null && seedValue !== void 0 ? seedValue : targetValue : seedValue;
412
- innerOnStart(animation, startValue, timestamp, previousAnimation);
413
- };
414
- }
415
- if (delay && delay > 0) {
416
- animatedValue = (0, import_react_native_reanimated.withDelay)(delay, animatedValue);
417
- }
418
- return animatedValue;
368
+ var applyAnimation = function(targetValue, config, callback, seedValue) {
369
+ "worklet";
370
+ var validateStartAsColor = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : false;
371
+ var delay = config.delay;
372
+ var reanimatedConfig = createReanimatedConfig(config);
373
+ var animatedValue;
374
+ if (config.type === "timing") {
375
+ animatedValue = (0, import_react_native_reanimated.withTiming)(targetValue, reanimatedConfig, callback);
376
+ } else {
377
+ animatedValue = (0, import_react_native_reanimated.withSpring)(targetValue, reanimatedConfig, callback);
378
+ var innerOnFrame = animatedValue.onFrame;
379
+ animatedValue.onFrame = function(animation, now) {
380
+ "worklet";
381
+ return innerOnFrame(animation, now < animation.lastTimestamp ? animation.lastTimestamp : now);
382
+ };
383
+ }
384
+ if (seedValue !== void 0 || validateStartAsColor) {
385
+ var innerOnStart = animatedValue.onStart;
386
+ animatedValue.onStart = function(animation, value, timestamp, previousAnimation) {
387
+ "worklet";
388
+ var startValue = validateStartAsColor ? isReanimatedColorHistory(value) ? toReanimatedColor(value) : seedValue !== null && seedValue !== void 0 ? seedValue : targetValue : seedValue;
389
+ innerOnStart(animation, startValue, timestamp, previousAnimation);
390
+ };
391
+ }
392
+ if (delay && delay > 0) {
393
+ animatedValue = (0, import_react_native_reanimated.withDelay)(delay, animatedValue);
394
+ }
395
+ return animatedValue;
419
396
  };
420
- var animateSnapshotValue = function (key, implicitKey, targetValue, config, previouslyEmitted, seedValue, gated, currentlyExiting, exitCycleId, currentlyCompletingAnimation, didAnimateCycleId, markExitKeyDone, markDidAnimateKeyDone) {
421
- "worklet";
422
-
423
- var validateStartAsColor = arguments.length > 13 && arguments[13] !== void 0 ? arguments[13] : false;
424
- var cycleGated = gated && (currentlyExiting || currentlyCompletingAnimation);
425
- if (!previouslyEmitted && seedValue === void 0 && !cycleGated) {
426
- return targetValue;
427
- }
428
- var callback;
429
- if (gated && currentlyExiting) {
430
- callback = function (finished) {
431
- "worklet";
432
-
433
- (0, import_react_native_reanimated.runOnJS)(markExitKeyDone)(key, exitCycleId, finished !== null && finished !== void 0 ? finished : false);
434
- };
435
- } else if (gated && currentlyCompletingAnimation) {
436
- callback = function (finished) {
437
- "worklet";
438
-
439
- (0, import_react_native_reanimated.runOnJS)(markDidAnimateKeyDone)(key, didAnimateCycleId, finished !== null && finished !== void 0 ? finished : false);
440
- };
441
- }
442
- return applyAnimation(targetValue, config, callback, previouslyEmitted ? void 0 : seedValue !== null && seedValue !== void 0 ? seedValue : getImplicitDefault(implicitKey, targetValue), validateStartAsColor);
397
+ var animateSnapshotValue = function(key, implicitKey, targetValue, config, previouslyEmitted, seedValue, gated, currentlyExiting, exitCycleId, currentlyCompletingEnter, enterCycleId, currentlyCompletingUpdate, updateCycleId, markExitKeyDone, markEnterKeyDone, markUpdateKeyDone) {
398
+ "worklet";
399
+ var validateStartAsColor = arguments.length > 16 && arguments[16] !== void 0 ? arguments[16] : false;
400
+ var cycleGated = gated && (currentlyExiting || currentlyCompletingEnter || currentlyCompletingUpdate);
401
+ if (!previouslyEmitted && seedValue === void 0 && !cycleGated) {
402
+ return targetValue;
403
+ }
404
+ var callback;
405
+ if (gated && currentlyExiting) {
406
+ callback = function(finished) {
407
+ "worklet";
408
+ (0, import_react_native_reanimated.runOnJS)(markExitKeyDone)(key, exitCycleId, finished !== null && finished !== void 0 ? finished : false);
409
+ };
410
+ } else if (gated && currentlyCompletingEnter) {
411
+ callback = function() {
412
+ "worklet";
413
+ (0, import_react_native_reanimated.runOnJS)(markEnterKeyDone)(key, enterCycleId);
414
+ };
415
+ } else if (gated && currentlyCompletingUpdate) {
416
+ callback = function(finished) {
417
+ "worklet";
418
+ (0, import_react_native_reanimated.runOnJS)(markUpdateKeyDone)(key, updateCycleId, finished !== null && finished !== void 0 ? finished : false);
419
+ };
420
+ }
421
+ return applyAnimation(targetValue, config, callback, previouslyEmitted ? void 0 : seedValue !== null && seedValue !== void 0 ? seedValue : getImplicitDefault(implicitKey, targetValue), validateStartAsColor);
443
422
  };
444
423
  var ANIMATABLE_PROPERTIES = {
445
- // Transform
446
- transform: true,
447
- // Opacity
448
- opacity: true,
449
- // Dimensions
450
- height: true,
451
- width: true,
452
- minWidth: true,
453
- minHeight: true,
454
- maxWidth: true,
455
- maxHeight: true,
456
- // Background
457
- backgroundColor: true,
458
- // Border colors
459
- borderColor: true,
460
- borderLeftColor: true,
461
- borderRightColor: true,
462
- borderTopColor: true,
463
- borderBottomColor: true,
464
- // Border radius
465
- borderRadius: true,
466
- borderTopLeftRadius: true,
467
- borderTopRightRadius: true,
468
- borderBottomLeftRadius: true,
469
- borderBottomRightRadius: true,
470
- // Border width
471
- borderWidth: true,
472
- borderLeftWidth: true,
473
- borderRightWidth: true,
474
- borderTopWidth: true,
475
- borderBottomWidth: true,
476
- // Text
477
- color: true,
478
- fontSize: true,
479
- fontWeight: true,
480
- lineHeight: true,
481
- letterSpacing: true,
482
- // Position
483
- left: true,
484
- right: true,
485
- top: true,
486
- bottom: true,
487
- // Margin
488
- margin: true,
489
- marginTop: true,
490
- marginBottom: true,
491
- marginLeft: true,
492
- marginRight: true,
493
- marginHorizontal: true,
494
- marginVertical: true,
495
- // Padding
496
- padding: true,
497
- paddingTop: true,
498
- paddingBottom: true,
499
- paddingLeft: true,
500
- paddingRight: true,
501
- paddingHorizontal: true,
502
- paddingVertical: true,
503
- // Flex/Gap
504
- gap: true,
505
- rowGap: true,
506
- columnGap: true,
507
- flex: true,
508
- flexGrow: true,
509
- flexShrink: true
424
+ transform: true,
425
+ opacity: true,
426
+ height: true,
427
+ width: true,
428
+ minWidth: true,
429
+ minHeight: true,
430
+ maxWidth: true,
431
+ maxHeight: true,
432
+ backgroundColor: true,
433
+ borderColor: true,
434
+ borderLeftColor: true,
435
+ borderRightColor: true,
436
+ borderTopColor: true,
437
+ borderBottomColor: true,
438
+ borderRadius: true,
439
+ borderTopLeftRadius: true,
440
+ borderTopRightRadius: true,
441
+ borderBottomLeftRadius: true,
442
+ borderBottomRightRadius: true,
443
+ borderWidth: true,
444
+ borderLeftWidth: true,
445
+ borderRightWidth: true,
446
+ borderTopWidth: true,
447
+ borderBottomWidth: true,
448
+ color: true,
449
+ fontSize: true,
450
+ fontWeight: true,
451
+ lineHeight: true,
452
+ letterSpacing: true,
453
+ left: true,
454
+ right: true,
455
+ top: true,
456
+ bottom: true,
457
+ margin: true,
458
+ marginTop: true,
459
+ marginBottom: true,
460
+ marginLeft: true,
461
+ marginRight: true,
462
+ marginHorizontal: true,
463
+ marginVertical: true,
464
+ padding: true,
465
+ paddingTop: true,
466
+ paddingBottom: true,
467
+ paddingLeft: true,
468
+ paddingRight: true,
469
+ paddingHorizontal: true,
470
+ paddingVertical: true,
471
+ gap: true,
472
+ rowGap: true,
473
+ columnGap: true,
474
+ flex: true,
475
+ flexGrow: true,
476
+ flexShrink: true
510
477
  };
511
- var canAnimateProperty = function (key, value, animateOnly) {
512
- if (!ANIMATABLE_PROPERTIES[key]) return false;
513
- if (value === "auto") return false;
514
- if (typeof value === "string" && value.startsWith("calc")) return false;
515
- if (animateOnly && !animateOnly.includes(key)) return false;
516
- return true;
478
+ var canAnimateProperty = function(key, value, animateOnly) {
479
+ if (!ANIMATABLE_PROPERTIES[key]) return false;
480
+ if (value === "auto") return false;
481
+ if (typeof value === "string" && value.startsWith("calc")) return false;
482
+ if (animateOnly && !animateOnly.includes(key)) return false;
483
+ return true;
517
484
  };
518
- var splitAnimationStyles = function (style, isDark, disableAnimation, animateOnly) {
519
- var animated = {};
520
- var statics = {};
521
- for (var key in style) {
522
- var value = resolveDynamicValue(style[key], isDark);
523
- if (value === void 0) continue;
524
- if (!disableAnimation && canAnimateProperty(key, value, animateOnly)) {
525
- animated[key] = cloneAnimationValue(value);
526
- } else {
527
- statics[key] = cloneAnimationValue(value);
528
- }
529
- }
530
- return {
531
- animated,
532
- statics
533
- };
485
+ var splitAnimationStyles = function(style, isDark, disableAnimation, animateOnly) {
486
+ var animated = {};
487
+ var statics = {};
488
+ for (var key in style) {
489
+ var value = resolveDynamicValue(style[key], isDark);
490
+ if (value === void 0) continue;
491
+ if (!disableAnimation && canAnimateProperty(key, value, animateOnly)) {
492
+ animated[key] = cloneAnimationValue(value);
493
+ } else {
494
+ statics[key] = cloneAnimationValue(value);
495
+ }
496
+ }
497
+ return {
498
+ animated,
499
+ statics
500
+ };
534
501
  };
535
502
  function createWebAnimatedComponent(defaultTag) {
536
- var isText = defaultTag === "span";
537
- var Component = Animated.createAnimatedComponent(/* @__PURE__ */(0, import_react.forwardRef)(function (propsIn, ref) {
538
- var _hooks_usePropsTransform;
539
- var {
540
- forwardedRef,
541
- render = defaultTag,
542
- ...rest
543
- } = propsIn;
544
- var hostRef = (0, import_react.useRef)(null);
545
- var composedRefs = (0, import_core.useComposedRefs)(forwardedRef, ref, hostRef);
546
- var stateRef = (0, import_react.useRef)({
547
- get host() {
548
- return hostRef.current;
549
- }
550
- });
551
- var [, themeState] = (0, import_core.useThemeWithState)({});
552
- var _themeState_theme, _themeState_name;
553
- var result = (0, import_core.getSplitStyles)(rest, isText ? import_core.Text.staticConfig : import_core.View.staticConfig, (_themeState_theme = themeState === null || themeState === void 0 ? void 0 : themeState.theme) !== null && _themeState_theme !== void 0 ? _themeState_theme : {}, (_themeState_name = themeState === null || themeState === void 0 ? void 0 : themeState.name) !== null && _themeState_name !== void 0 ? _themeState_name : "", {
554
- unmounted: false
555
- }, {
556
- isAnimated: false,
557
- noClass: true
558
- });
559
- var _result_viewProps;
560
- var viewProps = (_result_viewProps = result === null || result === void 0 ? void 0 : result.viewProps) !== null && _result_viewProps !== void 0 ? _result_viewProps : {};
561
- var Element = render;
562
- var transformedProps = (_hooks_usePropsTransform = import_core.hooks.usePropsTransform) === null || _hooks_usePropsTransform === void 0 ? void 0 : _hooks_usePropsTransform.call(import_core.hooks, render, viewProps, stateRef, false);
563
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(Element, {
564
- ...transformedProps,
565
- ref: composedRefs
566
- });
567
- }));
568
- Component.acceptRenderProp = true;
569
- return Component;
503
+ var isText = defaultTag === "span";
504
+ var Component = Animated.createAnimatedComponent((0, import_core.createRefComponent)(function(propsIn, ref) {
505
+ var _hooks_usePropsTransform;
506
+ var { forwardedRef, render = defaultTag, ...rest } = propsIn;
507
+ var hostRef = (0, import_react.useRef)(null);
508
+ var composedRefs = (0, import_core.useComposedRefs)(forwardedRef, ref, hostRef);
509
+ var stateRef = (0, import_react.useRef)({ get host() {
510
+ return hostRef.current;
511
+ } });
512
+ var [, themeState] = (0, import_core.useThemeWithState)({});
513
+ var _themeState_theme, _themeState_name;
514
+ var result = (0, import_core.getSplitStyles)(rest, isText ? import_core.Text.staticConfig : import_core.View.staticConfig, (_themeState_theme = themeState === null || themeState === void 0 ? void 0 : themeState.theme) !== null && _themeState_theme !== void 0 ? _themeState_theme : {}, (_themeState_name = themeState === null || themeState === void 0 ? void 0 : themeState.name) !== null && _themeState_name !== void 0 ? _themeState_name : "", { unmounted: false }, {
515
+ isAnimated: false,
516
+ noClass: true
517
+ });
518
+ var _result_viewProps;
519
+ var viewProps = (_result_viewProps = result === null || result === void 0 ? void 0 : result.viewProps) !== null && _result_viewProps !== void 0 ? _result_viewProps : {};
520
+ var Element = render;
521
+ var transformedProps = (_hooks_usePropsTransform = import_core.hooks.usePropsTransform) === null || _hooks_usePropsTransform === void 0 ? void 0 : _hooks_usePropsTransform.call(import_core.hooks, render, viewProps, stateRef, false);
522
+ var { nativeID, ...webProps } = transformedProps !== null && transformedProps !== void 0 ? transformedProps : viewProps;
523
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Element, {
524
+ ...webProps,
525
+ ref: composedRefs
526
+ });
527
+ }));
528
+ Component.acceptRenderProp = true;
529
+ return Component;
570
530
  }
571
531
  var AnimatedView = createWebAnimatedComponent("div");
572
532
  var AnimatedText = createWebAnimatedComponent("span");
573
533
  function buildTransitionConfig(transition, animations, animationState, styleKeys) {
574
- var normalized = (0, import_animation_helpers.normalizeTransition)(transition);
575
- var effectiveKey = (0, import_animation_helpers.getEffectiveAnimation)(normalized, animationState);
576
- var _animations_effectiveKey;
577
- var base = cloneTransitionConfig(effectiveKey ? (_animations_effectiveKey = animations[effectiveKey]) !== null && _animations_effectiveKey !== void 0 ? _animations_effectiveKey : {
578
- type: "spring"
579
- } : {
580
- type: "spring"
581
- });
582
- if (normalized.delay) {
583
- base = cloneTransitionConfig({
584
- ...base,
585
- delay: normalized.delay
586
- });
587
- }
588
- if (normalized.config) {
589
- base = cloneTransitionConfig({
590
- ...base,
591
- ...normalized.config
592
- });
593
- if (base.type !== "timing" && normalized.config.duration !== void 0 && normalized.config.damping === void 0 && normalized.config.stiffness === void 0 && normalized.config.mass === void 0) {
594
- base = cloneTransitionConfig({
595
- ...base,
596
- type: "timing"
597
- });
598
- }
599
- }
600
- var propertyConfigs = {};
601
- var _iteratorNormalCompletion = true,
602
- _didIteratorError = false,
603
- _iteratorError = void 0;
604
- try {
605
- for (var _iterator = styleKeys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
606
- var key = _step.value;
607
- var propAnimation = normalized.properties[key];
608
- if (typeof propAnimation === "string") {
609
- var _animations_propAnimation;
610
- propertyConfigs[key] = cloneTransitionConfig((_animations_propAnimation = animations[propAnimation]) !== null && _animations_propAnimation !== void 0 ? _animations_propAnimation : base);
611
- } else if (propAnimation && (typeof propAnimation === "undefined" ? "undefined" : _type_of(propAnimation)) === "object") {
612
- var configType = propAnimation.type;
613
- var _animations_configType;
614
- var baseForProp = configType ? (_animations_configType = animations[configType]) !== null && _animations_configType !== void 0 ? _animations_configType : base : base;
615
- propertyConfigs[key] = cloneTransitionConfig({
616
- ...baseForProp,
617
- ...propAnimation
618
- });
619
- } else {
620
- propertyConfigs[key] = cloneTransitionConfig(base);
621
- }
622
- }
623
- } catch (err) {
624
- _didIteratorError = true;
625
- _iteratorError = err;
626
- } finally {
627
- try {
628
- if (!_iteratorNormalCompletion && _iterator.return != null) {
629
- _iterator.return();
630
- }
631
- } finally {
632
- if (_didIteratorError) {
633
- throw _iteratorError;
634
- }
635
- }
636
- }
637
- return {
638
- baseConfig: base,
639
- propertyConfigs
640
- };
534
+ var normalized = (0, import_animation_helpers.normalizeTransition)(transition);
535
+ var effectiveKey = (0, import_animation_helpers.getEffectiveAnimation)(normalized, animationState);
536
+ var _animations_effectiveKey;
537
+ var base = cloneTransitionConfig(effectiveKey ? (_animations_effectiveKey = animations[effectiveKey]) !== null && _animations_effectiveKey !== void 0 ? _animations_effectiveKey : { type: "spring" } : { type: "spring" });
538
+ if (normalized.delay) {
539
+ base = cloneTransitionConfig({
540
+ ...base,
541
+ delay: normalized.delay
542
+ });
543
+ }
544
+ if (normalized.config) {
545
+ base = cloneTransitionConfig({
546
+ ...base,
547
+ ...normalized.config
548
+ });
549
+ if (base.type !== "timing" && normalized.config.duration !== void 0 && normalized.config.damping === void 0 && normalized.config.stiffness === void 0 && normalized.config.mass === void 0) {
550
+ base = cloneTransitionConfig({
551
+ ...base,
552
+ type: "timing"
553
+ });
554
+ }
555
+ }
556
+ var propertyConfigs = {};
557
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
558
+ try {
559
+ for (var _iterator = styleKeys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
560
+ var key = _step.value;
561
+ var propAnimation = normalized.properties[key];
562
+ if (typeof propAnimation === "string") {
563
+ var _animations_propAnimation;
564
+ propertyConfigs[key] = cloneTransitionConfig((_animations_propAnimation = animations[propAnimation]) !== null && _animations_propAnimation !== void 0 ? _animations_propAnimation : base);
565
+ } else if (propAnimation && (typeof propAnimation === "undefined" ? "undefined" : _type_of(propAnimation)) === "object") {
566
+ var configType = propAnimation.type;
567
+ var _animations_configType;
568
+ var baseForProp = configType ? (_animations_configType = animations[configType]) !== null && _animations_configType !== void 0 ? _animations_configType : base : base;
569
+ propertyConfigs[key] = cloneTransitionConfig({
570
+ ...baseForProp,
571
+ ...propAnimation
572
+ });
573
+ } else {
574
+ propertyConfigs[key] = cloneTransitionConfig(base);
575
+ }
576
+ }
577
+ } catch (err) {
578
+ _didIteratorError = true;
579
+ _iteratorError = err;
580
+ } finally {
581
+ try {
582
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
583
+ _iterator.return();
584
+ }
585
+ } finally {
586
+ if (_didIteratorError) {
587
+ throw _iteratorError;
588
+ }
589
+ }
590
+ }
591
+ return {
592
+ baseConfig: base,
593
+ propertyConfigs
594
+ };
641
595
  }
642
596
  function getStyleKeys(style) {
643
- var keys = new Set(Object.keys(style));
644
- if (style.transform && Array.isArray(style.transform)) {
645
- var _iteratorNormalCompletion = true,
646
- _didIteratorError = false,
647
- _iteratorError = void 0;
648
- try {
649
- for (var _iterator = style.transform[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
650
- var t = _step.value;
651
- if (t && (typeof t === "undefined" ? "undefined" : _type_of(t)) === "object") {
652
- keys.add(Object.keys(t)[0]);
653
- }
654
- }
655
- } catch (err) {
656
- _didIteratorError = true;
657
- _iteratorError = err;
658
- } finally {
659
- try {
660
- if (!_iteratorNormalCompletion && _iterator.return != null) {
661
- _iterator.return();
662
- }
663
- } finally {
664
- if (_didIteratorError) {
665
- throw _iteratorError;
666
- }
667
- }
668
- }
669
- }
670
- return keys;
597
+ var keys = new Set(Object.keys(style));
598
+ if (style.transform && Array.isArray(style.transform)) {
599
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
600
+ try {
601
+ for (var _iterator = style.transform[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
602
+ var t = _step.value;
603
+ if (t && (typeof t === "undefined" ? "undefined" : _type_of(t)) === "object") {
604
+ keys.add(Object.keys(t)[0]);
605
+ }
606
+ }
607
+ } catch (err) {
608
+ _didIteratorError = true;
609
+ _iteratorError = err;
610
+ } finally {
611
+ try {
612
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
613
+ _iterator.return();
614
+ }
615
+ } finally {
616
+ if (_didIteratorError) {
617
+ throw _iteratorError;
618
+ }
619
+ }
620
+ }
621
+ }
622
+ return keys;
671
623
  }
672
624
  function createAnimations(animationsConfig) {
673
- var animations = {};
674
- for (var key in animationsConfig) {
675
- animations[key] = cloneTransitionConfig({
676
- type: "spring",
677
- ...animationsConfig[key]
678
- });
679
- }
680
- return {
681
- needsCustomComponent: true,
682
- View: import_core.isWeb ? AnimatedView : Animated.View,
683
- Text: import_core.isWeb ? AnimatedText : Animated.Text,
684
- isReactNative: true,
685
- inputStyle: "value",
686
- outputStyle: "inline",
687
- avoidReRenders: true,
688
- animations,
689
- usePresence: import_use_presence.usePresence,
690
- ResetPresence: import_use_presence.ResetPresence,
691
- // =========================================================================
692
- // useAnimatedNumber - For imperative animated values
693
- // =========================================================================
694
- useAnimatedNumber(initial) {
695
- var sharedValue = (0, import_react_native_reanimated.useSharedValue)(initial);
696
- return (0, import_react.useMemo)(function () {
697
- return {
698
- getInstance() {
699
- "worklet";
700
-
701
- return sharedValue;
702
- },
703
- getValue() {
704
- "worklet";
705
-
706
- return sharedValue.value;
707
- },
708
- setValue(next) {
709
- var config = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
710
- type: "spring"
711
- },
712
- onFinish = arguments.length > 2 ? arguments[2] : void 0;
713
- if (config.type === "direct") {
714
- sharedValue.value = next;
715
- onFinish === null || onFinish === void 0 ? void 0 : onFinish();
716
- } else {
717
- var cb = onFinish ? function (finished) {
718
- "worklet";
719
-
720
- if (finished !== false) {
721
- (0, import_react_native_reanimated.runOnJS)(onFinish)();
722
- }
723
- } : void 0;
724
- var animationConfig = cloneTransitionConfig(config);
725
- if (import_core.isWeb) {
726
- sharedValue.value = applyAnimation(next, animationConfig, cb);
727
- } else {
728
- (0, import_react_native_reanimated.runOnUI)(function (targetValue, animationConfig2) {
729
- "worklet";
730
-
731
- sharedValue.value = applyAnimation(targetValue, animationConfig2, cb);
732
- })(next, animationConfig);
733
- }
734
- }
735
- },
736
- stop() {
737
- (0, import_react_native_reanimated.cancelAnimation)(sharedValue);
738
- }
739
- };
740
- }, [sharedValue]);
741
- },
742
- // =========================================================================
743
- // useAnimatedNumberReaction - React to animated value changes
744
- // =========================================================================
745
- useAnimatedNumberReaction(param, onValue) {
746
- var {
747
- value
748
- } = param;
749
- var instance = value.getInstance();
750
- return (0, import_react_native_reanimated.useAnimatedReaction)(function () {
751
- return instance.value;
752
- }, function (next, prev) {
753
- if (prev !== next) {
754
- (0, import_react_native_reanimated.runOnJS)(onValue)(next);
755
- }
756
- }, [onValue, instance]);
757
- },
758
- // =========================================================================
759
- // useAnimatedNumberStyle - Create animated styles from values
760
- // =========================================================================
761
- useAnimatedNumberStyle(val, getStyle) {
762
- var instance = val.getInstance();
763
- if (import_core.isWeb) {
764
- return (0, import_react_native_reanimated.useAnimatedStyle)(function () {
765
- "worklet";
766
-
767
- return getStyle(instance.value);
768
- }, [instance, getStyle]);
769
- }
770
- var styleVal = (0, import_react_native_reanimated.useDerivedValue)(function () {
771
- "worklet";
772
-
773
- return getStyle(instance.value);
774
- });
775
- var animatedStyle = (0, import_react_native_reanimated.useAnimatedStyle)(function () {
776
- "worklet";
777
-
778
- return styleVal.value;
779
- });
780
- silenceAnimatedComponentDevCheck(animatedStyle);
781
- return animatedStyle;
782
- },
783
- useAnimatedNumbersStyle(vals, getStyle) {
784
- var instances = vals.map(function (v) {
785
- return v.getInstance();
786
- });
787
- var animatedStyle = (0, import_react_native_reanimated.useAnimatedStyle)(function () {
788
- "worklet";
789
-
790
- var currentValues = instances.map(function (inst) {
791
- return inst.value;
792
- });
793
- return getStyle(...currentValues);
794
- }, import_core.isWeb ? [getStyle, ...instances] : void 0);
795
- silenceAnimatedComponentDevCheck(animatedStyle);
796
- return animatedStyle;
797
- },
798
- // =========================================================================
799
- // useAnimations - Main animation hook for components
800
- // =========================================================================
801
- useAnimations(animationProps) {
802
- var {
803
- props,
804
- presence,
805
- style,
806
- componentState,
807
- useStyleEmitter,
808
- themeName,
809
- stateRef,
810
- styleState,
811
- onDidAnimate
812
- } = animationProps;
813
- var isHydrating = componentState.unmounted === true;
814
- var isMounting = componentState.unmounted === "should-enter";
815
- var isEntering = !!componentState.unmounted;
816
- var isExiting = (presence === null || presence === void 0 ? void 0 : presence[0]) === false;
817
- var wasEnteringRef = (0, import_react.useRef)(isEntering);
818
- var justFinishedEntering = wasEnteringRef.current && !isEntering;
819
- import_react.default.useEffect(function () {
820
- wasEnteringRef.current = isEntering;
821
- });
822
- var _styleState_effectiveTransition;
823
- var effectiveTransition = (_styleState_effectiveTransition = styleState === null || styleState === void 0 ? void 0 : styleState.effectiveTransition) !== null && _styleState_effectiveTransition !== void 0 ? _styleState_effectiveTransition : props.transition;
824
- var normalized = (0, import_animation_helpers.normalizeTransition)(effectiveTransition);
825
- var animationState = isExiting ? "exit" : isMounting || justFinishedEntering ? "enter" : "default";
826
- var animationKey = (0, import_animation_helpers.getEffectiveAnimation)(normalized, animationState);
827
- var disableAnimation = isHydrating || !animationKey;
828
- var isDark = (themeName === null || themeName === void 0 ? void 0 : themeName.startsWith("dark")) || false;
829
- var sendExitComplete = presence === null || presence === void 0 ? void 0 : presence[1];
830
- var onDidAnimateRef = (0, import_react.useRef)(onDidAnimate);
831
- (0, import_core.useIsomorphicLayoutEffect)(function () {
832
- onDidAnimateRef.current = onDidAnimate;
833
- }, [onDidAnimate]);
834
- var didAnimateCycleIdRef = (0, import_react.useRef)(0);
835
- var pendingDidAnimateKeysRef = (0, import_react.useRef)(/* @__PURE__ */new Set());
836
- var didAnimateCompletedRef = (0, import_react.useRef)(false);
837
- var isCompletingAnimationRef = (0, import_react_native_reanimated.useSharedValue)(false);
838
- var didAnimateCycleIdShared = (0, import_react_native_reanimated.useSharedValue)(0);
839
- var markDidAnimateKeyDone = (0, import_core.useEvent)(function (key2, cycleId, finished) {
840
- if (!finished || cycleId !== didAnimateCycleIdRef.current) return;
841
- if (didAnimateCompletedRef.current) return;
842
- pendingDidAnimateKeysRef.current.delete(key2);
843
- if (pendingDidAnimateKeysRef.current.size === 0) {
844
- var _onDidAnimateRef_current;
845
- didAnimateCompletedRef.current = true;
846
- isCompletingAnimationRef.value = false;
847
- (_onDidAnimateRef_current = onDidAnimateRef.current) === null || _onDidAnimateRef_current === void 0 ? void 0 : _onDidAnimateRef_current.call(onDidAnimateRef);
848
- }
849
- });
850
- var exitCycleIdRef = (0, import_react.useRef)(0);
851
- var pendingExitKeysRef = (0, import_react.useRef)(/* @__PURE__ */new Set());
852
- var exitCompletedRef = (0, import_react.useRef)(false);
853
- var wasExitingRef = (0, import_react.useRef)(false);
854
- var justStartedExiting = isExiting && !wasExitingRef.current;
855
- var justStoppedExiting = !isExiting && wasExitingRef.current;
856
- var markExitKeyDone = (0, import_core.useEvent)(function (key2, cycleId, finished) {
857
- if (cycleId !== exitCycleIdRef.current) return;
858
- if (exitCompletedRef.current) return;
859
- pendingExitKeysRef.current.delete(key2);
860
- if (pendingExitKeysRef.current.size === 0) {
861
- exitCompletedRef.current = true;
862
- sendExitComplete === null || sendExitComplete === void 0 ? void 0 : sendExitComplete();
863
- }
864
- });
865
- var isExitingRef = (0, import_react_native_reanimated.useSharedValue)(isExiting);
866
- var exitCycleIdShared = (0, import_react_native_reanimated.useSharedValue)(exitCycleIdRef.current);
867
- if (justStartedExiting) {
868
- exitCycleIdRef.current++;
869
- exitCompletedRef.current = false;
870
- pendingExitKeysRef.current.clear();
871
- didAnimateCycleIdRef.current++;
872
- pendingDidAnimateKeysRef.current.clear();
873
- didAnimateCompletedRef.current = true;
874
- }
875
- if (justStoppedExiting) {
876
- exitCycleIdRef.current++;
877
- pendingExitKeysRef.current.clear();
878
- }
879
- (0, import_core.useIsomorphicLayoutEffect)(function () {
880
- isExitingRef.value = isExiting;
881
- exitCycleIdShared.value = exitCycleIdRef.current;
882
- if (justStartedExiting) {
883
- isCompletingAnimationRef.value = false;
884
- didAnimateCycleIdShared.value = didAnimateCycleIdRef.current;
885
- }
886
- }, [isExiting, exitCycleIdRef.current, justStartedExiting]);
887
- import_react.default.useEffect(function () {
888
- wasExitingRef.current = isExiting;
889
- });
890
- var committedRenderKeysRef = (0, import_react.useRef)(/* @__PURE__ */new Set());
891
- var lastPaintedRef = (0, import_react.useRef)({});
892
- var carryRef = (0, import_react.useRef)({});
893
- var {
894
- animatedStyles,
895
- staticStyles,
896
- nextCarry
897
- } = (0, import_react.useMemo)(function () {
898
- var animateOnly = props.animateOnly;
899
- var {
900
- animated,
901
- statics
902
- } = splitAnimationStyles(style, isDark, disableAnimation, animateOnly);
903
- var nextCarry2 = cloneStyleRecord(carryRef.current);
904
- for (var key2 in nextCarry2) {
905
- if (!(key2 in animated)) delete nextCarry2[key2];
906
- }
907
- for (var key1 in animated) {
908
- if (!(key1 in nextCarry2)) {
909
- nextCarry2[key1] = cloneAnimationValue(animated[key1]);
910
- }
911
- statics[key1] = nextCarry2[key1];
912
- }
913
- return {
914
- animatedStyles: animated,
915
- staticStyles: statics,
916
- nextCarry: nextCarry2
917
- };
918
- }, [disableAnimation, style, isDark, props.animateOnly]);
919
- var renderSnapshot = (0, import_react.useMemo)(function () {
920
- return buildSnapshot(animatedStyles, staticStyles, getAnimatedTransforms(animatedStyles.transform), committedRenderKeysRef.current, lastPaintedRef.current);
921
- }, [animatedStyles, staticStyles]);
922
- var renderSnapshotRef = (0, import_react_native_reanimated.useSharedValue)({
923
- animated: {},
924
- statics: {},
925
- transforms: [],
926
- gatedKeys: {},
927
- seeds: {},
928
- removedKeys: {},
929
- removeTransform: false,
930
- clearValue: import_core.isWeb ? "" : null
931
- });
932
- var emitterSnapshotRef = (0, import_react_native_reanimated.useSharedValue)(null);
933
- var emitterKeysRef = (0, import_react.useRef)(null);
934
- (0, import_core.useIsomorphicLayoutEffect)(function () {
935
- carryRef.current = nextCarry;
936
- committedRenderKeysRef.current = renderSnapshot.keys;
937
- lastPaintedRef.current = renderSnapshot.painted;
938
- }, [nextCarry, renderSnapshot]);
939
- var pseudoActiveRef = (0, import_react.useRef)(false);
940
- var isExitingJSRef = (0, import_react.useRef)(false);
941
- isExitingJSRef.current = isExiting;
942
- var publishedSnapshotRef = (0, import_react.useRef)(null);
943
- (0, import_core.useIsomorphicLayoutEffect)(function () {
944
- var droppingLatch = (isExiting || !pseudoActiveRef.current) && emitterSnapshotRef.value !== null;
945
- var emitterKeys = droppingLatch ? emitterKeysRef.current : null;
946
- if (droppingLatch || publishedSnapshotRef.current !== renderSnapshot.value) {
947
- var removedKeys = emitterKeys ? {
948
- ...renderSnapshot.value.removedKeys,
949
- ...getRemovedAnimatedKeys(renderSnapshot.keys, emitterKeys)
950
- } : renderSnapshot.value.removedKeys;
951
- renderSnapshotRef.value = {
952
- ...renderSnapshot.value,
953
- removedKeys,
954
- removeTransform: Object.keys(removedKeys).some(function (key2) {
955
- return key2.startsWith("transform:");
956
- })
957
- };
958
- publishedSnapshotRef.current = renderSnapshot.value;
959
- }
960
- if (droppingLatch) {
961
- emitterSnapshotRef.value = null;
962
- emitterKeysRef.current = null;
963
- }
964
- });
965
- var {
966
- baseConfig,
967
- propertyConfigs
968
- } = (0, import_react.useMemo)(function () {
969
- if (isHydrating) {
970
- return {
971
- baseConfig: {
972
- type: "timing",
973
- duration: 0
974
- },
975
- propertyConfigs: {}
976
- };
977
- }
978
- return buildTransitionConfig(effectiveTransition, animations, animationState, getStyleKeys(animatedStyles));
979
- }, [isHydrating, effectiveTransition, animatedStyles, animationState]);
980
- var configRef = (0, import_react_native_reanimated.useSharedValue)({
981
- baseConfig,
982
- propertyConfigs,
983
- disableAnimation,
984
- isHydrating
985
- });
986
- (0, import_core.useIsomorphicLayoutEffect)(function () {
987
- configRef.value = {
988
- baseConfig,
989
- propertyConfigs,
990
- disableAnimation,
991
- isHydrating
992
- };
993
- }, [baseConfig, propertyConfigs, disableAnimation, isHydrating]);
994
- useStyleEmitter === null || useStyleEmitter === void 0 ? void 0 : useStyleEmitter(function (nextStyle, effectiveTransition2, pseudoActive) {
995
- if (isExitingJSRef.current) return;
996
- pseudoActiveRef.current = pseudoActive === true;
997
- var animateOnly = props.animateOnly;
998
- var transitionToUse = effectiveTransition2 !== null && effectiveTransition2 !== void 0 ? effectiveTransition2 : props.transition;
999
- var {
1000
- baseConfig: newBase,
1001
- propertyConfigs: newPropertyConfigs
1002
- } = buildTransitionConfig(transitionToUse, animations, animationState, getStyleKeys(nextStyle));
1003
- configRef.value = {
1004
- baseConfig: newBase,
1005
- propertyConfigs: newPropertyConfigs,
1006
- disableAnimation: configRef.value.disableAnimation,
1007
- isHydrating: configRef.value.isHydrating
1008
- };
1009
- var _emitterKeysRef_current;
1010
- var previousKeys = (_emitterKeysRef_current = emitterKeysRef.current) !== null && _emitterKeysRef_current !== void 0 ? _emitterKeysRef_current : committedRenderKeysRef.current;
1011
- var {
1012
- animated,
1013
- statics
1014
- } = splitAnimationStyles(nextStyle, isDark, configRef.value.disableAnimation, animateOnly);
1015
- var snapshot = buildSnapshot(animated, statics, getAnimatedTransforms(animated.transform), previousKeys, lastPaintedRef.current);
1016
- emitterSnapshotRef.value = snapshot.value;
1017
- emitterKeysRef.current = snapshot.keys;
1018
- lastPaintedRef.current = snapshot.painted;
1019
- if (process.env.NODE_ENV === "development" && props.debug && props.debug !== "profile") {
1020
- console.info("[animations-reanimated] useStyleEmitter update", {
1021
- animated,
1022
- statics,
1023
- transforms: snapshot.value.transforms
1024
- });
1025
- }
1026
- });
1027
- var exitKeysRegistered = (0, import_react.useRef)(false);
1028
- if (justStartedExiting && sendExitComplete) {
1029
- var exitKeys = getGatedKeys(renderSnapshot.value);
1030
- pendingExitKeysRef.current = new Set(exitKeys);
1031
- exitKeysRegistered.current = exitKeys.length > 0;
1032
- }
1033
- var previousDidAnimateStyleRef = (0, import_react.useRef)(null);
1034
- var didAnimateStyle = onDidAnimate ? JSON.stringify(style) : null;
1035
- var previousDidAnimateStyle = previousDidAnimateStyleRef.current;
1036
- var shouldRegisterDidAnimate = didAnimateStyle !== null && previousDidAnimateStyle !== null && previousDidAnimateStyle !== didAnimateStyle && !isExiting && !isEntering && !justFinishedEntering;
1037
- var didAnimateKeys = shouldRegisterDidAnimate ? getGatedKeys(renderSnapshot.value) : [];
1038
- (0, import_core.useIsomorphicLayoutEffect)(function () {
1039
- if (didAnimateStyle === null) {
1040
- previousDidAnimateStyleRef.current = null;
1041
- isCompletingAnimationRef.value = false;
1042
- return;
1043
- }
1044
- var previousStyleStillCurrent = previousDidAnimateStyleRef.current === previousDidAnimateStyle;
1045
- previousDidAnimateStyleRef.current = didAnimateStyle;
1046
- if (!shouldRegisterDidAnimate || !previousStyleStillCurrent) return;
1047
- var cycleId = ++didAnimateCycleIdRef.current;
1048
- pendingDidAnimateKeysRef.current = new Set(didAnimateKeys);
1049
- didAnimateCompletedRef.current = didAnimateKeys.length === 0;
1050
- isCompletingAnimationRef.value = didAnimateKeys.length > 0;
1051
- didAnimateCycleIdShared.value = cycleId;
1052
- if (didAnimateKeys.length === 0) {
1053
- var _onDidAnimateRef_current;
1054
- (_onDidAnimateRef_current = onDidAnimateRef.current) === null || _onDidAnimateRef_current === void 0 ? void 0 : _onDidAnimateRef_current.call(onDidAnimateRef);
1055
- }
1056
- }, [didAnimateStyle, shouldRegisterDidAnimate]);
1057
- import_react.default.useEffect(function () {
1058
- if (!justStartedExiting || !sendExitComplete) return;
1059
- if (!exitKeysRegistered.current && pendingExitKeysRef.current.size === 0) {
1060
- if (!exitCompletedRef.current) {
1061
- exitCompletedRef.current = true;
1062
- sendExitComplete();
1063
- }
1064
- }
1065
- }, [justStartedExiting, sendExitComplete]);
1066
- var mapperStateRef = (0, import_react_native_reanimated.useSharedValue)({
1067
- emitted: {}
1068
- });
1069
- var animatedStyle = (0, import_react_native_reanimated.useAnimatedStyle)(function () {
1070
- "worklet";
1071
-
1072
- var mapperState = mapperStateRef.value;
1073
- var config = configRef.value;
1074
- if (config.disableAnimation || config.isHydrating) {
1075
- updateMapperState(mapperStateRef, {});
1076
- return {};
1077
- }
1078
- var previouslyEmitted = mapperState.emitted;
1079
- var emitted = {};
1080
- var result = {};
1081
- var emitterSnapshot = emitterSnapshotRef.value;
1082
- var snapshot = emitterSnapshot !== null && emitterSnapshot !== void 0 ? emitterSnapshot : renderSnapshotRef.value;
1083
- var animatedValues = snapshot.animated;
1084
- var staticValues = snapshot.statics;
1085
- var currentlyExiting = isExitingRef.value;
1086
- var currentCycleId = exitCycleIdShared.value;
1087
- var currentlyCompletingAnimation = isCompletingAnimationRef.value;
1088
- var currentDidAnimateCycleId = didAnimateCycleIdShared.value;
1089
- for (var key2 in staticValues) {
1090
- result[key2] = staticValues[key2];
1091
- }
1092
- for (var key1 in snapshot.removedKeys) {
1093
- if (!key1.startsWith("transform:") && !(key1 in staticValues)) {
1094
- result[key1] = snapshot.clearValue;
1095
- }
1096
- }
1097
- for (var key22 in animatedValues) {
1098
- if (key22 === "transform") continue;
1099
- var targetValue = animatedValues[key22];
1100
- emitted[key22] = true;
1101
- if (typeof targetValue !== "number" && typeof targetValue !== "string") {
1102
- result[key22] = targetValue;
1103
- continue;
1104
- }
1105
- var _config_propertyConfigs_key;
1106
- result[key22] = animateSnapshotValue(key22, key22, targetValue, (_config_propertyConfigs_key = config.propertyConfigs[key22]) !== null && _config_propertyConfigs_key !== void 0 ? _config_propertyConfigs_key : config.baseConfig, !!previouslyEmitted[key22], snapshot.seeds[key22], !!snapshot.gatedKeys[key22], currentlyExiting, currentCycleId, currentlyCompletingAnimation, currentDidAnimateCycleId, markExitKeyDone, markDidAnimateKeyDone, !!COLOR_STYLE_KEYS[key22]);
1107
- }
1108
- var transforms = snapshot.transforms;
1109
- if (transforms.length > 0 || snapshot.removeTransform) {
1110
- var validTransforms = [];
1111
- var _iteratorNormalCompletion = true,
1112
- _didIteratorError = false,
1113
- _iteratorError = void 0;
1114
- try {
1115
- for (var _iterator = transforms[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
1116
- var t = _step.value;
1117
- if (!t) continue;
1118
- var keys = Object.keys(t);
1119
- if (keys.length === 0) continue;
1120
- var transformKey = keys[0];
1121
- var value = t[transformKey];
1122
- if (typeof value === "number" || typeof value === "string") {
1123
- var _config_propertyConfigs_transformKey;
1124
- var propConfig = (_config_propertyConfigs_transformKey = config.propertyConfigs[transformKey]) !== null && _config_propertyConfigs_transformKey !== void 0 ? _config_propertyConfigs_transformKey : config.baseConfig;
1125
- var subKey = `transform:${transformKey}`;
1126
- emitted[subKey] = true;
1127
- validTransforms.push({
1128
- [transformKey]: animateSnapshotValue(subKey, transformKey, value, propConfig, !!previouslyEmitted[subKey], snapshot.seeds[subKey], !!snapshot.gatedKeys[subKey], currentlyExiting, currentCycleId, currentlyCompletingAnimation, currentDidAnimateCycleId, markExitKeyDone, markDidAnimateKeyDone)
1129
- });
1130
- } else {
1131
- validTransforms.push(t);
1132
- }
1133
- }
1134
- } catch (err) {
1135
- _didIteratorError = true;
1136
- _iteratorError = err;
1137
- } finally {
1138
- try {
1139
- if (!_iteratorNormalCompletion && _iterator.return != null) {
1140
- _iterator.return();
1141
- }
1142
- } finally {
1143
- if (_didIteratorError) {
1144
- throw _iteratorError;
1145
- }
1146
- }
1147
- }
1148
- if (validTransforms.length > 0 || !("transform" in staticValues)) {
1149
- result.transform = validTransforms;
1150
- }
1151
- }
1152
- updateMapperState(mapperStateRef, emitted);
1153
- return result;
1154
- }, import_core.isWeb ? [
1155
- // pass SharedValues so the stable mapper watches them on web (no babel plugin)
1156
- renderSnapshotRef, emitterSnapshotRef, configRef, isExitingRef, exitCycleIdShared, markExitKeyDone, isCompletingAnimationRef, didAnimateCycleIdShared, markDidAnimateKeyDone] : void 0);
1157
- silenceAnimatedComponentDevCheck(animatedStyle);
1158
- if (process.env.NODE_ENV === "development" && props.debug && props.debug !== "profile") {
1159
- console.info("[animations-reanimated] useAnimations", {
1160
- animationKey,
1161
- componentState,
1162
- isExiting,
1163
- animatedStyles,
1164
- staticStyles,
1165
- baseConfig,
1166
- propertyConfigs
1167
- });
1168
- }
1169
- return {
1170
- style: [staticStyles, animatedStyle]
1171
- };
1172
- }
1173
- };
625
+ var animations = {};
626
+ for (var key in animationsConfig) {
627
+ animations[key] = cloneTransitionConfig({
628
+ type: "spring",
629
+ ...animationsConfig[key]
630
+ });
631
+ }
632
+ return {
633
+ needsCustomComponent: true,
634
+ View: import_core.isWeb ? AnimatedView : Animated.View,
635
+ Text: import_core.isWeb ? AnimatedText : Animated.Text,
636
+ isReactNative: true,
637
+ inputStyle: "value",
638
+ outputStyle: "inline",
639
+ avoidReRenders: true,
640
+ animations,
641
+ usePresence: import_use_presence.usePresence,
642
+ ResetPresence: import_use_presence.ResetPresence,
643
+ useAnimatedNumber(initial) {
644
+ var sharedValue = (0, import_react_native_reanimated.useSharedValue)(initial);
645
+ return (0, import_react.useMemo)(function() {
646
+ return {
647
+ getInstance() {
648
+ "worklet";
649
+ return sharedValue;
650
+ },
651
+ getValue() {
652
+ "worklet";
653
+ return sharedValue.value;
654
+ },
655
+ setValue(next) {
656
+ var config = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : { type: "spring" }, onFinish = arguments.length > 2 ? arguments[2] : void 0;
657
+ if (config.type === "direct") {
658
+ sharedValue.value = next;
659
+ onFinish === null || onFinish === void 0 ? void 0 : onFinish();
660
+ } else {
661
+ var cb = onFinish ? function(finished) {
662
+ "worklet";
663
+ if (finished !== false) {
664
+ (0, import_react_native_reanimated.runOnJS)(onFinish)();
665
+ }
666
+ } : void 0;
667
+ var animationConfig = cloneTransitionConfig(config);
668
+ if (import_core.isWeb) {
669
+ sharedValue.value = applyAnimation(next, animationConfig, cb);
670
+ } else {
671
+ (0, import_react_native_reanimated.runOnUI)(function(targetValue, animationConfig2) {
672
+ "worklet";
673
+ sharedValue.value = applyAnimation(targetValue, animationConfig2, cb);
674
+ })(next, animationConfig);
675
+ }
676
+ }
677
+ },
678
+ stop() {
679
+ (0, import_react_native_reanimated.cancelAnimation)(sharedValue);
680
+ }
681
+ };
682
+ }, [sharedValue]);
683
+ },
684
+ useAnimatedNumberReaction(param, onValue) {
685
+ var { value } = param;
686
+ var instance = value.getInstance();
687
+ return (0, import_react_native_reanimated.useAnimatedReaction)(function() {
688
+ return instance.value;
689
+ }, function(next, prev) {
690
+ if (prev !== next) {
691
+ (0, import_react_native_reanimated.runOnJS)(onValue)(next);
692
+ }
693
+ }, [onValue, instance]);
694
+ },
695
+ useAnimatedNumberStyle(val, getStyle) {
696
+ var instance = val.getInstance();
697
+ if (import_core.isWeb) {
698
+ return (0, import_react_native_reanimated.useAnimatedStyle)(function() {
699
+ "worklet";
700
+ return getStyle(instance.value);
701
+ }, [instance, getStyle]);
702
+ }
703
+ var styleVal = (0, import_react_native_reanimated.useDerivedValue)(function() {
704
+ "worklet";
705
+ return getStyle(instance.value);
706
+ });
707
+ var animatedStyle = (0, import_react_native_reanimated.useAnimatedStyle)(function() {
708
+ "worklet";
709
+ return styleVal.value;
710
+ });
711
+ silenceAnimatedComponentDevCheck(animatedStyle);
712
+ return animatedStyle;
713
+ },
714
+ useAnimatedNumbersStyle(vals, getStyle) {
715
+ var instances = vals.map(function(v) {
716
+ return v.getInstance();
717
+ });
718
+ var animatedStyle = (0, import_react_native_reanimated.useAnimatedStyle)(function() {
719
+ "worklet";
720
+ var currentValues = instances.map(function(inst) {
721
+ return inst.value;
722
+ });
723
+ return getStyle(...currentValues);
724
+ }, import_core.isWeb ? [getStyle, ...instances] : void 0);
725
+ silenceAnimatedComponentDevCheck(animatedStyle);
726
+ return animatedStyle;
727
+ },
728
+ useAnimations(animationProps) {
729
+ var { props, presence, style, componentState, useStyleEmitter, themeName, stateRef, styleState, onTransition } = animationProps;
730
+ var isHydrating = componentState.unmounted === true;
731
+ var isMounting = componentState.unmounted === "should-enter";
732
+ var isEntering = !!componentState.unmounted;
733
+ var isExiting = (presence === null || presence === void 0 ? void 0 : presence[0]) === false;
734
+ var wasEnteringRef = (0, import_react.useRef)(isEntering);
735
+ var justFinishedEntering = wasEnteringRef.current && !isEntering;
736
+ import_react.default.useEffect(function() {
737
+ wasEnteringRef.current = isEntering;
738
+ });
739
+ var _styleState_effectiveTransition;
740
+ var effectiveTransition = (_styleState_effectiveTransition = styleState === null || styleState === void 0 ? void 0 : styleState.effectiveTransition) !== null && _styleState_effectiveTransition !== void 0 ? _styleState_effectiveTransition : props.transition;
741
+ var normalized = (0, import_animation_helpers.normalizeTransition)(effectiveTransition);
742
+ var animationState = isExiting ? "exit" : isMounting || justFinishedEntering ? "enter" : "default";
743
+ var animationKey = (0, import_animation_helpers.getEffectiveAnimation)(normalized, animationState);
744
+ var disableAnimation = isHydrating || !animationKey;
745
+ var isDark = (themeName === null || themeName === void 0 ? void 0 : themeName.startsWith("dark")) || false;
746
+ var sendExitComplete = presence === null || presence === void 0 ? void 0 : presence[1];
747
+ var onTransitionRef = (0, import_react.useRef)(onTransition);
748
+ onTransitionRef.current = onTransition;
749
+ var emit = function(phase, cause, finished) {
750
+ var _onTransitionRef_current;
751
+ (_onTransitionRef_current = onTransitionRef.current) === null || _onTransitionRef_current === void 0 ? void 0 : _onTransitionRef_current.call(onTransitionRef, phase === "end" ? {
752
+ phase,
753
+ cause,
754
+ finished
755
+ } : {
756
+ phase,
757
+ cause
758
+ });
759
+ };
760
+ var enterStartedRef = (0, import_react.useRef)(false);
761
+ var exitStartedRef = (0, import_react.useRef)(false);
762
+ var updateStartedRef = (0, import_react.useRef)(false);
763
+ var isExitingJSRef = (0, import_react.useRef)(false);
764
+ isExitingJSRef.current = isExiting;
765
+ var updateCycleIdRef = (0, import_react.useRef)(0);
766
+ var pendingUpdateKeysRef = (0, import_react.useRef)(/* @__PURE__ */ new Set());
767
+ var updateCompletedRef = (0, import_react.useRef)(false);
768
+ var isCompletingUpdateRef = (0, import_react_native_reanimated.useSharedValue)(false);
769
+ var updateCycleIdShared = (0, import_react_native_reanimated.useSharedValue)(0);
770
+ var markUpdateKeyDone = (0, import_core.useEvent)(function(key2, cycleId, finished) {
771
+ if (!finished || cycleId !== updateCycleIdRef.current) return;
772
+ if (updateCompletedRef.current) return;
773
+ pendingUpdateKeysRef.current.delete(key2);
774
+ if (pendingUpdateKeysRef.current.size === 0) {
775
+ updateCompletedRef.current = true;
776
+ isCompletingUpdateRef.value = false;
777
+ if (updateStartedRef.current) {
778
+ updateStartedRef.current = false;
779
+ emit("end", "update", true);
780
+ }
781
+ }
782
+ });
783
+ var exitCycleIdRef = (0, import_react.useRef)(0);
784
+ var pendingExitKeysRef = (0, import_react.useRef)(/* @__PURE__ */ new Set());
785
+ var exitCompletedRef = (0, import_react.useRef)(false);
786
+ var wasExitingRef = (0, import_react.useRef)(false);
787
+ var justStartedExiting = isExiting && !wasExitingRef.current;
788
+ var justStoppedExiting = !isExiting && wasExitingRef.current;
789
+ var markExitKeyDone = (0, import_core.useEvent)(function(key2, cycleId, finished) {
790
+ if (cycleId !== exitCycleIdRef.current) return;
791
+ if (exitCompletedRef.current) return;
792
+ pendingExitKeysRef.current.delete(key2);
793
+ if (pendingExitKeysRef.current.size === 0) {
794
+ exitCompletedRef.current = true;
795
+ if (exitStartedRef.current) {
796
+ exitStartedRef.current = false;
797
+ emit("end", "exit", true);
798
+ }
799
+ sendExitComplete === null || sendExitComplete === void 0 ? void 0 : sendExitComplete();
800
+ }
801
+ });
802
+ var enterCycleIdRef = (0, import_react.useRef)(0);
803
+ var pendingEnterKeysRef = (0, import_react.useRef)(/* @__PURE__ */ new Set());
804
+ var enterCompletedRef = (0, import_react.useRef)(false);
805
+ var markEnterKeyDone = (0, import_core.useEvent)(function(key2, cycleId) {
806
+ if (cycleId !== enterCycleIdRef.current) return;
807
+ if (enterCompletedRef.current) return;
808
+ if (isExitingJSRef.current) return;
809
+ pendingEnterKeysRef.current.delete(key2);
810
+ if (pendingEnterKeysRef.current.size === 0) {
811
+ enterCompletedRef.current = true;
812
+ if (enterStartedRef.current) {
813
+ enterStartedRef.current = false;
814
+ emit("end", "enter", true);
815
+ }
816
+ }
817
+ });
818
+ var isExitingRef = (0, import_react_native_reanimated.useSharedValue)(isExiting);
819
+ var exitCycleIdShared = (0, import_react_native_reanimated.useSharedValue)(exitCycleIdRef.current);
820
+ var isCompletingEnterRef = (0, import_react_native_reanimated.useSharedValue)(false);
821
+ var enterCycleIdShared = (0, import_react_native_reanimated.useSharedValue)(enterCycleIdRef.current);
822
+ if (justStartedExiting) {
823
+ exitCycleIdRef.current++;
824
+ exitCompletedRef.current = false;
825
+ pendingExitKeysRef.current.clear();
826
+ enterCycleIdRef.current++;
827
+ pendingEnterKeysRef.current.clear();
828
+ updateCycleIdRef.current++;
829
+ pendingUpdateKeysRef.current.clear();
830
+ updateCompletedRef.current = true;
831
+ }
832
+ if (justStoppedExiting) {
833
+ exitCycleIdRef.current++;
834
+ pendingExitKeysRef.current.clear();
835
+ }
836
+ (0, import_core.useIsomorphicLayoutEffect)(function() {
837
+ isExitingRef.value = isExiting;
838
+ exitCycleIdShared.value = exitCycleIdRef.current;
839
+ isCompletingEnterRef.value = !isExiting && justFinishedEntering && Boolean(onTransitionRef.current);
840
+ enterCycleIdShared.value = enterCycleIdRef.current;
841
+ if (justStartedExiting) {
842
+ isCompletingUpdateRef.value = false;
843
+ updateCycleIdShared.value = updateCycleIdRef.current;
844
+ }
845
+ }, [
846
+ isExiting,
847
+ justFinishedEntering,
848
+ exitCycleIdRef.current,
849
+ enterCycleIdRef.current,
850
+ justStartedExiting
851
+ ]);
852
+ (0, import_core.useIsomorphicLayoutEffect)(function() {
853
+ if (justStoppedExiting && exitStartedRef.current && !exitCompletedRef.current) {
854
+ exitStartedRef.current = false;
855
+ emit("end", "exit", false);
856
+ }
857
+ }, [justStoppedExiting]);
858
+ import_react.default.useEffect(function() {
859
+ wasExitingRef.current = isExiting;
860
+ });
861
+ var committedRenderKeysRef = (0, import_react.useRef)(/* @__PURE__ */ new Set());
862
+ var lastPaintedRef = (0, import_react.useRef)({});
863
+ var carryRef = (0, import_react.useRef)({});
864
+ var { animatedStyles, staticStyles, nextCarry } = (0, import_react.useMemo)(function() {
865
+ var animateOnly = props.animateOnly;
866
+ var { animated, statics } = splitAnimationStyles(style, isDark, disableAnimation, animateOnly);
867
+ var nextCarry2 = cloneStyleRecord(carryRef.current);
868
+ for (var key2 in nextCarry2) {
869
+ if (!(key2 in animated)) delete nextCarry2[key2];
870
+ }
871
+ for (var key1 in animated) {
872
+ if (!(key1 in nextCarry2)) {
873
+ nextCarry2[key1] = cloneAnimationValue(animated[key1]);
874
+ }
875
+ statics[key1] = nextCarry2[key1];
876
+ }
877
+ return {
878
+ animatedStyles: animated,
879
+ staticStyles: statics,
880
+ nextCarry: nextCarry2
881
+ };
882
+ }, [
883
+ disableAnimation,
884
+ style,
885
+ isDark,
886
+ props.animateOnly
887
+ ]);
888
+ var renderSnapshot = (0, import_react.useMemo)(function() {
889
+ return buildSnapshot(animatedStyles, staticStyles, getAnimatedTransforms(animatedStyles.transform), committedRenderKeysRef.current, lastPaintedRef.current);
890
+ }, [animatedStyles, staticStyles]);
891
+ var renderSnapshotRef = (0, import_react_native_reanimated.useSharedValue)({
892
+ animated: {},
893
+ statics: {},
894
+ transforms: [],
895
+ gatedKeys: {},
896
+ seeds: {},
897
+ removedKeys: {},
898
+ removeTransform: false,
899
+ clearValue: import_core.isWeb ? "" : null
900
+ });
901
+ var emitterSnapshotRef = (0, import_react_native_reanimated.useSharedValue)(null);
902
+ var emitterKeysRef = (0, import_react.useRef)(null);
903
+ (0, import_core.useIsomorphicLayoutEffect)(function() {
904
+ carryRef.current = nextCarry;
905
+ committedRenderKeysRef.current = renderSnapshot.keys;
906
+ lastPaintedRef.current = renderSnapshot.painted;
907
+ }, [nextCarry, renderSnapshot]);
908
+ var pseudoActiveRef = (0, import_react.useRef)(false);
909
+ var publishedSnapshotRef = (0, import_react.useRef)(null);
910
+ (0, import_core.useIsomorphicLayoutEffect)(function() {
911
+ var renderChanged = publishedSnapshotRef.current !== renderSnapshot.value;
912
+ var droppingLatch = (isExiting || !pseudoActiveRef.current && publishedSnapshotRef.current !== null && renderChanged) && emitterSnapshotRef.value !== null;
913
+ var emitterKeys = droppingLatch ? emitterKeysRef.current : null;
914
+ if (droppingLatch || renderChanged) {
915
+ var removedKeys = emitterKeys ? {
916
+ ...renderSnapshot.value.removedKeys,
917
+ ...getRemovedAnimatedKeys(renderSnapshot.keys, emitterKeys)
918
+ } : renderSnapshot.value.removedKeys;
919
+ renderSnapshotRef.value = {
920
+ ...renderSnapshot.value,
921
+ removedKeys,
922
+ removeTransform: Object.keys(removedKeys).some(function(key2) {
923
+ return key2.startsWith("transform:");
924
+ })
925
+ };
926
+ publishedSnapshotRef.current = renderSnapshot.value;
927
+ }
928
+ if (droppingLatch) {
929
+ emitterSnapshotRef.value = null;
930
+ emitterKeysRef.current = null;
931
+ }
932
+ });
933
+ var { baseConfig, propertyConfigs } = (0, import_react.useMemo)(function() {
934
+ if (isHydrating) {
935
+ return {
936
+ baseConfig: {
937
+ type: "timing",
938
+ duration: 0
939
+ },
940
+ propertyConfigs: {}
941
+ };
942
+ }
943
+ return buildTransitionConfig(effectiveTransition, animations, animationState, getStyleKeys(animatedStyles));
944
+ }, [
945
+ isHydrating,
946
+ effectiveTransition,
947
+ animatedStyles,
948
+ animationState
949
+ ]);
950
+ var configRef = (0, import_react_native_reanimated.useSharedValue)({
951
+ baseConfig,
952
+ propertyConfigs,
953
+ disableAnimation,
954
+ isHydrating
955
+ });
956
+ (0, import_core.useIsomorphicLayoutEffect)(function() {
957
+ configRef.value = {
958
+ baseConfig,
959
+ propertyConfigs,
960
+ disableAnimation,
961
+ isHydrating
962
+ };
963
+ }, [
964
+ baseConfig,
965
+ propertyConfigs,
966
+ disableAnimation,
967
+ isHydrating
968
+ ]);
969
+ useStyleEmitter === null || useStyleEmitter === void 0 ? void 0 : useStyleEmitter(function(nextStyle, effectiveTransition2, pseudoActive) {
970
+ if (isExitingJSRef.current) return;
971
+ pseudoActiveRef.current = pseudoActive === true;
972
+ var animateOnly = props.animateOnly;
973
+ var transitionToUse = effectiveTransition2 !== null && effectiveTransition2 !== void 0 ? effectiveTransition2 : props.transition;
974
+ var { baseConfig: newBase, propertyConfigs: newPropertyConfigs } = buildTransitionConfig(transitionToUse, animations, animationState, getStyleKeys(nextStyle));
975
+ configRef.value = {
976
+ baseConfig: newBase,
977
+ propertyConfigs: newPropertyConfigs,
978
+ disableAnimation: configRef.value.disableAnimation,
979
+ isHydrating: configRef.value.isHydrating
980
+ };
981
+ var _emitterKeysRef_current;
982
+ var previousKeys = (_emitterKeysRef_current = emitterKeysRef.current) !== null && _emitterKeysRef_current !== void 0 ? _emitterKeysRef_current : committedRenderKeysRef.current;
983
+ var { animated, statics } = splitAnimationStyles(nextStyle, isDark, configRef.value.disableAnimation, animateOnly);
984
+ var snapshot = buildSnapshot(animated, statics, getAnimatedTransforms(animated.transform), previousKeys, lastPaintedRef.current);
985
+ emitterSnapshotRef.value = snapshot.value;
986
+ emitterKeysRef.current = snapshot.keys;
987
+ lastPaintedRef.current = snapshot.painted;
988
+ if (process.env.NODE_ENV === "development" && props.debug && props.debug !== "profile") {
989
+ console.info("[animations-reanimated] useStyleEmitter update", {
990
+ animated,
991
+ statics,
992
+ transforms: snapshot.value.transforms
993
+ });
994
+ }
995
+ });
996
+ var exitKeysRegistered = (0, import_react.useRef)(false);
997
+ var enterKeysRegistered = (0, import_react.useRef)(false);
998
+ if (!isExiting && justFinishedEntering && onTransition) {
999
+ var enterKeys = getGatedKeys(renderSnapshot.value);
1000
+ enterCycleIdRef.current++;
1001
+ enterCompletedRef.current = false;
1002
+ pendingEnterKeysRef.current = new Set(enterKeys);
1003
+ enterKeysRegistered.current = enterKeys.length > 0;
1004
+ }
1005
+ if (justStartedExiting && sendExitComplete) {
1006
+ var exitKeys = getGatedKeys(renderSnapshot.value);
1007
+ pendingExitKeysRef.current = new Set(exitKeys);
1008
+ exitKeysRegistered.current = exitKeys.length > 0;
1009
+ }
1010
+ var previousUpdateStyleRef = (0, import_react.useRef)(null);
1011
+ var updateStyle = onTransition ? JSON.stringify(style) : null;
1012
+ var previousUpdateStyle = previousUpdateStyleRef.current;
1013
+ var shouldRegisterUpdate = updateStyle !== null && previousUpdateStyle !== null && previousUpdateStyle !== updateStyle && !isExiting && !isEntering && !justFinishedEntering;
1014
+ var updateKeys = shouldRegisterUpdate ? getGatedKeys(renderSnapshot.value) : [];
1015
+ (0, import_core.useIsomorphicLayoutEffect)(function() {
1016
+ if (updateStyle === null) {
1017
+ previousUpdateStyleRef.current = null;
1018
+ isCompletingUpdateRef.value = false;
1019
+ return;
1020
+ }
1021
+ var previousStyleStillCurrent = previousUpdateStyleRef.current === previousUpdateStyle;
1022
+ previousUpdateStyleRef.current = updateStyle;
1023
+ if (!shouldRegisterUpdate || !previousStyleStillCurrent) return;
1024
+ var cycleId = ++updateCycleIdRef.current;
1025
+ pendingUpdateKeysRef.current = new Set(updateKeys);
1026
+ updateCompletedRef.current = updateKeys.length === 0;
1027
+ isCompletingUpdateRef.value = updateKeys.length > 0;
1028
+ updateCycleIdShared.value = cycleId;
1029
+ if (updateStartedRef.current) {
1030
+ emit("end", "update", false);
1031
+ }
1032
+ updateStartedRef.current = true;
1033
+ emit("start", "update");
1034
+ if (updateKeys.length === 0) {
1035
+ updateStartedRef.current = false;
1036
+ emit("end", "update", true);
1037
+ }
1038
+ }, [updateStyle, shouldRegisterUpdate]);
1039
+ import_react.default.useEffect(function() {
1040
+ if (!justStartedExiting || !sendExitComplete) return;
1041
+ if (enterStartedRef.current) {
1042
+ enterStartedRef.current = false;
1043
+ emit("end", "enter", false);
1044
+ }
1045
+ if (updateStartedRef.current) {
1046
+ updateStartedRef.current = false;
1047
+ emit("end", "update", false);
1048
+ }
1049
+ if (onTransitionRef.current && !exitStartedRef.current) {
1050
+ exitStartedRef.current = true;
1051
+ emit("start", "exit");
1052
+ }
1053
+ if (!exitKeysRegistered.current && pendingExitKeysRef.current.size === 0) {
1054
+ if (!exitCompletedRef.current) {
1055
+ exitCompletedRef.current = true;
1056
+ if (exitStartedRef.current) {
1057
+ exitStartedRef.current = false;
1058
+ emit("end", "exit", true);
1059
+ }
1060
+ sendExitComplete();
1061
+ }
1062
+ }
1063
+ }, [justStartedExiting, sendExitComplete]);
1064
+ import_react.default.useEffect(function() {
1065
+ if (isExiting || !justFinishedEntering || !onTransition) return;
1066
+ if (!enterStartedRef.current) {
1067
+ enterStartedRef.current = true;
1068
+ emit("start", "enter");
1069
+ }
1070
+ if (!enterKeysRegistered.current && pendingEnterKeysRef.current.size === 0) {
1071
+ if (!enterCompletedRef.current) {
1072
+ enterCompletedRef.current = true;
1073
+ if (enterStartedRef.current) {
1074
+ enterStartedRef.current = false;
1075
+ emit("end", "enter", true);
1076
+ }
1077
+ }
1078
+ }
1079
+ }, [
1080
+ isExiting,
1081
+ justFinishedEntering,
1082
+ onTransition
1083
+ ]);
1084
+ var mapperStateRef = (0, import_react_native_reanimated.useSharedValue)({ emitted: {} });
1085
+ var animatedStyle = (0, import_react_native_reanimated.useAnimatedStyle)(function() {
1086
+ "worklet";
1087
+ var mapperState = mapperStateRef.value;
1088
+ var config = configRef.value;
1089
+ if (config.disableAnimation || config.isHydrating) {
1090
+ updateMapperState(mapperStateRef, {});
1091
+ return {};
1092
+ }
1093
+ var previouslyEmitted = mapperState.emitted;
1094
+ var emitted = {};
1095
+ var result = {};
1096
+ var emitterSnapshot = emitterSnapshotRef.value;
1097
+ var snapshot = emitterSnapshot !== null && emitterSnapshot !== void 0 ? emitterSnapshot : renderSnapshotRef.value;
1098
+ var animatedValues = snapshot.animated;
1099
+ var staticValues = snapshot.statics;
1100
+ var currentlyExiting = isExitingRef.value;
1101
+ var currentCycleId = exitCycleIdShared.value;
1102
+ var currentlyCompletingEnter = isCompletingEnterRef.value;
1103
+ var currentEnterCycleId = enterCycleIdShared.value;
1104
+ var currentlyCompletingUpdate = isCompletingUpdateRef.value;
1105
+ var currentUpdateCycleId = updateCycleIdShared.value;
1106
+ for (var key2 in staticValues) {
1107
+ result[key2] = staticValues[key2];
1108
+ }
1109
+ for (var key1 in snapshot.removedKeys) {
1110
+ if (!key1.startsWith("transform:") && !(key1 in staticValues)) {
1111
+ result[key1] = snapshot.clearValue;
1112
+ }
1113
+ }
1114
+ for (var key22 in animatedValues) {
1115
+ if (key22 === "transform") continue;
1116
+ var targetValue = animatedValues[key22];
1117
+ emitted[key22] = true;
1118
+ if (typeof targetValue !== "number" && typeof targetValue !== "string") {
1119
+ result[key22] = targetValue;
1120
+ continue;
1121
+ }
1122
+ var _config_propertyConfigs_key;
1123
+ result[key22] = animateSnapshotValue(key22, key22, targetValue, (_config_propertyConfigs_key = config.propertyConfigs[key22]) !== null && _config_propertyConfigs_key !== void 0 ? _config_propertyConfigs_key : config.baseConfig, !!previouslyEmitted[key22], snapshot.seeds[key22], !!snapshot.gatedKeys[key22], currentlyExiting, currentCycleId, currentlyCompletingEnter, currentEnterCycleId, currentlyCompletingUpdate, currentUpdateCycleId, markExitKeyDone, markEnterKeyDone, markUpdateKeyDone, !!COLOR_STYLE_KEYS[key22]);
1124
+ }
1125
+ var transforms = snapshot.transforms;
1126
+ if (transforms.length > 0 || snapshot.removeTransform) {
1127
+ var validTransforms = [];
1128
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
1129
+ try {
1130
+ for (var _iterator = transforms[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
1131
+ var t = _step.value;
1132
+ if (!t) continue;
1133
+ var keys = Object.keys(t);
1134
+ if (keys.length === 0) continue;
1135
+ var transformKey = keys[0];
1136
+ var value = t[transformKey];
1137
+ if (typeof value === "number" || typeof value === "string") {
1138
+ var _config_propertyConfigs_transformKey;
1139
+ var propConfig = (_config_propertyConfigs_transformKey = config.propertyConfigs[transformKey]) !== null && _config_propertyConfigs_transformKey !== void 0 ? _config_propertyConfigs_transformKey : config.baseConfig;
1140
+ var subKey = `transform:${transformKey}`;
1141
+ emitted[subKey] = true;
1142
+ validTransforms.push({ [transformKey]: animateSnapshotValue(subKey, transformKey, value, propConfig, !!previouslyEmitted[subKey], snapshot.seeds[subKey], !!snapshot.gatedKeys[subKey], currentlyExiting, currentCycleId, currentlyCompletingEnter, currentEnterCycleId, currentlyCompletingUpdate, currentUpdateCycleId, markExitKeyDone, markEnterKeyDone, markUpdateKeyDone) });
1143
+ } else {
1144
+ validTransforms.push(t);
1145
+ }
1146
+ }
1147
+ } catch (err) {
1148
+ _didIteratorError = true;
1149
+ _iteratorError = err;
1150
+ } finally {
1151
+ try {
1152
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
1153
+ _iterator.return();
1154
+ }
1155
+ } finally {
1156
+ if (_didIteratorError) {
1157
+ throw _iteratorError;
1158
+ }
1159
+ }
1160
+ }
1161
+ if (validTransforms.length > 0 || !("transform" in staticValues)) {
1162
+ result.transform = validTransforms;
1163
+ }
1164
+ }
1165
+ updateMapperState(mapperStateRef, emitted);
1166
+ return result;
1167
+ }, import_core.isWeb ? [
1168
+ renderSnapshotRef,
1169
+ emitterSnapshotRef,
1170
+ configRef,
1171
+ isExitingRef,
1172
+ exitCycleIdShared,
1173
+ markExitKeyDone,
1174
+ isCompletingEnterRef,
1175
+ enterCycleIdShared,
1176
+ markEnterKeyDone,
1177
+ isCompletingUpdateRef,
1178
+ updateCycleIdShared,
1179
+ markUpdateKeyDone
1180
+ ] : void 0);
1181
+ silenceAnimatedComponentDevCheck(animatedStyle);
1182
+ if (process.env.NODE_ENV === "development" && props.debug && props.debug !== "profile") {
1183
+ console.info("[animations-reanimated] useAnimations", {
1184
+ animationKey,
1185
+ componentState,
1186
+ isExiting,
1187
+ animatedStyles,
1188
+ staticStyles,
1189
+ baseConfig,
1190
+ propertyConfigs
1191
+ });
1192
+ }
1193
+ return { style: [staticStyles, animatedStyle] };
1194
+ }
1195
+ };
1174
1196
  }
1197
+
1175
1198
  //# sourceMappingURL=createAnimations.native.js.map