@pie-element/multiple-choice 12.0.0-beta.0 → 12.0.0-next.0

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 (47) hide show
  1. package/CHANGELOG.md +0 -11
  2. package/configure/CHANGELOG.md +0 -11
  3. package/configure/lib/defaults.js +4 -1
  4. package/configure/lib/defaults.js.map +1 -1
  5. package/configure/lib/index.js +8 -8
  6. package/configure/lib/index.js.map +1 -1
  7. package/configure/lib/main.js +7 -7
  8. package/configure/lib/main.js.map +1 -1
  9. package/configure/lib/utils.js +1 -1
  10. package/configure/package.json +9 -9
  11. package/controller/CHANGELOG.md +0 -11
  12. package/controller/lib/defaults.js +1 -1
  13. package/controller/lib/index.js +6 -6
  14. package/controller/lib/index.js.map +1 -1
  15. package/controller/lib/utils.js +3 -4
  16. package/controller/lib/utils.js.map +1 -1
  17. package/controller/package.json +4 -4
  18. package/lib/choice-input.js +3 -3
  19. package/lib/choice-input.js.map +1 -1
  20. package/lib/choice.js +1 -1
  21. package/lib/feedback-tick.js +1 -1
  22. package/lib/index.js +5 -5
  23. package/lib/index.js.map +1 -1
  24. package/lib/main.js +1 -1
  25. package/lib/multiple-choice.js +1 -1
  26. package/lib/print.js +4 -5
  27. package/lib/print.js.map +1 -1
  28. package/lib/session-updater.js +1 -1
  29. package/module/configure.js +1 -0
  30. package/module/controller.js +2998 -0
  31. package/module/demo.js +86 -0
  32. package/module/element.js +1 -0
  33. package/module/index.html +21 -0
  34. package/module/manifest.json +14 -0
  35. package/module/print-demo.js +124 -0
  36. package/module/print.html +18 -0
  37. package/module/print.js +1 -0
  38. package/package.json +16 -12
  39. package/configure/lib/__tests__/root.test.js +0 -286
  40. package/controller/lib/__tests__/index.test.js +0 -520
  41. package/controller/lib/__tests__/utils.test.js +0 -8
  42. package/docs/demo/pie.manifest.json +0 -11
  43. package/lib/__tests__/choice-input-test.js +0 -49
  44. package/lib/__tests__/index-test.js +0 -200
  45. package/lib/__tests__/key-events-test.js +0 -95
  46. package/lib/__tests__/multiple-choice-test.js +0 -101
  47. package/lib/__tests__/session-updater-test.js +0 -70
