@doenet/v06-to-v07 0.7.3 → 0.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.js +684 -145
  2. package/index.js.map +1 -1
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -44293,12 +44293,14 @@ class DependencyHandler {
44293
44293
  parentDependenciesByParent: {},
44294
44294
  dependenciesMissingComponentBySpecifiedName: {},
44295
44295
  dependenciesBasedOnDependenciesOfStateVariables: {},
44296
- primaryShadowDependencies: {}
44296
+ primaryShadowDependencies: {},
44297
+ componentsReferencingAttributeByReferenced: {}
44297
44298
  };
44298
44299
  this.resolveBlockers = {
44299
44300
  neededToResolve: {},
44300
44301
  resolveBlockedBy: {}
44301
44302
  };
44303
+ this.attributeRefResolutionDependenciesByReferenced = {};
44302
44304
  }
44303
44305
  async setUpComponentDependencies(component) {
44304
44306
  if (this.downstreamDependencies[component.componentIdx]) {
@@ -49350,6 +49352,8 @@ class RefResolutionDependency extends Dependency {
49350
49352
  if (!refComponent) {
49351
49353
  this.addUpdateTriggerForMissingComponent(nodeIdx);
49352
49354
  this.missingComponentBlockers.push(nodeIdx);
49355
+ this.extendIdx = -1;
49356
+ this.unresolvedPath = this.originalPath;
49353
49357
  return {
49354
49358
  success: true,
49355
49359
  downstreamComponentIndices: [],
@@ -49591,7 +49595,7 @@ class RefResolutionDependency extends Dependency {
49591
49595
  async getValue() {
49592
49596
  const result2 = await super.getValue();
49593
49597
  result2.value = {
49594
- extendIdx: this.extendIdx,
49598
+ extendIdx: this.extendIdx ?? -1,
49595
49599
  unresolvedPath: this.unresolvedPath,
49596
49600
  originalPath: this.originalPath
49597
49601
  };
@@ -49623,6 +49627,7 @@ class AttributeRefResolutions extends Dependency {
49623
49627
  "originalPath"
49624
49628
  ];
49625
49629
  this.missingComponentBlockers = [];
49630
+ this.extendIndicesResolved = [];
49626
49631
  }
49627
49632
  async determineDownstreamComponents() {
49628
49633
  let parent = this.dependencyHandler._components[this.parentIdx];
@@ -49658,11 +49663,50 @@ class AttributeRefResolutions extends Dependency {
49658
49663
  }
49659
49664
  async getValue() {
49660
49665
  const result2 = await super.getValue();
49661
- result2.value = result2.value.map((comp) => ({
49662
- componentIdx: comp.stateValues.extendIdx,
49663
- unresolvedPath: comp.stateValues.unresolvedPath,
49664
- originalPath: comp.stateValues.originalPath
49665
- }));
49666
+ const newValue = [];
49667
+ for (const comp of result2.value) {
49668
+ const extendIdx = comp.stateValues.extendIdx;
49669
+ newValue.push({
49670
+ componentIdx: extendIdx,
49671
+ unresolvedPath: comp.stateValues.unresolvedPath,
49672
+ originalPath: comp.stateValues.originalPath
49673
+ });
49674
+ if (extendIdx !== -1) {
49675
+ if (!this.extendIndicesResolved.includes(extendIdx)) {
49676
+ this.extendIndicesResolved.push(extendIdx);
49677
+ let attributeRefResolutionDeps = this.dependencyHandler.attributeRefResolutionDependenciesByReferenced[extendIdx];
49678
+ if (!attributeRefResolutionDeps) {
49679
+ attributeRefResolutionDeps = this.dependencyHandler.attributeRefResolutionDependenciesByReferenced[extendIdx] = [];
49680
+ }
49681
+ attributeRefResolutionDeps.push({
49682
+ dependency: this,
49683
+ composite: comp
49684
+ });
49685
+ }
49686
+ if (this.dependencyHandler.updateTriggers.componentsReferencingAttributeByReferenced[extendIdx]) {
49687
+ for (let dep of this.dependencyHandler.updateTriggers.componentsReferencingAttributeByReferenced[extendIdx]) {
49688
+ for (let varName of dep.upstreamVariableNames) {
49689
+ await this.dependencyHandler.addBlocker({
49690
+ blockerComponentIdx: dep.upstreamComponentIdx,
49691
+ blockerType: "recalculateDownstreamComponents",
49692
+ blockerStateVariable: varName,
49693
+ blockerDependency: dep.dependencyName,
49694
+ componentIdxBlocked: dep.upstreamComponentIdx,
49695
+ typeBlocked: "stateVariable",
49696
+ stateVariableBlocked: varName
49697
+ });
49698
+ }
49699
+ await this.dependencyHandler.addBlockersFromChangedStateVariableDependencies(
49700
+ {
49701
+ componentIdx: dep.upstreamComponentIdx,
49702
+ stateVariables: dep.upstreamVariableNames
49703
+ }
49704
+ );
49705
+ }
49706
+ }
49707
+ }
49708
+ }
49709
+ result2.value = newValue;
49666
49710
  result2.usedDefault = !this.foundAttribute;
49667
49711
  return result2;
49668
49712
  }
@@ -49670,9 +49714,89 @@ class AttributeRefResolutions extends Dependency {
49670
49714
  for (const componentIdx of this.missingComponentBlockers) {
49671
49715
  this.deleteUpdateTriggerForMissingComponent(componentIdx);
49672
49716
  }
49717
+ for (const extendIdx of this.extendIndicesResolved) {
49718
+ let attributeRefResolutionDeps = this.dependencyHandler.attributeRefResolutionDependenciesByReferenced[extendIdx];
49719
+ if (attributeRefResolutionDeps) {
49720
+ let ind = attributeRefResolutionDeps.findIndex(
49721
+ (entry) => entry.dependency === this
49722
+ );
49723
+ if (ind !== -1) {
49724
+ attributeRefResolutionDeps.splice(ind, 1);
49725
+ }
49726
+ }
49727
+ }
49673
49728
  }
49674
49729
  }
49675
49730
  dependencyTypeArray.push(AttributeRefResolutions);
49731
+ class ComponentsReferencingAttributeDependency extends Dependency {
49732
+ static dependencyType = "componentsReferencingAttribute";
49733
+ setUpParameters() {
49734
+ if (this.definition.referencedIdx != void 0) {
49735
+ this.referencedIdx = this.definition.referencedIdx;
49736
+ this.specifiedComponentName = this.referencedIdx;
49737
+ } else {
49738
+ this.referencedIdx = this.upstreamComponentIdx;
49739
+ }
49740
+ this.attributeName = this.definition.attributeName;
49741
+ this.allowUnresolvedPath = this.definition.allowUnresolvedPath || false;
49742
+ this.missingComponentBlockers = [];
49743
+ }
49744
+ async determineDownstreamComponents() {
49745
+ let referencedComponent = this.dependencyHandler._components[this.referencedIdx];
49746
+ if (!referencedComponent) {
49747
+ this.addBlockerUpdateTriggerForMissingComponent(this.referencedIdx);
49748
+ this.missingComponentBlockers.push(this.referencedIdx);
49749
+ return {
49750
+ success: false,
49751
+ downstreamComponentIndices: [],
49752
+ downstreamComponentTypes: []
49753
+ };
49754
+ }
49755
+ if (!this.dependencyHandler.updateTriggers.componentsReferencingAttributeByReferenced[this.referencedIdx]) {
49756
+ this.dependencyHandler.updateTriggers.componentsReferencingAttributeByReferenced[this.referencedIdx] = [];
49757
+ }
49758
+ this.dependencyHandler.updateTriggers.componentsReferencingAttributeByReferenced[this.referencedIdx].push(this);
49759
+ let attributeRefResolutionDeps = this.dependencyHandler.attributeRefResolutionDependenciesByReferenced[this.referencedIdx];
49760
+ if (attributeRefResolutionDeps) {
49761
+ if (!this.allowUnresolvedPath) {
49762
+ attributeRefResolutionDeps = attributeRefResolutionDeps.filter(
49763
+ (entry) => entry.composite.stateValues.unresolvedPath === null
49764
+ );
49765
+ }
49766
+ if (this.attributeName) {
49767
+ attributeRefResolutionDeps = attributeRefResolutionDeps.filter(
49768
+ (entry) => entry.dependency.attributeName === this.attributeName
49769
+ );
49770
+ }
49771
+ const downstreamComponentIndices = [];
49772
+ const downstreamComponentTypes = [];
49773
+ for (const entry of attributeRefResolutionDeps) {
49774
+ const parentIdx = entry.dependency.parentIdx;
49775
+ const parent = this.dependencyHandler._components[parentIdx];
49776
+ if (parent) {
49777
+ downstreamComponentIndices.push(parentIdx);
49778
+ downstreamComponentTypes.push(parent.componentType);
49779
+ }
49780
+ }
49781
+ return {
49782
+ success: true,
49783
+ downstreamComponentIndices,
49784
+ downstreamComponentTypes
49785
+ };
49786
+ }
49787
+ return {
49788
+ success: false,
49789
+ downstreamComponentIndices: [],
49790
+ downstreamComponentTypes: []
49791
+ };
49792
+ }
49793
+ deleteFromUpdateTriggers() {
49794
+ for (const componentIdx of this.missingComponentBlockers) {
49795
+ this.deleteUpdateTriggerForMissingComponent(componentIdx);
49796
+ }
49797
+ }
49798
+ }
49799
+ dependencyTypeArray.push(ComponentsReferencingAttributeDependency);
49676
49800
  class StringsFromReferenceAttribute extends Dependency {
49677
49801
  static dependencyType = "stringsFromReferenceAttribute";
49678
49802
  setUpParameters() {
@@ -52477,7 +52601,7 @@ class Core {
52477
52601
  this.visibilityInfo.saveDelay
52478
52602
  );
52479
52603
  }
52480
- async callUpdateRenderers(args, init = false) {
52604
+ callUpdateRenderers(args, init = false) {
52481
52605
  let errorWarnings = void 0;
52482
52606
  if (this.newErrorWarning) {
52483
52607
  errorWarnings = this.getErrorWarnings().errorWarnings;
@@ -52587,16 +52711,6 @@ class Core {
52587
52711
  let results = await this.initializeRenderedComponentInstruction(
52588
52712
  this.document
52589
52713
  );
52590
- if (this.updateInfo.compositesToUpdateReplacements.size > 0) {
52591
- await this.replacementChangesFromCompositesToUpdate();
52592
- let componentNamesToUpdate = [
52593
- ...this.updateInfo.componentsToUpdateRenderers
52594
- ];
52595
- this.updateInfo.componentsToUpdateRenderers.clear();
52596
- await this.updateRendererInstructions({
52597
- componentNamesToUpdate
52598
- });
52599
- }
52600
52714
  this.documentRendererInstructions = results.componentToRender;
52601
52715
  let updateInstructions = [
52602
52716
  {
@@ -52614,6 +52728,16 @@ class Core {
52614
52728
  ];
52615
52729
  this.callUpdateRenderers({ updateInstructions: updateInstructions2 });
52616
52730
  }
52731
+ if (this.updateInfo.compositesToUpdateReplacements.size > 0) {
52732
+ await this.replacementChangesFromCompositesToUpdate();
52733
+ let componentNamesToUpdate = [
52734
+ ...this.updateInfo.componentsToUpdateRenderers
52735
+ ];
52736
+ this.updateInfo.componentsToUpdateRenderers.clear();
52737
+ await this.updateRendererInstructions({
52738
+ componentNamesToUpdate
52739
+ });
52740
+ }
52617
52741
  await this.processStateVariableTriggers(true);
52618
52742
  } else {
52619
52743
  if (parent === void 0) {
@@ -62375,6 +62499,12 @@ class BaseComponent {
62375
62499
  defaultValue: false,
62376
62500
  public: true
62377
62501
  },
62502
+ isPotentialResponse: {
62503
+ createPrimitiveOfType: "boolean",
62504
+ createStateVariable: "isPotentialResponse",
62505
+ defaultValue: false,
62506
+ excludeFromSchema: true
62507
+ },
62378
62508
  permid: {
62379
62509
  createPrimitiveOfType: "string",
62380
62510
  createStateVariable: "permid",
@@ -64172,14 +64302,14 @@ function gatherRawRoundingFixedResponseAttributes(component, components) {
64172
64302
  }
64173
64303
  if (componentForRawAttributes.doenetAttributes.extendListViaComposite) {
64174
64304
  const composite = components[componentForRawAttributes.doenetAttributes.extendListViaComposite];
64175
- if (typeof composite.stateValues.extendIdx === "number") {
64305
+ if (typeof composite.stateValues.extendIdx === "number" && composite.stateValues.extendIdx !== -1) {
64176
64306
  componentForRawAttributes = components[composite.stateValues.extendIdx];
64177
64307
  } else {
64178
64308
  break;
64179
64309
  }
64180
64310
  } else if (componentForRawAttributes.doenetAttributes.copyListViaComposite) {
64181
64311
  const composite = components[componentForRawAttributes.doenetAttributes.copyListViaComposite];
64182
- if (typeof composite.stateValues.extendIdx === "number") {
64312
+ if (typeof composite.stateValues.extendIdx === "number" && composite.stateValues.extendIdx !== -1) {
64183
64313
  componentForRawAttributes = components[composite.stateValues.extendIdx];
64184
64314
  } else {
64185
64315
  break;
@@ -67357,7 +67487,7 @@ function returnUnorderedListStateVariableDefinitions() {
67357
67487
  }
67358
67488
  },
67359
67489
  definition({ dependencyValues }) {
67360
- if (dependencyValues.extendListSourceIdx) {
67490
+ if (typeof dependencyValues.extendListSourceIdx === "number" && dependencyValues.extendListSourceIdx !== -1) {
67361
67491
  return {
67362
67492
  setValue: {
67363
67493
  extendListSourceIdx: dependencyValues.extendListSourceIdx
@@ -67449,7 +67579,7 @@ function returnUnorderedListStateVariableDefinitions() {
67449
67579
  variableName: "unorderedFromCopyListSource"
67450
67580
  }
67451
67581
  };
67452
- if (stateValues.extendListSourceIdx) {
67582
+ if (stateValues.extendListSourceIdx !== null) {
67453
67583
  dependencies2.unorderedFromExtended = {
67454
67584
  dependencyType: "stateVariable",
67455
67585
  componentIdx: stateValues.extendListSourceIdx,
@@ -67520,6 +67650,10 @@ class MathList extends CompositeComponent {
67520
67650
  attributes.isResponse = {
67521
67651
  leaveRaw: true
67522
67652
  };
67653
+ attributes.isPotentialResponse = {
67654
+ leaveRaw: true,
67655
+ excludeFromSchema: true
67656
+ };
67523
67657
  attributes.asList = {
67524
67658
  createPrimitiveOfType: "boolean",
67525
67659
  createStateVariable: "asList",
@@ -67949,11 +68083,13 @@ class MathList extends CompositeComponent {
67949
68083
  const copyChild = component.definingChildren.length === 1 && component.definingChildren[0].componentType === "_copy" ? component.definingChildren[0] : null;
67950
68084
  let copyChildSource;
67951
68085
  if (copyChild) {
67952
- const cIdx = await copyChild?.stateValues.extendIdx;
67953
- copyChildSource = {
67954
- componentIdx: cIdx,
67955
- componentType: components[cIdx].componentType
67956
- };
68086
+ const cIdx = await copyChild.stateValues.extendIdx;
68087
+ if (cIdx !== -1) {
68088
+ copyChildSource = {
68089
+ componentIdx: cIdx,
68090
+ componentType: components[cIdx].componentType
68091
+ };
68092
+ }
67957
68093
  }
67958
68094
  let childInfoByComponent = await component.stateValues.childInfoByComponent;
67959
68095
  let numComponents = await component.stateValues.numComponents;
@@ -68100,7 +68236,17 @@ function returnScoredSectionAttributes() {
68100
68236
  showCorrectness: {
68101
68237
  createComponentOfType: "boolean",
68102
68238
  createStateVariable: "showCorrectnessPreliminary",
68103
- defaultValue: null
68239
+ defaultValue: false
68240
+ },
68241
+ colorCorrectness: {
68242
+ createComponentOfType: "boolean",
68243
+ createStateVariable: "colorCorrectnessPreliminary",
68244
+ defaultValue: false
68245
+ },
68246
+ forceIndividualAnswerColoring: {
68247
+ createComponentOfType: "boolean",
68248
+ createStateVariable: "forceIndividualAnswerColoring",
68249
+ defaultValue: false
68104
68250
  },
68105
68251
  submitLabel: {
68106
68252
  createComponentOfType: "text",
@@ -68211,18 +68357,52 @@ function returnScoredSectionStateVariableDefinition() {
68211
68357
  showCorrectnessFlag: {
68212
68358
  dependencyType: "flag",
68213
68359
  flagName: "showCorrectness"
68360
+ },
68361
+ showCorrectnessAncestor: {
68362
+ dependencyType: "ancestor",
68363
+ variableNames: ["showCorrectness"]
68214
68364
  }
68215
68365
  }),
68216
68366
  definition({ dependencyValues, usedDefault }) {
68217
68367
  let showCorrectness;
68218
68368
  if (!usedDefault.showCorrectnessPreliminary) {
68219
68369
  showCorrectness = dependencyValues.showCorrectnessPreliminary;
68370
+ } else if (dependencyValues.showCorrectnessAncestor) {
68371
+ showCorrectness = dependencyValues.showCorrectnessAncestor.stateValues.showCorrectness;
68220
68372
  } else {
68221
68373
  showCorrectness = dependencyValues.showCorrectnessFlag !== false;
68222
68374
  }
68223
68375
  return { setValue: { showCorrectness } };
68224
68376
  }
68225
68377
  };
68378
+ stateVariableDefinitions.colorCorrectness = {
68379
+ forRenderer: true,
68380
+ returnDependencies: () => ({
68381
+ colorCorrectnessPreliminary: {
68382
+ dependencyType: "stateVariable",
68383
+ variableName: "colorCorrectnessPreliminary"
68384
+ },
68385
+ showCorrectness: {
68386
+ dependencyType: "stateVariable",
68387
+ variableName: "showCorrectness"
68388
+ },
68389
+ colorCorrectnessAncestor: {
68390
+ dependencyType: "ancestor",
68391
+ variableNames: ["colorCorrectness"]
68392
+ }
68393
+ }),
68394
+ definition({ dependencyValues, usedDefault }) {
68395
+ let colorCorrectness = true;
68396
+ if (!dependencyValues.showCorrectness) {
68397
+ colorCorrectness = false;
68398
+ } else if (!usedDefault.colorCorrectnessPreliminary) {
68399
+ colorCorrectness = dependencyValues.colorCorrectnessPreliminary;
68400
+ } else if (dependencyValues.colorCorrectnessAncestor) {
68401
+ colorCorrectness = dependencyValues.colorCorrectnessAncestor.stateValues.colorCorrectness;
68402
+ }
68403
+ return { setValue: { colorCorrectness } };
68404
+ }
68405
+ };
68226
68406
  stateVariableDefinitions.displayDecimalsForCreditAchieved = {
68227
68407
  returnDependencies: () => ({}),
68228
68408
  definition: () => ({
@@ -68405,63 +68585,46 @@ function returnScoredSectionStateVariableDefinition() {
68405
68585
  stateVariableDefinitions.createSubmitAllButton = {
68406
68586
  forRenderer: true,
68407
68587
  additionalStateVariablesDefined: [
68408
- {
68409
- variableName: "suppressAnswerSubmitButtons",
68410
- forRenderer: true
68411
- }
68588
+ "suppressAnswerSubmitButtons",
68589
+ "descendantColorCorrectnessBasedOnIdx"
68412
68590
  ],
68413
68591
  returnDependencies: () => ({
68414
68592
  sectionWideCheckWork: {
68415
68593
  dependencyType: "stateVariable",
68416
68594
  variableName: "sectionWideCheckWork"
68417
68595
  },
68418
- sectionAncestor: {
68419
- dependencyType: "ancestor",
68420
- componentType: "_sectioningComponent",
68421
- variableNames: ["suppressAnswerSubmitButtons"]
68422
- },
68423
- documentAncestor: {
68424
- dependencyType: "ancestor",
68425
- componentType: "document",
68426
- variableNames: ["suppressAnswerSubmitButtons"]
68427
- },
68428
- pAncestor: {
68429
- dependencyType: "ancestor",
68430
- componentType: "p",
68431
- variableNames: ["suppressAnswerSubmitButtons"]
68432
- },
68433
- liAncestor: {
68434
- dependencyType: "ancestor",
68435
- componentType: "li",
68436
- variableNames: ["suppressAnswerSubmitButtons"]
68437
- },
68438
- divAncestor: {
68439
- dependencyType: "ancestor",
68440
- componentType: "div",
68441
- variableNames: ["suppressAnswerSubmitButtons"]
68596
+ forceIndividualAnswerColoring: {
68597
+ dependencyType: "stateVariable",
68598
+ variableName: "forceIndividualAnswerColoring"
68442
68599
  },
68443
- spanAncestor: {
68600
+ ancestorDeterminingSubmit: {
68444
68601
  dependencyType: "ancestor",
68445
- componentType: "span",
68446
- variableNames: ["suppressAnswerSubmitButtons"]
68602
+ variableNames: [
68603
+ "suppressAnswerSubmitButtons",
68604
+ "descendantColorCorrectnessBasedOnIdx"
68605
+ ]
68447
68606
  }
68448
68607
  }),
68449
- definition({ dependencyValues }) {
68450
- let warnings = [];
68608
+ definition({ dependencyValues, componentIdx }) {
68451
68609
  let createSubmitAllButton = false;
68452
68610
  let suppressAnswerSubmitButtons = false;
68453
- if (dependencyValues.documentAncestor.stateValues.suppressAnswerSubmitButtons || dependencyValues.sectionAncestor?.stateValues.suppressAnswerSubmitButtons || dependencyValues.pAncestor?.stateValues.suppressAnswerSubmitButtons || dependencyValues.liAncestor?.stateValues.suppressAnswerSubmitButtons || dependencyValues.divAncestor?.stateValues.suppressAnswerSubmitButtons || dependencyValues.spanAncestor?.stateValues.suppressAnswerSubmitButtons) {
68611
+ let descendantColorCorrectnessBasedOnIdx = null;
68612
+ if (dependencyValues.ancestorDeterminingSubmit?.stateValues.suppressAnswerSubmitButtons) {
68454
68613
  suppressAnswerSubmitButtons = true;
68614
+ descendantColorCorrectnessBasedOnIdx = dependencyValues.ancestorDeterminingSubmit.stateValues.descendantColorCorrectnessBasedOnIdx;
68455
68615
  } else if (dependencyValues.sectionWideCheckWork) {
68456
68616
  createSubmitAllButton = true;
68457
68617
  suppressAnswerSubmitButtons = true;
68618
+ if (!dependencyValues.forceIndividualAnswerColoring) {
68619
+ descendantColorCorrectnessBasedOnIdx = componentIdx;
68620
+ }
68458
68621
  }
68459
68622
  return {
68460
68623
  setValue: {
68461
68624
  createSubmitAllButton,
68462
- suppressAnswerSubmitButtons
68463
- },
68464
- sendWarnings: warnings
68625
+ suppressAnswerSubmitButtons,
68626
+ descendantColorCorrectnessBasedOnIdx
68627
+ }
68465
68628
  };
68466
68629
  }
68467
68630
  };
@@ -101831,6 +101994,9 @@ class Input extends InlineComponent {
101831
101994
  public: true,
101832
101995
  excludeFromSchema: true
101833
101996
  };
101997
+ attributes.forAnswer = {
101998
+ createReferences: true
101999
+ };
101834
102000
  Object.assign(attributes, returnLabelAttributes());
101835
102001
  return attributes;
101836
102002
  }
@@ -101842,6 +102008,102 @@ class Input extends InlineComponent {
101842
102008
  returnDependencies: () => ({}),
101843
102009
  definition: () => ({ setValue: { numValues: 1 } })
101844
102010
  };
102011
+ stateVariableDefinitions.answerOverrideIdx = {
102012
+ returnDependencies: () => ({
102013
+ ancestorForOverride: {
102014
+ dependencyType: "ancestor",
102015
+ variableNames: ["descendantColorCorrectnessBasedOnIdx"]
102016
+ }
102017
+ }),
102018
+ definition({ dependencyValues }) {
102019
+ let answerOverrideIdx = null;
102020
+ if (typeof dependencyValues.ancestorForOverride?.stateValues.descendantColorCorrectnessBasedOnIdx === "number") {
102021
+ answerOverrideIdx = dependencyValues.ancestorForOverride.stateValues.descendantColorCorrectnessBasedOnIdx;
102022
+ }
102023
+ return {
102024
+ setValue: { answerOverrideIdx }
102025
+ };
102026
+ }
102027
+ };
102028
+ stateVariableDefinitions.answerOverride = {
102029
+ stateVariablesDeterminingDependencies: ["answerOverrideIdx"],
102030
+ returnDependencies({ stateValues }) {
102031
+ let dependencies2 = {};
102032
+ if (stateValues.answerOverrideIdx !== null) {
102033
+ dependencies2.answerOverride = {
102034
+ dependencyType: "multipleStateVariables",
102035
+ componentIdx: stateValues.answerOverrideIdx,
102036
+ variableNames: [
102037
+ "justSubmitted",
102038
+ "creditAchieved",
102039
+ "showCorrectness",
102040
+ "colorCorrectness"
102041
+ ],
102042
+ variablesOptional: true
102043
+ };
102044
+ }
102045
+ return dependencies2;
102046
+ },
102047
+ definition({ dependencyValues }) {
102048
+ let answerOverride = null;
102049
+ if (dependencyValues.answerOverride) {
102050
+ answerOverride = dependencyValues.answerOverride;
102051
+ }
102052
+ return { setValue: { answerOverride } };
102053
+ }
102054
+ };
102055
+ stateVariableDefinitions.answerDelegateIdx = {
102056
+ returnDependencies: () => ({
102057
+ forAnswer: {
102058
+ dependencyType: "attributeRefResolutions",
102059
+ attributeName: "forAnswer"
102060
+ }
102061
+ }),
102062
+ definition({ dependencyValues }) {
102063
+ if (dependencyValues.forAnswer?.length === 1) {
102064
+ const forAnswer = dependencyValues.forAnswer[0];
102065
+ if (!forAnswer.unresolvedPath) {
102066
+ return {
102067
+ setValue: {
102068
+ answerDelegateIdx: forAnswer.componentIdx
102069
+ }
102070
+ };
102071
+ }
102072
+ }
102073
+ return {
102074
+ setValue: {
102075
+ answerDelegateIdx: null
102076
+ }
102077
+ };
102078
+ }
102079
+ };
102080
+ stateVariableDefinitions.answerDelegate = {
102081
+ stateVariablesDeterminingDependencies: ["answerDelegateIdx"],
102082
+ returnDependencies({ stateValues }) {
102083
+ let dependencies2 = {};
102084
+ if (stateValues.answerDelegateIdx !== null) {
102085
+ dependencies2.answerDelegate = {
102086
+ dependencyType: "multipleStateVariables",
102087
+ componentIdx: stateValues.answerDelegateIdx,
102088
+ variableNames: [
102089
+ "justSubmitted",
102090
+ "creditAchieved",
102091
+ "showCorrectness",
102092
+ "colorCorrectness"
102093
+ ],
102094
+ variablesOptional: true
102095
+ };
102096
+ }
102097
+ return dependencies2;
102098
+ },
102099
+ definition({ dependencyValues }) {
102100
+ let answerDelegate = null;
102101
+ if (dependencyValues.answerDelegate && dependencyValues.answerDelegate.componentType === "answer") {
102102
+ answerDelegate = dependencyValues.answerDelegate;
102103
+ }
102104
+ return { setValue: { answerDelegate } };
102105
+ }
102106
+ };
101845
102107
  stateVariableDefinitions.answerAncestor = {
101846
102108
  returnDependencies: () => ({
101847
102109
  answerAncestor: {
@@ -101852,6 +102114,7 @@ class Input extends InlineComponent {
101852
102114
  "justSubmitted",
101853
102115
  "creditAchieved",
101854
102116
  "showCorrectness",
102117
+ "colorCorrectness",
101855
102118
  "submitLabel",
101856
102119
  "submitLabelNoCorrectness",
101857
102120
  "numAttemptsLeft",
@@ -101914,12 +102177,24 @@ class Input extends InlineComponent {
101914
102177
  answerAncestor: {
101915
102178
  dependencyType: "stateVariable",
101916
102179
  variableName: "answerAncestor"
102180
+ },
102181
+ answerDelegate: {
102182
+ dependencyType: "stateVariable",
102183
+ variableName: "answerDelegate"
102184
+ },
102185
+ answerOverride: {
102186
+ dependencyType: "stateVariable",
102187
+ variableName: "answerOverride"
101917
102188
  }
101918
102189
  }),
101919
102190
  definition: function({ dependencyValues }) {
101920
102191
  let creditAchieved = 0;
101921
- if (dependencyValues.answerAncestor) {
102192
+ if (dependencyValues.answerOverride) {
102193
+ creditAchieved = dependencyValues.answerOverride.stateValues.creditAchieved;
102194
+ } else if (dependencyValues.answerAncestor) {
101922
102195
  creditAchieved = dependencyValues.answerAncestor.stateValues.creditAchieved;
102196
+ } else if (dependencyValues.answerDelegate) {
102197
+ creditAchieved = dependencyValues.answerDelegate.stateValues.creditAchieved;
101923
102198
  }
101924
102199
  return {
101925
102200
  setValue: { creditAchieved }
@@ -101950,12 +102225,30 @@ class Input extends InlineComponent {
101950
102225
  answerAncestor: {
101951
102226
  dependencyType: "stateVariable",
101952
102227
  variableName: "answerAncestor"
102228
+ },
102229
+ answerDelegate: {
102230
+ dependencyType: "stateVariable",
102231
+ variableName: "answerDelegate"
102232
+ },
102233
+ answerOverride: {
102234
+ dependencyType: "stateVariable",
102235
+ variableName: "answerOverride"
101953
102236
  }
101954
102237
  }),
101955
102238
  definition: function({ dependencyValues }) {
101956
102239
  let justSubmitted = false;
101957
- if (dependencyValues.answerAncestor && dependencyValues.answerAncestor.stateValues.justSubmitted) {
101958
- justSubmitted = true;
102240
+ if (dependencyValues.answerOverride) {
102241
+ if (dependencyValues.answerOverride.stateValues.justSubmitted) {
102242
+ justSubmitted = true;
102243
+ }
102244
+ } else if (dependencyValues.answerAncestor) {
102245
+ if (dependencyValues.answerAncestor.stateValues.justSubmitted) {
102246
+ justSubmitted = true;
102247
+ }
102248
+ } else if (dependencyValues.answerDelegate) {
102249
+ if (dependencyValues.answerDelegate.stateValues.justSubmitted) {
102250
+ justSubmitted = true;
102251
+ }
101959
102252
  }
101960
102253
  return {
101961
102254
  setValue: { justSubmitted }
@@ -101972,18 +102265,64 @@ class Input extends InlineComponent {
101972
102265
  answerAncestor: {
101973
102266
  dependencyType: "stateVariable",
101974
102267
  variableName: "answerAncestor"
102268
+ },
102269
+ answerDelegate: {
102270
+ dependencyType: "stateVariable",
102271
+ variableName: "answerDelegate"
102272
+ },
102273
+ answerOverride: {
102274
+ dependencyType: "stateVariable",
102275
+ variableName: "answerOverride"
101975
102276
  }
101976
102277
  }),
101977
102278
  definition({ dependencyValues }) {
101978
102279
  let showCorrectness;
101979
- if (dependencyValues.answerAncestor) {
102280
+ if (dependencyValues.answerOverride) {
102281
+ showCorrectness = dependencyValues.answerOverride.stateValues.showCorrectness;
102282
+ } else if (dependencyValues.answerAncestor) {
101980
102283
  showCorrectness = dependencyValues.answerAncestor.stateValues.showCorrectness;
102284
+ } else if (dependencyValues.answerDelegate) {
102285
+ showCorrectness = dependencyValues.answerDelegate.stateValues.showCorrectness;
101981
102286
  } else {
101982
102287
  showCorrectness = dependencyValues.showCorrectnessFlag !== false;
101983
102288
  }
101984
102289
  return { setValue: { showCorrectness } };
101985
102290
  }
101986
102291
  };
102292
+ stateVariableDefinitions.colorCorrectness = {
102293
+ forRenderer: true,
102294
+ returnDependencies: () => ({
102295
+ answerAncestor: {
102296
+ dependencyType: "stateVariable",
102297
+ variableName: "answerAncestor"
102298
+ },
102299
+ answerDelegate: {
102300
+ dependencyType: "stateVariable",
102301
+ variableName: "answerDelegate"
102302
+ },
102303
+ answerOverride: {
102304
+ dependencyType: "stateVariable",
102305
+ variableName: "answerOverride"
102306
+ },
102307
+ showCorrectness: {
102308
+ dependencyType: "stateVariable",
102309
+ variableName: "showCorrectness"
102310
+ }
102311
+ }),
102312
+ definition({ dependencyValues }) {
102313
+ let colorCorrectness = true;
102314
+ if (!dependencyValues.showCorrectness) {
102315
+ colorCorrectness = false;
102316
+ } else if (dependencyValues.answerOverride) {
102317
+ colorCorrectness = dependencyValues.answerOverride.stateValues.colorCorrectness;
102318
+ } else if (dependencyValues.answerAncestor) {
102319
+ colorCorrectness = dependencyValues.answerAncestor.stateValues.colorCorrectness;
102320
+ } else if (dependencyValues.answerDelegate) {
102321
+ colorCorrectness = dependencyValues.answerDelegate.stateValues.colorCorrectness;
102322
+ }
102323
+ return { setValue: { colorCorrectness } };
102324
+ }
102325
+ };
101987
102326
  stateVariableDefinitions.submitLabel = {
101988
102327
  forRenderer: true,
101989
102328
  returnDependencies: () => ({
@@ -105564,6 +105903,7 @@ class Document extends BaseComponent {
105564
105903
  delete attributes.fixed;
105565
105904
  delete attributes.styleNumber;
105566
105905
  delete attributes.isResponse;
105906
+ delete attributes.isPotentialResponse;
105567
105907
  attributes.documentWideCheckWork = {
105568
105908
  createComponentOfType: "boolean",
105569
105909
  createStateVariable: "documentWideCheckWork",
@@ -105573,7 +105913,17 @@ class Document extends BaseComponent {
105573
105913
  attributes.showCorrectness = {
105574
105914
  createComponentOfType: "boolean",
105575
105915
  createStateVariable: "showCorrectnessPreliminary",
105576
- defaultValue: null
105916
+ defaultValue: true
105917
+ };
105918
+ attributes.colorCorrectness = {
105919
+ createComponentOfType: "boolean",
105920
+ createStateVariable: "colorCorrectnessPreliminary",
105921
+ defaultValue: true
105922
+ };
105923
+ attributes.forceIndividualAnswerColoring = {
105924
+ createComponentOfType: "boolean",
105925
+ createStateVariable: "forceIndividualAnswerColoring",
105926
+ defaultValue: false
105577
105927
  };
105578
105928
  attributes.submitLabel = {
105579
105929
  createComponentOfType: "text",
@@ -106067,28 +106417,35 @@ class Document extends BaseComponent {
106067
106417
  stateVariableDefinitions.createSubmitAllButton = {
106068
106418
  forRenderer: true,
106069
106419
  additionalStateVariablesDefined: [
106070
- {
106071
- variableName: "suppressAnswerSubmitButtons",
106072
- forRenderer: true
106073
- }
106420
+ "suppressAnswerSubmitButtons",
106421
+ "descendantColorCorrectnessBasedOnIdx"
106074
106422
  ],
106075
106423
  returnDependencies: () => ({
106076
106424
  documentWideCheckWork: {
106077
106425
  dependencyType: "stateVariable",
106078
106426
  variableName: "documentWideCheckWork"
106427
+ },
106428
+ forceIndividualAnswerColoring: {
106429
+ dependencyType: "stateVariable",
106430
+ variableName: "forceIndividualAnswerColoring"
106079
106431
  }
106080
106432
  }),
106081
106433
  definition({ dependencyValues, componentIdx }) {
106082
106434
  let createSubmitAllButton = false;
106083
106435
  let suppressAnswerSubmitButtons = false;
106436
+ let descendantColorCorrectnessBasedOnIdx = null;
106084
106437
  if (dependencyValues.documentWideCheckWork) {
106085
106438
  createSubmitAllButton = true;
106086
106439
  suppressAnswerSubmitButtons = true;
106440
+ if (!dependencyValues.forceIndividualAnswerColoring) {
106441
+ descendantColorCorrectnessBasedOnIdx = componentIdx;
106442
+ }
106087
106443
  }
106088
106444
  return {
106089
106445
  setValue: {
106090
106446
  createSubmitAllButton,
106091
- suppressAnswerSubmitButtons
106447
+ suppressAnswerSubmitButtons,
106448
+ descendantColorCorrectnessBasedOnIdx
106092
106449
  }
106093
106450
  };
106094
106451
  }
@@ -106249,6 +106606,10 @@ let TextList$1 = class TextList extends CompositeComponent {
106249
106606
  attributes.isResponse = {
106250
106607
  leaveRaw: true
106251
106608
  };
106609
+ attributes.isPotentialResponse = {
106610
+ leaveRaw: true,
106611
+ excludeFromSchema: true
106612
+ };
106252
106613
  attributes.asList = {
106253
106614
  createPrimitiveOfType: "boolean",
106254
106615
  createStateVariable: "asList",
@@ -106489,7 +106850,7 @@ let TextList$1 = class TextList extends CompositeComponent {
106489
106850
  let replacements = [];
106490
106851
  let componentsCopied = [];
106491
106852
  let attributesToConvert = {};
106492
- for (let attr of ["fixed", "isResponse"]) {
106853
+ for (let attr of ["fixed", "isResponse", "isPotentialResponse"]) {
106493
106854
  if (attr in component.attributes) {
106494
106855
  attributesToConvert[attr] = component.attributes[attr];
106495
106856
  }
@@ -106874,6 +107235,10 @@ class NumberList extends CompositeComponent {
106874
107235
  attributes.isResponse = {
106875
107236
  leaveRaw: true
106876
107237
  };
107238
+ attributes.isPotentialResponse = {
107239
+ leaveRaw: true,
107240
+ excludeFromSchema: true
107241
+ };
106877
107242
  attributes.asList = {
106878
107243
  createPrimitiveOfType: "boolean",
106879
107244
  createStateVariable: "asList",
@@ -107298,11 +107663,13 @@ class NumberList extends CompositeComponent {
107298
107663
  const copyChild = component.definingChildren.length === 1 && component.definingChildren[0].componentType === "_copy" ? component.definingChildren[0] : null;
107299
107664
  let copyChildSource;
107300
107665
  if (copyChild) {
107301
- const cIdx = await copyChild?.stateValues.extendIdx;
107302
- copyChildSource = {
107303
- componentIdx: cIdx,
107304
- componentType: components[cIdx].componentType
107305
- };
107666
+ const cIdx = await copyChild.stateValues.extendIdx;
107667
+ if (cIdx !== -1) {
107668
+ copyChildSource = {
107669
+ componentIdx: cIdx,
107670
+ componentType: components[cIdx].componentType
107671
+ };
107672
+ }
107306
107673
  }
107307
107674
  let childInfoByComponent = await component.stateValues.childInfoByComponent;
107308
107675
  let numComponents = await component.stateValues.numComponents;
@@ -107461,6 +107828,10 @@ class BooleanList extends CompositeComponent {
107461
107828
  attributes.isResponse = {
107462
107829
  leaveRaw: true
107463
107830
  };
107831
+ attributes.isPotentialResponse = {
107832
+ leaveRaw: true,
107833
+ excludeFromSchema: true
107834
+ };
107464
107835
  attributes.asList = {
107465
107836
  createPrimitiveOfType: "boolean",
107466
107837
  createStateVariable: "asList",
@@ -107701,7 +108072,7 @@ class BooleanList extends CompositeComponent {
107701
108072
  let replacements = [];
107702
108073
  let componentsCopied = [];
107703
108074
  let attributesToConvert = {};
107704
- for (let attr of ["fixed", "isResponse"]) {
108075
+ for (let attr of ["fixed", "isResponse", "isPotentialResponse"]) {
107705
108076
  if (attr in component.attributes) {
107706
108077
  attributesToConvert[attr] = component.attributes[attr];
107707
108078
  }
@@ -107822,6 +108193,7 @@ class Collect extends CompositeComponent {
107822
108193
  delete attributes.fixed;
107823
108194
  delete attributes.styleNumber;
107824
108195
  delete attributes.isResponse;
108196
+ delete attributes.isPotentialResponse;
107825
108197
  delete attributes.hide;
107826
108198
  attributes.maxNumber = {
107827
108199
  createComponentOfType: "number",
@@ -119302,6 +119674,10 @@ class VectorListComponent extends CompositeComponent {
119302
119674
  attributes.isResponse = {
119303
119675
  leaveRaw: true
119304
119676
  };
119677
+ attributes.isPotentialResponse = {
119678
+ leaveRaw: true,
119679
+ excludeFromSchema: true
119680
+ };
119305
119681
  attributes.asList = {
119306
119682
  createPrimitiveOfType: "boolean",
119307
119683
  createStateVariable: "asList",
@@ -119701,11 +120077,13 @@ class VectorListComponent extends CompositeComponent {
119701
120077
  const copyChild = component.definingChildren.length === 1 && component.definingChildren[0].componentType === "_copy" ? component.definingChildren[0] : null;
119702
120078
  let copyChildSource;
119703
120079
  if (copyChild) {
119704
- const cIdx = await copyChild?.stateValues.extendIdx;
119705
- copyChildSource = {
119706
- componentIdx: cIdx,
119707
- componentType: components[cIdx].componentType
119708
- };
120080
+ const cIdx = await copyChild.stateValues.extendIdx;
120081
+ if (cIdx !== -1) {
120082
+ copyChildSource = {
120083
+ componentIdx: cIdx,
120084
+ componentType: components[cIdx].componentType
120085
+ };
120086
+ }
119709
120087
  }
119710
120088
  let childIndicesByVector = await component.stateValues.childIndicesByVector;
119711
120089
  let numVectors = await component.stateValues.numVectors;
@@ -119903,6 +120281,10 @@ class PointList extends CompositeComponent {
119903
120281
  attributes.isResponse = {
119904
120282
  leaveRaw: true
119905
120283
  };
120284
+ attributes.isPotentialResponse = {
120285
+ leaveRaw: true,
120286
+ excludeFromSchema: true
120287
+ };
119906
120288
  attributes.asList = {
119907
120289
  createPrimitiveOfType: "boolean",
119908
120290
  createStateVariable: "asList",
@@ -120306,11 +120688,13 @@ class PointList extends CompositeComponent {
120306
120688
  const copyChild = component.definingChildren.length === 1 && component.definingChildren[0].componentType === "_copy" ? component.definingChildren[0] : null;
120307
120689
  let copyChildSource;
120308
120690
  if (copyChild) {
120309
- const cIdx = await copyChild?.stateValues.extendIdx;
120310
- copyChildSource = {
120311
- componentIdx: cIdx,
120312
- componentType: components[cIdx].componentType
120313
- };
120691
+ const cIdx = await copyChild.stateValues.extendIdx;
120692
+ if (cIdx !== -1) {
120693
+ copyChildSource = {
120694
+ componentIdx: cIdx,
120695
+ componentType: components[cIdx].componentType
120696
+ };
120697
+ }
120314
120698
  }
120315
120699
  let childIndicesByPoint = await component.stateValues.childIndicesByPoint;
120316
120700
  let numPoints = await component.stateValues.numPoints;
@@ -120487,6 +120871,10 @@ class IntervalList extends CompositeComponent {
120487
120871
  attributes.isResponse = {
120488
120872
  leaveRaw: true
120489
120873
  };
120874
+ attributes.isPotentialResponse = {
120875
+ leaveRaw: true,
120876
+ excludeFromSchema: true
120877
+ };
120490
120878
  attributes.asList = {
120491
120879
  createPrimitiveOfType: "boolean",
120492
120880
  createStateVariable: "asList",
@@ -120787,11 +121175,13 @@ class IntervalList extends CompositeComponent {
120787
121175
  const copyChild = component.definingChildren.length === 1 && component.definingChildren[0].componentType === "_copy" ? component.definingChildren[0] : null;
120788
121176
  let copyChildSource;
120789
121177
  if (copyChild) {
120790
- const cIdx = await copyChild?.stateValues.extendIdx;
120791
- copyChildSource = {
120792
- componentIdx: cIdx,
120793
- componentType: components[cIdx].componentType
120794
- };
121178
+ const cIdx = await copyChild.stateValues.extendIdx;
121179
+ if (cIdx !== -1) {
121180
+ copyChildSource = {
121181
+ componentIdx: cIdx,
121182
+ componentType: components[cIdx].componentType
121183
+ };
121184
+ }
120795
121185
  }
120796
121186
  let childIndicesByInterval = await component.stateValues.childIndicesByInterval;
120797
121187
  let numIntervals = await component.stateValues.numIntervals;
@@ -124934,7 +125324,13 @@ function returnStandardAnswerAttributes() {
124934
125324
  showCorrectness: {
124935
125325
  createComponentOfType: "boolean",
124936
125326
  createStateVariable: "showCorrectnessPreliminary",
124937
- defaultValue: null
125327
+ defaultValue: true
125328
+ },
125329
+ colorCorrectness: {
125330
+ createComponentOfType: "boolean",
125331
+ createStateVariable: "colorCorrectnessPreliminary",
125332
+ defaultValue: true,
125333
+ public: true
124938
125334
  },
124939
125335
  disableAfterCorrect: {
124940
125336
  createComponentOfType: "boolean",
@@ -124986,18 +125382,54 @@ function returnStandardAnswerStateVariableDefinition() {
124986
125382
  handGraded: {
124987
125383
  dependencyType: "stateVariable",
124988
125384
  variableName: "handGraded"
125385
+ },
125386
+ showCorrectnessAncestor: {
125387
+ dependencyType: "ancestor",
125388
+ variableNames: ["showCorrectness"]
124989
125389
  }
124990
125390
  }),
124991
125391
  definition({ dependencyValues, usedDefault }) {
124992
125392
  let showCorrectness;
124993
125393
  if (!usedDefault.showCorrectnessPreliminary) {
124994
125394
  showCorrectness = dependencyValues.showCorrectnessPreliminary;
125395
+ } else if (dependencyValues.handGraded) {
125396
+ showCorrectness = false;
125397
+ } else if (dependencyValues.showCorrectnessAncestor) {
125398
+ showCorrectness = dependencyValues.showCorrectnessAncestor.stateValues.showCorrectness;
124995
125399
  } else {
124996
- showCorrectness = dependencyValues.showCorrectnessFlag !== false && !dependencyValues.handGraded;
125400
+ showCorrectness = dependencyValues.showCorrectnessFlag !== false;
124997
125401
  }
124998
125402
  return { setValue: { showCorrectness } };
124999
125403
  }
125000
125404
  };
125405
+ stateVariableDefinitions.colorCorrectness = {
125406
+ forRenderer: true,
125407
+ returnDependencies: () => ({
125408
+ colorCorrectnessPreliminary: {
125409
+ dependencyType: "stateVariable",
125410
+ variableName: "colorCorrectnessPreliminary"
125411
+ },
125412
+ showCorrectness: {
125413
+ dependencyType: "stateVariable",
125414
+ variableName: "showCorrectness"
125415
+ },
125416
+ colorCorrectnessAncestor: {
125417
+ dependencyType: "ancestor",
125418
+ variableNames: ["colorCorrectness"]
125419
+ }
125420
+ }),
125421
+ definition({ dependencyValues, usedDefault }) {
125422
+ let colorCorrectness = true;
125423
+ if (!dependencyValues.showCorrectness) {
125424
+ colorCorrectness = false;
125425
+ } else if (!usedDefault.colorCorrectnessPreliminary) {
125426
+ colorCorrectness = dependencyValues.colorCorrectnessPreliminary;
125427
+ } else if (dependencyValues.colorCorrectnessAncestor) {
125428
+ colorCorrectness = dependencyValues.colorCorrectnessAncestor.stateValues.colorCorrectness;
125429
+ }
125430
+ return { setValue: { colorCorrectness } };
125431
+ }
125432
+ };
125001
125433
  stateVariableDefinitions.suppressCheckWork = {
125002
125434
  returnDependencies: () => ({
125003
125435
  autoSubmit: {
@@ -125398,6 +125830,7 @@ class Answer extends InlineComponent {
125398
125830
  attributes.inline = {
125399
125831
  createComponentOfType: "boolean",
125400
125832
  createStateVariable: "inline",
125833
+ forRenderer: true,
125401
125834
  defaultValue: false,
125402
125835
  public: true
125403
125836
  };
@@ -125586,22 +126019,21 @@ class Answer extends InlineComponent {
125586
126019
  }
125587
126020
  return false;
125588
126021
  }
125589
- function addResponsesToCompositeDescendants(components) {
126022
+ function addPotentialResponsesToReferenceDescendants(components) {
125590
126023
  for (let component of components) {
125591
- if (componentInfoObjects2.isInheritedComponentType({
125592
- inheritedComponentType: component.componentType,
125593
- baseComponentType: "_composite"
125594
- })) {
126024
+ if (component.componentType === "_copy") {
125595
126025
  if (!component.attributes) {
125596
126026
  component.attributes = {};
125597
126027
  }
125598
- component.attributes.isResponse = {
126028
+ component.attributes.isPotentialResponse = {
125599
126029
  type: "unresolved",
125600
- name: "isResponse",
126030
+ name: "isPotentialResponse",
125601
126031
  children: ["true"]
125602
126032
  };
125603
126033
  } else if (component.children) {
125604
- addResponsesToCompositeDescendants(component.children);
126034
+ addPotentialResponsesToReferenceDescendants(
126035
+ component.children
126036
+ );
125605
126037
  }
125606
126038
  }
125607
126039
  }
@@ -125795,7 +126227,7 @@ class Answer extends InlineComponent {
125795
126227
  for (let child of matchedChildren) {
125796
126228
  if (componentIsSpecifiedType(child, "award")) {
125797
126229
  if (child.children?.length > 0) {
125798
- addResponsesToCompositeDescendants(
126230
+ addPotentialResponsesToReferenceDescendants(
125799
126231
  child.children
125800
126232
  );
125801
126233
  }
@@ -126042,6 +126474,26 @@ class Answer extends InlineComponent {
126042
126474
  };
126043
126475
  }
126044
126476
  };
126477
+ stateVariableDefinitions.haveBlockInputChild = {
126478
+ forRenderer: true,
126479
+ returnDependencies: () => ({
126480
+ allInputChildrenIncludingSugared: {
126481
+ dependencyType: "child",
126482
+ childGroups: ["inputs"],
126483
+ variableNames: ["inline"],
126484
+ variablesOptional: true
126485
+ }
126486
+ }),
126487
+ definition({ dependencyValues }) {
126488
+ return {
126489
+ setValue: {
126490
+ haveBlockInputChild: dependencyValues.allInputChildrenIncludingSugared.some(
126491
+ (child) => child.stateValues.inline === false
126492
+ )
126493
+ }
126494
+ };
126495
+ }
126496
+ };
126045
126497
  stateVariableDefinitions.descriptionChildInd = {
126046
126498
  forRenderer: true,
126047
126499
  returnDependencies: () => ({
@@ -126177,13 +126629,38 @@ class Answer extends InlineComponent {
126177
126629
  };
126178
126630
  }
126179
126631
  };
126632
+ stateVariableDefinitions.inputsForAnswer = {
126633
+ returnDependencies: () => ({
126634
+ inputsReferencing: {
126635
+ dependencyType: "componentsReferencingAttribute",
126636
+ attributeName: "forAnswer"
126637
+ },
126638
+ inputChildren: {
126639
+ dependencyType: "stateVariable",
126640
+ variableName: "inputChildrenWithValues"
126641
+ }
126642
+ }),
126643
+ definition({ dependencyValues }) {
126644
+ const inputsForAnswer = [];
126645
+ if (dependencyValues.inputsReferencing) {
126646
+ inputsForAnswer.push(
126647
+ ...dependencyValues.inputsReferencing.filter(
126648
+ (comp) => !dependencyValues.inputChildren.map((child) => child.componentIdx).includes(comp.componentIdx)
126649
+ )
126650
+ );
126651
+ }
126652
+ return { setValue: { inputsForAnswer } };
126653
+ }
126654
+ };
126180
126655
  stateVariableDefinitions.numResponses = {
126656
+ additionalStateVariablesDefined: ["usePotentialResponses"],
126181
126657
  public: true,
126182
126658
  shadowingInstructions: {
126183
126659
  createComponentOfType: "number"
126184
126660
  },
126185
126661
  stateVariablesDeterminingDependencies: [
126186
- "awardInputResponseChildren"
126662
+ "awardInputResponseChildren",
126663
+ "inputsForAnswer"
126187
126664
  ],
126188
126665
  returnDependencies({ stateValues, componentInfoObjects: componentInfoObjects2 }) {
126189
126666
  let dependencies2 = {
@@ -126192,8 +126669,23 @@ class Answer extends InlineComponent {
126192
126669
  value: stateValues.awardInputResponseChildren.map(
126193
126670
  (x2) => x2.componentType
126194
126671
  )
126672
+ },
126673
+ numInputsForAnswer: {
126674
+ dependencyType: "value",
126675
+ value: stateValues.inputsForAnswer.length
126195
126676
  }
126196
126677
  };
126678
+ for (let [
126679
+ ind,
126680
+ inputComp
126681
+ ] of stateValues.inputsForAnswer.entries()) {
126682
+ dependencies2["inputForAnswerNValues" + ind] = {
126683
+ dependencyType: "stateVariable",
126684
+ componentIdx: inputComp.componentIdx,
126685
+ variableName: "numValues",
126686
+ variablesOptional: true
126687
+ };
126688
+ }
126197
126689
  for (let [
126198
126690
  ind,
126199
126691
  child
@@ -126206,7 +126698,11 @@ class Answer extends InlineComponent {
126206
126698
  dependencyType: "descendant",
126207
126699
  ancestorIdx: child.componentIdx,
126208
126700
  componentTypes: ["_base"],
126209
- variableNames: ["isResponse", "numValues"],
126701
+ variableNames: [
126702
+ "isResponse",
126703
+ "isPotentialResponse",
126704
+ "numValues"
126705
+ ],
126210
126706
  variablesOptional: true,
126211
126707
  recurseToMatchedChildren: true,
126212
126708
  includeNonActiveChildren: true,
@@ -126234,6 +126730,15 @@ class Answer extends InlineComponent {
126234
126730
  },
126235
126731
  definition({ dependencyValues, componentInfoObjects: componentInfoObjects2 }) {
126236
126732
  let numResponses = 0;
126733
+ let numPotentialResponses = 0;
126734
+ for (let ind = 0; ind < dependencyValues.numInputsForAnswer; ind++) {
126735
+ let numValues = dependencyValues["inputForAnswerNValues" + ind];
126736
+ if (numValues === void 0) {
126737
+ numResponses += 1;
126738
+ } else {
126739
+ numResponses += numValues;
126740
+ }
126741
+ }
126237
126742
  for (let [
126238
126743
  ind,
126239
126744
  childType
@@ -126243,16 +126748,17 @@ class Answer extends InlineComponent {
126243
126748
  baseComponentType: "award"
126244
126749
  })) {
126245
126750
  for (let descendant of dependencyValues["child" + ind]) {
126246
- if (!descendant.stateValues.isResponse || componentInfoObjects2.isInheritedComponentType({
126751
+ if (!descendant.stateValues.isResponse && !descendant.stateValues.isPotentialResponse || componentInfoObjects2.isInheritedComponentType({
126247
126752
  inheritedComponentType: descendant.componentType,
126248
126753
  baseComponentType: "_composite"
126249
126754
  })) {
126250
126755
  continue;
126251
126756
  }
126252
- if (descendant.stateValues.numValues === void 0) {
126253
- numResponses += 1;
126757
+ let numValues = descendant.stateValues.numValues ?? 1;
126758
+ if (descendant.stateValues.isResponse) {
126759
+ numResponses += numValues;
126254
126760
  } else {
126255
- numResponses += descendant.stateValues.numValues;
126761
+ numPotentialResponses += numValues;
126256
126762
  }
126257
126763
  }
126258
126764
  } else if (componentInfoObjects2.isInheritedComponentType({
@@ -126275,7 +126781,14 @@ class Answer extends InlineComponent {
126275
126781
  }
126276
126782
  }
126277
126783
  }
126278
- return { setValue: { numResponses } };
126784
+ let usePotentialResponses = false;
126785
+ if (numResponses === 0 && numPotentialResponses > 0) {
126786
+ numResponses = numPotentialResponses;
126787
+ usePotentialResponses = true;
126788
+ }
126789
+ return {
126790
+ setValue: { numResponses, usePotentialResponses }
126791
+ };
126279
126792
  }
126280
126793
  };
126281
126794
  stateVariableDefinitions.currentResponses = {
@@ -126291,7 +126804,8 @@ class Answer extends InlineComponent {
126291
126804
  isArray: true,
126292
126805
  entryPrefixes: ["currentResponse"],
126293
126806
  stateVariablesDeterminingDependencies: [
126294
- "awardInputResponseChildren"
126807
+ "awardInputResponseChildren",
126808
+ "inputsForAnswer"
126295
126809
  ],
126296
126810
  returnArraySizeDependencies: () => ({
126297
126811
  numResponses: {
@@ -126312,8 +126826,27 @@ class Answer extends InlineComponent {
126312
126826
  value: stateValues.awardInputResponseChildren.map(
126313
126827
  (x2) => x2.componentType
126314
126828
  )
126829
+ },
126830
+ numInputsForAnswer: {
126831
+ dependencyType: "value",
126832
+ value: stateValues.inputsForAnswer.length
126833
+ },
126834
+ usePotentialResponses: {
126835
+ dependencyType: "stateVariable",
126836
+ variableName: "usePotentialResponses"
126315
126837
  }
126316
126838
  };
126839
+ for (let [
126840
+ ind,
126841
+ inputComp
126842
+ ] of stateValues.inputsForAnswer.entries()) {
126843
+ globalDependencies["inputForAnswer" + ind] = {
126844
+ dependencyType: "multipleStateVariables",
126845
+ componentIdx: inputComp.componentIdx,
126846
+ variableNames: ["value", "values", "componentType"],
126847
+ variablesOptional: true
126848
+ };
126849
+ }
126317
126850
  for (let [
126318
126851
  ind,
126319
126852
  child
@@ -126328,6 +126861,7 @@ class Answer extends InlineComponent {
126328
126861
  componentTypes: ["_base"],
126329
126862
  variableNames: [
126330
126863
  "isResponse",
126864
+ "isPotentialResponse",
126331
126865
  "value",
126332
126866
  "values",
126333
126867
  "formula",
@@ -126343,22 +126877,10 @@ class Answer extends InlineComponent {
126343
126877
  inheritedComponentType: child.componentType,
126344
126878
  baseComponentType: "_input"
126345
126879
  })) {
126346
- globalDependencies["childValue" + ind] = {
126347
- dependencyType: "stateVariable",
126348
- componentIdx: child.componentIdx,
126349
- variableName: "value",
126350
- variablesOptional: true
126351
- };
126352
- globalDependencies["childValues" + ind] = {
126353
- dependencyType: "stateVariable",
126354
- componentIdx: child.componentIdx,
126355
- variableName: "values",
126356
- variablesOptional: true
126357
- };
126358
- globalDependencies["childComponentType" + ind] = {
126359
- dependencyType: "stateVariable",
126880
+ globalDependencies["child" + ind] = {
126881
+ dependencyType: "multipleStateVariables",
126360
126882
  componentIdx: child.componentIdx,
126361
- variableName: "componentType",
126883
+ variableNames: ["value", "values", "componentType"],
126362
126884
  variablesOptional: true
126363
126885
  };
126364
126886
  } else {
@@ -126378,6 +126900,11 @@ class Answer extends InlineComponent {
126378
126900
  let currentResponses = [];
126379
126901
  let componentType = [];
126380
126902
  let responseComponents = [];
126903
+ for (let ind = 0; ind < globalDependencyValues.numInputsForAnswer; ind++) {
126904
+ const input = globalDependencyValues["inputForAnswer" + ind];
126905
+ input.componentType = input.stateValues.componentType;
126906
+ responseComponents.push(input);
126907
+ }
126381
126908
  for (let [
126382
126909
  ind,
126383
126910
  childType
@@ -126387,7 +126914,7 @@ class Answer extends InlineComponent {
126387
126914
  baseComponentType: "award"
126388
126915
  })) {
126389
126916
  for (let descendant of globalDependencyValues["child" + ind]) {
126390
- if (!descendant.stateValues.isResponse || componentInfoObjects2.isInheritedComponentType({
126917
+ if (!descendant.stateValues.isResponse && (!globalDependencyValues.usePotentialResponses || !descendant.stateValues.isPotentialResponse) || componentInfoObjects2.isInheritedComponentType({
126391
126918
  inheritedComponentType: descendant.componentType,
126392
126919
  baseComponentType: "_composite"
126393
126920
  })) {
@@ -126399,14 +126926,8 @@ class Answer extends InlineComponent {
126399
126926
  inheritedComponentType: childType,
126400
126927
  baseComponentType: "_input"
126401
126928
  })) {
126402
- let child = {
126403
- componentType: childType,
126404
- stateValues: {
126405
- value: globalDependencyValues["childValue" + ind],
126406
- values: globalDependencyValues["childValues" + ind],
126407
- componentType: globalDependencyValues["childComponentType" + ind]
126408
- }
126409
- };
126929
+ const child = globalDependencyValues["child" + ind];
126930
+ child.componentType = child.stateValues.componentType;
126410
126931
  responseComponents.push(child);
126411
126932
  } else {
126412
126933
  responseComponents.push(
@@ -136048,6 +136569,10 @@ class Repeat extends CompositeComponent {
136048
136569
  attributes.isResponse = {
136049
136570
  leaveRaw: true
136050
136571
  };
136572
+ attributes.isPotentialResponse = {
136573
+ leaveRaw: true,
136574
+ excludeFromSchema: true
136575
+ };
136051
136576
  attributes.asList = {
136052
136577
  createPrimitiveOfType: "boolean",
136053
136578
  createStateVariable: "asList",
@@ -136839,6 +137364,10 @@ class RepeatForSequence extends CompositeComponent {
136839
137364
  attributes.isResponse = {
136840
137365
  leaveRaw: true
136841
137366
  };
137367
+ attributes.isPotentialResponse = {
137368
+ leaveRaw: true,
137369
+ excludeFromSchema: true
137370
+ };
136842
137371
  attributes.asList = {
136843
137372
  createPrimitiveOfType: "boolean",
136844
137373
  createStateVariable: "asList",
@@ -181675,6 +182204,10 @@ class Group extends CompositeComponent {
181675
182204
  attributes.isResponse = {
181676
182205
  leaveRaw: true
181677
182206
  };
182207
+ attributes.isPotentialResponse = {
182208
+ leaveRaw: true,
182209
+ excludeFromSchema: true
182210
+ };
181678
182211
  attributes.createComponentOfType = {
181679
182212
  createPrimitiveOfType: "string"
181680
182213
  };
@@ -181835,15 +182368,20 @@ class Group extends CompositeComponent {
181835
182368
  prefix: `${component.stateId}|`,
181836
182369
  num: workspace.replacementsCreated
181837
182370
  };
181838
- if ("isResponse" in component.attributes) {
182371
+ if ("isResponse" in component.attributes || "isPotentialResponse" in component.attributes) {
182372
+ const attributes = {};
182373
+ if ("isResponse" in component.attributes) {
182374
+ attributes.isResponse = component.attributes.isResponse;
182375
+ }
182376
+ if ("isPotentialResponse" in component.attributes) {
182377
+ attributes.isPotentialResponse = component.attributes.isPotentialResponse;
182378
+ }
181839
182379
  for (let repl of replacements) {
181840
182380
  if (typeof repl !== "object") {
181841
182381
  continue;
181842
182382
  }
181843
182383
  const res = convertUnresolvedAttributesForComponentType({
181844
- attributes: {
181845
- isResponse: component.attributes.isResponse
181846
- },
182384
+ attributes,
181847
182385
  componentType: repl.componentType,
181848
182386
  componentInfoObjects: componentInfoObjects2,
181849
182387
  nComponents,
@@ -203575,6 +204113,7 @@ class Copy extends CompositeComponent {
203575
204113
  delete attributes.fixed;
203576
204114
  delete attributes.styleNumber;
203577
204115
  delete attributes.isResponse;
204116
+ delete attributes.isPotentialResponse;
203578
204117
  delete attributes.hide;
203579
204118
  attributes.createComponentOfType = {
203580
204119
  createPrimitiveOfType: "string"
@@ -203686,7 +204225,7 @@ class Copy extends CompositeComponent {
203686
204225
  // then remove the relevant code from `Dependencies`
203687
204226
  // determineDependenciesImmediately: true,
203688
204227
  returnDependencies({ stateValues }) {
203689
- if (stateValues.extendIdx != void 0) {
204228
+ if (stateValues.extendIdx !== -1) {
203690
204229
  return {
203691
204230
  extendedComponent: {
203692
204231
  dependencyType: "componentIdentity",