octane 0.2.7 → 0.2.8

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.
@@ -188,6 +188,7 @@ __export(runtime_exports, {
188
188
  queueRefAttach: () => queueRefAttach,
189
189
  queueRefDetach: () => queueRefDetach,
190
190
  readContextFromScope: () => readContextFromScope,
191
+ registerWarmPlan: () => registerWarmPlan,
191
192
  renderBlock: () => renderBlock,
192
193
  renderClientContextProvider: () => renderClientContextProvider,
193
194
  replaceRef: () => replaceRef,
@@ -3799,7 +3800,7 @@ function runEffectBody(e) {
3799
3800
  CURRENT_EFFECT_PHASE = e.phase;
3800
3801
  EFFECT_BODY_DEPTH++;
3801
3802
  try {
3802
- cleanup = e.fn.apply(null, e.args ?? []);
3803
+ cleanup = e.fn.apply(null, e.args);
3803
3804
  } finally {
3804
3805
  EFFECT_BODY_DEPTH--;
3805
3806
  CURRENT_EFFECT_PHASE = previousPhase;
@@ -4021,6 +4022,7 @@ class BlockImpl {
4021
4022
  this.$$ctxReads = null;
4022
4023
  this.$$ctxDirect = null;
4023
4024
  this.$$ctxCache = null;
4025
+ this.$$ctxCacheOwner = null;
4024
4026
  this.$$implicitBail = false;
4025
4027
  this.__thenableIdx = 0;
4026
4028
  this.drainStamp = 0;
@@ -4067,6 +4069,7 @@ class ScopeImpl {
4067
4069
  this.$$ctxValues = null;
4068
4070
  this.$$ctxReads = null;
4069
4071
  this.$$ctxCache = null;
4072
+ this.$$ctxCacheOwner = null;
4070
4073
  this.mounted = false;
4071
4074
  this.slots = [];
4072
4075
  }
@@ -7068,7 +7071,8 @@ function bindRendererRegionOwner(props) {
7068
7071
  const binding = { bridge, release };
7069
7072
  RENDERER_REGION_DOM_BINDINGS.set(root, binding);
7070
7073
  RENDERER_REGION_DOM_OWNERS.set(root, bridge);
7071
- root.$$ctxCache?.clear();
7074
+ root.$$ctxCache = null;
7075
+ root.$$ctxCacheOwner = null;
7072
7076
  if (previous === void 0) {
7073
7077
  (root.cleanups ??= []).push(() => {
7074
7078
  const current = RENDERER_REGION_DOM_BINDINGS.get(root);
@@ -7183,11 +7187,31 @@ function createNativeScopedResolver(read) {
7183
7187
  }
7184
7188
  };
7185
7189
  }
7190
+ function cacheContextOwner(reader, context, owner) {
7191
+ if (reader === null) return;
7192
+ const cache = reader.$$ctxCache;
7193
+ if (cache === null) {
7194
+ reader.$$ctxCache = context;
7195
+ reader.$$ctxCacheOwner = owner;
7196
+ return;
7197
+ }
7198
+ const inlineOwner = reader.$$ctxCacheOwner;
7199
+ if (inlineOwner !== null) {
7200
+ const spill = /* @__PURE__ */ new Map();
7201
+ spill.set(cache, inlineOwner);
7202
+ spill.set(context, owner);
7203
+ reader.$$ctxCache = spill;
7204
+ reader.$$ctxCacheOwner = null;
7205
+ } else {
7206
+ cache.set(context, owner);
7207
+ }
7208
+ }
7186
7209
  function readContextFrom(reader, block, context) {
7187
7210
  if (SCOPED_READ_TRACKING) (SCOPED_READS ??= /* @__PURE__ */ new Map()).set(context, context.$$version);
7188
- if (reader !== null && reader.$$ctxCache !== null) {
7189
- const hit = reader.$$ctxCache.get(context);
7190
- if (hit !== void 0) {
7211
+ if (reader !== null) {
7212
+ const cache = reader.$$ctxCache;
7213
+ const hit = cache === context ? reader.$$ctxCacheOwner : cache !== null && reader.$$ctxCacheOwner === null ? cache.get(context) : void 0;
7214
+ if (hit !== null && hit !== void 0) {
7191
7215
  if (hit === DEFAULT_CTX) {
7192
7216
  const bridge2 = rendererRegionOwnerForBlock(block);
7193
7217
  return bridge2 === null ? context.defaultValue : bridge2.readContext(context);
@@ -7199,7 +7223,7 @@ function readContextFrom(reader, block, context) {
7199
7223
  while (scope !== null) {
7200
7224
  const values = scope.$$ctxValues;
7201
7225
  if (values !== null && values.has(context)) {
7202
- if (reader !== null) (reader.$$ctxCache ??= /* @__PURE__ */ new Map()).set(context, scope);
7226
+ cacheContextOwner(reader, context, scope);
7203
7227
  return values.get(context);
7204
7228
  }
7205
7229
  scope = scope.parent;
@@ -7208,14 +7232,14 @@ function readContextFrom(reader, block, context) {
7208
7232
  while (current !== null) {
7209
7233
  const values = current.$$ctxValues;
7210
7234
  if (values !== null && values.has(context)) {
7211
- if (reader !== null) (reader.$$ctxCache ??= /* @__PURE__ */ new Map()).set(context, current);
7235
+ cacheContextOwner(reader, context, current);
7212
7236
  return values.get(context);
7213
7237
  }
7214
7238
  current = current.parentBlock;
7215
7239
  }
7216
7240
  const bridge = rendererRegionOwnerForBlock(block);
7217
7241
  if (bridge !== null) return bridge.readContext(context);
7218
- if (reader !== null) (reader.$$ctxCache ??= /* @__PURE__ */ new Map()).set(context, DEFAULT_CTX);
7242
+ cacheContextOwner(reader, context, DEFAULT_CTX);
7219
7243
  return context.defaultValue;
7220
7244
  }
7221
7245
  function readContextFromScope(scope, context) {
@@ -7431,7 +7455,7 @@ function warnUseWaterfall(block, idx) {
7431
7455
  }
7432
7456
  function useBatch(items, warm) {
7433
7457
  if (items.length === 0) {
7434
- if (warm !== void 0) ACTIVE_WARM_PLANS.push({ block: CURRENT_BLOCK, fn: warm });
7458
+ if (warm !== void 0) ACTIVE_WARM_PLANS.push(CURRENT_BLOCK, warm, void 0);
7435
7459
  return;
7436
7460
  }
7437
7461
  const hydration = activeHydration();
@@ -7458,9 +7482,13 @@ function useBatch(items, warm) {
7458
7482
  });
7459
7483
  throw new SuspenseException(combined);
7460
7484
  }
7485
+ function registerWarmPlan(fn, props) {
7486
+ ACTIVE_WARM_PLANS.push(CURRENT_BLOCK, fn, props);
7487
+ }
7461
7488
  let CURRENT_WARM = null;
7462
7489
  let CURRENT_WARM_CLAIMS = null;
7463
7490
  let WARM_EVER = false;
7491
+ let LATEST_WARM_CACHE_EPISODE = 0;
7464
7492
  let WARM_DEPTH = 0;
7465
7493
  const WARM_DEPTH_CAP = 64;
7466
7494
  const WARM_MISS = /* @__PURE__ */ Symbol("octane.warm.miss");
@@ -7485,16 +7513,18 @@ function warmCacheForOwner(owner) {
7485
7513
  }
7486
7514
  owner.__warmCache = cache;
7487
7515
  owner.__warmCacheEpisode = CURRENT_WARM_EPISODE;
7516
+ if (CURRENT_WARM_EPISODE > LATEST_WARM_CACHE_EPISODE)
7517
+ LATEST_WARM_CACHE_EPISODE = CURRENT_WARM_EPISODE;
7488
7518
  return cache;
7489
7519
  }
7490
7520
  function recordRealWarmMemo(slot, deps, source) {
7491
7521
  const block = CURRENT_BLOCK;
7492
7522
  if (block === null) return false;
7493
7523
  let owner = null;
7494
- for (let i = 0; i < ACTIVE_WARM_PLANS.length; i++) {
7495
- const plan = ACTIVE_WARM_PLANS[i];
7496
- if (!blockIsAncestor(plan.block, block)) continue;
7497
- owner = plan.block;
7524
+ for (let i = 0; i < ACTIVE_WARM_PLANS.length; i += 3) {
7525
+ const planBlock = ACTIVE_WARM_PLANS[i];
7526
+ if (!blockIsAncestor(planBlock, block)) continue;
7527
+ owner = planBlock;
7498
7528
  break;
7499
7529
  }
7500
7530
  if (owner === null) return false;
@@ -7557,11 +7587,11 @@ function runActiveWarmPlans(local) {
7557
7587
  const block = CURRENT_BLOCK;
7558
7588
  let plans = null;
7559
7589
  let owner = block;
7560
- for (let i = 0; i < ACTIVE_WARM_PLANS.length; i++) {
7561
- const plan = ACTIVE_WARM_PLANS[i];
7562
- if (!blockIsAncestor(plan.block, block)) continue;
7563
- (plans ??= []).push(plan);
7564
- if (plans.length === 1) owner = plan.block;
7590
+ for (let i = 0; i < ACTIVE_WARM_PLANS.length; i += 3) {
7591
+ const planBlock = ACTIVE_WARM_PLANS[i];
7592
+ if (!blockIsAncestor(planBlock, block)) continue;
7593
+ (plans ??= []).push(i);
7594
+ if (plans.length === 1) owner = planBlock;
7565
7595
  }
7566
7596
  if (plans === null && local === void 0) return;
7567
7597
  runWarm(() => {
@@ -7569,7 +7599,8 @@ function runActiveWarmPlans(local) {
7569
7599
  for (let i = 0; i < plans.length; i++) {
7570
7600
  CURRENT_WARM_CLAIMS = /* @__PURE__ */ new Set();
7571
7601
  try {
7572
- plans[i].fn();
7602
+ const index = plans[i];
7603
+ ACTIVE_WARM_PLANS[index + 1](ACTIVE_WARM_PLANS[index + 2]);
7573
7604
  } catch {
7574
7605
  }
7575
7606
  }
@@ -7702,7 +7733,7 @@ function markWarm(component, plan) {
7702
7733
  return component;
7703
7734
  }
7704
7735
  function adoptWarmEntry(slot, deps, accept) {
7705
- let b = CURRENT_BLOCK;
7736
+ let b = CURRENT_WARM_EPISODE <= LATEST_WARM_CACHE_EPISODE ? CURRENT_BLOCK : null;
7706
7737
  while (b !== null) {
7707
7738
  const cache = b.__warmCache;
7708
7739
  if (b.__warmCacheEpisode === CURRENT_WARM_EPISODE && cache !== void 0) {
@@ -8121,8 +8152,10 @@ function getFirstChild(node) {
8121
8152
  function getNextSibling(node) {
8122
8153
  return nextSiblingGetter === void 0 ? node.nextSibling : nextSiblingGetter.call(node);
8123
8154
  }
8124
- function seedExpando(proto, key) {
8125
- if (!(key in proto)) proto[key] = void 0;
8155
+ function seedExpando(proto, key, enumerable = true) {
8156
+ if (key in proto) return;
8157
+ if (enumerable) proto[key] = void 0;
8158
+ else Object.defineProperty(proto, key, { value: void 0, writable: true, configurable: true });
8126
8159
  }
8127
8160
  let domOperationsReady = false;
8128
8161
  function initDomOperations() {
@@ -8140,6 +8173,11 @@ function initDomOperations() {
8140
8173
  seedExpando(elementProto, "__oct_suppress");
8141
8174
  seedExpando(elementProto, "__oct_frag");
8142
8175
  seedExpando(elementProto, "__oct_vfrag");
8176
+ seedExpando(elementProto, DANGER_HTML_ACTIVE, false);
8177
+ seedExpando(elementProto, DANGER_HTML_STATIC_CHILD, false);
8178
+ seedExpando(elementProto, DANGER_HTML_SPREAD_CHILD, false);
8179
+ seedExpando(elementProto, DEOPT_DESC, false);
8180
+ seedExpando(elementProto, DEFAULT_VALUE_BASELINE, false);
8143
8181
  if (process.env.NODE_ENV !== "production") {
8144
8182
  seedExpando(elementProto, "__oct_loc");
8145
8183
  }
@@ -8147,6 +8185,7 @@ function initDomOperations() {
8147
8185
  if (typeof CharacterData !== "undefined" && Object.isExtensible(CharacterData.prototype)) {
8148
8186
  seedExpando(CharacterData.prototype, "$$portalEnd");
8149
8187
  seedExpando(CharacterData.prototype, "$$deoptKey");
8188
+ seedExpando(CharacterData.prototype, DEOPT_DESC, false);
8150
8189
  }
8151
8190
  }
8152
8191
  const LAZY_TEMPLATE = /* @__PURE__ */ Symbol("octane.lazy-template");
@@ -10816,6 +10855,10 @@ function isEventRoot(node, epoch) {
10816
10855
  return membership !== void 0 && membership.count > 0;
10817
10856
  }
10818
10857
  function prepareDelegatedEvent(event, listener) {
10858
+ if (_delegationTargets.size === 1 && portalEventTargetCount === 0) {
10859
+ event[EVENT_ROOT_EPOCH] = eventRootEpoch;
10860
+ return;
10861
+ }
10819
10862
  const path = event.composedPath();
10820
10863
  if (_delegationTargets.size === 1) {
10821
10864
  event[EVENT_ROOT_EPOCH] = eventRootEpoch;
@@ -11363,6 +11406,11 @@ function finishCaptureDispatch(event) {
11363
11406
  return;
11364
11407
  }
11365
11408
  if (!DISCRETE_EVENTS.has(type)) return;
11409
+ if (pendingRestores.length === 0) {
11410
+ if (!RESTORE_EVENTS.has(type)) return;
11411
+ const tag = event.target?.localName;
11412
+ if (tag !== "input" && tag !== "textarea" && tag !== "select") return;
11413
+ }
11366
11414
  const bubbleVersion = event[DELEGATED_BUBBLE_VERSION];
11367
11415
  const fallback = () => {
11368
11416
  if (event[DELEGATED_BUBBLE_VERSION] === bubbleVersion) {
@@ -11374,7 +11422,8 @@ function finishCaptureDispatch(event) {
11374
11422
  else queueMicrotask(fallback);
11375
11423
  }
11376
11424
  function dispatchDelegated(event) {
11377
- if (delegatedCapture(event.type)) prepareDelegatedEvent(event, this);
11425
+ const nativeCapture = delegatedCapture(event.type);
11426
+ let path = nativeCapture ? prepareDelegatedEvent(event, this) : void 0;
11378
11427
  event[DELEGATED_BUBBLE_VERSION] = (event[DELEGATED_BUBBLE_VERSION] || 0) + 1;
11379
11428
  maybeEnqueueRestore(event);
11380
11429
  const key = "$$" + event.type;
@@ -11389,12 +11438,14 @@ function dispatchDelegated(event) {
11389
11438
  let stop;
11390
11439
  let propagationStarted = false;
11391
11440
  try {
11392
- if (delegatedCapture(event.type) && _delegatedCapture.has(event.type) && dispatchDelegatedCapture.call(this, event))
11393
- return;
11441
+ if (nativeCapture && _delegatedCapture.has(event.type)) {
11442
+ path ??= event.composedPath();
11443
+ if (dispatchDelegatedCapture.call(this, event, path)) return;
11444
+ }
11394
11445
  if (!_delegated.has(event.type)) return;
11395
11446
  if (node?.nodeType === 1 && isHtmlCustomElement(node) && (event.type === "invalid" || EMULATED_BUBBLING_EVENTS.includes(event.type)))
11396
11447
  return;
11397
- buildDelegatedPath(event, this);
11448
+ buildDelegatedPath(event, this, path);
11398
11449
  snapshotDelegatedSlots(pathBase, key, event);
11399
11450
  stop = Object.getOwnPropertyDescriptor(event, "stopPropagation");
11400
11451
  propagationStarted = true;
@@ -11431,9 +11482,10 @@ function dispatchDelegated(event) {
11431
11482
  maybeFlushDiscrete(event.type);
11432
11483
  }
11433
11484
  }
11434
- function dispatchDelegatedCapture(event) {
11435
- const path = prepareDelegatedEvent(event, this);
11485
+ function dispatchDelegatedCapture(event, path) {
11486
+ path ??= prepareDelegatedEvent(event, this);
11436
11487
  if (!_delegatedCapture.has(event.type)) return false;
11488
+ path ??= event.composedPath();
11437
11489
  if (!event.bubbles || !_delegated.has(event.type)) maybeEnqueueRestore(event);
11438
11490
  const key = CAPTURE_PREFIX + event.type;
11439
11491
  const pathBase = CAPTURE_PATH.length;
@@ -12830,6 +12882,14 @@ function elementKeyWasProvided(descriptor) {
12830
12882
  }
12831
12883
  const ELEMENTS_MISSING_LIST_KEY = /* @__PURE__ */ new WeakSet();
12832
12884
  const SCOPED_ELEMENT_PROPS = /* @__PURE__ */ new WeakSet();
12885
+ const SCOPED_CHILDREN_RESOLVER = /* @__PURE__ */ Symbol("octane.scopedChildren");
12886
+ const SCOPED_CHILDREN_PROPERTY = {
12887
+ configurable: true,
12888
+ enumerable: true,
12889
+ get: function() {
12890
+ return this[SCOPED_CHILDREN_RESOLVER]();
12891
+ }
12892
+ };
12833
12893
  function hasElementConfigKey(config) {
12834
12894
  if (config == null || typeof config !== "object" && typeof config !== "function") return false;
12835
12895
  if (process.env.NODE_ENV !== "production" && import_has_own.hasOwnProp.call(config, "key")) {
@@ -12846,6 +12906,83 @@ function copyElementConfig(config) {
12846
12906
  }
12847
12907
  return props;
12848
12908
  }
12909
+ function restoreWritableScopedChildren(props, name, value) {
12910
+ const inherited = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(props), name);
12911
+ if (inherited?.get === void 0 && inherited?.set === void 0) return false;
12912
+ Object.defineProperty(props, "children", {
12913
+ configurable: true,
12914
+ enumerable: true,
12915
+ writable: true,
12916
+ value
12917
+ });
12918
+ return true;
12919
+ }
12920
+ function copyScopedElementConfig(type, config, resolve) {
12921
+ if (config != null && import_has_own.hasOwnProp.call(config, "__proto__") || import_has_own.hasOwnProp.call(Object.prototype, "children")) {
12922
+ const props2 = copyElementConfig(config);
12923
+ (0, import_shared_value_helpers.applyElementDefaultProps)(type, props2);
12924
+ Object.defineProperty(props2, SCOPED_CHILDREN_RESOLVER, { value: resolve });
12925
+ Object.defineProperty(props2, "children", SCOPED_CHILDREN_PROPERTY);
12926
+ SCOPED_ELEMENT_PROPS.add(props2);
12927
+ return props2;
12928
+ }
12929
+ const props = {};
12930
+ Object.defineProperty(props, SCOPED_CHILDREN_RESOLVER, { value: resolve });
12931
+ let copiedChildren;
12932
+ let hasCopiedChildren = false;
12933
+ let childrenAreWritable = false;
12934
+ if (config != null) {
12935
+ for (const name in config) {
12936
+ if (name === "key" || !import_has_own.hasOwnProp.call(config, name)) continue;
12937
+ if (name === "children") {
12938
+ copiedChildren = config[name];
12939
+ Object.defineProperty(props, "children", SCOPED_CHILDREN_PROPERTY);
12940
+ hasCopiedChildren = true;
12941
+ } else {
12942
+ const value = config[name];
12943
+ if (hasCopiedChildren && !childrenAreWritable && !import_has_own.hasOwnProp.call(props, name) && restoreWritableScopedChildren(props, name, copiedChildren)) {
12944
+ childrenAreWritable = true;
12945
+ }
12946
+ props[name] = value;
12947
+ }
12948
+ }
12949
+ }
12950
+ const defaults = type?.defaultProps;
12951
+ if (defaults != null) {
12952
+ for (const name in defaults) {
12953
+ if (name === "children") {
12954
+ if ((childrenAreWritable ? props.children : hasCopiedChildren ? copiedChildren : props.children) === void 0) {
12955
+ copiedChildren = defaults[name];
12956
+ if (childrenAreWritable) {
12957
+ props.children = copiedChildren;
12958
+ } else if (!hasCopiedChildren) {
12959
+ if ("children" in props) {
12960
+ props.children = copiedChildren;
12961
+ } else {
12962
+ Object.defineProperty(props, "children", SCOPED_CHILDREN_PROPERTY);
12963
+ hasCopiedChildren = true;
12964
+ }
12965
+ }
12966
+ }
12967
+ } else {
12968
+ if (hasCopiedChildren && !childrenAreWritable && !import_has_own.hasOwnProp.call(props, name) && restoreWritableScopedChildren(props, name, copiedChildren)) {
12969
+ childrenAreWritable = true;
12970
+ }
12971
+ if (props[name] === void 0) props[name] = defaults[name];
12972
+ }
12973
+ }
12974
+ }
12975
+ if (childrenAreWritable || !hasCopiedChildren)
12976
+ Object.defineProperty(props, "children", SCOPED_CHILDREN_PROPERTY);
12977
+ SCOPED_ELEMENT_PROPS.add(props);
12978
+ return props;
12979
+ }
12980
+ function scopedElementRecord(type, props, key, ref, resolve) {
12981
+ const descriptor = { $$kind: ELEMENT_TAG, type, props, key, ref };
12982
+ Object.defineProperty(descriptor, SCOPED_CHILDREN_RESOLVER, { value: resolve });
12983
+ Object.defineProperty(descriptor, "children", SCOPED_CHILDREN_PROPERTY);
12984
+ return descriptor;
12985
+ }
12849
12986
  function finalizeElementDescriptor(descriptor) {
12850
12987
  if (process.env.NODE_ENV !== "production") {
12851
12988
  Object.freeze(descriptor.props);
@@ -12854,6 +12991,33 @@ function finalizeElementDescriptor(descriptor) {
12854
12991
  return descriptor;
12855
12992
  }
12856
12993
  const SCOPED_VALUE_RECORD = /* @__PURE__ */ Symbol("octane.scopedValue");
12994
+ function scopedValueType() {
12995
+ return this[SCOPED_VALUE_RECORD]().type;
12996
+ }
12997
+ function scopedValueProps() {
12998
+ return this[SCOPED_VALUE_RECORD]().props;
12999
+ }
13000
+ function scopedValueKey() {
13001
+ const next = this[SCOPED_VALUE_RECORD]();
13002
+ const key = next.key;
13003
+ if (key === null && KEYED_ELEMENT_DESCRIPTORS.has(next)) {
13004
+ KEYED_ELEMENT_DESCRIPTORS.add(this);
13005
+ }
13006
+ return key;
13007
+ }
13008
+ function scopedValueRef() {
13009
+ return this[SCOPED_VALUE_RECORD]().ref;
13010
+ }
13011
+ function scopedValueChildren() {
13012
+ return this[SCOPED_VALUE_RECORD]().children;
13013
+ }
13014
+ const SCOPED_VALUE_PROPERTIES = {
13015
+ type: { configurable: true, enumerable: true, get: scopedValueType },
13016
+ props: { configurable: true, enumerable: true, get: scopedValueProps },
13017
+ key: { configurable: true, enumerable: true, get: scopedValueKey },
13018
+ ref: { configurable: true, enumerable: true, get: scopedValueRef },
13019
+ children: { configurable: true, enumerable: true, get: scopedValueChildren }
13020
+ };
12857
13021
  function createScopedValue(readElement) {
12858
13022
  return scopedValueDescriptor(createScopedResolver(readElement));
12859
13023
  }
@@ -12861,30 +13025,13 @@ function nativeCreateScopedValue(readElement) {
12861
13025
  return scopedValueDescriptor(createNativeScopedResolver(readElement));
12862
13026
  }
12863
13027
  function scopedValueDescriptor(resolve) {
12864
- const descriptor = {
12865
- $$kind: ELEMENT_TAG,
12866
- get type() {
12867
- return resolve().type;
12868
- },
12869
- get props() {
12870
- return resolve().props;
12871
- },
12872
- get key() {
12873
- const next = resolve();
12874
- const key = next.key;
12875
- if (key === null && KEYED_ELEMENT_DESCRIPTORS.has(next)) {
12876
- KEYED_ELEMENT_DESCRIPTORS.add(descriptor);
12877
- }
12878
- return key;
12879
- },
12880
- get ref() {
12881
- return resolve().ref;
12882
- },
12883
- get children() {
12884
- return resolve().children;
12885
- }
12886
- };
13028
+ const descriptor = { $$kind: ELEMENT_TAG };
12887
13029
  Object.defineProperty(descriptor, SCOPED_VALUE_RECORD, { value: resolve });
13030
+ Object.defineProperty(descriptor, "type", SCOPED_VALUE_PROPERTIES.type);
13031
+ Object.defineProperty(descriptor, "props", SCOPED_VALUE_PROPERTIES.props);
13032
+ Object.defineProperty(descriptor, "key", SCOPED_VALUE_PROPERTIES.key);
13033
+ Object.defineProperty(descriptor, "ref", SCOPED_VALUE_PROPERTIES.ref);
13034
+ Object.defineProperty(descriptor, "children", SCOPED_VALUE_PROPERTIES.children);
12888
13035
  if (process.env.NODE_ENV !== "production") Object.freeze(descriptor);
12889
13036
  return descriptor;
12890
13037
  }
@@ -12898,20 +13045,14 @@ function scopedElementDescriptor(type, props, children) {
12898
13045
  const src = props ?? null;
12899
13046
  const hasKey = hasElementConfigKey(src);
12900
13047
  const key = hasKey ? "" + src.key : null;
12901
- const copiedProps = copyElementConfig(src);
12902
- (0, import_shared_value_helpers.applyElementDefaultProps)(type, copiedProps);
12903
- const childProperty = { configurable: true, enumerable: true, get: children };
12904
- Object.defineProperty(copiedProps, "children", childProperty);
12905
- SCOPED_ELEMENT_PROPS.add(copiedProps);
12906
- const descriptor = {
12907
- $$kind: ELEMENT_TAG,
13048
+ const copiedProps = copyScopedElementConfig(type, src, children);
13049
+ const descriptor = scopedElementRecord(
12908
13050
  type,
12909
- props: copiedProps,
13051
+ copiedProps,
12910
13052
  key,
12911
- ref: copiedProps.ref !== void 0 ? copiedProps.ref : null,
12912
- children: null
12913
- };
12914
- Object.defineProperty(descriptor, "children", childProperty);
13053
+ copiedProps.ref !== void 0 ? copiedProps.ref : null,
13054
+ children
13055
+ );
12915
13056
  if (key === null && src != null && (typeof src === "object" || typeof src === "function") && "key" in src) {
12916
13057
  KEYED_ELEMENT_DESCRIPTORS.add(descriptor);
12917
13058
  }
@@ -12961,9 +13102,15 @@ function cloneElement(element, config, ...children) {
12961
13102
  throw new Error((0, import_error_codes_client_generated.formatClientError)(4));
12962
13103
  }
12963
13104
  let scopedChildren;
13105
+ let copiedGetter;
12964
13106
  let props;
12965
13107
  if (SCOPED_ELEMENT_PROPS.has(element.props)) {
12966
- scopedChildren = Object.getOwnPropertyDescriptor(element, "children").get;
13108
+ const get = Object.getOwnPropertyDescriptor(element, "children").get;
13109
+ if (get === SCOPED_CHILDREN_PROPERTY.get) {
13110
+ scopedChildren = element[SCOPED_CHILDREN_RESOLVER];
13111
+ } else {
13112
+ copiedGetter = get === SCOPED_VALUE_PROPERTIES.children.get ? () => get.call(element) : get;
13113
+ }
12967
13114
  props = {};
12968
13115
  for (const name in element.props) {
12969
13116
  if (name !== "key" && name !== "children" && import_has_own.hasOwnProp.call(element.props, name)) {
@@ -12990,30 +13137,49 @@ function cloneElement(element, config, ...children) {
12990
13137
  }
12991
13138
  const n = children.length;
12992
13139
  let kids;
12993
- let childProperty;
13140
+ let keepsScopedChildren = false;
12994
13141
  if (n === 1) {
12995
13142
  kids = children[0];
12996
13143
  } else if (n > 1) {
12997
13144
  POSITIONAL_CHILDREN.add(children);
12998
13145
  kids = children;
12999
- } else if (scopedChildren !== void 0 && !replacedChildren) {
13000
- childProperty = { configurable: true, enumerable: true, get: scopedChildren };
13001
- Object.defineProperty(props, "children", childProperty);
13146
+ } else if ((scopedChildren !== void 0 || copiedGetter !== void 0) && !replacedChildren) {
13147
+ if (copiedGetter === void 0) {
13148
+ Object.defineProperty(props, SCOPED_CHILDREN_RESOLVER, { value: scopedChildren });
13149
+ }
13150
+ Object.defineProperty(
13151
+ props,
13152
+ "children",
13153
+ copiedGetter === void 0 ? SCOPED_CHILDREN_PROPERTY : { configurable: true, enumerable: true, get: copiedGetter }
13154
+ );
13002
13155
  SCOPED_ELEMENT_PROPS.add(props);
13156
+ keepsScopedChildren = true;
13003
13157
  kids = null;
13004
13158
  } else {
13005
13159
  kids = "children" in props ? props.children : element.children;
13006
13160
  }
13007
13161
  if (n > 0) props.children = kids;
13008
- const descriptor = {
13009
- $$kind: ELEMENT_TAG,
13010
- type: element.type,
13011
- props,
13012
- key,
13013
- ref: props.ref !== void 0 ? props.ref : null,
13014
- children: kids ?? null
13015
- };
13016
- if (childProperty !== void 0) Object.defineProperty(descriptor, "children", childProperty);
13162
+ const ref = props.ref !== void 0 ? props.ref : null;
13163
+ let descriptor;
13164
+ if (keepsScopedChildren && copiedGetter === void 0) {
13165
+ descriptor = scopedElementRecord(element.type, props, key, ref, scopedChildren);
13166
+ } else {
13167
+ descriptor = {
13168
+ $$kind: ELEMENT_TAG,
13169
+ type: element.type,
13170
+ props,
13171
+ key,
13172
+ ref,
13173
+ children: kids ?? null
13174
+ };
13175
+ if (keepsScopedChildren) {
13176
+ Object.defineProperty(descriptor, "children", {
13177
+ configurable: true,
13178
+ enumerable: true,
13179
+ get: copiedGetter
13180
+ });
13181
+ }
13182
+ }
13017
13183
  if (key === null && (elementKeyWasProvided(element) || config != null && import_has_own.hasOwnProp.call(config, "key"))) {
13018
13184
  KEYED_ELEMENT_DESCRIPTORS.add(descriptor);
13019
13185
  }
@@ -13024,20 +13190,42 @@ function cloneElement(element, config, ...children) {
13024
13190
  }
13025
13191
  function cloneAndReplaceElementKey(element, key) {
13026
13192
  const scoped = SCOPED_ELEMENT_PROPS.has(element.props);
13027
- const descriptor = {
13028
- $$kind: ELEMENT_TAG,
13029
- type: element.type,
13030
- props: element.props,
13031
- key,
13032
- ref: element.ref,
13033
- children: scoped ? null : element.children
13034
- };
13193
+ let descriptor;
13035
13194
  if (scoped) {
13036
- Object.defineProperty(descriptor, "children", {
13037
- configurable: true,
13038
- enumerable: true,
13039
- get: Object.getOwnPropertyDescriptor(element, "children").get
13040
- });
13195
+ const get = Object.getOwnPropertyDescriptor(element, "children").get;
13196
+ if (get === SCOPED_CHILDREN_PROPERTY.get) {
13197
+ descriptor = scopedElementRecord(
13198
+ element.type,
13199
+ element.props,
13200
+ key,
13201
+ element.ref,
13202
+ element[SCOPED_CHILDREN_RESOLVER]
13203
+ );
13204
+ } else {
13205
+ const copiedGetter = get === SCOPED_VALUE_PROPERTIES.children.get ? () => get.call(element) : get;
13206
+ descriptor = {
13207
+ $$kind: ELEMENT_TAG,
13208
+ type: element.type,
13209
+ props: element.props,
13210
+ key,
13211
+ ref: element.ref,
13212
+ children: null
13213
+ };
13214
+ Object.defineProperty(descriptor, "children", {
13215
+ configurable: true,
13216
+ enumerable: true,
13217
+ get: copiedGetter
13218
+ });
13219
+ }
13220
+ } else {
13221
+ descriptor = {
13222
+ $$kind: ELEMENT_TAG,
13223
+ type: element.type,
13224
+ props: element.props,
13225
+ key,
13226
+ ref: element.ref,
13227
+ children: element.children
13228
+ };
13041
13229
  }
13042
13230
  if (ELEMENTS_MISSING_LIST_KEY.has(element)) ELEMENTS_MISSING_LIST_KEY.add(descriptor);
13043
13231
  return finalizeElementDescriptor(descriptor);
@@ -13958,7 +14146,7 @@ function hostComponent(scope, slot, tag, props, childrenBody, anchor) {
13958
14146
  if (typeof childrenBody === "function") {
13959
14147
  state.latest = childrenBody;
13960
14148
  if (state.body === void 0) {
13961
- state.body = ((...args) => state.latest(...args));
14149
+ state.body = (props2, scope2, extra) => state.latest(props2, scope2, extra);
13962
14150
  }
13963
14151
  childSlot(state.childScope, 0, el, state.body, null, false, el);
13964
14152
  } else if (childrenBody != null || state.childScope.slots[0] !== void 0) {
@@ -14122,20 +14310,48 @@ function renderFragmentRefDescriptor(descriptor, scope) {
14122
14310
  function deoptWrapperKind(value) {
14123
14311
  return POSITIONAL_CHILDREN.has(value) ? "fragment" : "array";
14124
14312
  }
14125
- function scopedDeoptKey(path, item, index, key) {
14313
+ const DEOPT_KEY_STRINGIFY = JSON.stringify;
14314
+ function nestedImplicitKeyPrefix(path) {
14315
+ if (JSON.stringify !== DEOPT_KEY_STRINGIFY || "toJSON" in path) return null;
14316
+ for (let i = 0; i < path.length; i++) {
14317
+ const type = typeof path[i];
14318
+ if (type !== "string" && type !== "number") return null;
14319
+ }
14320
+ return "[" + JSON.stringify(path) + ',"index",';
14321
+ }
14322
+ function appendScopedDeoptKey(outKeys, path, item, index, key, implicitPrefix) {
14126
14323
  const explicit = (isElementDescriptor(item) || item?.$$kind === PORTAL_TAG) && item.key != null;
14127
- if (path.length === 0) return explicit ? "k" + String(key) : "i" + index;
14128
- return JSON.stringify([path, explicit ? "key" : "index", explicit ? String(key) : index]);
14324
+ if (path.length === 0) {
14325
+ outKeys.push(explicit ? "k" + String(key) : index);
14326
+ return implicitPrefix;
14327
+ }
14328
+ if (!explicit) {
14329
+ if (implicitPrefix === void 0) implicitPrefix = nestedImplicitKeyPrefix(path);
14330
+ if (implicitPrefix !== null && JSON.stringify === DEOPT_KEY_STRINGIFY && !("toJSON" in path)) {
14331
+ outKeys.push(implicitPrefix + index + "]");
14332
+ return implicitPrefix;
14333
+ }
14334
+ }
14335
+ outKeys.push(JSON.stringify([path, explicit ? "key" : "index", explicit ? String(key) : index]));
14336
+ return implicitPrefix;
14129
14337
  }
14130
14338
  function flattenReactChildContainer(outItems, outKeys, children, kind, path) {
14131
14339
  const keyFn = kind === "fragment" ? deoptKeyPositional : deoptKey;
14132
14340
  const count = children.length;
14341
+ let implicitPrefix = count > 1 ? void 0 : null;
14133
14342
  for (let i = 0; i < count; i++) {
14134
14343
  const item = children[i];
14135
14344
  if (isFragmentDescriptor(item)) {
14136
14345
  if (item.ref != null || import_has_own.hasOwnProp.call(item.props, "ref")) {
14137
14346
  outItems.push(fragmentRefDescriptor(item));
14138
- outKeys.push(scopedDeoptKey(path, item, i, keyFn(item, i)));
14347
+ implicitPrefix = appendScopedDeoptKey(
14348
+ outKeys,
14349
+ path,
14350
+ item,
14351
+ i,
14352
+ keyFn(item, i),
14353
+ implicitPrefix
14354
+ );
14139
14355
  continue;
14140
14356
  }
14141
14357
  const nested = fragmentDescriptorChildren(item);
@@ -14158,15 +14374,18 @@ function flattenReactChildContainer(outItems, outKeys, children, kind, path) {
14158
14374
  continue;
14159
14375
  }
14160
14376
  outItems.push(item);
14161
- outKeys.push(scopedDeoptKey(path, item, i, keyFn(item, i)));
14377
+ implicitPrefix = appendScopedDeoptKey(outKeys, path, item, i, keyFn(item, i), implicitPrefix);
14162
14378
  }
14163
14379
  }
14380
+ function singleDeoptKey(item, key) {
14381
+ return (isElementDescriptor(item) || item?.$$kind === PORTAL_TAG) && item.key != null ? "k" + String(key) : 0;
14382
+ }
14164
14383
  function prepareDeoptList(value, forceSingle = false, includeKeyedSingle = true) {
14165
14384
  if (isFragmentDescriptor(value)) {
14166
14385
  if (value.ref != null || import_has_own.hasOwnProp.call(value.props, "ref")) {
14167
14386
  return {
14168
14387
  items: [fragmentRefDescriptor(value)],
14169
- keys: [scopedDeoptKey([], value, 0, value.key ?? 0)]
14388
+ keys: [singleDeoptKey(value, value.key ?? 0)]
14170
14389
  };
14171
14390
  }
14172
14391
  const items = [];
@@ -14182,10 +14401,10 @@ function prepareDeoptList(value, forceSingle = false, includeKeyedSingle = true)
14182
14401
  return { items, keys };
14183
14402
  }
14184
14403
  if (includeKeyedSingle && isElementDescriptor(value) && value.key != null) {
14185
- return { items: [value], keys: [scopedDeoptKey([], value, 0, value.key)] };
14404
+ return { items: [value], keys: [singleDeoptKey(value, value.key)] };
14186
14405
  }
14187
14406
  if (forceSingle) {
14188
- return { items: [value], keys: [scopedDeoptKey([], value, 0, deoptKeyPositional(value, 0))] };
14407
+ return { items: [value], keys: [singleDeoptKey(value, deoptKeyPositional(value, 0))] };
14189
14408
  }
14190
14409
  return null;
14191
14410
  }
@@ -16014,29 +16233,36 @@ function shallowEqualPropsExact(a, b) {
16014
16233
  }
16015
16234
  return true;
16016
16235
  }
16236
+ const MEMO_OWNER = /* @__PURE__ */ Symbol("memoOwner");
16237
+ const MEMO_MARKER_DESCRIPTOR = {
16238
+ get() {
16239
+ return this === this[MEMO_OWNER];
16240
+ }
16241
+ };
16242
+ const MEMO_DEFAULT_PROPS_DESCRIPTOR = {
16243
+ configurable: true,
16244
+ // Static hoisters must copy `type` along with this accessor.
16245
+ get() {
16246
+ return this.type.defaultProps;
16247
+ },
16248
+ set(value) {
16249
+ this.type.defaultProps = value;
16250
+ }
16251
+ };
16017
16252
  // @__NO_SIDE_EFFECTS__
16018
16253
  function memo(component, arePropsEqual) {
16019
16254
  function memoWrapper(props, scope, extra) {
16020
16255
  return component(props, scope, extra);
16021
16256
  }
16257
+ Object.defineProperty(memoWrapper, MEMO_OWNER, { value: memoWrapper });
16022
16258
  Object.defineProperty(memoWrapper, "type", { value: component });
16023
16259
  Object.defineProperty(memoWrapper, "displayName", {
16024
16260
  configurable: true,
16025
16261
  writable: true,
16026
16262
  value: component.displayName || component.name || "Memo"
16027
16263
  });
16028
- Object.defineProperty(memoWrapper, "__memo", {
16029
- get() {
16030
- return this === memoWrapper;
16031
- }
16032
- });
16033
- Object.defineProperty(memoWrapper, "defaultProps", {
16034
- configurable: true,
16035
- get: () => component.defaultProps,
16036
- set: (value) => {
16037
- component.defaultProps = value;
16038
- }
16039
- });
16264
+ Object.defineProperty(memoWrapper, "__memo", MEMO_MARKER_DESCRIPTOR);
16265
+ Object.defineProperty(memoWrapper, "defaultProps", MEMO_DEFAULT_PROPS_DESCRIPTOR);
16040
16266
  if (typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__)
16041
16267
  (0, import_profiling.__profileComponentSource)(memoWrapper, component);
16042
16268
  if (arePropsEqual) Object.defineProperty(memoWrapper, "__compare", { value: arePropsEqual });
@@ -22557,6 +22783,7 @@ function scriptResource(attrs) {
22557
22783
  queueRefAttach,
22558
22784
  queueRefDetach,
22559
22785
  readContextFromScope,
22786
+ registerWarmPlan,
22560
22787
  renderBlock,
22561
22788
  renderClientContextProvider,
22562
22789
  replaceRef,