package/lib/print.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"print.js","names":["_react","_interopRequireDefault","require","_client","_debounce","_cloneDeep","_main","_mathRendering","_debug","log","debug","preparePrintModel","model","opts","instr","role","prompt","promptEnabled","undefined","teacherInstructions","teacherInstructionsEnabled","showTeacherInstructions","alwaysShowCorrect","mode","disabled","animationsDisabled","lockChoiceOrder","choicesLayout","choices","cloneDeep","map","c","rationale","rationaleEnabled","hideTick","feedback","keyMode","choicePrefix","MultipleChoicePrint","HTMLElement","constructor","_options","_model","_session","_root","_rerender","debounce","printModel","element","React","createElement","Main","session","options","createRoot","render","queueMicrotask","renderMath","leading","trailing","o","s","connectedCallback","disconnectedCallback","unmount","exports","default"],"sources":["../src/print.js"],"sourcesContent":["import React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport debounce from 'lodash/debounce';\nimport cloneDeep from 'lodash/cloneDeep';\nimport Main from './main';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport debug from 'debug';\n\nconst log = debug('pie-element:multiple-choice:print');\n\n/**\n * Live in same package as main element - so we can access some of the shared comps!\n *\n * - update pslb to build print if src/print.js is there\n * - update demo el\n * - get configure/controller building\n */\n\nconst preparePrintModel = (model, opts) => {\n const instr = opts.role === 'instructor';\n\n model.prompt = model.promptEnabled !== false ? model.prompt : undefined;\n model.teacherInstructions =\n instr && model.teacherInstructionsEnabled !== false ? model.teacherInstructions : undefined;\n model.showTeacherInstructions = instr;\n model.alwaysShowCorrect = instr;\n model.mode = instr ? 'evaluate' : model.mode;\n\n model.disabled = true;\n model.animationsDisabled = true;\n model.lockChoiceOrder = true;\n model.choicesLayout = model.choicesLayout || 'vertical';\n\n const choices = cloneDeep(model.choices);\n\n model.choices = choices.map((c) => {\n c.rationale = instr && model.rationaleEnabled !== false ? c.rationale : undefined;\n c.hideTick = instr;\n c.feedback = undefined;\n return c;\n });\n\n model.keyMode = model.choicePrefix || 'letters';\n\n return model;\n};\n\nexport default class MultipleChoicePrint extends HTMLElement {\n constructor() {\n super();\n this._options = null;\n this._model = null;\n this._session = [];\n this._root = null;\n this._rerender = debounce(\n () => {\n if (this._model && this._session) {\n const printModel = preparePrintModel(this._model, this._options);\n\n const element =\n this._options &&\n React.createElement(Main, {\n model: printModel,\n session: {},\n options: this._options,\n });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(element);\n queueMicrotask(() => {\n log('render complete - render math');\n renderMath(this);\n });\n } else {\n log('skip');\n }\n },\n 50,\n { leading: false, trailing: true },\n );\n }\n set options(o) {\n this._options = o;\n }\n\n set model(s) {\n this._model = s;\n this._rerender();\n }\n\n connectedCallback() {}\n\n disconnectedCallback() {\n if (this._root) {\n this._root.unmount();\n }\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,UAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,KAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,cAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAP,sBAAA,CAAAC,OAAA;AAEA,MAAMO,GAAG,GAAG,IAAAC,cAAK,EAAC,mCAAmC,CAAC;;AAEtD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMC,iBAAiB,GAAGA,CAACC,KAAK,EAAEC,IAAI,KAAK;EACzC,MAAMC,KAAK,GAAGD,IAAI,CAACE,IAAI,KAAK,YAAY;EAExCH,KAAK,CAACI,MAAM,GAAGJ,KAAK,CAACK,aAAa,KAAK,KAAK,GAAGL,KAAK,CAACI,MAAM,GAAGE,SAAS;EACvEN,KAAK,CAACO,mBAAmB,GACvBL,KAAK,IAAIF,KAAK,CAACQ,0BAA0B,KAA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AE;QAChC,MAAMI,UAAU,GAAGpC,iBAAiB,CAAC,IAAI,CAAC+B,MAAM,EAAE,IAAI,CAACD,QAAQ,CAAC;QAEhE,MAAMO,OAAO,GACX,IAAI,CAACP,QAAQ,iBACbQ,cAAK,CAACC,aAAa,CAACC,aAAI,EAAE;UACxBvC,KAAK,EAAEmC,UAAU;UACjBK,OAAO,EAAE,CAAC,CAAC;UACXC,OAAO,EAAE,IAAI,CAACZ;QAChB,CAAC,CAAC;QAEJ,IAAI,CAAC,IAAI,CAACG,KAAK,EAAE;UACf,IAAI,CAACA,KAAK,GAAG,IAAAU,kBAAU,EAAC,IAAI,CAAC;QAC/B;QACA,IAAI,CAACV,KAAK,CAACW,MAAM,CAACP,OAAO,CAAC;QAC1BQ,cAAc,CAAC,MAAM;UACnB/C,GAAG,CAAC,+BAA+B,CAAC;UACpC,IAAAgD,yBAAU,EAAC,IAAI,CAAC;QAClB,CAAC,CAAC;MACJ,CAAC,MAAM;QACLhD,GAAG,CAAC,MAAM,CAAC;MACb;IACF,CAAC,EACD,EAAE,EACF;MAAEiD,OAAO,EAAE,KAAK;MAAEC,QAAQ,EAAE;IAAK,CACnC,CAAC;EACH;EACA,IAAIN,OAAOA,CAACO,CAAC,EAAE;IACb,IAAI,CAACnB,QAAQ,GAAGmB,CAAC;EACnB;EAEA,IAAIhD,KAAKA,CAACiD,CAAC,EAAE;IACX,IAAI,CAACnB,MAAM,GAAGmB,CAAC;IACf,IAAI,CAAChB,SAAS,CAAC,CAAC;EAClB;EAEAiB,iBAAiBA,CAAA,EAAG,CAAC;EAErBC,oBAAoBA,CAAA,EAAG;IACrB,IAAI,IAAI,CAACnB,KAAK,EAAE;MACd,IAAI,CAACA,KAAK,CAACoB,OAAO,CAAC,CAAC;IACtB;EACF;AACF;AAACC,OAAA,CAAAC,OAAA,GAAA5B,mBAAA","ignoreList":[]}
1
+ {"version":3,"file":"print.js","names":["_react","_interopRequireDefault","require","_client","_lodashEs","_main","_mathRendering","_debug","log","debug","preparePrintModel","model","opts","instr","role","prompt","promptEnabled","undefined","teacherInstructions","teacherInstructionsEnabled","showTeacherInstructions","alwaysShowCorrect","mode","disabled","animationsDisabled","lockChoiceOrder","choicesLayout","choices","cloneDeep","map","c","rationale","rationaleEnabled","hideTick","feedback","keyMode","choicePrefix","MultipleChoicePrint","HTMLElement","constructor","_options","_model","_session","_root","_rerender","debounce","printModel","element","React","createElement","Main","session","options","createRoot","render","queueMicrotask","renderMath","leading","trailing","o","s","connectedCallback","disconnectedCallback","unmount","exports","default"],"sources":["../src/print.js"],"sourcesContent":["import React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport { cloneDeep, debounce } from 'lodash-es';\nimport Main from './main';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport debug from 'debug';\n\nconst log = debug('pie-element:multiple-choice:print');\n\n/**\n * Live in same package as main element - so we can access some of the shared comps!\n *\n * - update pslb to build print if src/print.js is there\n * - update demo el\n * - get configure/controller building\n */\n\nconst preparePrintModel = (model, opts) => {\n const instr = opts.role === 'instructor';\n\n model.prompt = model.promptEnabled !== false ? model.prompt : undefined;\n model.teacherInstructions =\n instr && model.teacherInstructionsEnabled !== false ? model.teacherInstructions : undefined;\n model.showTeacherInstructions = instr;\n model.alwaysShowCorrect = instr;\n model.mode = instr ? 'evaluate' : model.mode;\n\n model.disabled = true;\n model.animationsDisabled = true;\n model.lockChoiceOrder = true;\n model.choicesLayout = model.choicesLayout || 'vertical';\n\n const choices = cloneDeep(model.choices);\n\n model.choices = choices.map((c) => {\n c.rationale = instr && model.rationaleEnabled !== false ? c.rationale : undefined;\n c.hideTick = instr;\n c.feedback = undefined;\n return c;\n });\n\n model.keyMode = model.choicePrefix || 'letters';\n\n return model;\n};\n\nexport default class MultipleChoicePrint extends HTMLElement {\n constructor() {\n super();\n this._options = null;\n this._model = null;\n this._session = [];\n this._root = null;\n this._rerender = debounce(\n () => {\n if (this._model && this._session) {\n const printModel = preparePrintModel(this._model, this._options);\n\n const element =\n this._options &&\n React.createElement(Main, {\n model: printModel,\n session: {},\n options: this._options,\n });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(element);\n queueMicrotask(() => {\n log('render complete - render math');\n renderMath(this);\n });\n } else {\n log('skip');\n }\n },\n 50,\n { leading: false, trailing: true },\n );\n }\n set options(o) {\n this._options = o;\n }\n\n set model(s) {\n this._model = s;\n this._rerender();\n }\n\n connectedCallback() {}\n\n disconnectedCallback() {\n if (this._root) {\n this._root.unmount();\n }\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAN,sBAAA,CAAAC,OAAA;AAEA,MAAMM,GAAG,GAAG,IAAAC,cAAK,EAAC,mCAAmC,CAAC;;AAEtD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMC,iBAAiB,GAAGA,CAACC,KAAK,EAAEC,IAAI,KAAK;EACzC,MAAMC,KAAK,GAAGD,IAAI,CAACE,IAAI,KAAK,YAAY;EAExCH,KAAK,CAACI,MAAM,GAAGJ,KAAK,CAACK,aAAa,KAAK,KAAK,GAAGL,KAAK,CAACI,MAAM,GAAGE,SAAS;EACvEN,KAAK,CAACO,mBAAmB,GACvBL,KAAK,IAAIF,KAAK,CAACQ,0BAA0B,KAAK,KAAK,GAAGR,KAAK,CAACO,mBAAmB,GAAGD,SAAS;EAC7FN,KAAK,CAACS,uBAAuB,GAAGP,KAAK;EACrCF,KAAK,CAACU,iBAAiB,GAAGR,KAAK;EAC/BF,KAAK,CAACW,IAAI,GAAGT,KAAK,GAAG,UAAU,GAAGF,KAAK,CAACW,IAAI;EAE5CX,KAAK,CAACY,QAAQ,GAAG,IAAI;EACrBZ,KAAK,CAACa,kBAAkB,GAA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B,CAAC,CAAC;QAEJ,IAAI,CAAC,IAAI,CAACG,KAAK,EAAE;UACf,IAAI,CAACA,KAAK,GAAG,IAAAU,kBAAU,EAAC,IAAI,CAAC;QAC/B;QACA,IAAI,CAACV,KAAK,CAACW,MAAM,CAACP,OAAO,CAAC;QAC1BQ,cAAc,CAAC,MAAM;UACnB/C,GAAG,CAAC,+BAA+B,CAAC;UACpC,IAAAgD,yBAAU,EAAC,IAAI,CAAC;QAClB,CAAC,CAAC;MACJ,CAAC,MAAM;QACLhD,GAAG,CAAC,MAAM,CAAC;MACb;IACF,CAAC,EACD,EAAE,EACF;MAAEiD,OAAO,EAAE,KAAK;MAAEC,QAAQ,EAAE;IAAK,CACnC,CAAC;EACH;EACA,IAAIN,OAAOA,CAACO,CAAC,EAAE;IACb,IAAI,CAACnB,QAAQ,GAAGmB,CAAC;EACnB;EAEA,IAAIhD,KAAKA,CAACiD,CAAC,EAAE;IACX,IAAI,CAACnB,MAAM,GAAGmB,CAAC;IACf,IAAI,CAAChB,SAAS,CAAC,CAAC;EAClB;EAEAiB,iBAAiBA,CAAA,EAAG,CAAC;EAErBC,oBAAoBA,CAAA,EAAG;IACrB,IAAI,IAAI,CAACnB,KAAK,EAAE;MACd,IAAI,CAACA,KAAK,CAACoB,OAAO,CAAC,CAAC;IACtB;EACF;AACF;AAACC,OAAA,CAAAC,OAAA,GAAA5B,mBAAA","ignoreList":[]}
@@ -34,4 +34,4 @@ function updateSessionMetadata(session, metadata) {
34
34
  session.waitTime = session.audioEndTime - session.audioStartTime;
35
35
  }
36
36
  }
