@doenet/v06-to-v07 0.7.20-dev.316 → 0.7.20-dev.317

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.
@@ -40963,7 +40963,7 @@ async function cidFromArrayBuffer(data) {
40963
40963
  await crypto.subtle.digest("SHA-256", new Uint8Array());
40964
40964
  digest = (data2) => crypto.subtle.digest("SHA-256", data2);
40965
40965
  } catch (e22) {
40966
- const sha256 = (await import("./sha256-C0vj3HDn-CiX8mjgB-LkkwAqwy.js").then((n2) => n2.s)).default;
40966
+ const sha256 = (await import("./sha256-C0vj3HDn-B8ugC21B-Cq92odhc.js").then((n2) => n2.s)).default;
40967
40967
  digest = (data2) => sha256(data2, {
40968
40968
  asBytes: true
40969
40969
  });
@@ -50172,6 +50172,142 @@ async function createReferenceShadowStateVariableDefinitions({
50172
50172
  targetComponent
50173
50173
  });
50174
50174
  }
50175
+ function shadowReturnDependencies(args) {
50176
+ let dependencies2 = Object.assign(
50177
+ {},
50178
+ this.shadowOriginalReturnDependencies?.(args)
50179
+ );
50180
+ dependencies2.targetVariable = {
50181
+ dependencyType: "stateVariable",
50182
+ componentIdx: this.shadowOfComponentIdx,
50183
+ variableName: this.shadowVarNameInTarget
50184
+ };
50185
+ if (this.shadowCopyComponentType) {
50186
+ dependencies2.targetVariableComponentType = {
50187
+ dependencyType: "stateVariableComponentType",
50188
+ componentIdx: this.shadowOfComponentIdx,
50189
+ variableName: this.shadowVarNameInTarget
50190
+ };
50191
+ }
50192
+ return dependencies2;
50193
+ }
50194
+ function shadowDefinition({ dependencyValues, usedDefault }) {
50195
+ const varName = this.shadowVarName;
50196
+ let result2 = {};
50197
+ if ("targetVariableComponentType" in dependencyValues) {
50198
+ result2.setCreateComponentOfType = {
50199
+ [varName]: dependencyValues.targetVariableComponentType
50200
+ };
50201
+ }
50202
+ if (usedDefault.targetVariable && "defaultValue" in this && this.hasEssential) {
50203
+ result2.useEssentialOrDefaultValue = {
50204
+ [varName]: {
50205
+ defaultValue: dependencyValues.targetVariable
50206
+ }
50207
+ };
50208
+ } else {
50209
+ result2.setValue = {
50210
+ [varName]: dependencyValues.targetVariable
50211
+ };
50212
+ }
50213
+ return result2;
50214
+ }
50215
+ function shadowInverseDefinition({ desiredStateVariableValues }) {
50216
+ return {
50217
+ success: true,
50218
+ instructions: [
50219
+ {
50220
+ setDependency: "targetVariable",
50221
+ desiredValue: desiredStateVariableValues[this.shadowVarName],
50222
+ shadowedVariable: true
50223
+ }
50224
+ ]
50225
+ };
50226
+ }
50227
+ function shadowReturnArrayDependenciesByKey({ arrayKeys }) {
50228
+ let dependenciesByKey = {};
50229
+ for (let key of arrayKeys) {
50230
+ dependenciesByKey[key] = {
50231
+ targetVariable: {
50232
+ dependencyType: "stateVariable",
50233
+ componentIdx: this.shadowOfComponentIdx,
50234
+ variableName: this.shadowOverrideVarName || this.arrayVarNameFromArrayKey(key)
50235
+ }
50236
+ };
50237
+ }
50238
+ let globalDependencies = {};
50239
+ if (this.shadowCopyComponentType) {
50240
+ globalDependencies.targetVariableComponentType = {
50241
+ dependencyType: "stateVariableComponentType",
50242
+ componentIdx: this.shadowOfComponentIdx,
50243
+ variableName: this.shadowVarName
50244
+ };
50245
+ }
50246
+ if (this.inverseShadowToSetEntireArray) {
50247
+ globalDependencies.targetArray = {
50248
+ dependencyType: "stateVariable",
50249
+ componentIdx: this.shadowOfComponentIdx,
50250
+ variableName: this.shadowVarName
50251
+ };
50252
+ }
50253
+ return { globalDependencies, dependenciesByKey };
50254
+ }
50255
+ function shadowArrayDefinitionByKey({ globalDependencyValues, dependencyValuesByKey, arrayKeys }) {
50256
+ const varName = this.shadowVarName;
50257
+ let newEntries = {};
50258
+ for (let arrayKey of arrayKeys) {
50259
+ if ("targetVariable" in dependencyValuesByKey[arrayKey]) {
50260
+ newEntries[arrayKey] = dependencyValuesByKey[arrayKey].targetVariable;
50261
+ } else {
50262
+ newEntries[arrayKey] = this.defaultValueByArrayKey?.(arrayKey);
50263
+ }
50264
+ }
50265
+ let result2 = {
50266
+ setValue: { [varName]: newEntries }
50267
+ };
50268
+ if ("targetVariableComponentType" in globalDependencyValues) {
50269
+ result2.setCreateComponentOfType = {
50270
+ [varName]: globalDependencyValues.targetVariableComponentType
50271
+ };
50272
+ }
50273
+ return result2;
50274
+ }
50275
+ function shadowInverseArrayDefinitionByKey({
50276
+ desiredStateVariableValues,
50277
+ dependencyValuesByKey,
50278
+ dependencyNamesByKey,
50279
+ arraySize: arraySize2,
50280
+ initialChange
50281
+ }) {
50282
+ const varName = this.shadowVarName;
50283
+ if (this.inverseShadowToSetEntireArray) {
50284
+ return {
50285
+ success: true,
50286
+ instructions: [
50287
+ {
50288
+ setDependency: "targetArray",
50289
+ desiredValue: desiredStateVariableValues[varName],
50290
+ treatAsInitialChange: initialChange
50291
+ }
50292
+ ]
50293
+ };
50294
+ }
50295
+ let instructions = [];
50296
+ for (let key in desiredStateVariableValues[varName]) {
50297
+ if (!dependencyValuesByKey[key]) {
50298
+ continue;
50299
+ }
50300
+ instructions.push({
50301
+ setDependency: dependencyNamesByKey[key].targetVariable,
50302
+ desiredValue: desiredStateVariableValues[varName][key],
50303
+ shadowedVariable: true
50304
+ });
50305
+ }
50306
+ return {
50307
+ success: true,
50308
+ instructions
50309
+ };
50310
+ }
50175
50311
  function modifyStateDefsToBeShadows({
50176
50312
  stateVariablesToShadow,
50177
50313
  stateVariableDefinitions,
@@ -50205,157 +50341,23 @@ function modifyStateDefsToBeShadows({
50205
50341
  delete stateDef.stateVariablesDeterminingDependencies;
50206
50342
  }
50207
50343
  let copyComponentType = stateDef.public && stateDef.shadowingInstructions.hasVariableComponentType;
50344
+ stateDef.shadowOfComponentIdx = targetComponent.componentIdx;
50345
+ stateDef.shadowVarName = varName;
50346
+ stateDef.shadowCopyComponentType = copyComponentType;
50208
50347
  if (stateDef.isArray) {
50209
- let overrideVarNameWith = differentStateVariablesInTarget[varInd];
50210
- stateDef.returnArrayDependenciesByKey = function({ arrayKeys }) {
50211
- let dependenciesByKey = {};
50212
- for (let key of arrayKeys) {
50213
- dependenciesByKey[key] = {
50214
- targetVariable: {
50215
- dependencyType: "stateVariable",
50216
- componentIdx: targetComponent.componentIdx,
50217
- variableName: overrideVarNameWith || this.arrayVarNameFromArrayKey(key)
50218
- }
50219
- };
50220
- }
50221
- let globalDependencies = {};
50222
- if (copyComponentType) {
50223
- globalDependencies.targetVariableComponentType = {
50224
- dependencyType: "stateVariableComponentType",
50225
- componentIdx: targetComponent.componentIdx,
50226
- variableName: varName
50227
- };
50228
- }
50229
- if (stateDef.inverseShadowToSetEntireArray) {
50230
- globalDependencies.targetArray = {
50231
- dependencyType: "stateVariable",
50232
- componentIdx: targetComponent.componentIdx,
50233
- variableName: varName
50234
- };
50235
- }
50236
- return { globalDependencies, dependenciesByKey };
50237
- };
50238
- stateDef.arrayDefinitionByKey = function({
50239
- globalDependencyValues,
50240
- dependencyValuesByKey,
50241
- arrayKeys
50242
- }) {
50243
- let newEntries = {};
50244
- for (let arrayKey of arrayKeys) {
50245
- if ("targetVariable" in dependencyValuesByKey[arrayKey]) {
50246
- newEntries[arrayKey] = dependencyValuesByKey[arrayKey].targetVariable;
50247
- } else {
50248
- newEntries[arrayKey] = stateDef.defaultValueByArrayKey?.(arrayKey);
50249
- }
50250
- }
50251
- let result2 = {
50252
- setValue: { [varName]: newEntries }
50253
- };
50254
- if ("targetVariableComponentType" in globalDependencyValues) {
50255
- result2.setCreateComponentOfType = {
50256
- [varName]: globalDependencyValues.targetVariableComponentType
50257
- };
50258
- }
50259
- return result2;
50260
- };
50261
- stateDef.inverseArrayDefinitionByKey = function({
50262
- desiredStateVariableValues,
50263
- dependencyValuesByKey,
50264
- dependencyNamesByKey,
50265
- arraySize: arraySize2,
50266
- initialChange
50267
- }) {
50268
- if (stateDef.inverseShadowToSetEntireArray) {
50269
- return {
50270
- success: true,
50271
- instructions: [
50272
- {
50273
- setDependency: "targetArray",
50274
- desiredValue: desiredStateVariableValues[varName],
50275
- treatAsInitialChange: initialChange
50276
- }
50277
- ]
50278
- };
50279
- }
50280
- let instructions = [];
50281
- for (let key in desiredStateVariableValues[varName]) {
50282
- if (!dependencyValuesByKey[key]) {
50283
- continue;
50284
- }
50285
- instructions.push({
50286
- setDependency: dependencyNamesByKey[key].targetVariable,
50287
- desiredValue: desiredStateVariableValues[varName][key],
50288
- shadowedVariable: true
50289
- });
50290
- }
50291
- return {
50292
- success: true,
50293
- instructions
50294
- };
50295
- };
50348
+ stateDef.shadowOverrideVarName = differentStateVariablesInTarget[varInd];
50349
+ stateDef.returnArrayDependenciesByKey = shadowReturnArrayDependenciesByKey;
50350
+ stateDef.arrayDefinitionByKey = shadowArrayDefinitionByKey;
50351
+ stateDef.inverseArrayDefinitionByKey = shadowInverseArrayDefinitionByKey;
50296
50352
  } else {
50297
- let returnStartingDependencies = () => ({});
50298
50353
  if (foundReadyToExpandWhenResolved) {
50299
- returnStartingDependencies = stateDef.returnDependencies.bind(stateDef);
50300
- }
50301
- let varNameInTarget = differentStateVariablesInTarget[varInd];
50302
- if (!varNameInTarget) {
50303
- varNameInTarget = varName;
50354
+ stateDef.shadowOriginalReturnDependencies = stateDef.returnDependencies.bind(stateDef);
50304
50355
  }
50305
- stateDef.returnDependencies = function(args) {
50306
- let dependencies2 = Object.assign(
50307
- {},
50308
- returnStartingDependencies(args)
50309
- );
50310
- dependencies2.targetVariable = {
50311
- dependencyType: "stateVariable",
50312
- componentIdx: targetComponent.componentIdx,
50313
- variableName: varNameInTarget
50314
- };
50315
- if (copyComponentType) {
50316
- dependencies2.targetVariableComponentType = {
50317
- dependencyType: "stateVariableComponentType",
50318
- componentIdx: targetComponent.componentIdx,
50319
- variableName: varNameInTarget
50320
- };
50321
- }
50322
- return dependencies2;
50323
- };
50324
- stateDef.definition = function({ dependencyValues, usedDefault }) {
50325
- let result2 = {};
50326
- if ("targetVariableComponentType" in dependencyValues) {
50327
- result2.setCreateComponentOfType = {
50328
- [varName]: dependencyValues.targetVariableComponentType
50329
- };
50330
- }
50331
- if (usedDefault.targetVariable && "defaultValue" in stateDef && stateDef.hasEssential) {
50332
- result2.useEssentialOrDefaultValue = {
50333
- [varName]: {
50334
- defaultValue: dependencyValues.targetVariable
50335
- }
50336
- };
50337
- } else {
50338
- result2.setValue = {
50339
- [varName]: dependencyValues.targetVariable
50340
- };
50341
- }
50342
- return result2;
50343
- };
50356
+ stateDef.shadowVarNameInTarget = differentStateVariablesInTarget[varInd] || varName;
50357
+ stateDef.returnDependencies = shadowReturnDependencies;
50358
+ stateDef.definition = shadowDefinition;
50344
50359
  stateDef.excludeDependencyValuesInInverseDefinition = true;
50345
- stateDef.inverseDefinition = function({
50346
- desiredStateVariableValues
50347
- }) {
50348
- return {
50349
- success: true,
50350
- instructions: [
50351
- {
50352
- setDependency: "targetVariable",
50353
- desiredValue: desiredStateVariableValues[varName],
50354
- shadowedVariable: true
50355
- }
50356
- ]
50357
- };
50358
- };
50360
+ stateDef.inverseDefinition = shadowInverseDefinition;
50359
50361
  }
50360
50362
  }
50361
50363
  for (let varName in deleteStateVariablesFromDefinition) {
@@ -53120,6 +53122,12 @@ const _Dependency = class _Dependency2 {
53120
53122
  let downComponents = await this.determineDownstreamComponents();
53121
53123
  let downstreamComponentIndices = downComponents.downstreamComponentIndices;
53122
53124
  let downstreamComponentTypes = downComponents.downstreamComponentTypes;
53125
+ this.upstreamVariableNames = this.dependencyHandler.internVariableNameListByCopy(
53126
+ this.upstreamVariableNames
53127
+ );
53128
+ this.originalDownstreamVariableNames = this.dependencyHandler.internVariableNameListByCopy(
53129
+ this.originalDownstreamVariableNames
53130
+ );
53123
53131
  this.componentIdentitiesChanged = true;
53124
53132
  let upCompDownDeps = this.dependencyHandler.downstreamDependencies[this.upstreamComponentIdx];
53125
53133
  if (!upCompDownDeps) {
@@ -53150,6 +53158,112 @@ const _Dependency = class _Dependency2 {
53150
53158
  index: index2
53151
53159
  });
53152
53160
  }
53161
+ this.downstreamComponentIndices = this.dependencyHandler.internComponentIndexList(
53162
+ this.downstreamComponentIndices
53163
+ );
53164
+ this.downstreamComponentTypes = this.dependencyHandler.internComponentTypeList(
53165
+ this.downstreamComponentTypes
53166
+ );
53167
+ if (this.mappedDownstreamVariableNamesByComponent) {
53168
+ this.mappedDownstreamVariableNamesByComponent = this.dependencyHandler.internNameListArray(
53169
+ this.mappedDownstreamVariableNamesByComponent
53170
+ );
53171
+ }
53172
+ if (this.valuesChanged) {
53173
+ this.valuesChanged = this.dependencyHandler.internValuesChangedArray(
53174
+ this.valuesChanged
53175
+ );
53176
+ }
53177
+ }
53178
+ /**
53179
+ * Replace the interned (frozen, shared) parallel downstream arrays with
53180
+ * mutable copies before changing the downstream set.
53181
+ */
53182
+ thawDownstreamArrays() {
53183
+ if (Object.isFrozen(this.downstreamComponentIndices)) {
53184
+ this.downstreamComponentIndices = [
53185
+ ...this.downstreamComponentIndices
53186
+ ];
53187
+ }
53188
+ if (Object.isFrozen(this.downstreamComponentTypes)) {
53189
+ this.downstreamComponentTypes = [...this.downstreamComponentTypes];
53190
+ }
53191
+ if (this.mappedDownstreamVariableNamesByComponent && Object.isFrozen(this.mappedDownstreamVariableNamesByComponent)) {
53192
+ this.mappedDownstreamVariableNamesByComponent = [
53193
+ ...this.mappedDownstreamVariableNamesByComponent
53194
+ ];
53195
+ }
53196
+ if (this.valuesChanged && Object.isFrozen(this.valuesChanged)) {
53197
+ this.valuesChanged = [...this.valuesChanged];
53198
+ }
53199
+ }
53200
+ /**
53201
+ * Replace the interned (frozen, shared) `valuesChanged` outer array
53202
+ * and/or the record at `componentInd` with mutable copies so a caller
53203
+ * can record change metadata on them.
53204
+ */
53205
+ thawValuesChangedRecord(componentInd) {
53206
+ if (!this.valuesChanged) {
53207
+ return;
53208
+ }
53209
+ if (Object.isFrozen(this.valuesChanged)) {
53210
+ this.valuesChanged = [...this.valuesChanged];
53211
+ }
53212
+ const record = this.valuesChanged[componentInd];
53213
+ if (record && Object.isFrozen(record)) {
53214
+ this.valuesChanged[componentInd] = { ...record };
53215
+ }
53216
+ }
53217
+ /**
53218
+ * Remove the change record for `varName` of the downstream component at
53219
+ * `componentInd` after `getValue` consumed it (records are recreated on
53220
+ * demand when marked changed again). Fully-consumed records converge to
53221
+ * the shared frozen empty record, and outer arrays of shared records are
53222
+ * re-interned, so an unchanging dependency retains no per-dependency
53223
+ * change-tracking allocations at all.
53224
+ */
53225
+ consumeChangeRecord(componentInd, varName) {
53226
+ const outer = this.valuesChanged;
53227
+ if (!outer) {
53228
+ return;
53229
+ }
53230
+ const record = outer[componentInd];
53231
+ if (!record) {
53232
+ return;
53233
+ }
53234
+ let replacement = record;
53235
+ if (Object.isFrozen(record)) {
53236
+ if (!(varName in record)) {
53237
+ return;
53238
+ }
53239
+ const remaining = Object.keys(record).filter(
53240
+ (name2) => name2 !== varName
53241
+ );
53242
+ if (remaining.length === 0) {
53243
+ replacement = this.dependencyHandler.emptyValuesChangedRecord;
53244
+ } else {
53245
+ replacement = {};
53246
+ for (const name2 of remaining) {
53247
+ replacement[name2] = record[name2];
53248
+ }
53249
+ }
53250
+ } else {
53251
+ delete record[varName];
53252
+ if (Object.keys(record).length === 0) {
53253
+ replacement = this.dependencyHandler.emptyValuesChangedRecord;
53254
+ }
53255
+ }
53256
+ if (replacement !== record) {
53257
+ if (Object.isFrozen(this.valuesChanged)) {
53258
+ this.valuesChanged = [...this.valuesChanged];
53259
+ }
53260
+ this.valuesChanged[componentInd] = replacement;
53261
+ }
53262
+ if (!Object.isFrozen(this.valuesChanged)) {
53263
+ this.valuesChanged = this.dependencyHandler.internValuesChangedArray(
53264
+ this.valuesChanged
53265
+ );
53266
+ }
53153
53267
  }
53154
53268
  async addDownstreamComponent({
53155
53269
  downstreamComponentIdx,
@@ -53157,6 +53271,7 @@ const _Dependency = class _Dependency2 {
53157
53271
  index: index2
53158
53272
  }) {
53159
53273
  this.componentIdentitiesChanged = true;
53274
+ this.thawDownstreamArrays();
53160
53275
  this.downstreamComponentIndices.splice(
53161
53276
  index2,
53162
53277
  0,
@@ -53239,11 +53354,14 @@ const _Dependency = class _Dependency2 {
53239
53354
  0,
53240
53355
  mappedVarNames
53241
53356
  );
53242
- let valsChanged = {};
53243
- for (let downVar of mappedVarNames) {
53244
- valsChanged[downVar] = INITIAL_CHANGE_RECORD;
53245
- }
53246
- this.valuesChanged.splice(index2, 0, valsChanged);
53357
+ this.valuesChanged.splice(
53358
+ index2,
53359
+ 0,
53360
+ this.dependencyHandler.internInitialValuesChangedRecord(
53361
+ mappedVarNames,
53362
+ INITIAL_CHANGE_RECORD
53363
+ )
53364
+ );
53247
53365
  if (this.variablesOptional) {
53248
53366
  downVarNames = downVarNames.filter(
53249
53367
  (downVar) => downVar in downComponent.state || this.dependencyHandler.core.checkIfArrayEntry({
@@ -53292,10 +53410,12 @@ const _Dependency = class _Dependency2 {
53292
53410
  downCompUpDeps = this.dependencyHandler.upstreamDependencies[downstreamComponentIdx] = {};
53293
53411
  }
53294
53412
  for (let varName of downVarNames) {
53295
- if (downCompUpDeps[varName] === void 0) {
53296
- downCompUpDeps[varName] = [];
53413
+ const existingUpDeps = downCompUpDeps[varName];
53414
+ if (existingUpDeps === void 0) {
53415
+ downCompUpDeps[varName] = [this];
53416
+ } else {
53417
+ downCompUpDeps[varName] = existingUpDeps.concat(this);
53297
53418
  }
53298
- downCompUpDeps[varName].push(this);
53299
53419
  if (varName !== this.downstreamVariableNameIfNoVariables) {
53300
53420
  for (let upstreamVarName of this.upstreamVariableNames) {
53301
53421
  this.dependencyHandler.resetCircularCheckPassed(
@@ -53324,6 +53444,7 @@ const _Dependency = class _Dependency2 {
53324
53444
  if (recordChange) {
53325
53445
  this.componentIdentitiesChanged = true;
53326
53446
  }
53447
+ this.thawDownstreamArrays();
53327
53448
  let componentIdx = this.downstreamComponentIndices[indexToRemove];
53328
53449
  this.downstreamComponentIndices.splice(indexToRemove, 1);
53329
53450
  this.downstreamComponentTypes.splice(indexToRemove, 1);
@@ -53355,7 +53476,7 @@ const _Dependency = class _Dependency2 {
53355
53476
  if (downCompUpDeps.length === 1) {
53356
53477
  delete this.dependencyHandler.upstreamDependencies[componentIdx][vName];
53357
53478
  } else {
53358
- downCompUpDeps.splice(ind, 1);
53479
+ this.dependencyHandler.upstreamDependencies[componentIdx][vName] = downCompUpDeps.slice(0, ind).concat(downCompUpDeps.slice(ind + 1));
53359
53480
  }
53360
53481
  }
53361
53482
  }
@@ -53384,6 +53505,7 @@ const _Dependency = class _Dependency2 {
53384
53505
  }
53385
53506
  async swapDownstreamComponents(index1, index2) {
53386
53507
  this.componentIdentitiesChanged = true;
53508
+ this.thawDownstreamArrays();
53387
53509
  [
53388
53510
  this.downstreamComponentIndices[index1],
53389
53511
  this.downstreamComponentIndices[index2]
@@ -53465,7 +53587,7 @@ const _Dependency = class _Dependency2 {
53465
53587
  if (downCompUpDeps.length === 1) {
53466
53588
  delete this.dependencyHandler.upstreamDependencies[downCompIdx][vName];
53467
53589
  } else {
53468
- downCompUpDeps.splice(ind, 1);
53590
+ this.dependencyHandler.upstreamDependencies[downCompIdx][vName] = downCompUpDeps.slice(0, ind).concat(downCompUpDeps.slice(ind + 1));
53469
53591
  }
53470
53592
  }
53471
53593
  }
@@ -53578,7 +53700,10 @@ const _Dependency = class _Dependency2 {
53578
53700
  });
53579
53701
  }
53580
53702
  if (consumeChanges) {
53581
- delete this.valuesChanged[componentInd][mappedVarName];
53703
+ this.consumeChangeRecord(
53704
+ componentInd,
53705
+ mappedVarName
53706
+ );
53582
53707
  }
53583
53708
  if (mappedStateVarObj.usedDefault) {
53584
53709
  usedDefaultObj[nameForOutput] = true;
@@ -54160,7 +54285,7 @@ const _StateVariableComponentTypeDependency = class _StateVariableComponentTypeD
54160
54285
  });
54161
54286
  }
54162
54287
  if (consumeChanges) {
54163
- delete this.valuesChanged[0][mappedVarName];
54288
+ this.consumeChangeRecord(0, mappedVarName);
54164
54289
  }
54165
54290
  let hasVariableComponentType = stateVarObj.shadowingInstructions?.hasVariableComponentType;
54166
54291
  if (!hasVariableComponentType && stateVarObj.isArrayEntry) {
@@ -57233,6 +57358,11 @@ const _ShadowSourceDependency = class _ShadowSourceDependency2 extends Dependenc
57233
57358
  if (!this.originalDownstreamVariableNames.includes(
57234
57359
  component.shadows.propVariable
57235
57360
  )) {
57361
+ if (Object.isFrozen(this.originalDownstreamVariableNames)) {
57362
+ this.originalDownstreamVariableNames = [
57363
+ ...this.originalDownstreamVariableNames
57364
+ ];
57365
+ }
57236
57366
  this.originalDownstreamVariableNames.push(
57237
57367
  component.shadows.propVariable
57238
57368
  );
@@ -58585,6 +58715,60 @@ class DependencyHandler {
58585
58715
  };
58586
58716
  this.attributeRefResolutionDependenciesByReferenced = {};
58587
58717
  this._internedVariableNameLists = /* @__PURE__ */ new Map();
58718
+ this._internedComponentIndexLists = /* @__PURE__ */ new Map();
58719
+ this._internedComponentTypeLists = /* @__PURE__ */ new Map();
58720
+ this._internedNameListArrays = /* @__PURE__ */ new Map();
58721
+ this._internedListIds = /* @__PURE__ */ new WeakMap();
58722
+ this._nextInternedListId = 1;
58723
+ this._internedValuesChangedRecords = /* @__PURE__ */ new Map();
58724
+ this._internedValuesChangedArrays = /* @__PURE__ */ new Map();
58725
+ this.emptyValuesChangedRecord = Object.freeze({});
58726
+ this._internedListIds.set(
58727
+ this.emptyValuesChangedRecord,
58728
+ this._nextInternedListId
58729
+ );
58730
+ this._nextInternedListId++;
58731
+ }
58732
+ internComponentIndexList(indices) {
58733
+ const key = indices.join(",");
58734
+ let interned = this._internedComponentIndexLists.get(key);
58735
+ if (!interned) {
58736
+ interned = Object.freeze(indices);
58737
+ this._internedComponentIndexLists.set(key, interned);
58738
+ }
58739
+ return interned;
58740
+ }
58741
+ internComponentTypeList(types) {
58742
+ const key = types.join("\n");
58743
+ let interned = this._internedComponentTypeLists.get(key);
58744
+ if (!interned) {
58745
+ interned = Object.freeze(types);
58746
+ this._internedComponentTypeLists.set(key, interned);
58747
+ }
58748
+ return interned;
58749
+ }
58750
+ /**
58751
+ * Intern an array whose elements are already-interned name lists
58752
+ * (from `internVariableNameList`), keyed by the identity of those
58753
+ * elements. Elements that are not interned lists (no assigned id) make
58754
+ * the array non-internable; it is returned unchanged.
58755
+ */
58756
+ internNameListArray(outer) {
58757
+ const ids = [];
58758
+ for (const inner of outer) {
58759
+ const id2 = typeof inner === "object" && inner !== null ? this._internedListIds.get(inner) : void 0;
58760
+ if (id2 === void 0) {
58761
+ return outer;
58762
+ }
58763
+ ids.push(id2);
58764
+ }
58765
+ const key = ids.join(",");
58766
+ let interned = this._internedNameListArrays.get(key);
58767
+ if (!interned) {
58768
+ interned = Object.freeze(outer);
58769
+ this._internedNameListArrays.set(key, interned);
58770
+ }
58771
+ return interned;
58588
58772
  }
58589
58773
  internVariableNameList(names) {
58590
58774
  const key = names.join("\n");
@@ -58592,6 +58776,76 @@ class DependencyHandler {
58592
58776
  if (!interned) {
58593
58777
  interned = Object.freeze(names);
58594
58778
  this._internedVariableNameLists.set(key, interned);
58779
+ this._internedListIds.set(interned, this._nextInternedListId);
58780
+ this._nextInternedListId++;
58781
+ }
58782
+ return interned;
58783
+ }
58784
+ /**
58785
+ * Like `internVariableNameList`, but never freezes the caller's array:
58786
+ * on a cache miss the interned entry is a frozen copy. For dependency
58787
+ * fields that alias arrays owned elsewhere (state-variable definitions,
58788
+ * constructor arguments), which must stay mutable for their owners.
58789
+ */
58790
+ internVariableNameListByCopy(names) {
58791
+ const key = names.join("\n");
58792
+ const interned = this._internedVariableNameLists.get(key);
58793
+ if (interned) {
58794
+ return interned;
58795
+ }
58796
+ return this.internVariableNameList([...names]);
58797
+ }
58798
+ /**
58799
+ * Return the shared frozen initial `valuesChanged` record (every
58800
+ * variable mapped to the shared initial change record) for the given
58801
+ * interned variable-name list. Falls back to a fresh mutable record if
58802
+ * `names` was not interned. Writers must thaw/replace before mutating;
58803
+ * see `Dependency.thawValuesChangedRecord` and
58804
+ * `Dependency.consumeChangeRecord`.
58805
+ */
58806
+ internInitialValuesChangedRecord(names, initialChangeRecord) {
58807
+ const listId = this._internedListIds.get(names);
58808
+ if (listId === void 0) {
58809
+ const record2 = {};
58810
+ for (const name2 of names) {
58811
+ record2[name2] = initialChangeRecord;
58812
+ }
58813
+ return record2;
58814
+ }
58815
+ let record = this._internedValuesChangedRecords.get(listId);
58816
+ if (!record) {
58817
+ record = {};
58818
+ for (const name2 of names) {
58819
+ record[name2] = initialChangeRecord;
58820
+ }
58821
+ Object.freeze(record);
58822
+ this._internedValuesChangedRecords.set(listId, record);
58823
+ this._internedListIds.set(record, this._nextInternedListId);
58824
+ this._nextInternedListId++;
58825
+ }
58826
+ return record;
58827
+ }
58828
+ /**
58829
+ * Intern a `valuesChanged` outer array whose entries are all interned
58830
+ * records (from `internInitialValuesChangedRecord` or
58831
+ * `emptyValuesChangedRecord`), keyed by the identity of those entries.
58832
+ * Any non-interned (hence mutable) entry makes the array non-internable;
58833
+ * it is returned unchanged.
58834
+ */
58835
+ internValuesChangedArray(outer) {
58836
+ const ids = [];
58837
+ for (const record of outer) {
58838
+ const id2 = typeof record === "object" && record !== null ? this._internedListIds.get(record) : void 0;
58839
+ if (id2 === void 0) {
58840
+ return outer;
58841
+ }
58842
+ ids.push(id2);
58843
+ }
58844
+ const key = ids.join(",");
58845
+ let interned = this._internedValuesChangedArrays.get(key);
58846
+ if (!interned) {
58847
+ interned = Object.freeze(outer);
58848
+ this._internedValuesChangedArrays.set(key, interned);
58595
58849
  }
58596
58850
  return interned;
58597
58851
  }
@@ -59007,6 +59261,19 @@ class DependencyHandler {
59007
59261
  }
59008
59262
  }
59009
59263
  }
59264
+ /**
59265
+ * Drop the circular-check memo records. They are pure caches ("this
59266
+ * state variable already passed the check"), so clearing costs only
59267
+ * re-verification when a later dependency change re-triggers a check.
59268
+ * Called once initial document construction finishes: at that point the
59269
+ * memos cover every state variable created during the load (one record
59270
+ * entry per state variable), but they regrow only for the typically few
59271
+ * components involved in subsequent updates.
59272
+ */
59273
+ clearCircularCheckMemos() {
59274
+ this.circularCheckPassed = {};
59275
+ this.circularResolveBlockedCheckPassed = {};
59276
+ }
59010
59277
  resetCircularCheckPassed(componentIdx, varName) {
59011
59278
  let stateVariableIdentifier = componentIdx + ":" + varName;
59012
59279
  if (this.circularCheckPassed[stateVariableIdentifier]) {
@@ -59307,6 +59574,7 @@ class DependencyHandler {
59307
59574
  for (let upDep of upstream) {
59308
59575
  if (upDep.valuesChanged) {
59309
59576
  let ind = upDep.downstreamComponentIndices.indexOf(componentIdx);
59577
+ upDep.thawValuesChangedRecord(ind);
59310
59578
  let upValuesChanged = upDep.valuesChanged[ind][varName];
59311
59579
  if (!upValuesChanged) {
59312
59580
  upValuesChanged = upDep.valuesChanged[ind][varName] = {};
@@ -59851,12 +60119,12 @@ class DependencyHandler {
59851
60119
  });
59852
60120
  let neededToResolveBlocked = neededForBlocked[blockerType];
59853
60121
  if (!neededToResolveBlocked) {
59854
- neededToResolveBlocked = neededForBlocked[blockerType] = [];
59855
- }
59856
- if (neededToResolveBlocked.includes(blockerCode)) {
60122
+ neededForBlocked[blockerType] = [blockerCode];
60123
+ } else if (neededToResolveBlocked.includes(blockerCode)) {
59857
60124
  return;
60125
+ } else {
60126
+ neededToResolveBlocked.push(blockerCode);
59858
60127
  }
59859
- neededToResolveBlocked.push(blockerCode);
59860
60128
  if (typeBlocked === "stateVariable") {
59861
60129
  let component = this._components[componentIdxBlocked];
59862
60130
  if (component) {
@@ -59897,9 +60165,8 @@ class DependencyHandler {
59897
60165
  });
59898
60166
  let blockedByBlocker = resolvedBlockedByBlocker[typeBlocked];
59899
60167
  if (!blockedByBlocker) {
59900
- blockedByBlocker = resolvedBlockedByBlocker[typeBlocked] = [];
59901
- }
59902
- if (!blockedByBlocker.includes(codeBlocked)) {
60168
+ resolvedBlockedByBlocker[typeBlocked] = [codeBlocked];
60169
+ } else if (!blockedByBlocker.includes(codeBlocked)) {
59903
60170
  blockedByBlocker.push(codeBlocked);
59904
60171
  }
59905
60172
  this.resetCircularResolveBlockerCheckPassed({
@@ -63920,6 +64187,7 @@ class StalenessPropagator {
63920
64187
  if (!upDep.valuesChanged) {
63921
64188
  upDep.valuesChanged = [];
63922
64189
  }
64190
+ upDep.thawValuesChangedRecord(componentInd);
63923
64191
  if (!upDep.valuesChanged[componentInd]) {
63924
64192
  upDep.valuesChanged[componentInd] = {};
63925
64193
  }
@@ -67501,6 +67769,7 @@ class Core {
67501
67769
  reportTimerError(TimerLabels.generateDastSaveState)
67502
67770
  );
67503
67771
  }
67772
+ this.dependencies.clearCircularCheckMemos();
67504
67773
  const returnResult = {
67505
67774
  coreInfo: this.coreInfo
67506
67775
  };
@@ -228907,4 +229176,4 @@ export {
228907
229176
  getDefaultExportFromCjs as g,
228908
229177
  updateSyntaxFromV06toV07 as u
228909
229178
  };
228910
- //# sourceMappingURL=index-CgX2sNWV.js.map
229179
+ //# sourceMappingURL=index-DiShf3LI.js.map