@player-devtools/profiler-plugin 0.13.1--canary.16.915

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/ProfilerDevtoolsPlugin.native.js +2237 -0
  2. package/dist/ProfilerDevtoolsPlugin.native.js.map +1 -0
  3. package/dist/cjs/index.cjs +346 -0
  4. package/dist/cjs/index.cjs.map +1 -0
  5. package/dist/index.legacy-esm.js +325 -0
  6. package/dist/index.mjs +325 -0
  7. package/dist/index.mjs.map +1 -0
  8. package/package.json +39 -0
  9. package/src/__tests__/__snapshots__/plugin.test.ts.snap +1484 -0
  10. package/src/__tests__/addProfilerInterceptorsToHooks.test.ts +60 -0
  11. package/src/__tests__/plugin.test.ts +168 -0
  12. package/src/addProfilerInterceptorsToHooks.ts +89 -0
  13. package/src/constants.ts +7 -0
  14. package/src/helpers/__tests__/hasHooks.test.ts +55 -0
  15. package/src/helpers/__tests__/isMatchingPaths.test.ts +24 -0
  16. package/src/helpers/__tests__/isRecordType.test.ts +31 -0
  17. package/src/helpers/__tests__/profiler.test.ts +282 -0
  18. package/src/helpers/__tests__/transformProfilerData.test.ts +151 -0
  19. package/src/helpers/hasHooks.ts +9 -0
  20. package/src/helpers/index.ts +5 -0
  21. package/src/helpers/isMatchingPaths.ts +5 -0
  22. package/src/helpers/isRecordType.ts +2 -0
  23. package/src/helpers/profiler.ts +114 -0
  24. package/src/helpers/transformProfilerData.ts +51 -0
  25. package/src/index.ts +1 -0
  26. package/src/plugin.ts +185 -0
  27. package/src/types.ts +16 -0
  28. package/types/addProfilerInterceptorsToHooks.d.ts +4 -0
  29. package/types/constants.d.ts +2 -0
  30. package/types/helpers/hasHooks.d.ts +5 -0
  31. package/types/helpers/index.d.ts +6 -0
  32. package/types/helpers/isMatchingPaths.d.ts +2 -0
  33. package/types/helpers/isRecordType.d.ts +2 -0
  34. package/types/helpers/profiler.d.ts +22 -0
  35. package/types/helpers/transformProfilerData.d.ts +3 -0
  36. package/types/index.d.ts +2 -0
  37. package/types/plugin.d.ts +20 -0
  38. package/types/types.d.ts +16 -0
