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.
package/dist/runtime.js CHANGED
@@ -3628,7 +3628,7 @@ function runEffectBody(e) {
3628
3628
  CURRENT_EFFECT_PHASE = e.phase;
3629
3629
  EFFECT_BODY_DEPTH++;
3630
3630
  try {
3631
- cleanup = e.fn.apply(null, e.args ?? []);
3631
+ cleanup = e.fn.apply(null, e.args);
3632
3632
  } finally {
3633
3633
  EFFECT_BODY_DEPTH--;
3634
3634
  CURRENT_EFFECT_PHASE = previousPhase;
@@ -3850,6 +3850,7 @@ class BlockImpl {
3850
3850
  this.$$ctxReads = null;
3851
3851
  this.$$ctxDirect = null;
3852
3852
  this.$$ctxCache = null;
3853
+ this.$$ctxCacheOwner = null;
3853
3854
  this.$$implicitBail = false;
3854
3855
  this.__thenableIdx = 0;
3855
3856
  this.drainStamp = 0;
@@ -3896,6 +3897,7 @@ class ScopeImpl {
3896
3897
  this.$$ctxValues = null;
3897
3898
  this.$$ctxReads = null;
3898
3899
  this.$$ctxCache = null;
3900
+ this.$$ctxCacheOwner = null;
3899
3901
  this.mounted = false;
3900
3902
  this.slots = [];
3901
3903
  }
@@ -6897,7 +6899,8 @@ function bindRendererRegionOwner(props) {
6897
6899
  const binding = { bridge, release };
6898
6900
  RENDERER_REGION_DOM_BINDINGS.set(root, binding);
6899
6901
  RENDERER_REGION_DOM_OWNERS.set(root, bridge);
6900
- root.$$ctxCache?.clear();
6902
+ root.$$ctxCache = null;
6903
+ root.$$ctxCacheOwner = null;
6901
6904
  if (previous === void 0) {
6902
6905
  (root.cleanups ??= []).push(() => {
6903
6906
  const current = RENDERER_REGION_DOM_BINDINGS.get(root);
@@ -7012,11 +7015,31 @@ function createNativeScopedResolver(read) {
7012
7015
  }
7013
7016
  };
7014
7017
  }
7018
+ function cacheContextOwner(reader, context, owner) {
7019
+ if (reader === null) return;
7020
+ const cache = reader.$$ctxCache;
7021
+ if (cache === null) {
7022
+ reader.$$ctxCache = context;
7023
+ reader.$$ctxCacheOwner = owner;
7024
+ return;
7025
+ }
7026
+ const inlineOwner = reader.$$ctxCacheOwner;
7027
+ if (inlineOwner !== null) {
7028
+ const spill = /* @__PURE__ */ new Map();
7029
+ spill.set(cache, inlineOwner);
7030
+ spill.set(context, owner);
7031
+ reader.$$ctxCache = spill;
7032
+ reader.$$ctxCacheOwner = null;
7033
+ } else {
7034
+ cache.set(context, owner);
7035
+ }
7036
+ }
7015
7037
  function readContextFrom(reader, block, context) {
7016
7038
  if (SCOPED_READ_TRACKING) (SCOPED_READS ??= /* @__PURE__ */ new Map()).set(context, context.$$version);
7017
- if (reader !== null && reader.$$ctxCache !== null) {
7018
- const hit = reader.$$ctxCache.get(context);
7019
- if (hit !== void 0) {
7039
+ if (reader !== null) {
7040
+ const cache = reader.$$ctxCache;
7041
+ const hit = cache === context ? reader.$$ctxCacheOwner : cache !== null && reader.$$ctxCacheOwner === null ? cache.get(context) : void 0;
7042
+ if (hit !== null && hit !== void 0) {
7020
7043
  if (hit === DEFAULT_CTX) {
7021
7044
  const bridge2 = rendererRegionOwnerForBlock(block);
7022
7045
  return bridge2 === null ? context.defaultValue : bridge2.readContext(context);
@@ -7028,7 +7051,7 @@ function readContextFrom(reader, block, context) {
7028
7051
  while (scope !== null) {
7029
7052
  const values = scope.$$ctxValues;
7030
7053
  if (values !== null && values.has(context)) {
7031
- if (reader !== null) (reader.$$ctxCache ??= /* @__PURE__ */ new Map()).set(context, scope);
7054
+ cacheContextOwner(reader, context, scope);
7032
7055
  return values.get(context);
7033
7056
  }
7034
7057
  scope = scope.parent;
@@ -7037,14 +7060,14 @@ function readContextFrom(reader, block, context) {
7037
7060
  while (current !== null) {
7038
7061
  const values = current.$$ctxValues;
7039
7062
  if (values !== null && values.has(context)) {
7040
- if (reader !== null) (reader.$$ctxCache ??= /* @__PURE__ */ new Map()).set(context, current);
7063
+ cacheContextOwner(reader, context, current);
7041
7064
  return values.get(context);
7042
7065
  }
7043
7066
  current = current.parentBlock;
7044
7067
  }
7045
7068
  const bridge = rendererRegionOwnerForBlock(block);
7046
7069
  if (bridge !== null) return bridge.readContext(context);
7047
- if (reader !== null) (reader.$$ctxCache ??= /* @__PURE__ */ new Map()).set(context, DEFAULT_CTX);
7070
+ cacheContextOwner(reader, context, DEFAULT_CTX);
7048
7071
  return context.defaultValue;
7049
7072
  }
7050
7073
  function readContextFromScope(scope, context) {
@@ -7260,7 +7283,7 @@ function warnUseWaterfall(block, idx) {
7260
7283
  }
7261
7284
  function useBatch(items, warm) {
7262
7285
  if (items.length === 0) {
7263
- if (warm !== void 0) ACTIVE_WARM_PLANS.push({ block: CURRENT_BLOCK, fn: warm });
7286
+ if (warm !== void 0) ACTIVE_WARM_PLANS.push(CURRENT_BLOCK, warm, void 0);
7264
7287
  return;
7265
7288
  }
7266
7289
  const hydration = activeHydration();
@@ -7287,9 +7310,13 @@ function useBatch(items, warm) {
7287
7310
  });
7288
7311
  throw new SuspenseException(combined);
7289
7312
  }
7313
+ function registerWarmPlan(fn, props) {
7314
+ ACTIVE_WARM_PLANS.push(CURRENT_BLOCK, fn, props);
7315
+ }
7290
7316
  let CURRENT_WARM = null;
7291
7317
  let CURRENT_WARM_CLAIMS = null;
7292
7318
  let WARM_EVER = false;
7319
+ let LATEST_WARM_CACHE_EPISODE = 0;
7293
7320
  let WARM_DEPTH = 0;
7294
7321
  const WARM_DEPTH_CAP = 64;
7295
7322
  const WARM_MISS = /* @__PURE__ */ Symbol("octane.warm.miss");
@@ -7314,16 +7341,18 @@ function warmCacheForOwner(owner) {
7314
7341
  }
7315
7342
  owner.__warmCache = cache;
7316
7343
  owner.__warmCacheEpisode = CURRENT_WARM_EPISODE;
7344
+ if (CURRENT_WARM_EPISODE > LATEST_WARM_CACHE_EPISODE)
7345
+ LATEST_WARM_CACHE_EPISODE = CURRENT_WARM_EPISODE;
7317
7346
  return cache;
7318
7347
  }
7319
7348
  function recordRealWarmMemo(slot, deps, source) {
7320
7349
  const block = CURRENT_BLOCK;
7321
7350
  if (block === null) return false;
7322
7351
  let owner = null;
7323
- for (let i = 0; i < ACTIVE_WARM_PLANS.length; i++) {
7324
- const plan = ACTIVE_WARM_PLANS[i];
7325
- if (!blockIsAncestor(plan.block, block)) continue;
7326
- owner = plan.block;
7352
+ for (let i = 0; i < ACTIVE_WARM_PLANS.length; i += 3) {
7353
+ const planBlock = ACTIVE_WARM_PLANS[i];
7354
+ if (!blockIsAncestor(planBlock, block)) continue;
7355
+ owner = planBlock;
7327
7356
  break;
7328
7357
  }
7329
7358
  if (owner === null) return false;
@@ -7386,11 +7415,11 @@ function runActiveWarmPlans(local) {
7386
7415
  const block = CURRENT_BLOCK;
7387
7416
  let plans = null;
7388
7417
  let owner = block;
7389
- for (let i = 0; i < ACTIVE_WARM_PLANS.length; i++) {
7390
- const plan = ACTIVE_WARM_PLANS[i];
7391
- if (!blockIsAncestor(plan.block, block)) continue;
7392
- (plans ??= []).push(plan);
7393
- if (plans.length === 1) owner = plan.block;
7418
+ for (let i = 0; i < ACTIVE_WARM_PLANS.length; i += 3) {
7419
+ const planBlock = ACTIVE_WARM_PLANS[i];
7420
+ if (!blockIsAncestor(planBlock, block)) continue;
7421
+ (plans ??= []).push(i);
7422
+ if (plans.length === 1) owner = planBlock;
7394
7423
  }
7395
7424
  if (plans === null && local === void 0) return;
7396
7425
  runWarm(() => {
@@ -7398,7 +7427,8 @@ function runActiveWarmPlans(local) {
7398
7427
  for (let i = 0; i < plans.length; i++) {
7399
7428
  CURRENT_WARM_CLAIMS = /* @__PURE__ */ new Set();
7400
7429
  try {
7401
- plans[i].fn();
7430
+ const index = plans[i];
7431
+ ACTIVE_WARM_PLANS[index + 1](ACTIVE_WARM_PLANS[index + 2]);
7402
7432
  } catch {
7403
7433
  }
7404
7434
  }
@@ -7531,7 +7561,7 @@ function markWarm(component, plan) {
7531
7561
  return component;
7532
7562
  }
7533
7563
  function adoptWarmEntry(slot, deps, accept) {
7534
- let b = CURRENT_BLOCK;
7564
+ let b = CURRENT_WARM_EPISODE <= LATEST_WARM_CACHE_EPISODE ? CURRENT_BLOCK : null;
7535
7565
  while (b !== null) {
7536
7566
  const cache = b.__warmCache;
7537
7567
  if (b.__warmCacheEpisode === CURRENT_WARM_EPISODE && cache !== void 0) {
@@ -7950,8 +7980,10 @@ function getFirstChild(node) {
7950
7980
  function getNextSibling(node) {
7951
7981
  return nextSiblingGetter === void 0 ? node.nextSibling : nextSiblingGetter.call(node);
7952
7982
  }
7953
- function seedExpando(proto, key) {
7954
- if (!(key in proto)) proto[key] = void 0;
7983
+ function seedExpando(proto, key, enumerable = true) {
7984
+ if (key in proto) return;
7985
+ if (enumerable) proto[key] = void 0;
7986
+ else Object.defineProperty(proto, key, { value: void 0, writable: true, configurable: true });
7955
7987
  }
7956
7988
  let domOperationsReady = false;
7957
7989
  function initDomOperations() {
@@ -7969,6 +8001,11 @@ function initDomOperations() {
7969
8001
  seedExpando(elementProto, "__oct_suppress");
7970
8002
  seedExpando(elementProto, "__oct_frag");
7971
8003
  seedExpando(elementProto, "__oct_vfrag");
8004
+ seedExpando(elementProto, DANGER_HTML_ACTIVE, false);
8005
+ seedExpando(elementProto, DANGER_HTML_STATIC_CHILD, false);
8006
+ seedExpando(elementProto, DANGER_HTML_SPREAD_CHILD, false);
8007
+ seedExpando(elementProto, DEOPT_DESC, false);
8008
+ seedExpando(elementProto, DEFAULT_VALUE_BASELINE, false);
7972
8009
  if (process.env.NODE_ENV !== "production") {
7973
8010
  seedExpando(elementProto, "__oct_loc");
7974
8011
  }
@@ -7976,6 +8013,7 @@ function initDomOperations() {
7976
8013
  if (typeof CharacterData !== "undefined" && Object.isExtensible(CharacterData.prototype)) {
7977
8014
  seedExpando(CharacterData.prototype, "$$portalEnd");
7978
8015
  seedExpando(CharacterData.prototype, "$$deoptKey");
8016
+ seedExpando(CharacterData.prototype, DEOPT_DESC, false);
7979
8017
  }
7980
8018
  }
7981
8019
  const LAZY_TEMPLATE = /* @__PURE__ */ Symbol("octane.lazy-template");
@@ -10652,6 +10690,10 @@ function isEventRoot(node, epoch) {
10652
10690
  return membership !== void 0 && membership.count > 0;
10653
10691
  }
10654
10692
  function prepareDelegatedEvent(event, listener) {
10693
+ if (_delegationTargets.size === 1 && portalEventTargetCount === 0) {
10694
+ event[EVENT_ROOT_EPOCH] = eventRootEpoch;
10695
+ return;
10696
+ }
10655
10697
  const path = event.composedPath();
10656
10698
  if (_delegationTargets.size === 1) {
10657
10699
  event[EVENT_ROOT_EPOCH] = eventRootEpoch;
@@ -11199,6 +11241,11 @@ function finishCaptureDispatch(event) {
11199
11241
  return;
11200
11242
  }
11201
11243
  if (!DISCRETE_EVENTS.has(type)) return;
11244
+ if (pendingRestores.length === 0) {
11245
+ if (!RESTORE_EVENTS.has(type)) return;
11246
+ const tag = event.target?.localName;
11247
+ if (tag !== "input" && tag !== "textarea" && tag !== "select") return;
11248
+ }
11202
11249
  const bubbleVersion = event[DELEGATED_BUBBLE_VERSION];
11203
11250
  const fallback = () => {
11204
11251
  if (event[DELEGATED_BUBBLE_VERSION] === bubbleVersion) {
@@ -11210,7 +11257,8 @@ function finishCaptureDispatch(event) {
11210
11257
  else queueMicrotask(fallback);
11211
11258
  }
11212
11259
  function dispatchDelegated(event) {
11213
- if (delegatedCapture(event.type)) prepareDelegatedEvent(event, this);
11260
+ const nativeCapture = delegatedCapture(event.type);
11261
+ let path = nativeCapture ? prepareDelegatedEvent(event, this) : void 0;
11214
11262
  event[DELEGATED_BUBBLE_VERSION] = (event[DELEGATED_BUBBLE_VERSION] || 0) + 1;
11215
11263
  maybeEnqueueRestore(event);
11216
11264
  const key = "$$" + event.type;
@@ -11225,12 +11273,14 @@ function dispatchDelegated(event) {
11225
11273
  let stop;
11226
11274
  let propagationStarted = false;
11227
11275
  try {
11228
- if (delegatedCapture(event.type) && _delegatedCapture.has(event.type) && dispatchDelegatedCapture.call(this, event))
11229
- return;
11276
+ if (nativeCapture && _delegatedCapture.has(event.type)) {
11277
+ path ??= event.composedPath();
11278
+ if (dispatchDelegatedCapture.call(this, event, path)) return;
11279
+ }
11230
11280
  if (!_delegated.has(event.type)) return;
11231
11281
  if (node?.nodeType === 1 && isHtmlCustomElement(node) && (event.type === "invalid" || EMULATED_BUBBLING_EVENTS.includes(event.type)))
11232
11282
  return;
11233
- buildDelegatedPath(event, this);
11283
+ buildDelegatedPath(event, this, path);
11234
11284
  snapshotDelegatedSlots(pathBase, key, event);
11235
11285
  stop = Object.getOwnPropertyDescriptor(event, "stopPropagation");
11236
11286
  propagationStarted = true;
@@ -11267,9 +11317,10 @@ function dispatchDelegated(event) {
11267
11317
  maybeFlushDiscrete(event.type);
11268
11318
  }
11269
11319
  }
11270
- function dispatchDelegatedCapture(event) {
11271
- const path = prepareDelegatedEvent(event, this);
11320
+ function dispatchDelegatedCapture(event, path) {
11321
+ path ??= prepareDelegatedEvent(event, this);
11272
11322
  if (!_delegatedCapture.has(event.type)) return false;
11323
+ path ??= event.composedPath();
11273
11324
  if (!event.bubbles || !_delegated.has(event.type)) maybeEnqueueRestore(event);
11274
11325
  const key = CAPTURE_PREFIX + event.type;
11275
11326
  const pathBase = CAPTURE_PATH.length;
@@ -12666,6 +12717,14 @@ function elementKeyWasProvided(descriptor) {
12666
12717
  }
12667
12718
  const ELEMENTS_MISSING_LIST_KEY = /* @__PURE__ */ new WeakSet();
12668
12719
  const SCOPED_ELEMENT_PROPS = /* @__PURE__ */ new WeakSet();
12720
+ const SCOPED_CHILDREN_RESOLVER = /* @__PURE__ */ Symbol("octane.scopedChildren");
12721
+ const SCOPED_CHILDREN_PROPERTY = {
12722
+ configurable: true,
12723
+ enumerable: true,
12724
+ get: function() {
12725
+ return this[SCOPED_CHILDREN_RESOLVER]();
12726
+ }
12727
+ };
12669
12728
  function hasElementConfigKey(config) {
12670
12729
  if (config == null || typeof config !== "object" && typeof config !== "function") return false;
12671
12730
  if (process.env.NODE_ENV !== "production" && hasOwnProp.call(config, "key")) {
@@ -12682,6 +12741,83 @@ function copyElementConfig(config) {
12682
12741
  }
12683
12742
  return props;
12684
12743
  }
12744
+ function restoreWritableScopedChildren(props, name, value) {
12745
+ const inherited = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(props), name);
12746
+ if (inherited?.get === void 0 && inherited?.set === void 0) return false;
12747
+ Object.defineProperty(props, "children", {
12748
+ configurable: true,
12749
+ enumerable: true,
12750
+ writable: true,
12751
+ value
12752
+ });
12753
+ return true;
12754
+ }
12755
+ function copyScopedElementConfig(type, config, resolve) {
12756
+ if (config != null && hasOwnProp.call(config, "__proto__") || hasOwnProp.call(Object.prototype, "children")) {
12757
+ const props2 = copyElementConfig(config);
12758
+ applyElementDefaultProps(type, props2);
12759
+ Object.defineProperty(props2, SCOPED_CHILDREN_RESOLVER, { value: resolve });
12760
+ Object.defineProperty(props2, "children", SCOPED_CHILDREN_PROPERTY);
12761
+ SCOPED_ELEMENT_PROPS.add(props2);
12762
+ return props2;
12763
+ }
12764
+ const props = {};
12765
+ Object.defineProperty(props, SCOPED_CHILDREN_RESOLVER, { value: resolve });
12766
+ let copiedChildren;
12767
+ let hasCopiedChildren = false;
12768
+ let childrenAreWritable = false;
12769
+ if (config != null) {
12770
+ for (const name in config) {
12771
+ if (name === "key" || !hasOwnProp.call(config, name)) continue;
12772
+ if (name === "children") {
12773
+ copiedChildren = config[name];
12774
+ Object.defineProperty(props, "children", SCOPED_CHILDREN_PROPERTY);
12775
+ hasCopiedChildren = true;
12776
+ } else {
12777
+ const value = config[name];
12778
+ if (hasCopiedChildren && !childrenAreWritable && !hasOwnProp.call(props, name) && restoreWritableScopedChildren(props, name, copiedChildren)) {
12779
+ childrenAreWritable = true;
12780
+ }
12781
+ props[name] = value;
12782
+ }
12783
+ }
12784
+ }
12785
+ const defaults = type?.defaultProps;
12786
+ if (defaults != null) {
12787
+ for (const name in defaults) {
12788
+ if (name === "children") {
12789
+ if ((childrenAreWritable ? props.children : hasCopiedChildren ? copiedChildren : props.children) === void 0) {
12790
+ copiedChildren = defaults[name];
12791
+ if (childrenAreWritable) {
12792
+ props.children = copiedChildren;
12793
+ } else if (!hasCopiedChildren) {
12794
+ if ("children" in props) {
12795
+ props.children = copiedChildren;
12796
+ } else {
12797
+ Object.defineProperty(props, "children", SCOPED_CHILDREN_PROPERTY);
12798
+ hasCopiedChildren = true;
12799
+ }
12800
+ }
12801
+ }
12802
+ } else {
12803
+ if (hasCopiedChildren && !childrenAreWritable && !hasOwnProp.call(props, name) && restoreWritableScopedChildren(props, name, copiedChildren)) {
12804
+ childrenAreWritable = true;
12805
+ }
12806
+ if (props[name] === void 0) props[name] = defaults[name];
12807
+ }
12808
+ }
12809
+ }
12810
+ if (childrenAreWritable || !hasCopiedChildren)
12811
+ Object.defineProperty(props, "children", SCOPED_CHILDREN_PROPERTY);
12812
+ SCOPED_ELEMENT_PROPS.add(props);
12813
+ return props;
12814
+ }
12815
+ function scopedElementRecord(type, props, key, ref, resolve) {
12816
+ const descriptor = { $$kind: ELEMENT_TAG, type, props, key, ref };
12817
+ Object.defineProperty(descriptor, SCOPED_CHILDREN_RESOLVER, { value: resolve });
12818
+ Object.defineProperty(descriptor, "children", SCOPED_CHILDREN_PROPERTY);
12819
+ return descriptor;
12820
+ }
12685
12821
  function finalizeElementDescriptor(descriptor) {
12686
12822
  if (process.env.NODE_ENV !== "production") {
12687
12823
  Object.freeze(descriptor.props);
@@ -12690,6 +12826,33 @@ function finalizeElementDescriptor(descriptor) {
12690
12826
  return descriptor;
12691
12827
  }
12692
12828
  const SCOPED_VALUE_RECORD = /* @__PURE__ */ Symbol("octane.scopedValue");
12829
+ function scopedValueType() {
12830
+ return this[SCOPED_VALUE_RECORD]().type;
12831
+ }
12832
+ function scopedValueProps() {
12833
+ return this[SCOPED_VALUE_RECORD]().props;
12834
+ }
12835
+ function scopedValueKey() {
12836
+ const next = this[SCOPED_VALUE_RECORD]();
12837
+ const key = next.key;
12838
+ if (key === null && KEYED_ELEMENT_DESCRIPTORS.has(next)) {
12839
+ KEYED_ELEMENT_DESCRIPTORS.add(this);
12840
+ }
12841
+ return key;
12842
+ }
12843
+ function scopedValueRef() {
12844
+ return this[SCOPED_VALUE_RECORD]().ref;
12845
+ }
12846
+ function scopedValueChildren() {
12847
+ return this[SCOPED_VALUE_RECORD]().children;
12848
+ }
12849
+ const SCOPED_VALUE_PROPERTIES = {
12850
+ type: { configurable: true, enumerable: true, get: scopedValueType },
12851
+ props: { configurable: true, enumerable: true, get: scopedValueProps },
12852
+ key: { configurable: true, enumerable: true, get: scopedValueKey },
12853
+ ref: { configurable: true, enumerable: true, get: scopedValueRef },
12854
+ children: { configurable: true, enumerable: true, get: scopedValueChildren }
12855
+ };
12693
12856
  function createScopedValue(readElement) {
12694
12857
  return scopedValueDescriptor(createScopedResolver(readElement));
12695
12858
  }
@@ -12697,30 +12860,13 @@ function nativeCreateScopedValue(readElement) {
12697
12860
  return scopedValueDescriptor(createNativeScopedResolver(readElement));
12698
12861
  }
12699
12862
  function scopedValueDescriptor(resolve) {
12700
- const descriptor = {
12701
- $$kind: ELEMENT_TAG,
12702
- get type() {
12703
- return resolve().type;
12704
- },
12705
- get props() {
12706
- return resolve().props;
12707
- },
12708
- get key() {
12709
- const next = resolve();
12710
- const key = next.key;
12711
- if (key === null && KEYED_ELEMENT_DESCRIPTORS.has(next)) {
12712
- KEYED_ELEMENT_DESCRIPTORS.add(descriptor);
12713
- }
12714
- return key;
12715
- },
12716
- get ref() {
12717
- return resolve().ref;
12718
- },
12719
- get children() {
12720
- return resolve().children;
12721
- }
12722
- };
12863
+ const descriptor = { $$kind: ELEMENT_TAG };
12723
12864
  Object.defineProperty(descriptor, SCOPED_VALUE_RECORD, { value: resolve });
12865
+ Object.defineProperty(descriptor, "type", SCOPED_VALUE_PROPERTIES.type);
12866
+ Object.defineProperty(descriptor, "props", SCOPED_VALUE_PROPERTIES.props);
12867
+ Object.defineProperty(descriptor, "key", SCOPED_VALUE_PROPERTIES.key);
12868
+ Object.defineProperty(descriptor, "ref", SCOPED_VALUE_PROPERTIES.ref);
12869
+ Object.defineProperty(descriptor, "children", SCOPED_VALUE_PROPERTIES.children);
12724
12870
  if (process.env.NODE_ENV !== "production") Object.freeze(descriptor);
12725
12871
  return descriptor;
12726
12872
  }
@@ -12734,20 +12880,14 @@ function scopedElementDescriptor(type, props, children) {
12734
12880
  const src = props ?? null;
12735
12881
  const hasKey = hasElementConfigKey(src);
12736
12882
  const key = hasKey ? "" + src.key : null;
12737
- const copiedProps = copyElementConfig(src);
12738
- applyElementDefaultProps(type, copiedProps);
12739
- const childProperty = { configurable: true, enumerable: true, get: children };
12740
- Object.defineProperty(copiedProps, "children", childProperty);
12741
- SCOPED_ELEMENT_PROPS.add(copiedProps);
12742
- const descriptor = {
12743
- $$kind: ELEMENT_TAG,
12883
+ const copiedProps = copyScopedElementConfig(type, src, children);
12884
+ const descriptor = scopedElementRecord(
12744
12885
  type,
12745
- props: copiedProps,
12886
+ copiedProps,
12746
12887
  key,
12747
- ref: copiedProps.ref !== void 0 ? copiedProps.ref : null,
12748
- children: null
12749
- };
12750
- Object.defineProperty(descriptor, "children", childProperty);
12888
+ copiedProps.ref !== void 0 ? copiedProps.ref : null,
12889
+ children
12890
+ );
12751
12891
  if (key === null && src != null && (typeof src === "object" || typeof src === "function") && "key" in src) {
12752
12892
  KEYED_ELEMENT_DESCRIPTORS.add(descriptor);
12753
12893
  }
@@ -12797,9 +12937,15 @@ function cloneElement(element, config, ...children) {
12797
12937
  throw new Error(formatClientError(4));
12798
12938
  }
12799
12939
  let scopedChildren;
12940
+ let copiedGetter;
12800
12941
  let props;
12801
12942
  if (SCOPED_ELEMENT_PROPS.has(element.props)) {
12802
- scopedChildren = Object.getOwnPropertyDescriptor(element, "children").get;
12943
+ const get = Object.getOwnPropertyDescriptor(element, "children").get;
12944
+ if (get === SCOPED_CHILDREN_PROPERTY.get) {
12945
+ scopedChildren = element[SCOPED_CHILDREN_RESOLVER];
12946
+ } else {
12947
+ copiedGetter = get === SCOPED_VALUE_PROPERTIES.children.get ? () => get.call(element) : get;
12948
+ }
12803
12949
  props = {};
12804
12950
  for (const name in element.props) {
12805
12951
  if (name !== "key" && name !== "children" && hasOwnProp.call(element.props, name)) {
@@ -12826,30 +12972,49 @@ function cloneElement(element, config, ...children) {
12826
12972
  }
12827
12973
  const n = children.length;
12828
12974
  let kids;
12829
- let childProperty;
12975
+ let keepsScopedChildren = false;
12830
12976
  if (n === 1) {
12831
12977
  kids = children[0];
12832
12978
  } else if (n > 1) {
12833
12979
  POSITIONAL_CHILDREN.add(children);
12834
12980
  kids = children;
12835
- } else if (scopedChildren !== void 0 && !replacedChildren) {
12836
- childProperty = { configurable: true, enumerable: true, get: scopedChildren };
12837
- Object.defineProperty(props, "children", childProperty);
12981
+ } else if ((scopedChildren !== void 0 || copiedGetter !== void 0) && !replacedChildren) {
12982
+ if (copiedGetter === void 0) {
12983
+ Object.defineProperty(props, SCOPED_CHILDREN_RESOLVER, { value: scopedChildren });
12984
+ }
12985
+ Object.defineProperty(
12986
+ props,
12987
+ "children",
12988
+ copiedGetter === void 0 ? SCOPED_CHILDREN_PROPERTY : { configurable: true, enumerable: true, get: copiedGetter }
12989
+ );
12838
12990
  SCOPED_ELEMENT_PROPS.add(props);
12991
+ keepsScopedChildren = true;
12839
12992
  kids = null;
12840
12993
  } else {
12841
12994
  kids = "children" in props ? props.children : element.children;
12842
12995
  }
12843
12996
  if (n > 0) props.children = kids;
12844
- const descriptor = {
12845
- $$kind: ELEMENT_TAG,
12846
- type: element.type,
12847
- props,
12848
- key,
12849
- ref: props.ref !== void 0 ? props.ref : null,
12850
- children: kids ?? null
12851
- };
12852
- if (childProperty !== void 0) Object.defineProperty(descriptor, "children", childProperty);
12997
+ const ref = props.ref !== void 0 ? props.ref : null;
12998
+ let descriptor;
12999
+ if (keepsScopedChildren && copiedGetter === void 0) {
13000
+ descriptor = scopedElementRecord(element.type, props, key, ref, scopedChildren);
13001
+ } else {
13002
+ descriptor = {
13003
+ $$kind: ELEMENT_TAG,
13004
+ type: element.type,
13005
+ props,
13006
+ key,
13007
+ ref,
13008
+ children: kids ?? null
13009
+ };
13010
+ if (keepsScopedChildren) {
13011
+ Object.defineProperty(descriptor, "children", {
13012
+ configurable: true,
13013
+ enumerable: true,
13014
+ get: copiedGetter
13015
+ });
13016
+ }
13017
+ }
12853
13018
  if (key === null && (elementKeyWasProvided(element) || config != null && hasOwnProp.call(config, "key"))) {
12854
13019
  KEYED_ELEMENT_DESCRIPTORS.add(descriptor);
12855
13020
  }
@@ -12860,20 +13025,42 @@ function cloneElement(element, config, ...children) {
12860
13025
  }
12861
13026
  function cloneAndReplaceElementKey(element, key) {
12862
13027
  const scoped = SCOPED_ELEMENT_PROPS.has(element.props);
12863
- const descriptor = {
12864
- $$kind: ELEMENT_TAG,
12865
- type: element.type,
12866
- props: element.props,
12867
- key,
12868
- ref: element.ref,
12869
- children: scoped ? null : element.children
12870
- };
13028
+ let descriptor;
12871
13029
  if (scoped) {
12872
- Object.defineProperty(descriptor, "children", {
12873
- configurable: true,
12874
- enumerable: true,
12875
- get: Object.getOwnPropertyDescriptor(element, "children").get
12876
- });
13030
+ const get = Object.getOwnPropertyDescriptor(element, "children").get;
13031
+ if (get === SCOPED_CHILDREN_PROPERTY.get) {
13032
+ descriptor = scopedElementRecord(
13033
+ element.type,
13034
+ element.props,
13035
+ key,
13036
+ element.ref,
13037
+ element[SCOPED_CHILDREN_RESOLVER]
13038
+ );
13039
+ } else {
13040
+ const copiedGetter = get === SCOPED_VALUE_PROPERTIES.children.get ? () => get.call(element) : get;
13041
+ descriptor = {
13042
+ $$kind: ELEMENT_TAG,
13043
+ type: element.type,
13044
+ props: element.props,
13045
+ key,
13046
+ ref: element.ref,
13047
+ children: null
13048
+ };
13049
+ Object.defineProperty(descriptor, "children", {
13050
+ configurable: true,
13051
+ enumerable: true,
13052
+ get: copiedGetter
13053
+ });
13054
+ }
13055
+ } else {
13056
+ descriptor = {
13057
+ $$kind: ELEMENT_TAG,
13058
+ type: element.type,
13059
+ props: element.props,
13060
+ key,
13061
+ ref: element.ref,
13062
+ children: element.children
13063
+ };
12877
13064
  }
12878
13065
  if (ELEMENTS_MISSING_LIST_KEY.has(element)) ELEMENTS_MISSING_LIST_KEY.add(descriptor);
12879
13066
  return finalizeElementDescriptor(descriptor);
@@ -13794,7 +13981,7 @@ function hostComponent(scope, slot, tag, props, childrenBody, anchor) {
13794
13981
  if (typeof childrenBody === "function") {
13795
13982
  state.latest = childrenBody;
13796
13983
  if (state.body === void 0) {
13797
- state.body = ((...args) => state.latest(...args));
13984
+ state.body = (props2, scope2, extra) => state.latest(props2, scope2, extra);
13798
13985
  }
13799
13986
  childSlot(state.childScope, 0, el, state.body, null, false, el);
13800
13987
  } else if (childrenBody != null || state.childScope.slots[0] !== void 0) {
@@ -13958,20 +14145,48 @@ function renderFragmentRefDescriptor(descriptor, scope) {
13958
14145
  function deoptWrapperKind(value) {
13959
14146
  return POSITIONAL_CHILDREN.has(value) ? "fragment" : "array";
13960
14147
  }
13961
- function scopedDeoptKey(path, item, index, key) {
14148
+ const DEOPT_KEY_STRINGIFY = JSON.stringify;
14149
+ function nestedImplicitKeyPrefix(path) {
14150
+ if (JSON.stringify !== DEOPT_KEY_STRINGIFY || "toJSON" in path) return null;
14151
+ for (let i = 0; i < path.length; i++) {
14152
+ const type = typeof path[i];
14153
+ if (type !== "string" && type !== "number") return null;
14154
+ }
14155
+ return "[" + JSON.stringify(path) + ',"index",';
14156
+ }
14157
+ function appendScopedDeoptKey(outKeys, path, item, index, key, implicitPrefix) {
13962
14158
  const explicit = (isElementDescriptor(item) || item?.$$kind === PORTAL_TAG) && item.key != null;
13963
- if (path.length === 0) return explicit ? "k" + String(key) : "i" + index;
13964
- return JSON.stringify([path, explicit ? "key" : "index", explicit ? String(key) : index]);
14159
+ if (path.length === 0) {
14160
+ outKeys.push(explicit ? "k" + String(key) : index);
14161
+ return implicitPrefix;
14162
+ }
14163
+ if (!explicit) {
14164
+ if (implicitPrefix === void 0) implicitPrefix = nestedImplicitKeyPrefix(path);
14165
+ if (implicitPrefix !== null && JSON.stringify === DEOPT_KEY_STRINGIFY && !("toJSON" in path)) {
14166
+ outKeys.push(implicitPrefix + index + "]");
14167
+ return implicitPrefix;
14168
+ }
14169
+ }
14170
+ outKeys.push(JSON.stringify([path, explicit ? "key" : "index", explicit ? String(key) : index]));
14171
+ return implicitPrefix;
13965
14172
  }
13966
14173
  function flattenReactChildContainer(outItems, outKeys, children, kind, path) {
13967
14174
  const keyFn = kind === "fragment" ? deoptKeyPositional : deoptKey;
13968
14175
  const count = children.length;
14176
+ let implicitPrefix = count > 1 ? void 0 : null;
13969
14177
  for (let i = 0; i < count; i++) {
13970
14178
  const item = children[i];
13971
14179
  if (isFragmentDescriptor(item)) {
13972
14180
  if (item.ref != null || hasOwnProp.call(item.props, "ref")) {
13973
14181
  outItems.push(fragmentRefDescriptor(item));
13974
- outKeys.push(scopedDeoptKey(path, item, i, keyFn(item, i)));
14182
+ implicitPrefix = appendScopedDeoptKey(
14183
+ outKeys,
14184
+ path,
14185
+ item,
14186
+ i,
14187
+ keyFn(item, i),
14188
+ implicitPrefix
14189
+ );
13975
14190
  continue;
13976
14191
  }
13977
14192
  const nested = fragmentDescriptorChildren(item);
@@ -13994,15 +14209,18 @@ function flattenReactChildContainer(outItems, outKeys, children, kind, path) {
13994
14209
  continue;
13995
14210
  }
13996
14211
  outItems.push(item);
13997
- outKeys.push(scopedDeoptKey(path, item, i, keyFn(item, i)));
14212
+ implicitPrefix = appendScopedDeoptKey(outKeys, path, item, i, keyFn(item, i), implicitPrefix);
13998
14213
  }
13999
14214
  }
14215
+ function singleDeoptKey(item, key) {
14216
+ return (isElementDescriptor(item) || item?.$$kind === PORTAL_TAG) && item.key != null ? "k" + String(key) : 0;
14217
+ }
14000
14218
  function prepareDeoptList(value, forceSingle = false, includeKeyedSingle = true) {
14001
14219
  if (isFragmentDescriptor(value)) {
14002
14220
  if (value.ref != null || hasOwnProp.call(value.props, "ref")) {
14003
14221
  return {
14004
14222
  items: [fragmentRefDescriptor(value)],
14005
- keys: [scopedDeoptKey([], value, 0, value.key ?? 0)]
14223
+ keys: [singleDeoptKey(value, value.key ?? 0)]
14006
14224
  };
14007
14225
  }
14008
14226
  const items = [];
@@ -14018,10 +14236,10 @@ function prepareDeoptList(value, forceSingle = false, includeKeyedSingle = true)
14018
14236
  return { items, keys };
14019
14237
  }
14020
14238
  if (includeKeyedSingle && isElementDescriptor(value) && value.key != null) {
14021
- return { items: [value], keys: [scopedDeoptKey([], value, 0, value.key)] };
14239
+ return { items: [value], keys: [singleDeoptKey(value, value.key)] };
14022
14240
  }
14023
14241
  if (forceSingle) {
14024
- return { items: [value], keys: [scopedDeoptKey([], value, 0, deoptKeyPositional(value, 0))] };
14242
+ return { items: [value], keys: [singleDeoptKey(value, deoptKeyPositional(value, 0))] };
14025
14243
  }
14026
14244
  return null;
14027
14245
  }
@@ -15850,29 +16068,36 @@ function shallowEqualPropsExact(a, b) {
15850
16068
  }
15851
16069
  return true;
15852
16070
  }
16071
+ const MEMO_OWNER = /* @__PURE__ */ Symbol("memoOwner");
16072
+ const MEMO_MARKER_DESCRIPTOR = {
16073
+ get() {
16074
+ return this === this[MEMO_OWNER];
16075
+ }
16076
+ };
16077
+ const MEMO_DEFAULT_PROPS_DESCRIPTOR = {
16078
+ configurable: true,
16079
+ // Static hoisters must copy `type` along with this accessor.
16080
+ get() {
16081
+ return this.type.defaultProps;
16082
+ },
16083
+ set(value) {
16084
+ this.type.defaultProps = value;
16085
+ }
16086
+ };
15853
16087
  // @__NO_SIDE_EFFECTS__
15854
16088
  function memo(component, arePropsEqual) {
15855
16089
  function memoWrapper(props, scope, extra) {
15856
16090
  return component(props, scope, extra);
15857
16091
  }
16092
+ Object.defineProperty(memoWrapper, MEMO_OWNER, { value: memoWrapper });
15858
16093
  Object.defineProperty(memoWrapper, "type", { value: component });
15859
16094
  Object.defineProperty(memoWrapper, "displayName", {
15860
16095
  configurable: true,
15861
16096
  writable: true,
15862
16097
  value: component.displayName || component.name || "Memo"
15863
16098
  });
15864
- Object.defineProperty(memoWrapper, "__memo", {
15865
- get() {
15866
- return this === memoWrapper;
15867
- }
15868
- });
15869
- Object.defineProperty(memoWrapper, "defaultProps", {
15870
- configurable: true,
15871
- get: () => component.defaultProps,
15872
- set: (value) => {
15873
- component.defaultProps = value;
15874
- }
15875
- });
16099
+ Object.defineProperty(memoWrapper, "__memo", MEMO_MARKER_DESCRIPTOR);
16100
+ Object.defineProperty(memoWrapper, "defaultProps", MEMO_DEFAULT_PROPS_DESCRIPTOR);
15876
16101
  if (typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__)
15877
16102
  __profileComponentSource(memoWrapper, component);
15878
16103
  if (arePropsEqual) Object.defineProperty(memoWrapper, "__compare", { value: arePropsEqual });
@@ -22392,6 +22617,7 @@ export {
22392
22617
  queueRefAttach,
22393
22618
  queueRefDetach,
22394
22619
  readContextFromScope,
22620
+ registerWarmPlan,
22395
22621
  renderBlock,
22396
22622
  renderClientContextProvider,
22397
22623
  replaceRef,