37
- //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJ1cGRhdGVTZXNzaW9uVmFsdWUiLCJzZXNzaW9uIiwiY2hvaWNlTW9kZSIsImRhdGEiLCJ2YWx1ZSIsInNlbGVjdGVkIiwiQXJyYXkiLCJmcm9tIiwiU2V0IiwiZmlsdGVyIiwidiIsInNlbGVjdG9yIiwidXBk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BQVksR0FBR2QsT0FBTyxDQUFDYSxjQUFlO0VBQ3BFO0FBQ0YiLCJpZ25vcmVMaXN0IjpbXX0=
37
+ //# sourceMappingURL=session-updater.js.map
@@ -0,0 +1 @@
1
+ import{_dll_react_dom as e,_dll_react as t,_dll_prop_types as o,_dll_mui__material_styles as n,_dll_pie_lib__render_ui as i,_dll_mui__material as r,_dll_mui__icons_material as a,_dll_debug as s}from"../../../@pie-lib/shared-module@^4.0.1/module/index.js";import{_dll_pie_lib__config_ui as l}from"../../../@pie-lib/config-module@^3.0.1/module/index.js";import{_dll_pie_lib__editable_html_tip_tap as c}from"../../../@pie-lib/editable-html-module@^6.1.2/module/index.js";var u,d=e;u=d.createRoot,d.hydrateRoot;var h={};Object.defineProperty(h,"__esModule",{value:!0});class p extends CustomEvent{constructor(e,t=!1){super(p.TYPE,{bubbles:!0,detail:{update:e,reset:t}}),this.update=e,this.reset=t}}p.TYPE="model.updated";var g=h.ModelUpdatedEvent=p;class f extends CustomEvent{constructor(e,t){super(f.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}f.TYPE="delete.image";var b=h.DeleteImageEvent=f;class m extends CustomEvent{constructor(e){super(m.TYPE,{bubbles:!0,detail:e}),this.handler=e}}m.TYPE="insert.image";var _=h.InsertImageEvent=m;class C extends CustomEvent{constructor(e,t){super(C.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}C.TYPE="delete.sound";var y=h.DeleteSoundEvent=C;class v extends CustomEvent{constructor(e){super(v.TYPE,{bubbles:!0,detail:e}),this.handler=e}}v.TYPE="insert.sound";var E=h.InsertSoundEvent=v,j="object"==typeof global&&global&&global.Object===Object&&global,S="object"==typeof self&&self&&self.Object===Object&&self,A=j||S||Function("return this")(),x=A.Symbol,w=Object.prototype,O=w.hasOwnProperty,P=w.toString,k=x?x.toStringTag:void 0,I=Object.prototype.toString,M=x?x.toStringTag:void 0;function T(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":M&&M in Object(e)?function(e){var t=O.call(e,k),o=e[k];try{e[k]=void 0;var n=!0}catch(e){}var i=P.call(e);return n&&(t?e[k]=o:delete e[k]),i}(e):function(e){return I.call(e)}(e)}function R(e){return null!=e&&"object"==typeof e}var z=Array.isArray;function L(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function D(e){return e}function U(e){if(!L(e))return!1;var t=T(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var q,F=A["__core-js_shared__"],$=(q=/[^.]+$/.exec(F&&F.keys&&F.keys.IE_PROTO||""))?"Symbol(src)_1."+q:"",B=Function.prototype.toString,W=/^\[object .+?Constructor\]$/,Y=Function.prototype,H=Object.prototype,N=Y.toString,G=H.hasOwnProperty,V=RegExp("^"+N.call(G).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function J(e,t){var o=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!L(e)||(t=e,$&&$ in t))&&(U(e)?V:W).test(function(e){if(null!=e){try{return B.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e));var t}(o)?o:void 0}var K,Q,X,Z=Object.create,ee=function(){function e(){}return function(t){if(!L(t))return{};if(Z)return Z(t);e.prototype=t;var o=new e;return e.prototype=void 0,o}}(),te=Date.now,oe=function(){try{var e=J(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),ne=oe,ie=ne?function(e,t){return ne(e,"toString",{configurable:!0,enumerable:!1,value:(o=t,function(){return o}),writable:!0});var o}:D,re=(K=ie,Q=0,X=0,function(){var e=te(),t=16-(e-X);if(X=e,t>0){if(++Q>=800)return arguments[0]}else Q=0;return K.apply(void 0,arguments)}),ae=/^(?:0|[1-9]\d*)$/;function se(e,t){var o=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==o||"symbol"!=o&&ae.test(e))&&e>-1&&e%1==0&&e<t}function le(e,t,o){"__proto__"==t&&ne?ne(e,t,{configurable:!0,enumerable:!0,value:o,writable:!0}):e[t]=o}function ce(e,t){return e===t||e!=e&&t!=t}var ue=Object.prototype.hasOwnProperty;function de(e,t,o){var n=e[t];ue.call(e,t)&&ce(n,o)&&(void 0!==o||t in e)||le(e,t,o)}var he=Math.max;function pe(e,t){return re(function(e,t,o){return t=he(void 0===t?e.length-1:t,0),function(){for(var n=arguments,i=-1,r=he(n.length-t,0),a=Array(r);++i<r;)a[i]=n[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=n[i];return s[t]=o(a),function(e,t,o){switch(o.length){case 0:return e.call(t);case 1:return e.call(t,o[0]);case 2:return e.call(t,o[0],o[1]);case 3:return e.call(t,o[0],o[1],o[2])}return e.apply(t,o)}(e,this,s)}}(e,t,D),e+"")}function ge(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function fe(e){return null!=e&&ge(e.length)&&!U(e)}function be(e,t,o){if(!L(o))return!1;var n=typeof t;return!!("number"==n?fe(o)&&se(t,o.length):"string"==n&&t in o)&&ce(o[t],e)}var me=Object.prototype;function _e(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||me)}function Ce(e){return R(e)&&"[object Arguments]"==T(e)}var ye=Object.prototype,ve=ye.hasOwnProperty,Ee=ye.propertyIsEnumerable,je=Ce(function(){return arguments}())?Ce:function(e){return R(e)&&ve.call(e,"callee")&&!Ee.call(e,"callee")},Se="object"==typeof exports&&exports&&!exports.nodeType&&exports,Ae=Se&&"object"==typeof module&&module&&!module.nodeType&&module,xe=Ae&&Ae.exports===Se?A.Buffer:void 0,we=(xe?xe.isBuffer:void 0)||function(){return!1},Oe={};Oe["[object Float32Array]"]=Oe["[object Float64Array]"]=Oe["[object Int8Array]"]=Oe["[object Int16Array]"]=Oe["[object Int32Array]"]=Oe["[object Uint8Array]"]=Oe["[object Uint8ClampedArray]"]=Oe["[object Uint16Array]"]=Oe["[object Uint32Array]"]=!0,Oe["[object Arguments]"]=Oe["[object Array]"]=Oe["[object ArrayBuffer]"]=Oe["[object Boolean]"]=Oe["[object DataView]"]=Oe["[object Date]"]=Oe["[object Error]"]=Oe["[object Function]"]=Oe["[object Map]"]=Oe["[object Number]"]=Oe["[object Object]"]=Oe["[object RegExp]"]=Oe["[object Set]"]=Oe["[object String]"]=Oe["[object WeakMap]"]=!1;var Pe="object"==typeof exports&&exports&&!exports.nodeType&&exports,ke=Pe&&"object"==typeof module&&module&&!module.nodeType&&module,Ie=ke&&ke.exports===Pe&&j.process,Me=function(){try{return ke&&ke.require&&ke.require("util").types||Ie&&Ie.binding&&Ie.binding("util")}catch(e){}}(),Te=Me&&Me.isTypedArray,Re=Te?function(e){return function(t){return e(t)}}(Te):function(e){return R(e)&&ge(e.length)&&!!Oe[T(e)]},ze=Re,Le=Object.prototype.hasOwnProperty;var De=Object.prototype.hasOwnProperty;function Ue(e){return fe(e)?function(e,t){var o=z(e),n=!o&&je(e),i=!o&&!n&&we(e),r=!o&&!n&&!i&&ze(e),a=o||n||i||r,s=a?function(e,t){for(var o=-1,n=Array(e);++o<e;)n[o]=t(o);return n}(e.length,String):[],l=s.length;for(var c in e)!t&&!Le.call(e,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||r&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||se(c,l))||s.push(c);return s}(e,!0):function(e){if(!L(e))return function(e){var t=[];if(null!=e)for(var o in Object(e))t.push(o);return t}(e);var t=_e(e),o=[];for(var n in e)("constructor"!=n||!t&&De.call(e,n))&&o.push(n);return o}(e)}var qe=J(Object,"create"),Fe=Object.prototype.hasOwnProperty,$e=Object.prototype.hasOwnProperty;function Be(e){var t=-1,o=null==e?0:e.length;for(this.clear();++t<o;){var n=e[t];this.set(n[0],n[1])}}function We(e,t){for(var o=e.length;o--;)if(ce(e[o][0],t))return o;return-1}Be.prototype.clear=function(){this.__data__=qe?qe(null):{},this.size=0},Be.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Be.prototype.get=function(e){var t=this.__data__;if(qe){var o=t[e];return"__lodash_hash_undefined__"===o?void 0:o}return Fe.call(t,e)?t[e]:void 0},Be.prototype.has=function(e){var t=this.__data__;return qe?void 0!==t[e]:$e.call(t,e)},Be.prototype.set=function(e,t){var o=this.__data__;return this.size+=this.has(e)?0:1,o[e]=qe&&void 0===t?"__lodash_hash_undefined__":t,this};var Ye=Array.prototype.splice;function He(e){var t=-1,o=null==e?0:e.length;for(this.clear();++t<o;){var n=e[t];this.set(n[0],n[1])}}He.prototype.clear=function(){this.__data__=[],this.size=0},He.prototype.delete=function(e){var t=this.__data__,o=We(t,e);return!(o<0||(o==t.length-1?t.pop():Ye.call(t,o,1),--this.size,0))},He.prototype.get=function(e){var t=this.__data__,o=We(t,e);return o<0?void 0:t[o][1]},He.prototype.has=function(e){return We(this.__data__,e)>-1},He.prototype.set=function(e,t){var o=this.__data__,n=We(o,e);return n<0?(++this.size,o.push([e,t])):o[n][1]=t,this};var Ne=J(A,"Map");function Ge(e,t){var o,n,i=e.__data__;return("string"==(n=typeof(o=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==o:null===o)?i["string"==typeof t?"string":"hash"]:i.map}function Ve(e){var t=-1,o=null==e?0:e.length;for(this.clear();++t<o;){var n=e[t];this.set(n[0],n[1])}}Ve.prototype.clear=function(){this.size=0,this.__data__={hash:new Be,map:new(Ne||He),string:new Be}},Ve.prototype.delete=function(e){var t=Ge(this,e).delete(e);return this.size-=t?1:0,t},Ve.prototype.get=function(e){return Ge(this,e).get(e)},Ve.prototype.has=function(e){return Ge(this,e).has(e)},Ve.prototype.set=function(e,t){var o=Ge(this,e),n=o.size;return o.set(e,t),this.size+=o.size==n?0:1,this};var Je=function(e,t){return function(o){return e(t(o))}}(Object.getPrototypeOf,Object),Ke=Je,Qe=Function.prototype,Xe=Object.prototype,Ze=Qe.toString,et=Xe.hasOwnProperty,tt=Ze.call(Object);function ot(e){var t=this.__data__=new He(e);this.size=t.size}ot.prototype.clear=function(){this.__data__=new He,this.size=0},ot.prototype.delete=function(e){var t=this.__data__,o=t.delete(e);return this.size=t.size,o},ot.prototype.get=function(e){return this.__data__.get(e)},ot.prototype.has=function(e){return this.__data__.has(e)},ot.prototype.set=function(e,t){var o=this.__data__;if(o instanceof He){var n=o.__data__;if(!Ne||n.length<199)return n.push([e,t]),this.size=++o.size,this;o=this.__data__=new Ve(n)}return o.set(e,t),this.size=o.size,this};var nt="object"==typeof exports&&exports&&!exports.nodeType&&exports,it=nt&&"object"==typeof module&&module&&!module.nodeType&&module,rt=it&&it.exports===nt?A.Buffer:void 0,at=(rt&&rt.allocUnsafe,A.Uint8Array);var st=Object.prototype,lt=st.hasOwnProperty,ct=pe(function(e,t){e=Object(e);var o=-1,n=t.length,i=n>2?t[2]:void 0;for(i&&be(t[0],t[1],i)&&(n=1);++o<n;)for(var r=t[o],a=Ue(r),s=-1,l=a.length;++s<l;){var c=a[s],u=e[c];(void 0===u||ce(u,st[c])&&!lt.call(e,c))&&(e[c]=r[c])}return e});function ut(e,t,o){(void 0!==o&&!ce(e[t],o)||void 0===o&&!(t in e))&&le(e,t,o)}function dt(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}function ht(e,t,o,n,i,r,a){var s=dt(e,o),l=dt(t,o),c=a.get(l);if(c)ut(e,o,c);else{var u,d=r?r(s,l,o+"",e,t,a):void 0,h=void 0===d;if(h){var p=z(l),g=!p&&we(l),f=!p&&!g&&ze(l);d=l,p||g||f?z(s)?d=s:R(u=s)&&fe(u)?d=function(e,t){var o=-1,n=e.length;for(t||(t=Array(n));++o<n;)t[o]=e[o];return t}(s):g?(h=!1,d=function(e){return e.slice()}(l)):f?(h=!1,d=function(e,t){var o,n,i=t?(n=new(o=e.buffer).constructor(o.byteLength),new at(n).set(new at(o)),n):e.buffer;return new e.constructor(i,e.byteOffset,e.length)}(l,!0)):d=[]:function(e){if(!R(e)||"[object Object]"!=T(e))return!1;var t=Ke(e);if(null===t)return!0;var o=et.call(t,"constructor")&&t.constructor;return"function"==typeof o&&o instanceof o&&Ze.call(o)==tt}(l)||je(l)?(d=s,je(s)?d=function(e){return function(e,t,o){var n=!o;o||(o={});for(var i=-1,r=t.length;++i<r;){var a=t[i],s=void 0;void 0===s&&(s=e[a]),n?le(o,a,s):de(o,a,s)}return o}(e,Ue(e))}(s):L(s)&&!U(s)||(d=function(e){return"function"!=typeof e.constructor||_e(e)?{}:ee(Ke(e))}(l))):h=!1}h&&(a.set(l,d),i(d,l,n,r,a),a.delete(l)),ut(e,o,d)}}function pt(e,t,o,n,i){e!==t&&function(e,t,o){for(var n=-1,i=Object(e),r=o(e),a=r.length;a--;){var s=r[++n];if(!1===t(i[s],s,i))break}}(t,function(r,a){if(i||(i=new ot),L(r))ht(e,t,a,o,pt,n,i);else{var s=n?n(dt(e,a),r,a+"",e,t,i):void 0;void 0===s&&(s=r),ut(e,a,s)}},Ue)}var gt,ft=(gt=function(e,t,o){pt(e,t,o)},pe(function(e,t){var o=-1,n=t.length,i=n>1?t[n-1]:void 0,r=n>2?t[2]:void 0;for(i=gt.length>3&&"function"==typeof i?(n--,i):void 0,r&&be(t[0],t[1],r)&&(i=n<3?void 0:i,n=1),e=Object(e);++o<n;){var a=t[o];a&&gt(e,a,o)}return e}));const bt=t,mt=o,{styled:_t}=n,{color:Ct}=i,{Button:yt}=r,{Tooltip:vt}=r,{Typography:Et}=r,{Box:jt}=r,{Info:St}=a,At=c,{AlertDialog:xt}=l,{InputContainer:wt}=l,{ChoiceConfiguration:Ot}=l,{settings:Pt}=l,{layout:kt}=l,{choiceUtils:It}=l;function Mt(e){let t,o=e[0],n=1;for(;n<e.length;){const i=e[n],r=e[n+1];if(n+=2,("optionalAccess"===i||"optionalCall"===i)&&null==o)return;"access"===i||"optionalAccess"===i?(t=o,o=r(o)):"call"!==i&&"optionalCall"!==i||(o=r((...e)=>o.call(t,...e)),t=void 0)}return o}const{Panel:Tt,toggle:Rt,radio:zt,dropdown:Lt}=Pt,Dt=_t(wt)(({theme:e})=>({width:"100%",paddingTop:e.spacing(2),marginBottom:e.spacing(2)})),Ut=_t(wt)(({theme:e})=>({flex:1,marginTop:e.spacing(1.5),paddingTop:e.spacing(2),marginLeft:e.spacing(3.5)})),qt=_t(wt)(({theme:e})=>({display:"flex",flexDirection:"column",marginBottom:e.spacing(1),width:"100%"})),Ft=_t(yt)(({theme:e})=>({marginTop:e.spacing(1),float:"right"})),$t=_t(Ft)({cursor:"not-allowed",pointerEvents:"all",backgroundColor:Ct.disabled(),"&:hover":{backgroundColor:Ct.disabled()},"&:focus":{backgroundColor:Ct.disabled()}}),Bt=_t(jt)({display:"flex",alignItems:"center"}),Wt=_t(Et)(({theme:e})=>({fontSize:e.typography.fontSize+2,marginRight:e.spacing(1)})),Yt=_t(vt)(({theme:e})=>({"& .MuiTooltip-tooltip":{fontSize:e.typography.fontSize-2,whiteSpace:"pre",maxWidth:"500px"}})),Ht=_t("div")(({theme:e})=>({fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingTop:e.spacing(1)})),Nt=e=>{const{model:t,configuration:o,onPromptChanged:n,onChoiceChanged:i,onRemoveChoice:r,onAddChoice:a,imageSupport:s,uploadSoundSupport:l,onChangeModel:c,onConfigurationChanged:u,onTeacherInstructionsChanged:d}=e,{addChoiceButton:h={},contentDimensions:p={},feedback:g={},deleteChoice:f={},choiceMode:b={},choicePrefix:m={},partialScoring:_={},lockChoiceOrder:C={},teacherInstructions:y={},studentInstructions:v={},rationale:E={},scoringType:j={},sequentialChoiceLabels:S={},settingsPanelDisabled:A,choicesLayout:x,spellCheck:w={},gridColumns:O,maxImageWidth:P={},maxImageHeight:k={},prompt:I={},withRubric:M={},mathMlOptions:T={},language:R={},languageChoices:z={}}=o||{};let{maxAnswerChoices:L}=o||{};const{limitChoicesNumber:D,teacherInstructionsEnabled:U,rationaleEnabled:q,feedbackEnabled:F,promptEnabled:$,spellCheckEnabled:B,choices:W,errors:Y,toolbarEditorPosition:H,extraCSSRules:N}=t||{},{answerChoices:G,choices:V,correctResponse:J,prompt:K,rationale:Q,teacherInstructions:X}=Y||{},Z=Mt([W,"optionalAccess",e=>e.length])?Array.from({length:W.length},(e,t)=>`${t+1}`):[],{baseInputConfiguration:ee={}}=o,te={position:"top"===H?"top":"bottom"};D&&(L=9);const oe=(e={})=>({...ee,...e}),ne=(e=>{const{minAnswerChoices:t,maxAnswerChoices:o}=e;return`Validation requirements:\nThere should be at least ${t} `+(o?`and at most ${o} `:"")+"answer choices defined.\nEvery answer choice should be non-blank and unique.\nA correct answer must be defined."})(o),ie=P&&P.prompt,re=k&&k.prompt,ae=L&&Mt([W,"optionalAccess",e=>e.length])>=L?`Only ${L} allowed maximum`:"",se={choiceMode:b.settings&&zt(b.label,["checkbox","radio"]),"sequentialChoiceLabels.enabled":S.settings&&Rt(S.label,!0),choicePrefix:m.settings&&zt(m.label,["numbers","letters"]),partialScoring:_.settings&&Rt(_.label),lockChoiceOrder:C.settings&&Rt(C.label),feedbackEnabled:g.settings&&Rt(g.label),choicesLayout:x.settings&&Lt(x.label,["vertical","grid","horizontal"]),gridColumns:x.settings&&"grid"===t.choicesLayout&&Z.length>0&&Lt(O.label,Z),"language.enabled":R.settings&&Rt(R.label,!0),language:R.settings&&R.enabled&&Lt(z.label,z.options)},le={teacherInstructionsEnabled:y.settings&&Rt(y.label),studentInstructionsEnabled:v.settings&&Rt(v.label),promptEnabled:I.settings&&Rt(I.label),rationaleEnabled:E.settings&&Rt(E.label),spellCheckEnabled:w.settings&&Rt(w.label),scoringType:j.settings&&zt(j.label,["auto","rubric"]),rubricEnabled:Mt([M,"optionalAccess",e=>e.settings])&&Rt(Mt([M,"optionalAccess",e=>e.label]))};return bt.createElement(kt.ConfigLayout,{dimensions:p,hideSettings:A,extraCSSRules:N,classes:{},settings:bt.createElement(Tt,{model:t,onChangeModel:c,configuration:o,onChangeConfiguration:u,groups:{Settings:se,Properties:le}})},U&&bt.createElement(Dt,{label:y.label},bt.createElement(At,{markup:t.teacherInstructions||"",onChange:d,imageSupport:s,nonEmpty:!1,disableUnderline:!0,error:X,toolbarOpts:te,pluginProps:oe(Mt([o,"optionalAccess",e=>e.teacherInstructions,"optionalAccess",e=>e.inputConfiguration])),spellCheck:B,maxImageWidth:P&&P.teacherInstructions||ie,maxImageHeight:k&&k.teacherInstructions||re,uploadSoundSupport:l,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:T}),X&&bt.createElement(Ht,null,X)),$&&bt.createElement(Dt,{label:I.label},bt.createElement(At,{markup:t.prompt,onChange:n,imageSupport:s,nonEmpty:!1,disableUnderline:!0,error:K,toolbarOpts:te,pluginProps:oe(Mt([o,"optionalAccess",e=>e.prompt,"optionalAccess",e=>e.inputConfiguration])),spellCheck:B,maxImageWidth:P&&P.prompt,maxImageHeight:k&&k.prompt,uploadSoundSupport:l,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:T}),K&&bt.createElement(Ht,null,K)),bt.createElement(Bt,null,bt.createElement(Wt,{component:"div"},"Choices"),bt.createElement(Yt,{disableFocusListener:!0,disableTouchListener:!0,placement:"right",title:ne},bt.createElement(St,{fontSize:"small",color:"primary"}))),W.map((e,n)=>bt.createElement(qt,{key:`choice-${n}`},bt.createElement(Ot,{key:n,index:n+1,useLetterOrdering:"letters"===t.choicePrefix,mode:t.choiceMode,data:e,defaultFeedback:{},imageSupport:s,disableImageAlignmentButtons:!0,onDelete:()=>r(n),onChange:e=>i(n,e),allowFeedBack:F,allowDelete:f.settings,noLabels:!0,pluginOpts:oe(Mt([o,"optionalAccess",e=>e.choices,"optionalAccess",e=>e.inputConfiguration])),toolbarOpts:te,spellCheck:B,error:Mt([V,"optionalAccess",t=>t[e.value]])||null,noCorrectAnswerError:J,maxImageWidth:P&&P.choices||ie,maxImageHeight:k&&k.choices||re,uploadSoundSupport:l,mathMlOptions:T}),q&&bt.createElement(Ut,{key:`rationale-${n}`,label:E.label},bt.createElement(At,{markup:e.rationale||"",onChange:t=>i(n,{...e,rationale:t}),imageSupport:s,error:Mt([Q,"optionalAccess",t=>t[e.value]])||null,toolbarOpts:te,pluginProps:oe(Mt([o,"optionalAccess",e=>e.rationale,"optionalAccess",e=>e.inputConfiguration])),spellCheck:B,maxImageWidth:P&&P.rationale||ie,maxImageHeight:k&&k.rationale||re,uploadSoundSupport:l,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:T}),Mt([Q,"optionalAccess",t=>t[e.value]])&&bt.createElement(Ht,null,Mt([Q,"optionalAccess",t=>t[e.value]]))))),J&&bt.createElement(Ht,null,J),G&&bt.createElement(Ht,null,G),h.settings&&bt.createElement(Yt,{title:ae},L&&Mt([W,"optionalAccess",e=>e.length])>=L?bt.createElement($t,{variant:"contained",color:"primary",onClick:a,disabled:!0},h.label):bt.createElement(Ft,{variant:"contained",color:"primary",onClick:a},h.label)))};class Gt extends bt.Component{constructor(...e){super(...e),Gt.prototype.__init.call(this),Gt.prototype.__init2.call(this),Gt.prototype.__init3.call(this),Gt.prototype.__init4.call(this),Gt.prototype.__init5.call(this),Gt.prototype.__init6.call(this),Gt.prototype.__init7.call(this)}static __initStatic(){this.propTypes={model:mt.object.isRequired,configuration:mt.object.isRequired,disableSidePanel:mt.bool,onModelChanged:mt.func.isRequired,onConfigurationChanged:mt.func.isRequired,imageSupport:mt.shape({add:mt.func.isRequired,delete:mt.func.isRequired})}}__init(){this.state={showWarning:!1}}__init2(){this.onRemoveChoice=e=>{const{model:t,configuration:o,onModelChanged:n}=this.props,{minAnswerChoices:i}=o||{};i&&t.choices.length===i?this.setState({showWarning:!0}):(t.choices.splice(e,1),n(t))}}__init3(){this.onAddChoice=()=>{const{model:e,configuration:t,onModelChanged:o}=this.props;let{maxAnswerChoices:n}=t||{};const{limitChoicesNumber:i}=e||{};i&&(n=9),n&&e.choices.length>=n||(e.choices.push({label:"",value:It.firstAvailableIndex(e.choices.map(e=>e.value),0),feedback:{type:"none"}}),o(e))}}__init4(){this.onChoiceChanged=(e,t)=>{const{model:o,onModelChanged:n}=this.props;t.correct&&"radio"===o.choiceMode&&(o.choices=o.choices.map(e=>ft({},e,{correct:!1}))),o.choices.splice(e,1,t),n(o)}}__init5(){this.onPromptChanged=e=>{this.props.onModelChanged({...this.props.model,prompt:e})}}__init6(){this.onTeacherInstructionsChanged=e=>{this.props.onModelChanged({...this.props.model,teacherInstructions:e})}}__init7(){this.onModelChanged=(e,t)=>{const{onModelChanged:o}=this.props;if("choiceMode"===t){if("radio"===e.choiceMode){let t=!1;e.choices=e.choices.map(e=>t?(e.correct=!1,e):(e.correct&&(t=!0),e))}o(e,!0)}else o(e)}}render(){const{configuration:{minAnswerChoices:e}={}}=this.props,{showWarning:t}=this.state;return bt.createElement(bt.Fragment,null,bt.createElement(xt,{open:t,title:"Warning",text:`There can't be less than ${e||0} choices.`,onConfirm:()=>this.setState({showWarning:!1})}),bt.createElement(Nt,{...this.props,onChangeModel:this.onModelChanged,onRemoveChoice:this.onRemoveChoice,onChoiceChanged:this.onChoiceChanged,onAddChoice:this.onAddChoice,onPromptChanged:this.onPromptChanged,onTeacherInstructionsChanged:this.onTeacherInstructionsChanged}))}}Gt.__initStatic();var Vt={choiceMode:"checkbox",choicePrefix:"letters",choices:[],choicesLayout:"vertical",feedbackEnabled:!1,gridColumns:2,lockChoiceOrder:!0,partialScoring:!0,prompt:"",promptEnabled:!0,rationale:"",rationaleEnabled:!0,scoringType:"auto",studentInstructionsEnabled:!0,teacherInstructions:"",teacherInstructionsEnabled:!0,toolbarEditorPosition:"bottom",selectedAnswerBackgroundColor:"initial",keyboardEventsEnabled:!1},Jt={baseInputConfiguration:{h3:{disabled:!0},audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1},textAlign:{disabled:!0},showParagraphs:{disabled:!1},separateParagraphs:{disabled:!0}},choices:{inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}}},spellCheck:{label:"Spellcheck",settings:!1,enabled:!0},choicesLayout:{settings:!1,label:"Choices Layout"},gridColumns:{label:"Grid columns"},answerChoiceCount:0,addChoiceButton:{settings:!0,label:"Add a Choice"},choiceMode:{settings:!0,label:"Response Type"},choicePrefix:{settings:!0,label:"Choice Labels"},deleteChoice:{settings:!0},feedback:{settings:!0,label:"Feedback"},prompt:{settings:!0,label:"Prompt",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},lockChoiceOrder:{settings:!0,label:"Lock Choice Order"},partialScoring:{settings:!1,label:"Allow Partial Scoring"},rationale:{settings:!0,label:"Rationale",inputConfiguration:{audio:{disabled:!0},video:{disabled:!0},image:{disabled:!1}},required:!1},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},toolbarEditorPosition:{settings:!1,label:"Toolbar Editor Position"},minAnswerChoices:2,maxAnswerChoices:5,maxImageWidth:{teacherInstructions:300,prompt:300,rationale:636,choices:900},maxImageHeight:{teacherInstructions:300,prompt:300,rationale:300,choices: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 Kt=t,Qt=s,{choiceUtils:Xt}=l;function Zt(e){let t,o=e[0],n=1;for(;n<e.length;){const i=e[n],r=e[n+1];if(n+=2,("optionalAccess"===i||"optionalCall"===i)&&null==o)return;"access"===i||"optionalAccess"===i?(t=o,o=r(o)):"call"!==i&&"optionalCall"!==i||(o=r((...e)=>o.call(t,...e)),t=void 0)}return o}const eo=Qt("multiple-choice:configure"),to=(e,t=0)=>{if(!e||0===e.length){let e=[];for(let o=0;o<t;o++)e.push({value:`${o}`,label:"",feedback:{type:"none",value:""}});return e}return e},oo=(e,t)=>{const o=ct(e,Jt);return{configuration:o,model:{...t,choices:to(t&&t.choices||[],o&&o.answerChoiceCount)}}};class no extends HTMLElement{static __initStatic(){this.createDefaultModel=(e={})=>{const t=Xt.normalizeChoices({...Vt,...e,choices:to(e&&e.choices||[])});return t.choicesLayout=e.choicesLayout||!1===e.verticalMode&&"horizontal"||Vt.choicesLayout,t}}constructor(){super(),this._root=null,this._reactContainer=null,this._model=no.createDefaultModel(),this._configuration=Jt,this.onModelChanged=this.onModelChanged.bind(this),this.onConfigurationChanged=this.onConfigurationChanged.bind(this)}set model(e){this._model=no.createDefaultModel(e),this._render()}set configuration(e){const t=oo(e,this._model);this.onModelChanged(t.model);const o={...Jt,...t.configuration};this._configuration=o,Zt([o,"optionalAccess",e=>e.language,"optionalAccess",e=>e.enabled])?Zt([o,"optionalAccess",e=>e.languageChoices,"optionalAccess",e=>e.options,"optionalAccess",e=>e.length])&&(this._model.language=Zt([o,"optionalAccess",e=>e.languageChoices,"access",e=>e.options,"access",e=>e[0],"access",e=>e.value])):o.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()}set disableSidePanel(e){this._disableSidePanel=e,this._render()}dispatchModelUpdated(e){const t=!!e;this.dispatchEvent(new g(this._model,t))}onModelChanged(e,t){this._model=e,this._render(),this.dispatchModelUpdated(t)}onConfigurationChanged(e){this._configuration=oo(e,this._model).configuration,this._model&&this.onModelChanged(this._model),this._render()}insertImage(e){this.dispatchEvent(new _(e))}onDeleteImage(e,t){this.dispatchEvent(new b(e,t))}insertSound(e){this.dispatchEvent(new E(e))}onDeleteSound(e,t){this.dispatchEvent(new y(e,t))}_render(){console.log("🔧 [multiple-choice-configure] _render - Starting render"),console.log("🔧 [multiple-choice-configure] _render - Model:",this._model?"present":"missing"),console.log("🔧 [multiple-choice-configure] _render - Configuration:",this._configuration?"present":"missing"),console.log("🔧 [multiple-choice-configure] _render - Root exists:",!!this._root),eo("_render - Starting render"),eo("_render - Model:",this._model?"present":"missing"),eo("_render - Configuration:",this._configuration?"present":"missing"),eo("_render - Root exists:",!!this._root);try{let e=Kt.createElement(Gt,{model:this._model,configuration:this._configuration,onModelChanged:this.onModelChanged,onConfigurationChanged:this.onConfigurationChanged,disableSidePanel:this._disableSidePanel,imageSupport:{add:this.insertImage.bind(this),delete:this.onDeleteImage.bind(this)},uploadSoundSupport:{add:this.insertSound.bind(this),delete:this.onDeleteSound.bind(this)}});this._root||(console.log("🔧 [multiple-choice-configure] _render - Creating React container"),eo("_render - Creating React container"),this._reactContainer=document.createElement("div"),this._reactContainer.className="pie-configure-wrapper",this.appendChild(this._reactContainer),console.log("🔧 [multiple-choice-configure] _render - Creating new React root"),eo("_render - Creating new React root"),this._root=u(this._reactContainer),console.log("✅ [multiple-choice-configure] _render - React root created successfully"),eo("_render - React root created successfully")),console.log("🔧 [multiple-choice-configure] _render - Calling root.render()"),eo("_render - Calling root.render()"),this._root.render(e),console.log("✅ [multiple-choice-configure] _render - Render completed successfully"),eo("_render - Render completed successfully")}catch(e){throw console.error("❌ [multiple-choice-configure] Render error:",e),console.error("Error stack:",e.stack),e}}connectedCallback(){console.log("🔧 [multiple-choice-configure] connectedCallback - Component connected to DOM"),eo("connectedCallback - Component connected to DOM"),eo("connectedCallback - Model:",this._model?"present":"missing"),eo("connectedCallback - Configuration:",this._configuration?"present":"missing")}disconnectedCallback(){console.log("🔧 [multiple-choice-configure] disconnectedCallback - Component disconnected from DOM"),eo("disconnectedCallback - Component disconnected from DOM"),this._root&&(console.log("🔧 [multiple-choice-configure] disconnectedCallback - Unmounting React root"),eo("disconnectedCallback - Unmounting React root"),this._root.unmount(),this._root=null),this._reactContainer&&(this._reactContainer=null)}}no.__initStatic();export{no as default};