@@ -0,0 +1,2237 @@
1
+ "use strict";
2
+ function _array_like_to_array(arr, len) {
3
+ if (len == null || len > arr.length) len = arr.length;
4
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
5
+ return arr2;
6
+ }
7
+ function _array_with_holes(arr) {
8
+ if (Array.isArray(arr)) return arr;
9
+ }
10
+ function _array_without_holes(arr) {
11
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
12
+ }
13
+ function _assert_this_initialized(self) {
14
+ if (self === void 0) {
15
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
16
+ }
17
+ return self;
18
+ }
19
+ function _class_call_check(instance, Constructor) {
20
+ if (!(instance instanceof Constructor)) {
21
+ throw new TypeError("Cannot call a class as a function");
22
+ }
23
+ }
24
+ function _defineProperties(target, props) {
25
+ for(var i = 0; i < props.length; i++){
26
+ var descriptor = props[i];
27
+ descriptor.enumerable = descriptor.enumerable || false;
28
+ descriptor.configurable = true;
29
+ if ("value" in descriptor) descriptor.writable = true;
30
+ Object.defineProperty(target, descriptor.key, descriptor);
31
+ }
32
+ }
33
+ function _create_class(Constructor, protoProps, staticProps) {
34
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
35
+ if (staticProps) _defineProperties(Constructor, staticProps);
36
+ return Constructor;
37
+ }
38
+ function _define_property(obj, key, value) {
39
+ if (key in obj) {
40
+ Object.defineProperty(obj, key, {
41
+ value: value,
42
+ enumerable: true,
43
+ configurable: true,
44
+ writable: true
45
+ });
46
+ } else {
47
+ obj[key] = value;
48
+ }
49
+ return obj;
50
+ }
51
+ function _get(target, property, receiver) {
52
+ if (typeof Reflect !== "undefined" && Reflect.get) {
53
+ _get = Reflect.get;
54
+ } else {
55
+ _get = function get(target, property, receiver) {
56
+ var base = _super_prop_base(target, property);
57
+ if (!base) return;
58
+ var desc = Object.getOwnPropertyDescriptor(base, property);
59
+ if (desc.get) {
60
+ return desc.get.call(receiver || target);
61
+ }
62
+ return desc.value;
63
+ };
64
+ }
65
+ return _get(target, property, receiver || target);
66
+ }
67
+ function _get_prototype_of(o) {
68
+ _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
69
+ return o.__proto__ || Object.getPrototypeOf(o);
70
+ };
71
+ return _get_prototype_of(o);
72
+ }
73
+ function _inherits(subClass, superClass) {
74
+ if (typeof superClass !== "function" && superClass !== null) {
75
+ throw new TypeError("Super expression must either be null or a function");
76
+ }
77
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
78
+ constructor: {
79
+ value: subClass,
80
+ writable: true,
81
+ configurable: true
82
+ }
83
+ });
84
+ if (superClass) _set_prototype_of(subClass, superClass);
85
+ }
86
+ function _instanceof(left, right) {
87
+ if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
88
+ return !!right[Symbol.hasInstance](left);
89
+ } else {
90
+ return left instanceof right;
91
+ }
92
+ }
93
+ function _iterable_to_array(iter) {
94
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
95
+ }
96
+ function _iterable_to_array_limit(arr, i) {
97
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
98
+ if (_i == null) return;
99
+ var _arr = [];
100
+ var _n = true;
101
+ var _d = false;
102
+ var _s, _e;
103
+ try {
104
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
105
+ _arr.push(_s.value);
106
+ if (i && _arr.length === i) break;
107
+ }
108
+ } catch (err) {
109
+ _d = true;
110
+ _e = err;
111
+ } finally{
112
+ try {
113
+ if (!_n && _i["return"] != null) _i["return"]();
114
+ } finally{
115
+ if (_d) throw _e;
116
+ }
117
+ }
118
+ return _arr;
119
+ }
120
+ function _non_iterable_rest() {
121
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
122
+ }
123
+ function _non_iterable_spread() {
124
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
125
+ }
126
+ function _object_spread(target) {
127
+ for(var i = 1; i < arguments.length; i++){
128
+ var source = arguments[i] != null ? arguments[i] : {};
129
+ var ownKeys = Object.keys(source);
130
+ if (typeof Object.getOwnPropertySymbols === "function") {
131
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
132
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
133
+ }));
134
+ }
135
+ ownKeys.forEach(function(key) {
136
+ _define_property(target, key, source[key]);
137
+ });
138
+ }
139
+ return target;
140
+ }
141
+ function ownKeys(object, enumerableOnly) {
142
+ var keys = Object.keys(object);
143
+ if (Object.getOwnPropertySymbols) {
144
+ var symbols = Object.getOwnPropertySymbols(object);
145
+ if (enumerableOnly) {
146
+ symbols = symbols.filter(function(sym) {
147
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
148
+ });
149
+ }
150
+ keys.push.apply(keys, symbols);
151
+ }
152
+ return keys;
153
+ }
154
+ function _object_spread_props(target, source) {
155
+ source = source != null ? source : {};
156
+ if (Object.getOwnPropertyDescriptors) {
157
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
158
+ } else {
159
+ ownKeys(Object(source)).forEach(function(key) {
160
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
161
+ });
162
+ }
163
+ return target;
164
+ }
165
+ function _possible_constructor_return(self, call) {
166
+ if (call && (_type_of(call) === "object" || typeof call === "function")) {
167
+ return call;
168
+ }
169
+ return _assert_this_initialized(self);
170
+ }
171
+ function _set_prototype_of(o, p) {
172
+ _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
173
+ o.__proto__ = p;
174
+ return o;
175
+ };
176
+ return _set_prototype_of(o, p);
177
+ }
178
+ function _sliced_to_array(arr, i) {
179
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
180
+ }
181
+ function _super_prop_base(object, property) {
182
+ while(!Object.prototype.hasOwnProperty.call(object, property)){
183
+ object = _get_prototype_of(object);
184
+ if (object === null) break;
185
+ }
186
+ return object;
187
+ }
188
+ function _to_consumable_array(arr) {
189
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
190
+ }
191
+ function _type_of(obj) {
192
+ "@swc/helpers - typeof";
193
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
194
+ }
195
+ function _unsupported_iterable_to_array(o, minLen) {
196
+ if (!o) return;
197
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
198
+ var n = Object.prototype.toString.call(o).slice(8, -1);
199
+ if (n === "Object" && o.constructor) n = o.constructor.name;
200
+ if (n === "Map" || n === "Set") return Array.from(n);
201
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
202
+ }
203
+ function _is_native_reflect_construct() {
204
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
205
+ if (Reflect.construct.sham) return false;
206
+ if (typeof Proxy === "function") return true;
207
+ try {
208
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
209
+ return true;
210
+ } catch (e) {
211
+ return false;
212
+ }
213
+ }
214
+ function _create_super(Derived) {
215
+ var hasNativeReflectConstruct = _is_native_reflect_construct();
216
+ return function _createSuperInternal() {
217
+ var Super = _get_prototype_of(Derived), result;
218
+ if (hasNativeReflectConstruct) {
219
+ var NewTarget = _get_prototype_of(this).constructor;
220
+ result = Reflect.construct(Super, arguments, NewTarget);
221
+ } else {
222
+ result = Super.apply(this, arguments);
223
+ }
224
+ return _possible_constructor_return(this, result);
225
+ };
226
+ }
227
+ var ProfilerDevtoolsPlugin = function() {
228
+ var dsetAssign = function dsetAssign(obj, keys, value) {
229
+ var merge2 = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false;
230
+ var key = keys[keys.length - 1];
231
+ if (key === void 0) throw Error("Unable to assign at path containing undefined keys");
232
+ var _acc_key2;
233
+ var target = keys.slice(0, -1).reduce(function(acc, key2) {
234
+ return (_acc_key2 = acc[key2]) !== null && _acc_key2 !== void 0 ? _acc_key2 : acc[key2] = {};
235
+ }, obj);
236
+ target[key] = deepAssign(target[key], value, merge2);
237
+ };
238
+ var die = function die(error) {
239
+ for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
240
+ args[_key - 1] = arguments[_key];
241
+ }
242
+ if (false) {
243
+ var e = errors[error];
244
+ var msg = typeof e === "function" ? e.apply(null, args) : e;
245
+ throw new Error("[Immer] ".concat(msg));
246
+ }
247
+ throw new Error("[Immer] minified error nr: ".concat(error, ". Full error at: https://bit.ly/3cXEKWf"));
248
+ };
249
+ var isDraft = function isDraft(value) {
250
+ return !!value && !!value[DRAFT_STATE];
251
+ };
252
+ var isDraftable = function isDraftable(value) {
253
+ var _value_constructor;
254
+ if (!value) return false;
255
+ return isPlainObject(value) || Array.isArray(value) || !!value[DRAFTABLE] || !!((_value_constructor = value.constructor) === null || _value_constructor === void 0 ? void 0 : _value_constructor[DRAFTABLE]) || isMap(value) || isSet(value);
256
+ };
257
+ var isPlainObject = function isPlainObject(value) {
258
+ if (!value || typeof value !== "object") return false;
259
+ var proto = getPrototypeOf(value);
260
+ if (proto === null) {
261
+ return true;
262
+ }
263
+ var Ctor = Object.hasOwnProperty.call(proto, "constructor") && proto.constructor;
264
+ if (Ctor === Object) return true;
265
+ return typeof Ctor == "function" && Function.toString.call(Ctor) === objectCtorString;
266
+ };
267
+ var each = function each(obj, iter) {
268
+ if (getArchtype(obj) === 0) {
269
+ Reflect.ownKeys(obj).forEach(function(key) {
270
+ iter(key, obj[key], obj);
271
+ });
272
+ } else {
273
+ obj.forEach(function(entry, index) {
274
+ return iter(index, entry, obj);
275
+ });
276
+ }
277
+ };
278
+ var getArchtype = function getArchtype(thing) {
279
+ var state = thing[DRAFT_STATE];
280
+ return state ? state.type_ : Array.isArray(thing) ? 1 : isMap(thing) ? 2 : isSet(thing) ? 3 : 0;
281
+ };
282
+ var has = function has(thing, prop) {
283
+ return getArchtype(thing) === 2 ? thing.has(prop) : Object.prototype.hasOwnProperty.call(thing, prop);
284
+ };
285
+ var set = function set(thing, propOrOldValue, value) {
286
+ var t = getArchtype(thing);
287
+ if (t === 2) thing.set(propOrOldValue, value);
288
+ else if (t === 3) {
289
+ thing.add(value);
290
+ } else thing[propOrOldValue] = value;
291
+ };
292
+ var is = function is(x, y) {
293
+ if (x === y) {
294
+ return x !== 0 || 1 / x === 1 / y;
295
+ } else {
296
+ return x !== x && y !== y;
297
+ }
298
+ };
299
+ var isMap = function isMap(target) {
300
+ return _instanceof(target, Map);
301
+ };
302
+ var isSet = function isSet(target) {
303
+ return _instanceof(target, Set);
304
+ };
305
+ var latest = function latest(state) {
306
+ return state.copy_ || state.base_;
307
+ };
308
+ var shallowCopy = function shallowCopy(base, strict) {
309
+ if (isMap(base)) {
310
+ return new Map(base);
311
+ }
312
+ if (isSet(base)) {
313
+ return new Set(base);
314
+ }
315
+ if (Array.isArray(base)) return Array.prototype.slice.call(base);
316
+ var isPlain = isPlainObject(base);
317
+ if (strict === true || strict === "class_only" && !isPlain) {
318
+ var descriptors = Object.getOwnPropertyDescriptors(base);
319
+ delete descriptors[DRAFT_STATE];
320
+ var keys = Reflect.ownKeys(descriptors);
321
+ for(var i = 0; i < keys.length; i++){
322
+ var key = keys[i];
323
+ var desc = descriptors[key];
324
+ if (desc.writable === false) {
325
+ desc.writable = true;
326
+ desc.configurable = true;
327
+ }
328
+ if (desc.get || desc.set) descriptors[key] = {
329
+ configurable: true,
330
+ writable: true,
331
+ // could live with !!desc.set as well here...
332
+ enumerable: desc.enumerable,
333
+ value: base[key]
334
+ };
335
+ }
336
+ return Object.create(getPrototypeOf(base), descriptors);
337
+ } else {
338
+ var proto = getPrototypeOf(base);
339
+ if (proto !== null && isPlain) {
340
+ return _object_spread({}, base);
341
+ }
342
+ var obj = Object.create(proto);
343
+ return Object.assign(obj, base);
344
+ }
345
+ };
346
+ var dontMutateFrozenCollections = function dontMutateFrozenCollections() {
347
+ die(2);
348
+ };
349
+ var isFrozen = function isFrozen(obj) {
350
+ return Object.isFrozen(obj);
351
+ };
352
+ var getPlugin = function getPlugin(pluginKey) {
353
+ var plugin = plugins[pluginKey];
354
+ if (!plugin) {
355
+ die(0, pluginKey);
356
+ }
357
+ return plugin;
358
+ };
359
+ var getCurrentScope = function getCurrentScope() {
360
+ return currentScope;
361
+ };
362
+ var createScope = function createScope(parent_, immer_) {
363
+ return {
364
+ drafts_: [],
365
+ parent_: parent_,
366
+ immer_: immer_,
367
+ // Whenever the modified draft contains a draft from another scope, we
368
+ // need to prevent auto-freezing so the unowned draft can be finalized.
369
+ canAutoFreeze_: true,
370
+ unfinalizedDrafts_: 0
371
+ };
372
+ };
373
+ var usePatchesInScope = function usePatchesInScope(scope, patchListener) {
374
+ if (patchListener) {
375
+ getPlugin("Patches");
376
+ scope.patches_ = [];
377
+ scope.inversePatches_ = [];
378
+ scope.patchListener_ = patchListener;
379
+ }
380
+ };
381
+ var revokeScope = function revokeScope(scope) {
382
+ leaveScope(scope);
383
+ scope.drafts_.forEach(revokeDraft);
384
+ scope.drafts_ = null;
385
+ };
386
+ var leaveScope = function leaveScope(scope) {
387
+ if (scope === currentScope) {
388
+ currentScope = scope.parent_;
389
+ }
390
+ };
391
+ var enterScope = function enterScope(immer2) {
392
+ return currentScope = createScope(currentScope, immer2);
393
+ };
394
+ var revokeDraft = function revokeDraft(draft) {
395
+ var state = draft[DRAFT_STATE];
396
+ if (state.type_ === 0 || state.type_ === 1) state.revoke_();
397
+ else state.revoked_ = true;
398
+ };
399
+ var processResult = function processResult(result, scope) {
400
+ scope.unfinalizedDrafts_ = scope.drafts_.length;
401
+ var baseDraft = scope.drafts_[0];
402
+ var isReplaced = result !== void 0 && result !== baseDraft;
403
+ if (isReplaced) {
404
+ if (baseDraft[DRAFT_STATE].modified_) {
405
+ revokeScope(scope);
406
+ die(4);
407
+ }
408
+ if (isDraftable(result)) {
409
+ result = finalize(scope, result);
410
+ if (!scope.parent_) maybeFreeze(scope, result);
411
+ }
412
+ if (scope.patches_) {
413
+ getPlugin("Patches").generateReplacementPatches_(baseDraft[DRAFT_STATE].base_, result, scope.patches_, scope.inversePatches_);
414
+ }
415
+ } else {
416
+ result = finalize(scope, baseDraft, []);
417
+ }
418
+ revokeScope(scope);
419
+ if (scope.patches_) {
420
+ scope.patchListener_(scope.patches_, scope.inversePatches_);
421
+ }
422
+ return result !== NOTHING ? result : void 0;
423
+ };
424
+ var finalize = function finalize(rootScope, value, path) {
425
+ if (isFrozen(value)) return value;
426
+ var state = value[DRAFT_STATE];
427
+ if (!state) {
428
+ each(value, function(key, childValue) {
429
+ return finalizeProperty(rootScope, state, value, key, childValue, path);
430
+ });
431
+ return value;
432
+ }
433
+ if (state.scope_ !== rootScope) return value;
434
+ if (!state.modified_) {
435
+ maybeFreeze(rootScope, state.base_, true);
436
+ return state.base_;
437
+ }
438
+ if (!state.finalized_) {
439
+ state.finalized_ = true;
440
+ state.scope_.unfinalizedDrafts_--;
441
+ var result = state.copy_;
442
+ var resultEach = result;
443
+ var isSet2 = false;
444
+ if (state.type_ === 3) {
445
+ resultEach = new Set(result);
446
+ result.clear();
447
+ isSet2 = true;
448
+ }
449
+ each(resultEach, function(key, childValue) {
450
+ return finalizeProperty(rootScope, state, result, key, childValue, path, isSet2);
451
+ });
452
+ maybeFreeze(rootScope, result, false);
453
+ if (path && rootScope.patches_) {
454
+ getPlugin("Patches").generatePatches_(state, path, rootScope.patches_, rootScope.inversePatches_);
455
+ }
456
+ }
457
+ return state.copy_;
458
+ };
459
+ var finalizeProperty = function finalizeProperty(rootScope, parentState, targetObject, prop, childValue, rootPath, targetIsSet) {
460
+ if (false) die(5);
461
+ if (isDraft(childValue)) {
462
+ var path = rootPath && parentState && parentState.type_ !== 3 && // Set objects are atomic since they have no keys.
463
+ !has(parentState.assigned_, prop) ? rootPath.concat(prop) : void 0;
464
+ var res = finalize(rootScope, childValue, path);
465
+ set(targetObject, prop, res);
466
+ if (isDraft(res)) {
467
+ rootScope.canAutoFreeze_ = false;
468
+ } else return;
469
+ } else if (targetIsSet) {
470
+ targetObject.add(childValue);
471
+ }
472
+ if (isDraftable(childValue) && !isFrozen(childValue)) {
473
+ if (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) {
474
+ return;
475
+ }
476
+ finalize(rootScope, childValue);
477
+ if ((!parentState || !parentState.scope_.parent_) && (typeof prop === "undefined" ? "undefined" : _type_of(prop)) !== "symbol" && (isMap(targetObject) ? targetObject.has(prop) : Object.prototype.propertyIsEnumerable.call(targetObject, prop))) maybeFreeze(rootScope, childValue);
478
+ }
479
+ };
480
+ var maybeFreeze = function maybeFreeze(scope, value) {
481
+ var deep = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
482
+ if (!scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_) {
483
+ freeze(value, deep);
484
+ }
485
+ };
486
+ var createProxyProxy = function createProxyProxy(base, parent) {
487
+ var isArray = Array.isArray(base);
488
+ var state = {
489
+ type_: isArray ? 1 : 0,
490
+ // Track which produce call this is associated with.
491
+ scope_: parent ? parent.scope_ : getCurrentScope(),
492
+ // True for both shallow and deep changes.
493
+ modified_: false,
494
+ // Used during finalization.
495
+ finalized_: false,
496
+ // Track which properties have been assigned (true) or deleted (false).
497
+ assigned_: {},
498
+ // The parent draft state.
499
+ parent_: parent,
500
+ // The base state.
501
+ base_: base,
502
+ // The base proxy.
503
+ draft_: null,
504
+ // set below
505
+ // The base copy with any updated values.
506
+ copy_: null,
507
+ // Called by the `produce` function.
508
+ revoke_: null,
509
+ isManual_: false
510
+ };
511
+ var target = state;
512
+ var traps = objectTraps;
513
+ if (isArray) {
514
+ target = [
515
+ state
516
+ ];
517
+ traps = arrayTraps;
518
+ }
519
+ var _Proxy_revocable = Proxy.revocable(target, traps), revoke = _Proxy_revocable.revoke, proxy = _Proxy_revocable.proxy;
520
+ state.draft_ = proxy;
521
+ state.revoke_ = revoke;
522
+ return proxy;
523
+ };
524
+ var peek = function peek(draft, prop) {
525
+ var state = draft[DRAFT_STATE];
526
+ var source = state ? latest(state) : draft;
527
+ return source[prop];
528
+ };
529
+ var readPropFromProto = function readPropFromProto(state, source, prop) {
530
+ var // This is a very special case, if the prop is a getter defined by the
531
+ // prototype, we should invoke it with the draft as context!
532
+ _desc_get;
533
+ var desc = getDescriptorFromProto(source, prop);
534
+ return desc ? "value" in desc ? desc.value : (_desc_get = desc.get) === null || _desc_get === void 0 ? void 0 : _desc_get.call(state.draft_) : void 0;
535
+ };
536
+ var getDescriptorFromProto = function getDescriptorFromProto(source, prop) {
537
+ if (!(prop in source)) return void 0;
538
+ var proto = getPrototypeOf(source);
539
+ while(proto){
540
+ var desc = Object.getOwnPropertyDescriptor(proto, prop);
541
+ if (desc) return desc;
542
+ proto = getPrototypeOf(proto);
543
+ }
544
+ return void 0;
545
+ };
546
+ var prepareCopy = function prepareCopy(state) {
547
+ if (!state.copy_) {
548
+ state.copy_ = shallowCopy(state.base_, state.scope_.immer_.useStrictShallowCopy_);
549
+ }
550
+ };
551
+ var createProxy = function createProxy(value, parent) {
552
+ var draft = isMap(value) ? getPlugin("MapSet").proxyMap_(value, parent) : isSet(value) ? getPlugin("MapSet").proxySet_(value, parent) : createProxyProxy(value, parent);
553
+ var scope = parent ? parent.scope_ : getCurrentScope();
554
+ scope.drafts_.push(draft);
555
+ return draft;
556
+ };
557
+ var current = function current(value) {
558
+ if (!isDraft(value)) die(10, value);
559
+ return currentImpl(value);
560
+ };
561
+ var find = function find(iter, tar, key) {
562
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
563
+ try {
564
+ for(var _iterator = iter.keys()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
565
+ key = _step.value;
566
+ if (dequal(key, tar)) return key;
567
+ }
568
+ } catch (err) {
569
+ _didIteratorError = true;
570
+ _iteratorError = err;
571
+ } finally{
572
+ try {
573
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
574
+ _iterator.return();
575
+ }
576
+ } finally{
577
+ if (_didIteratorError) {
578
+ throw _iteratorError;
579
+ }
580
+ }
581
+ }
582
+ };
583
+ var dset = function dset(obj, keys, val) {
584
+ keys.split && (keys = keys.split("."));
585
+ var i = 0, l = keys.length, t = obj, x, k;
586
+ while(i < l){
587
+ k = "" + keys[i++];
588
+ if (k === "__proto__" || k === "constructor" || k === "prototype") break;
589
+ t = t[k] = i === l ? merge(t[k], val) : _type_of(x = t[k]) === (typeof keys === "undefined" ? "undefined" : _type_of(keys)) ? x : keys[i] * 0 !== 0 || !!~("" + keys[i]).indexOf(".") ? {} : [];
590
+ }
591
+ };
592
+ var __defProp = Object.defineProperty;
593
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
594
+ var __getOwnPropNames = Object.getOwnPropertyNames;
595
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
596
+ var __export = function(target, all) {
597
+ for(var name in all)__defProp(target, name, {
598
+ get: all[name],
599
+ enumerable: true
600
+ });
601
+ };
602
+ var __copyProps = function(to, from, except, desc) {
603
+ if (from && typeof from === "object" || typeof from === "function") {
604
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
605
+ try {
606
+ var _loop = function() {
607
+ var key = _step.value;
608
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
609
+ get: function() {
610
+ return from[key];
611
+ },
612
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
613
+ });
614
+ };
615
+ for(var _iterator = __getOwnPropNames(from)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
616
+ } catch (err) {
617
+ _didIteratorError = true;
618
+ _iteratorError = err;
619
+ } finally{
620
+ try {
621
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
622
+ _iterator.return();
623
+ }
624
+ } finally{
625
+ if (_didIteratorError) {
626
+ throw _iteratorError;
627
+ }
628
+ }
629
+ }
630
+ }
631
+ return to;
632
+ };
633
+ var __toCommonJS = function(mod) {
634
+ return __copyProps(__defProp({}, "__esModule", {
635
+ value: true
636
+ }), mod);
637
+ };
638
+ // ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/profiler/core/src/index.ts
639
+ var src_exports = {};
640
+ __export(src_exports, {
641
+ ProfilerDevtoolsPlugin: function() {
642
+ return ProfilerDevtoolsPlugin;
643
+ }
644
+ });
645
+ // ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/@player-devtools+utils@0.0.0/node_modules/@player-devtools/utils/dist/index.mjs
646
+ var useStateReducer = function(reducer2, initialState) {
647
+ var state = initialState;
648
+ var subscribers = /* @__PURE__ */ new Set();
649
+ return {
650
+ getState: function() {
651
+ return state;
652
+ },
653
+ /** Subscribe to state changes; returns an unsubscribe function. */ subscribe: function subscribe(subscriber) {
654
+ subscribers.add(subscriber);
655
+ subscriber(state);
656
+ return function() {
657
+ return subscribers.delete(subscriber);
658
+ };
659
+ },
660
+ /** Dispatch an action through the reducer, then run side-effects. */ dispatch: function dispatch(action) {
661
+ var prevState = state;
662
+ var nextState = reducer2(prevState, action);
663
+ if (nextState !== prevState) {
664
+ state = nextState;
665
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
666
+ try {
667
+ for(var _iterator = subscribers[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
668
+ var sub = _step.value;
669
+ sub(state);
670
+ }
671
+ } catch (err) {
672
+ _didIteratorError = true;
673
+ _iteratorError = err;
674
+ } finally{
675
+ try {
676
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
677
+ _iterator.return();
678
+ }
679
+ } finally{
680
+ if (_didIteratorError) {
681
+ throw _iteratorError;
682
+ }
683
+ }
684
+ }
685
+ }
686
+ }
687
+ };
688
+ };
689
+ function deepAssign(target, source) {
690
+ var merge2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
691
+ if (Array.isArray(target) && Array.isArray(source)) {
692
+ while(!merge2 && target.length > source.length)target.pop();
693
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
694
+ try {
695
+ for(var _iterator = source.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
696
+ var _step_value = _sliced_to_array(_step.value, 2), index = _step_value[0], item = _step_value[1];
697
+ target[index] = deepAssign(target[index], item, merge2);
698
+ }
699
+ } catch (err) {
700
+ _didIteratorError = true;
701
+ _iteratorError = err;
702
+ } finally{
703
+ try {
704
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
705
+ _iterator.return();
706
+ }
707
+ } finally{
708
+ if (_didIteratorError) {
709
+ throw _iteratorError;
710
+ }
711
+ }
712
+ }
713
+ } else if (target && typeof target === "object" && !Array.isArray(target) && source && typeof source === "object" && !Array.isArray(source)) {
714
+ var record = target;
715
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
716
+ if (!merge2) try {
717
+ for(var _iterator1 = Object.keys(target)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
718
+ var key = _step1.value;
719
+ if (!(key in source)) delete record[key];
720
+ }
721
+ } catch (err) {
722
+ _didIteratorError1 = true;
723
+ _iteratorError1 = err;
724
+ } finally{
725
+ try {
726
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
727
+ _iterator1.return();
728
+ }
729
+ } finally{
730
+ if (_didIteratorError1) {
731
+ throw _iteratorError1;
732
+ }
733
+ }
734
+ }
735
+ var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = undefined;
736
+ try {
737
+ for(var _iterator2 = Object.entries(source)[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true){
738
+ var _step_value1 = _sliced_to_array(_step2.value, 2), key1 = _step_value1[0], item1 = _step_value1[1];
739
+ record[key1] = deepAssign(record[key1], item1, merge2);
740
+ }
741
+ } catch (err) {
742
+ _didIteratorError2 = true;
743
+ _iteratorError2 = err;
744
+ } finally{
745
+ try {
746
+ if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
747
+ _iterator2.return();
748
+ }
749
+ } finally{
750
+ if (_didIteratorError2) {
751
+ throw _iteratorError2;
752
+ }
753
+ }
754
+ }
755
+ } else {
756
+ return source;
757
+ }
758
+ return target;
759
+ }
760
+ // ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/immer@10.1.3/node_modules/immer/dist/immer.mjs
761
+ var NOTHING = Symbol.for("immer-nothing");
762
+ var DRAFTABLE = Symbol.for("immer-draftable");
763
+ var DRAFT_STATE = Symbol.for("immer-state");
764
+ var getPrototypeOf = Object.getPrototypeOf;
765
+ var objectCtorString = Object.prototype.constructor.toString();
766
+ function freeze(obj) {
767
+ var deep = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
768
+ if (isFrozen(obj) || isDraft(obj) || !isDraftable(obj)) return obj;
769
+ if (getArchtype(obj) > 1) {
770
+ Object.defineProperties(obj, {
771
+ set: {
772
+ value: dontMutateFrozenCollections
773
+ },
774
+ add: {
775
+ value: dontMutateFrozenCollections
776
+ },
777
+ clear: {
778
+ value: dontMutateFrozenCollections
779
+ },
780
+ delete: {
781
+ value: dontMutateFrozenCollections
782
+ }
783
+ });
784
+ }
785
+ Object.freeze(obj);
786
+ if (deep) Object.values(obj).forEach(function(value) {
787
+ return freeze(value, true);
788
+ });
789
+ return obj;
790
+ }
791
+ var plugins = {};
792
+ var currentScope;
793
+ var objectTraps = {
794
+ get: function get(state, prop) {
795
+ if (prop === DRAFT_STATE) return state;
796
+ var source = latest(state);
797
+ if (!has(source, prop)) {
798
+ return readPropFromProto(state, source, prop);
799
+ }
800
+ var value = source[prop];
801
+ if (state.finalized_ || !isDraftable(value)) {
802
+ return value;
803
+ }
804
+ if (value === peek(state.base_, prop)) {
805
+ prepareCopy(state);
806
+ return state.copy_[prop] = createProxy(value, state);
807
+ }
808
+ return value;
809
+ },
810
+ has: function has(state, prop) {
811
+ return prop in latest(state);
812
+ },
813
+ ownKeys: function ownKeys(state) {
814
+ return Reflect.ownKeys(latest(state));
815
+ },
816
+ set: function set(state, prop, value) {
817
+ var _desc;
818
+ var desc = getDescriptorFromProto(latest(state), prop);
819
+ if ((_desc = desc) === null || _desc === void 0 ? void 0 : _desc.set) {
820
+ desc.set.call(state.draft_, value);
821
+ return true;
822
+ }
823
+ if (!state.modified_) {
824
+ var _current2;
825
+ var current2 = peek(latest(state), prop);
826
+ var currentState = (_current2 = current2) === null || _current2 === void 0 ? void 0 : _current2[DRAFT_STATE];
827
+ if (currentState && currentState.base_ === value) {
828
+ state.copy_[prop] = value;
829
+ state.assigned_[prop] = false;
830
+ return true;
831
+ }
832
+ if (is(value, current2) && (value !== void 0 || has(state.base_, prop))) return true;
833
+ prepareCopy(state);
834
+ markChanged(state);
835
+ }
836
+ if (state.copy_[prop] === value && // special case: handle new props with value 'undefined'
837
+ (value !== void 0 || prop in state.copy_) || // special case: NaN
838
+ Number.isNaN(value) && Number.isNaN(state.copy_[prop])) return true;
839
+ state.copy_[prop] = value;
840
+ state.assigned_[prop] = true;
841
+ return true;
842
+ },
843
+ deleteProperty: function deleteProperty(state, prop) {
844
+ if (peek(state.base_, prop) !== void 0 || prop in state.base_) {
845
+ state.assigned_[prop] = false;
846
+ prepareCopy(state);
847
+ markChanged(state);
848
+ } else {
849
+ delete state.assigned_[prop];
850
+ }
851
+ if (state.copy_) {
852
+ delete state.copy_[prop];
853
+ }
854
+ return true;
855
+ },
856
+ // Note: We never coerce `desc.value` into an Immer draft, because we can't make
857
+ // the same guarantee in ES5 mode.
858
+ getOwnPropertyDescriptor: function getOwnPropertyDescriptor(state, prop) {
859
+ var owner = latest(state);
860
+ var desc = Reflect.getOwnPropertyDescriptor(owner, prop);
861
+ if (!desc) return desc;
862
+ return {
863
+ writable: true,
864
+ configurable: state.type_ !== 1 || prop !== "length",
865
+ enumerable: desc.enumerable,
866
+ value: owner[prop]
867
+ };
868
+ },
869
+ defineProperty: function defineProperty() {
870
+ die(11);
871
+ },
872
+ getPrototypeOf: function getPrototypeOf1(state) {
873
+ return getPrototypeOf(state.base_);
874
+ },
875
+ setPrototypeOf: function setPrototypeOf() {
876
+ die(12);
877
+ }
878
+ };
879
+ var arrayTraps = {};
880
+ each(objectTraps, function(key, fn) {
881
+ arrayTraps[key] = function() {
882
+ arguments[0] = arguments[0][0];
883
+ return fn.apply(this, arguments);
884
+ };
885
+ });
886
+ arrayTraps.deleteProperty = function(state, prop) {
887
+ if (false) die(13);
888
+ return arrayTraps.set.call(this, state, prop, void 0);
889
+ };
890
+ arrayTraps.set = function(state, prop, value) {
891
+ if (false) die(14);
892
+ return objectTraps.set.call(this, state[0], prop, value, state[0]);
893
+ };
894
+ function markChanged(state) {
895
+ if (!state.modified_) {
896
+ state.modified_ = true;
897
+ if (state.parent_) {
898
+ markChanged(state.parent_);
899
+ }
900
+ }
901
+ }
902
+ var Immer2 = /*#__PURE__*/ function() {
903
+ function Immer2(config) {
904
+ var _this = this;
905
+ _class_call_check(this, Immer2);
906
+ var _config, _config1;
907
+ this.autoFreeze_ = true;
908
+ this.useStrictShallowCopy_ = false;
909
+ this.produce = function(base, recipe, patchListener) {
910
+ if (typeof base === "function" && typeof recipe !== "function") {
911
+ var defaultBase = recipe;
912
+ recipe = base;
913
+ var self = _this;
914
+ return function curriedProduce() {
915
+ var base2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : defaultBase;
916
+ for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
917
+ args[_key - 1] = arguments[_key];
918
+ }
919
+ var _this = this;
920
+ var _recipe;
921
+ return self.produce(base2, function(draft) {
922
+ return (_recipe = recipe).call.apply(_recipe, [
923
+ _this,
924
+ draft
925
+ ].concat(_to_consumable_array(args)));
926
+ });
927
+ };
928
+ }
929
+ if (typeof recipe !== "function") die(6);
930
+ if (patchListener !== void 0 && typeof patchListener !== "function") die(7);
931
+ var result;
932
+ if (isDraftable(base)) {
933
+ var scope = enterScope(_this);
934
+ var proxy = createProxy(base, void 0);
935
+ var hasError = true;
936
+ try {
937
+ result = recipe(proxy);
938
+ hasError = false;
939
+ } finally{
940
+ if (hasError) revokeScope(scope);
941
+ else leaveScope(scope);
942
+ }
943
+ usePatchesInScope(scope, patchListener);
944
+ return processResult(result, scope);
945
+ } else if (!base || typeof base !== "object") {
946
+ result = recipe(base);
947
+ if (result === void 0) result = base;
948
+ if (result === NOTHING) result = void 0;
949
+ if (_this.autoFreeze_) freeze(result, true);
950
+ if (patchListener) {
951
+ var p = [];
952
+ var ip = [];
953
+ getPlugin("Patches").generateReplacementPatches_(base, result, p, ip);
954
+ patchListener(p, ip);
955
+ }
956
+ return result;
957
+ } else die(1, base);
958
+ };
959
+ this.produceWithPatches = function(base, recipe) {
960
+ if (typeof base === "function") {
961
+ return function(state) {
962
+ for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
963
+ args[_key - 1] = arguments[_key];
964
+ }
965
+ return _this.produceWithPatches(state, function(draft) {
966
+ return base.apply(void 0, [
967
+ draft
968
+ ].concat(_to_consumable_array(args)));
969
+ });
970
+ };
971
+ }
972
+ var patches, inversePatches;
973
+ var result = _this.produce(base, recipe, function(p, ip) {
974
+ patches = p;
975
+ inversePatches = ip;
976
+ });
977
+ return [
978
+ result,
979
+ patches,
980
+ inversePatches
981
+ ];
982
+ };
983
+ if (typeof ((_config = config) === null || _config === void 0 ? void 0 : _config.autoFreeze) === "boolean") this.setAutoFreeze(config.autoFreeze);
984
+ if (typeof ((_config1 = config) === null || _config1 === void 0 ? void 0 : _config1.useStrictShallowCopy) === "boolean") this.setUseStrictShallowCopy(config.useStrictShallowCopy);
985
+ }
986
+ _create_class(Immer2, [
987
+ {
988
+ key: "createDraft",
989
+ value: function createDraft(base) {
990
+ if (!isDraftable(base)) die(8);
991
+ if (isDraft(base)) base = current(base);
992
+ var scope = enterScope(this);
993
+ var proxy = createProxy(base, void 0);
994
+ proxy[DRAFT_STATE].isManual_ = true;
995
+ leaveScope(scope);
996
+ return proxy;
997
+ }
998
+ },
999
+ {
1000
+ key: "finishDraft",
1001
+ value: function finishDraft(draft, patchListener) {
1002
+ var state = draft && draft[DRAFT_STATE];
1003
+ if (!state || !state.isManual_) die(9);
1004
+ var scope = state.scope_;
1005
+ usePatchesInScope(scope, patchListener);
1006
+ return processResult(void 0, scope);
1007
+ }
1008
+ },
1009
+ {
1010
+ /**
1011
+ * Pass true to automatically freeze all copies created by Immer.
1012
+ *
1013
+ * By default, auto-freezing is enabled.
1014
+ */ key: "setAutoFreeze",
1015
+ value: function setAutoFreeze(value) {
1016
+ this.autoFreeze_ = value;
1017
+ }
1018
+ },
1019
+ {
1020
+ /**
1021
+ * Pass true to enable strict shallow copy.
1022
+ *
1023
+ * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.
1024
+ */ key: "setUseStrictShallowCopy",
1025
+ value: function setUseStrictShallowCopy(value) {
1026
+ this.useStrictShallowCopy_ = value;
1027
+ }
1028
+ },
1029
+ {
1030
+ key: "applyPatches",
1031
+ value: function applyPatches(base, patches) {
1032
+ var i;
1033
+ for(i = patches.length - 1; i >= 0; i--){
1034
+ var patch = patches[i];
1035
+ if (patch.path.length === 0 && patch.op === "replace") {
1036
+ base = patch.value;
1037
+ break;
1038
+ }
1039
+ }
1040
+ if (i > -1) {
1041
+ patches = patches.slice(i + 1);
1042
+ }
1043
+ var applyPatchesImpl = getPlugin("Patches").applyPatches_;
1044
+ if (isDraft(base)) {
1045
+ return applyPatchesImpl(base, patches);
1046
+ }
1047
+ return this.produce(base, function(draft) {
1048
+ return applyPatchesImpl(draft, patches);
1049
+ });
1050
+ }
1051
+ }
1052
+ ]);
1053
+ return Immer2;
1054
+ }();
1055
+ function currentImpl(value) {
1056
+ if (!isDraftable(value) || isFrozen(value)) return value;
1057
+ var state = value[DRAFT_STATE];
1058
+ var copy;
1059
+ if (state) {
1060
+ if (!state.modified_) return state.base_;
1061
+ state.finalized_ = true;
1062
+ copy = shallowCopy(value, state.scope_.immer_.useStrictShallowCopy_);
1063
+ } else {
1064
+ copy = shallowCopy(value, true);
1065
+ }
1066
+ each(copy, function(key, childValue) {
1067
+ set(copy, key, currentImpl(childValue));
1068
+ });
1069
+ if (state) {
1070
+ state.finalized_ = false;
1071
+ }
1072
+ return copy;
1073
+ }
1074
+ var immer = new Immer2();
1075
+ var produce = immer.produce;
1076
+ // ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/dequal@2.0.3/node_modules/dequal/dist/index.mjs
1077
+ var has2 = Object.prototype.hasOwnProperty;
1078
+ function dequal(foo, bar) {
1079
+ var ctor, len, tmp;
1080
+ if (foo === bar) return true;
1081
+ if (foo && bar && (ctor = foo.constructor) === bar.constructor) {
1082
+ if (ctor === Date) return foo.getTime() === bar.getTime();
1083
+ if (ctor === RegExp) return foo.toString() === bar.toString();
1084
+ if (ctor === Array) {
1085
+ if ((len = foo.length) === bar.length) {
1086
+ while(len-- && dequal(foo[len], bar[len]));
1087
+ }
1088
+ return len === -1;
1089
+ }
1090
+ if (ctor === Set) {
1091
+ if (foo.size !== bar.size) {
1092
+ return false;
1093
+ }
1094
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
1095
+ try {
1096
+ for(var _iterator = foo[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
1097
+ len = _step.value;
1098
+ tmp = len;
1099
+ if (tmp && typeof tmp === "object") {
1100
+ tmp = find(bar, tmp);
1101
+ if (!tmp) return false;
1102
+ }
1103
+ if (!bar.has(tmp)) return false;
1104
+ }
1105
+ } catch (err) {
1106
+ _didIteratorError = true;
1107
+ _iteratorError = err;
1108
+ } finally{
1109
+ try {
1110
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
1111
+ _iterator.return();
1112
+ }
1113
+ } finally{
1114
+ if (_didIteratorError) {
1115
+ throw _iteratorError;
1116
+ }
1117
+ }
1118
+ }
1119
+ return true;
1120
+ }
1121
+ if (ctor === Map) {
1122
+ if (foo.size !== bar.size) {
1123
+ return false;
1124
+ }
1125
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
1126
+ try {
1127
+ for(var _iterator1 = foo[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
1128
+ len = _step1.value;
1129
+ tmp = len[0];
1130
+ if (tmp && typeof tmp === "object") {
1131
+ tmp = find(bar, tmp);
1132
+ if (!tmp) return false;
1133
+ }
1134
+ if (!dequal(len[1], bar.get(tmp))) {
1135
+ return false;
1136
+ }
1137
+ }
1138
+ } catch (err) {
1139
+ _didIteratorError1 = true;
1140
+ _iteratorError1 = err;
1141
+ } finally{
1142
+ try {
1143
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
1144
+ _iterator1.return();
1145
+ }
1146
+ } finally{
1147
+ if (_didIteratorError1) {
1148
+ throw _iteratorError1;
1149
+ }
1150
+ }
1151
+ }
1152
+ return true;
1153
+ }
1154
+ if (ctor === ArrayBuffer) {
1155
+ foo = new Uint8Array(foo);
1156
+ bar = new Uint8Array(bar);
1157
+ } else if (ctor === DataView) {
1158
+ if ((len = foo.byteLength) === bar.byteLength) {
1159
+ while(len-- && foo.getInt8(len) === bar.getInt8(len));
1160
+ }
1161
+ return len === -1;
1162
+ }
1163
+ if (ArrayBuffer.isView(foo)) {
1164
+ if ((len = foo.byteLength) === bar.byteLength) {
1165
+ while(len-- && foo[len] === bar[len]);
1166
+ }
1167
+ return len === -1;
1168
+ }
1169
+ if (!ctor || typeof foo === "object") {
1170
+ len = 0;
1171
+ for(ctor in foo){
1172
+ if (has2.call(foo, ctor) && ++len && !has2.call(bar, ctor)) return false;
1173
+ if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false;
1174
+ }
1175
+ return Object.keys(bar).length === len;
1176
+ }
1177
+ }
1178
+ return foo !== foo && bar !== bar;
1179
+ }
1180
+ // ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/@player-devtools+plugin@0.0.0/node_modules/@player-devtools/plugin/dist/index.mjs
1181
+ var containsInteraction = function(interactions, interaction) {
1182
+ return interactions.filter(function(i) {
1183
+ return dequal(i, interaction);
1184
+ }).length > 0;
1185
+ };
1186
+ var reducer = function(state, transaction) {
1187
+ switch(transaction.type){
1188
+ case "PLAYER_DEVTOOLS_PLAYER_INIT":
1189
+ return produce(state, function(draft) {
1190
+ var payload = transaction.payload;
1191
+ dsetAssign(draft, [
1192
+ "plugins"
1193
+ ], payload.plugins);
1194
+ var message = {
1195
+ type: "PLAYER_DEVTOOLS_PLAYER_INIT",
1196
+ payload: payload
1197
+ };
1198
+ draft.messages.push(message);
1199
+ });
1200
+ case "PLAYER_DEVTOOLS_PLUGIN_DATA_CHANGE":
1201
+ return produce(state, function(draft) {
1202
+ var payload = transaction.payload;
1203
+ if (!payload.data) return state;
1204
+ try {
1205
+ dsetAssign(draft, [
1206
+ "plugins",
1207
+ transaction.payload.pluginID,
1208
+ "flow",
1209
+ "data"
1210
+ ], transaction.payload.data);
1211
+ } catch (e) {
1212
+ console.error("error setting data:", transaction.payload.data);
1213
+ }
1214
+ var message = {
1215
+ type: "PLAYER_DEVTOOLS_PLUGIN_DATA_CHANGE",
1216
+ payload: payload
1217
+ };
1218
+ draft.messages.push(message);
1219
+ });
1220
+ case "PLAYER_DEVTOOLS_PLUGIN_INTERACTION":
1221
+ return produce(state, function(draft) {
1222
+ if (containsInteraction(draft.interactions, transaction)) return state;
1223
+ dsetAssign(draft, [
1224
+ "interactions"
1225
+ ], _to_consumable_array(draft.interactions).concat([
1226
+ transaction
1227
+ ]));
1228
+ });
1229
+ case "PLAYER_DEVTOOLS_SELECTED_PLAYER_CHANGE":
1230
+ {
1231
+ var playerID = transaction.payload.playerID;
1232
+ if (!playerID) return state;
1233
+ return produce(state, function(draft) {
1234
+ dsetAssign(draft, [
1235
+ "currentPlayer"
1236
+ ], playerID);
1237
+ });
1238
+ }
1239
+ default:
1240
+ return state;
1241
+ }
1242
+ };
1243
+ var INTERACTIONS = {
1244
+ PLAYER_SELECTED: "player-selected"
1245
+ };
1246
+ var PLUGIN_INACTIVE_WARNING = "The plugin has been registered, but the Player development tools are not active. If you are working in a production environment, it is recommended to remove the plugin. To activate, enable through the browser extension popup for web or configure the FlipperClient for mobile.";
1247
+ var getNowTime = globalThis.performance ? function() {
1248
+ return globalThis.performance.now();
1249
+ } : function() {
1250
+ return Date.now();
1251
+ };
1252
+ var NOOP_ID = -1;
1253
+ var genDataChangeTransaction = function(param) {
1254
+ var playerID = param.playerID, data = param.data, pluginID2 = param.pluginID;
1255
+ return {
1256
+ id: NOOP_ID,
1257
+ type: "PLAYER_DEVTOOLS_PLUGIN_DATA_CHANGE",
1258
+ payload: {
1259
+ pluginID: pluginID2,
1260
+ data: data
1261
+ },
1262
+ sender: playerID,
1263
+ context: "player",
1264
+ target: "player",
1265
+ timestamp: Date.now(),
1266
+ _messenger_: true
1267
+ };
1268
+ };
1269
+ var INITIAL_STATE = {
1270
+ messages: [],
1271
+ plugins: {},
1272
+ interactions: [],
1273
+ currentPlayer: ""
1274
+ };
1275
+ var DevtoolsPlugin = /*#__PURE__*/ function() {
1276
+ function DevtoolsPlugin(options) {
1277
+ var _this = this;
1278
+ _class_call_check(this, DevtoolsPlugin);
1279
+ this.options = options;
1280
+ this.name = "DevtoolsPlugin";
1281
+ this.loggedWarning = false;
1282
+ this.store = useStateReducer(reducer, INITIAL_STATE);
1283
+ this.lastProcessedInteraction = 0;
1284
+ this.store.subscribe(function(param) {
1285
+ var interactions = param.interactions;
1286
+ var start = _this.lastProcessedInteraction;
1287
+ var _interactions_length;
1288
+ var end = (_interactions_length = interactions.length) !== null && _interactions_length !== void 0 ? _interactions_length : 0;
1289
+ if (start < end) {
1290
+ _this.lastProcessedInteraction = end;
1291
+ interactions.slice(start, end).forEach(_this.processInteraction.bind(_this));
1292
+ }
1293
+ });
1294
+ }
1295
+ _create_class(DevtoolsPlugin, [
1296
+ {
1297
+ key: "pluginID",
1298
+ get: function get() {
1299
+ return this.options.pluginData.id;
1300
+ }
1301
+ },
1302
+ {
1303
+ key: "playerID",
1304
+ get: function get() {
1305
+ return this.options.playerID;
1306
+ }
1307
+ },
1308
+ {
1309
+ key: "registerMessenger",
1310
+ value: function registerMessenger(messenger) {
1311
+ var lastMessageIndex = -1;
1312
+ return this.store.subscribe(function(param) {
1313
+ var messages = param.messages;
1314
+ var start = lastMessageIndex + 1;
1315
+ if (messages.length > start) {
1316
+ var newlyAdded = messages.slice(start);
1317
+ lastMessageIndex = messages.length - 1;
1318
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
1319
+ try {
1320
+ for(var _iterator = newlyAdded[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
1321
+ var msg = _step.value;
1322
+ messenger.sendMessage(msg);
1323
+ }
1324
+ } catch (err) {
1325
+ _didIteratorError = true;
1326
+ _iteratorError = err;
1327
+ } finally{
1328
+ try {
1329
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
1330
+ _iterator.return();
1331
+ }
1332
+ } finally{
1333
+ if (_didIteratorError) {
1334
+ throw _iteratorError;
1335
+ }
1336
+ }
1337
+ }
1338
+ }
1339
+ });
1340
+ }
1341
+ },
1342
+ {
1343
+ key: "dispatchPlayerInit",
1344
+ value: function dispatchPlayerInit() {
1345
+ var transaction = {
1346
+ id: -1,
1347
+ type: "PLAYER_DEVTOOLS_PLAYER_INIT",
1348
+ payload: {
1349
+ plugins: _define_property({}, this.pluginID, this.options.pluginData)
1350
+ },
1351
+ sender: this.options.playerID,
1352
+ context: "player",
1353
+ target: "player",
1354
+ timestamp: Date.now(),
1355
+ _messenger_: true
1356
+ };
1357
+ this.store.dispatch(transaction);
1358
+ }
1359
+ },
1360
+ {
1361
+ // By default, we'll only write to the keys defined in data -- if undefined, data will be cleared
1362
+ key: "dispatchDataUpdate",
1363
+ value: function dispatchDataUpdate(data) {
1364
+ var _this = this;
1365
+ var _state_plugins_this_pluginID_flow, _state_plugins_this_pluginID;
1366
+ var state = this.store.getState();
1367
+ var _produce = produce(this.store.getState(), function(draft) {
1368
+ if (!data) dsetAssign(draft, [
1369
+ "plugins",
1370
+ _this.pluginID,
1371
+ "flow",
1372
+ "data"
1373
+ ], data);
1374
+ else Object.entries(data).forEach(function(param) {
1375
+ var _param = _sliced_to_array(param, 2), key = _param[0], value = _param[1];
1376
+ dsetAssign(draft, [
1377
+ "plugins",
1378
+ _this.pluginID,
1379
+ "flow",
1380
+ "data",
1381
+ key
1382
+ ], value);
1383
+ });
1384
+ }), plugins2 = _produce.plugins;
1385
+ var newData = plugins2[this.pluginID].flow.data;
1386
+ if (dequal((_state_plugins_this_pluginID = state.plugins[this.pluginID]) === null || _state_plugins_this_pluginID === void 0 ? void 0 : (_state_plugins_this_pluginID_flow = _state_plugins_this_pluginID.flow) === null || _state_plugins_this_pluginID_flow === void 0 ? void 0 : _state_plugins_this_pluginID_flow.data, newData)) return;
1387
+ var transaction = genDataChangeTransaction({
1388
+ playerID: this.playerID,
1389
+ pluginID: this.pluginID,
1390
+ data: newData
1391
+ });
1392
+ this.store.dispatch(transaction);
1393
+ }
1394
+ },
1395
+ {
1396
+ key: "checkIfDevtoolsIsActive",
1397
+ value: function checkIfDevtoolsIsActive() {
1398
+ var isActive = this.options.handler.checkIfDevtoolsIsActive();
1399
+ if (!isActive && !this.loggedWarning) {
1400
+ var _this_options_handler_log, _this_options_handler;
1401
+ (_this_options_handler_log = (_this_options_handler = this.options.handler).log) === null || _this_options_handler_log === void 0 ? void 0 : _this_options_handler_log.call(_this_options_handler, PLUGIN_INACTIVE_WARNING);
1402
+ this.loggedWarning = true;
1403
+ }
1404
+ return isActive;
1405
+ }
1406
+ },
1407
+ {
1408
+ key: "processInteraction",
1409
+ value: function processInteraction(interaction) {
1410
+ this.options.handler.processInteraction(interaction);
1411
+ var _interaction_payload = interaction.payload, type = _interaction_payload.type, payload = _interaction_payload.payload;
1412
+ if (type === INTERACTIONS.PLAYER_SELECTED && payload) {
1413
+ this.store.dispatch({
1414
+ id: -1,
1415
+ type: "PLAYER_DEVTOOLS_SELECTED_PLAYER_CHANGE",
1416
+ payload: {
1417
+ playerID: payload
1418
+ },
1419
+ sender: this.playerID,
1420
+ context: "player",
1421
+ target: this.playerID,
1422
+ timestamp: Date.now(),
1423
+ _messenger_: true
1424
+ });
1425
+ }
1426
+ }
1427
+ },
1428
+ {
1429
+ key: "apply",
1430
+ value: function apply(player) {
1431
+ if (!this.checkIfDevtoolsIsActive()) return;
1432
+ this.dispatchPlayerInit();
1433
+ }
1434
+ }
1435
+ ]);
1436
+ return DevtoolsPlugin;
1437
+ }();
1438
+ // ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/@player-devtools+profiler-plugin-content@0.0.0/node_modules/@player-devtools/profiler-plugin-content/dist/index.mjs
1439
+ var PLUGIN_ID = "player-ui-profiler-plugin";
1440
+ var INTERACTIONS2 = {
1441
+ START_PROFILING: "start-profiling",
1442
+ STOP_PROFILING: "stop-profiling",
1443
+ RESET_PROFILING: "reset-profiling"
1444
+ };
1445
+ var flow_default = {
1446
+ id: "player-ui-profiler-plugin",
1447
+ views: [
1448
+ {
1449
+ id: "Profile",
1450
+ type: "stacked-view",
1451
+ header: {
1452
+ asset: {
1453
+ id: "Profile-header",
1454
+ type: "navigation",
1455
+ values: [
1456
+ {
1457
+ asset: {
1458
+ id: "Profile-header-values-0",
1459
+ type: "action",
1460
+ value: "Profile",
1461
+ label: {
1462
+ asset: {
1463
+ id: "Profile-header-values-0-label",
1464
+ type: "text",
1465
+ value: "Flame Graph"
1466
+ }
1467
+ }
1468
+ }
1469
+ },
1470
+ {
1471
+ asset: {
1472
+ id: "Profile-header-values-1",
1473
+ type: "action",
1474
+ value: "Raw",
1475
+ label: {
1476
+ asset: {
1477
+ id: "Profile-header-values-1-label",
1478
+ type: "text",
1479
+ value: "Raw"
1480
+ }
1481
+ }
1482
+ }
1483
+ }
1484
+ ]
1485
+ }
1486
+ },
1487
+ main: {
1488
+ asset: {
1489
+ id: "Profile-main",
1490
+ type: "flame-graph",
1491
+ width: "@[{{rootNode.value}} / 200]@",
1492
+ binding: "rootNode"
1493
+ }
1494
+ },
1495
+ footer: {
1496
+ asset: {
1497
+ id: "Profile-footer",
1498
+ type: "collection",
1499
+ values: [
1500
+ {
1501
+ asset: {
1502
+ id: "Profile-footer-values-0",
1503
+ type: "action",
1504
+ exp: "conditional({{profiling}} === true, publish('stop-profiling'), publish('start-profiling'))",
1505
+ label: {
1506
+ asset: {
1507
+ id: "Profile-footer-values-0-label",
1508
+ type: "text",
1509
+ value: "@[conditional({{profiling}} === true, 'Stop', 'Start')]@"
1510
+ }
1511
+ }
1512
+ }
1513
+ },
1514
+ {
1515
+ asset: {
1516
+ id: "Profile-footer-values-1",
1517
+ type: "action",
1518
+ exp: "publish('reset-profiling')",
1519
+ label: {
1520
+ asset: {
1521
+ id: "Profile-footer-values-1-label",
1522
+ type: "text",
1523
+ value: "Reset"
1524
+ }
1525
+ }
1526
+ }
1527
+ }
1528
+ ]
1529
+ }
1530
+ }
1531
+ },
1532
+ {
1533
+ id: "Raw",
1534
+ type: "stacked-view",
1535
+ header: {
1536
+ asset: {
1537
+ id: "Raw-header",
1538
+ type: "navigation",
1539
+ values: [
1540
+ {
1541
+ asset: {
1542
+ id: "Raw-header-values-0",
1543
+ type: "action",
1544
+ value: "Profile",
1545
+ label: {
1546
+ asset: {
1547
+ id: "Raw-header-values-0-label",
1548
+ type: "text",
1549
+ value: "Flame Graph"
1550
+ }
1551
+ }
1552
+ }
1553
+ },
1554
+ {
1555
+ asset: {
1556
+ id: "Raw-header-values-1",
1557
+ type: "action",
1558
+ value: "Raw",
1559
+ label: {
1560
+ asset: {
1561
+ id: "Raw-header-values-1-label",
1562
+ type: "text",
1563
+ value: "Raw"
1564
+ }
1565
+ }
1566
+ }
1567
+ }
1568
+ ]
1569
+ }
1570
+ },
1571
+ main: {
1572
+ asset: {
1573
+ id: "Raw-main",
1574
+ type: "object-inspector",
1575
+ binding: "rawNodes"
1576
+ }
1577
+ },
1578
+ footer: {
1579
+ asset: {
1580
+ id: "Raw-footer",
1581
+ type: "collection",
1582
+ values: [
1583
+ {
1584
+ asset: {
1585
+ id: "Raw-footer-values-0",
1586
+ type: "action",
1587
+ exp: "conditional({{profiling}} === true, publish('stop-profiling'), publish('start-profiling'))",
1588
+ label: {
1589
+ asset: {
1590
+ id: "Raw-footer-values-0-label",
1591
+ type: "text",
1592
+ value: "@[conditional({{profiling}} === true, 'Stop', 'Start')]@"
1593
+ }
1594
+ }
1595
+ }
1596
+ },
1597
+ {
1598
+ asset: {
1599
+ id: "Raw-footer-values-1",
1600
+ type: "action",
1601
+ exp: "publish('reset-profiling')",
1602
+ label: {
1603
+ asset: {
1604
+ id: "Raw-footer-values-1-label",
1605
+ type: "text",
1606
+ value: "Reset"
1607
+ }
1608
+ }
1609
+ }
1610
+ }
1611
+ ]
1612
+ }
1613
+ }
1614
+ }
1615
+ ],
1616
+ navigation: {
1617
+ BEGIN: "Plugin",
1618
+ Plugin: {
1619
+ startState: "PROFILE",
1620
+ PROFILE: {
1621
+ state_type: "VIEW",
1622
+ ref: "Profile",
1623
+ transitions: {
1624
+ Profile: "PROFILE",
1625
+ Raw: "RAW"
1626
+ }
1627
+ },
1628
+ RAW: {
1629
+ state_type: "VIEW",
1630
+ ref: "Raw",
1631
+ transitions: {
1632
+ Profile: "PROFILE",
1633
+ Raw: "RAW"
1634
+ }
1635
+ }
1636
+ }
1637
+ },
1638
+ schema: {
1639
+ ROOT: {
1640
+ profiling: {
1641
+ type: "BooleanType",
1642
+ default: false,
1643
+ validation: [
1644
+ {
1645
+ type: "oneOf",
1646
+ message: "Value must be true or false",
1647
+ options: [
1648
+ true,
1649
+ false
1650
+ ]
1651
+ }
1652
+ ]
1653
+ },
1654
+ displayFlameGraph: {
1655
+ type: "BooleanType",
1656
+ default: false,
1657
+ validation: [
1658
+ {
1659
+ type: "oneOf",
1660
+ message: "Value must be true or false",
1661
+ options: [
1662
+ true,
1663
+ false
1664
+ ]
1665
+ }
1666
+ ]
1667
+ },
1668
+ rootNode: {
1669
+ type: "RecordType"
1670
+ },
1671
+ rootNodes: {
1672
+ type: "RecordType"
1673
+ },
1674
+ rawNodes: {
1675
+ type: "RecordType"
1676
+ }
1677
+ }
1678
+ },
1679
+ data: {
1680
+ profiling: false,
1681
+ displayFlameGraph: false,
1682
+ rootNode: {
1683
+ value: 0
1684
+ },
1685
+ rawNodes: []
1686
+ }
1687
+ };
1688
+ var PLUGIN_VERSION = true ? "0.13.1--canary.16.915" : "unstamped";
1689
+ var _obj;
1690
+ var ProfilerPluginData = {
1691
+ id: PLUGIN_ID,
1692
+ name: "Player UI Profiler",
1693
+ description: "Standard Player UI Profiler",
1694
+ version: PLUGIN_VERSION,
1695
+ flow: flow_default,
1696
+ capabilities: {
1697
+ description: "Profiles Player hook execution timing and exposes the result as a flame graph. Supports starting, stopping, and resetting profiling.",
1698
+ data: {
1699
+ rootNode: {
1700
+ description: "The captured hook timings as a flame-graph tree (transformed for display)"
1701
+ },
1702
+ rawNodes: {
1703
+ description: "The untransformed captured profiler nodes"
1704
+ },
1705
+ profiling: {
1706
+ description: "Whether profiling is currently running"
1707
+ },
1708
+ displayFlameGraph: {
1709
+ description: "Whether the client should render the flame graph"
1710
+ }
1711
+ },
1712
+ actions: (_obj = {}, _define_property(_obj, INTERACTIONS2.START_PROFILING, {
1713
+ description: "Start profiling Player hook execution"
1714
+ }), _define_property(_obj, INTERACTIONS2.STOP_PROFILING, {
1715
+ description: "Stop profiling and publish the captured flame-graph data"
1716
+ }), _define_property(_obj, INTERACTIONS2.RESET_PROFILING, {
1717
+ description: "Clear the captured profiler nodes"
1718
+ }), _obj)
1719
+ }
1720
+ };
1721
+ // ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/dset@3.1.4/node_modules/dset/merge/index.mjs
1722
+ function merge(a, b, k) {
1723
+ if (typeof a === "object" && typeof b === "object") {
1724
+ if (Array.isArray(a) && Array.isArray(b)) {
1725
+ for(k = 0; k < b.length; k++){
1726
+ a[k] = merge(a[k], b[k]);
1727
+ }
1728
+ } else {
1729
+ for(k in b){
1730
+ if (k === "__proto__" || k === "constructor" || k === "prototype") break;
1731
+ a[k] = merge(a[k], b[k]);
1732
+ }
1733
+ }
1734
+ return a;
1735
+ }
1736
+ return b;
1737
+ }
1738
+ // ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/profiler/core/src/helpers/isRecordType.ts
1739
+ var isRecordType = function(obj) {
1740
+ return typeof obj === "object" && obj !== null && !Array.isArray(obj);
1741
+ };
1742
+ // ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/profiler/core/src/helpers/hasHooks.ts
1743
+ var hasHooks = function(obj) {
1744
+ return isRecordType(obj) && "hooks" in obj && isRecordType(obj.hooks);
1745
+ };
1746
+ // ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/profiler/core/src/helpers/isMatchingPaths.ts
1747
+ var isMatchingPaths = function(path1, path2) {
1748
+ if (path1.length !== path2.length) return false;
1749
+ return path1.every(function(val, idx) {
1750
+ return val === path2[idx];
1751
+ });
1752
+ };
1753
+ // ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/profiler/core/src/helpers/profiler.ts
1754
+ var Profiler = /*#__PURE__*/ function() {
1755
+ function Profiler(onUpdate) {
1756
+ _class_call_check(this, Profiler);
1757
+ this.onUpdate = onUpdate;
1758
+ this.rootNodes = [];
1759
+ this.stack = [];
1760
+ }
1761
+ _create_class(Profiler, [
1762
+ {
1763
+ key: "start",
1764
+ value: function start() {
1765
+ var _this_onUpdate, _this;
1766
+ this.rootNodes = [];
1767
+ this.stack = [];
1768
+ (_this_onUpdate = (_this = this).onUpdate) === null || _this_onUpdate === void 0 ? void 0 : _this_onUpdate.call(_this);
1769
+ }
1770
+ },
1771
+ {
1772
+ key: "clear",
1773
+ value: function clear() {
1774
+ var _this_onUpdate, _this;
1775
+ var now = getNowTime();
1776
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
1777
+ try {
1778
+ for(var _iterator = this.stack[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
1779
+ var node = _step.value;
1780
+ node.startTime = now;
1781
+ node.children = node.children.filter(function(x) {
1782
+ return x.endTime === void 0;
1783
+ });
1784
+ }
1785
+ } catch (err) {
1786
+ _didIteratorError = true;
1787
+ _iteratorError = err;
1788
+ } finally{
1789
+ try {
1790
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
1791
+ _iterator.return();
1792
+ }
1793
+ } finally{
1794
+ if (_didIteratorError) {
1795
+ throw _iteratorError;
1796
+ }
1797
+ }
1798
+ }
1799
+ for(var i = 1; i < this.stack.length; i++){
1800
+ this.stack[i - 1].children = [
1801
+ this.stack[i]
1802
+ ];
1803
+ }
1804
+ this.rootNodes = this.stack.slice(0, 1);
1805
+ (_this_onUpdate = (_this = this).onUpdate) === null || _this_onUpdate === void 0 ? void 0 : _this_onUpdate.call(_this);
1806
+ }
1807
+ },
1808
+ {
1809
+ key: "cloneNode",
1810
+ value: function cloneNode(node, snapshotTime) {
1811
+ var _this = this;
1812
+ var children = node.children.map(function(c) {
1813
+ return _this.cloneNode(c, snapshotTime);
1814
+ });
1815
+ var _node_endTime;
1816
+ var endTime = (_node_endTime = node.endTime) !== null && _node_endTime !== void 0 ? _node_endTime : snapshotTime !== void 0 ? snapshotTime : void 0;
1817
+ var _current2_value, _node_value;
1818
+ var value = (_node_value = node.value) !== null && _node_value !== void 0 ? _node_value : endTime !== void 0 && node.startTime !== void 0 ? Math.ceil((endTime - node.startTime) * 1e3) : children.reduce(function(prev, current2) {
1819
+ var _current2;
1820
+ return prev + ((_current2_value = (_current2 = current2) === null || _current2 === void 0 ? void 0 : _current2.value) !== null && _current2_value !== void 0 ? _current2_value : 0);
1821
+ }, 0);
1822
+ return _object_spread_props(_object_spread({}, node), {
1823
+ endTime: endTime,
1824
+ value: value,
1825
+ children: children
1826
+ });
1827
+ }
1828
+ },
1829
+ {
1830
+ key: "getSnapshot",
1831
+ value: function getSnapshot() {
1832
+ var _this = this;
1833
+ var now = getNowTime();
1834
+ return {
1835
+ rootNodes: this.rootNodes.map(function(n) {
1836
+ return _this.cloneNode(n, now);
1837
+ })
1838
+ };
1839
+ }
1840
+ },
1841
+ {
1842
+ key: "startTimer",
1843
+ value: function startTimer(hookName) {
1844
+ var node = {
1845
+ name: hookName,
1846
+ startTime: getNowTime(),
1847
+ children: []
1848
+ };
1849
+ if (this.stack.length > 0) {
1850
+ this.stack[this.stack.length - 1].children.push(node);
1851
+ } else {
1852
+ this.rootNodes.push(node);
1853
+ }
1854
+ this.stack.push(node);
1855
+ }
1856
+ },
1857
+ {
1858
+ key: "finalizeNode",
1859
+ value: function finalizeNode(node, endTime) {
1860
+ var duration = node.startTime !== void 0 ? endTime - node.startTime : 0.01;
1861
+ node.endTime = endTime;
1862
+ node.value = Math.ceil(duration * 1e3);
1863
+ node.tooltip = "".concat(node.name, ", ").concat(duration.toFixed(4), " (ms)");
1864
+ }
1865
+ },
1866
+ {
1867
+ key: "endTimer",
1868
+ value: function endTimer(param) {
1869
+ var hookName = param.hookName;
1870
+ var _this_onUpdate, _this;
1871
+ var idx = _to_consumable_array(this.stack).reverse().findIndex(function(n) {
1872
+ return n.name === hookName;
1873
+ });
1874
+ if (idx === -1) {
1875
+ console.warn("endTimer: '".concat(hookName, "' not found in stack, ignoring"));
1876
+ return;
1877
+ }
1878
+ var targetIdx = this.stack.length - 1 - idx;
1879
+ var endTime = getNowTime();
1880
+ for(var i = this.stack.length - 1; i > targetIdx; i--){
1881
+ var orphan = this.stack[i];
1882
+ console.warn("endTimer: popping '".concat(orphan.name, "' — timer was never explicitly ended"));
1883
+ this.finalizeNode(orphan, endTime);
1884
+ }
1885
+ this.finalizeNode(this.stack[targetIdx], endTime);
1886
+ this.stack.length = targetIdx;
1887
+ (_this_onUpdate = (_this = this).onUpdate) === null || _this_onUpdate === void 0 ? void 0 : _this_onUpdate.call(_this);
1888
+ }
1889
+ },
1890
+ {
1891
+ key: "stopProfiler",
1892
+ value: function stopProfiler() {
1893
+ return {
1894
+ rootNodes: _to_consumable_array(this.rootNodes)
1895
+ };
1896
+ }
1897
+ }
1898
+ ]);
1899
+ return Profiler;
1900
+ }();
1901
+ // ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/profiler/core/src/helpers/transformProfilerData.ts
1902
+ var createSpacer = function(gap) {
1903
+ return {
1904
+ name: "(work)",
1905
+ value: Math.ceil(gap * 1e3),
1906
+ children: [],
1907
+ backgroundColor: "#000000",
1908
+ color: "#000000",
1909
+ tooltip: "Placeholder time between hooks"
1910
+ };
1911
+ };
1912
+ var transformProfilerData = function(root) {
1913
+ return _object_spread_props(_object_spread({}, root), {
1914
+ children: transformProfilerDataHelper(root.children, root.startTime)
1915
+ });
1916
+ };
1917
+ var transformProfilerDataHelper = function(nodes) {
1918
+ var parentStart = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
1919
+ var merged = [];
1920
+ var cursor = parentStart;
1921
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
1922
+ try {
1923
+ for(var _iterator = nodes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
1924
+ var node = _step.value;
1925
+ if (node.startTime === void 0 || node.endTime === void 0 || node.value === void 0 || node.value <= 0) {
1926
+ continue;
1927
+ }
1928
+ var next = _object_spread_props(_object_spread({}, node), {
1929
+ children: transformProfilerDataHelper(node.children, node.startTime)
1930
+ });
1931
+ var gap = node.startTime - cursor;
1932
+ if (gap > 0) {
1933
+ merged.push(createSpacer(gap));
1934
+ }
1935
+ cursor = node.endTime;
1936
+ merged.push(next);
1937
+ }
1938
+ } catch (err) {
1939
+ _didIteratorError = true;
1940
+ _iteratorError = err;
1941
+ } finally{
1942
+ try {
1943
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
1944
+ _iterator.return();
1945
+ }
1946
+ } finally{
1947
+ if (_didIteratorError) {
1948
+ throw _iteratorError;
1949
+ }
1950
+ }
1951
+ }
1952
+ return merged;
1953
+ };
1954
+ // ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/profiler/core/src/addProfilerInterceptorsToHooks.ts
1955
+ var IGNORED_PATHS = [
1956
+ [
1957
+ "view"
1958
+ ]
1959
+ ];
1960
+ var isAnyHook = function(obj) {
1961
+ return isRecordType(obj) && "intercept" in obj && typeof obj.intercept === "function";
1962
+ };
1963
+ var addProfilerInterceptorsToHooks = function(obj, profiler) {
1964
+ var currentPath = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [], intercepted = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : /* @__PURE__ */ new WeakSet();
1965
+ if (!hasHooks(obj)) {
1966
+ return;
1967
+ }
1968
+ Object.entries(obj.hooks).forEach(function(param) {
1969
+ var _param = _sliced_to_array(param, 2), key = _param[0], value = _param[1];
1970
+ var nextPath = _to_consumable_array(currentPath).concat([
1971
+ key
1972
+ ]);
1973
+ if (!isAnyHook(value) || IGNORED_PATHS.some(function(path) {
1974
+ return isMatchingPaths(path, nextPath);
1975
+ }) || intercepted.has(value)) {
1976
+ return;
1977
+ }
1978
+ intercepted.add(value);
1979
+ value.intercept({
1980
+ call: function() {
1981
+ for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
1982
+ args[_key] = arguments[_key];
1983
+ }
1984
+ if (args.length > 0) {
1985
+ addProfilerInterceptorsToHooks(args[0], profiler, nextPath, intercepted);
1986
+ }
1987
+ profiler.startTimer(key);
1988
+ },
1989
+ done: function() {
1990
+ profiler.endTimer({
1991
+ hookName: key
1992
+ });
1993
+ },
1994
+ result: function() {
1995
+ profiler.endTimer({
1996
+ hookName: key
1997
+ });
1998
+ },
1999
+ error: function() {
2000
+ profiler.endTimer({
2001
+ hookName: key
2002
+ });
2003
+ }
2004
+ });
2005
+ });
2006
+ };
2007
+ // ../../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/devtools/plugins/profiler/core/src/plugin.ts
2008
+ var wrapInRoot = function(nodes) {
2009
+ var _nodes_reduce;
2010
+ var startTime = (_nodes_reduce = nodes.reduce(function(min, n) {
2011
+ return n.startTime !== void 0 && (min === void 0 || n.startTime < min) ? n.startTime : min;
2012
+ }, void 0)) !== null && _nodes_reduce !== void 0 ? _nodes_reduce : 0;
2013
+ var _nodes_reduce1;
2014
+ var endTime = (_nodes_reduce1 = nodes.reduce(function(max, n) {
2015
+ return n.endTime !== void 0 && (max === void 0 || n.endTime > max) ? n.endTime : max;
2016
+ }, void 0)) !== null && _nodes_reduce1 !== void 0 ? _nodes_reduce1 : startTime;
2017
+ return {
2018
+ name: "root",
2019
+ startTime: startTime,
2020
+ endTime: endTime,
2021
+ value: Math.ceil((endTime - startTime) * 1e3),
2022
+ children: nodes
2023
+ };
2024
+ };
2025
+ var pluginData = ProfilerPluginData;
2026
+ var pluginID = pluginData.id;
2027
+ var ProfilerDevtoolsPlugin = /*#__PURE__*/ function(DevtoolsPlugin) {
2028
+ _inherits(ProfilerDevtoolsPlugin, DevtoolsPlugin);
2029
+ var _super = _create_super(ProfilerDevtoolsPlugin);
2030
+ function ProfilerDevtoolsPlugin(options) {
2031
+ _class_call_check(this, ProfilerDevtoolsPlugin);
2032
+ var _this;
2033
+ _this = _super.call(this, _object_spread_props(_object_spread({}, options), {
2034
+ pluginData: pluginData
2035
+ }));
2036
+ _this.name = "ProfilerDevtoolsPlugin";
2037
+ _this.interactionMap = /* @__PURE__ */ new Map([
2038
+ [
2039
+ INTERACTIONS2.START_PROFILING,
2040
+ function() {
2041
+ return _this.startProfiler();
2042
+ }
2043
+ ],
2044
+ [
2045
+ INTERACTIONS2.STOP_PROFILING,
2046
+ function() {
2047
+ return _this.stopProfiler();
2048
+ }
2049
+ ],
2050
+ [
2051
+ INTERACTIONS2.RESET_PROFILING,
2052
+ function() {
2053
+ return _this.clearProfiler();
2054
+ }
2055
+ ]
2056
+ ]);
2057
+ _this.profilerObj = new Profiler(function() {
2058
+ var _newState_plugins_pluginID;
2059
+ var rootNodes = _this.profilerObj.getSnapshot().rootNodes;
2060
+ var newState = _this.produceState([
2061
+ [
2062
+ "plugins",
2063
+ pluginID,
2064
+ "flow",
2065
+ "data",
2066
+ "rootNode"
2067
+ ],
2068
+ transformProfilerData(wrapInRoot(rootNodes))
2069
+ ], [
2070
+ [
2071
+ "plugins",
2072
+ pluginID,
2073
+ "flow",
2074
+ "data",
2075
+ "rawNodes"
2076
+ ],
2077
+ rootNodes
2078
+ ]);
2079
+ _this.store.dispatch(genDataChangeTransaction({
2080
+ playerID: _this.playerID,
2081
+ data: (_newState_plugins_pluginID = newState.plugins[pluginID]) === null || _newState_plugins_pluginID === void 0 ? void 0 : _newState_plugins_pluginID.flow.data,
2082
+ pluginID: pluginID
2083
+ }));
2084
+ });
2085
+ return _this;
2086
+ }
2087
+ _create_class(ProfilerDevtoolsPlugin, [
2088
+ {
2089
+ /**
2090
+ * Produces a new store state with each `[path, value]` pair written into the
2091
+ * draft via `dset`, leaving the live store untouched.
2092
+ */ key: "produceState",
2093
+ value: function produceState() {
2094
+ for(var _len = arguments.length, updates = new Array(_len), _key = 0; _key < _len; _key++){
2095
+ updates[_key] = arguments[_key];
2096
+ }
2097
+ return produce(this.store.getState(), function(draft) {
2098
+ updates.forEach(function(param) {
2099
+ var _param = _sliced_to_array(param, 2), path = _param[0], value = _param[1];
2100
+ dset(draft, path, value);
2101
+ });
2102
+ });
2103
+ }
2104
+ },
2105
+ {
2106
+ key: "startProfiler",
2107
+ value: function startProfiler() {
2108
+ var _newState_plugins_pluginID;
2109
+ this.profilerObj.start();
2110
+ var newState = produce(this.store.getState(), function(draft) {
2111
+ dset(draft, [
2112
+ "plugins",
2113
+ pluginID,
2114
+ "flow",
2115
+ "data",
2116
+ "profiling"
2117
+ ], true);
2118
+ dset(draft, [
2119
+ "plugins",
2120
+ pluginID,
2121
+ "flow",
2122
+ "data",
2123
+ "displayFlameGraph"
2124
+ ], false);
2125
+ });
2126
+ this.store.dispatch(genDataChangeTransaction({
2127
+ playerID: this.playerID,
2128
+ data: (_newState_plugins_pluginID = newState.plugins[pluginID]) === null || _newState_plugins_pluginID === void 0 ? void 0 : _newState_plugins_pluginID.flow.data,
2129
+ pluginID: pluginID
2130
+ }));
2131
+ }
2132
+ },
2133
+ {
2134
+ key: "clearProfiler",
2135
+ value: function clearProfiler() {
2136
+ this.profilerObj.clear();
2137
+ }
2138
+ },
2139
+ {
2140
+ key: "stopProfiler",
2141
+ value: function stopProfiler() {
2142
+ var _newState_plugins_pluginID;
2143
+ var result = this.profilerObj.stopProfiler();
2144
+ var rootNodes = result.rootNodes;
2145
+ var newState = this.produceState([
2146
+ [
2147
+ "plugins",
2148
+ pluginID,
2149
+ "flow",
2150
+ "data",
2151
+ "rootNode"
2152
+ ],
2153
+ transformProfilerData(wrapInRoot(rootNodes))
2154
+ ], [
2155
+ [
2156
+ "plugins",
2157
+ pluginID,
2158
+ "flow",
2159
+ "data",
2160
+ "rawNodes"
2161
+ ],
2162
+ rootNodes
2163
+ ], [
2164
+ [
2165
+ "plugins",
2166
+ pluginID,
2167
+ "flow",
2168
+ "data",
2169
+ "profiling"
2170
+ ],
2171
+ false
2172
+ ], [
2173
+ [
2174
+ "plugins",
2175
+ pluginID,
2176
+ "flow",
2177
+ "data",
2178
+ "displayFlameGraph"
2179
+ ],
2180
+ true
2181
+ ]);
2182
+ this.store.dispatch(genDataChangeTransaction({
2183
+ playerID: this.playerID,
2184
+ data: (_newState_plugins_pluginID = newState.plugins[pluginID]) === null || _newState_plugins_pluginID === void 0 ? void 0 : _newState_plugins_pluginID.flow.data,
2185
+ pluginID: pluginID
2186
+ }));
2187
+ return result;
2188
+ }
2189
+ },
2190
+ {
2191
+ key: "apply",
2192
+ value: function apply(player) {
2193
+ var _initialState_plugins_pluginID;
2194
+ if (!this.checkIfDevtoolsIsActive()) {
2195
+ return;
2196
+ }
2197
+ _get(_get_prototype_of(ProfilerDevtoolsPlugin.prototype), "apply", this).call(this, player);
2198
+ addProfilerInterceptorsToHooks(player, this.profilerObj);
2199
+ this.profilerObj.start();
2200
+ var initialState = produce(this.store.getState(), function(draft) {
2201
+ dset(draft, [
2202
+ "plugins",
2203
+ pluginID,
2204
+ "flow",
2205
+ "data",
2206
+ "profiling"
2207
+ ], true);
2208
+ dset(draft, [
2209
+ "plugins",
2210
+ pluginID,
2211
+ "flow",
2212
+ "data",
2213
+ "displayFlameGraph"
2214
+ ], false);
2215
+ });
2216
+ this.store.dispatch(genDataChangeTransaction({
2217
+ playerID: this.playerID,
2218
+ data: (_initialState_plugins_pluginID = initialState.plugins[pluginID]) === null || _initialState_plugins_pluginID === void 0 ? void 0 : _initialState_plugins_pluginID.flow.data,
2219
+ pluginID: pluginID
2220
+ }));
2221
+ }
2222
+ },
2223
+ {
2224
+ key: "processInteraction",
2225
+ value: function processInteraction(interaction) {
2226
+ var _this_interactionMap_get;
2227
+ _get(_get_prototype_of(ProfilerDevtoolsPlugin.prototype), "processInteraction", this).call(this, interaction);
2228
+ var type = interaction.payload.type;
2229
+ (_this_interactionMap_get = this.interactionMap.get(type)) === null || _this_interactionMap_get === void 0 ? void 0 : _this_interactionMap_get();
2230
+ }
2231
+ }
2232
+ ]);
2233
+ return ProfilerDevtoolsPlugin;
2234
+ }(DevtoolsPlugin);
2235
+ return __toCommonJS(src_exports);
2236
+ }();
2237
+ //# sourceMappingURL=index.global.js.map