@pie-element/math-inline 10.3.0 → 10.3.1

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/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [10.3.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/math-inline@10.2.1...@pie-element/math-inline@10.3.1) (2025-10-16)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * bump pie-lib versions and pslb module versions ([393d39f](https://github.com/pie-framework/pie-elements/commit/393d39fb850ad055568f4d20464213e9043f208f))
12
+ * remove deprecated ReactDOM.findDOMNode from math-inline ([b6267be](https://github.com/pie-framework/pie-elements/commit/b6267be95153d5f6d9f4b46ed431859d6e99b7d5))
13
+
14
+
15
+
16
+
17
+
6
18
  # [10.3.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/math-inline@10.2.0...@pie-element/math-inline@10.3.0) (2025-10-15)
7
19
 
8
20
 
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [9.3.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/math-inline-configure@9.2.1...@pie-element/math-inline-configure@9.3.1) (2025-10-16)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * bump pie-lib versions and pslb module versions ([393d39f](https://github.com/pie-framework/pie-elements/commit/393d39fb850ad055568f4d20464213e9043f208f))
12
+
13
+
14
+
15
+
16
+
6
17
  # [9.3.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/math-inline-configure@9.2.0...@pie-element/math-inline-configure@9.3.0) (2025-10-15)
7
18
 
8
19
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pie-element/math-inline-configure",
3
3
  "private": true,
4
- "version": "9.3.0",
4
+ "version": "9.3.1",
5
5
  "description": "",
6
6
  "main": "lib/index.js",
7
7
  "module": "src/index.js",
@@ -11,12 +11,12 @@
11
11
  "@material-ui/icons": "^3.0.1",
12
12
  "@pie-framework/mathquill": "^1.1.3",
13
13
  "@pie-framework/pie-configure-events": "^1.3.0",
14
- "@pie-lib/config-ui": "^11.25.2",
15
- "@pie-lib/editable-html": "^11.17.2",
16
- "@pie-lib/math-rendering": "^3.19.4",
17
- "@pie-lib/math-toolbar": "^1.27.2",
18
- "@pie-lib/render-ui": "^4.31.2",
19
- "@pie-lib/test-utils": "^0.19.5",
14
+ "@pie-lib/config-ui": "^11.29.0",
15
+ "@pie-lib/editable-html": "^11.21.0",
16
+ "@pie-lib/math-rendering": "^3.22.0",
17
+ "@pie-lib/math-toolbar": "^1.31.0",
18
+ "@pie-lib/render-ui": "^4.35.0",
19
+ "@pie-lib/test-utils": "^0.22.0",
20
20
  "classnames": "^2.2.5",
21
21
  "debug": "^3.1.0",
22
22
  "prop-types": "^15.6.2",
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [8.3.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/math-inline-controller@8.2.0...@pie-element/math-inline-controller@8.3.1) (2025-10-16)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * bump pie-lib versions and pslb module versions ([393d39f](https://github.com/pie-framework/pie-elements/commit/393d39fb850ad055568f4d20464213e9043f208f))
12
+
13
+
14
+
15
+
16
+
6
17
  # [8.3.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/math-inline-controller@8.2.0...@pie-element/math-inline-controller@8.3.0) (2025-10-15)
7
18
 
8
19
  **Note:** Version bump only for package @pie-element/math-inline-controller
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pie-element/math-inline-controller",
3
3
  "private": true,
4
- "version": "8.3.0",
4
+ "version": "8.3.1",
5
5
  "description": "",
6
6
  "main": "lib/index.js",
7
7
  "module": "src/index.js",
@@ -10,8 +10,8 @@
10
10
  },
11
11
  "dependencies": {
12
12
  "@pie-framework/math-validation": "^1.4.2",
13
- "@pie-lib/feedback": "^0.21.4",
14
- "@pie-lib/translator": "^2.20.4",
13
+ "@pie-lib/feedback": "^0.24.0",
14
+ "@pie-lib/translator": "^2.23.0",
15
15
  "debug": "^3.1.0",
16
16
  "lodash": "^4.17.15"
17
17
  },
@@ -1 +1 @@
1
- import{_dll_react as e,_dll_prop_types as t,_dll_material_ui__core as n,_dll_material_ui__core_styles as a,_dll_pie_lib__render_ui as o,_dll_classnames as s,_dll_lodash as i,_dll_material_ui__icons as l,_dll_debug as r,_dll_react_dom as c}from"../../../@pie-lib/shared-module@^1.14.9/module/index.js";import{_dll_pie_lib__config_ui as p}from"../../../@pie-lib/config-module@^2.19.9/module/index.js";import{_dll_pie_lib__editable_html as d}from"../../../@pie-lib/editable-html-module@^5.6.9/module/index.js";import{_dll_pie_lib__math_toolbar as u,_dll_pie_framework__mathquill as m}from"../../../@pie-lib/math-edit-module@^2.5.0/module/index.js";const h=e,g=t,{Card:b}=n,{CardContent:_}=n,{Button:C}=n,{FormControlLabel:y}=n,{Typography:f}=n,{InputLabel:E}=n,{Checkbox:v}=n,{Select:x}=n,{MenuItem:S}=n,{withStyles:w}=a,{color:T}=o,{InputContainer:I}=p,{MathToolbar:A}=u;class k extends h.Component{static __initStatic(){this.propTypes={classes:g.object.isRequired,defaultResponse:g.bool,error:g.object,mode:g.oneOfType([g.string,g.number]),index:g.number,onResponseChange:g.func.isRequired,response:g.object.isRequired,cIgnoreOrder:g.object.isRequired,cAllowTrailingZeros:g.object.isRequired}}static __initStatic2(){this.defaultProps={defaultResponse:!1,mode:"miscellaneous"}}constructor(e){super(e),k.prototype.__init.call(this),k.prototype.__init2.call(this),k.prototype.__init3.call(this),k.prototype.__init4.call(this),k.prototype.__init5.call(this),k.prototype.__init6.call(this),k.prototype.__init7.call(this),k.prototype.__init8.call(this),k.prototype.__init9.call(this),k.prototype.__init10.call(this),k.prototype.__init11.call(this);const{response:{alternates:t}={}}=e||{},n=Object.keys(t||{}).length;this.state={alternateIdCounter:n+1,showKeypad:{openCount:0,main:!1}}}__init(){this.onChange=e=>t=>{const{response:n,onResponseChange:a,index:o}=this.props,s={...n};s[e]=t.target.value,a(s,o)}}__init2(){this.onConfigChanged=e=>t=>{const{response:n,onResponseChange:a,index:o}=this.props,s={...n};s[e]=t.target.checked,a(s,o)}}__init3(){this.onLiteralOptionsChange=e=>()=>{const{response:t,onResponseChange:n,index:a}=this.props,o={...t};o[e]=!t[e],n(o,a)}}__init4(){this.onAnswerChange=e=>{const{response:t,onResponseChange:n,index:a}=this.props,o={...t};o.answer=e,n(o,a)}}__init5(){this.onAlternateAnswerChange=e=>t=>{const{response:n,onResponseChange:a,index:o}=this.props,s={...n};s.alternates[e]=t,a(s,o)}}__init6(){this.onAddAlternate=()=>{const{response:e,onResponseChange:t,index:n}=this.props,{alternateIdCounter:a}=this.state,o={...e};o.alternates||(o.alternates={}),o.alternates[a]="",t(o,n),this.setState({alternateIdCounter:a+1})}}__init7(){this.onRemoveAlternate=e=>()=>{const{response:t,onResponseChange:n,index:a}=this.props,o={...t};delete o.alternates[e],n(o,a),this.setState((t=>({showKeypad:{...t.showKeypad,openCount:t.showKeypad[e]?t.showKeypad.openCount-1:t.showKeypad.openCount}})))}}__init8(){this.onDone=()=>{this.setState((e=>({showKeypad:{...e.showKeypad,openCount:e.showKeypad.openCount-1,main:!1}})))}}__init9(){this.onFocus=()=>{this.setState((e=>({showKeypad:{...e.showKeypad,openCount:e.showKeypad.main?e.showKeypad.openCount:e.showKeypad.openCount+1,main:!0}})))}}__init10(){this.onAlternateFocus=e=>()=>{this.setState((t=>({showKeypad:{...t.showKeypad,openCount:t.showKeypad[e]?t.showKeypad.openCount:t.showKeypad.openCount+1,[e]:!0}})))}}__init11(){this.onAlternateDone=e=>()=>{this.setState((t=>({showKeypad:{...t.showKeypad,openCount:t.showKeypad.openCount-1,[e]:!1}})))}}render(){const{classes:e,mode:t,defaultResponse:n,index:a,response:o,cAllowTrailingZeros:s,cIgnoreOrder:i,error:l}=this.props,{showKeypad:r}=this.state,{validation:c,answer:p,alternates:d,ignoreOrder:u,allowTrailingZeros:m}=o,g=Object.keys(d||{}).length>0,w={editor:e.responseEditor,mathToolbar:e.mathToolbar},T={minHeight:(r.openCount>0?430:230)+"px"};return h.createElement(b,{className:e.responseContainer,style:T},h.createElement(_,{className:e.cardContent},h.createElement("div",{className:e.titleBar},h.createElement(f,{className:e.title,component:"div"},"Response ",""),h.createElement(I,{label:"Validation",className:e.selectContainer},h.createElement(x,{className:e.select,onChange:this.onChange("validation"),value:c||"literal"},h.createElement(S,{value:"literal"},"Literal Validation"),h.createElement(S,{value:"symbolic"},"Symbolic Validation")))),"literal"===c&&h.createElement("div",{className:e.flexContainer},s.enabled&&h.createElement(y,{label:s.label,control:h.createElement(v,{className:e.customColor,checked:m,onChange:this.onLiteralOptionsChange("allowTrailingZeros")})}),i.enabled&&h.createElement(y,{label:i.label,control:h.createElement(v,{className:e.customColor,checked:u,onChange:this.onLiteralOptionsChange("ignoreOrder")})})),h.createElement("div",{className:e.inputContainer},h.createElement(E,null,"Correct Answer"),h.createElement(A,{keypadMode:t,classNames:w,controlledKeypad:!0,showKeypad:r.main,latex:p||"",onChange:this.onAnswerChange,onFocus:this.onFocus,onDone:this.onDone,error:l&&l.answer}),l&&l.answer?h.createElement("div",{className:e.errorText},l.answer):null),g&&Object.keys(d).map(((n,a)=>h.createElement("div",{className:e.inputContainer,key:n},h.createElement("div",{className:e.alternateBar},h.createElement(E,null,"Alternate",Object.keys(d).length>1?` ${a+1}`:""),h.createElement(C,{className:e.removeAlternateButton,type:"secondary",onClick:this.onRemoveAlternate(n)},"Remove")),h.createElement(A,{classNames:w,controlledKeypad:!0,keypadMode:t,showKeypad:r[n]||!1,latex:d[n]||"",onChange:this.onAlternateAnswerChange(n),onFocus:this.onAlternateFocus(n),onDone:this.onAlternateDone(n),error:l&&l[n]}),l&&l[n]?h.createElement("div",{className:e.errorText},l[n]):null))),h.createElement(C,{className:e.alternateButton,type:"primary",onClick:this.onAddAlternate},"ADD ALTERNATE")))}}k.__initStatic(),k.__initStatic2();var N=w((e=>({responseContainer:{marginBottom:2.5*e.spacing.unit,width:"100%",minWidth:"548px",border:`1px solid ${e.palette.grey[700]}`,display:"flex",flexDirection:"column",justifyContent:"space-between"},cardContent:{paddingBottom:2*e.spacing.unit+"px !important"},title:{fontWeight:700,fontSize:"1.2rem",flex:3},selectContainer:{flex:2},inputContainer:{marginBottom:2*e.spacing.unit},titleBar:{display:"flex",alignItems:"center",justifyContent:"space-between"},responseEditor:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",minWidth:"500px",maxWidth:"900px",height:"auto",minHeight:"40px"},mathToolbar:{width:"100%"},alternateButton:{border:`1px solid ${e.palette.grey.A100}`},removeAlternateButton:{marginLeft:2*e.spacing.unit,border:`1px solid ${e.palette.grey.A100}`,color:"gray",fontSize:"0.8rem"},errorText:{fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingTop:e.spacing.unit},customColor:{color:`${T.tertiary()} !important`}})))(k);const R="Advanced Multi",D="Simple",O=(e={},t={})=>({...t,...e}),j=e,M=t,K=s,{withStyles:P}=a,{InputLabel:q}=n,{Select:B}=n,{MenuItem:F}=n,{Tooltip:L}=n,{isEqual:H}=i,{Info:$}=l,z=d,{InputContainer:G}=p,{MathToolbar:Z}=u,W=m;function Y(e){let t,n=e[0],a=1;for(;a<e.length;){const o=e[a],s=e[a+1];if(a+=2,("optionalAccess"===o||"optionalCall"===o)&&null==n)return;"access"===o||"optionalAccess"===o?(t=n,n=s(n)):"call"!==o&&"optionalCall"!==o||(n=s(((...e)=>n.call(t,...e))),t=void 0)}return n}let U=!1;const V=/{{response}}/gm,J=/\\%response\\%/gm,Q=/\\embed\{answerBlock\}\[r\d*\]/g,X=/\\embed\{newLine\}\[\]/g,ee=/\\newline/g;function te(e){if(e){let t=1;return e.replace(V,(()=>`\\embed{answerBlock}[r${t++}]`)).replace(ee,"\\embed{newLine}[]")}}class ne extends j.Component{static __initStatic(){this.propTypes={classes:M.object.isRequired,model:M.object.isRequired,imageSupport:M.object,uploadSoundSupport:M.object,configuration:M.object,onChange:M.func.isRequired,promptEnabled:M.bool,rationaleEnabled:M.bool,toolbarOpts:M.object}}constructor(e){super(e),ne.prototype.__init.call(this),ne.prototype.__init2.call(this),ne.prototype.__init3.call(this),ne.prototype.__init4.call(this),ne.prototype.__init5.call(this),ne.prototype.__init6.call(this),ne.prototype.__init7.call(this);const t={};if(e.model&&e.model.expression){let n=1;e.model.expression.replace(V,(()=>{t["r"+n++]={value:""}}))}this.state={showKeypad:!1,responseAreas:t,responseIdCounter:Object.keys(t).length}}__init(){this.onChange=e=>t=>{const{model:n,onChange:a}=this.props,o={...n};o[e]="object"==typeof t?t.target.value:t,"expression"===e&&(o[e]=function(e){if(e)return e.replace(Q,(()=>"{{response}}")).replace(J,(()=>"{{response}}")).replace(X,(()=>"\\newline"))}(t)),a(o)}}__init2(){this.onDone=()=>{this.setState({showKeypad:!1})}}__init3(){this.onFocus=()=>{this.setState({showKeypad:!0})}}__init4(){this.onPromptFocus=()=>{this.setState({showKeypad:!1})}}UNSAFE_componentWillMount(){const{classes:e}=this.props;if("undefined"!=typeof window){let t=W.getInterface(2);U||(t.registerEmbed("answerBlock",(t=>({htmlString:`<div class="${K(e.blockContainer,e.blockContainerGeneric)}">\n <div class="${K(e.blockResponse,e.blockResponseGeneric)}" id="${t}Index">Response</div>\n </div>`,text:()=>"text",latex:()=>`\\embed{answerBlock}[${t}]`}))),U=!0)}}componentDidMount(){this.handleAnswerBlockDomUpdate()}componentDidUpdate(){this.handleAnswerBlockDomUpdate()}__init5(){this.handleAnswerBlockDomUpdate=()=>{const{model:e}=this.props,t={};if(e&&e.expression){let n=1;e.expression.replace(V,(()=>{t["r"+n++]={value:""}}))}H(t,this.state.responseAreas)||this.setState({responseAreas:t},(()=>{this.root&&Object.keys(t).length&&Object.keys(t).forEach(((e,t)=>{const n=this.root.querySelector(`#${e}`),a=this.root.querySelector(`#${e}Index`);n&&(W.getInterface(2).StaticMath(n),a.textContent=`R${t+1}`)}))}))}}__init6(){this.onAddResponse=()=>{const{model:e,onChange:t}=this.props,{responseIdCounter:n}=this.state,a={...e};let o=n;for(;e.responses.find((e=>e.id===o));)o++;const s={id:o,validation:"literal",answer:"",alternates:{}};a.responses=a.responses.concat(s),t(a),this.setState({responseIdCounter:s.id})}}__init7(){this.onResponseChange=(e,t)=>{const{model:n,onChange:a}=this.props,o={...n};o.responses[t]=e,a(o)}}render(){const{classes:e,model:t,imageSupport:n,uploadSoundSupport:a,configuration:o,promptEnabled:s,rationaleEnabled:i,toolbarOpts:l}=this.props,{showKeypad:r}=this.state,{prompt:c,expression:p,equationEditor:d,promptEquationEditor:u="8",responses:m,responseType:h,rationale:g,spellCheckEnabled:b,errors:_={}}=t,{baseInputConfiguration:C={},rationale:y={},prompt:f={},ignoreOrder:E={},allowTrailingZeros:v={},maxResponseAreas:x,maxImageWidth:S={},maxImageHeight:w={},mathMlOptions:T={}}=o||{},I=((e={},t={})=>{const{maxResponseAreas:n}=t,{responseType:a}=e;let o="";return"Advanced Multi"===a&&(o="\nThere should be at least 1 "+(n?`and at most ${n} `:"")+"response area"+(n?"s":"")+" defined."),"Validation requirements:\nAll correct answers (the primary and any alternates) should not be empty and should be unique."+o})(o,t),{prompt:A,rationale:k,responsesErrors:M,responseAreasError:K}=_,P=S&&S.prompt,H=w&&w.prompt,W={editor:e.responseEditor,mathToolbar:e.mathToolbar},U=h===R?m:m.slice(0,1),V=j.createElement(L,{classes:{tooltip:e.tooltip},disableFocusListener:!0,disableTouchListener:!0,placement:"right",title:I},j.createElement($,{fontSize:"small",color:"primary",style:{marginLeft:"5px"}}));return j.createElement("div",{ref:e=>this.root=e||this.root,className:e.container},s&&j.createElement(G,{label:f.label,className:e.promptHolder},j.createElement(z,{onFocus:this.onPromptFocus,className:e.prompt,markup:c||"",onChange:this.onChange("prompt"),imageSupport:n,nonEmpty:!1,error:A,toolbarOpts:l,pluginProps:O(Y([f,"optionalAccess",e=>e.inputConfiguration]),C),spellCheck:b,maxImageWidth:P,maxImageHeight:H,uploadSoundSupport:a,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:T}),A&&j.createElement("div",{className:e.errorText},A)),h===R&&j.createElement("div",{className:e.advancedResponse},j.createElement("div",{className:e.flexContainer,style:{justifyContent:"flex-start"}},j.createElement("div",{className:e.title},"Define Response"),V),j.createElement(G,{key:"templateEditorType",label:"Response Template Equation Editor",className:e.selectContainer},j.createElement(B,{className:e.select,onChange:this.onChange("promptEquationEditor"),value:u},j.createElement(F,{value:"non-negative-integers"},"Numeric - Non-Negative Integers"),j.createElement(F,{value:"integers"},"Numeric - Integers"),j.createElement(F,{value:"decimals"},"Numeric - Decimals"),j.createElement(F,{value:"fractions"},"Numeric - Fractions"),j.createElement(F,{value:1},"Grade 1 - 2"),j.createElement(F,{value:3},"Grade 3 - 5"),j.createElement(F,{value:6},"Grade 6 - 7"),j.createElement(F,{value:8},"Grade 8 - HS"),j.createElement(F,{value:"geometry"},"Geometry"),j.createElement(F,{value:"advanced-algebra"},"Advanced Algebra"),j.createElement(F,{value:"statistics"},"Statistics"),j.createElement(F,{value:"item-authoring"},"Item Authoring"))),j.createElement("div",{className:e.responseTemplate,key:"templateHolder"},j.createElement(q,{className:e.templateTitle},"RESPONSE TEMPLATE"),j.createElement(Z,{classNames:W,allowAnswerBlock:!0,keypadMode:u,controlledKeypad:!0,showKeypad:r,latex:te(p)||"",onChange:this.onChange("expression"),onFocus:this.onFocus,onDone:this.onDone,maxResponseAreas:x,error:K})),K&&j.createElement("div",{className:e.errorText},K)),j.createElement("div",{className:e.flexContainer,style:{justifyContent:"flex-start"}},j.createElement("div",{className:e.title},"Define Correct Response"),h===D?V:null),j.createElement(G,{label:"Equation Editor",className:e.selectContainer},j.createElement(B,{className:e.select,onChange:this.onChange("equationEditor"),value:d},j.createElement(F,{value:"non-negative-integers"},"Numeric - Non-Negative Integers"),j.createElement(F,{value:"integers"},"Numeric - Integers"),j.createElement(F,{value:"decimals"},"Numeric - Decimals"),j.createElement(F,{value:"fractions"},"Numeric - Fractions"),j.createElement(F,{value:1},"Grade 1 - 2"),j.createElement(F,{value:3},"Grade 3 - 5"),j.createElement(F,{value:6},"Grade 6 - 7"),j.createElement(F,{value:8},"Grade 8 - HS"),j.createElement(F,{value:"geometry"},"Geometry"),j.createElement(F,{value:"advanced-algebra"},"Advanced Algebra"),j.createElement(F,{value:"statistics"},"Statistics"),j.createElement(F,{value:"item-authoring"},"Item Authoring"))),U.map(((e,t)=>j.createElement(N,{key:e.id,mode:d,response:e,defaultResponse:h===D,onResponseChange:this.onResponseChange,index:t,cIgnoreOrder:E,cAllowTrailingZeros:v,error:M&&M[t]}))),i&&j.createElement(G,{label:y.label,className:e.promptHolder},j.createElement(z,{className:e.prompt,markup:g||"",onChange:this.onChange("rationale"),imageSupport:n,nonEmpty:!1,error:k,toolbarOpts:l,pluginProps:O(Y([y,"optionalAccess",e=>e.inputConfiguration]),{...C,math:{controlledKeypadMode:!1}}),spellCheck:b,maxImageWidth:S&&S.rationale||P,maxImageHeight:w&&w.rationale||H,uploadSoundSupport:a,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:T}),k&&j.createElement("div",{className:e.errorText},k)))}}ne.__initStatic();var ae=P((e=>({container:{display:"flex",flexDirection:"column"},templateTitle:{fontSize:"0.85rem"},title:{fontSize:"1.1rem"},addResponseButton:{border:`1px solid ${e.palette.grey.A100}`,float:"right",width:"150px"},flexContainer:{display:"flex",alignItems:"center",justifyContent:"space-between"},selectContainer:{flex:"initial",width:"40%",marginTop:2*e.spacing.unit,marginBottom:2*e.spacing.unit},responseTemplate:{display:"flex",flexDirection:"column"},responseEditor:{display:"flex",justifyContent:"center",width:"100%",maxWidth:"inherit",height:"auto",minHeight:"130px",textAlign:"left",padding:e.spacing.unit},promptHolder:{width:"100%",paddingTop:2*e.spacing.unit,marginBottom:2*e.spacing.unit},blockContainer:{margin:e.spacing.unit,display:"inline-flex",border:"2px solid grey"},blockContainerGeneric:{margin:e.spacing.unit/2},blockResponse:{flex:2,color:"grey",background:e.palette.grey.A100,fontSize:"0.8rem",padding:e.spacing.unit/2,display:"flex",alignItems:"center",justifyContent:"center",borderRight:"2px solid grey"},blockResponseGeneric:{borderRight:0},blockMath:{color:e.palette.grey[400],padding:e.spacing.unit/2,display:"flex",alignItems:"center",justifyContent:"center",flex:8,"& > .mq-math-mode":{"& > .mq-hasCursor":{"& > .mq-cursor":{display:"none"}}}},tooltip:{fontSize:e.typography.fontSize-2,whiteSpace:"pre-wrap"},errorText:{fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingTop:e.spacing.unit},advancedResponse:{marginBottom:2.5*e.spacing.unit}})))(ne);const oe=e,{withStyles:se}=a,ie=t,le=r,{FeedbackConfig:re}=p,{settings:ce}=p,{layout:pe}=p,{InputContainer:de}=p,ue=d;function me(e){let t,n=e[0],a=1;for(;a<e.length;){const o=e[a],s=e[a+1];if(a+=2,("optionalAccess"===o||"optionalCall"===o)&&null==n)return;"access"===o||"optionalAccess"===o?(t=n,n=s(n)):"call"!==o&&"optionalCall"!==o||(n=s(((...e)=>n.call(t,...e))),t=void 0)}return n}const he=le("@pie-element:math-inline:configure"),{Panel:ge,toggle:be,radio:_e,dropdown:Ce}=ce;class ye extends oe.Component{constructor(...e){super(...e),ye.prototype.__init.call(this),ye.prototype.__init2.call(this),ye.prototype.__init3.call(this)}static __initStatic(){this.propTypes={onModelChanged:ie.func,onConfigurationChanged:ie.func,classes:ie.object,model:ie.object.isRequired,configuration:ie.object.isRequired,imageSupport:ie.object,uploadSoundSupport:ie.object}}__init(){this.onChange=e=>{this.props.onModelChanged(e)}}__init2(){this.changeTeacherInstructions=e=>{this.props.onModelChanged({...this.props.model,teacherInstructions:e})}}__init3(){this.onFeedbackChange=e=>{const{model:t,onModelChanged:n}=this.props;t.feedback=e,n(t)}}render(){const{classes:e,model:t,imageSupport:n,onModelChanged:a,configuration:o,onConfigurationChanged:s,uploadSoundSupport:i}=this.props,{allowTrailingZeros:l={},baseInputConfiguration:r={},contentDimensions:c={},feedback:p={},ignoreOrder:d={},maxImageWidth:u={},maxImageHeight:m={},prompt:h={},rationale:g={},responseType:b={},scoringType:_={},settingsPanelDisabled:C,spellCheck:y={},studentInstructions:f={},teacherInstructions:E={},withRubric:v={},mathMlOptions:x={},language:S={},languageChoices:w={}}=o||{},{errors:T={},extraCSSRules:I,feedbackEnabled:A,promptEnabled:k,rationaleEnabled:N,spellCheckEnabled:j,teacherInstructionsEnabled:M,toolbarEditorPosition:K}=t||{},{teacherInstructions:P}=T;he("[render] model",t);const q={position:"top"===K?"top":"bottom"},B=u&&u.prompt,F=m&&m.prompt,L={responseType:b.settings&&_e(b.label,[D,R]),feedbackEnabled:p.settings&&be(p.label),promptEnabled:h.settings&&be(h.label),"language.enabled":S.settings&&be(S.label,!0),language:S.settings&&S.enabled&&Ce(w.label,w.options)},H={teacherInstructionsEnabled:E.settings&&be(E.label),studentInstructionsEnabled:f.settings&&be(f.label),rationaleEnabled:g.settings&&be(g.label),spellCheckEnabled:y.settings&&be(y.label),scoringType:_.settings&&_e(_.label,["auto","rubric"]),"ignoreOrder.enabled":d.settings&&be(d.label),"allowTrailingZeros.enabled":l.settings&&be(l.label),rubricEnabled:me([v,"optionalAccess",e=>e.settings])&&be(me([v,"optionalAccess",e=>e.label]))};return oe.createElement(pe.ConfigLayout,{extraCSSRules:I,dimensions:c,hideSettings:C,settings:oe.createElement(ge,{model:t,configuration:o,onChangeModel:e=>a(e),onChangeConfiguration:e=>s(e),groups:{Settings:L,Properties:H}})},M&&oe.createElement(de,{label:E.label,className:e.promptHolder},oe.createElement(ue,{className:e.prompt,markup:t.teacherInstructions||"",onChange:this.changeTeacherInstructions,imageSupport:n,nonEmpty:!1,error:P,toolbarOpts:q,pluginProps:O(me([E,"optionalAccess",e=>e.inputConfiguration]),r),spellCheck:j,maxImageWidth:u&&u.teacherInstructions||B,maxImageHeight:m&&m.teacherInstructions||F,uploadSoundSupport:i,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:x}),P&&oe.createElement("div",{className:e.errorText},P)),oe.createElement(ae,{imageSupport:n,uploadSoundSupport:i,model:t,configuration:o,onChange:this.onChange,rationaleEnabled:N,promptEnabled:k,toolbarOpts:q,spellCheck:j}),A&&oe.createElement(re,{feedback:t.feedback,onChange:this.onFeedbackChange,toolbarOpts:q}))}}ye.__initStatic();var fe=se((e=>({promptHolder:{width:"100%",paddingTop:2*e.spacing.unit,marginBottom:2*e.spacing.unit},errorText:{fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingTop:e.spacing.unit}})))(ye),Ee={};Object.defineProperty(Ee,"__esModule",{value:!0});class ve extends CustomEvent{constructor(e,t=!1){super(ve.TYPE,{bubbles:!0,detail:{update:e,reset:t}}),this.update=e,this.reset=t}}ve.TYPE="model.updated";var xe=Ee.ModelUpdatedEvent=ve;class Se extends CustomEvent{constructor(e,t){super(Se.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}Se.TYPE="delete.image";var we=Ee.DeleteImageEvent=Se;class Te extends CustomEvent{constructor(e){super(Te.TYPE,{bubbles:!0,detail:e}),this.handler=e}}Te.TYPE="insert.image";var Ie=Ee.InsertImageEvent=Te;class Ae extends CustomEvent{constructor(e,t){super(Ae.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}Ae.TYPE="delete.sound";var ke=Ee.DeleteSoundEvent=Ae;class Ne extends CustomEvent{constructor(e){super(Ne.TYPE,{bubbles:!0,detail:e}),this.handler=e}}Ne.TYPE="insert.sound";var Re=Ee.InsertSoundEvent=Ne,De={allowTrailingZerosDefault:!1,customKeys:[],equationEditor:"8",expression:"",feedback:{correct:{default:"Correct",type:"none"},incorrect:{default:"Incorrect",type:"none"},partial:{default:"Nearly",type:"none"}},feedbackEnabled:!1,ignoreOrderDefault:!1,partialScoring:!0,prompt:"",promptEnabled:!0,rationale:"",rationaleEnabled:!0,responseType:R,responses:[],scoringType:"auto",studentInstructionsEnabled:!0,teacherInstructions:"",teacherInstructionsEnabled:!0,toolbarEditorPosition:"bottom",validationDefault:"literal"},Oe={baseInputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1},textAlign:{disabled:!0},showParagraphs:{disabled:!1},separateParagraphs:{disabled:!0}},prompt:{settings:!0,label:"Prompt",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},feedback:{settings:!0,label:"Feedback"},responseType:{settings:!0,label:"Response type"},rationale:{settings:!0,label:"Rationale",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},settingsPanelDisabled:!1,spellCheck:{label:"Spellcheck",settings:!1,enabled:!0},scoringType:{settings:!1,label:"Scoring Type"},studentInstructions:{settings:!1,label:"Student Instructions"},teacherInstructions:{settings:!0,label:"Teacher Instructions",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},partialScoring:{settings:!1,label:"Allow Partial Scoring"},ignoreOrder:{settings:!1,label:"Ignore Order",enabled:!0},allowTrailingZeros:{settings:!1,label:"Allow Trailing Zeros",enabled:!0},maxImageWidth:{teacherInstructions:300,prompt:300,rationale:300},maxImageHeight:{teacherInstructions:300,prompt:300,rationale:300},withRubric:{settings:!1,label:"Add Rubric"},mathMlOptions:{mmlOutput:!1,mmlEditing:!1},language:{settings:!1,label:"Specify Language",enabled:!1},languageChoices:{label:"Language Choices",options:[]}};const je=e,Me=c,{isEmpty:Ke}=i;function Pe(e){let t,n=e[0],a=1;for(;a<e.length;){const o=e[a],s=e[a+1];if(a+=2,("optionalAccess"===o||"optionalCall"===o)&&null==n)return;"access"===o||"optionalAccess"===o?(t=n,n=s(n)):"call"!==o&&"optionalCall"!==o||(n=s(((...e)=>n.call(t,...e))),t=void 0)}return n}const qe=r("pie-elements:math-inline:configure");class Be extends HTMLElement{static __initStatic(){this.createDefaultModel=(e={})=>(Ke(e.responses)||(e.responses=e.responses.map((e=>({...e,validation:e.validation||De.validationDefault,allowTrailingZeros:e.allowTrailingZeros||De.allowTrailingZerosDefault,ignoreOrder:e.ignoreOrder||De.ignoreOrderDefault||!1})))),{...De,...e})}constructor(){super(),this._model=Be.createDefaultModel(),this._configuration=Oe}set model(e){this._model=Be.createDefaultModel(e),this._render()}set configuration(e){const t={...Oe,...e};this._configuration=t,Pe([t,"optionalAccess",e=>e.language,"optionalAccess",e=>e.enabled])?Pe([t,"optionalAccess",e=>e.languageChoices,"optionalAccess",e=>e.options,"optionalAccess",e=>e.length])&&(this._model.language=Pe([t,"optionalAccess",e=>e.languageChoices,"access",e=>e.options,"access",e=>e[0],"access",e=>e.value])):t.language.settings&&this._model.language?(this._configuration.language.enabled=!0,this._configuration.languageChoices.options&&this._configuration.languageChoices.options.length||(this._configuration.languageChoices.options=[]),this._configuration.languageChoices.options.find((e=>e.value===this._model.language))||this._configuration.languageChoices.options.push({value:this._model.language,label:this._model.language})):delete this._model.language,this._render()}onModelChanged(e){this._model=e,qe("[onModelChanged]: ",this._model),this._render(),this.dispatchEvent(new xe(this._model))}onConfigurationChanged(e){this._configuration=e,this._model&&this.onModelChanged(this._model),this._render()}insertImage(e){this.dispatchEvent(new Ie(e))}onDeleteImage(e,t){this.dispatchEvent(new we(e,t))}insertSound(e){this.dispatchEvent(new Re(e))}onDeleteSound(e,t){this.dispatchEvent(new ke(e,t))}_render(){if(this._model){const e=je.createElement(fe,{onModelChanged:this.onModelChanged.bind(this),onConfigurationChanged:this.onConfigurationChanged.bind(this),model:this._model,configuration:this._configuration,imageSupport:{add:this.insertImage.bind(this),delete:this.onDeleteImage.bind(this)},uploadSoundSupport:{add:this.insertSound.bind(this),delete:this.onDeleteSound.bind(this)}});Me.render(e,this)}}}Be.__initStatic();export{Be as default};
1
+ import{_dll_react as e,_dll_prop_types as t,_dll_material_ui__core as n,_dll_material_ui__core_styles as a,_dll_pie_lib__render_ui as o,_dll_classnames as s,_dll_lodash as i,_dll_material_ui__icons as l,_dll_debug as r,_dll_react_dom as c}from"../../../@pie-lib/shared-module@^1.17.0/module/index.js";import{_dll_pie_lib__config_ui as p}from"../../../@pie-lib/config-module@^2.22.0/module/index.js";import{_dll_pie_lib__editable_html as d}from"../../../@pie-lib/editable-html-module@^5.9.0/module/index.js";import{_dll_pie_lib__math_toolbar as u,_dll_pie_framework__mathquill as m}from"../../../@pie-lib/math-edit-module@^2.8.0/module/index.js";const h=e,g=t,{Card:b}=n,{CardContent:_}=n,{Button:C}=n,{FormControlLabel:y}=n,{Typography:f}=n,{InputLabel:E}=n,{Checkbox:v}=n,{Select:x}=n,{MenuItem:S}=n,{withStyles:w}=a,{color:T}=o,{InputContainer:I}=p,{MathToolbar:A}=u;class k extends h.Component{static __initStatic(){this.propTypes={classes:g.object.isRequired,defaultResponse:g.bool,error:g.object,mode:g.oneOfType([g.string,g.number]),index:g.number,onResponseChange:g.func.isRequired,response:g.object.isRequired,cIgnoreOrder:g.object.isRequired,cAllowTrailingZeros:g.object.isRequired}}static __initStatic2(){this.defaultProps={defaultResponse:!1,mode:"miscellaneous"}}constructor(e){super(e),k.prototype.__init.call(this),k.prototype.__init2.call(this),k.prototype.__init3.call(this),k.prototype.__init4.call(this),k.prototype.__init5.call(this),k.prototype.__init6.call(this),k.prototype.__init7.call(this),k.prototype.__init8.call(this),k.prototype.__init9.call(this),k.prototype.__init10.call(this),k.prototype.__init11.call(this);const{response:{alternates:t}={}}=e||{},n=Object.keys(t||{}).length;this.state={alternateIdCounter:n+1,showKeypad:{openCount:0,main:!1}}}__init(){this.onChange=e=>t=>{const{response:n,onResponseChange:a,index:o}=this.props,s={...n};s[e]=t.target.value,a(s,o)}}__init2(){this.onConfigChanged=e=>t=>{const{response:n,onResponseChange:a,index:o}=this.props,s={...n};s[e]=t.target.checked,a(s,o)}}__init3(){this.onLiteralOptionsChange=e=>()=>{const{response:t,onResponseChange:n,index:a}=this.props,o={...t};o[e]=!t[e],n(o,a)}}__init4(){this.onAnswerChange=e=>{const{response:t,onResponseChange:n,index:a}=this.props,o={...t};o.answer=e,n(o,a)}}__init5(){this.onAlternateAnswerChange=e=>t=>{const{response:n,onResponseChange:a,index:o}=this.props,s={...n};s.alternates[e]=t,a(s,o)}}__init6(){this.onAddAlternate=()=>{const{response:e,onResponseChange:t,index:n}=this.props,{alternateIdCounter:a}=this.state,o={...e};o.alternates||(o.alternates={}),o.alternates[a]="",t(o,n),this.setState({alternateIdCounter:a+1})}}__init7(){this.onRemoveAlternate=e=>()=>{const{response:t,onResponseChange:n,index:a}=this.props,o={...t};delete o.alternates[e],n(o,a),this.setState((t=>({showKeypad:{...t.showKeypad,openCount:t.showKeypad[e]?t.showKeypad.openCount-1:t.showKeypad.openCount}})))}}__init8(){this.onDone=()=>{this.setState((e=>({showKeypad:{...e.showKeypad,openCount:e.showKeypad.openCount-1,main:!1}})))}}__init9(){this.onFocus=()=>{this.setState((e=>({showKeypad:{...e.showKeypad,openCount:e.showKeypad.main?e.showKeypad.openCount:e.showKeypad.openCount+1,main:!0}})))}}__init10(){this.onAlternateFocus=e=>()=>{this.setState((t=>({showKeypad:{...t.showKeypad,openCount:t.showKeypad[e]?t.showKeypad.openCount:t.showKeypad.openCount+1,[e]:!0}})))}}__init11(){this.onAlternateDone=e=>()=>{this.setState((t=>({showKeypad:{...t.showKeypad,openCount:t.showKeypad.openCount-1,[e]:!1}})))}}render(){const{classes:e,mode:t,defaultResponse:n,index:a,response:o,cAllowTrailingZeros:s,cIgnoreOrder:i,error:l}=this.props,{showKeypad:r}=this.state,{validation:c,answer:p,alternates:d,ignoreOrder:u,allowTrailingZeros:m}=o,g=Object.keys(d||{}).length>0,w={editor:e.responseEditor,mathToolbar:e.mathToolbar},T={minHeight:(r.openCount>0?430:230)+"px"};return h.createElement(b,{className:e.responseContainer,style:T},h.createElement(_,{className:e.cardContent},h.createElement("div",{className:e.titleBar},h.createElement(f,{className:e.title,component:"div"},"Response ",""),h.createElement(I,{label:"Validation",className:e.selectContainer},h.createElement(x,{className:e.select,onChange:this.onChange("validation"),value:c||"literal"},h.createElement(S,{value:"literal"},"Literal Validation"),h.createElement(S,{value:"symbolic"},"Symbolic Validation")))),"literal"===c&&h.createElement("div",{className:e.flexContainer},s.enabled&&h.createElement(y,{label:s.label,control:h.createElement(v,{className:e.customColor,checked:m,onChange:this.onLiteralOptionsChange("allowTrailingZeros")})}),i.enabled&&h.createElement(y,{label:i.label,control:h.createElement(v,{className:e.customColor,checked:u,onChange:this.onLiteralOptionsChange("ignoreOrder")})})),h.createElement("div",{className:e.inputContainer},h.createElement(E,null,"Correct Answer"),h.createElement(A,{keypadMode:t,classNames:w,controlledKeypad:!0,showKeypad:r.main,latex:p||"",onChange:this.onAnswerChange,onFocus:this.onFocus,onDone:this.onDone,error:l&&l.answer}),l&&l.answer?h.createElement("div",{className:e.errorText},l.answer):null),g&&Object.keys(d).map(((n,a)=>h.createElement("div",{className:e.inputContainer,key:n},h.createElement("div",{className:e.alternateBar},h.createElement(E,null,"Alternate",Object.keys(d).length>1?` ${a+1}`:""),h.createElement(C,{className:e.removeAlternateButton,type:"secondary",onClick:this.onRemoveAlternate(n)},"Remove")),h.createElement(A,{classNames:w,controlledKeypad:!0,keypadMode:t,showKeypad:r[n]||!1,latex:d[n]||"",onChange:this.onAlternateAnswerChange(n),onFocus:this.onAlternateFocus(n),onDone:this.onAlternateDone(n),error:l&&l[n]}),l&&l[n]?h.createElement("div",{className:e.errorText},l[n]):null))),h.createElement(C,{className:e.alternateButton,type:"primary",onClick:this.onAddAlternate},"ADD ALTERNATE")))}}k.__initStatic(),k.__initStatic2();var N=w((e=>({responseContainer:{marginBottom:2.5*e.spacing.unit,width:"100%",minWidth:"548px",border:`1px solid ${e.palette.grey[700]}`,display:"flex",flexDirection:"column",justifyContent:"space-between"},cardContent:{paddingBottom:2*e.spacing.unit+"px !important"},title:{fontWeight:700,fontSize:"1.2rem",flex:3},selectContainer:{flex:2},inputContainer:{marginBottom:2*e.spacing.unit},titleBar:{display:"flex",alignItems:"center",justifyContent:"space-between"},responseEditor:{display:"flex",alignItems:"center",justifyContent:"center",width:"100%",minWidth:"500px",maxWidth:"900px",height:"auto",minHeight:"40px"},mathToolbar:{width:"100%"},alternateButton:{border:`1px solid ${e.palette.grey.A100}`},removeAlternateButton:{marginLeft:2*e.spacing.unit,border:`1px solid ${e.palette.grey.A100}`,color:"gray",fontSize:"0.8rem"},errorText:{fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingTop:e.spacing.unit},customColor:{color:`${T.tertiary()} !important`}})))(k);const R="Advanced Multi",D="Simple",O=(e={},t={})=>({...t,...e}),j=e,M=t,K=s,{withStyles:P}=a,{InputLabel:q}=n,{Select:B}=n,{MenuItem:F}=n,{Tooltip:L}=n,{isEqual:H}=i,{Info:$}=l,z=d,{InputContainer:G}=p,{MathToolbar:Z}=u,W=m;function Y(e){let t,n=e[0],a=1;for(;a<e.length;){const o=e[a],s=e[a+1];if(a+=2,("optionalAccess"===o||"optionalCall"===o)&&null==n)return;"access"===o||"optionalAccess"===o?(t=n,n=s(n)):"call"!==o&&"optionalCall"!==o||(n=s(((...e)=>n.call(t,...e))),t=void 0)}return n}let U=!1;const V=/{{response}}/gm,J=/\\%response\\%/gm,Q=/\\embed\{answerBlock\}\[r\d*\]/g,X=/\\embed\{newLine\}\[\]/g,ee=/\\newline/g;function te(e){if(e){let t=1;return e.replace(V,(()=>`\\embed{answerBlock}[r${t++}]`)).replace(ee,"\\embed{newLine}[]")}}class ne extends j.Component{static __initStatic(){this.propTypes={classes:M.object.isRequired,model:M.object.isRequired,imageSupport:M.object,uploadSoundSupport:M.object,configuration:M.object,onChange:M.func.isRequired,promptEnabled:M.bool,rationaleEnabled:M.bool,toolbarOpts:M.object}}constructor(e){super(e),ne.prototype.__init.call(this),ne.prototype.__init2.call(this),ne.prototype.__init3.call(this),ne.prototype.__init4.call(this),ne.prototype.__init5.call(this),ne.prototype.__init6.call(this),ne.prototype.__init7.call(this);const t={};if(e.model&&e.model.expression){let n=1;e.model.expression.replace(V,(()=>{t["r"+n++]={value:""}}))}this.state={showKeypad:!1,responseAreas:t,responseIdCounter:Object.keys(t).length}}__init(){this.onChange=e=>t=>{const{model:n,onChange:a}=this.props,o={...n};o[e]="object"==typeof t?t.target.value:t,"expression"===e&&(o[e]=function(e){if(e)return e.replace(Q,(()=>"{{response}}")).replace(J,(()=>"{{response}}")).replace(X,(()=>"\\newline"))}(t)),a(o)}}__init2(){this.onDone=()=>{this.setState({showKeypad:!1})}}__init3(){this.onFocus=()=>{this.setState({showKeypad:!0})}}__init4(){this.onPromptFocus=()=>{this.setState({showKeypad:!1})}}UNSAFE_componentWillMount(){const{classes:e}=this.props;if("undefined"!=typeof window){let t=W.getInterface(2);U||(t.registerEmbed("answerBlock",(t=>({htmlString:`<div class="${K(e.blockContainer,e.blockContainerGeneric)}">\n <div class="${K(e.blockResponse,e.blockResponseGeneric)}" id="${t}Index">Response</div>\n </div>`,text:()=>"text",latex:()=>`\\embed{answerBlock}[${t}]`}))),U=!0)}}componentDidMount(){this.handleAnswerBlockDomUpdate()}componentDidUpdate(){this.handleAnswerBlockDomUpdate()}__init5(){this.handleAnswerBlockDomUpdate=()=>{const{model:e}=this.props,t={};if(e&&e.expression){let n=1;e.expression.replace(V,(()=>{t["r"+n++]={value:""}}))}H(t,this.state.responseAreas)||this.setState({responseAreas:t},(()=>{this.root&&Object.keys(t).length&&Object.keys(t).forEach(((e,t)=>{const n=this.root.querySelector(`#${e}`),a=this.root.querySelector(`#${e}Index`);n&&(W.getInterface(2).StaticMath(n),a.textContent=`R${t+1}`)}))}))}}__init6(){this.onAddResponse=()=>{const{model:e,onChange:t}=this.props,{responseIdCounter:n}=this.state,a={...e};let o=n;for(;e.responses.find((e=>e.id===o));)o++;const s={id:o,validation:"literal",answer:"",alternates:{}};a.responses=a.responses.concat(s),t(a),this.setState({responseIdCounter:s.id})}}__init7(){this.onResponseChange=(e,t)=>{const{model:n,onChange:a}=this.props,o={...n};o.responses[t]=e,a(o)}}render(){const{classes:e,model:t,imageSupport:n,uploadSoundSupport:a,configuration:o,promptEnabled:s,rationaleEnabled:i,toolbarOpts:l}=this.props,{showKeypad:r}=this.state,{prompt:c,expression:p,equationEditor:d,promptEquationEditor:u="8",responses:m,responseType:h,rationale:g,spellCheckEnabled:b,errors:_={}}=t,{baseInputConfiguration:C={},rationale:y={},prompt:f={},ignoreOrder:E={},allowTrailingZeros:v={},maxResponseAreas:x,maxImageWidth:S={},maxImageHeight:w={},mathMlOptions:T={}}=o||{},I=((e={},t={})=>{const{maxResponseAreas:n}=t,{responseType:a}=e;let o="";return"Advanced Multi"===a&&(o="\nThere should be at least 1 "+(n?`and at most ${n} `:"")+"response area"+(n?"s":"")+" defined."),"Validation requirements:\nAll correct answers (the primary and any alternates) should not be empty and should be unique."+o})(o,t),{prompt:A,rationale:k,responsesErrors:M,responseAreasError:K}=_,P=S&&S.prompt,H=w&&w.prompt,W={editor:e.responseEditor,mathToolbar:e.mathToolbar},U=h===R?m:m.slice(0,1),V=j.createElement(L,{classes:{tooltip:e.tooltip},disableFocusListener:!0,disableTouchListener:!0,placement:"right",title:I},j.createElement($,{fontSize:"small",color:"primary",style:{marginLeft:"5px"}}));return j.createElement("div",{ref:e=>this.root=e||this.root,className:e.container},s&&j.createElement(G,{label:f.label,className:e.promptHolder},j.createElement(z,{onFocus:this.onPromptFocus,className:e.prompt,markup:c||"",onChange:this.onChange("prompt"),imageSupport:n,nonEmpty:!1,error:A,toolbarOpts:l,pluginProps:O(Y([f,"optionalAccess",e=>e.inputConfiguration]),C),spellCheck:b,maxImageWidth:P,maxImageHeight:H,uploadSoundSupport:a,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:T}),A&&j.createElement("div",{className:e.errorText},A)),h===R&&j.createElement("div",{className:e.advancedResponse},j.createElement("div",{className:e.flexContainer,style:{justifyContent:"flex-start"}},j.createElement("div",{className:e.title},"Define Response"),V),j.createElement(G,{key:"templateEditorType",label:"Response Template Equation Editor",className:e.selectContainer},j.createElement(B,{className:e.select,onChange:this.onChange("promptEquationEditor"),value:u},j.createElement(F,{value:"non-negative-integers"},"Numeric - Non-Negative Integers"),j.createElement(F,{value:"integers"},"Numeric - Integers"),j.createElement(F,{value:"decimals"},"Numeric - Decimals"),j.createElement(F,{value:"fractions"},"Numeric - Fractions"),j.createElement(F,{value:1},"Grade 1 - 2"),j.createElement(F,{value:3},"Grade 3 - 5"),j.createElement(F,{value:6},"Grade 6 - 7"),j.createElement(F,{value:8},"Grade 8 - HS"),j.createElement(F,{value:"geometry"},"Geometry"),j.createElement(F,{value:"advanced-algebra"},"Advanced Algebra"),j.createElement(F,{value:"statistics"},"Statistics"),j.createElement(F,{value:"item-authoring"},"Item Authoring"))),j.createElement("div",{className:e.responseTemplate,key:"templateHolder"},j.createElement(q,{className:e.templateTitle},"RESPONSE TEMPLATE"),j.createElement(Z,{classNames:W,allowAnswerBlock:!0,keypadMode:u,controlledKeypad:!0,showKeypad:r,latex:te(p)||"",onChange:this.onChange("expression"),onFocus:this.onFocus,onDone:this.onDone,maxResponseAreas:x,error:K})),K&&j.createElement("div",{className:e.errorText},K)),j.createElement("div",{className:e.flexContainer,style:{justifyContent:"flex-start"}},j.createElement("div",{className:e.title},"Define Correct Response"),h===D?V:null),j.createElement(G,{label:"Equation Editor",className:e.selectContainer},j.createElement(B,{className:e.select,onChange:this.onChange("equationEditor"),value:d},j.createElement(F,{value:"non-negative-integers"},"Numeric - Non-Negative Integers"),j.createElement(F,{value:"integers"},"Numeric - Integers"),j.createElement(F,{value:"decimals"},"Numeric - Decimals"),j.createElement(F,{value:"fractions"},"Numeric - Fractions"),j.createElement(F,{value:1},"Grade 1 - 2"),j.createElement(F,{value:3},"Grade 3 - 5"),j.createElement(F,{value:6},"Grade 6 - 7"),j.createElement(F,{value:8},"Grade 8 - HS"),j.createElement(F,{value:"geometry"},"Geometry"),j.createElement(F,{value:"advanced-algebra"},"Advanced Algebra"),j.createElement(F,{value:"statistics"},"Statistics"),j.createElement(F,{value:"item-authoring"},"Item Authoring"))),U.map(((e,t)=>j.createElement(N,{key:e.id,mode:d,response:e,defaultResponse:h===D,onResponseChange:this.onResponseChange,index:t,cIgnoreOrder:E,cAllowTrailingZeros:v,error:M&&M[t]}))),i&&j.createElement(G,{label:y.label,className:e.promptHolder},j.createElement(z,{className:e.prompt,markup:g||"",onChange:this.onChange("rationale"),imageSupport:n,nonEmpty:!1,error:k,toolbarOpts:l,pluginProps:O(Y([y,"optionalAccess",e=>e.inputConfiguration]),{...C,math:{controlledKeypadMode:!1}}),spellCheck:b,maxImageWidth:S&&S.rationale||P,maxImageHeight:w&&w.rationale||H,uploadSoundSupport:a,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:T}),k&&j.createElement("div",{className:e.errorText},k)))}}ne.__initStatic();var ae=P((e=>({container:{display:"flex",flexDirection:"column"},templateTitle:{fontSize:"0.85rem"},title:{fontSize:"1.1rem"},addResponseButton:{border:`1px solid ${e.palette.grey.A100}`,float:"right",width:"150px"},flexContainer:{display:"flex",alignItems:"center",justifyContent:"space-between"},selectContainer:{flex:"initial",width:"40%",marginTop:2*e.spacing.unit,marginBottom:2*e.spacing.unit},responseTemplate:{display:"flex",flexDirection:"column"},responseEditor:{display:"flex",justifyContent:"center",width:"100%",maxWidth:"inherit",height:"auto",minHeight:"130px",textAlign:"left",padding:e.spacing.unit},promptHolder:{width:"100%",paddingTop:2*e.spacing.unit,marginBottom:2*e.spacing.unit},blockContainer:{margin:e.spacing.unit,display:"inline-flex",border:"2px solid grey"},blockContainerGeneric:{margin:e.spacing.unit/2},blockResponse:{flex:2,color:"grey",background:e.palette.grey.A100,fontSize:"0.8rem",padding:e.spacing.unit/2,display:"flex",alignItems:"center",justifyContent:"center",borderRight:"2px solid grey"},blockResponseGeneric:{borderRight:0},blockMath:{color:e.palette.grey[400],padding:e.spacing.unit/2,display:"flex",alignItems:"center",justifyContent:"center",flex:8,"& > .mq-math-mode":{"& > .mq-hasCursor":{"& > .mq-cursor":{display:"none"}}}},tooltip:{fontSize:e.typography.fontSize-2,whiteSpace:"pre-wrap"},errorText:{fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingTop:e.spacing.unit},advancedResponse:{marginBottom:2.5*e.spacing.unit}})))(ne);const oe=e,{withStyles:se}=a,ie=t,le=r,{FeedbackConfig:re}=p,{settings:ce}=p,{layout:pe}=p,{InputContainer:de}=p,ue=d;function me(e){let t,n=e[0],a=1;for(;a<e.length;){const o=e[a],s=e[a+1];if(a+=2,("optionalAccess"===o||"optionalCall"===o)&&null==n)return;"access"===o||"optionalAccess"===o?(t=n,n=s(n)):"call"!==o&&"optionalCall"!==o||(n=s(((...e)=>n.call(t,...e))),t=void 0)}return n}const he=le("@pie-element:math-inline:configure"),{Panel:ge,toggle:be,radio:_e,dropdown:Ce}=ce;class ye extends oe.Component{constructor(...e){super(...e),ye.prototype.__init.call(this),ye.prototype.__init2.call(this),ye.prototype.__init3.call(this)}static __initStatic(){this.propTypes={onModelChanged:ie.func,onConfigurationChanged:ie.func,classes:ie.object,model:ie.object.isRequired,configuration:ie.object.isRequired,imageSupport:ie.object,uploadSoundSupport:ie.object}}__init(){this.onChange=e=>{this.props.onModelChanged(e)}}__init2(){this.changeTeacherInstructions=e=>{this.props.onModelChanged({...this.props.model,teacherInstructions:e})}}__init3(){this.onFeedbackChange=e=>{const{model:t,onModelChanged:n}=this.props;t.feedback=e,n(t)}}render(){const{classes:e,model:t,imageSupport:n,onModelChanged:a,configuration:o,onConfigurationChanged:s,uploadSoundSupport:i}=this.props,{allowTrailingZeros:l={},baseInputConfiguration:r={},contentDimensions:c={},feedback:p={},ignoreOrder:d={},maxImageWidth:u={},maxImageHeight:m={},prompt:h={},rationale:g={},responseType:b={},scoringType:_={},settingsPanelDisabled:C,spellCheck:y={},studentInstructions:f={},teacherInstructions:E={},withRubric:v={},mathMlOptions:x={},language:S={},languageChoices:w={}}=o||{},{errors:T={},extraCSSRules:I,feedbackEnabled:A,promptEnabled:k,rationaleEnabled:N,spellCheckEnabled:j,teacherInstructionsEnabled:M,toolbarEditorPosition:K}=t||{},{teacherInstructions:P}=T;he("[render] model",t);const q={position:"top"===K?"top":"bottom"},B=u&&u.prompt,F=m&&m.prompt,L={responseType:b.settings&&_e(b.label,[D,R]),feedbackEnabled:p.settings&&be(p.label),promptEnabled:h.settings&&be(h.label),"language.enabled":S.settings&&be(S.label,!0),language:S.settings&&S.enabled&&Ce(w.label,w.options)},H={teacherInstructionsEnabled:E.settings&&be(E.label),studentInstructionsEnabled:f.settings&&be(f.label),rationaleEnabled:g.settings&&be(g.label),spellCheckEnabled:y.settings&&be(y.label),scoringType:_.settings&&_e(_.label,["auto","rubric"]),"ignoreOrder.enabled":d.settings&&be(d.label),"allowTrailingZeros.enabled":l.settings&&be(l.label),rubricEnabled:me([v,"optionalAccess",e=>e.settings])&&be(me([v,"optionalAccess",e=>e.label]))};return oe.createElement(pe.ConfigLayout,{extraCSSRules:I,dimensions:c,hideSettings:C,settings:oe.createElement(ge,{model:t,configuration:o,onChangeModel:e=>a(e),onChangeConfiguration:e=>s(e),groups:{Settings:L,Properties:H}})},M&&oe.createElement(de,{label:E.label,className:e.promptHolder},oe.createElement(ue,{className:e.prompt,markup:t.teacherInstructions||"",onChange:this.changeTeacherInstructions,imageSupport:n,nonEmpty:!1,error:P,toolbarOpts:q,pluginProps:O(me([E,"optionalAccess",e=>e.inputConfiguration]),r),spellCheck:j,maxImageWidth:u&&u.teacherInstructions||B,maxImageHeight:m&&m.teacherInstructions||F,uploadSoundSupport:i,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:x}),P&&oe.createElement("div",{className:e.errorText},P)),oe.createElement(ae,{imageSupport:n,uploadSoundSupport:i,model:t,configuration:o,onChange:this.onChange,rationaleEnabled:N,promptEnabled:k,toolbarOpts:q,spellCheck:j}),A&&oe.createElement(re,{feedback:t.feedback,onChange:this.onFeedbackChange,toolbarOpts:q}))}}ye.__initStatic();var fe=se((e=>({promptHolder:{width:"100%",paddingTop:2*e.spacing.unit,marginBottom:2*e.spacing.unit},errorText:{fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingTop:e.spacing.unit}})))(ye),Ee={};Object.defineProperty(Ee,"__esModule",{value:!0});class ve extends CustomEvent{constructor(e,t=!1){super(ve.TYPE,{bubbles:!0,detail:{update:e,reset:t}}),this.update=e,this.reset=t}}ve.TYPE="model.updated";var xe=Ee.ModelUpdatedEvent=ve;class Se extends CustomEvent{constructor(e,t){super(Se.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}Se.TYPE="delete.image";var we=Ee.DeleteImageEvent=Se;class Te extends CustomEvent{constructor(e){super(Te.TYPE,{bubbles:!0,detail:e}),this.handler=e}}Te.TYPE="insert.image";var Ie=Ee.InsertImageEvent=Te;class Ae extends CustomEvent{constructor(e,t){super(Ae.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}Ae.TYPE="delete.sound";var ke=Ee.DeleteSoundEvent=Ae;class Ne extends CustomEvent{constructor(e){super(Ne.TYPE,{bubbles:!0,detail:e}),this.handler=e}}Ne.TYPE="insert.sound";var Re=Ee.InsertSoundEvent=Ne,De={allowTrailingZerosDefault:!1,customKeys:[],equationEditor:"8",expression:"",feedback:{correct:{default:"Correct",type:"none"},incorrect:{default:"Incorrect",type:"none"},partial:{default:"Nearly",type:"none"}},feedbackEnabled:!1,ignoreOrderDefault:!1,partialScoring:!0,prompt:"",promptEnabled:!0,rationale:"",rationaleEnabled:!0,responseType:R,responses:[],scoringType:"auto",studentInstructionsEnabled:!0,teacherInstructions:"",teacherInstructionsEnabled:!0,toolbarEditorPosition:"bottom",validationDefault:"literal"},Oe={baseInputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1},textAlign:{disabled:!0},showParagraphs:{disabled:!1},separateParagraphs:{disabled:!0}},prompt:{settings:!0,label:"Prompt",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},feedback:{settings:!0,label:"Feedback"},responseType:{settings:!0,label:"Response type"},rationale:{settings:!0,label:"Rationale",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},settingsPanelDisabled:!1,spellCheck:{label:"Spellcheck",settings:!1,enabled:!0},scoringType:{settings:!1,label:"Scoring Type"},studentInstructions:{settings:!1,label:"Student Instructions"},teacherInstructions:{settings:!0,label:"Teacher Instructions",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},partialScoring:{settings:!1,label:"Allow Partial Scoring"},ignoreOrder:{settings:!1,label:"Ignore Order",enabled:!0},allowTrailingZeros:{settings:!1,label:"Allow Trailing Zeros",enabled:!0},maxImageWidth:{teacherInstructions:300,prompt:300,rationale:300},maxImageHeight:{teacherInstructions:300,prompt:300,rationale:300},withRubric:{settings:!1,label:"Add Rubric"},mathMlOptions:{mmlOutput:!1,mmlEditing:!1},language:{settings:!1,label:"Specify Language",enabled:!1},languageChoices:{label:"Language Choices",options:[]}};const je=e,Me=c,{isEmpty:Ke}=i;function Pe(e){let t,n=e[0],a=1;for(;a<e.length;){const o=e[a],s=e[a+1];if(a+=2,("optionalAccess"===o||"optionalCall"===o)&&null==n)return;"access"===o||"optionalAccess"===o?(t=n,n=s(n)):"call"!==o&&"optionalCall"!==o||(n=s(((...e)=>n.call(t,...e))),t=void 0)}return n}const qe=r("pie-elements:math-inline:configure");class Be extends HTMLElement{static __initStatic(){this.createDefaultModel=(e={})=>(Ke(e.responses)||(e.responses=e.responses.map((e=>({...e,validation:e.validation||De.validationDefault,allowTrailingZeros:e.allowTrailingZeros||De.allowTrailingZerosDefault,ignoreOrder:e.ignoreOrder||De.ignoreOrderDefault||!1})))),{...De,...e})}constructor(){super(),this._model=Be.createDefaultModel(),this._configuration=Oe}set model(e){this._model=Be.createDefaultModel(e),this._render()}set configuration(e){const t={...Oe,...e};this._configuration=t,Pe([t,"optionalAccess",e=>e.language,"optionalAccess",e=>e.enabled])?Pe([t,"optionalAccess",e=>e.languageChoices,"optionalAccess",e=>e.options,"optionalAccess",e=>e.length])&&(this._model.language=Pe([t,"optionalAccess",e=>e.languageChoices,"access",e=>e.options,"access",e=>e[0],"access",e=>e.value])):t.language.settings&&this._model.language?(this._configuration.language.enabled=!0,this._configuration.languageChoices.options&&this._configuration.languageChoices.options.length||(this._configuration.languageChoices.options=[]),this._configuration.languageChoices.options.find((e=>e.value===this._model.language))||this._configuration.languageChoices.options.push({value:this._model.language,label:this._model.language})):delete this._model.language,this._render()}onModelChanged(e){this._model=e,qe("[onModelChanged]: ",this._model),this._render(),this.dispatchEvent(new xe(this._model))}onConfigurationChanged(e){this._configuration=e,this._model&&this.onModelChanged(this._model),this._render()}insertImage(e){this.dispatchEvent(new Ie(e))}onDeleteImage(e,t){this.dispatchEvent(new we(e,t))}insertSound(e){this.dispatchEvent(new Re(e))}onDeleteSound(e,t){this.dispatchEvent(new ke(e,t))}_render(){if(this._model){const e=je.createElement(fe,{onModelChanged:this.onModelChanged.bind(this),onConfigurationChanged:this.onConfigurationChanged.bind(this),model:this._model,configuration:this._configuration,imageSupport:{add:this.insertImage.bind(this),delete:this.onDeleteImage.bind(this)},uploadSoundSupport:{add:this.insertSound.bind(this),delete:this.onDeleteSound.bind(this)}});Me.render(e,this)}}}Be.__initStatic();export{Be as default};
@@ -976,68 +976,41 @@ function isEmpty(value) {
976
976
 
977
977
  var isEmpty_1 = isEmpty;
978
978
 
979
- function _extends$1() {
980
- _extends$1 = Object.assign || function (target) {
981
- for (var i = 1; i < arguments.length; i++) {
982
- var source = arguments[i];
983
-
984
- for (var key in source) {
985
- if (Object.prototype.hasOwnProperty.call(source, key)) {
986
- target[key] = source[key];
987
- }
988
- }
989
- }
990
-
991
- return target;
992
- };
993
-
994
- return _extends$1.apply(this, arguments);
995
- }
996
-
997
979
  const defaults$1 = {
998
- correct: {
999
- type: 'default',
1000
- default: 'Correct',
1001
- custom: 'Correct'
1002
- },
1003
- incorrect: {
1004
- type: 'default',
1005
- default: 'Incorrect',
1006
- custom: 'Incorrect'
1007
- },
1008
- partial: {
1009
- type: 'default',
1010
- default: 'Nearly',
1011
- custom: 'Nearly'
1012
- },
980
+ correct: { type: 'default', default: 'Correct', custom: 'Correct' },
981
+ incorrect: { type: 'default', default: 'Incorrect', custom: 'Incorrect' },
982
+ partial: { type: 'default', default: 'Nearly', custom: 'Nearly' },
1013
983
  unanswered: {
1014
984
  type: 'default',
1015
985
  default: 'You have not entered a response',
1016
- custom: 'You have not entered a response'
1017
- }
986
+ custom: 'You have not entered a response',
987
+ },
1018
988
  };
1019
989
 
990
+ // TODO: should replace getFeedbackForCorrectness
1020
991
  /**
1021
992
  * Get feedback for correctness
1022
993
  * @param {'correct'|'incorrect'|'partial'} correctness
1023
994
  * @param {Feedback} feedback
1024
995
  */
1025
-
1026
996
  const getActualFeedbackForCorrectness = (correctness, feedback) => {
1027
- feedback = _extends$1({}, defaults$1, feedback); // normalize correctness
997
+ feedback = { ...defaults$1, ...feedback };
1028
998
 
999
+ // normalize correctness
1029
1000
  correctness = correctness === 'partially-correct' ? 'partial' : correctness;
1001
+
1030
1002
  const defaultFeedback = defaults$1[correctness] || {};
1031
1003
  const fb = feedback[correctness] || defaultFeedback;
1004
+
1032
1005
  return getActualFeedback(fb, defaultFeedback[fb.type || 'default']);
1033
- }; // TODO: should replace getFeedback
1006
+ };
1034
1007
 
1008
+ // TODO: should replace getFeedback
1035
1009
  /**
1036
1010
  * Get the feedback from a {FeedbackConfig}
1037
1011
  * @param {FeedbackConfig} feedback
1038
1012
  * @param {string} fallback
1039
1013
  */
1040
-
1041
1014
  const getActualFeedback = (feedback, fallback) => {
1042
1015
  if (!feedback || feedback.type === 'none') {
1043
1016
  return undefined;
@@ -1680,7 +1653,7 @@ function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) {
1680
1653
  function _createSuper$2(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$2(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
1681
1654
  function _isNativeReflectConstruct$2() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
1682
1655
  var checkedLoadedFor = {};
1683
- var Translator = function (_EventEmitter) {
1656
+ var Translator$1 = function (_EventEmitter) {
1684
1657
  _inherits(Translator, _EventEmitter);
1685
1658
  var _super = _createSuper$2(Translator);
1686
1659
  function Translator(services) {
@@ -3289,7 +3262,7 @@ var I18n = function (_EventEmitter) {
3289
3262
  s.i18nFormat = createClassOnDemand(this.modules.i18nFormat);
3290
3263
  if (s.i18nFormat.init) s.i18nFormat.init(this);
3291
3264
  }
3292
- this.translator = new Translator(this.services, this.options);
3265
+ this.translator = new Translator$1(this.services, this.options);
3293
3266
  this.translator.on('*', function (event) {
3294
3267
  for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
3295
3268
  args[_key2 - 1] = arguments[_key2];
@@ -3649,7 +3622,7 @@ var I18n = function (_EventEmitter) {
3649
3622
  clone.services.utils = {
3650
3623
  hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
3651
3624
  };
3652
- clone.translator = new Translator(clone.services, clone.options);
3625
+ clone.translator = new Translator$1(clone.services, clone.options);
3653
3626
  clone.translator.on('*', function (event) {
3654
3627
  for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
3655
3628
  args[_key4 - 1] = arguments[_key4];
@@ -3700,41 +3673,26 @@ instance.hasLoadedNamespace;
3700
3673
  instance.loadNamespaces;
3701
3674
  instance.loadLanguages;
3702
3675
 
3703
- function _extends() {
3704
- _extends = Object.assign || function (target) {
3705
- for (var i = 1; i < arguments.length; i++) {
3706
- var source = arguments[i];
3707
-
3708
- for (var key in source) {
3709
- if (Object.prototype.hasOwnProperty.call(source, key)) {
3710
- target[key] = source[key];
3711
- }
3712
- }
3713
- }
3714
-
3715
- return target;
3716
- };
3717
-
3718
- return _extends.apply(this, arguments);
3719
- }
3720
-
3721
3676
  var en = {
3722
3677
  translation: {
3723
3678
  categorize: {
3724
- limitMaxChoicesPerCategory: "You've reached the limit of {{maxChoicesPerCategory}} responses per area. To add another response, one must first be removed.",
3725
- maxChoicesPerCategoryRestriction: 'To change this value to {{maxChoicesPerCategory}}, each category must have {{maxChoicesPerCategory}} or fewer answer choice[s].'
3679
+ limitMaxChoicesPerCategory:
3680
+ "You've reached the limit of {{maxChoicesPerCategory}} responses per area. To add another response, one must first be removed.",
3681
+ maxChoicesPerCategoryRestriction:
3682
+ 'To change this value to {{maxChoicesPerCategory}}, each category must have {{maxChoicesPerCategory}} or fewer answer choice[s].',
3726
3683
  },
3727
3684
  ebsr: {
3728
- part: 'Part {{index}}'
3685
+ part: 'Part {{index}}',
3729
3686
  },
3730
3687
  numberLine: {
3731
3688
  addElementLimit_one: 'You can only add {{count}} element',
3732
3689
  addElementLimit_other: 'You can only add {{count}} elements',
3733
- clearAll: 'Clear all'
3690
+ clearAll: 'Clear all',
3734
3691
  },
3735
3692
  imageClozeAssociation: {
3736
- reachedLimit_one: 'You’ve reached the limit of {{count}} response per area. To add another response, one must first be removed.',
3737
- reachedLimit_other: 'Full'
3693
+ reachedLimit_one:
3694
+ 'You’ve reached the limit of {{count}} response per area. To add another response, one must first be removed.',
3695
+ reachedLimit_other: 'Full',
3738
3696
  },
3739
3697
  drawingResponse: {
3740
3698
  fillColor: 'Fill color',
@@ -3750,7 +3708,7 @@ var en = {
3750
3708
  green: 'Green',
3751
3709
  white: 'White',
3752
3710
  black: 'Black',
3753
- onDoubleClick: 'Double click to edit this text. Press Enter to submit.'
3711
+ onDoubleClick: 'Double click to edit this text. Press Enter to submit.',
3754
3712
  },
3755
3713
  charting: {
3756
3714
  addCategory: 'Add category',
@@ -3762,8 +3720,8 @@ var en = {
3762
3720
  keyLegend: {
3763
3721
  incorrectAnswer: 'Student incorrect answer',
3764
3722
  correctAnswer: 'Student correct answer',
3765
- correctKeyAnswer: 'Answer key correct'
3766
- }
3723
+ correctKeyAnswer: 'Answer key correct',
3724
+ },
3767
3725
  },
3768
3726
  graphing: {
3769
3727
  point: 'Point',
@@ -3779,24 +3737,25 @@ var en = {
3779
3737
  vector: 'Vector',
3780
3738
  label: 'Label',
3781
3739
  redo: 'Redo',
3782
- reset: 'Reset'
3740
+ reset: 'Reset',
3783
3741
  },
3784
3742
  mathInline: {
3785
- primaryCorrectWithAlternates: 'Note: The answer shown above is the primary correct answer specified by the author for this item, but other answers may also be recognized as correct.'
3743
+ primaryCorrectWithAlternates:
3744
+ 'Note: The answer shown above is the primary correct answer specified by the author for this item, but other answers may also be recognized as correct.',
3786
3745
  },
3787
3746
  multipleChoice: {
3788
3747
  minSelections: 'Select at least {{minSelections}}.',
3789
3748
  maxSelections_one: 'Only {{maxSelections}} answer is allowed.',
3790
3749
  maxSelections_other: 'Only {{maxSelections}} answers are allowed.',
3791
3750
  minmaxSelections_equal: 'Select {{minSelections}}.',
3792
- minmaxSelections_range: 'Select between {{minSelections}} and {{maxSelections}}.'
3751
+ minmaxSelections_range: 'Select between {{minSelections}} and {{maxSelections}}.',
3793
3752
  },
3794
3753
  selectText: {
3795
3754
  correctAnswerSelected: 'Correct',
3796
3755
  correctAnswerNotSelected: 'Correct Answer Not Selected',
3797
3756
  incorrectSelection: 'Incorrect Selection',
3798
- key: 'Key'
3799
- }
3757
+ key: 'Key',
3758
+ },
3800
3759
  },
3801
3760
  common: {
3802
3761
  undo: 'Undo',
@@ -3805,31 +3764,35 @@ var en = {
3805
3764
  incorrect: 'Incorrect',
3806
3765
  showCorrectAnswer: 'Show correct answer',
3807
3766
  hideCorrectAnswer: 'Hide correct answer',
3808
- commonCorrectAnswerWithAlternates: 'Note: The answer shown above is the most common correct answer for this item. One or more additional correct answers are also defined, and will also be recognized as correct.',
3767
+ commonCorrectAnswerWithAlternates:
3768
+ 'Note: The answer shown above is the most common correct answer for this item. One or more additional correct answers are also defined, and will also be recognized as correct.',
3809
3769
  warning: 'Warning',
3810
3770
  showNote: 'Show Note',
3811
3771
  hideNote: 'Hide Note',
3812
- cancel: 'Cancel'
3813
- }
3772
+ cancel: 'Cancel',
3773
+ },
3814
3774
  };
3815
3775
 
3816
3776
  var es = {
3817
3777
  translation: {
3818
3778
  categorize: {
3819
- limitMaxChoicesPerCategory: 'Has alcanzado el límite de {{maxChoicesPerCategory}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.',
3820
- maxChoicesPerCategoryRestriction: 'Para cambiar este valor a {{maxChoicesPerCategory}}, cada categoría debe tener {{maxChoicesPerCategory}} o menos opciones de respuesta'
3779
+ limitMaxChoicesPerCategory:
3780
+ 'Has alcanzado el límite de {{maxChoicesPerCategory}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.',
3781
+ maxChoicesPerCategoryRestriction:
3782
+ 'Para cambiar este valor a {{maxChoicesPerCategory}}, cada categoría debe tener {{maxChoicesPerCategory}} o menos opciones de respuesta',
3821
3783
  },
3822
3784
  ebsr: {
3823
- part: 'Parte {{index}}'
3785
+ part: 'Parte {{index}}',
3824
3786
  },
3825
3787
  numberLine: {
3826
3788
  addElementLimit_one: 'Solo puedes agregar {{count}} elemento',
3827
3789
  addElementLimit_other: 'Solo puedes agregar {{count}} elementos',
3828
- clearAll: 'Borrar todo'
3790
+ clearAll: 'Borrar todo',
3829
3791
  },
3830
3792
  imageClozeAssociation: {
3831
- reachedLimit_one: 'Has alcanzado el límite de {{count}} respuesta por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.',
3832
- reachedLimit_other: 'Lleno'
3793
+ reachedLimit_one:
3794
+ 'Has alcanzado el límite de {{count}} respuesta por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.',
3795
+ reachedLimit_other: 'Lleno',
3833
3796
  },
3834
3797
  drawingResponse: {
3835
3798
  fillColor: 'Color de relleno',
@@ -3845,7 +3808,7 @@ var es = {
3845
3808
  green: 'Verde',
3846
3809
  white: 'Blanco',
3847
3810
  black: 'Negro',
3848
- onDoubleClick: 'Haz doble clic para revisar este texto. Presiona el botón de ingreso para enviar'
3811
+ onDoubleClick: 'Haz doble clic para revisar este texto. Presiona el botón de ingreso para enviar',
3849
3812
  },
3850
3813
  charting: {
3851
3814
  addCategory: 'Añadir categoría',
@@ -3857,8 +3820,8 @@ var es = {
3857
3820
  keyLegend: {
3858
3821
  incorrectAnswer: 'Respuesta incorrecta del estudiante',
3859
3822
  correctAnswer: 'Respuesta correcta del estudiante',
3860
- correctKeyAnswer: 'Clave de respuesta correcta'
3861
- }
3823
+ correctKeyAnswer: 'Clave de respuesta correcta',
3824
+ },
3862
3825
  },
3863
3826
  graphing: {
3864
3827
  point: 'Punto',
@@ -3874,24 +3837,25 @@ var es = {
3874
3837
  vector: 'Vector',
3875
3838
  label: 'Etiqueta',
3876
3839
  redo: 'Rehacer',
3877
- reset: 'Reiniciar'
3840
+ reset: 'Reiniciar',
3878
3841
  },
3879
3842
  mathInline: {
3880
- primaryCorrectWithAlternates: 'Nota: La respuesta que se muestra arriba es la respuesta correcta principal especificada por el autor para esta pregunta, pero también se pueden reconocer otras respuestas como correctas.'
3843
+ primaryCorrectWithAlternates:
3844
+ 'Nota: La respuesta que se muestra arriba es la respuesta correcta principal especificada por el autor para esta pregunta, pero también se pueden reconocer otras respuestas como correctas.',
3881
3845
  },
3882
3846
  multipleChoice: {
3883
3847
  minSelections: 'Seleccione al menos {{minSelections}}.',
3884
3848
  maxSelections_one: 'Sólo se permite {{maxSelections}} respuesta.',
3885
3849
  maxSelections_other: 'Sólo se permiten {{maxSelections}} respuestas.',
3886
3850
  minmaxSelections_equal: 'Seleccione {{minSelections}}.',
3887
- minmaxSelections_range: 'Seleccione entre {{minSelections}} y {{maxSelections}}.'
3851
+ minmaxSelections_range: 'Seleccione entre {{minSelections}} y {{maxSelections}}.',
3888
3852
  },
3889
3853
  selectText: {
3890
3854
  correctAnswerSelected: 'Respuesta Correcta',
3891
3855
  correctAnswerNotSelected: 'Respuesta Correcta No Seleccionada',
3892
3856
  incorrectSelection: 'Selección Incorrecta',
3893
- key: 'Clave'
3894
- }
3857
+ key: 'Clave',
3858
+ },
3895
3859
  },
3896
3860
  common: {
3897
3861
  undo: 'Deshacer',
@@ -3900,12 +3864,13 @@ var es = {
3900
3864
  incorrect: 'Incorrect',
3901
3865
  showCorrectAnswer: 'Mostrar respuesta correcta',
3902
3866
  hideCorrectAnswer: 'Ocultar respuesta correcta',
3903
- commonCorrectAnswerWithAlternates: 'Nota: La respuesta que se muestra arriba es la respuesta correcta más común para esta pregunta. También se definen una o más respuestas correctas adicionales, y también se reconocerán como correctas.',
3867
+ commonCorrectAnswerWithAlternates:
3868
+ 'Nota: La respuesta que se muestra arriba es la respuesta correcta más común para esta pregunta. También se definen una o más respuestas correctas adicionales, y también se reconocerán como correctas.',
3904
3869
  warning: 'Advertencia',
3905
3870
  showNote: 'Mostrar Nota',
3906
3871
  hideNote: 'Ocultar Nota',
3907
- cancel: 'Cancelar'
3908
- }
3872
+ cancel: 'Cancelar',
3873
+ },
3909
3874
  };
3910
3875
 
3911
3876
  instance.init({
@@ -3914,15 +3879,15 @@ instance.init({
3914
3879
  debug: true,
3915
3880
  resources: {
3916
3881
  en: en,
3917
- es: es
3918
- }
3882
+ es: es,
3883
+ },
3919
3884
  });
3920
- var index = {
3921
- translator: _extends({}, instance, {
3885
+
3886
+ var Translator = {
3887
+ translator: {
3888
+ ...instance,
3922
3889
  t: (key, options) => {
3923
- const {
3924
- lng
3925
- } = options;
3890
+ const { lng } = options;
3926
3891
 
3927
3892
  switch (lng) {
3928
3893
  // these keys don't work with plurals, don't know why, so I added a workaround to convert them to the correct lng
@@ -3930,7 +3895,6 @@ var index = {
3930
3895
  case 'en-US':
3931
3896
  options.lng = 'en';
3932
3897
  break;
3933
-
3934
3898
  case 'es_ES':
3935
3899
  case 'es-ES':
3936
3900
  case 'es_MX':
@@ -3938,19 +3902,13 @@ var index = {
3938
3902
  options.lng = 'es';
3939
3903
  break;
3940
3904
  }
3941
-
3942
- return instance.t(key, _extends({
3943
- lng
3944
- }, options));
3945
- }
3946
- }),
3947
- languageOptions: [{
3948
- value: 'en_US',
3949
- label: 'English (US)'
3950
- }, {
3951
- value: 'es_ES',
3952
- label: 'Spanish'
3953
- }]
3905
+ return instance.t(key, { lng, ...options });
3906
+ },
3907
+ },
3908
+ languageOptions: [
3909
+ { value: 'en_US', label: 'English (US)' },
3910
+ { value: 'es_ES', label: 'Spanish' },
3911
+ ],
3954
3912
  };
3955
3913
 
3956
3914
  var defaults = {
@@ -3980,7 +3938,7 @@ var defaults = {
3980
3938
  validationDefault: 'literal',
3981
3939
  };
3982
3940
 
3983
- const { translator } = index;
3941
+ const { translator } = Translator;
3984
3942
 
3985
3943
  const log = debug();
3986
3944